Add ability to extract raw bitcode #276
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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., renamingobj_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.