* 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.
This commit is contained in:
Maciej W. Rozycki 2012-08-06 22:45:18 +00:00
parent 9e8082845f
commit 43b5366be5
13 changed files with 133 additions and 0 deletions

View File

@ -1,3 +1,18 @@
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

View File

@ -0,0 +1,9 @@
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 *

View File

@ -0,0 +1,10 @@
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 *

View File

@ -0,0 +1,6 @@
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 *

View File

@ -0,0 +1,6 @@
.data
.globl bar
.type bar, @object
bar:
.dc.a _gp
.size bar, . - bar

View File

@ -0,0 +1,13 @@
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 *

View File

@ -0,0 +1,7 @@
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

View File

@ -0,0 +1,7 @@
.data
.globl foo
.type foo, @object
foo:
.dc.a bar
.dc.a _gp
.size foo, . - foo

View File

@ -0,0 +1 @@
{ global: foo; local: *; };

View File

@ -0,0 +1,5 @@
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

View File

@ -0,0 +1,7 @@
.data
.globl blah
.type blah, @object
blah:
.dc.a foo
.dc.a _gp
.size blah, . - blah

View File

@ -0,0 +1,9 @@
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

View File

@ -328,6 +328,44 @@ if { $linux_gnu } {
"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}"]]
}
}