summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-x86-64
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2011-08-12 19:42:38 +0000
committerH.J. Lu <hjl.tools@gmail.com>2011-08-12 19:42:38 +0000
commit9f4075d56b56ae1e9327bccbda105425c3f159b8 (patch)
tree162c836e5ba7f9dfbf72be8300b25a2c0bf3ed46 /ld/testsuite/ld-x86-64
parent2f9549c43dacdc63e5135d0dae7b861970cdbb75 (diff)
downloadbinutils-redhat-9f4075d56b56ae1e9327bccbda105425c3f159b8.tar.gz
Add R_X86_64_RELATIVE64 and handle R_X86_64_64 for x32.
bfd/ 2011-08-12 H.J. Lu <hongjiu.lu@intel.com> PR ld/13082 * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_RELATIVE64. (elf_x86_64_relocate_section): Treat R_X86_64_64 like R_X86_64_32 and zero-extend it to 64bit if addend is zero for x32. Generate R_X86_64_RELATIVE64 for x32. include/elf/ 2011-08-12 H.J. Lu <hongjiu.lu@intel.com> PR ld/13082 * x86-64.h (R_X86_64_RELATIVE64): New. ld/testsuite/ 2011-08-12 H.J. Lu <hongjiu.lu@intel.com> PR ld/13082 * ld-x86-64/pr13082-1.s: New. * ld-x86-64/pr13082-1a.d: Likewise. * ld-x86-64/pr13082-1b.d: Likewise. * ld-x86-64/pr13082-2.s: Likewise. * ld-x86-64/pr13082-2a.d: Likewise. * ld-x86-64/pr13082-2b.d: Likewise. * ld-x86-64/pr13082-3.s: Likewise. * ld-x86-64/pr13082-3a.d: Likewise. * ld-x86-64/pr13082-3b.d: Likewise. * ld-x86-64/pr13082-4.s: Likewise. * ld-x86-64/pr13082-4a.d: Likewise. * ld-x86-64/pr13082-4b.d: Likewise. * ld-x86-64/pr13082-5.s: Likewise. * ld-x86-64/pr13082-5a.d: Likewise. * ld-x86-64/pr13082-5b.d: Likewise. * ld-x86-64/pr13082-6.s: Likewise. * ld-x86-64/pr13082-6a.d: Likewise. * ld-x86-64/pr13082-6b.d: Likewise. * ld-x86-64/x86-64.exp: Run pr13082-[1-6][ab].
Diffstat (limited to 'ld/testsuite/ld-x86-64')
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-1.s10
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-1a.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-1b.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-2.s9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-2a.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-2b.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-3.s10
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-3a.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-3b.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-4.s10
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-4a.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-4b.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-5.s12
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-5a.d14
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-5b.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-6.s11
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-6a.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr13082-6b.d13
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp12
19 files changed, 199 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/pr13082-1.s b/ld/testsuite/ld-x86-64/pr13082-1.s
new file mode 100644
index 0000000000..6c03e980e4
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-1.s
@@ -0,0 +1,10 @@
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+.L1:
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad .L1
diff --git a/ld/testsuite/ld-x86-64/pr13082-1a.d b/ld/testsuite/ld-x86-64/pr13082-1a.d
new file mode 100644
index 0000000000..f0e98ffc90
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-1a.d
@@ -0,0 +1,9 @@
+#source: pr13082-1.s
+#name: PR ld/13082-1 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE64 +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/pr13082-1b.d b/ld/testsuite/ld-x86-64/pr13082-1b.d
new file mode 100644
index 0000000000..f10481f85e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-1b.d
@@ -0,0 +1,9 @@
+#source: pr13082-1.s
+#name: PR ld/13082-1 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE64 +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/pr13082-2.s b/ld/testsuite/ld-x86-64/pr13082-2.s
new file mode 100644
index 0000000000..d1847a6557
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-2.s
@@ -0,0 +1,9 @@
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad _start
diff --git a/ld/testsuite/ld-x86-64/pr13082-2a.d b/ld/testsuite/ld-x86-64/pr13082-2a.d
new file mode 100644
index 0000000000..aed33c2416
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-2a.d
@@ -0,0 +1,9 @@
+#source: pr13082-2.s
+#name: PR ld/13082-2 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +_start \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr13082-2b.d b/ld/testsuite/ld-x86-64/pr13082-2b.d
new file mode 100644
index 0000000000..b000e85bba
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-2b.d
@@ -0,0 +1,9 @@
+#source: pr13082-2.s
+#name: PR ld/13082-2 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/pr13082-3.s b/ld/testsuite/ld-x86-64/pr13082-3.s
new file mode 100644
index 0000000000..b76eb0f938
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-3.s
@@ -0,0 +1,10 @@
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .weak func
+ .align 8
+.Ljmp:
+ .quad func
diff --git a/ld/testsuite/ld-x86-64/pr13082-3a.d b/ld/testsuite/ld-x86-64/pr13082-3a.d
new file mode 100644
index 0000000000..bf176f983a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-3a.d
@@ -0,0 +1,9 @@
+#source: pr13082-3.s
+#name: PR ld/13082-3 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +func \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr13082-3b.d b/ld/testsuite/ld-x86-64/pr13082-3b.d
new file mode 100644
index 0000000000..12efaf0964
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-3b.d
@@ -0,0 +1,9 @@
+#source: pr13082-3.s
+#name: PR ld/13082-3 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +func \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr13082-4.s b/ld/testsuite/ld-x86-64/pr13082-4.s
new file mode 100644
index 0000000000..ed8506d5e6
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-4.s
@@ -0,0 +1,10 @@
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .weak func
+ .align 8
+.Ljmp:
+ .quad func + 1
diff --git a/ld/testsuite/ld-x86-64/pr13082-4a.d b/ld/testsuite/ld-x86-64/pr13082-4a.d
new file mode 100644
index 0000000000..bb2c573557
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-4a.d
@@ -0,0 +1,9 @@
+#source: pr13082-4.s
+#name: PR ld/13082-4 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +[0-9a-f]+ +func \+ 1
diff --git a/ld/testsuite/ld-x86-64/pr13082-4b.d b/ld/testsuite/ld-x86-64/pr13082-4b.d
new file mode 100644
index 0000000000..cb4d90af19
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-4b.d
@@ -0,0 +1,9 @@
+#source: pr13082-4.s
+#name: PR ld/13082-4 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +[0-9a-f]+ +func \+ 1
diff --git a/ld/testsuite/ld-x86-64/pr13082-5.s b/ld/testsuite/ld-x86-64/pr13082-5.s
new file mode 100644
index 0000000000..9757fcbf82
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-5.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+ .globl ifunc
+ .type ifunc, @gnu_indirect_function
+_start:
+ lea .Ljmp(%rip), %rax
+ifunc:
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad ifunc
diff --git a/ld/testsuite/ld-x86-64/pr13082-5a.d b/ld/testsuite/ld-x86-64/pr13082-5a.d
new file mode 100644
index 0000000000..e5b0c113e7
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-5a.d
@@ -0,0 +1,14 @@
+#source: pr13082-5.s
+#name: PR ld/13082-5 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +ifunc\(\)+ +ifunc \+ 0
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_GLOB_DAT +ifunc\(\)+ +ifunc \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +ifunc\(\)+ +ifunc \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr13082-5b.d b/ld/testsuite/ld-x86-64/pr13082-5b.d
new file mode 100644
index 0000000000..1c5a5e79b5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-5b.d
@@ -0,0 +1,13 @@
+#source: pr13082-5.s
+#name: PR ld/13082-5 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/pr13082-6.s b/ld/testsuite/ld-x86-64/pr13082-6.s
new file mode 100644
index 0000000000..eb88fb6f3e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-6.s
@@ -0,0 +1,11 @@
+ .text
+ .globl _start
+ .type ifunc, @gnu_indirect_function
+_start:
+ lea .Ljmp(%rip), %rax
+ifunc:
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad ifunc
diff --git a/ld/testsuite/ld-x86-64/pr13082-6a.d b/ld/testsuite/ld-x86-64/pr13082-6a.d
new file mode 100644
index 0000000000..9a1a655185
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-6a.d
@@ -0,0 +1,13 @@
+#source: pr13082-6.s
+#name: PR ld/13082-6 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/pr13082-6b.d b/ld/testsuite/ld-x86-64/pr13082-6b.d
new file mode 100644
index 0000000000..792c3483eb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr13082-6b.d
@@ -0,0 +1,13 @@
+#source: pr13082-6.s
+#name: PR ld/13082-6 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 2b8721c142..77b081ba46 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -213,6 +213,18 @@ run_dump_test "ia32-3"
run_dump_test "lp64-1"
run_dump_test "lp64-2"
run_dump_test "lp64-3"
+run_dump_test "pr13082-1a"
+run_dump_test "pr13082-1b"
+run_dump_test "pr13082-2a"
+run_dump_test "pr13082-2b"
+run_dump_test "pr13082-3a"
+run_dump_test "pr13082-3b"
+run_dump_test "pr13082-4a"
+run_dump_test "pr13082-4b"
+run_dump_test "pr13082-5a"
+run_dump_test "pr13082-5b"
+run_dump_test "pr13082-6a"
+run_dump_test "pr13082-6b"
# Must be native with the C compiler
if { [isnative] && [which $CC] != 0 } {