How to use llvm linker?

LLVM provides 2 llvm-link and llvm-ld tools. I'd like to know:

  • How to merge the entire .o file into one?

  • how to set a similar name using gcc -Wl, -soname, libsomething.so.1?

I would like to do this in C ++, but if you show me how to do this from the command line, I will find how to do it in C ++.

thank

+5
source share
1 answer
  • llvm-link is a tool for linking (~ merging) LLVM IR files to another LLVM IR file.
  • llvm-ldtrying to be compatible with ld. Note that LLVM does not currently have real binding capabilities, so it llvm-ldcalls gccto complete the actual final steps.

: GCC, clang:

clang -c file.c -fpic
clang -shared file.o -o file.so

-Wl clang, gcc:

clang -shared file.o -Wl,-soname,libfile.so.8 -o file.so
+9

All Articles