[llvm-dev] [cfe-dev] LLD to be the default linker in Clang
Renato Golin via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 28 12:27:06 PDT 2016
On 28 October 2016 at 19:52, David Chisnall <David.Chisnall at cl.cam.ac.uk> wrote:
> GCC doesn’t use BFD by default, it uses /usr/bin/ld (or ${PREFIX}/bin/ld). If that is a symlink to ld.bfd, ld.gold, Apple ld64, or ld.lld, it will use whichever.
Hum, that's actually a good point.
> I think it would be very confusing for clang to use a linker that is not whatever the host system has decided the default linker should be, unless there is some compelling reason to pick a different one (e.g. you’re doing LTO with a mechanism that absolutely requires lld and not ld64/gold).
If you build GCC, and binutils, "ld" is on the path, and it all
bootstraps without glitches. If we build Clang and LLD, "lld" is on
the path, but Clang still picks the system's "ld", which is weird.
So, let's say we don't make it the default (because of your argument
above), what would be the steps to make bootstrap transparent?
Today, we can:
1. Use -DLLVM_ENABLE_LLD=True, but that only works for tests and
bootstrap (right?)
2. Use "--cflags -fuse-ld=lld" for LNT, so we can run the test suite
(I'm assuming this works, too)
3. Add an "ld" symlink into $BUILD/bin, together with the already
existing "ld.lld" and "lld-link" and put $BUILD/bin before /usr/bin on
the $PATH
They all seem kosher enough, so I'd be ok with any of them, but
they're all *additional* steps, not the default.
So maybe, a better approach would be to make LLD the default in our
own CMake scripts, via (1) above, not in the Clang driver, IFF the LLD
project is built-in.
Setting (3) above would make the test-suite transparent, too. Again,
IFF LLD is built-in.
Makes sense?
--renato
More information about the llvm-dev
mailing list