Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to extract raw bitcode #276

Merged
merged 2 commits into from
Jul 1, 2023

Conversation

boomanaiden154
Copy link
Collaborator

This patch adds in the ability to extract raw bitcode from a directory. This is motivated primarily by extracting LLVM IR bitcode from rust projects as it is quite easy to emit LLVM bitcode for each target but bitcode embedded in object files is much less trivial and neither solution currently provides command line arguments so they need to be reconstructed regardless.

This could probably benefit from some refactoring in the future to make it more clean. I held off on any additional refactoring before this patch as some of it was less trivial and I need some feedback at how specific IR extraction techniques are used. I believe we could unify the --thinlto_build and --input_type flags (assuming that distributed ThinLTO is always done with a linker parameter file which I'm unsure of) which might make things a little bit more clean. Some later renaming (i.e., renaming obj_file() to something more generic or using a different property might also make things more clean. If these things are desired before landing this patch I can make that work too.

Copy link
Collaborator

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this point, why not let this be a different tool that just makes the corpus_descriptor json file? it's not extracting anything anymore, right?

@boomanaiden154
Copy link
Collaborator Author

Yes, that's the plan. I just haven't had an opportunity to rewrite the patch. I'll have something up soon.

This patch adds in a make_corpus.py script (along with the associated
library and unit test) that allows for the creation of a corpus from a
directory containing LLVM bitcode files.
compiler_opt/tools/make_corpus.py Outdated Show resolved Hide resolved
compiler_opt/tools/make_corpus_lib.py Outdated Show resolved Hide resolved
compiler_opt/tools/make_corpus_lib.py Outdated Show resolved Hide resolved
@boomanaiden154 boomanaiden154 merged commit 5bf8776 into google:main Jul 1, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants