Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5059315

Browse files
committed
remove -znostart-stop-gc workaround
Now that `#[used(linker)]` is the default on ELF, we don't need to use the `-znostart-stop-gc` link-arg workaround to match bfd's behavior when using lld.
1 parent 889638a commit 5059315

File tree

1 file changed

+0
-29
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+0
-29
lines changed

‎compiler/rustc_codegen_ssa/src/back/link.rs‎

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3327,35 +3327,6 @@ fn add_lld_args(
33273327
// this, `wasm-component-ld`, which is overridden if this option is passed.
33283328
if !sess.target.is_like_wasm {
33293329
cmd.cc_arg("-fuse-ld=lld");
3330-
3331-
// On ELF platforms like at least x64 linux, GNU ld and LLD have opposite defaults on some
3332-
// section garbage-collection features. For example, the somewhat popular `linkme` crate and
3333-
// its dependents rely in practice on this difference: when using lld, they need `-z
3334-
// nostart-stop-gc` to prevent encapsulation symbols and sections from being
3335-
// garbage-collected.
3336-
//
3337-
// More information about all this can be found in:
3338-
// - https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order
3339-
// - https://lld.llvm.org/ELF/start-stop-gc
3340-
//
3341-
// So when using lld, we restore, for now, the traditional behavior to help migration, but
3342-
// will remove it in the future.
3343-
// Since this only disables an optimization, it shouldn't create issues, but is in theory
3344-
// slightly suboptimal. However, it:
3345-
// - doesn't have any visible impact on our benchmarks
3346-
// - reduces the need to disable lld for the crates that depend on this
3347-
//
3348-
// Note that lld can detect some cases where this difference is relied on, and emits a
3349-
// dedicated error to add this link arg. We could make use of this error to emit an FCW. As
3350-
// of writing this, we don't do it, because lld is already enabled by default on nightly
3351-
// without this mitigation: no working project would see the FCW, so we do this to help
3352-
// stabilization.
3353-
//
3354-
// FIXME: emit an FCW if linking fails due its absence, and then remove this link-arg in the
3355-
// future.
3356-
if sess.target.llvm_target == "x86_64-unknown-linux-gnu" {
3357-
cmd.link_arg("-znostart-stop-gc");
3358-
}
33593330
}
33603331

33613332
if !flavor.is_gnu() {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /