binutils Newspaper
OCTOBER 6, 2026
x86 — Proposed

x86: Check if needed dynamic relocation section is created

Fixes binutils to avoid aborting when a needed dynamic relocation section is not created.

This patch for binutils addresses an issue where the elf_link_read_relocs_from_section function aborts on bad relocations, preventing the creation of needed dynamic relocation sections. It proposes to skip dynamic relocation counting if the section hasn’t been created, resolving PR ld/34448.

In Details

The x86 ELF linker (elfxx-x86.c) has a _bfd_x86_elf_late_size_sections function that processes relocations. If elf_link_read_relocs_from_section encounters an error, it aborts, which can lead to a failure in creating the dynamic relocation section. This patch adds a check to skip counting dynamic relocations if this section is not present, preventing an early abort and ensuring the section can be created.

For Context
relocation
The process of updating symbolic references in relocatable object code to absolute symbols, typically done by the linker.
dynamic relocation
Relocations that are resolved at runtime by the dynamic linker, used for dynamically linked executables and libraries.
PR ld/34448
A bug report filed against the GNU ld linker, identified by the number 34448.
Filed Under: bugfixlinkerx86