Closed
Description
This issue is related to stabilizing use of LLD from rustc and/or making it default - rust-lang/compiler-team#510, #39915.
GCC and Clang have several ways to specify linker.
-B directory
, you specify a search directory, then the compiler finds a file namedld
in it an uses it as a linker.
This is the old way working on all versions of GCC and Clang that we want to support (?).-fuse-ld=bfd|gold|lld|mold
limited to 4 well-known linker names, you specify the name, then the compiler finds a file namedld.name
in its search directories.
This is a somewhat new way, the well-known name-fuse-ld=lld
works in Clang, and in GCC since 2018 (which GCC version?).-fuse-ld=/absolute/path/to/lld
, where you specify the full linker path.
This doesn't work with GCC, and worked with Clang since 2016, but is now deprecated in favor of--ld-path
.--ld-path=/absolute/path/to/lld
, where you specify the full linker path.
This doesn't work with GCC, and works with Clang since 2021.
rustc
needs to tell C compiler to use LLD in two modes
- "Self-contained" mode when we need to find the LLD shipped with rustc.
This mode always uses-B directory
right now (after Simplify implementation of-Z gcc-ld
#97375) just because it's simple to do, but it also means that old compilers are supported. - Mode in which we should find system-provided LLD.
QUESTIONS:- How should we do it?
- Do we care about older GCC versions that don't support
-fuse-ld=lld
?