[llvm] Add --offoading option to llvm-readobj (PR #143342)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 01:50:04 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");
----------------
jh7370 wrote:

I don't think this should be an assertion. What happens if you specify the --offloading option with e.g. a Mach-O file? Assertions should be internal only, not user-facing.

https://github.com/llvm/llvm-project/pull/143342


More information about the llvm-commits mailing list