binutils Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ld

Linker Now Orders Input Files Consistently

The linker now maintains the input file order when adding new archives from linker scripts, which fixes LTO rescanning issues.

When the linker adds a new input archive from a linker script that isn’t referenced by any inputs, it now appends it to the input file list in the correct order. This fixes a problem where compiler built-in functions were not being added to the LTO symbol table, leading to issues during LTO rescan.

In Details

When adding a new input archive from a linker script file and isn't referenced by any inputs, ld appends it to the input file list. The compiler may not add compiler builtin functions to the LTO symbol table because it doesn't really know if builtin functions will have real symbols. When ld extracts an element from the archive later during LTO rescan, the input file order must be consistent.

For Context

The linker combines compiled code (objects) and libraries into an executable. The order in which these files are provided to the linker can be significant, especially when link-time optimization (LTO) is enabled. This commit addresses an issue where the linker was not maintaining the correct input file order when adding libraries from linker scripts, which could lead to problems during the LTO process.

Filed Under: ldlinkerltolinker scriptinput file order