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

Fix assumptions about dynamic sections for some ELF backends

Correctly handle cases where dynamic sections are not created even if dynobj is set.

Several ELF backends in BFD incorrectly assumed that the presence of a dynamic object pointer implied the creation of dynamic sections. This patch corrects this by moving assertions to check for dynamic section creation status, fixing issues in backends like mn10300, cr16, cris, m68k, vax, bfin, lm32, m32c, rl78, and xstormy16. It also adds checks for specific sections before use, preventing potential crashes.

In Details

This patch revises multiple ELF backends within BFD to address an incorrect assumption: that a non-NULL dynobj pointer necessitates the existence of dynamic sections. This assumption fails when dynobj is set without a corresponding create_dynamic_sections call, as seen with ppc64's early stub BFD setup. The fixes involve reordering checks and explicitly verifying the creation of dynamic sections or specific related sections before proceeding, enhancing robustness for these targets.

For Context
BFD
The Binary File Descriptor library, a low-level interface for reading and writing object file formats.
ELF
Executable and Linkable Format, a common standard for object file formats on Unix-like systems.
dynobj
A pointer within BFD that typically points to structures related to dynamic linking, indicating that dynamic sections might be present.
dynamic sections
Sections in an ELF object file that contain information necessary for dynamic linking, such as symbol tables for dynamic linking and relocation entries.
Filed Under: elflinkerbackendbugfix