admin管理员组文章数量:1289537
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.
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.
1 Answer
Reset to default -1Although 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.
本文标签: llvmHow to specify the default linker for Clang when compiling from sourceStack Overflow
版权声明:本文标题:llvm - How to specify the default linker for Clang when compiling from source? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741434276a2378544.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
clang
to default to the LLVM linkerlld
? Depending on your install environment and configuration,lld
should be built along withclang
and will act as the default linker. – J. Nolan Faught Commented Feb 22 at 2:57/another/location/ld
, so even if I would like it to uselld
I don't know how to... – Welgriv Commented Feb 24 at 9:10