binutils Newspaper
NOVEMBER 30, 2026
bfd — Proposed

bfd: Fix writing of secondary reloc sections

Fixes a typo in secondary relocation writing logic, correcting internal relocation lookups.

This patch corrects a typo introduced in commit eb92a17c47ea that affected the _bfd_elf_write_secondary_reloc_section function. The typo caused internal relocations of secondary reloc sections to be incorrectly looked up, leading to corrupted data.

In the Thread 1 participant
  1. Antoine Damhet <adamhet@scaleway.com> proposer

    Submits a patch to fix a typo in BFD's secondary relocation handling, which was causing incorrect internal relocation lookups.

    “Commit eb92a17c47ea ("bfd: move sec_info from ELF to general section struct") introduced a typo in '_bfd_elf_write_secondary_reloc_section' that made the internal relocations of secondary reloc sections incorrectly looked up.”

In Details

This patch addresses a regression in the BFD library's ELF backend, specifically within the _bfd_elf_write_secondary_reloc_section function. A previous change moved sec_info from an ELF-specific structure to the general section structure. This patch corrects a typo introduced during that refactoring, where sec->sec_info was incorrectly used instead of relsec->sec_info, leading to incorrect relocation data being written.

For Context
sec_info
Likely a structure or pointer within a BFD section that holds information specific to relocations within that section.
secondary reloc sections
Sections in an object file that contain relocation information, possibly for a secondary linking or patching stage.
ELF
Executable and Linkable Format, a common standard file format for object files, executables, and shared libraries on Unix-like systems.
bfd
The Binary File Descriptor library, a core component of GNU Binutils that provides a device-independent interface to a variety of object file formats.
Filed Under: binutilsbfdrelocationsELF