How to invoke LLVM's whole-program devirtualization feature in bitcode generation using wllvm
See original GitHub issueI am trying to build a whole-program bitcode using wllvm for a large C++ project with many source files (configured by bazel build system using CROSSTOOL) and also need to invoke LLVM’s whole-program devirtualization feature (whole-program-vtables) in the bitcode generation. For a single source file, I can invoke the whole-program devirtualization feature by clang -c -emit-llvm -flto -fwhole-program-vtables *.cpp -o *.bc
(lto needs to be invoked when invoking whole-program-vtables feature).
However, when I pass the compiler flag -flto and -fwhole-program-vtables into CROSSTOOL and invoke clang and wllvm to generate the whole-program bitcode, a lot of warning outputs WARNING:Cannot attach bitcode path to "*.o of type UNKNOWN"
are generated and the bitcode generation fails. I checked wllvm’s source code and it seems that this warning is related to https://github.com/travitch/whole-program-llvm/blob/474ff73744024a6747d997b2aec99ea6705769e5/wllvm/compilers.py#L115
Is there any clue why this happens? Did I make any wrong configuration? Is there any way to invoke LLVM’s whole-program devirtualization feature (whole-program-vtables) in wllvm? Thank you for your input.
Issue Analytics
- State:
- Created 3 years ago
- Comments:18
https://github.com/SRI-CSL/gllvm has a good README. You will want to wait until I port yesterday’s fix, which I will do this afternoon. I will let you know.
Just finished building the bitcode without the virtualization flags. It works. I am pulling your update and run wllvm again to see if it also works. Thanks.