binutils Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
binutils/bfd

Use COFF r_ignore for handled relocations

Fixes bugs in COFF relocation handling by using `r_ignore` instead of changing `r_type` for already-processed relocations, preventing incorrect address emissio…

This commit modifies the COFF relocation handling for aarch64, i386, and x86_64 targets to use the r_ignore flag when a backend’s relocate_section function has already handled a relocation. Previously, these relocations might have had their r_type modified, leading to incorrect addresses being emitted for dynamic relocations. Using r_ignore clearly marks these relocations as processed by the backend, resolving this issue.

In Details

The COFF backend's relocation handling in BFD has been updated to introduce and utilize the r_ignore flag within the internal_reloc structure. When a target-specific relocate_section implementation (e.g., coff_pe_aarch64_relocate_section) fully processes a relocation, it now sets r_ignore to true instead of altering the r_type. The generic _bfd_coff_generic_relocate_section is then modified to skip any relocations where r_ignore is set. This addresses bugs in several targets where inappropriate r_type changes for already-handled dynamic relocations caused incorrect addresses…

For Context
COFF
Common Object File Format, a file format for object code used on many Unix-like systems. Binutils interacts with COFF files through its BFD library.
relocation
The process of updating symbolic references in object code to their final addresses when linking or loading. Relocations are instructions for the linker on how to modify addresses.
r_type
A field within a relocation entry that specifies the type of relocation to be performed (e.g., absolute address, PC-relative).
r_ignore
A new flag introduced to indicate that a relocation has already been handled by a specific backend function and should be skipped by generic processing.
relocate_section
A function within a target-specific BFD backend responsible for applying relocations to a particular section of an object file.
dynamic relocations
Relocations that are resolved at runtime by the dynamic linker, typically used for shared libraries and position-independent code.
Filed Under: binutilsbfdcoffrelocationaarch64