[2.46 PATCH]: ld: Maintain the input file order

Project / Subsystem

binutils / binutils

Date

2026-05-02

Proposer

"H.J. Lu" <hjl.tools@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Backporting the patch ensures stability for the 2.46 release, but it may introduce unforeseen regressions.
  • The fix is limited to Linux/x86-64 and Linux/aarch64 due to test dependencies.
  • The patch might increase the complexity of the linker code.

All attributes

project
binutils
subsystem
binutils
patch_id
discussion_id
CAMe9rOou0Nsz12kg-9ToWVsuO7KcsuLh3ce5X_bHP9=Og-sVRg@mail.gmail.com
source_type
public_inbox
title
[2.46 PATCH]: ld: Maintain the input file order
headline
Ld: Maintain the input file order.
tldr
This patch backports a fix to binutils 2.46 to maintain the correct input file order during linking with LTO, especially when using linker scripts.
proposer
"H.J. Lu" <hjl.tools@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Backporting the patch ensures stability for the 2.46 release, but it may introduce unforeseen regressions.
  • The fix is limited to Linux/x86-64 and Linux/aarch64 due to test dependencies.
  • The patch might increase the complexity of the linker code.
series_id
series_role
standalone
series_parts
[]
tags
  • binutils
  • ld
  • linker
  • LTO
  • linker script
bugzilla_url
date
2026-05-02T00:00:00.000Z

[2.46 PATCH]: ld: Maintain the input file order

This patch backports a fix from the master branch to the binutils 2.46 branch to address an issue where the linker (ld) reorders input files when linking with Link-Time Optimization (LTO) and linker scripts. Specifically, when libraries are included via the GROUP command in a linker script (e.g., -lm pulling in /usr/lib64/libm.a), the order of archive members can be changed during LTO rescan. This is important for maintaining the correct symbol resolution order and preventing unexpected linking errors.