aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMarcus Shawcroft <mshawcroft@sourceware.org>2013-04-10 12:00:14 +0000
committerMarcus Shawcroft <mshawcroft@sourceware.org>2013-04-10 12:00:14 +0000
commitedb2fa9a965edcd8c747be6fe6e9d8a75397708d (patch)
treec42a296f57e42da5bd945aefac70520158d2bd3a /ld
parent393fd4c3768e4babdc112fded0bde4aedd40925e (diff)
downloadgdb-edb2fa9a965edcd8c747be6fe6e9d8a75397708d.zip
gdb-edb2fa9a965edcd8c747be6fe6e9d8a75397708d.tar.gz
gdb-edb2fa9a965edcd8c747be6fe6e9d8a75397708d.tar.bz2
2013-04-10 Venkataramanan Kumar <venkataramanan.kumar@linaro.org>
* ld-aarch64/gc-plt1.s: New file. * ld-aarch64/gc-plt2.s: Likewise. * ld-aarch64/gc-plt-hidden.s: Likewise. * ld-aarch64/gc-plt-main.s: Likewise. * ld-aarch64/gc-relocs-257.s: Likewise. * ld-aarch64/gc-plt-relocs.d: Update expected objdump. * ld-aarch64/gc-relocs-257.d: Likewise. * ld-aarch64/gc-relocs-257-dyn.d: Likewise. * ld-aarch64/aarch64-elf.exp: Add test.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog12
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp3
-rw-r--r--ld/testsuite/ld-aarch64/gc-plt-hidden.s7
-rw-r--r--ld/testsuite/ld-aarch64/gc-plt-main.s8
-rw-r--r--ld/testsuite/ld-aarch64/gc-plt-relocs.d48
-rw-r--r--ld/testsuite/ld-aarch64/gc-plt1.s9
-rw-r--r--ld/testsuite/ld-aarch64/gc-plt2.s11
-rw-r--r--ld/testsuite/ld-aarch64/gc-relocs-257-dyn.d16
-rw-r--r--ld/testsuite/ld-aarch64/gc-relocs-257.d16
-rw-r--r--ld/testsuite/ld-aarch64/gc-relocs-257.s8
10 files changed, 138 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index b105b52..d11c4e5 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2013-04-10 Venkataramanan Kumar <venkataramanan.kumar@linaro.org>
+
+ * ld-aarch64/gc-plt1.s: New file.
+ * ld-aarch64/gc-plt2.s: Likewise.
+ * ld-aarch64/gc-plt-hidden.s: Likewise.
+ * ld-aarch64/gc-plt-main.s: Likewise.
+ * ld-aarch64/gc-relocs-257.s: Likewise.
+ * ld-aarch64/gc-plt-relocs.d: Update expected objdump.
+ * ld-aarch64/gc-relocs-257.d: Likewise.
+ * ld-aarch64/gc-relocs-257-dyn.d: Likewise.
+ * ld-aarch64/aarch64-elf.exp: Add test.
+
2013-04-08 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* ld-aarch64/gc-tls-relocs.d: Handle big endian format.
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index f913fe6..d687cc2 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -111,3 +111,6 @@ run_dump_test "tls-relax-ie-le-3"
run_dump_test "tlsle-symbol-offset"
run_dump_test "gc-got-relocs"
run_dump_test "gc-tls-relocs"
+run_dump_test "gc-plt-relocs"
+run_dump_test "gc-relocs-257-dyn"
+run_dump_test "gc-relocs-257"
diff --git a/ld/testsuite/ld-aarch64/gc-plt-hidden.s b/ld/testsuite/ld-aarch64/gc-plt-hidden.s
new file mode 100644
index 0000000..bb6fe75
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-plt-hidden.s
@@ -0,0 +1,7 @@
+ .text
+ .globl hidfn
+ .hidden hidfn
+ .type hidfn, %function
+hidfn:
+ and x0, x0, x0
+ .size hidfn, . - hidfn
diff --git a/ld/testsuite/ld-aarch64/gc-plt-main.s b/ld/testsuite/ld-aarch64/gc-plt-main.s
new file mode 100644
index 0000000..6f6c903
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-plt-main.s
@@ -0,0 +1,8 @@
+ .data
+ .global var
+ .text
+ .globl _start
+ .type _start, %function
+_start:
+ bl foo
+ .size _start, . - _start
diff --git a/ld/testsuite/ld-aarch64/gc-plt-relocs.d b/ld/testsuite/ld-aarch64/gc-plt-relocs.d
new file mode 100644
index 0000000..6c4d3ca
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-plt-relocs.d
@@ -0,0 +1,48 @@
+#source: gc-plt1.s
+#source: gc-plt-main.s
+#source: gc-plt-hidden.s
+#source: gc-plt2.s
+#ld: --gc-sections -T aarch64.ld --shared
+#objdump: -dT
+
+# Shared object with plt related relocs against global symbol
+# and local functions gced. After gc-section removal we are
+# checking that the function does not exist.
+
+.*: file format elf64-(little|big)aarch64
+
+DYNAMIC SYMBOL TABLE:
+0+8000 l d \.text 0+ \.text
+0+8000 g DF \.text 0+4 _start
+0+0000 D \*UND\* 0+ foo
+0+8008 g DF \.text 0+ bar
+
+Disassembly of section .text:
+
+0+8000 \<_start\>:
+ 8000: 9400000c bl 8030 \<foo\+0x24\>
+
+0+8004 \<hidfn\>:
+ 8004: 8a000000 and x0, x0, x0
+
+0+8008 \<bar\>:
+ 8008: 14000001 b 800c \<foo\>
+
+0+800c \<foo\>:
+ 800c: 97fffffe bl 8004 \<hidfn\>
+
+Disassembly of section .plt:
+
+0+8010 \<\.plt\>:
+ 8010: a9bf7bf0 stp x16, x30, \[sp,#-16\]!
+ 8014: b0000010 adrp x16, 9000 .*
+ 8018: f9400a11 ldr x17, \[x16,#16\]
+ 801c: 91004210 add x16, x16, #0x10
+ 8020: d61f0220 br x17
+ 8024: d503201f nop
+ 8028: d503201f nop
+ 802c: d503201f nop
+ 8030: b0000010 adrp x16, 9000 .*
+ 8034: f9400e11 ldr x17, \[x16,#24\]
+ 8038: 91006210 add x16, x16, #0x18
+ 803c: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/gc-plt1.s b/ld/testsuite/ld-aarch64/gc-plt1.s
new file mode 100644
index 0000000..b786353
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-plt1.s
@@ -0,0 +1,9 @@
+plt_relocs:
+ adrp x0, :pg_hi21:var
+ ldr x0, [x0, :lo12:var]
+
+ adrp x1, :pg_hi21_nc:var
+ ldr x1, [x1, :lo12:var]
+
+ b bar
+ bl foo
diff --git a/ld/testsuite/ld-aarch64/gc-plt2.s b/ld/testsuite/ld-aarch64/gc-plt2.s
new file mode 100644
index 0000000..e9fb4cb
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-plt2.s
@@ -0,0 +1,11 @@
+ .text
+ .align 2
+ .global bar
+ .type bar, %function
+bar:
+ b foo
+
+ .align 2
+ .type foo, %function
+foo:
+ bl hidfn
diff --git a/ld/testsuite/ld-aarch64/gc-relocs-257-dyn.d b/ld/testsuite/ld-aarch64/gc-relocs-257-dyn.d
new file mode 100644
index 0000000..f1f7eb6
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-relocs-257-dyn.d
@@ -0,0 +1,16 @@
+#source: gc-start.s
+#source: gc-relocs-257.s
+#ld: --defsym tempy=0x11012 --defsym tempy2=0x45034 --defsym tempy3=0x1234 -T aarch64.ld -shared --gc-sections
+#objdump: -R -d
+
+# This tests if the linker is able to remove dynamic relocs created
+# for R_AARCH64_ABS64 while removing a gc section. The section is
+# also removed. So after gc, we should be left with the startup code.
+
+.*: file format elf64-(little|big)aarch64
+
+
+Disassembly of section .text:
+
+0+8000 \<_start\>:
+ 8000: d503201f nop
diff --git a/ld/testsuite/ld-aarch64/gc-relocs-257.d b/ld/testsuite/ld-aarch64/gc-relocs-257.d
new file mode 100644
index 0000000..ffa7571
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-relocs-257.d
@@ -0,0 +1,16 @@
+#source: gc-start.s
+#source: gc-relocs-257.s
+#ld: --defsym tempy=0x11012 --defsym tempy2=0x45034 --defsym tempy3=0x1234 -T aarch64.ld --gc-sections
+#objdump: -d
+
+# This tests if linker is able to remove gc section containing
+# R_AARCH64_ABS64 relocs. So after gc, we should be left with
+# only the startup code.
+
+.*: file format elf64-(little|big)aarch64
+
+
+Disassembly of section .text:
+
+0+8000 \<_start\>:
+ 8000: d503201f nop
diff --git a/ld/testsuite/ld-aarch64/gc-relocs-257.s b/ld/testsuite/ld-aarch64/gc-relocs-257.s
new file mode 100644
index 0000000..dcc9db1
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/gc-relocs-257.s
@@ -0,0 +1,8 @@
+ .text
+ .word tempy
+ .xword tempy2
+ .hword tempy3
+ .hword tempy3+8
+
+ and x0, x0, x0
+ and x0, x0, #0x1