0

I am compiling my program like this,

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 

How do I specify linking with -ldl

pythonic
  • 20,589
  • 43
  • 136
  • 219

1 Answers1

3

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.

Community
  • 1
  • 1
Oak
  • 26,231
  • 8
  • 93
  • 152