[llvm] Add --offoading option to llvm-readobj (PR #143342)
David Salinas via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 09:04:00 PDT 2025
================
@@ -230,4 +232,21 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile &Obj,
}
}
+// TODO: add proper error handling.
+void ObjDumper::printOffloading(const object::ObjectFile &Obj) {
+ // we can use an argument to let user select which offloading section they
+ // want to print. but for now, we're hardcoding ELF and "hip_fatbin".
+ assert((Obj.isELF() || Obj.isCOFF()) && "Invalid file type");
+
+ SmallVector<llvm::object::OffloadBundleFatBin> Bundles;
+ if (Error Err = llvm::object::extractOffloadBundleFatBinary(Obj, Bundles))
----------------
david-salinas wrote:
The API routine extractOffloadBundleFatBinary generates it's own error message. I don't really need to add to it here. So I'm just going std::move() the Err into reportWarning() along with the object's filename.
https://github.com/llvm/llvm-project/pull/143342
More information about the llvm-commits
mailing list