将程序的bitcode附加到它的二进制文件中

时间:2012-10-24 06:44:22

标签: llvm

LLVM中是否存在传递或某些内容,它会将给定的llvm::Module序列化为二进制形式,然后将此数据放入源模块中?因此,当我将其链接到二进制文件时,我最终将编译代码的bitcode表示与单个文件中的本机代码链接?

如果没有,你能就如何实现这个提出一些建议吗?

1 个答案:

答案 0 :(得分:2)

This functionality is partially implemented in Clang/LLVM now and is called ThinLTO. It is now possible to run clang -c -emit-llvm -flto=thin source.cpp and this would produce a LLVM bitcode file with same bitcode embedded in it. Support for writing native object file with embedded bitcode is being worked on.