* ld-mips-elf/gp-hidden.sd: New test.
* ld-mips-elf/gp-hidden-lib.rd: New test.
* ld-mips-elf/gp-hidden-ver.rd: New test.
* ld-mips-elf/gp-hidden-64.rd: New test.
* ld-mips-elf/gp-hidden-lib-64.rd: New test.
* ld-mips-elf/gp-hidden-ver-64.rd: New test.
* ld-mips-elf/gp-hidden.s: New test source.
* ld-mips-elf/gp-hidden-lib.s: New test source.
* ld-mips-elf/gp-hidden-ver.s: New test source.
* ld-mips-elf/gp-hidden-ver.ver: New test version script.
* ld-mips-elf/mips-elf.exp: Run the new tests.
+2012-08-06 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * ld-mips-elf/gp-hidden.rd: New test.
+ * ld-mips-elf/gp-hidden.sd: New test.
+ * ld-mips-elf/gp-hidden-lib.rd: New test.
+ * ld-mips-elf/gp-hidden-ver.rd: New test.
+ * ld-mips-elf/gp-hidden-64.rd: New test.
+ * ld-mips-elf/gp-hidden-lib-64.rd: New test.
+ * ld-mips-elf/gp-hidden-ver-64.rd: New test.
+ * ld-mips-elf/gp-hidden.s: New test source.
+ * ld-mips-elf/gp-hidden-lib.s: New test source.
+ * ld-mips-elf/gp-hidden-ver.s: New test source.
+ * ld-mips-elf/gp-hidden-ver.ver: New test version script.
+ * ld-mips-elf/mips-elf.exp: Run the new tests.
+
2012-08-06 Maciej W. Rozycki <macro@codesourcery.com>
* ld-mips-elf/rel32-o32.d: Adjust section VMAs after the removal
--- /dev/null
+
+Relocation section '\.rel\.dyn' at offset .* contains 2 entries:
+ *Offset * Info * Type * Sym\. *Value * Sym\. *Name
+[0-9a-f]+ * 0+00000000 * R_MIPS_NONE *
+ * Type2: R_MIPS_NONE *
+ * Type3: R_MIPS_NONE *
+[0-9a-f]+ * [0-9a-f]+00001203 * R_MIPS_REL32 * [0-9a-f]+ * foo
+ * Type2: R_MIPS_64 *
+ * Type3: R_MIPS_NONE *
--- /dev/null
+
+Relocation section '\.rel\.dyn' at offset .* contains 2 entries:
+ *Offset * Info * Type * Sym\. *Value * Sym\. *Name
+[0-9a-f]+ * 0+00000000 * R_MIPS_NONE *
+ * Type2: R_MIPS_NONE *
+ * Type3: R_MIPS_NONE *
+# This must be an absolute relocation, there must not be a _gp reference.
+[0-9a-f]+ * 0+00001203 * R_MIPS_REL32 *
+ * Type2: R_MIPS_64 *
+ * Type3: R_MIPS_NONE *
--- /dev/null
+
+Relocation section '\.rel\.dyn' at offset .* contains 2 entries:
+ *Offset * Info * Type * Sym\. *Value * Sym\. *Name
+[0-9a-f]+ * 0+00 * R_MIPS_NONE *
+# This must be an absolute relocation, there must not be a _gp reference.
+[0-9a-f]+ * 0+03 * R_MIPS_REL32 *
--- /dev/null
+ .data
+ .globl bar
+ .type bar, @object
+bar:
+ .dc.a _gp
+ .size bar, . - bar
--- /dev/null
+
+Relocation section '\.rel\.dyn' at offset .* contains 3 entries:
+ *Offset * Info * Type * Sym\. *Value * Sym\. *Name
+[0-9a-f]+ * 0+00000000 * R_MIPS_NONE *
+ * Type2: R_MIPS_NONE *
+ * Type3: R_MIPS_NONE *
+# This must be an absolute relocation, there must not be a _gp reference.
+[0-9a-f]+ * 0+00001203 * R_MIPS_REL32 *
+ * Type2: R_MIPS_64 *
+ * Type3: R_MIPS_NONE *
+[0-9a-f]+ * [0-9a-f]+00001203 * R_MIPS_REL32 * [0-9a-f]+ * bar
+ * Type2: R_MIPS_64 *
+ * Type3: R_MIPS_NONE *
--- /dev/null
+
+Relocation section '\.rel\.dyn' at offset .* contains 3 entries:
+ *Offset * Info * Type * Sym\. *Value * Sym\. *Name
+[0-9a-f]+ * 0+00 * R_MIPS_NONE *
+# This must be an absolute relocation, there must not be a _gp reference.
+[0-9a-f]+ * 0+03 * R_MIPS_REL32 *
+[0-9a-f]+ * [0-9a-f]+03 * R_MIPS_REL32 * [0-9a-f]+ * bar
--- /dev/null
+ .data
+ .globl foo
+ .type foo, @object
+foo:
+ .dc.a bar
+ .dc.a _gp
+ .size foo, . - foo
--- /dev/null
+{ global: foo; local: *; };
--- /dev/null
+
+Relocation section '\.rel\.dyn' at offset .* contains 2 entries:
+ *Offset * Info * Type * Sym\. *Value * Sym\. *Name
+[0-9a-f]+ * 0+00 * R_MIPS_NONE *
+[0-9a-f]+ * [0-9a-f]+03 * R_MIPS_REL32 * [0-9a-f]+ * foo
--- /dev/null
+ .data
+ .globl blah
+ .type blah, @object
+blah:
+ .dc.a foo
+ .dc.a _gp
+ .size blah, . - blah
--- /dev/null
+
+Symbol table '.dynsym' contains [0-9]+ entries:
+ * Num: * Value * Size * Type * Bind * Vis * Ndx * Name
+#...
+Symbol table '.symtab' contains [0-9]+ entries:
+ * Num: * Value * Size * Type * Bind * Vis * Ndx * Name
+#...
+ * [0-9a-f]+: * [0-9a-f]+ * 0 * NOTYPE * LOCAL * DEFAULT * ABS * _gp
+#pass
"readelf --symbols pic-and-nonpic-6-${abi}.nd" \
"readelf -d pic-and-nonpic-6-${abi}.ad"] \
"pic-and-nonpic-6-${abi}"]]
+
+ # This checks whether our linker scripts get the scope of _gp right,
+ # and must therefore use default scripts. If they don't, then -- in
+ # addition to dumps failing to match -- the final link fails with:
+ #
+ # ld: gp-hidden.o: undefined reference to symbol '_gp'
+ # ld: note: '_gp' is defined in DSO ./tmpdir/gp-hidden-lib-${abi}.so
+ # so try adding it to the linker command line
+ #
+ set suff64 [string map {o32 "" n32 "" n64 -64} $abi]
+ run_ld_link_tests [list \
+ [list \
+ "_gp scope test ($abi shared library)" \
+ "$abi_ldflags($abi) -shared" \
+ "$abi_asflags($abi) -KPIC" \
+ { gp-hidden-lib.s } \
+ [list \
+ "readelf --relocs gp-hidden-lib${suff64}.rd" \
+ "readelf --syms gp-hidden.sd"] \
+ "gp-hidden-lib-${abi}.so"] \
+ [list \
+ "_gp scope test ($abi versioned library)" \
+ "$abi_ldflags($abi) -shared -version-script gp-hidden-ver.ver tmpdir/gp-hidden-lib-${abi}.so" \
+ "$abi_asflags($abi) -KPIC" \
+ { gp-hidden-ver.s } \
+ [list \
+ "readelf --relocs gp-hidden-ver${suff64}.rd" \
+ "readelf --syms gp-hidden.sd"] \
+ "gp-hidden-ver-${abi}.so"] \
+ [list \
+ "_gp scope test ($abi executable)" \
+ "$abi_ldflags($abi) -e 0 -rpath-link . tmpdir/gp-hidden-ver-${abi}.so" \
+ "$abi_asflags($abi) -call_nonpic" \
+ { gp-hidden.s } \
+ [list \
+ "readelf --relocs gp-hidden${suff64}.rd" \
+ "readelf --syms gp-hidden.sd"] \
+ "gp-hidden-${abi}"]]
}
}