How to build clang into a monolithic bitcode file?

Hi all,

I am wondering if there is any quick way to tweak the "Makefile" of
clang (or LLVM) such that compiling clang can arrive at its bitcode
file (where the symbols from llvm are already resolved), rather than
the executable file?

Xiaolong

Hi all,

I am wondering if there is any quick way to tweak the "Makefile" of
clang (or LLVM) such that compiling clang can arrive at its bitcode
file (where the symbols from llvm are already resolved), rather than
the executable file?

On linux with gold you can you pass -plugin-opt=also-emit-llvm=foo.bc to the linker when linking clang. Note that that will give you the bitcode after it is merged, but before it is optimized.

Xiaolong

Cheers,
Rafael