aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-08-27 16:05:54 +0930
committerAlan Modra <amodra@gmail.com>2015-08-27 23:21:21 +0930
commit1cb0b71f5a2e5b55e1c4b41fc308414572180893 (patch)
treefe974a9fcd305f3cc04a29986173c0f42c60ab55
parent2e57ce7b1422a025a65ad4ef0b1f2f4c214b9eec (diff)
downloadgdb-1cb0b71f5a2e5b55e1c4b41fc308414572180893.zip
gdb-1cb0b71f5a2e5b55e1c4b41fc308414572180893.tar.gz
gdb-1cb0b71f5a2e5b55e1c4b41fc308414572180893.tar.bz2
Add reloc sort test
* ld-powerpc/relocsort.s, * ld-powerpc/relocsort.d: New test. * ld-powerpc/powerpc.exp: Run it.
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp1
-rw-r--r--ld/testsuite/ld-powerpc/relocsort.d30
-rw-r--r--ld/testsuite/ld-powerpc/relocsort.s26
4 files changed, 62 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 67ef467..7650cda 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-27 Alan Modra <amodra@gmail.com>
+
+ * ld-powerpc/relocsort.s, * ld-powerpc/relocsort.d: New test.
+ * ld-powerpc/powerpc.exp: Run it.
+
2015-08-26 Nick Clifton <nickc@redhat.com>
PR ld/18401
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 0b53c0b..4211063 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -287,6 +287,7 @@ if [ supports_ppc64 ] then {
run_dump_test "tocvar"
run_dump_test "tocnovar"
run_dump_test "tlsld"
+ run_dump_test "relocsort"
}
run_dump_test "tlsld32"
diff --git a/ld/testsuite/ld-powerpc/relocsort.d b/ld/testsuite/ld-powerpc/relocsort.d
new file mode 100644
index 0000000..a32e725
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/relocsort.d
@@ -0,0 +1,30 @@
+#source: relocsort.s
+#as: -a64
+#ld: -r -melf64ppc
+#readelf: -r --wide
+
+.* contains 23 entries:
+.*
+0+0 +[0-9a-f]+ R_PPC64_GOT_TLSGD16 +0+0 x \+ 0
+0+0 +[0-9a-f]+ R_PPC64_NONE +0
+0+0 +[0-9a-f]+ R_PPC64_ADDR32 +1
+0+0 +[0-9a-f]+ R_PPC64_ADDR24 +2
+0+0 +[0-9a-f]+ R_PPC64_ADDR16 +3
+0+0 +[0-9a-f]+ R_PPC64_ADDR16_LO +4
+0+0 +[0-9a-f]+ R_PPC64_ADDR16_HI +5
+0+0 +[0-9a-f]+ R_PPC64_ADDR16_HA +6
+0+0 +[0-9a-f]+ R_PPC64_ADDR14 +7
+0+0 +[0-9a-f]+ R_PPC64_ADDR14_BRTAKEN +8
+0+0 +[0-9a-f]+ R_PPC64_ADDR14_BRNTAKE +9
+0+4 +[0-9a-f]+ R_PPC64_REL24 +0+0 __tls_get_addr \+ 0
+0+4 +[0-9a-f]+ R_PPC64_TLSGD +0+0 x \+ 0
+0+8 +[0-9a-f]+ R_PPC64_REL24 +a
+0+8 +[0-9a-f]+ R_PPC64_REL14 +b
+0+8 +[0-9a-f]+ R_PPC64_REL14_BRTAKEN +c
+0+8 +[0-9a-f]+ R_PPC64_REL14_BRNTAKEN +d
+0+8 +[0-9a-f]+ R_PPC64_GOT16 +e
+0+8 +[0-9a-f]+ R_PPC64_GOT16_LO +f
+0+8 +[0-9a-f]+ R_PPC64_GOT16_HI +10
+0+8 +[0-9a-f]+ R_PPC64_GOT16_HA +11
+0+8 +[0-9a-f]+ R_PPC64_NONE +12
+0+8 +[0-9a-f]+ R_PPC64_COPY +13
diff --git a/ld/testsuite/ld-powerpc/relocsort.s b/ld/testsuite/ld-powerpc/relocsort.s
new file mode 100644
index 0000000..8e05d69
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/relocsort.s
@@ -0,0 +1,26 @@
+# Deliberately create out-of-order relocs to test that ld -r sorts them.
+ .text
+ .long 0, 0, 0
+ .reloc 4, R_PPC64_REL24, __tls_get_addr
+ .reloc 4, R_PPC64_TLSGD, x
+ .reloc 0, R_PPC64_GOT_TLSGD16, x
+ .reloc 0, R_PPC64_NONE, 0
+ .reloc 0, R_PPC64_ADDR32, 1
+ .reloc 0, R_PPC64_ADDR24, 2
+ .reloc 8, R_PPC64_REL24, 10
+ .reloc 8, R_PPC64_REL14, 11
+ .reloc 8, R_PPC64_REL14_BRTAKEN, 12
+ .reloc 0, R_PPC64_ADDR16, 3
+ .reloc 0, R_PPC64_ADDR16_LO, 4
+ .reloc 0, R_PPC64_ADDR16_HI, 5
+ .reloc 0, R_PPC64_ADDR16_HA, 6
+ .reloc 0, R_PPC64_ADDR14, 7
+ .reloc 8, R_PPC64_REL14_BRNTAKEN, 13
+ .reloc 8, R_PPC64_GOT16, 14
+ .reloc 8, R_PPC64_GOT16_LO, 15
+ .reloc 8, R_PPC64_GOT16_HI, 16
+ .reloc 8, R_PPC64_GOT16_HA, 17
+ .reloc 8, R_PPC64_NONE, 18
+ .reloc 8, R_PPC64_COPY, 19
+ .reloc 0, R_PPC64_ADDR14_BRTAKEN, 8
+ .reloc 0, R_PPC64_ADDR14_BRNTAKEN, 9