[PATCH] x86-64: Generate R_X86_64_PLT32 for ".long foo@PLT - .L4"

H.J. Lu hjl.tools@gmail.com
Sat Jul 25 02:35:20 GMT 2026


Add BFD_RELOC_X86_64_PLT32 and use it to generate R_X86_64_PLT32 for
directives like ".long foo@PLT - .L4" so that PLT entries are used to
resolve the PC32 relocation against function symbols for such directives.

bfd/

PR gas/34423
* elf64-x86-64.c (x86_64_reloc_map): Add BFD_RELOC_X86_64_PLT32.
* reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PLT32.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.

gas/

PR gas/34423
* config/tc-i386.c (x86_cons): Return BFD_RELOC_X86_64_PLT32 for
directives like ".long foo@PLT - .L4".
(tc_gen_reloc): Generate R_X86_64_PLT32 for BFD_RELOC_X86_64_PLT32
with addend computed like R_X86_64_PC32.
* testsuite/gas/i386/reloc64.l: Updated.
* testsuite/gas/i386/reloc64.s: Replace ".long xtrn@plt - ." with
".long xtrn@plt - _start".
* testsuite/gas/i386/ilp32/reloc64.l: Updated.
* testsuite/gas/i386/ilp32/reloc64.s: Replace ".long xtrn@plt - ."
with ".long xtrn@plt - ptr".
* testsuite/gas/i386/x86-64-jump-table.d: New file.
* testsuite/gas/i386/x86-64-jump-table.d: Likewise.
* testsuite/gas/i386/x86-64-jump-table.s: Likewise.
* testsuite/gas/i386/x86-64.exp: Run x86-64-jump-table.
* testsuite/gas/i386/ilp32/x86-64-jump-table.d: New file.

ld/

PR gas/34423
* testsuite/ld-x86-64/pr34423.c: New file.
* testsuite/ld-x86-64/x86-64-jump-table.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run gas/34423 tests.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-64-Generate-R_X86_64_PLT32-for-.long-foo-PLT-.L4.patch
Type: text/x-patch
Size: 13486 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260725/d62fbd68/attachment-0001.bin>


More information about the Binutils mailing list