binutils Newspaper
NOVEMBER 30, 2026
ld/pe — Proposed

ld/PE: ignore R_*_ABS / R_*_NONE

The PE linker will now ignore R_*_ABS and R_*_NONE relocations instead of erroring on them.

This patch modifies the PE linker to gracefully ignore relocation types designated as R_ABS or R_NONE. Previously, these might have caused errors. The change allows these relocations to be used for ‘interesting purposes’ without halting the linking process, and introduces a new test case to verify this behavior.

In Details

This patch modifies ld/pe-dll.c to skip relocations where BITS_AND_SHIFT(relocs[i]->howto->bitsize, relocs[i]->howto->rightshift) results in BITS_AND_SHIFT(0, 0), effectively ignoring ABS/NONE type relocations. This change is accompanied by a new test case (ld/testsuite/ld-pe/reloc-none.*) and associated test runner configuration (pe.exp) to validate that these previously problematic relocations are now handled correctly without erroring out, aligning with their potential use cases.

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.
R_*_ABS / R_*_NONE
Relocation types that do not alter the binary's content. R_*_ABS typically refers to absolute symbol relocations, while R_*_NONE indicates no relocation is needed. These are analogous to ELF's R_X86_64_NONE.
BITS_AND_SHIFT
A macro used within binutils to extract the bitsize and rightshift parameters from a relocation howto structure.
Filed Under: linkerPE/COFFrelocation