Currently, the way LLD (and using it as a default linker for a given target) is configured in bootstrap is a big mess. We have:
rust.use-lld, which tells bootstrap to use LLD when building local Rust components, so it is only relevant for bootstrapping and faster local (re)builds.
rust.lld, which both:
- Tells bootstrap to build LLD and include it in the built rustc's sysroot
- Tells rustc to use
rust-lld by default (ONLY on x86_64-unknown-linux-gnu)
rust.default-linker, which changes the default linker to be used by rustc, but this does not work on Linux, which is why we used the rust.lld hack above
I would suggest the following, based on prior discussions in #146604 and other PRs:
We should keep the old options for some time, to keep backwards compatibility.
Currently, the way LLD (and using it as a default linker for a given target) is configured in bootstrap is a big mess. We have:
rust.use-lld, which tells bootstrap to use LLD when building local Rust components, so it is only relevant for bootstrapping and faster local (re)builds.rust.lld, which both:rust-lldby default (ONLY onx86_64-unknown-linux-gnu)rust.default-linker, which changes the default linker to be used by rustc, but this does not work on Linux, which is why we used therust.lldhack aboveI would suggest the following, based on prior discussions in #146604 and other PRs:
rust.use-lldto e.g.rust.bootstrap-override-lld, to make it clear that it's a bootstrapping-only flag.rust.use-lldtorust.bootstrap-override-lld#147046MoveEdit: I don't think it's worth the churn.rust.lldtollvm.lld, because the LLVM section configures which LLVM-adjacent things we build, and make it only mean "build LLD and add it to sysroot", nothing elsetarget.<target>.default-linker-linux, which can be either unset or "self-contained-lld-cc". It will be mutually exclusive withrust.default_linker.We should keep the old options for some time, to keep backwards compatibility.