我正在像这样编译我的程序,
clang++ -O4 -emit-llvm file1.cpp -c -o file1.bc -pthread
clang++ -O4 -emit-llvm file2.cpp -c -o file2.bc -pthread
llvm-link file1.bc file2.bc -o main.ll -S
如何指定与-ldl的链接
llvm-link
is a program which "links" together LLVM IR files into a single IR file; you can read more about it here. It does not have any relation to ld
or to linking object files together.
If you do want to generate object code and/or executables, see these related questions:
In short, you should be using native tools for assembling and linking (as
and ld
, for instance), though there is currently some experimental support for generating object files and for linking in LLVM.
In any case, Clang itself can invoke a platform linker - that is actually the default, but of course you have overridden by providing -c
.