Reputation: 833
I am in the process of compiling Clang from source on my system. However, I have multiple ld
(linker) binaries available:
/usr/bin/ld
/another/location/ld
After successfully compiling Clang, it defaults to using the linker located at /another/location/ld
. However, I want Clang to use the linker at /usr/bin/ld
by default.
Is there a specific configuration option or a method to specify the default linker during the Clang compilation process?
I know there is the LLVM_USE_LINKER
CMake variable but in my understanding it specify the linker that will be used to actually compile Clang, and not the one the it will be used to compile let's say user code afterward.
Upvotes: 1
Views: 48
Reputation: 464
Although not explicitly documented in the Linux manpage or on the LLVM website, the GCC-compatible flag -fuse-ld
allows you to point clang
to a linker.
$ which ld
/usr/bin/ld
$ clang -fuse-ld=/usr/bin/ld main.c -o main
If you ever need to know exactly what linker or assembler clang
is using, the -v
flag shows all invocations made during compilation.
Upvotes: -1