[llvm] Extend llvm objdump fatbin (PR #114834)

Jan Patrick Lehr via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 01:51:06 PST 2025


================
@@ -167,6 +216,102 @@ Error extractFromArchive(const Archive &Library,
 
 } // namespace
 
+Error OffloadBundleFatBin::ReadEntries(StringRef Buffer,
+                                       uint64_t SectionOffset) {
+  uint64_t BundleNumber = 0;
+  uint64_t NumOfEntries = 0;
+
+  // get Reader
+  BinaryStreamReader Reader(Buffer, llvm::endianness::little);
+
+  // Read the Magic String first.
+  StringRef Magic;
+  if (auto EC = Reader.readFixedString(Magic, 24)) {
+    return errorCodeToError(object_error::parse_failed);
+  }
+
+  // read the number of Code Objects (Entries) in the current Bundle.
+  if (auto EC = Reader.readInteger(NumOfEntries)) {
+    printf("OffloadBundleFatBin::ReadEntries .... failed to read number of "
----------------
jplehr wrote:

Is there a reason this uses `printf` instead of an llvm error stream?

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


More information about the llvm-commits mailing list