你好,
在我的 WSL2 ubuntu 20.04 系统上,当我使用以下命令调用 ld.lld 时,一切正常:
clang -fuse-ld=/usr/local/bin/ld.lld ....
但是当添加选项“--target=aarch64”时,它会调用gcc。
clang -fuse-ld=/usr/local/bin/ld.lld --target=aarch64
实际的命令将是:
'/usr/bin/gcc' -fuse-ld=/usr/local/bin/ld.lld --target=aarch64
注意:当我运行以下命令时,它显示:
simon@LAPTOP-JH2M71LG:~/musl-1.2.2$ clang -fuse-ld=/usr/local/bin/ld.lld --target=aarch64 -v obj/src/unistd/writev.lo
clang version 13.0.0
Target: aarch64
Thread model: posix
InstalledDir: /usr/local/bin
"/usr/bin/gcc" -fuse-ld=/usr/local/bin/ld.lld -o a.out obj/src/unistd/writev.lo
gcc: error: unrecognized command-line option ‘-fuse-ld=/usr/local/bin/ld.lld’
clang-13: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
注意:同时,我使用以下命令将 edthe ld 链接到 ld.lld:
sudo ln -fs /usr/local/bin/ld.lld /usr/bin/ld
谢谢,
西蒙