aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-09-20 05:37:04 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-09-20 05:44:35 +0800
commit8015b1b0c1a1d3a581099c4855f95e4adfa3c0ad (patch)
treee4a0f30c6e0a6edff9b102efa8aaef0da89960fd /ld
parentgdb/MAINTAINERS: update my email address (diff)
downloadbinutils-gdb-8015b1b0c1a1d3a581099c4855f95e4adfa3c0ad.tar.gz
binutils-gdb-8015b1b0c1a1d3a581099c4855f95e4adfa3c0ad.tar.bz2
binutils-gdb-8015b1b0c1a1d3a581099c4855f95e4adfa3c0ad.zip
x86-64: Never make R_X86_64_GOT64 section relative
R_X86_64_GOT64 relocation should never be made section relative. Change tc_i386_fix_adjustable to return 0 for BFD_RELOC_X86_64_GOT64. gas/ PR gas/32189 * config/tc-i386.c (tc_i386_fix_adjustable): Return 0 for BFD_RELOC_X86_64_GOT64. * testsuite/gas/i386/reloc64.d: Updated. * testsuite/gas/i386/reloc64.s: Add more tests for R_X86_64_GOT64 and R_X86_64_GOTOFF64. ld/ PR gas/32189 * testsuite/ld-x86-64/x86-64.exp: Run PR gas/32189 test. * testsuite/ld-x86-64/pr32189.s: New file. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-x86-64/pr32189.s35
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp8
2 files changed, 43 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/pr32189.s b/ld/testsuite/ld-x86-64/pr32189.s
new file mode 100644
index 00000000000..3d0f682d663
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr32189.s
@@ -0,0 +1,35 @@
+ .text
+ .global _start
+_start:
+ leaq 1f(%rip), %r11
+1:
+ movabs $_GLOBAL_OFFSET_TABLE_, %r15
+ leaq (%r11,%r15), %r15
+
+ movabs $ptr@GOT, %rax
+ movabs $Ldst@GOTOFF, %rdx
+ movq (%rax,%r15), %rax
+ leaq (%rdx,%r15), %rcx
+ movq %rcx, (%rax)
+
+ # Write out "PASS\n".
+ movl $5, %edx
+ movl $.LC0, %esi
+ movl $1, %edi
+ movl $1, %eax
+ syscall
+
+ # exit
+ movq $60, %rax
+ movq $0, %rdi
+ syscall
+
+ .data
+Ldst:
+ .quad 0
+ptr:
+ .quad 0
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
+ .string "PASS\n"
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index e729b69a7cd..c203fbe4037 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -1921,6 +1921,14 @@ if { [isnative] && [check_compiler_available] } {
"pass.out" \
"-fPIE" \
] \
+ [list \
+ "Run pr32189" \
+ "-nostdlib -nostartfiles" \
+ "" \
+ { pr32189.s } \
+ "pr32189" \
+ "pass.out" \
+ ] \
]
# Run-time tests which require working ifunc attribute support.