2 years ago

#66691

test-img

ZuseZ3

clang - Verify embeding of bitcode

I'm currently compiling the libint library. This release to be specific. During the process, an libint2.a archive is created. I'd like to add the right compile flags such that the llvm-bc will be embeded into the object file and as a consequence into that archive.

For the first part, I've read that instead of using the fembed-bitcode flag, most people prefer using -flto, as lto will already imply the embedding. So the following Flags should be fine, right? lld links to an appropriate llvm-lld. -DCMAKE_CXX_FLAGS="-O3 -flto -fuse-ld=lld"

Now, how do I continue from here, to verify that the bitcode is part of my archive? I've mostly found solutions for apple (otool), not for ubuntu. It seems like either llvm-otool, or llvm-objdump and some grepping for the LLVM section should work, but I fail to put the pieces together. Can someone please help me with with the correct set of commands / flags, startig with my archive?

Edit: Focused my example on the relevant flags.

c++

clang

llvm

archive

0 Answers

Your Answer

Accepted video resources