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

Refine PE linker script target definitions

Correctly assigns PE linker scripts to 32-bit or 64-bit targets, preventing misconfiguration.

The linker scripts for PE (Portable Executable) object files were not accurately distinguishing between 32-bit and 64-bit targets. This commit adjusts the target definitions in pe.em (for 32-bit) and pep.em (for 64-bit) to correctly exclude irrelevant architectures. This ensures that the appropriate linker script is used based on the target architecture, preventing potential configuration issues when building PE executables.

In Details

The linker emulation scripts pe.em and pep.em define target-specific configurations for PE object files. This change refines the case ${target} statements within these scripts. It removes x86_64 from pe.em's target list, as pe.em is intended for 32-bit PE targets, and removes i[3-7]86 from pep.em's target list, as pep.em is for 64-bit PE targets. This corrects the association between linker scripts and the architectures they are meant to support.

For Context
PE
Portable Executable format, the file format used for executables, object code, DLLs, and other files on 32-bit and 64-bit versions of Windows.
linker script
A file that provides directives to the linker, controlling how input sections from object files are mapped into the output sections of an executable or library.
emulation
In this context, refers to linker configurations that support specific target executable formats, like PE for Windows.
Filed Under: ldlinkerPEWindowsemulation