Why does clang / llvm for Windows require Visual Studio Link.exe?

According to LLVM Getting Started Website (Windows) :

... Clang can be used to emit bit code, directly emit object files or even related executables using Visual Studios link.exe.

Why is it necessary to use Link.exe for Windows? And for that matter, what is used on Mac / Linux? Further down says:

 Compile the program to object code using the LLC code generator: C:\..> llc -filetype=obj hello.bc Link to binary using Microsoft link: C:\..> link hello.obj -defaultlib:libcmt 

Why can't the LLC complete the last step? LLI is working fine, so I guess it interacts with Link.exe somehow under the hood - why can't the LLC?

+7
source share
2 answers

Because no one wrote a linker for LLVM.

There is a project for this (called unimaginably lld ), but it is not ready yet.

See http://lld.llvm.org for more details.

On mac, people use Apple linker, ld .

On Linux, most people use the gnu linker, usually (also) named ld

+11
source

Try MinGW-W64 ld. I used it with llvm clang instead of the VS tools that I used to create clang in the first place.

+5
source

All Articles