binutils Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
x86

Ensure dynamic relocation section is created when needed

x86 linker now correctly handles errors during relocation processing to ensure dynamic relocation sections are created.

The x86 linker now correctly handles cases where a dynamic relocation section is needed but hasn’t been created due to earlier relocation processing errors. Previously, if elf_link_read_relocs_from_section aborted due to a bad relocation, subsequent processing would halt, preventing the creation of the necessary dynamic relocation section. This commit adds a check to skip dynamic relocation counting if the needed section has not been created, preventing potential errors and ensuring correct linking.

In Details

Modifies _bfd_x86_elf_late_size_sections to check if srel (needed dynamic relocation section) exists before attempting to count relocations. If srel is NULL, it prints an error and continues, addressing a scenario where previous relocation errors prevented its creation, as seen in PR ld/34448.

For Context
x86
A family of instruction set architectures for microprocessors, commonly used in personal computers and servers.
dynamic relocation
Relocation information that is used by the dynamic linker at runtime to resolve symbols and adjust addresses in shared libraries or position-independent executables.
relocation
A process performed by the linker or dynamic linker to adjust symbolic references and addresses in machine code to their final locations in memory.
ELF
Executable and Linkable Format. A common standard file format for object files, executables, shared libraries, and core dumps on Unix-like systems.
BFD
Binary File Descriptor library. A low-level library used by binutils and GDB to support various binary file formats, including ELF.
Filed Under: x86linkerrelocationelferror handling