Page 1 of 1

Clang using GCC as linker?

Posted: Thu Sep 15, 2022 8:13 pm
by nexos
Hello,
I was doing some work on my OS and noticed how clang calls my host's GCC to perform linking, seemingly discarding -fuse-ld=lld. How come this is?

I would like for my OSes build environment to be completely isolated from the host's tools so that it doesn't rely on anything in the host. Also, I don't want to have whole layer extra where issues could prop up. How can I make clang use LLD directly for linking and not GCC?

Thanks,
nexos

Re: Clang using GCC as linker?

Posted: Thu Sep 22, 2022 10:05 am
by eekee
lld might be a stub which calls gcc. You could query your package manager to see if there's another package which provides lld.

`file $(which lld)` may show obvious signs of it being a stub, but don't rely on it.

Re: Clang using GCC as linker?

Posted: Sat Sep 24, 2022 7:58 am
by nexos
No, because running with -V shows gcc calling /usr/bin/ld.lld (since clang forwarded -fuse-ld=lld to gcc). It works fine currently, it's just that I'd like clang to call my custom built lld.

Re: Clang using GCC as linker?

Posted: Sat Oct 01, 2022 11:46 am
by nexos
I did the simplest thing: simple add the path of my LLD before /usr/bin. How simple :oops: