Reputation: 61
I am trying to get LLVM bitcode Example.bc
using -emit-llvm -S
option.
but I am building my file using a static library
CXXFLAGS += -emit-llvm -S
@Clang++ $(CFLAGS) $(CXXFLAGS) Example.cpp -L$(LIB_PATH) -lpthread
I get the error -emit-llvm can not be used while linking . How can I get I get LLVM IR while linking to static library ?
Upvotes: 2
Views: 1245
Reputation: 796
Compiler with -flto
flag will generate object files in LLVM bitcode format.
-save-temps
given to clang at link time will save temporary files(completely linked) in bitcode format. It can be converted to LLVM IR with llvm-dis
Upvotes: 1