aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-11-24 11:32:14 -0800
committerH.J. Lu <hjl.tools@gmail.com>2020-11-24 11:32:26 -0800
commitd0089f12f6f40e7b69fd432ef4915908407379f2 (patch)
tree9badcdd8208ee829a6bbe48628bec3a1197a2183 /ld
parent1c64f6cbcfb2acef1f80b6c03d989d77f9237779 (diff)
downloadfsf-binutils-gdb-d0089f12f6f40e7b69fd432ef4915908407379f2.zip
fsf-binutils-gdb-d0089f12f6f40e7b69fd432ef4915908407379f2.tar.gz
fsf-binutils-gdb-d0089f12f6f40e7b69fd432ef4915908407379f2.tar.bz2
ld/x86-64: Add PR gold/26939 tests
GOTPCRELX relocations can be transformed only when addend == -4. Add tests for GOTPCRELX relocations with addend != -4. PR gold/26939 * testsuite/ld-x86-64/pr26939-x32.d: New file. * testsuite/ld-x86-64/pr26939.d: Likewise. * testsuite/ld-x86-64/pr26939.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run PR gold/26939 tests.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/testsuite/ld-x86-64/pr26939-x32.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr26939.d12
-rw-r--r--ld/testsuite/ld-x86-64/pr26939.s5
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp2
5 files changed, 40 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2d687f9..0faa03a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/26939
+ * testsuite/ld-x86-64/pr26939-x32.d: New file.
+ * testsuite/ld-x86-64/pr26939.d: Likewise.
+ * testsuite/ld-x86-64/pr26939.s: Likewise.
+ * testsuite/ld-x86-64/x86-64.exp: Run PR gold/26939 tests.
+
2020-11-23 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26918
diff --git a/ld/testsuite/ld-x86-64/pr26939-x32.d b/ld/testsuite/ld-x86-64/pr26939-x32.d
new file mode 100644
index 0000000..af2c023
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr26939-x32.d
@@ -0,0 +1,13 @@
+#source: pr26939.s
+#as: --x32
+#ld: -pie -melf32_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+#...
+[ ]*[a-f0-9]+: 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ <.*>
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr26939.d b/ld/testsuite/ld-x86-64/pr26939.d
new file mode 100644
index 0000000..d02bdfc
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr26939.d
@@ -0,0 +1,12 @@
+#as: --64
+#ld: -pie -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+#...
+[ ]*[a-f0-9]+: 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ <.*>
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr26939.s b/ld/testsuite/ld-x86-64/pr26939.s
new file mode 100644
index 0000000..f961361
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr26939.s
@@ -0,0 +1,5 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ movl _start@GOTPCREL+4(%rip), %eax
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index b99e6f1..99c8a33 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -659,6 +659,8 @@ run_dump_test "pr20253-5b"
run_dump_test "tlsdesc2"
run_dump_test "pr22048"
run_dump_test "pr22929"
+run_dump_test "pr26939"
+run_dump_test "pr26939-x32"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"