aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2012-08-06 22:45:18 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2012-08-06 22:45:18 +0000
commit43b5366be5820507e12426aa42705668231db6a3 (patch)
treeb6f20645ddc14717107b2e4d228a0734d4c20e89 /ld/testsuite
parent9e8082845f85cc1cb6be434177aa4d59e00663ff (diff)
downloadgdb-43b5366be5820507e12426aa42705668231db6a3.zip
gdb-43b5366be5820507e12426aa42705668231db6a3.tar.gz
gdb-43b5366be5820507e12426aa42705668231db6a3.tar.bz2
* 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.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog15
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-64.rd9
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-lib-64.rd10
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-lib.rd6
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-lib.s6
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-ver-64.rd13
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-ver.rd7
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-ver.s7
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden-ver.ver1
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden.rd5
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden.s7
-rw-r--r--ld/testsuite/ld-mips-elf/gp-hidden.sd9
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp38
13 files changed, 133 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index cd71a9f..19c101e 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,20 @@
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
of _gp from the global scope.
* ld-mips-elf/rel32-n32.d: Likewise.
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-64.rd b/ld/testsuite/ld-mips-elf/gp-hidden-64.rd
new file mode 100644
index 0000000..133fd48
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-64.rd
@@ -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 *
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-lib-64.rd b/ld/testsuite/ld-mips-elf/gp-hidden-lib-64.rd
new file mode 100644
index 0000000..8dbba28
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-lib-64.rd
@@ -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 *
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-lib.rd b/ld/testsuite/ld-mips-elf/gp-hidden-lib.rd
new file mode 100644
index 0000000..080dfe2
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-lib.rd
@@ -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 *
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-lib.s b/ld/testsuite/ld-mips-elf/gp-hidden-lib.s
new file mode 100644
index 0000000..988c3d3
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-lib.s
@@ -0,0 +1,6 @@
+ .data
+ .globl bar
+ .type bar, @object
+bar:
+ .dc.a _gp
+ .size bar, . - bar
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-ver-64.rd b/ld/testsuite/ld-mips-elf/gp-hidden-ver-64.rd
new file mode 100644
index 0000000..1639211
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-ver-64.rd
@@ -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 *
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-ver.rd b/ld/testsuite/ld-mips-elf/gp-hidden-ver.rd
new file mode 100644
index 0000000..31ccd2b
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-ver.rd
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-ver.s b/ld/testsuite/ld-mips-elf/gp-hidden-ver.s
new file mode 100644
index 0000000..eb4acf7
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-ver.s
@@ -0,0 +1,7 @@
+ .data
+ .globl foo
+ .type foo, @object
+foo:
+ .dc.a bar
+ .dc.a _gp
+ .size foo, . - foo
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden-ver.ver b/ld/testsuite/ld-mips-elf/gp-hidden-ver.ver
new file mode 100644
index 0000000..b6b2365
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden-ver.ver
@@ -0,0 +1 @@
+{ global: foo; local: *; };
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden.rd b/ld/testsuite/ld-mips-elf/gp-hidden.rd
new file mode 100644
index 0000000..62c9b37
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden.rd
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden.s b/ld/testsuite/ld-mips-elf/gp-hidden.s
new file mode 100644
index 0000000..154dcdd
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden.s
@@ -0,0 +1,7 @@
+ .data
+ .globl blah
+ .type blah, @object
+blah:
+ .dc.a foo
+ .dc.a _gp
+ .size blah, . - blah
diff --git a/ld/testsuite/ld-mips-elf/gp-hidden.sd b/ld/testsuite/ld-mips-elf/gp-hidden.sd
new file mode 100644
index 0000000..2e9cfbf
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/gp-hidden.sd
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index d9430ff..50e51c6 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -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}"]]
}
}