make ld -u symbols load --as-needed shared libraries
Project / Subsystem
binutils / binutils
Date
2026-09-10
Proposer
Alan Modra <amodra@gmail.com>
Source type
public_inbox
Consensus
Proposed
Sentiment
—/10
Technical tradeoffs
- • Ensures libraries are linked when symbols are explicitly requested, improving predictability.
- • Requires test case adjustments to account for the changed linking behavior.
All attributes
- project
- binutils
- subsystem
- binutils
- patch_id
- —
- discussion_id
- aqJsk3F6NO4zrsmU@squeak.grove.modra.org
- source_type
- public_inbox
- title
- make ld -u symbols load --as-needed shared libraries
- headline
- ld: load --as-needed shared libraries for -u symbols
- tldr
- Make linker load --as-needed shared libraries when symbols are explicitly requested with -u.
- proposer
- Alan Modra <amodra@gmail.com>
- consensus
- Proposed
- outcome
- proposed
- sentiment_score
- —
- technical_tradeoffs
-
- • Ensures libraries are linked when symbols are explicitly requested, improving predictability.
- • Requires test case adjustments to account for the changed linking behavior.
- series_id
- —
- series_role
- standalone
- series_parts
- []
- tags
-
- • linker
- • shared libraries
- • ELF
- • symbols
- bugzilla_url
- —
- date
- 2026-09-10T00:00:00.000Z
make ld -u symbols load --as-needed shared libraries
This patch modifies the linker to treat command-line specified symbols with -u as explicit needs for —as-needed shared libraries. Previously, such libraries might not have been loaded if no other symbols explicitly required them, potentially leading to unexpected behavior or incorrect test results. The changes ensure consistency with archive library behavior and fix issues in test cases related to common symbol size.