binutils Newspaper
OCTOBER 6, 2026
x86 — Proposed

x86: Generate PLT32 relocation for ".long foo@PLT - .L4"

H.J. Lu confirms the necessity and correctness of generating R_X86_64_PLT32 for specific directives to resolve PC32 relocations against function symbols.

In response to Jan Beulich’s questions, H.J. Lu clarifies that the patch is necessary for generating the R_X86_64_PLT32 relocation for directives like “.long foo@PLT - .L4”. This ensures that PLT entries are used to resolve PC32 relocations against function symbols, addressing a reported gas PR.

In the Thread 1 participant
  1. H.J. Lu proposer

    Confirms that the patch correctly generates the R_X86_64_PLT32 relocation for specific directives, enabling the use of PLT entries for PC32 relocation against function symbols. This addresses a gas PR.

    “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 PC32 relocation against function symbols for such directives.”

In Details

This discussion pertains to a patch for the x86 architecture in binutils that introduces a new relocation type, BFD_RELOC_X86_64_PLT32. The patch's goal is to correctly generate the R_X86_64_PLT32 ELF relocation type for specific assembler directives, such as ".long foo@PLT - .L4". This is crucial for ensuring that indirect function calls via the Procedure Linkage Table (PLT) are resolved properly using PC32 relative addressing, particularly in scenarios involving function symbols.

For Context
x86
A family of instruction set architectures developed by Intel, widely used in personal computers and servers.
relocation
A process performed by the linker to adjust memory addresses in code or data segments of an object file so that they can be correctly loaded and executed at a specific memory location.
PLT32
A specific type of relocation that targets the Procedure Linkage Table (PLT) and involves a 32-bit offset, often used for function calls.
R_X86_64_PLT32
An ELF relocation type for the x86-64 architecture, indicating a PC32-relative relocation against a PLT entry.
PC32
A relocation type that computes a 32-bit offset relative to the current Program Counter (PC).
GAS
GNU Assembler, part of the GNU toolchain responsible for converting assembly code into machine code.
BFD
GNU Binary File Descriptor library, providing a common interface to various object file formats.
Filed Under: binutilsx86relocationlinkerassembler