self-contained linker: conservatively default to -znostart-stop-gc on x64 linux#137685
Merged
bors merged 1 commit intorust-lang:masterfrom Mar 8, 2025
Merged
self-contained linker: conservatively default to -znostart-stop-gc on x64 linux#137685bors merged 1 commit intorust-lang:masterfrom
-znostart-stop-gc on x64 linux#137685bors merged 1 commit intorust-lang:masterfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To help stabilization, this PR disables an LLD optimization on x64 linux with respect to
--gc-sectionsand 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
linkmeexamples. 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-gcto only impact this... It should of course be doable though, maybe @Kobzol will look into it if they have time.r? @petrochenkov