summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2003-11-18 21:22:57 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2003-11-18 21:22:57 +0000
commit1abe91b1db3777cfb5ed135baa33e16c7744abfd (patch)
tree41fbff7437dc55eab52e797ec43524ae21dece2c /gas
parent5659daa1d9d69b21490a7624abaa6f88e9e33f31 (diff)
downloadbinutils-gdb-1abe91b1db3777cfb5ed135baa33e16c7744abfd.tar.gz
* config/tc-mips.c (macro): Handle new macros: "lca" and "dlca"
for loading addresses using CALL relocations. Don't emit CALL relocations when a base register is used. * gas/mips/lca-svr4pic.d: New test for the "lca" macro. * gas/mips/lca-xgot.d: Likewise. * gas/mips/lca.s: Source for the new tests. * gas/mips/mips.exp: Run the new tests. * opcode/mips.h: Define new enum members, M_LCA_AB and M_DLCA_AB. * mips-opc.c (mips_builtin_opcodes): Handle new macros: "lca" and "dlca".
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-mips.c27
-rw-r--r--gas/testsuite/ChangeLog7
-rw-r--r--gas/testsuite/gas/mips/lca-svr4pic.d472
-rw-r--r--gas/testsuite/gas/mips/lca-xgot.d616
-rw-r--r--gas/testsuite/gas/mips/lca.s111
-rw-r--r--gas/testsuite/gas/mips/mips.exp2
7 files changed, 1233 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 0219720e160..2195b9ee73f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2003-11-18 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * config/tc-mips.c (macro): Handle new macros: "lca" and "dlca"
+ for loading addresses using CALL relocations.
+ Don't emit CALL relocations when a base register is used.
+
2003-11-15 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* config/tc-mips.c: Formatting fixes.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index ae9625acaa7..75f81074dbb 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -4010,6 +4010,7 @@ macro (struct mips_cl_insn *ip)
int coproc = 0;
int lr = 0;
int imm = 0;
+ int call = 0;
offsetT maxnum;
int off;
bfd_reloc_code_real_type r;
@@ -4774,9 +4775,15 @@ macro (struct mips_cl_insn *ip)
macro_build (NULL, &icnt, NULL, s2, "d", dreg);
return;
+ case M_DLCA_AB:
+ dbl = 1;
+ case M_LCA_AB:
+ call = 1;
+ goto do_la;
case M_DLA_AB:
dbl = 1;
case M_LA_AB:
+ do_la:
/* Load the address of a symbol into a register. If breg is not
zero, we then add a base register to it. */
@@ -4956,7 +4963,7 @@ macro (struct mips_cl_insn *ip)
/* If this is a reference to an external symbol, and there
is no constant, we want
lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_GOT16)
- or if tempreg is PIC_CALL_REG
+ or for lca or if tempreg is PIC_CALL_REG
lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_CALL16)
For a local symbol, we want
lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_GOT16)
@@ -4986,7 +4993,8 @@ macro (struct mips_cl_insn *ip)
expr1.X_add_number = offset_expr.X_add_number;
offset_expr.X_add_number = 0;
frag_grow (32);
- if (expr1.X_add_number == 0 && tempreg == PIC_CALL_REG)
+ if (expr1.X_add_number == 0 && breg == 0
+ && (call || tempreg == PIC_CALL_REG))
lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16;
macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)",
tempreg, lw_reloc_type, mips_gp_register);
@@ -5082,7 +5090,7 @@ macro (struct mips_cl_insn *ip)
constant, or local symbol (*), with or without a
constant, we want
lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_GOT_DISP)
- or if tempreg is PIC_CALL_REG
+ or for lca or if tempreg is PIC_CALL_REG
lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_CALL16)
If we have a small constant, and this is a reference to
@@ -5102,7 +5110,8 @@ macro (struct mips_cl_insn *ip)
instruction. */
frag_grow (28);
- if (offset_expr.X_add_number == 0 && tempreg == PIC_CALL_REG)
+ if (offset_expr.X_add_number == 0 && breg == 0
+ && (call || tempreg == PIC_CALL_REG))
lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16;
if (offset_expr.X_add_number)
{
@@ -5206,7 +5215,7 @@ macro (struct mips_cl_insn *ip)
lui $tempreg,<sym> (BFD_RELOC_MIPS_GOT_HI16)
addu $tempreg,$tempreg,$gp
lw $tempreg,<sym>($tempreg) (BFD_RELOC_MIPS_GOT_LO16)
- or if tempreg is PIC_CALL_REG
+ or for lca or if tempreg is PIC_CALL_REG
lui $tempreg,<sym> (BFD_RELOC_MIPS_CALL_HI16)
addu $tempreg,$tempreg,$gp
lw $tempreg,<sym>($tempreg) (BFD_RELOC_MIPS_CALL_LO16)
@@ -5249,7 +5258,8 @@ macro (struct mips_cl_insn *ip)
gpdel = 4;
else
gpdel = 0;
- if (expr1.X_add_number == 0 && tempreg == PIC_CALL_REG)
+ if (expr1.X_add_number == 0 && breg == 0
+ && (call || tempreg == PIC_CALL_REG))
{
lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16;
lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16;
@@ -5410,7 +5420,7 @@ macro (struct mips_cl_insn *ip)
lui $tempreg,<sym> (BFD_RELOC_MIPS_GOT_HI16)
add $tempreg,$tempreg,$gp
lw $tempreg,<sym>($tempreg) (BFD_RELOC_MIPS_GOT_LO16)
- or if tempreg is PIC_CALL_REG
+ or for lca or if tempreg is PIC_CALL_REG
lui $tempreg,<sym> (BFD_RELOC_MIPS_CALL_HI16)
add $tempreg,$tempreg,$gp
lw $tempreg,<sym>($tempreg) (BFD_RELOC_MIPS_CALL_LO16)
@@ -5442,7 +5452,8 @@ macro (struct mips_cl_insn *ip)
expr1.X_add_number = offset_expr.X_add_number;
offset_expr.X_add_number = 0;
- if (expr1.X_add_number == 0 && tempreg == PIC_CALL_REG)
+ if (expr1.X_add_number == 0 && breg == 0
+ && (call || tempreg == PIC_CALL_REG))
{
lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16;
lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16;
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 9d21c630572..e3aec5b7c8b 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2003-11-18 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * gas/mips/lca-svr4pic.d: New test for the "lca" macro.
+ * gas/mips/lca-xgot.d: Likewise.
+ * gas/mips/lca.s: Source for the new tests.
+ * gas/mips/mips.exp: Run the new tests.
+
2003-11-14 Nick Clifton <nickc@redhat.com>
* gas/arm/arm7.d: Pass -D instead of -d to objdump in order to
diff --git a/gas/testsuite/gas/mips/lca-svr4pic.d b/gas/testsuite/gas/mips/lca-svr4pic.d
new file mode 100644
index 00000000000..730ecdde5d5
--- /dev/null
+++ b/gas/testsuite/gas/mips/lca-svr4pic.d
@@ -0,0 +1,472 @@
+#objdump: -dr --prefix-addresses -mmips:3000
+#name: MIPS lca-svr4pic
+#as: -32 -mips1 -KPIC --defsym KPIC=1
+#source: lca.s
+
+# Test the lca macro with -KPIC.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+[0-9a-f]+ <[^>]*> li a0,0
+[0-9a-f]+ <[^>]*> li a0,1
+[0-9a-f]+ <[^>]*> li a0,0x8000
+[0-9a-f]+ <[^>]*> li a0,-32768
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> ori a0,a0,0xa5a5
+[0-9a-f]+ <[^>]*> addiu a0,a1,0
+[0-9a-f]+ <[^>]*> addiu a0,a1,1
+[0-9a-f]+ <[^>]*> li a0,0x8000
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> addiu a0,a1,-32768
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> ori a0,a0,0xa5a5
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_CALL16 big_external_data_label
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_CALL16 small_external_data_label
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_CALL16 big_external_common
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_CALL16 small_external_common
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1001
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-22131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1001
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-22131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+ ...
diff --git a/gas/testsuite/gas/mips/lca-xgot.d b/gas/testsuite/gas/mips/lca-xgot.d
new file mode 100644
index 00000000000..e40ec555c14
--- /dev/null
+++ b/gas/testsuite/gas/mips/lca-xgot.d
@@ -0,0 +1,616 @@
+#objdump: -dr --prefix-addresses -mmips:3000
+#name: MIPS lca-xgot
+#as: -32 -mips1 -KPIC -xgot --defsym KPIC=1
+#source: lca.s
+
+# Test the lca macro with -KPIC -xgot.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+[0-9a-f]+ <[^>]*> li a0,0
+[0-9a-f]+ <[^>]*> li a0,1
+[0-9a-f]+ <[^>]*> li a0,0x8000
+[0-9a-f]+ <[^>]*> li a0,-32768
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> ori a0,a0,0xa5a5
+[0-9a-f]+ <[^>]*> addiu a0,a1,0
+[0-9a-f]+ <[^>]*> addiu a0,a1,1
+[0-9a-f]+ <[^>]*> li a0,0x8000
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> addiu a0,a1,-32768
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x1
+[0-9a-f]+ <[^>]*> ori a0,a0,0xa5a5
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_CALL_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_CALL_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_CALL_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_CALL_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_CALL_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_CALL_LO16 big_external_common
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_CALL_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_CALL_LO16 small_external_common
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1001
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-22131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,1001
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-32768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu a0,a0,-31768
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,0
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x1
+[0-9a-f]+ <[^>]*> addiu at,at,1000
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .data
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .data
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lui a0,0x0
+[ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common
+[0-9a-f]+ <[^>]*> addu a0,a0,gp
+[0-9a-f]+ <[^>]*> lw a0,0\(a0\)
+[ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-23131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+[0-9a-f]+ <[^>]*> lw a0,0\(gp\)
+[ ]*[0-9a-f]+: R_MIPS_GOT16 .bss
+[0-9a-f]+ <[^>]*> lui at,0x2
+[0-9a-f]+ <[^>]*> addiu at,at,-22131
+[ ]*[0-9a-f]+: R_MIPS_LO16 .bss
+[0-9a-f]+ <[^>]*> addu a0,a0,at
+[0-9a-f]+ <[^>]*> addu a0,a0,a1
+ ...
diff --git a/gas/testsuite/gas/mips/lca.s b/gas/testsuite/gas/mips/lca.s
new file mode 100644
index 00000000000..086c8f968ad
--- /dev/null
+++ b/gas/testsuite/gas/mips/lca.s
@@ -0,0 +1,111 @@
+# Source file used to test the lca macro.
+
+ .data
+data_label:
+ .extern big_external_data_label,1000
+ .extern small_external_data_label,1
+ .comm big_external_common,1000
+ .comm small_external_common,1
+ .lcomm big_local_common,1000
+ .lcomm small_local_common,1
+
+ .text
+ lca $4,0
+ lca $4,1
+ lca $4,0x8000
+ lca $4,-0x8000
+ lca $4,0x10000
+ lca $4,0x1a5a5
+ lca $4,0($5)
+ lca $4,1($5)
+ lca $4,0x8000($5)
+ lca $4,-0x8000($5)
+ lca $4,0x10000($5)
+ lca $4,0x1a5a5($5)
+ lca $4,data_label
+ lca $4,big_external_data_label
+ lca $4,small_external_data_label
+ lca $4,big_external_common
+ lca $4,small_external_common
+ lca $4,big_local_common
+ lca $4,small_local_common
+ lca $4,data_label+1
+ lca $4,big_external_data_label+1
+ lca $4,small_external_data_label+1
+ lca $4,big_external_common+1
+ lca $4,small_external_common+1
+ lca $4,big_local_common+1
+ lca $4,small_local_common+1
+ lca $4,data_label+0x8000
+ lca $4,big_external_data_label+0x8000
+ lca $4,small_external_data_label+0x8000
+ lca $4,big_external_common+0x8000
+ lca $4,small_external_common+0x8000
+ lca $4,big_local_common+0x8000
+ lca $4,small_local_common+0x8000
+ lca $4,data_label-0x8000
+ lca $4,big_external_data_label-0x8000
+ lca $4,small_external_data_label-0x8000
+ lca $4,big_external_common-0x8000
+ lca $4,small_external_common-0x8000
+ lca $4,big_local_common-0x8000
+ lca $4,small_local_common-0x8000
+ lca $4,data_label+0x10000
+ lca $4,big_external_data_label+0x10000
+ lca $4,small_external_data_label+0x10000
+ lca $4,big_external_common+0x10000
+ lca $4,small_external_common+0x10000
+ lca $4,big_local_common+0x10000
+ lca $4,small_local_common+0x10000
+ lca $4,data_label+0x1a5a5
+ lca $4,big_external_data_label+0x1a5a5
+ lca $4,small_external_data_label+0x1a5a5
+ lca $4,big_external_common+0x1a5a5
+ lca $4,small_external_common+0x1a5a5
+ lca $4,big_local_common+0x1a5a5
+ lca $4,small_local_common+0x1a5a5
+ lca $4,data_label($5)
+ lca $4,big_external_data_label($5)
+ lca $4,small_external_data_label($5)
+ lca $4,big_external_common($5)
+ lca $4,small_external_common($5)
+ lca $4,big_local_common($5)
+ lca $4,small_local_common($5)
+ lca $4,data_label+1($5)
+ lca $4,big_external_data_label+1($5)
+ lca $4,small_external_data_label+1($5)
+ lca $4,big_external_common+1($5)
+ lca $4,small_external_common+1($5)
+ lca $4,big_local_common+1($5)
+ lca $4,small_local_common+1($5)
+ lca $4,data_label+0x8000($5)
+ lca $4,big_external_data_label+0x8000($5)
+ lca $4,small_external_data_label+0x8000($5)
+ lca $4,big_external_common+0x8000($5)
+ lca $4,small_external_common+0x8000($5)
+ lca $4,big_local_common+0x8000($5)
+ lca $4,small_local_common+0x8000($5)
+ lca $4,data_label-0x8000($5)
+ lca $4,big_external_data_label-0x8000($5)
+ lca $4,small_external_data_label-0x8000($5)
+ lca $4,big_external_common-0x8000($5)
+ lca $4,small_external_common-0x8000($5)
+ lca $4,big_local_common-0x8000($5)
+ lca $4,small_local_common-0x8000($5)
+ lca $4,data_label+0x10000($5)
+ lca $4,big_external_data_label+0x10000($5)
+ lca $4,small_external_data_label+0x10000($5)
+ lca $4,big_external_common+0x10000($5)
+ lca $4,small_external_common+0x10000($5)
+ lca $4,big_local_common+0x10000($5)
+ lca $4,small_local_common+0x10000($5)
+ lca $4,data_label+0x1a5a5($5)
+ lca $4,big_external_data_label+0x1a5a5($5)
+ lca $4,small_external_data_label+0x1a5a5($5)
+ lca $4,big_external_common+0x1a5a5($5)
+ lca $4,small_external_common+0x1a5a5($5)
+ lca $4,big_local_common+0x1a5a5($5)
+ lca $4,small_local_common+0x1a5a5($5)
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .space 8
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 865b580005e..c4fd0c744b5 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -463,6 +463,8 @@ if { [istarget mips*-*-*] } then {
# Not sure when it first cropped up, but may be related to addition of
# "la" -> "addiu" pattern in MIPS opcode table long ago.
if $ecoff { run_dump_test "la-empic" }
+ if $elf { run_dump_test "lca-svr4pic" }
+ if $elf { run_dump_test "lca-xgot" }
if !$aout {
# XXX FIXME: Has mips2 and later insns with mips1 disassemblies.
# (Should split and then use appropriate arch lists.)