Skip to content

self-contained linker: conservatively default to -znostart-stop-gc on x64 linux#137685

Merged
bors merged 1 commit intorust-lang:masterfrom
lqd:nostart-stop-gc
Mar 8, 2025
Merged

self-contained linker: conservatively default to -znostart-stop-gc on x64 linux#137685
bors merged 1 commit intorust-lang:masterfrom
lqd:nostart-stop-gc

Conversation

@lqd
Copy link
Copy Markdown
Member

@lqd lqd commented Feb 26, 2025

To help stabilization, this PR disables an LLD optimization on x64 linux with respect to --gc-sections and encapsulation symbols: it will reduce the number of crates needing to opt-out of lld due to this bfd / lld difference. For example, all the people using linkme, which doesn't work with lld or on nightly, need to disable lld.

More information about all this, and the historical differences, can be found in:

This optimization has no visible impact on our benchmarks, so we can use it by default and have a safer/more conservative starting point to remove friction during migration. We can them emit an FCW for the cases where lld detects reliance on encapsulation symbols without -znostart-stop-gc, and then revert back to lld's default after a while. No one compiling on nightly relies on this difference, obviously, so doing an FCW is not necessary until after lld is used on stable.

I've tested that this correctly links on linkme examples. I've also quickly tried to crate an rmake test but the setup with encapsulation symbols is annoying to reproduce: a few link section/name attributes is not enough, we also need to collect symbols between the encapsulation symbols, without referencing them in code, for -znostart-stop-gc to only impact this... It should of course be doable though, maybe @Kobzol will look into it if they have time.

r? @petrochenkov

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants