binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ld/pe

ld/PE: Tolerate ABS and NONE relocations

The PE linker now correctly handles R_*_ABS and R_*_NONE relocation types, preventing errors and allowing them for various purposes.

This commit modifies the PE linker to correctly handle relocation types such as R_*_ABS and R_*_NONE. Previously, the linker would error out when encountering these relocation types. Now, they are ignored and can be used for various purposes without causing a linker failure. This change also includes new test cases to verify this behavior.

In Details

In ld/pe-dll.c, the generate_reloc function previously did not handle relocation types that do not alter the binary content, such as R_*_ABS or R_*_NONE. This commit adds a case for BITS_AND_SHIFT (0, 0) which corresponds to these types, allowing them to be skipped with a comment indicating they do not alter the binary. This prevents the linker from erroring out on valid, albeit non-modifying, relocation entries, and test cases are added to confirm this behavior.

For Context
ld
The GNU linker, responsible for combining object files and libraries into an executable or shared library.
PE
Portable Executable, a file format for executables, object code, DLLs, and system components used in 32-bit and 64-bit versions of Windows.
Relocation
Information in an object file that tells the linker how to modify code or data addresses when combining object files into an executable or shared library.
R_*_ABS / R_*_NONE
Relocation types that typically indicate no modification is needed for the address, often used for symbol definitions or specific compiler/linker directives.
Filed Under: binutilsldperelocationbugfix