I installed clang-10
and lld-10
, but I cannot use lld
as the linker.
messages:
[root@mine ~]# ll /usr/local/bin/lld
-rwxr-xr-x 1 root root 79005720 Mar 26 14:26 /usr/local/bin/lld
[root@mine ~]# ll /usr/local/bin/ld.lld
lrwxrwxrwx 1 root root 3 Mar 26 14:51 /usr/local/bin/ld.lld -> lld
[root@mine ~]# lld -v
lld is a generic driver.
Invoke ld.lld (Unix), ld64.lld (macOS), lld-link (Windows), wasm-ld (WebAssembly) instead
[root@mine ~]# ld.lld -v
LLD 10.0.0 (compatible with GNU linkers)
[root@mine ~]# cat main.cpp
int main() {}
[root@mine ~]# clang++ -fuse-ld=lld main.cpp
ld.lld: error: cannot open output file a.out: Function not implemented
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Why does lld-10
not work?
If I use ld
rather than lld
:
[root@mine ~]# clang++ -fuse-ld=ld main.cpp
then everything is ok!
lld
needs to know how to parse arguments, which it determines based on which binary name you use: https://groups.google.com/g/llvm-dev/c/k3q_ATl-K_0/m/MjEb6gsCCAAJ
You need to use ld.lld
as the binary name.