binutils Newspaper
NOVEMBER 30, 2026
ld/pe — Proposed

ld/PE: use in_reloc_p()

Updates the PE linker to use the generic in_reloc_p() function for relocation type checking.

This patch updates the PE linker to utilize the in_reloc_p() function, which is intended to consolidate relocation type checking logic. The goal is to remove custom relocation type handling for section, section relative, image base relative, and ABS/NONE relocations by ensuring these types are correctly identified by the generic function across various architectures.

In Details

This patch modifies the PE/COFF linker's BFD backend to use a standardized in_reloc_p() function for determining whether a relocation type should be processed. It aims to eliminate architecture-specific logic within ld/pe-dll.c by ensuring that the in_reloc_p() helper in BFD backends (like coff-aarch64.c, coff-arm.c, coff-mcore.c, coff-x86_64.c) correctly identifies and filters out non-altering relocations (e.g., ABSOLUTE, SECREL, SECTION) across different architectures.

For Context
PE/COFF
Portable Executable/Common Object File Format, the executable file format used by Windows operating systems. Binutils' ld supports this format for Windows targets.
relocation
A modification of a program or its data in the executable or library by the linker or loader to resolve symbolic references and make it runnable at its final address. Relocation types specify how the address or value should be calculated.
in_reloc_p
A BFD helper function that determines if a given relocation type should be considered for processing, typically by checking if it modifies the binary's content.
ABS/NONE relocation
Relocation types that do not alter the binary's content, often used for metadata or to indicate that no relocation is needed for a symbol.
Filed Under: linkerPE/COFFrelocation