diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-09-22 17:06:45 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-09-23 03:45:19 +0800 |
commit | 1b714c14e40f37ea8ea02a4998c4d95f25aff7f3 (patch) | |
tree | 87c9452df802c8983479585f8a0225df718d4bce /gas/testsuite | |
parent | 104ee502450af85428012e1d3bde42d033024f22 (diff) | |
download | binutils-1b714c14e40f37ea8ea02a4998c4d95f25aff7f3.zip binutils-1b714c14e40f37ea8ea02a4998c4d95f25aff7f3.tar.gz binutils-1b714c14e40f37ea8ea02a4998c4d95f25aff7f3.tar.bz2 |
x86: Turn PLT32 to PC32 only for PC-relative relocations
commit 292676c15a615b5a95bede9ee91004d3f7ee7dfd
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Feb 13 13:44:17 2020 -0800
x86: Resolve PLT32 reloc aganst local symbol to section
resolved PLT32 relocation against local symbol to section and
commit 2585b7a5ce5830e60a089aa2316a329558902f0c
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Jul 19 06:51:19 2020 -0700
x86: Change PLT32 reloc against section to PC32
turned PLT32 relocation against section into PC32 relocation. But these
transformations are valid only for PC-relative relocations. Add fx_pcrel
check for PC-relative relocations when performing these transformations
to keep PLT32 relocation in `movq $foo@PLT, %rax`.
gas/
PR gas/32196
* config/tc-i386.c (tc_i386_fix_adjustable): Return fixP->fx_pcrel
for PLT32 relocations.
(i386_validate_fix): Turn PLT32 relocation into PC32 relocation
only if fixp->fx_pcrel is set.
* testsuite/gas/i386/reloc32.d: Updated.
* testsuite/gas/i386/reloc64.d: Likewise.
* testsuite/gas/i386/reloc32.s: Add PR gas/32196 test.
* testsuite/gas/i386/reloc64.s: Likewise.
ld/
PR gas/32196
* testsuite/ld-x86-64/plt3.s: New file.
* testsuite/ld-x86-64/x86-64.exp: Run plt3.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/i386/reloc32.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/reloc32.s | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/reloc64.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/reloc64.s | 2 |
4 files changed, 11 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/reloc32.d b/gas/testsuite/gas/i386/reloc32.d index 7d1b1ba..ebac545 100644 --- a/gas/testsuite/gas/i386/reloc32.d +++ b/gas/testsuite/gas/i386/reloc32.d @@ -43,6 +43,7 @@ Disassembly of section \.text: .*[ ]+R_386_TLS_LE[ ]+xtrn .*[ ]+R_386_TLS_LE_32[ ]+xtrn .*[ ]+R_386_TLS_LE_32[ ]+xtrn +.*[ ]+R_386_PLT32[ ]+ptr Disassembly of section \.data: #... .*[ ]+R_386_32[ ]+xtrn diff --git a/gas/testsuite/gas/i386/reloc32.s b/gas/testsuite/gas/i386/reloc32.s index e766a3d..5616cd5 100644 --- a/gas/testsuite/gas/i386/reloc32.s +++ b/gas/testsuite/gas/i386/reloc32.s @@ -162,3 +162,10 @@ bad .byte xtrn@tpoff .long xtrn@got + 4 .long xtrn@got - 4 bad .long xtrn@plt - . + + .text + movl $ptr@PLT, %eax + + .data +ptr: + .dc.a 0 diff --git a/gas/testsuite/gas/i386/reloc64.d b/gas/testsuite/gas/i386/reloc64.d index 665ede6..5fee029 100644 --- a/gas/testsuite/gas/i386/reloc64.d +++ b/gas/testsuite/gas/i386/reloc64.d @@ -59,6 +59,7 @@ Disassembly of section \.text: .*[ ]+R_X86_64_32[ ]+xtrn .*[ ]+R_X86_64_GOT64[ ]+ptr .*[ ]+R_X86_64_GOTOFF64[ ]+Ldst +.*[ ]+R_X86_64_PLT32[ ]+ptr Disassembly of section \.data: #... .*[ ]+R_X86_64_64[ ]+xtrn diff --git a/gas/testsuite/gas/i386/reloc64.s b/gas/testsuite/gas/i386/reloc64.s index 2293865..5c0f413 100644 --- a/gas/testsuite/gas/i386/reloc64.s +++ b/gas/testsuite/gas/i386/reloc64.s @@ -229,6 +229,8 @@ bad .long xtrn@plt - . .text movabs $ptr@GOT, %rax movabs $Ldst@GOTOFF, %rdx + movq $ptr@PLT, %rax + .data ptr: .quad 0 |