Open
Description
This is a metabug, constraining the unbound scope of #39915.
What is lld
A linker that's part of the llvm project, which is desirable for two reasons:
- it's very friendly to cross compilation (hence its emphasis for embedded targets)
- it's very fast (often runs in half the time as Gold -- linking can take several minutes for big projects (rustc, servo, etc.) and linking can be a huge % of the compile with incremental builds, so halving this runtime is a Big Deal.)
Rust currently ships its own copy of lld which it calls rust-lld. This is used by default to link bare-metal targets and wasm.
Goal
The goal of this metabug is to use rust-lld by default when targeting x64 msvc windows (as opposed to e.g. mingw windows). It's possible this will incidentally get other windows targets working, but I'm constraining scope for the sake of focusing efforts.
This configuration is already in a decent state, with backend support already implemented. It's just a matter of making that configuration stable enough to use by default.
To test using rust-lld for msvc targets, use -C linker=lld
Blocking Issues
- Linking libtest with lld-link results in undefined symbols #68647 - linking libtest results in undefined symbols
- rust-analyser segfault with lto=thin, linker=lld-link #71504 - rust-analyser segfault with lto=thin, linker=lld-link
- Incorrect compilation / STATUS_ACCESS_VIOLATION when linking with lld with target-cpu set #72145 - LLD/COFF does not correctly align TLS section
- ACCESS_VIOLATION when dereferencing once_cell::Lazy in closure with LTO #81408 - ACCESS_VIOLATION when dereferencing once_cell::Lazy in closure with LTO
- Windows
rust-lld
does not support the MSVCmanifestdependency
.drectve
#85642 - Windows rust-lld does not support the MSVC manifestdependency .drectve - STATUS_ACCESS_VIOLATION when running rend3 on Windows MSVC linked with LLD and thin LTO #111480