PR ld/21375: MIPS: Add test cases for undefined weaks resolving to zero
authorMaciej W. Rozycki <macro@mips.com>
Fri, 14 Sep 2018 19:22:57 +0000 (20:22 +0100)
committerMaciej W. Rozycki <macro@linux-mips.org>
Fri, 14 Sep 2018 19:22:57 +0000 (20:22 +0100)
Define a new procedure, `run_mips_undefweak_test', and use it to iterate
over several scenarios involving undefined weak symbols resolving to
zero, verifying expected regular MIPS, MIPS16 and microMIPS code, GOT
and dynamic symbol table generation, as well as the setting of the
EI_ABIVERSION field in the ELF file header.  In particular ensure that
symbol versioning works and that `__gnu_absolute_zero' gets assigned a
version (any will do) even if it has not been listed for exportation in
a linker version script.

ld/
PR ld/21375
* testsuite/ld-mips-elf/pr21375-abi.hd: New test.
* testsuite/ld-mips-elf/pr21375-noabi.hd: New test.
* testsuite/ld-mips-elf/pr21375.dd: New test.
* testsuite/ld-mips-elf/pr21375h.dd: New test.
* testsuite/ld-mips-elf/pr21375p.dd: New test.
* testsuite/ld-mips-elf/pr21375ph.dd: New test.
* testsuite/ld-mips-elf/pr21375s.dd: New test.
* testsuite/ld-mips-elf/pr21375s-n32.dd: New test.
* testsuite/ld-mips-elf/pr21375s-n64.dd: New test.
* testsuite/ld-mips-elf/pr21375sh.dd: New test.
* testsuite/ld-mips-elf/pr21375sh-n32.dd: New test.
* testsuite/ld-mips-elf/pr21375sh-n64.dd: New test.
* testsuite/ld-mips-elf/pr21375shg.dd: New test.
* testsuite/ld-mips-elf/pr21375sx.dd: New test.
* testsuite/ld-mips-elf/pr21375sxh.dd: New test.
* testsuite/ld-mips-elf/pr21375sm16.dd: New test.
* testsuite/ld-mips-elf/pr21375sm16h.dd: New test.
* testsuite/ld-mips-elf/pr21375su.dd: New test.
* testsuite/ld-mips-elf/pr21375su-n32.dd: New test.
* testsuite/ld-mips-elf/pr21375su-n64.dd: New test.
* testsuite/ld-mips-elf/pr21375suh.dd: New test.
* testsuite/ld-mips-elf/pr21375suh-n32.dd: New test.
* testsuite/ld-mips-elf/pr21375suh-n64.dd: New test.
* testsuite/ld-mips-elf/pr21375sux.dd: New test.
* testsuite/ld-mips-elf/pr21375suxh.dd: New test.
* testsuite/ld-mips-elf/pr21375.gd: New test.
* testsuite/ld-mips-elf/pr21375h.gd: New test.
* testsuite/ld-mips-elf/pr21375p.gd: New test.
* testsuite/ld-mips-elf/pr21375ph.gd: New test.
* testsuite/ld-mips-elf/pr21375s.gd: New test.
* testsuite/ld-mips-elf/pr21375s-n32.gd: New test.
* testsuite/ld-mips-elf/pr21375s-n64.gd: New test.
* testsuite/ld-mips-elf/pr21375sh.gd: New test.
* testsuite/ld-mips-elf/pr21375sh-n32.gd: New test.
* testsuite/ld-mips-elf/pr21375sh-n64.gd: New test.
* testsuite/ld-mips-elf/pr21375shg.gd: New test.
* testsuite/ld-mips-elf/pr21375shl.gd: New test.
* testsuite/ld-mips-elf/pr21375shv.gd: New test.
* testsuite/ld-mips-elf/pr21375sx.gd: New test.
* testsuite/ld-mips-elf/pr21375sxh.gd: New test.
* testsuite/ld-mips-elf/pr21375.sd: New test.
* testsuite/ld-mips-elf/pr21375-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375h.sd: New test.
* testsuite/ld-mips-elf/pr21375h-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375p.sd: New test.
* testsuite/ld-mips-elf/pr21375p-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375ph.sd: New test.
* testsuite/ld-mips-elf/pr21375ph-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375s.sd: New test.
* testsuite/ld-mips-elf/pr21375s-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375s-n32.sd: New test.
* testsuite/ld-mips-elf/pr21375s-n32-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375s-n64.sd: New test.
* testsuite/ld-mips-elf/pr21375s-n64-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375sh.sd: New test.
* testsuite/ld-mips-elf/pr21375sh-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375sh-n32.sd: New test.
* testsuite/ld-mips-elf/pr21375sh-n32-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375sh-n64.sd: New test.
* testsuite/ld-mips-elf/pr21375sh-n64-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375shg.sd: New test.
* testsuite/ld-mips-elf/pr21375shg-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375shl.sd: New test.
* testsuite/ld-mips-elf/pr21375shl-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375shv.sd: New test.
* testsuite/ld-mips-elf/pr21375shv-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375sx.sd: New test.
* testsuite/ld-mips-elf/pr21375sx-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375sxh.sd: New test.
* testsuite/ld-mips-elf/pr21375sxh-irix.sd: New test.
* testsuite/ld-mips-elf/pr21375.ld: New test linker script.
* testsuite/ld-mips-elf/pr21375-xgot.ld: New test linker script.
* testsuite/ld-mips-elf/pr21375.ver: New test version script.
* testsuite/ld-mips-elf/pr21375v.ver: New test version script.
* testsuite/ld-mips-elf/pr21375.s: New test source.
* testsuite/ld-mips-elf/pr21375-mips16.s: New test source.
* testsuite/ld-mips-elf/pr21375-n32.s: New test source.
* testsuite/ld-mips-elf/pr21375-n64.s: New test source.
* testsuite/ld-mips-elf/pr21375-xgot.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp (run_mips_undefweak_test):
New procedure; run the new tests.

81 files changed:
ld/ChangeLog
ld/testsuite/ld-mips-elf/mips-elf.exp
ld/testsuite/ld-mips-elf/pr21375-abi.hd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375-mips16.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375-n32.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375-n64.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375-noabi.hd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375-xgot.ld [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375-xgot.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375.ld [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375.ver [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375h-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375h.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375h.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375h.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375p-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375p.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375p.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375p.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375ph-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375ph.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375ph.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375ph.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n32-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n32.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n32.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n32.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n64-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n64.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n64.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s-n64.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375s.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n32-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n32.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n32.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n32.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n64-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n64.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n64.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh-n64.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sh.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shg-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shg.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shg.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shg.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shl-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shl.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shl.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shv-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shv.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375shv.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sm16.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sm16h.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375su-n32.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375su-n64.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375su.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375suh-n32.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375suh-n64.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375suh.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sux.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375suxh.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sx-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sx.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sx.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sx.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sxh-irix.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sxh.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sxh.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375sxh.sd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/pr21375v.ver [new file with mode: 0644]

index f4f1d2e..ad224ab 100644 (file)
@@ -1,6 +1,91 @@
 2018-09-14  Maciej W. Rozycki  <macro@mips.com>
 
        PR ld/21375
+       * testsuite/ld-mips-elf/pr21375-abi.hd: New test.
+       * testsuite/ld-mips-elf/pr21375-noabi.hd: New test.
+       * testsuite/ld-mips-elf/pr21375.dd: New test.
+       * testsuite/ld-mips-elf/pr21375h.dd: New test.
+       * testsuite/ld-mips-elf/pr21375p.dd: New test.
+       * testsuite/ld-mips-elf/pr21375ph.dd: New test.
+       * testsuite/ld-mips-elf/pr21375s.dd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n32.dd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n64.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sh.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n32.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n64.dd: New test.
+       * testsuite/ld-mips-elf/pr21375shg.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sx.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sxh.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sm16.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sm16h.dd: New test.
+       * testsuite/ld-mips-elf/pr21375su.dd: New test.
+       * testsuite/ld-mips-elf/pr21375su-n32.dd: New test.
+       * testsuite/ld-mips-elf/pr21375su-n64.dd: New test.
+       * testsuite/ld-mips-elf/pr21375suh.dd: New test.
+       * testsuite/ld-mips-elf/pr21375suh-n32.dd: New test.
+       * testsuite/ld-mips-elf/pr21375suh-n64.dd: New test.
+       * testsuite/ld-mips-elf/pr21375sux.dd: New test.
+       * testsuite/ld-mips-elf/pr21375suxh.dd: New test.
+       * testsuite/ld-mips-elf/pr21375.gd: New test.
+       * testsuite/ld-mips-elf/pr21375h.gd: New test.
+       * testsuite/ld-mips-elf/pr21375p.gd: New test.
+       * testsuite/ld-mips-elf/pr21375ph.gd: New test.
+       * testsuite/ld-mips-elf/pr21375s.gd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n32.gd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n64.gd: New test.
+       * testsuite/ld-mips-elf/pr21375sh.gd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n32.gd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n64.gd: New test.
+       * testsuite/ld-mips-elf/pr21375shg.gd: New test.
+       * testsuite/ld-mips-elf/pr21375shl.gd: New test.
+       * testsuite/ld-mips-elf/pr21375shv.gd: New test.
+       * testsuite/ld-mips-elf/pr21375sx.gd: New test.
+       * testsuite/ld-mips-elf/pr21375sxh.gd: New test.
+       * testsuite/ld-mips-elf/pr21375.sd: New test.
+       * testsuite/ld-mips-elf/pr21375-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375h.sd: New test.
+       * testsuite/ld-mips-elf/pr21375h-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375p.sd: New test.
+       * testsuite/ld-mips-elf/pr21375p-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375ph.sd: New test.
+       * testsuite/ld-mips-elf/pr21375ph-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375s.sd: New test.
+       * testsuite/ld-mips-elf/pr21375s-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n32.sd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n32-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n64.sd: New test.
+       * testsuite/ld-mips-elf/pr21375s-n64-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sh.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n32.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n32-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n64.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sh-n64-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375shg.sd: New test.
+       * testsuite/ld-mips-elf/pr21375shg-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375shl.sd: New test.
+       * testsuite/ld-mips-elf/pr21375shl-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375shv.sd: New test.
+       * testsuite/ld-mips-elf/pr21375shv-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sx.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sx-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sxh.sd: New test.
+       * testsuite/ld-mips-elf/pr21375sxh-irix.sd: New test.
+       * testsuite/ld-mips-elf/pr21375.ld: New test linker script.
+       * testsuite/ld-mips-elf/pr21375-xgot.ld: New test linker script.
+       * testsuite/ld-mips-elf/pr21375.ver: New test version script.
+       * testsuite/ld-mips-elf/pr21375v.ver: New test version script.
+       * testsuite/ld-mips-elf/pr21375.s: New test source.
+       * testsuite/ld-mips-elf/pr21375-mips16.s: New test source.
+       * testsuite/ld-mips-elf/pr21375-n32.s: New test source.
+       * testsuite/ld-mips-elf/pr21375-n64.s: New test source.
+       * testsuite/ld-mips-elf/pr21375-xgot.s: New test source.
+       * testsuite/ld-mips-elf/mips-elf.exp (run_mips_undefweak_test):
+       New procedure; run the new tests.
+
+2018-09-14  Maciej W. Rozycki  <macro@mips.com>
+
+       PR ld/21375
        * emultempl/mipself.em: Set `gnu_target' according to ${target}.
        (mips_create_output_section_statements): Update call to
        `_bfd_mips_elf_linker_flags'.
index 7e8ef69..d429810 100644 (file)
@@ -1437,3 +1437,195 @@ run_dump_test "mips-abiflags-2r"
 
 # Test that _gp_disp symbol is not present in symbol tables.
 run_dump_test_o32 "gp-disp-sym"
+
+# PR ld/21375 undefined weak PIC references.
+proc run_mips_undefweak_test { name abi args } {
+    global abi_asflags
+    global abi_ldflags
+    global irixemul
+
+    set name "PR ld/21375 in $name"
+
+    set pic 0
+    set abisuf -noabi
+    set srcsuf ""
+    set scrsuf ""
+    set binsuf ""
+    set dsosuf ""
+    set objsuf ""
+    set rdesuf ""
+    set asxtra ""
+    set ldxtra ""
+    foreach arg $args {
+       switch -- $arg {
+           dso {
+               set pic 1
+               set dsosuf .so
+               append objsuf s
+               append rdesuf s
+               append ldxtra " -shared"
+           }
+           gc {
+               set abisuf -noabi
+               append binsuf g
+               append objsuf g
+               append rdesuf g
+               append ldxtra " --gc-sections"
+           }
+           hidden {
+               if { $pic && [istarget "*-*-*gnu*"] } { set abisuf -abi }
+               append binsuf h
+               append objsuf h
+               append rdesuf h
+               append asxtra " --defsym hidn=1"
+           }
+           internal {
+               if { $pic && [istarget "*-*-*gnu*"] } { set abisuf -abi }
+               append binsuf h
+               append objsuf h
+               append rdesuf h
+               append asxtra " --defsym intr=1"
+           }
+           local {
+               append binsuf l
+               append rdesuf l
+               append ldxtra " --version-script pr21375.ver"
+           }
+           mips16 {
+               set srcsuf -mips16
+               append binsuf m16
+               append objsuf m16
+               append asxtra " -mips16"
+           }
+           pie {
+               set pic 1
+               set dsosuf -pie
+               append objsuf p
+               append rdesuf p
+               append ldxtra " -pie"
+           }
+           protected {
+               if { $pic && [istarget "*-*-*gnu*"] } { set abisuf -abi }
+               append binsuf h
+               append objsuf h
+               append rdesuf h
+               append asxtra " --defsym prot=1"
+           }
+           umips {
+               append binsuf u
+               append objsuf u
+               append asxtra " -mmicromips"
+           }
+           version {
+               append binsuf v
+               append rdesuf v
+               append ldxtra " --version-script pr21375v.ver"
+           }
+           xgot {
+               set srcsuf -xgot
+               set scrsuf -xgot
+               append binsuf x
+               append objsuf x
+               append rdesuf x
+           }
+       }
+    }
+    switch -- $abi {
+       n32 {
+           set srcsuf -n32
+           append binsuf -n32
+           append objsuf -n32
+           append rdesuf -n32
+       }
+       n64 {
+           set srcsuf -n64
+           append binsuf -n64
+           append objsuf -n64
+           append rdesuf -n64
+       }
+    }
+    if $irixemul {
+       set irixsuf -irix
+    } else {
+       set irixsuf ""
+    }
+
+    if { $pic && ![check_shared_lib_support] } {
+       unsupported "$name"
+    } else {
+       run_ld_link_tests [list \
+           [list \
+               "$name" \
+               "$abi_ldflags($abi) -e foo -T pr21375${scrsuf}.ld ${ldxtra}" \
+               "" \
+               "$abi_asflags($abi) ${asxtra}" \
+               [list pr21375${srcsuf}.s] \
+               [list \
+                   [list objdump -d pr21375${objsuf}.dd] \
+                   [list readelf -A pr21375${rdesuf}.gd] \
+                   [list readelf --dyn-syms pr21375${rdesuf}${irixsuf}.sd] \
+                   [list readelf -h pr21375${abisuf}.hd]] \
+               "pr21375${binsuf}${dsosuf}"]]
+    }
+}
+
+if $has_abi(o32) {
+    run_mips_undefweak_test "SVR4 executable" \
+                                                   o32
+    run_mips_undefweak_test "SVR4 executable (hidden)" \
+                                                   o32 hidden
+    run_mips_undefweak_test "PIE executable" \
+                                                   o32 pie
+    run_mips_undefweak_test "PIE executable (hidden)" \
+                                                   o32 pie hidden
+    run_mips_undefweak_test "shared library" \
+                                                   o32 dso
+    run_mips_undefweak_test "shared library (hidden)" \
+                                                   o32 dso hidden
+    run_mips_undefweak_test "shared library (hidden, forced local)" \
+                                                   o32 dso hidden local
+    run_mips_undefweak_test "shared library (hidden, versioned)" \
+                                                   o32 dso hidden version
+    run_mips_undefweak_test "shared library (hidden, section GC)" \
+                                                   o32 dso hidden gc
+    run_mips_undefweak_test "shared library (protected)" \
+                                                   o32 dso protected
+    run_mips_undefweak_test "shared library (internal)" \
+                                                   o32 dso internal
+    run_mips_undefweak_test "shared library (large GOT)" \
+                                                   o32 dso xgot
+    run_mips_undefweak_test "shared library (large GOT, hidden)" \
+                                                   o32 dso xgot hidden
+    run_mips_undefweak_test "shared library (MIPS16)" \
+                                                   o32 dso mips16
+    run_mips_undefweak_test "shared library (MIPS16, hidden)" \
+                                                   o32 dso mips16 hidden
+    run_mips_undefweak_test "shared library (microMIPS)" \
+                                                   o32 dso umips
+    run_mips_undefweak_test "shared library (microMIPS, hidden)" \
+                                                   o32 dso umips hidden
+    run_mips_undefweak_test "shared library (microMIPS, large GOT)" \
+                                                   o32 dso umips xgot
+    run_mips_undefweak_test "shared library (microMIPS, large GOT, hidden)" \
+                                                   o32 dso umips xgot hidden
+}
+if $has_abi(n32) {
+    run_mips_undefweak_test "shared library (n32)" \
+                                                   n32 dso
+    run_mips_undefweak_test "shared library (n32, hidden)" \
+                                                   n32 dso hidden
+    run_mips_undefweak_test "shared library (n32, microMIPS)" \
+                                                   n32 dso umips
+    run_mips_undefweak_test "shared library (n32, microMIPS, hidden)" \
+                                                   n32 dso umips hidden
+}
+if $has_abi(n64) {
+    run_mips_undefweak_test "shared library (n64)" \
+                                                   n64 dso
+    run_mips_undefweak_test "shared library (n64, hidden)" \
+                                                   n64 dso hidden
+    run_mips_undefweak_test "shared library (n64, microMIPS)" \
+                                                   n64 dso umips
+    run_mips_undefweak_test "shared library (n64, microMIPS, hidden)" \
+                                                   n64 dso umips hidden
+}
diff --git a/ld/testsuite/ld-mips-elf/pr21375-abi.hd b/ld/testsuite/ld-mips-elf/pr21375-abi.hd
new file mode 100644 (file)
index 0000000..7e27fa1
--- /dev/null
@@ -0,0 +1,4 @@
+ELF Header:
+#...
+ +ABI Version: +4
+#pass
diff --git a/ld/testsuite/ld-mips-elf/pr21375-irix.sd b/ld/testsuite/ld-mips-elf/pr21375-irix.sd
new file mode 100644 (file)
index 0000000..996cee9
--- /dev/null
@@ -0,0 +1 @@
+# Empty.
diff --git a/ld/testsuite/ld-mips-elf/pr21375-mips16.s b/ld/testsuite/ld-mips-elf/pr21375-mips16.s
new file mode 100644 (file)
index 0000000..33b35a3
--- /dev/null
@@ -0,0 +1,63 @@
+       .abicalls
+       .set    noreorder
+
+       .type   fun, @function
+       .weak   fun
+       .type   obj, @object
+       .weak   obj
+       .ifdef  prot
+       .protected fun
+       .protected obj
+       .endif
+       .ifdef  hidn
+       .hidden fun
+       .hidden obj
+       .endif
+       .ifdef  intr
+       .internal fun
+       .internal obj
+       .endif
+
+       .section .text.foo, "ax", @progbits
+       .globl  foo
+       .ent    foo
+foo:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       li      $2, %hi(_gp_disp)
+       addiu   $3, $pc, %lo(_gp_disp)
+       sll     $2, 16
+       addu    $2, $3
+       lw      $4, %got(obj)($2)
+       lw      $2, %call16(fun)($2)
+       jr      $2
+        move   $25,$2
+       .end    foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
+
+       .section .text.bar, "ax", @progbits
+       .ent    bar
+bar:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       li      $2, %hi(_gp_disp)
+       addiu   $3, $pc, %lo(_gp_disp)
+       sll     $2, 16
+       addu    $2, $3
+       move    $4, $2
+       addiu   $4, %got(obj)
+       addiu   $2, %call16(fun)
+       lw      $2, 0($2)
+       lw      $4, 0($4)
+       jr      $2
+        move   $25,$2
+       .end    bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
diff --git a/ld/testsuite/ld-mips-elf/pr21375-n32.s b/ld/testsuite/ld-mips-elf/pr21375-n32.s
new file mode 100644 (file)
index 0000000..e17fab6
--- /dev/null
@@ -0,0 +1,59 @@
+       .abicalls
+       .set    noreorder
+
+       .type   obj, @object
+       .weak   obj
+       .ifdef  prot
+       .protected obj
+       .endif
+       .ifdef  hidn
+       .hidden obj
+       .endif
+       .ifdef  intr
+       .internal obj
+       .endif
+
+       .section .text.foo, "ax", @progbits
+       .globl  foo
+       .ent    foo
+foo:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cplocal $4
+       .cpsetup $25, $0, foo
+       lw      $2, %got_page(obj + 4)($4)
+       lw      $3, %got_disp(obj)($4)
+       addiu   $2, %got_ofst(obj + 4)
+       jr      $31
+        addiu  $3, 4
+       .end    foo
+
+# Pad a little so that the microMIPS version aligns the same.
+       .space  4
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
+
+       .section .text.bar, "ax", @progbits
+       .ent    bar
+bar:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cplocal $4
+       .cpsetup $25, $0, bar
+       lwl     $2, %got_page(obj + 4)($4)
+       lwr     $3, %got_disp(obj)($4)
+       addiu   $2, %got_ofst(obj + 4)
+       jr      $31
+        addiu  $3, 4
+       .end    bar
+
+# Pad a little so that the microMIPS version aligns the same.
+       .space  4
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
diff --git a/ld/testsuite/ld-mips-elf/pr21375-n64.s b/ld/testsuite/ld-mips-elf/pr21375-n64.s
new file mode 100644 (file)
index 0000000..366d860
--- /dev/null
@@ -0,0 +1,59 @@
+       .abicalls
+       .set    noreorder
+
+       .type   obj, @object
+       .weak   obj
+       .ifdef  prot
+       .protected obj
+       .endif
+       .ifdef  hidn
+       .hidden obj
+       .endif
+       .ifdef  intr
+       .internal obj
+       .endif
+
+       .section .text.foo, "ax", @progbits
+       .globl  foo
+       .ent    foo
+foo:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cplocal $4
+       .cpsetup $25, $0, foo
+       ld      $2, %got_page(obj + 4)($4)
+       ld      $3, %got_disp(obj)($4)
+       daddiu  $2, %got_ofst(obj + 4)
+       jr      $31
+        daddiu $3, 4
+       .end    foo
+
+# Pad a little so that the microMIPS version aligns the same.
+       .space  4
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
+
+       .section .text.bar, "ax", @progbits
+       .ent    bar
+bar:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cplocal $4
+       .cpsetup $25, $0, bar
+       ldl     $2, %got_page(obj + 4)($4)
+       ldr     $3, %got_disp(obj)($4)
+       daddiu  $2, %got_ofst(obj + 4)
+       jr      $31
+        daddiu $3, 4
+       .end    bar
+
+# Pad a little so that the microMIPS version aligns the same.
+       .space  4
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
diff --git a/ld/testsuite/ld-mips-elf/pr21375-noabi.hd b/ld/testsuite/ld-mips-elf/pr21375-noabi.hd
new file mode 100644 (file)
index 0000000..4c1a3b8
--- /dev/null
@@ -0,0 +1,4 @@
+ELF Header:
+#...
+ +ABI Version: +0
+#pass
diff --git a/ld/testsuite/ld-mips-elf/pr21375-xgot.ld b/ld/testsuite/ld-mips-elf/pr21375-xgot.ld
new file mode 100644 (file)
index 0000000..d63169d
--- /dev/null
@@ -0,0 +1,20 @@
+SECTIONS
+{
+  .dynamic : { *(.dynamic) }
+  .hash : { *(.hash) }
+  .dynsym : { *(.dynsym) }
+  .dynstr : { *(.dynstr) }
+  .gnu.version : { *(.gnu.version) }
+  .gnu.version_d : { *(.gnu.version_d) }
+  .gnu.version_r : { *(.gnu.version_r) }
+  /* Align up to account for traditional vs IRIX target differences
+     with the alignment of dynamic sections.  This way GOT addresses
+     work out the same.  */
+  .text : ALIGN (512) { *(.text*) }
+  HIDDEN (_gp = ALIGN (16) + 0x7fff8010);
+  .got : { *(.got) }
+  .symtab : { *(.symtab) }
+  .strtab : { *(.strtab) }
+  .shstrtab : { *(.shstrtab) }
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-mips-elf/pr21375-xgot.s b/ld/testsuite/ld-mips-elf/pr21375-xgot.s
new file mode 100644 (file)
index 0000000..39bfa08
--- /dev/null
@@ -0,0 +1,62 @@
+       .abicalls
+       .set    noreorder
+
+       .type   fun, @function
+       .weak   fun
+       .type   obj, @object
+       .weak   obj
+       .ifdef  prot
+       .protected fun
+       .protected obj
+       .endif
+       .ifdef  hidn
+       .hidden fun
+       .hidden obj
+       .endif
+       .ifdef  intr
+       .internal fun
+       .internal obj
+       .endif
+
+       .section .text.foo, "ax", @progbits
+       .globl  foo
+       .ent    foo
+foo:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cpload $25
+       lui     $4, %got_hi(obj)
+       lui     $25, %call_hi(fun)
+       addu    $4, $28
+       addu    $25, $28
+       lw      $25, %call_lo(fun)($25)
+       lw      $4, %got_lo(obj)($4)
+       jr      $25
+        addiu  $4, 4
+       .end    foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
+
+       .section .text.bar, "ax", @progbits
+       .ent    bar
+bar:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cpload $25
+       lui     $4, %got_hi(obj)
+       lui     $25, %call_hi(fun)
+       addu    $4, $28
+       addu    $25, $28
+       lwl     $25, %call_lo(fun)($25)
+       lwr     $4, %got_lo(obj)($4)
+       jr      $25
+        addiu  $4, 4
+       .end    bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
diff --git a/ld/testsuite/ld-mips-elf/pr21375.dd b/ld/testsuite/ld-mips-elf/pr21375.dd
new file mode 100644 (file)
index 0000000..056e6f4
--- /dev/null
@@ -0,0 +1,23 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8f998018        lw      t9,-32744\(gp\)
+ *[0-9a-f]+:   8f84801c        lw      a0,-32740\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8020        addiu   gp,gp,-32736
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8b998018        lwl     t9,-32744\(gp\)
+ *[0-9a-f]+:   9b84801c        lwr     a0,-32740\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375.gd b/ld/testsuite/ld-mips-elf/pr21375.gd
new file mode 100644 (file)
index 0000000..7164476
--- /dev/null
@@ -0,0 +1,12 @@
+Static GOT:
+ Canonical gp value: 00008050
+
+ Reserved entries:
+   Address     Access    Value
+  00000060 -32752\(gp\) 00000000
+  00000064 -32748\(gp\) 80000000
+
+ Local entries:
+   Address     Access    Value
+  00000068 -32744\(gp\) 00000000
+  0000006c -32740\(gp\) 00000000
diff --git a/ld/testsuite/ld-mips-elf/pr21375.ld b/ld/testsuite/ld-mips-elf/pr21375.ld
new file mode 100644 (file)
index 0000000..ecc7d6a
--- /dev/null
@@ -0,0 +1,20 @@
+SECTIONS
+{
+  .dynamic : { *(.dynamic) }
+  .hash : { *(.hash) }
+  .dynsym : { *(.dynsym) }
+  .dynstr : { *(.dynstr) }
+  .gnu.version : { *(.gnu.version) }
+  .gnu.version_d : { *(.gnu.version_d) }
+  .gnu.version_r : { *(.gnu.version_r) }
+  /* Align up to account for traditional vs IRIX target differences
+     with the alignment of dynamic sections.  This way GOT addresses
+     work out the same.  */
+  .text : ALIGN (512) { *(.text*) }
+  HIDDEN (_gp = ALIGN (16) + 0x7ff0);
+  .got : { *(.got) }
+  .symtab : { *(.symtab) }
+  .strtab : { *(.strtab) }
+  .shstrtab : { *(.shstrtab) }
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-mips-elf/pr21375.s b/ld/testsuite/ld-mips-elf/pr21375.s
new file mode 100644 (file)
index 0000000..e79a70c
--- /dev/null
@@ -0,0 +1,54 @@
+       .abicalls
+       .set    noreorder
+
+       .type   fun, @function
+       .weak   fun
+       .type   obj, @object
+       .weak   obj
+       .ifdef  prot
+       .protected fun
+       .protected obj
+       .endif
+       .ifdef  hidn
+       .hidden fun
+       .hidden obj
+       .endif
+       .ifdef  intr
+       .internal fun
+       .internal obj
+       .endif
+
+       .section .text.foo, "ax", @progbits
+       .globl  foo
+       .ent    foo
+foo:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cpload $25
+       lw      $25, %call16(fun)($28)
+       lw      $4, %got(obj)($28)
+       jr      $25
+        addiu  $4, 4
+       .end    foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
+
+       .section .text.bar, "ax", @progbits
+       .ent    bar
+bar:
+       .frame  $sp, 0, $31
+       .mask   0x00000000, 0
+       .fmask  0x00000000, 0
+       .cpload $25
+       lwl     $25, %call16(fun)($28)
+       lwr     $4, %got(obj)($28)
+       jr      $25
+        addiu  $4, 4
+       .end    bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
diff --git a/ld/testsuite/ld-mips-elf/pr21375.sd b/ld/testsuite/ld-mips-elf/pr21375.sd
new file mode 100644 (file)
index 0000000..996cee9
--- /dev/null
@@ -0,0 +1 @@
+# Empty.
diff --git a/ld/testsuite/ld-mips-elf/pr21375.ver b/ld/testsuite/ld-mips-elf/pr21375.ver
new file mode 100644 (file)
index 0000000..b6b2365
--- /dev/null
@@ -0,0 +1 @@
+{ global: foo; local: *; };
diff --git a/ld/testsuite/ld-mips-elf/pr21375h-irix.sd b/ld/testsuite/ld-mips-elf/pr21375h-irix.sd
new file mode 100644 (file)
index 0000000..996cee9
--- /dev/null
@@ -0,0 +1 @@
+# Empty.
diff --git a/ld/testsuite/ld-mips-elf/pr21375h.dd b/ld/testsuite/ld-mips-elf/pr21375h.dd
new file mode 100644 (file)
index 0000000..4a25dff
--- /dev/null
@@ -0,0 +1,23 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   24190000        li      t9,0
+ *[0-9a-f]+:   24040000        li      a0,0
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8020        addiu   gp,gp,-32736
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8b998018        lwl     t9,-32744\(gp\)
+ *[0-9a-f]+:   9b848018        lwr     a0,-32744\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375h.gd b/ld/testsuite/ld-mips-elf/pr21375h.gd
new file mode 100644 (file)
index 0000000..7164476
--- /dev/null
@@ -0,0 +1,12 @@
+Static GOT:
+ Canonical gp value: 00008050
+
+ Reserved entries:
+   Address     Access    Value
+  00000060 -32752\(gp\) 00000000
+  00000064 -32748\(gp\) 80000000
+
+ Local entries:
+   Address     Access    Value
+  00000068 -32744\(gp\) 00000000
+  0000006c -32740\(gp\) 00000000
diff --git a/ld/testsuite/ld-mips-elf/pr21375h.sd b/ld/testsuite/ld-mips-elf/pr21375h.sd
new file mode 100644 (file)
index 0000000..996cee9
--- /dev/null
@@ -0,0 +1 @@
+# Empty.
diff --git a/ld/testsuite/ld-mips-elf/pr21375p-irix.sd b/ld/testsuite/ld-mips-elf/pr21375p-irix.sd
new file mode 100644 (file)
index 0000000..239262b
--- /dev/null
@@ -0,0 +1,10 @@
+Symbol table '\.dynsym' contains 8 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION GLOBAL PROTECTED  ABS _procedure_table_size
+     2: 00000001     0 SECTION GLOBAL DEFAULT  ABS _DYNAMIC_LINK
+     3: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS __rld_map
+     4: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_string_table
+     5: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_table
+     6: 00000000     0 FUNC    WEAK   DEFAULT  UND fun
+     7: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375p.dd b/ld/testsuite/ld-mips-elf/pr21375p.dd
new file mode 100644 (file)
index 0000000..056e6f4
--- /dev/null
@@ -0,0 +1,23 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8f998018        lw      t9,-32744\(gp\)
+ *[0-9a-f]+:   8f84801c        lw      a0,-32740\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8020        addiu   gp,gp,-32736
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8b998018        lwl     t9,-32744\(gp\)
+ *[0-9a-f]+:   9b84801c        lwr     a0,-32740\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375p.gd b/ld/testsuite/ld-mips-elf/pr21375p.gd
new file mode 100644 (file)
index 0000000..3286104
--- /dev/null
@@ -0,0 +1,12 @@
+Primary GOT:
+ Canonical gp value: 00008250
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000260 -32752\(gp\) 00000000 Lazy resolver
+  00000264 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000268 -32744\(gp\) 00000000 00000000 FUNC    UND fun
+  0000026c -32740\(gp\) 00000000 00000000 OBJECT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375p.sd b/ld/testsuite/ld-mips-elf/pr21375p.sd
new file mode 100644 (file)
index 0000000..9649a7f
--- /dev/null
@@ -0,0 +1,7 @@
+Symbol table '\.dynsym' contains 5 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000001     0 SECTION GLOBAL DEFAULT  ABS _DYNAMIC_LINKING
+     2: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS __RLD_MAP
+     3: 00000000     0 FUNC    WEAK   DEFAULT  UND fun
+     4: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375ph-irix.sd b/ld/testsuite/ld-mips-elf/pr21375ph-irix.sd
new file mode 100644 (file)
index 0000000..1bb8531
--- /dev/null
@@ -0,0 +1,9 @@
+Symbol table '\.dynsym' contains 7 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION GLOBAL PROTECTED  ABS _procedure_table_size
+     2: 00000001     0 SECTION GLOBAL DEFAULT  ABS _DYNAMIC_LINK
+     3: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS __rld_map
+     4: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_string_table
+     5: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_table
+     6: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375ph.dd b/ld/testsuite/ld-mips-elf/pr21375ph.dd
new file mode 100644 (file)
index 0000000..0fedfe9
--- /dev/null
@@ -0,0 +1,23 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   24190000        li      t9,0
+ *[0-9a-f]+:   24040000        li      a0,0
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8020        addiu   gp,gp,-32736
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8b998020        lwl     t9,-32736\(gp\)
+ *[0-9a-f]+:   9b848020        lwr     a0,-32736\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375ph.gd b/ld/testsuite/ld-mips-elf/pr21375ph.gd
new file mode 100644 (file)
index 0000000..e24217d
--- /dev/null
@@ -0,0 +1,16 @@
+Primary GOT:
+ Canonical gp value: 00008250
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000260 -32752\(gp\) 00000000 Lazy resolver
+  00000264 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  00000268 -32744\(gp\) 00000000
+  0000026c -32740\(gp\) 00000000
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000270 -32736\(gp\) 00000000 00000000 NOTYPE  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375ph.sd b/ld/testsuite/ld-mips-elf/pr21375ph.sd
new file mode 100644 (file)
index 0000000..3df5641
--- /dev/null
@@ -0,0 +1,6 @@
+Symbol table '\.dynsym' contains 4 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000001     0 SECTION GLOBAL DEFAULT  ABS _DYNAMIC_LINKING
+     2: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS __RLD_MAP
+     3: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-irix.sd b/ld/testsuite/ld-mips-elf/pr21375s-irix.sd
new file mode 100644 (file)
index 0000000..e578ffc
--- /dev/null
@@ -0,0 +1,9 @@
+Symbol table '\.dynsym' contains 7 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION GLOBAL PROTECTED  ABS _procedure_table_size
+     2: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_string_table
+     3: 0000020.    2. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     4: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_table
+     5: 00000000     0 FUNC    WEAK   DEFAULT  UND fun
+     6: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n32-irix.sd b/ld/testsuite/ld-mips-elf/pr21375s-n32-irix.sd
new file mode 100644 (file)
index 0000000..1164f3b
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    3. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     2: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n32.dd b/ld/testsuite/ld-mips-elf/pr21375s-n32.dd
new file mode 100644 (file)
index 0000000..cd55d73
--- /dev/null
@@ -0,0 +1,27 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848070        addiu   a0,a0,-32656
+ *[0-9a-f]+:   00992021        addu    a0,a0,t9
+ *[0-9a-f]+:   8c828018        lw      v0,-32744\(a0\)
+ *[0-9a-f]+:   8c838018        lw      v1,-32744\(a0\)
+ *[0-9a-f]+:   24420004        addiu   v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   24630004        addiu   v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848030        addiu   a0,a0,-32720
+ *[0-9a-f]+:   00992021        addu    a0,a0,t9
+ *[0-9a-f]+:   88828018        lwl     v0,-32744\(a0\)
+ *[0-9a-f]+:   98838018        lwr     v1,-32744\(a0\)
+ *[0-9a-f]+:   24420004        addiu   v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   24630004        addiu   v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n32.gd b/ld/testsuite/ld-mips-elf/pr21375s-n32.gd
new file mode 100644 (file)
index 0000000..99182e4
--- /dev/null
@@ -0,0 +1,11 @@
+Primary GOT:
+ Canonical gp value: 00008270
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000280 -32752\(gp\) 00000000 Lazy resolver
+  00000284 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000288 -32744\(gp\) 00000000 00000000 OBJECT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n32.sd b/ld/testsuite/ld-mips-elf/pr21375s-n32.sd
new file mode 100644 (file)
index 0000000..cc801d5
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    3. FUNC    GLOBAL DEFAULT    5 foo
+     2: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n64-irix.sd b/ld/testsuite/ld-mips-elf/pr21375s-n64-irix.sd
new file mode 100644 (file)
index 0000000..a7481d8
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value          Size Type    Bind   Vis      Ndx Name
+     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 000000000000020.    3. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     2: 0000000000000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n64.dd b/ld/testsuite/ld-mips-elf/pr21375s-n64.dd
new file mode 100644 (file)
index 0000000..6b44a74
--- /dev/null
@@ -0,0 +1,27 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848070        addiu   a0,a0,-32656
+ *[0-9a-f]+:   0099202d        daddu   a0,a0,t9
+ *[0-9a-f]+:   dc828020        ld      v0,-32736\(a0\)
+ *[0-9a-f]+:   dc838020        ld      v1,-32736\(a0\)
+ *[0-9a-f]+:   64420004        daddiu  v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   64630004        daddiu  v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848030        addiu   a0,a0,-32720
+ *[0-9a-f]+:   0099202d        daddu   a0,a0,t9
+ *[0-9a-f]+:   68828020        ldl     v0,-32736\(a0\)
+ *[0-9a-f]+:   6c838020        ldr     v1,-32736\(a0\)
+ *[0-9a-f]+:   64420004        daddiu  v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   64630004        daddiu  v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n64.gd b/ld/testsuite/ld-mips-elf/pr21375s-n64.gd
new file mode 100644 (file)
index 0000000..6208b76
--- /dev/null
@@ -0,0 +1,11 @@
+Primary GOT:
+ Canonical gp value: 0000000000008270
+
+ Reserved entries:
+           Address     Access          Initial Purpose
+  0000000000000280 -32752\(gp\) 0000000000000000 Lazy resolver
+  0000000000000288 -32744\(gp\) 8000000000000000 Module pointer \(GNU extension\)
+
+ Global entries:
+           Address     Access          Initial         Sym\.Val\. Type    Ndx Name
+  0000000000000290 -32736\(gp\) 0000000000000000 0000000000000000 OBJECT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s-n64.sd b/ld/testsuite/ld-mips-elf/pr21375s-n64.sd
new file mode 100644 (file)
index 0000000..43c2921
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value          Size Type    Bind   Vis      Ndx Name
+     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 000000000000020.    3. FUNC    GLOBAL DEFAULT    5 foo
+     2: 0000000000000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s.dd b/ld/testsuite/ld-mips-elf/pr21375s.dd
new file mode 100644 (file)
index 0000000..056e6f4
--- /dev/null
@@ -0,0 +1,23 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8f998018        lw      t9,-32744\(gp\)
+ *[0-9a-f]+:   8f84801c        lw      a0,-32740\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8020        addiu   gp,gp,-32736
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8b998018        lwl     t9,-32744\(gp\)
+ *[0-9a-f]+:   9b84801c        lwr     a0,-32740\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375s.gd b/ld/testsuite/ld-mips-elf/pr21375s.gd
new file mode 100644 (file)
index 0000000..733fd04
--- /dev/null
@@ -0,0 +1,12 @@
+Primary GOT:
+ Canonical gp value: 00008250
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000260 -32752\(gp\) 00000000 Lazy resolver
+  00000264 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000268 -32744\(gp\) 0000000. 0000000. FUNC    UND fun
+  0000026c -32740\(gp\) 00000000 00000000 OBJECT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375s.sd b/ld/testsuite/ld-mips-elf/pr21375s.sd
new file mode 100644 (file)
index 0000000..cb45b8d
--- /dev/null
@@ -0,0 +1,6 @@
+Symbol table '\.dynsym' contains 4 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    2. FUNC    GLOBAL DEFAULT    5 foo
+     2: 00000000     0 FUNC    WEAK   DEFAULT  UND fun
+     3: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-irix.sd b/ld/testsuite/ld-mips-elf/pr21375sh-irix.sd
new file mode 100644 (file)
index 0000000..efcce02
--- /dev/null
@@ -0,0 +1,8 @@
+Symbol table '\.dynsym' contains 6 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION GLOBAL PROTECTED  ABS _procedure_table_size
+     2: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_string_table
+     3: 0000020.    2. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     4: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_table
+     5: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n32-irix.sd b/ld/testsuite/ld-mips-elf/pr21375sh-n32-irix.sd
new file mode 100644 (file)
index 0000000..9cddb6e
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    3. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     2: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n32.dd b/ld/testsuite/ld-mips-elf/pr21375sh-n32.dd
new file mode 100644 (file)
index 0000000..ac7207b
--- /dev/null
@@ -0,0 +1,27 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848070        addiu   a0,a0,-32656
+ *[0-9a-f]+:   00992021        addu    a0,a0,t9
+ *[0-9a-f]+:   24020000        li      v0,0
+ *[0-9a-f]+:   24030000        li      v1,0
+ *[0-9a-f]+:   24420004        addiu   v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   24630004        addiu   v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848030        addiu   a0,a0,-32720
+ *[0-9a-f]+:   00992021        addu    a0,a0,t9
+ *[0-9a-f]+:   8882801c        lwl     v0,-32740\(a0\)
+ *[0-9a-f]+:   9883801c        lwr     v1,-32740\(a0\)
+ *[0-9a-f]+:   24420004        addiu   v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   24630004        addiu   v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n32.gd b/ld/testsuite/ld-mips-elf/pr21375sh-n32.gd
new file mode 100644 (file)
index 0000000..25abbed
--- /dev/null
@@ -0,0 +1,15 @@
+Primary GOT:
+ Canonical gp value: 00008270
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000280 -32752\(gp\) 00000000 Lazy resolver
+  00000284 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  00000288 -32744\(gp\) 00000000
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  0000028c -32740\(gp\) 00000000 00000000 NOTYPE  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n32.sd b/ld/testsuite/ld-mips-elf/pr21375sh-n32.sd
new file mode 100644 (file)
index 0000000..4213465
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    3. FUNC    GLOBAL DEFAULT    5 foo
+     2: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n64-irix.sd b/ld/testsuite/ld-mips-elf/pr21375sh-n64-irix.sd
new file mode 100644 (file)
index 0000000..7eb7732
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value          Size Type    Bind   Vis      Ndx Name
+     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 000000000000020.    3. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     2: 0000000000000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n64.dd b/ld/testsuite/ld-mips-elf/pr21375sh-n64.dd
new file mode 100644 (file)
index 0000000..fb76b5a
--- /dev/null
@@ -0,0 +1,27 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848070        addiu   a0,a0,-32656
+ *[0-9a-f]+:   0099202d        daddu   a0,a0,t9
+ *[0-9a-f]+:   24020000        li      v0,0
+ *[0-9a-f]+:   24030000        li      v1,0
+ *[0-9a-f]+:   64420004        daddiu  v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   64630004        daddiu  v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   00800025        move    zero,a0
+ *[0-9a-f]+:   3c040001        lui     a0,0x1
+ *[0-9a-f]+:   24848030        addiu   a0,a0,-32720
+ *[0-9a-f]+:   0099202d        daddu   a0,a0,t9
+ *[0-9a-f]+:   68828028        ldl     v0,-32728\(a0\)
+ *[0-9a-f]+:   6c838028        ldr     v1,-32728\(a0\)
+ *[0-9a-f]+:   64420004        daddiu  v0,v0,4
+ *[0-9a-f]+:   03e00008        jr      ra
+ *[0-9a-f]+:   64630004        daddiu  v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n64.gd b/ld/testsuite/ld-mips-elf/pr21375sh-n64.gd
new file mode 100644 (file)
index 0000000..0287cc7
--- /dev/null
@@ -0,0 +1,15 @@
+Primary GOT:
+ Canonical gp value: 0000000000008270
+
+ Reserved entries:
+           Address     Access          Initial Purpose
+  0000000000000280 -32752\(gp\) 0000000000000000 Lazy resolver
+  0000000000000288 -32744\(gp\) 8000000000000000 Module pointer \(GNU extension\)
+
+ Local entries:
+           Address     Access          Initial
+  0000000000000290 -32736\(gp\) 0000000000000000
+
+ Global entries:
+           Address     Access          Initial         Sym\.Val\. Type    Ndx Name
+  0000000000000298 -32728\(gp\) 0000000000000000 0000000000000000 NOTYPE  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh-n64.sd b/ld/testsuite/ld-mips-elf/pr21375sh-n64.sd
new file mode 100644 (file)
index 0000000..d3f670a
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value          Size Type    Bind   Vis      Ndx Name
+     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 000000000000020.    3. FUNC    GLOBAL DEFAULT    5 foo
+     2: 0000000000000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh.dd b/ld/testsuite/ld-mips-elf/pr21375sh.dd
new file mode 100644 (file)
index 0000000..0fedfe9
--- /dev/null
@@ -0,0 +1,23 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   24190000        li      t9,0
+ *[0-9a-f]+:   24040000        li      a0,0
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8020        addiu   gp,gp,-32736
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   8b998020        lwl     t9,-32736\(gp\)
+ *[0-9a-f]+:   9b848020        lwr     a0,-32736\(gp\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh.gd b/ld/testsuite/ld-mips-elf/pr21375sh.gd
new file mode 100644 (file)
index 0000000..e24217d
--- /dev/null
@@ -0,0 +1,16 @@
+Primary GOT:
+ Canonical gp value: 00008250
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000260 -32752\(gp\) 00000000 Lazy resolver
+  00000264 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  00000268 -32744\(gp\) 00000000
+  0000026c -32740\(gp\) 00000000
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000270 -32736\(gp\) 00000000 00000000 NOTYPE  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sh.sd b/ld/testsuite/ld-mips-elf/pr21375sh.sd
new file mode 100644 (file)
index 0000000..6af824f
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    2. FUNC    GLOBAL DEFAULT    5 foo
+     2: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375shg-irix.sd b/ld/testsuite/ld-mips-elf/pr21375shg-irix.sd
new file mode 100644 (file)
index 0000000..4384154
--- /dev/null
@@ -0,0 +1,7 @@
+Symbol table '\.dynsym' contains 5 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION GLOBAL PROTECTED  ABS _procedure_table_size
+     2: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_string_table
+     3: 00000200    28 FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     4: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_table
diff --git a/ld/testsuite/ld-mips-elf/pr21375shg.dd b/ld/testsuite/ld-mips-elf/pr21375shg.dd
new file mode 100644 (file)
index 0000000..910a7ca
--- /dev/null
@@ -0,0 +1,13 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c0001        lui     gp,0x1
+ *[0-9a-f]+:   279c8020        addiu   gp,gp,-32736
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   24190000        li      t9,0
+ *[0-9a-f]+:   24040000        li      a0,0
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375shg.gd b/ld/testsuite/ld-mips-elf/pr21375shg.gd
new file mode 100644 (file)
index 0000000..2f516b8
--- /dev/null
@@ -0,0 +1,12 @@
+Primary GOT:
+ Canonical gp value: 00008220
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000230 -32752\(gp\) 00000000 Lazy resolver
+  00000234 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  00000238 -32744\(gp\) 00000000
+  0000023c -32740\(gp\) 00000000
diff --git a/ld/testsuite/ld-mips-elf/pr21375shg.sd b/ld/testsuite/ld-mips-elf/pr21375shg.sd
new file mode 100644 (file)
index 0000000..94f5ee5
--- /dev/null
@@ -0,0 +1,4 @@
+Symbol table '\.dynsym' contains 2 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000200    28 FUNC    GLOBAL DEFAULT    5 foo
diff --git a/ld/testsuite/ld-mips-elf/pr21375shl-irix.sd b/ld/testsuite/ld-mips-elf/pr21375shl-irix.sd
new file mode 100644 (file)
index 0000000..d954c77
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000200    28 FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     2: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375shl.gd b/ld/testsuite/ld-mips-elf/pr21375shl.gd
new file mode 100644 (file)
index 0000000..e24217d
--- /dev/null
@@ -0,0 +1,16 @@
+Primary GOT:
+ Canonical gp value: 00008250
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000260 -32752\(gp\) 00000000 Lazy resolver
+  00000264 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  00000268 -32744\(gp\) 00000000
+  0000026c -32740\(gp\) 00000000
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000270 -32736\(gp\) 00000000 00000000 NOTYPE  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375shl.sd b/ld/testsuite/ld-mips-elf/pr21375shl.sd
new file mode 100644 (file)
index 0000000..c9f5935
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000200    28 FUNC    GLOBAL DEFAULT    5 foo
+     2: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375shv-irix.sd b/ld/testsuite/ld-mips-elf/pr21375shv-irix.sd
new file mode 100644 (file)
index 0000000..4218081
--- /dev/null
@@ -0,0 +1,6 @@
+Symbol table '\.dynsym' contains 4 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000200    28 FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo@@PR21375
+     2: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS PR21375
+     3: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero@@PR21375
diff --git a/ld/testsuite/ld-mips-elf/pr21375shv.gd b/ld/testsuite/ld-mips-elf/pr21375shv.gd
new file mode 100644 (file)
index 0000000..e24217d
--- /dev/null
@@ -0,0 +1,16 @@
+Primary GOT:
+ Canonical gp value: 00008250
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000260 -32752\(gp\) 00000000 Lazy resolver
+  00000264 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  00000268 -32744\(gp\) 00000000
+  0000026c -32740\(gp\) 00000000
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000270 -32736\(gp\) 00000000 00000000 NOTYPE  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375shv.sd b/ld/testsuite/ld-mips-elf/pr21375shv.sd
new file mode 100644 (file)
index 0000000..20d244d
--- /dev/null
@@ -0,0 +1,6 @@
+Symbol table '\.dynsym' contains 4 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000200    28 FUNC    GLOBAL DEFAULT    7 foo@@PR21375
+     2: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS PR21375
+     3: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero@@PR21375
diff --git a/ld/testsuite/ld-mips-elf/pr21375sm16.dd b/ld/testsuite/ld-mips-elf/pr21375sm16.dd
new file mode 100644 (file)
index 0000000..a79053d
--- /dev/null
@@ -0,0 +1,28 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   f000 6a01       li      v0,1
+ *[0-9a-f]+:   f050 0b0c       la      v1,ffff8250 <_gp\+0xffff0000>
+ *[0-9a-f]+:   f400 3240       sll     v0,16
+ *[0-9a-f]+:   e269            addu    v0,v1
+ *[0-9a-f]+:   f010 9a9c       lw      a0,-32740\(v0\)
+ *[0-9a-f]+:   f010 9a58       lw      v0,-32744\(v0\)
+ *[0-9a-f]+:   ea00            jr      v0
+ *[0-9a-f]+:   653a            move    t9,v0
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   f000 6a01       li      v0,1
+ *[0-9a-f]+:   f010 0b1c       la      v1,ffff8250 <_gp\+0xffff0000>
+ *[0-9a-f]+:   f400 3240       sll     v0,16
+ *[0-9a-f]+:   e269            addu    v0,v1
+ *[0-9a-f]+:   6782            move    a0,v0
+ *[0-9a-f]+:   f010 4c1c       addiu   a0,-32740
+ *[0-9a-f]+:   f010 4a18       addiu   v0,-32744
+ *[0-9a-f]+:   9a40            lw      v0,0\(v0\)
+ *[0-9a-f]+:   9c80            lw      a0,0\(a0\)
+ *[0-9a-f]+:   ea00            jr      v0
+ *[0-9a-f]+:   653a            move    t9,v0
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sm16h.dd b/ld/testsuite/ld-mips-elf/pr21375sm16h.dd
new file mode 100644 (file)
index 0000000..c3f6186
--- /dev/null
@@ -0,0 +1,28 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   f000 6a01       li      v0,1
+ *[0-9a-f]+:   f050 0b0c       la      v1,ffff8250 <_gp\+0xffff0000>
+ *[0-9a-f]+:   f400 3240       sll     v0,16
+ *[0-9a-f]+:   e269            addu    v0,v1
+ *[0-9a-f]+:   f000 6c00       li      a0,0
+ *[0-9a-f]+:   f000 6a00       li      v0,0
+ *[0-9a-f]+:   ea00            jr      v0
+ *[0-9a-f]+:   653a            move    t9,v0
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   f000 6a01       li      v0,1
+ *[0-9a-f]+:   f010 0b1c       la      v1,ffff8250 <_gp\+0xffff0000>
+ *[0-9a-f]+:   f400 3240       sll     v0,16
+ *[0-9a-f]+:   e269            addu    v0,v1
+ *[0-9a-f]+:   6782            move    a0,v0
+ *[0-9a-f]+:   f030 4c00       addiu   a0,-32736
+ *[0-9a-f]+:   f030 4a00       addiu   v0,-32736
+ *[0-9a-f]+:   9a40            lw      v0,0\(v0\)
+ *[0-9a-f]+:   9c80            lw      a0,0\(a0\)
+ *[0-9a-f]+:   ea00            jr      v0
+ *[0-9a-f]+:   653a            move    t9,v0
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375su-n32.dd b/ld/testsuite/ld-mips-elf/pr21375su-n32.dd
new file mode 100644 (file)
index 0000000..f8c8bb9
--- /dev/null
@@ -0,0 +1,29 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 806f       addiu   a0,a0,-32657
+ *[0-9a-f]+:   0324 2150       addu    a0,a0,t9
+ *[0-9a-f]+:   fc44 8018       lw      v0,-32744\(a0\)
+ *[0-9a-f]+:   fc64 8018       lw      v1,-32744\(a0\)
+ *[0-9a-f]+:   3042 0004       addiu   v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   6db2            addiu   v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 802f       addiu   a0,a0,-32721
+ *[0-9a-f]+:   0324 2150       addu    a0,a0,t9
+ *[0-9a-f]+:   3024 8018       addiu   at,a0,-32744
+ *[0-9a-f]+:   6041 0000       lwl     v0,0\(at\)
+ *[0-9a-f]+:   3024 8018       addiu   at,a0,-32744
+ *[0-9a-f]+:   6061 1000       lwr     v1,0\(at\)
+ *[0-9a-f]+:   3042 0004       addiu   v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   6db2            addiu   v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375su-n64.dd b/ld/testsuite/ld-mips-elf/pr21375su-n64.dd
new file mode 100644 (file)
index 0000000..70ead43
--- /dev/null
@@ -0,0 +1,29 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 806f       addiu   a0,a0,-32657
+ *[0-9a-f]+:   5b24 2150       daddu   a0,a0,t9
+ *[0-9a-f]+:   dc44 8020       ld      v0,-32736\(a0\)
+ *[0-9a-f]+:   dc64 8020       ld      v1,-32736\(a0\)
+ *[0-9a-f]+:   5c42 0004       daddiu  v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   5c63 0004       daddiu  v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 802f       addiu   a0,a0,-32721
+ *[0-9a-f]+:   5b24 2150       daddu   a0,a0,t9
+ *[0-9a-f]+:   5c24 8020       daddiu  at,a0,-32736
+ *[0-9a-f]+:   6041 4000       ldl     v0,0\(at\)
+ *[0-9a-f]+:   5c24 8020       daddiu  at,a0,-32736
+ *[0-9a-f]+:   6061 5000       ldr     v1,0\(at\)
+ *[0-9a-f]+:   5c42 0004       daddiu  v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   5c63 0004       daddiu  v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375su.dd b/ld/testsuite/ld-mips-elf/pr21375su.dd
new file mode 100644 (file)
index 0000000..a5cca6e
--- /dev/null
@@ -0,0 +1,25 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   41bc 0001       lui     gp,0x1
+ *[0-9a-f]+:   339c 804f       addiu   gp,gp,-32689
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   ff3c 8018       lw      t9,-32744\(gp\)
+ *[0-9a-f]+:   fc9c 801c       lw      a0,-32740\(gp\)
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   41bc 0001       lui     gp,0x1
+ *[0-9a-f]+:   339c 801f       addiu   gp,gp,-32737
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   303c 8018       addiu   at,gp,-32744
+ *[0-9a-f]+:   6321 0000       lwl     t9,0\(at\)
+ *[0-9a-f]+:   303c 801c       addiu   at,gp,-32740
+ *[0-9a-f]+:   6081 1000       lwr     a0,0\(at\)
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375suh-n32.dd b/ld/testsuite/ld-mips-elf/pr21375suh-n32.dd
new file mode 100644 (file)
index 0000000..51d64fe
--- /dev/null
@@ -0,0 +1,29 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 806f       addiu   a0,a0,-32657
+ *[0-9a-f]+:   0324 2150       addu    a0,a0,t9
+ *[0-9a-f]+:   3040 0000       li      v0,0
+ *[0-9a-f]+:   3060 0000       li      v1,0
+ *[0-9a-f]+:   3042 0004       addiu   v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   6db2            addiu   v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 802f       addiu   a0,a0,-32721
+ *[0-9a-f]+:   0324 2150       addu    a0,a0,t9
+ *[0-9a-f]+:   3024 801c       addiu   at,a0,-32740
+ *[0-9a-f]+:   6041 0000       lwl     v0,0\(at\)
+ *[0-9a-f]+:   3024 801c       addiu   at,a0,-32740
+ *[0-9a-f]+:   6061 1000       lwr     v1,0\(at\)
+ *[0-9a-f]+:   3042 0004       addiu   v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   6db2            addiu   v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375suh-n64.dd b/ld/testsuite/ld-mips-elf/pr21375suh-n64.dd
new file mode 100644 (file)
index 0000000..8ef59dc
--- /dev/null
@@ -0,0 +1,29 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 806f       addiu   a0,a0,-32657
+ *[0-9a-f]+:   5b24 2150       daddu   a0,a0,t9
+ *[0-9a-f]+:   3040 0000       li      v0,0
+ *[0-9a-f]+:   3060 0000       li      v1,0
+ *[0-9a-f]+:   5c42 0004       daddiu  v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   5c63 0004       daddiu  v1,v1,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   0c04            move    zero,a0
+ *[0-9a-f]+:   41a4 0001       lui     a0,0x1
+ *[0-9a-f]+:   3084 802f       addiu   a0,a0,-32721
+ *[0-9a-f]+:   5b24 2150       daddu   a0,a0,t9
+ *[0-9a-f]+:   5c24 8028       daddiu  at,a0,-32728
+ *[0-9a-f]+:   6041 4000       ldl     v0,0\(at\)
+ *[0-9a-f]+:   5c24 8028       daddiu  at,a0,-32728
+ *[0-9a-f]+:   6061 5000       ldr     v1,0\(at\)
+ *[0-9a-f]+:   5c42 0004       daddiu  v0,v0,4
+ *[0-9a-f]+:   459f            jr      ra
+ *[0-9a-f]+:   5c63 0004       daddiu  v1,v1,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375suh.dd b/ld/testsuite/ld-mips-elf/pr21375suh.dd
new file mode 100644 (file)
index 0000000..fd91e2d
--- /dev/null
@@ -0,0 +1,25 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   41bc 0001       lui     gp,0x1
+ *[0-9a-f]+:   339c 804f       addiu   gp,gp,-32689
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   3320 0000       li      t9,0
+ *[0-9a-f]+:   3080 0000       li      a0,0
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   41bc 0001       lui     gp,0x1
+ *[0-9a-f]+:   339c 801f       addiu   gp,gp,-32737
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   303c 8020       addiu   at,gp,-32736
+ *[0-9a-f]+:   6321 0000       lwl     t9,0\(at\)
+ *[0-9a-f]+:   303c 8020       addiu   at,gp,-32736
+ *[0-9a-f]+:   6081 1000       lwr     a0,0\(at\)
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sux.dd b/ld/testsuite/ld-mips-elf/pr21375sux.dd
new file mode 100644 (file)
index 0000000..35cbf55
--- /dev/null
@@ -0,0 +1,33 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   41bc 8000       lui     gp,0x8000
+ *[0-9a-f]+:   339c 808f       addiu   gp,gp,-32625
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   41a4 8000       lui     a0,0x8000
+ *[0-9a-f]+:   41b9 8000       lui     t9,0x8000
+ *[0-9a-f]+:   0384 2150       addu    a0,a0,gp
+ *[0-9a-f]+:   0399 c950       addu    t9,t9,gp
+ *[0-9a-f]+:   ff39 7ff8       lw      t9,32760\(t9\)
+ *[0-9a-f]+:   fc84 7ffc       lw      a0,32764\(a0\)
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   41bc 8000       lui     gp,0x8000
+ *[0-9a-f]+:   339c 804f       addiu   gp,gp,-32689
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   41a4 8000       lui     a0,0x8000
+ *[0-9a-f]+:   41b9 8000       lui     t9,0x8000
+ *[0-9a-f]+:   0384 2150       addu    a0,a0,gp
+ *[0-9a-f]+:   0399 c950       addu    t9,t9,gp
+ *[0-9a-f]+:   3039 7ff8       addiu   at,t9,32760
+ *[0-9a-f]+:   6321 0000       lwl     t9,0\(at\)
+ *[0-9a-f]+:   3024 7ffc       addiu   at,a0,32764
+ *[0-9a-f]+:   6081 1000       lwr     a0,0\(at\)
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375suxh.dd b/ld/testsuite/ld-mips-elf/pr21375suxh.dd
new file mode 100644 (file)
index 0000000..7ba303f
--- /dev/null
@@ -0,0 +1,33 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   41bc 8000       lui     gp,0x8000
+ *[0-9a-f]+:   339c 808f       addiu   gp,gp,-32625
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   41a4 8001       lui     a0,0x8001
+ *[0-9a-f]+:   41b9 8001       lui     t9,0x8001
+ *[0-9a-f]+:   0384 2150       addu    a0,a0,gp
+ *[0-9a-f]+:   0399 c950       addu    t9,t9,gp
+ *[0-9a-f]+:   3320 0000       li      t9,0
+ *[0-9a-f]+:   3080 0000       li      a0,0
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   41bc 8000       lui     gp,0x8000
+ *[0-9a-f]+:   339c 804f       addiu   gp,gp,-32689
+ *[0-9a-f]+:   033c e150       addu    gp,gp,t9
+ *[0-9a-f]+:   41a4 8001       lui     a0,0x8001
+ *[0-9a-f]+:   41b9 8001       lui     t9,0x8001
+ *[0-9a-f]+:   0384 2150       addu    a0,a0,gp
+ *[0-9a-f]+:   0399 c950       addu    t9,t9,gp
+ *[0-9a-f]+:   3039 8000       addiu   at,t9,-32768
+ *[0-9a-f]+:   6321 0000       lwl     t9,0\(at\)
+ *[0-9a-f]+:   3024 8000       addiu   at,a0,-32768
+ *[0-9a-f]+:   6081 1000       lwr     a0,0\(at\)
+ *[0-9a-f]+:   4599            jr      t9
+ *[0-9a-f]+:   6e42            addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sx-irix.sd b/ld/testsuite/ld-mips-elf/pr21375sx-irix.sd
new file mode 100644 (file)
index 0000000..8b7553d
--- /dev/null
@@ -0,0 +1,9 @@
+Symbol table '\.dynsym' contains 7 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION GLOBAL PROTECTED  ABS _procedure_table_size
+     2: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_string_table
+     3: 0000020.    4. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     4: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_table
+     5: 00000000     0 FUNC    WEAK   DEFAULT  UND fun
+     6: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375sx.dd b/ld/testsuite/ld-mips-elf/pr21375sx.dd
new file mode 100644 (file)
index 0000000..3d2036c
--- /dev/null
@@ -0,0 +1,31 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c8000        lui     gp,0x8000
+ *[0-9a-f]+:   279c8090        addiu   gp,gp,-32624
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   3c048000        lui     a0,0x8000
+ *[0-9a-f]+:   3c198000        lui     t9,0x8000
+ *[0-9a-f]+:   009c2021        addu    a0,a0,gp
+ *[0-9a-f]+:   033cc821        addu    t9,t9,gp
+ *[0-9a-f]+:   8f397ff8        lw      t9,32760\(t9\)
+ *[0-9a-f]+:   8c847ffc        lw      a0,32764\(a0\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c8000        lui     gp,0x8000
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   3c048000        lui     a0,0x8000
+ *[0-9a-f]+:   3c198000        lui     t9,0x8000
+ *[0-9a-f]+:   009c2021        addu    a0,a0,gp
+ *[0-9a-f]+:   033cc821        addu    t9,t9,gp
+ *[0-9a-f]+:   8b397ff8        lwl     t9,32760\(t9\)
+ *[0-9a-f]+:   98847ffc        lwr     a0,32764\(a0\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sx.gd b/ld/testsuite/ld-mips-elf/pr21375sx.gd
new file mode 100644 (file)
index 0000000..14b17be
--- /dev/null
@@ -0,0 +1,12 @@
+Primary GOT:
+ Canonical gp value: 00008270
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000280 -32752\(gp\) 00000000 Lazy resolver
+  00000284 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000288 -32744\(gp\) 0000000. 0000000. FUNC    UND fun
+  0000028c -32740\(gp\) 00000000 00000000 OBJECT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375sx.sd b/ld/testsuite/ld-mips-elf/pr21375sx.sd
new file mode 100644 (file)
index 0000000..52573bf
--- /dev/null
@@ -0,0 +1,6 @@
+Symbol table '\.dynsym' contains 4 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    4. FUNC    GLOBAL DEFAULT    5 foo
+     2: 00000000     0 FUNC    WEAK   DEFAULT  UND fun
+     3: 00000000     0 OBJECT  WEAK   DEFAULT  UND obj
diff --git a/ld/testsuite/ld-mips-elf/pr21375sxh-irix.sd b/ld/testsuite/ld-mips-elf/pr21375sxh-irix.sd
new file mode 100644 (file)
index 0000000..a6d2df5
--- /dev/null
@@ -0,0 +1,8 @@
+Symbol table '\.dynsym' contains 6 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION GLOBAL PROTECTED  ABS _procedure_table_size
+     2: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_string_table
+     3: 0000020.    4. FUNC    GLOBAL DEFAULT PRC\[0xff01\] foo
+     4: 00000000     0 SECTION GLOBAL PROTECTED PRC\[0xff02\] _procedure_table
+     5: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sxh.dd b/ld/testsuite/ld-mips-elf/pr21375sxh.dd
new file mode 100644 (file)
index 0000000..0641892
--- /dev/null
@@ -0,0 +1,31 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ *[0-9a-f]+:   3c1c8000        lui     gp,0x8000
+ *[0-9a-f]+:   279c8090        addiu   gp,gp,-32624
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   3c048001        lui     a0,0x8001
+ *[0-9a-f]+:   3c198001        lui     t9,0x8001
+ *[0-9a-f]+:   009c2021        addu    a0,a0,gp
+ *[0-9a-f]+:   033cc821        addu    t9,t9,gp
+ *[0-9a-f]+:   24190000        li      t9,0
+ *[0-9a-f]+:   24040000        li      a0,0
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+:   3c1c8000        lui     gp,0x8000
+ *[0-9a-f]+:   279c8050        addiu   gp,gp,-32688
+ *[0-9a-f]+:   0399e021        addu    gp,gp,t9
+ *[0-9a-f]+:   3c048001        lui     a0,0x8001
+ *[0-9a-f]+:   3c198001        lui     t9,0x8001
+ *[0-9a-f]+:   009c2021        addu    a0,a0,gp
+ *[0-9a-f]+:   033cc821        addu    t9,t9,gp
+ *[0-9a-f]+:   8b398000        lwl     t9,-32768\(t9\)
+ *[0-9a-f]+:   98848000        lwr     a0,-32768\(a0\)
+ *[0-9a-f]+:   03200008        jr      t9
+ *[0-9a-f]+:   24840004        addiu   a0,a0,4
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pr21375sxh.gd b/ld/testsuite/ld-mips-elf/pr21375sxh.gd
new file mode 100644 (file)
index 0000000..a3deac7
--- /dev/null
@@ -0,0 +1,16 @@
+Primary GOT:
+ Canonical gp value: 00008270
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  00000280 -32752\(gp\) 00000000 Lazy resolver
+  00000284 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  00000288 -32744\(gp\) 00000000
+  0000028c -32740\(gp\) 00000000
+
+ Global entries:
+   Address     Access  Initial Sym\.Val\. Type    Ndx Name
+  00000290 -32736\(gp\) 00000000 00000000 NOTYPE  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375sxh.sd b/ld/testsuite/ld-mips-elf/pr21375sxh.sd
new file mode 100644 (file)
index 0000000..8ec224b
--- /dev/null
@@ -0,0 +1,5 @@
+Symbol table '\.dynsym' contains 3 entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0000020.    4. FUNC    GLOBAL DEFAULT    5 foo
+     2: 00000000     0 NOTYPE  GLOBAL PROTECTED  ABS __gnu_absolute_zero
diff --git a/ld/testsuite/ld-mips-elf/pr21375v.ver b/ld/testsuite/ld-mips-elf/pr21375v.ver
new file mode 100644 (file)
index 0000000..35d1a71
--- /dev/null
@@ -0,0 +1 @@
+PR21375 { global: foo; local: *; };