1

Helllo,

On my WSL2 ubuntu 20.04 system, when I use the following command to invoke ld.lld, everything is OK:

clang -fuse-ld=/usr/local/bin/ld.lld ....

But when the option "--target=aarch64" is added, it will invoke gcc.

clang -fuse-ld=/usr/local/bin/ld.lld --target=aarch64

The actual command will be:

'/usr/bin/gcc' -fuse-ld=/usr/local/bin/ld.lld --target=aarch64

Note: when I run the below command, it shows:

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) 

Note: At the same time I have link edthe ld to ld.lld by using following command:

sudo ln -fs /usr/local/bin/ld.lld /usr/bin/ld

Thanks,

Simon

simon
  • 23
  • 4
  • *"The actual command will be"* How did you determine it? – HolyBlackCat Oct 30 '21 at 11:09
  • 1
    @HolyBlackCat I add the information about it, thanks! – simon Oct 30 '21 at 12:26
  • 2
    Why is this a problem? FWIW, if you're asking about why, the reason it's done is that gcc contains a tediously long table of flags and libraries to use on different platforms, and the llvm maintainers are too cowardly/lazy/smart/… to put in the work to duplicate all that. Instead they sometimes use gcc to invoke ld with the right flags. – arnt Oct 30 '21 at 13:10

0 Answers0