-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Add --offoading option to llvm-readobj #143342
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
#include "llvm/Object/Archive.h" | ||
#include "llvm/Object/Decompressor.h" | ||
#include "llvm/Object/ObjectFile.h" | ||
#include "llvm/Object/OffloadBinary.h" | ||
#include "llvm/Object/OffloadBundle.h" | ||
#include "llvm/Support/Error.h" | ||
#include "llvm/Support/FormatVariadic.h" | ||
#include "llvm/Support/ScopedPrinter.h" | ||
|
@@ -230,4 +232,14 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile &Obj, | |
} | ||
} | ||
|
||
void ObjDumper::printOffloading(const object::ObjectFile &Obj) { | ||
SmallVector<llvm::object::OffloadBundleFatBin> Bundles; | ||
if (Error Err = object::extractOffloadBundleFatBinary(Obj, Bundles)) | ||
reportWarning(std::move(Err), Obj.getFileName()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd still like to see a test that shows this warning is printed when expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're just passing along the error message from the API routine here. There are a couple of cases where the API would return an error when "extractOffloadBundleFatBinary" is called. I agree we should have tests to verify all of the error cases in the API, though I guess I'd say those error tests should be part of the API, and not necessarily required for this tool to use the API. And we should ask the API "owner" to make those tests .... which is me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue isn't what all the different warnings are, it's to show that these warnings are propagated correctly up to the tool (though if you want to test that the API generates all the different expected warnings, using llvm-readobj as a mechanism to bubble them up, that's absolutely fine, but not what I'm asking for here). Imagine the case where you failed to actually check the value of |
||
|
||
// Print out all the FatBin Bundles that are contained in this buffer. | ||
for (const auto &[Index, Bundle] : llvm::enumerate(Bundles)) | ||
Bundle.printEntriesAsURI(); | ||
} | ||
|
||
} // namespace llvm |
Uh oh!
There was an error while loading. Please reload this page.