question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to invoke LLVM's whole-program devirtualization feature in bitcode generation using wllvm

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
ianamasoncommented, Mar 24, 2020

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.

1reaction
hongkedavidcommented, Mar 23, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A wrapper script to build whole-program LLVM bitcode files
WLLVM provides python-based compiler wrappers that work in two steps. The wrappers first invoke the compiler as normal. Then, for each object file,...
Read more >
is there any way to force the use of clang-11 on wllvm
I am trying to use wllvm to extract the bitcode of an executable and get the dotfiles of each function out of the...
Read more >
arXiv:1508.04627v2 [cs.CR] 6 Apr 2016
WLLVM is a python-based utility that lever- ages a compiler for generating whole-program or whole-library LLVM Bitcode.
Read more >
lib/Transforms/IPO/WholeProgramDevirt.cpp Source File - LLVM
1 //===- WholeProgramDevirt.cpp - Whole program virtual call optimization ... 169 /// Provide way to prevent certain function from being devirtualized.
Read more >
wllvm - PyPI
... WLLVM, provides tools for building whole-program (or whole-library) LLVM bitcode files from an ... The wrappers first invoke the compiler as normal....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found