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

Binutils stub bfd preparation for dynamic object use

Prepares linker stub BFds for use as dynamic objects by fixing section handling and EI_CLASS settings.

This change prepares the linker’s stub BFDs to be correctly used as dynamic objects. It adjusts how sections are identified (using SEC_LINKER_CREATED instead of relying on section names or stub status) and ensures the EI_CLASS is set appropriately for ELF linking, improving compatibility with targets like Arm and AArch64.

In Details

This commit refactors BFD handling for stub sections on targets like Arm and AArch64 to use the SEC_LINKER_CREATED flag rather than specific section name checks (e.g., STUB_SUFFIX). It also correctly sets the EI_CLASS for stub BFds in bfd_elfNN_aarch64_set_options and related functions, which is necessary for passing checks in _bfd_elf_final_link. This ensures that dynamic sections within stub BFds are properly recognized and handled.

For Context
BFD
Binary File Descriptor. A data structure used by the GNU Binutils to represent and manipulate object files and executables in a generic way, abstracting underlying formats like ELF or COFF.
stub bfd
A special BFD created by the linker that serves as a placeholder or container for linker-generated information, particularly for dynamic linking.
dynamic object
A shared library or executable that relies on dynamic linking, where external symbols are resolved at runtime rather than compile time.
EI_CLASS
Part of the ELF header's identification field (e_ident), specifying the file's class (e.g., 32-bit or 64-bit).
SEC_LINKER_CREATED
A flag within BFD indicating that a section was created by the linker, not present in the original object file.
Filed Under: binutilsbfdlinkerELF