Skip to content

Extend llvm objdump fatbin #140286

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

Merged
merged 2 commits into from
May 23, 2025

Conversation

david-salinas
Copy link
Contributor

@david-salinas david-salinas commented May 16, 2025

Utilize the new extensions to the LLVM Offloading API to extend to llvm-objdump to handle dumping fatbin offload bundles generated by HIP. This extension to llvm-objdump adds the option --offload-fatbin. Specifying this option will take the input object/executable and extract all offload fatbin bundle entries into distinct code object files with names reflecting the source file name combined with the Bundle Entry ID. Users can also use the --arch-name option to filter offload fatbin bundle entries by their target triple.

  With the intention to provide a common API for offloading, this
  extension to the existing LLVM Offloading API adds support for
  Binary Fatbin Bundles; moving some support from the Clang offloading
  API.  The intention is to add functionality to LLVM tooling for
  Binary Fatbin Bundles in subsequent commits.

Change-Id: I907fdcbcd0545162a0ce1cf17ebf7c9f3a4dbde6
@llvmbot
Copy link
Member

llvmbot commented May 16, 2025

@llvm/pr-subscribers-llvm-binary-utilities

Author: David Salinas (david-salinas)

Changes

Patch is 69.01 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/140286.diff

10 Files Affected:

  • (modified) llvm/docs/CommandGuide/llvm-objdump.rst (+1-1)
  • (added) llvm/include/llvm/Object/OffloadBundle.h (+212)
  • (modified) llvm/lib/Object/CMakeLists.txt (+1)
  • (added) llvm/lib/Object/OffloadBundle.cpp (+473)
  • (added) llvm/test/tools/llvm-objdump/Offloading/fatbin.test (+60)
  • (modified) llvm/tools/llvm-objdump/OffloadDump.cpp (+45-1)
  • (modified) llvm/tools/llvm-objdump/OffloadDump.h (+5-1)
  • (modified) llvm/tools/llvm-objdump/llvm-objdump.cpp (+2-1)
  • (modified) llvm/unittests/Object/CMakeLists.txt (+1)
  • (added) llvm/unittests/Object/OffloadingBundleTest.cpp (+89)
diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst
index ab9f583e96ec6..5e5eaccecd2b7 100644
--- a/llvm/docs/CommandGuide/llvm-objdump.rst
+++ b/llvm/docs/CommandGuide/llvm-objdump.rst
@@ -217,7 +217,7 @@ OPTIONS
 
 .. option:: --offloading
 
-  Display the content of the LLVM offloading section.
+  Display the content of the LLVM offloading sections and HIP offload bundles.
 
 .. option:: --prefix=<prefix>
 
diff --git a/llvm/include/llvm/Object/OffloadBundle.h b/llvm/include/llvm/Object/OffloadBundle.h
new file mode 100644
index 0000000000000..b6be7c3296cc1
--- /dev/null
+++ b/llvm/include/llvm/Object/OffloadBundle.h
@@ -0,0 +1,212 @@
+//===- OffloadBundle.h - Utilities for offload bundles---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===-------------------------------------------------------------------------===//
+//
+// This file contains the binary format used for budingling device metadata with
+// an associated device image. The data can then be stored inside a host object
+// file to create a fat binary and read by the linker. This is intended to be a
+// thin wrapper around the image itself. If this format becomes sufficiently
+// complex it should be moved to a standard binary format like msgpack or ELF.
+//
+//===-------------------------------------------------------------------------===//
+
+#ifndef LLVM_OBJECT_OFFLOADBUNDLE_H
+#define LLVM_OBJECT_OFFLOADBUNDLE_H
+
+#include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Object/Binary.h"
+#include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Compression.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include <memory>
+
+namespace llvm {
+
+namespace object {
+
+class CompressedOffloadBundle {
+private:
+  static inline const size_t MagicSize = 4;
+  static inline const size_t VersionFieldSize = sizeof(uint16_t);
+  static inline const size_t MethodFieldSize = sizeof(uint16_t);
+  static inline const size_t FileSizeFieldSize = sizeof(uint32_t);
+  static inline const size_t UncompressedSizeFieldSize = sizeof(uint32_t);
+  static inline const size_t HashFieldSize = sizeof(uint64_t);
+  static inline const size_t V1HeaderSize =
+      MagicSize + VersionFieldSize + MethodFieldSize +
+      UncompressedSizeFieldSize + HashFieldSize;
+  static inline const size_t V2HeaderSize =
+      MagicSize + VersionFieldSize + FileSizeFieldSize + MethodFieldSize +
+      UncompressedSizeFieldSize + HashFieldSize;
+  static inline const llvm::StringRef MagicNumber = "CCOB";
+  static inline const uint16_t Version = 2;
+
+public:
+  static llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
+  compress(llvm::compression::Params P, const llvm::MemoryBuffer &Input,
+           bool Verbose = false);
+  static llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
+  decompress(llvm::MemoryBufferRef &Input, bool Verbose = false);
+};
+
+/// Bundle entry in binary clang-offload-bundler format.
+struct OffloadBundleEntry {
+  uint64_t Offset = 0u;
+  uint64_t Size = 0u;
+  uint64_t IDLength = 0u;
+  StringRef ID;
+  OffloadBundleEntry(uint64_t O, uint64_t S, uint64_t I, StringRef T)
+      : Offset(O), Size(S), IDLength(I), ID(T) {}
+  void dumpInfo(raw_ostream &OS) {
+    OS << "Offset = " << Offset << ", Size = " << Size
+       << ", ID Length = " << IDLength << ", ID = " << ID;
+  }
+  void dumpURI(raw_ostream &OS, StringRef FilePath) {
+    OS << ID.data() << "\tfile://" << FilePath << "#offset=" << Offset
+       << "&size=" << Size << "\n";
+  }
+};
+
+/// Fat binary embedded in object files in clang-offload-bundler format
+class OffloadBundleFatBin {
+
+  uint64_t Size = 0u;
+  StringRef FileName;
+  uint64_t NumberOfEntries;
+  SmallVector<OffloadBundleEntry> Entries;
+
+public:
+  SmallVector<OffloadBundleEntry> getEntries() { return Entries; }
+  uint64_t getSize() const { return Size; }
+  StringRef getFileName() const { return FileName; }
+  uint64_t getNumEntries() const { return NumberOfEntries; }
+
+  static Expected<std::unique_ptr<OffloadBundleFatBin>>
+  create(MemoryBufferRef, uint64_t SectionOffset, StringRef FileName);
+  Error extractBundle(const ObjectFile &Source);
+
+  Error dumpEntryToCodeObject();
+
+  Error readEntries(StringRef Section, uint64_t SectionOffset);
+  void dumpEntries() {
+    for (OffloadBundleEntry &Entry : Entries)
+      Entry.dumpInfo(outs());
+  }
+
+  void printEntriesAsURI() {
+    for (OffloadBundleEntry &Entry : Entries)
+      Entry.dumpURI(outs(), FileName);
+  }
+
+  OffloadBundleFatBin(MemoryBufferRef Source, StringRef File)
+      : FileName(File), NumberOfEntries(0),
+        Entries(SmallVector<OffloadBundleEntry>()) {}
+
+  SmallVector<OffloadBundleEntry> entryIDContains(StringRef Str) {
+
+    SmallVector<OffloadBundleEntry> Found = SmallVector<OffloadBundleEntry>();
+    llvm::transform(Entries, std::back_inserter(Found), [Str](auto &X) {
+      if (X.ID.contains(Str))
+        return X;
+    });
+    return Found;
+  }
+};
+
+enum UriTypeT { FILE_URI, MEMORY_URI };
+
+struct OffloadBundleURI {
+  int64_t Offset = 0;
+  int64_t Size = 0;
+  uint64_t ProcessID = 0;
+  StringRef FileName;
+  UriTypeT URIType;
+
+  // Constructors
+  // TODO: add a Copy ctor ?
+  OffloadBundleURI(StringRef File, int64_t Off, int64_t Size)
+      : Offset(Off), Size(Size), ProcessID(0), FileName(File),
+        URIType(FILE_URI) {}
+
+public:
+  static Expected<std::unique_ptr<OffloadBundleURI>>
+  createOffloadBundleURI(StringRef Str, UriTypeT Type) {
+    switch (Type) {
+    case FILE_URI:
+      return createFileURI(Str);
+      break;
+    case MEMORY_URI:
+      return createMemoryURI(Str);
+      break;
+    default:
+      return createStringError(object_error::parse_failed,
+                               "Unrecognized URI type");
+    }
+  }
+
+  static Expected<std::unique_ptr<OffloadBundleURI>>
+  createFileURI(StringRef Str) {
+    int64_t O = 0;
+    int64_t S = 0;
+
+    if (!Str.consume_front("file://"))
+      return createStringError(object_error::parse_failed,
+                               "Reading type of URI");
+
+    StringRef FilePathname =
+        Str.take_until([](char C) { return (C == '#') || (C == '?'); });
+    Str = Str.drop_front(FilePathname.size());
+
+    if (!Str.consume_front("#offset="))
+      return createStringError(object_error::parse_failed,
+                               "Reading 'offset' in URI");
+
+    StringRef OffsetStr = Str.take_until([](char C) { return C == '&'; });
+    OffsetStr.getAsInteger(10, O);
+    Str = Str.drop_front(OffsetStr.size());
+
+    if (Str.consume_front("&size="))
+      return createStringError(object_error::parse_failed,
+                               "Reading 'size' in URI");
+
+    Str.getAsInteger(10, S);
+    std::unique_ptr<OffloadBundleURI> OffloadingURI(
+        new OffloadBundleURI(FilePathname, O, S));
+    // SALINAS return OffloadingURI;
+    return std::move(OffloadingURI);
+  }
+
+  static Expected<std::unique_ptr<OffloadBundleURI>>
+  createMemoryURI(StringRef Str) {
+    // TODO: add parseMemoryURI type
+    return createStringError(object_error::parse_failed,
+                             "Memory Type URI is not currently supported.");
+  }
+
+  StringRef getFileName() const { return FileName; }
+};
+
+/// Extracts fat binary in binary clang-offload-bundler format from object \p
+/// Obj and return it in \p Bundles
+Error extractOffloadBundleFatBinary(
+    const ObjectFile &Obj, SmallVectorImpl<OffloadBundleFatBin> &Bundles);
+
+/// Extract code object memory from the given \p Source object file at \p Offset
+/// and of \p Size, and copy into \p OutputFileName.
+Error extractCodeObject(const ObjectFile &Source, int64_t Offset, int64_t Size,
+                        StringRef OutputFileName);
+
+/// Extracts an Offload Bundle Entry given by URI
+Error extractOffloadBundleByURI(StringRef URIstr);
+
+} // namespace object
+
+} // namespace llvm
+#endif
diff --git a/llvm/lib/Object/CMakeLists.txt b/llvm/lib/Object/CMakeLists.txt
index bfb420e57a7f4..870169a83174f 100644
--- a/llvm/lib/Object/CMakeLists.txt
+++ b/llvm/lib/Object/CMakeLists.txt
@@ -22,6 +22,7 @@ add_llvm_component_library(LLVMObject
   Object.cpp
   ObjectFile.cpp
   OffloadBinary.cpp
+  OffloadBundle.cpp
   RecordStreamer.cpp
   RelocationResolver.cpp
   SymbolicFile.cpp
diff --git a/llvm/lib/Object/OffloadBundle.cpp b/llvm/lib/Object/OffloadBundle.cpp
new file mode 100644
index 0000000000000..5f087a5c84e8d
--- /dev/null
+++ b/llvm/lib/Object/OffloadBundle.cpp
@@ -0,0 +1,473 @@
+//===- OffloadBundle.cpp - Utilities for offload bundles---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------===//
+
+#include "llvm/Object/OffloadBundle.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/BinaryFormat/Magic.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IRReader/IRReader.h"
+#include "llvm/MC/StringTableBuilder.h"
+#include "llvm/Object/Archive.h"
+#include "llvm/Object/Binary.h"
+#include "llvm/Object/COFF.h"
+#include "llvm/Object/ELFObjectFile.h"
+#include "llvm/Object/Error.h"
+#include "llvm/Object/IRObjectFile.h"
+#include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Alignment.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/Timer.h"
+
+using namespace llvm;
+using namespace llvm::object;
+
+static llvm::TimerGroup
+    OffloadBundlerTimerGroup("Offload Bundler Timer Group",
+                             "Timer group for offload bundler");
+
+// Extract an Offload bundle (usually a Offload Bundle) from a fat_bin
+// section
+Error extractOffloadBundle(MemoryBufferRef Contents, uint64_t SectionOffset,
+                           StringRef FileName,
+                           SmallVectorImpl<OffloadBundleFatBin> &Bundles) {
+
+  uint64_t Offset = 0;
+  int64_t NextbundleStart = 0;
+
+  // There could be multiple offloading bundles stored at this section.
+  while (NextbundleStart >= 0) {
+
+    std::unique_ptr<MemoryBuffer> Buffer =
+        MemoryBuffer::getMemBuffer(Contents.getBuffer().drop_front(Offset), "",
+                                   /*RequiresNullTerminator=*/false);
+
+    // Create the FatBinBindle object. This will also create the Bundle Entry
+    // list info.
+    auto FatBundleOrErr =
+        OffloadBundleFatBin::create(*Buffer, SectionOffset + Offset, FileName);
+    if (!FatBundleOrErr)
+      return FatBundleOrErr.takeError();
+
+    // Add current Bundle to list.
+    Bundles.emplace_back(std::move(**FatBundleOrErr));
+
+    // Find the next bundle by searching for the magic string
+    StringRef Str = Buffer->getBuffer();
+    NextbundleStart =
+        (int64_t)Str.find(StringRef("__CLANG_OFFLOAD_BUNDLE__"), 24);
+
+    if (NextbundleStart >= 0)
+      Offset += NextbundleStart;
+  }
+
+  return Error::success();
+}
+
+Error OffloadBundleFatBin::readEntries(StringRef Buffer,
+                                       uint64_t SectionOffset) {
+  uint64_t NumOfEntries = 0;
+
+  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))
+    return errorCodeToError(object_error::parse_failed);
+
+  NumberOfEntries = NumOfEntries;
+
+  // For each Bundle Entry (code object)
+  for (uint64_t I = 0; I < NumOfEntries; I++) {
+    uint64_t EntrySize;
+    uint64_t EntryOffset;
+    uint64_t EntryIDSize;
+    StringRef EntryID;
+
+    if (auto EC = Reader.readInteger(EntryOffset))
+      return errorCodeToError(object_error::parse_failed);
+
+    if (auto EC = Reader.readInteger(EntrySize))
+      return errorCodeToError(object_error::parse_failed);
+
+    if (auto EC = Reader.readInteger(EntryIDSize))
+      return errorCodeToError(object_error::parse_failed);
+
+    if (auto EC = Reader.readFixedString(EntryID, EntryIDSize))
+      return errorCodeToError(object_error::parse_failed);
+
+    auto Entry = std::make_unique<OffloadBundleEntry>(
+        EntryOffset + SectionOffset, EntrySize, EntryIDSize, EntryID);
+
+    Entries.push_back(*Entry);
+  }
+
+  return Error::success();
+}
+
+Expected<std::unique_ptr<OffloadBundleFatBin>>
+OffloadBundleFatBin::create(MemoryBufferRef Buf, uint64_t SectionOffset,
+                            StringRef FileName) {
+  if (Buf.getBufferSize() < 24)
+    return errorCodeToError(object_error::parse_failed);
+
+  // Check for magic bytes.
+  if (identify_magic(Buf.getBuffer()) != file_magic::offload_bundle)
+    return errorCodeToError(object_error::parse_failed);
+
+  OffloadBundleFatBin *TheBundle = new OffloadBundleFatBin(Buf, FileName);
+
+  // Read the Bundle Entries
+  Error Err = TheBundle->readEntries(Buf.getBuffer(), SectionOffset);
+  if (Err)
+    return errorCodeToError(object_error::parse_failed);
+
+  return std::unique_ptr<OffloadBundleFatBin>(TheBundle);
+}
+
+Error OffloadBundleFatBin::extractBundle(const ObjectFile &Source) {
+  // This will extract all entries in the Bundle
+  for (OffloadBundleEntry &Entry : Entries) {
+
+    if (Entry.Size == 0)
+      continue;
+
+    // create output file name. Which should be
+    // <fileName>-offset<Offset>-size<Size>.co"
+    std::string Str = getFileName().str() + "-offset" + itostr(Entry.Offset) +
+                      "-size" + itostr(Entry.Size) + ".co";
+    if (Error Err = object::extractCodeObject(Source, Entry.Offset, Entry.Size,
+                                              StringRef(Str)))
+      return Err;
+  }
+
+  return Error::success();
+}
+
+Error object::extractOffloadBundleFatBinary(
+    const ObjectFile &Obj, SmallVectorImpl<OffloadBundleFatBin> &Bundles) {
+  assert((Obj.isELF() || Obj.isCOFF()) && "Invalid file type");
+
+  // Iterate through Sections until we find an offload_bundle section.
+  for (SectionRef Sec : Obj.sections()) {
+    Expected<StringRef> Buffer = Sec.getContents();
+    if (!Buffer)
+      return Buffer.takeError();
+
+    // If it does not start with the reserved suffix, just skip this section.
+    if ((llvm::identify_magic(*Buffer) == llvm::file_magic::offload_bundle) ||
+        (llvm::identify_magic(*Buffer) ==
+         llvm::file_magic::offload_bundle_compressed)) {
+
+      uint64_t SectionOffset = 0;
+      if (Obj.isELF()) {
+        SectionOffset = ELFSectionRef(Sec).getOffset();
+      } else if (Obj.isCOFF()) // TODO: add COFF Support
+        return createStringError(object_error::parse_failed,
+                                 "COFF object files not supported.\n");
+
+      MemoryBufferRef Contents(*Buffer, Obj.getFileName());
+
+      if (llvm::identify_magic(*Buffer) ==
+          llvm::file_magic::offload_bundle_compressed) {
+        // Decompress the input if necessary.
+        Expected<std::unique_ptr<MemoryBuffer>> DecompressedBufferOrErr =
+            CompressedOffloadBundle::decompress(Contents, false);
+
+        if (!DecompressedBufferOrErr)
+          return createStringError(
+              inconvertibleErrorCode(),
+              "Failed to decompress input: " +
+                  llvm::toString(DecompressedBufferOrErr.takeError()));
+
+        MemoryBuffer &DecompressedInput = **DecompressedBufferOrErr;
+        if (Error Err = extractOffloadBundle(DecompressedInput, SectionOffset,
+                                             Obj.getFileName(), Bundles))
+          return Err;
+      } else {
+        if (Error Err = extractOffloadBundle(Contents, SectionOffset,
+                                             Obj.getFileName(), Bundles))
+          return Err;
+      }
+    }
+  }
+  return Error::success();
+}
+
+Error object::extractCodeObject(const ObjectFile &Source, int64_t Offset,
+                                int64_t Size, StringRef OutputFileName) {
+  Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
+      FileOutputBuffer::create(OutputFileName, Size);
+
+  if (!BufferOrErr)
+    return BufferOrErr.takeError();
+
+  Expected<MemoryBufferRef> InputBuffOrErr = Source.getMemoryBufferRef();
+  if (Error Err = InputBuffOrErr.takeError())
+    return Err;
+
+  std::unique_ptr<FileOutputBuffer> Buf = std::move(*BufferOrErr);
+  std::copy(InputBuffOrErr->getBufferStart() + Offset,
+            InputBuffOrErr->getBufferStart() + Offset + Size,
+            Buf->getBufferStart());
+  if (Error E = Buf->commit())
+    return E;
+
+  return Error::success();
+}
+
+// given a file name, offset, and size, extract data into a code object file,
+// into file <SourceFile>-offset<Offset>-size<Size>.co
+Error object::extractOffloadBundleByURI(StringRef URIstr) {
+  // create a URI object
+  Expected<std::unique_ptr<OffloadBundleURI>> UriOrErr(
+      OffloadBundleURI::createOffloadBundleURI(URIstr, FILE_URI));
+  if (!UriOrErr)
+    return UriOrErr.takeError();
+
+  OffloadBundleURI &Uri = **UriOrErr;
+  std::string OutputFile = Uri.FileName.str();
+  OutputFile +=
+      "-offset" + itostr(Uri.Offset) + "-size" + itostr(Uri.Size) + ".co";
+
+  // Create an ObjectFile object from uri.file_uri
+  auto ObjOrErr = ObjectFile::createObjectFile(Uri.FileName);
+  if (!ObjOrErr)
+    return ObjOrErr.takeError();
+
+  auto Obj = ObjOrErr->getBinary();
+  if (Error Err =
+          object::extractCodeObject(*Obj, Uri.Offset, Uri.Size, OutputFile))
+    return Err;
+
+  return Error::success();
+}
+
+// Utility function to format numbers with commas
+static std::string formatWithCommas(unsigned long long Value) {
+  std::string Num = std::to_string(Value);
+  int InsertPosition = Num.length() - 3;
+  while (InsertPosition > 0) {
+    Num.insert(InsertPosition, ",");
+    InsertPosition -= 3;
+  }
+  return Num;
+}
+
+llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
+CompressedOffloadBundle::decompress(llvm::MemoryBufferRef &Input,
+                                    bool Verbose) {
+  StringRef Blob = Input.getBuffer();
+
+  if (Blob.size() < V1HeaderSize)
+    return llvm::MemoryBuffer::getMemBufferCopy(Blob);
+
+  if (llvm::identify_magic(Blob) !=
+      llvm::file_magic::offload_bundle_compressed) {
+    if (Verbose)
+      llvm::errs() << "Uncompressed bundle.\n";
+    return llvm::MemoryBuffer::getMemBufferCopy(Blob);
+  }
+
+  size_t CurrentOffset = MagicSize;
+
+  uint16_t ThisVersion;
+  memcpy(&ThisVersion, Blob.data() + CurrentOffset, sizeof(uint16_t));
+  CurrentOffset += VersionFieldSize;
+
+  uint16_t CompressionMethod;
+  memcpy(&CompressionMethod, Blob.data() + CurrentOffset, sizeof(uint16_t));
+  CurrentOffset += MethodFieldSize;
+
+  uint32_t TotalFileSize;
+  if (ThisVersion >= 2) {
+    if (Blob.size() < V2HeaderSize)
+      return createStringError(inconvertibleErrorCode(),
+                               "Compressed bundle header size too small");
+    memcpy(&TotalFileSize, Blob.data() + CurrentOffset, sizeof(uint32_t));
+    CurrentOffset += FileSizeFieldSize;
+  }
+
+  uint32_t UncompressedSize;
+  memcpy(&UncompressedSize, Blob.data() + CurrentOffset, sizeof(uint32_t));
+  CurrentOffset += UncompressedSizeFieldSize;
+
+  uint64_t StoredHash;
+  memcpy(&StoredHash, Blob.data() + CurrentOffset, sizeof(uint64_t));
+  CurrentOffset += HashFieldSize;
+
+  llvm::compression::Format CompressionFormat;
+  if (CompressionMethod ==
+      static_cast<uint16_t>(llvm::compression::Format::Zlib))
+    CompressionFormat = llvm::compression::Format::Zlib;
+  else if (CompressionMethod ==
+           static_cast<uint16_t>(llvm::compression::Format::Zstd))
+    CompressionFormat = llvm::compression::Format::Zstd;
+  else
+    return createStringError(inconvertibleErrorCode(),
+                             "Unknown compressing method");
+
+  llvm::Timer DecompressTimer("Decompression Timer", "Decompression time",
+                              OffloadBundlerTimerGroup);
+  if (Verbose)
+    DecompressTime...
[truncated]

@david-salinas david-salinas force-pushed the extend-llvm-objdump-fatbin branch from 71a9eb1 to 228b0b2 Compare May 21, 2025 19:59
Copy link

github-actions bot commented May 21, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

  extend option --offloading

Change-Id: Ibc865f80e30aa1a6e5495ecfe617be68a5e15fcf
@david-salinas david-salinas force-pushed the extend-llvm-objdump-fatbin branch from 228b0b2 to 13b5c8e Compare May 21, 2025 20:07
@david-salinas david-salinas merged commit 51a03ed into llvm:main May 23, 2025
12 checks passed
@ilovepi
Copy link
Contributor

ilovepi commented May 23, 2025

Hi, were seeing test failures from this patch in our CI.

Error:

******************** TEST 'LLVM :: tools/llvm-objdump/Offloading/fatbin.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--

/b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf:	file format elf64-x86-64
Extracting offload bundle: /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.host-x86_64-unknown-linux--
Extracting offload bundle: /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908

--
Command Output (stderr):
--
/b/s/w/ir/x/w/llvm_build/bin/yaml2obj /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 4
+ /b/s/w/ir/x/w/llvm_build/bin/yaml2obj /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/b/s/w/ir/x/w/llvm_build/bin/llvm-objdump --offloading /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 5
+ /b/s/w/ir/x/w/llvm_build/bin/llvm-objdump --offloading /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/b/s/w/ir/x/w/llvm_build/bin/llvm-objdump -d /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908 | /b/s/w/ir/x/w/llvm_build/bin/FileCheck /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test # RUN: at line 6
+ /b/s/w/ir/x/w/llvm_build/bin/llvm-objdump -d /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908
+ /b/s/w/ir/x/w/llvm_build/bin/FileCheck /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test
/b/s/w/ir/x/w/llvm_build/bin/llvm-objdump: error: '/b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908': can't find target: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
/b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test:9:10: error: CHECK: expected string not found in input
# CHECK: s_load_dword s7, s[4:5], 0x24
         ^
<stdin>:1:1: note: scanning from here

^
<stdin>:2:51: note: possible intended match here
/b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu
                                                  ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1:  
check:9'0     X error: no match found
           2: /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:9'1                                                       ?                                                                                                 possible intended match
>>>>>>

--

********************

Bot: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-host-linux-x64/b8714066091099918513/overview

Log: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8714066091099918513/+/u/clang/tests/stdout

If it isn't trivial to fix, would you mind reverting until a fixed version is ready?

@david-salinas
Copy link
Contributor Author

Hi, were seeing test failures from this patch in our CI.

Error:

******************** TEST 'LLVM :: tools/llvm-objdump/Offloading/fatbin.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--

/b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf:	file format elf64-x86-64
Extracting offload bundle: /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.host-x86_64-unknown-linux--
Extracting offload bundle: /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908

--
Command Output (stderr):
--
/b/s/w/ir/x/w/llvm_build/bin/yaml2obj /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 4
+ /b/s/w/ir/x/w/llvm_build/bin/yaml2obj /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/b/s/w/ir/x/w/llvm_build/bin/llvm-objdump --offloading /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 5
+ /b/s/w/ir/x/w/llvm_build/bin/llvm-objdump --offloading /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/b/s/w/ir/x/w/llvm_build/bin/llvm-objdump -d /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908 | /b/s/w/ir/x/w/llvm_build/bin/FileCheck /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test # RUN: at line 6
+ /b/s/w/ir/x/w/llvm_build/bin/llvm-objdump -d /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908
+ /b/s/w/ir/x/w/llvm_build/bin/FileCheck /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test
/b/s/w/ir/x/w/llvm_build/bin/llvm-objdump: error: '/b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908': can't find target: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
/b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test:9:10: error: CHECK: expected string not found in input
# CHECK: s_load_dword s7, s[4:5], 0x24
         ^
<stdin>:1:1: note: scanning from here

^
<stdin>:2:51: note: possible intended match here
/b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu
                                                  ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1:  
check:9'0     X error: no match found
           2: /b/s/w/ir/x/w/llvm_build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:9'1                                                       ?                                                                                                 possible intended match
>>>>>>

--

********************

Bot: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-host-linux-x64/b8714066091099918513/overview

Log: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8714066091099918513/+/u/clang/tests/stdout

If it isn't trivial to fix, would you mind reverting until a fixed version is ready?

hi I believe it is a trivial fix. I'll post a fix asap.

@ilovepi
Copy link
Contributor

ilovepi commented May 23, 2025

Thanks!

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-b-1 while building llvm at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/15785

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
      |             ^~~~~~~~
4 warnings generated.
[1371/1373] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[1372/1373] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/wasm-ld
-- Testing: 59291 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90
FAIL: LLVM :: tools/llvm-objdump/Offloading/fatbin.test (55254 of 59291)
******************** TEST 'LLVM :: tools/llvm-objdump/Offloading/fatbin.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--

/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf:	file format elf64-x86-64
Extracting offload bundle: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.host-x86_64-unknown-linux--
Extracting offload bundle: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908

--
Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/yaml2obj /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 4
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/yaml2obj /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump --offloading /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 5
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump --offloading /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump -d /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test # RUN: at line 6
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump -d /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump: error: '/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908': can't find target: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test:9:10: error: CHECK: expected string not found in input
# CHECK: s_load_dword s7, s[4:5], 0x24
         ^
<stdin>:1:1: note: scanning from here

^
<stdin>:2:91: note: possible intended match here
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu
                                                                                          ^

Input file: <stdin>
Check file: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
Step 7 (check) failure: check (failure)
...
      |             ^~~~~~~~
4 warnings generated.
[1371/1373] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[1372/1373] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/wasm-ld
-- Testing: 59291 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90
FAIL: LLVM :: tools/llvm-objdump/Offloading/fatbin.test (55254 of 59291)
******************** TEST 'LLVM :: tools/llvm-objdump/Offloading/fatbin.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--

/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf:	file format elf64-x86-64
Extracting offload bundle: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.host-x86_64-unknown-linux--
Extracting offload bundle: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908

--
Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/yaml2obj /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 4
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/yaml2obj /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump --offloading /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 5
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump --offloading /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump -d /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test # RUN: at line 6
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump -d /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/bin/llvm-objdump: error: '/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908': can't find target: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test:9:10: error: CHECK: expected string not found in input
# CHECK: s_load_dword s7, s[4:5], 0x24
         ^
<stdin>:1:1: note: scanning from here

^
<stdin>:2:91: note: possible intended match here
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-5xu_wgnk/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu
                                                                                          ^

Input file: <stdin>
Check file: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder clang-cmake-x86_64-avx512-linux running on avx512-intel64 while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/133/builds/16647

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llvm-objdump/Offloading/fatbin.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--

/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf:	file format elf64-x86-64
Extracting offload bundle: /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.host-x86_64-unknown-linux--
Extracting offload bundle: /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908

--
Command Output (stderr):
--
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/yaml2obj /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 4
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/yaml2obj /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/llvm-objdump --offloading /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 5
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/llvm-objdump --offloading /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/llvm-objdump -d /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908 | /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test # RUN: at line 6
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/llvm-objdump -d /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/llvm-objdump: error: '/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908': can't find target: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test:9:10: error: CHECK: expected string not found in input
# CHECK: s_load_dword s7, s[4:5], 0x24
         ^
<stdin>:1:1: note: scanning from here

^
<stdin>:2:20: note: possible intended match here
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu
                   ^

Input file: <stdin>
Check file: /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1:  
check:9'0     X error: no match found
           2: /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:9'1                        ?                                                                                                                                                                               possible intended match
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/16494

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM-Unit :: Object/./ObjectTests/98/128' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests-LLVM-Unit-413449-98-128.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=128 GTEST_SHARD_INDEX=98 /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests
--

Note: This is test shard 99 of 128.
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from OffloadingBundleTest
[ RUN      ] OffloadingBundleTest.checkExtractOffloadBundleFatBinary
ObjectTests: ../llvm/llvm/include/llvm/ADT/StringRef.h:618: StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
#0 0x010fa9c0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x31a9c0)
#1 0x010f8394 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x318394)
#2 0x010fb440 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0xf511d6f0 __default_rt_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:80:0
#4 0xf510db06 ./csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
#5 0xf514d292 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0xf511c840 gsignal ./signal/../sysdeps/posix/raise.c:27:6

--
exit: -6
--
shard JSON output does not exist: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests-LLVM-Unit-413449-98-128.json
********************


@kazutakahirata
Copy link
Contributor

@david-salinas @jhuber6 I've landed 3e3b02f to fix warnings from this PR. Thanks!

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/16405

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-objdump/Offloading/fatbin.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--

/buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf:	file format elf64-x86-64
Extracting offload bundle: /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.host-x86_64-unknown-linux--
Extracting offload bundle: /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908

--
Command Output (stderr):
--
/buildbot/worker/arc-folder/build/bin/yaml2obj /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 4
+ /buildbot/worker/arc-folder/build/bin/yaml2obj /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/buildbot/worker/arc-folder/build/bin/llvm-objdump --offloading /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 5
+ /buildbot/worker/arc-folder/build/bin/llvm-objdump --offloading /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/buildbot/worker/arc-folder/build/bin/llvm-objdump -d /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908 | /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test # RUN: at line 6
+ /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test
+ /buildbot/worker/arc-folder/build/bin/llvm-objdump -d /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908
/buildbot/worker/arc-folder/build/bin/llvm-objdump: error: '/buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908': can't find target: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
/buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test:9:10: error: CHECK: expected string not found in input
# CHECK: s_load_dword s7, s[4:5], 0x24
         ^
<stdin>:1:1: note: scanning from here

^
<stdin>:2:3: note: possible intended match here
/buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu
  ^

Input file: <stdin>
Check file: /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llvm-objdump/Offloading/fatbin.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1:  
check:9'0     X error: no match found
           2: /buildbot/worker/arc-folder/build/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:9'1       ?                                                                                                                                                          possible intended match
>>>>>>

--

********************


@david-salinas
Copy link
Contributor Author

Thanks!
Ok I have this PR to add a REQUIRES to the lit test: #141253

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/10487

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llvm-objdump/Offloading/fatbin.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--

/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf:	file format elf64-x86-64
Extracting offload bundle: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.host-x86_64-unknown-linux--
Extracting offload bundle: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908

--
Command Output (stderr):
--
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/yaml2obj /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 4
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/yaml2obj /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump --offloading /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf # RUN: at line 5
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump --offloading /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump -d /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908 | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test # RUN: at line 6
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump -d /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump: error: '/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908': can't find target: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test:9:10: error: CHECK: expected string not found in input
# CHECK: s_load_dword s7, s[4:5], 0x24
         ^
<stdin>:1:1: note: scanning from here

^
<stdin>:2:11: note: possible intended match here
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu
          ^

Input file: <stdin>
Check file: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llvm-objdump/Offloading/fatbin.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1:  
check:9'0     X error: no match found
           2: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llvm-objdump/Offloading/Output/fatbin.test.tmp.elf.0.hipv4-amdgcn-amd-amdhsa--gfx908: file format elf64-amdgpu 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:9'1               ?                                                                                                                                                                                             possible intended match
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-lld-multistage-test running on ppc64le-lld-multistage-test while building llvm at step 12 "build-stage2-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/168/builds/12406

Here is the relevant piece of the build log for the reference
Step 12 (build-stage2-unified-tree) failure: build (failure)
...
12.642 [1/8/16] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpenCLBuiltinEmitter.cpp.o
16.348 [1/7/17] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangASTPropertiesEmitter.cpp.o
23.705 [1/6/18] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
23.835 [1/5/19] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o
23.861 [1/4/20] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/RISCVVEmitter.cpp.o
39.693 [1/3/21] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/MveEmitter.cpp.o
48.922 [1/2/22] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o
66.759 [1/1/23] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangAttrEmitter.cpp.o
66.820 [0/1/24] Linking CXX executable bin/clang-tblgen
109.995 [4058/478/2040] Building CXX object unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o
FAILED: unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o 
ccache /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/install/stage1/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/unittests/Object -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Object -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o -MF unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o.d -o unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:56:19: error: unused variable 'mbuf' [-Werror,-Wunused-variable]
   56 |   MemoryBufferRef mbuf;
      |                   ^~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:57:13: error: unused variable 'FileName' [-Werror,-Wunused-variable]
   57 |   StringRef FileName;
      |             ^~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:72:19: error: unused variable 'mbuf' [-Werror,-Wunused-variable]
   72 |   MemoryBufferRef mbuf;
      |                   ^~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:73:13: error: unused variable 'FileName' [-Werror,-Wunused-variable]
   73 |   StringRef FileName;
      |             ^~~~~~~~
4 errors generated.
124.702 [4058/78/2440] Building CXX object unittests/Transforms/Scalar/CMakeFiles/ScalarTests.dir/LICMTest.cpp.o
125.319 [4058/76/2442] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmMatcherEmitter.cpp.o
125.364 [4058/75/2443] Building CXX object tools/llvm-pdbutil/CMakeFiles/llvm-pdbutil.dir/DumpOutputStyle.cpp.o
125.545 [4058/74/2444] Building CXX object lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/BitcodeWriter.cpp.o
125.574 [4058/73/2445] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/YAMLIOTest.cpp.o
125.829 [4058/72/2446] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/Metadata.cpp.o
125.846 [4058/71/2447] Building CXX object lib/CodeGen/GlobalISel/CMakeFiles/LLVMGlobalISel.dir/IRTranslator.cpp.o
125.954 [4058/70/2448] Building CXX object lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VectorCombine.cpp.o
126.017 [4058/69/2449] Building CXX object lib/Object/CMakeFiles/LLVMObject.dir/ELF.cpp.o
126.047 [4058/68/2450] Building CXX object lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/WholeProgramDevirt.cpp.o
126.175 [4058/67/2451] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/Verifier.cpp.o
126.285 [4058/66/2452] Building CXX object lib/CodeGen/SelectionDAG/CMakeFiles/LLVMSelectionDAG.dir/TargetLowering.cpp.o
126.365 [4058/65/2453] Building CXX object lib/CodeGen/SelectionDAG/CMakeFiles/LLVMSelectionDAG.dir/LegalizeVectorTypes.cpp.o
126.447 [4058/64/2454] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/ThinLTOCodeGenerator.cpp.o
126.503 [4058/63/2455] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/NewGVN.cpp.o
126.511 [4058/62/2456] Building CXX object lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlanTransforms.cpp.o
126.608 [4058/61/2457] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/LoopStrengthReduce.cpp.o
126.619 [4058/60/2458] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/ConstantRangeTest.cpp.o
126.959 [4058/59/2459] Building CXX object lib/ObjectYAML/CMakeFiles/LLVMObjectYAML.dir/ELFYAML.cpp.o
127.011 [4058/58/2460] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AssignmentTrackingAnalysis.cpp.o
127.284 [4058/57/2461] Building CXX object lib/CodeGen/GlobalISel/CMakeFiles/LLVMGlobalISel.dir/CombinerHelper.cpp.o
127.422 [4058/56/2462] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/VirtualFileSystemTest.cpp.o
127.701 [4058/55/2463] Building CXX object lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstructionCombining.cpp.o
127.874 [4058/54/2464] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/StandardInstrumentations.cpp.o

@david-salinas
Copy link
Contributor Author

@david-salinas @jhuber6 I've landed 3e3b02f to fix warnings from this PR. Thanks!

Thanks!

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/3766

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
210.892 [226/162/682] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BLAKE3Test.cpp.o
211.077 [225/162/683] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BlockFrequencyTest.cpp.o
211.221 [224/162/684] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ConvertEBCDICTest.cpp.o
211.412 [223/162/685] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DJBTest.cpp.o
211.581 [222/162/686] Building CXX object unittests/Analysis/CMakeFiles/AnalysisTests.dir/CGSCCPassManagerTest.cpp.o
211.787 [221/162/687] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/DataLayoutTest.cpp.o
211.992 [220/162/688] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/DebugInfoTest.cpp.o
212.172 [219/162/689] Building CXX object unittests/MIR/CMakeFiles/MIRTests.dir/MachineStableHashTest.cpp.o
212.376 [218/162/690] Building CXX object unittests/Object/CMakeFiles/ObjectTests.dir/DXContainerTest.cpp.o
212.542 [217/162/691] Building CXX object unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o
FAILED: unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o 
/home/llvm/llvm-external-buildbots/clang.19.1.2/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LARGE_FILE_API -D_XOPEN_SOURCE=700 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/unittests/Object -I/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/Object -I/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/include -I/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/include -I/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include -I/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googlemock/include -mcmodel=large -fPIC -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -pthread -Wno-suggest-override -MD -MT unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o -MF unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o.d -o unittests/Object/CMakeFiles/ObjectTests.dir/OffloadingBundleTest.cpp.o -c /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:56:19: error: unused variable 'mbuf' [-Werror,-Wunused-variable]
   56 |   MemoryBufferRef mbuf;
      |                   ^~~~
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:57:13: error: unused variable 'FileName' [-Werror,-Wunused-variable]
   57 |   StringRef FileName;
      |             ^~~~~~~~
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:72:19: error: unused variable 'mbuf' [-Werror,-Wunused-variable]
   72 |   MemoryBufferRef mbuf;
      |                   ^~~~
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/Object/OffloadingBundleTest.cpp:73:13: error: unused variable 'FileName' [-Werror,-Wunused-variable]
   73 |   StringRef FileName;
      |             ^~~~~~~~
4 errors generated.
212.545 [217/161/692] Building CXX object unittests/ObjectYAML/CMakeFiles/ObjectYAMLTests.dir/DWARFYAMLTest.cpp.o
212.549 [217/160/693] Building CXX object unittests/ObjectYAML/CMakeFiles/ObjectYAMLTests.dir/DXContainerYAMLTest.cpp.o
212.552 [217/159/694] Building CXX object unittests/ObjectYAML/CMakeFiles/ObjectYAMLTests.dir/MinidumpYAMLTest.cpp.o
212.555 [217/158/695] Building CXX object unittests/Option/CMakeFiles/OptionTests.dir/OptionParsingTest.cpp.o
212.558 [217/157/696] Building CXX object unittests/Remarks/CMakeFiles/RemarksTests.dir/BitstreamRemarksParsingTest.cpp.o
212.560 [217/156/697] Building CXX object unittests/Remarks/CMakeFiles/RemarksTests.dir/YAMLRemarksParsingTest.cpp.o
212.563 [217/155/698] Building CXX object unittests/ProfileData/CMakeFiles/ProfileDataTests.dir/ItaniumManglingCanonicalizerTest.cpp.o
212.566 [217/154/699] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/AddressRangeTest.cpp.o
212.569 [217/153/700] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/AlignmentTest.cpp.o
212.571 [217/152/701] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/AllocatorTest.cpp.o
212.573 [217/151/702] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ARMAttributeParser.cpp.o
212.576 [217/150/703] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/Base64Test.cpp.o
212.578 [217/149/704] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BranchProbabilityTest.cpp.o
212.581 [217/148/705] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CachePruningTest.cpp.o
212.583 [217/147/706] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
212.586 [217/146/707] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/Casting.cpp.o
212.588 [217/145/708] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CheckedArithmeticTest.cpp.o
212.590 [217/144/709] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/Chrono.cpp.o
212.593 [217/143/710] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CompressionTest.cpp.o
212.595 [217/142/711] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CRCTest.cpp.o
212.597 [217/141/712] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CSKYAttributeParserTest.cpp.o
212.600 [217/140/713] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugCounterTest.cpp.o
212.602 [217/139/714] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugTest.cpp.o
212.605 [217/138/715] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DivisionByConstantTest.cpp.o

@mgorny
Copy link
Member

mgorny commented May 24, 2025

This change has introduces crashes in unit tests on 32-bit x86:

[----------] 1 test from OffloadingBundleTest
[ RUN      ] OffloadingBundleTest.checkExtractOffloadBundleFatBinary
ObjectTests: /home/mgorny/llvm-project/llvm/include/llvm/ADT/StringRef.h:618: llvm::StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
 #0 0x5678ecfa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x221cfa)
 #1 0x5678f018 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #2 0x5678ce7a llvm::sys::RunSignalHandlers() (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x21fe7a)
 #3 0x5678dc7c SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #4 0xfffffffff7f6c5a0 (linux-gate.so.1+0x5a0)
 #5 0xfffffffff7f6c579 (linux-gate.so.1+0x579)
 #6 0xfffffffff794ad07 (/usr/lib/libc.so.6+0x93d07)
 #7 0xfffffffff78ef581 raise (/usr/lib/libc.so.6+0x38581)
 #8 0xfffffffff78d62d8 abort (/usr/lib/libc.so.6+0x1f2d8)
 #9 0xfffffffff78d61de (/usr/lib/libc.so.6+0x1f1de)
#10 0xfffffffff78e750b (/usr/lib/libc.so.6+0x3050b)
#11 0x56610c4d llvm::StringRef::drop_front(unsigned int) const (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0xa3c4d)
#12 0x56659439 extractOffloadBundle(llvm::MemoryBufferRef, unsigned long long, llvm::StringRef, llvm::SmallVectorImpl<llvm::object::OffloadBundleFatBin>&) (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0xec439)
#13 0x56659f83 llvm::object::extractOffloadBundleFatBinary(llvm::object::ObjectFile const&, llvm::SmallVectorImpl<llvm::object::OffloadBundleFatBin>&) (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0xecf83)
#14 0x565f7521 OffloadingBundleTest_checkExtractOffloadBundleFatBinary_Test::TestBody() (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x8a521)
#15 0x5679b95d void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (.isra.0) gtest-all.cc:0:0
#16 0x5679dd17 testing::Test::Run() (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x230d17)
#17 0x5679de25 testing::TestInfo::Run() (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x230e25)
#18 0x567a8906 testing::TestSuite::Run() (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x23b906)
#19 0x567a8ca9 testing::internal::UnitTestImpl::RunAllTests() (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x23bca9)
#20 0x567a8f0a testing::UnitTest::Run() (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x23bf0a)
#21 0x56585bad main (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x18bad)
#22 0xfffffffff78d7f83 (/usr/lib/libc.so.6+0x20f83)
#23 0xfffffffff78d8048 __libc_start_main (/usr/lib/libc.so.6+0x21048)
#24 0x5659d367 _start (/home/mgorny/llvm-project/build32/unittests/Object/./ObjectTests+0x30367)

--
exit: -6
--

searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request May 24, 2025
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request May 26, 2025
Utilize the new extensions to the LLVM Offloading API to extend to
llvm-objdump to handle dumping fatbin offload bundles generated by HIP.
This extension to llvm-objdump adds the option --offload-fatbin.
Specifying this option will take the input object/executable and extract
all offload fatbin bundle entries into distinct code object files with
names reflecting the source file name combined with the Bundle Entry ID.
Users can also use the --arch-name option to filter offload fatbin
bundle entries by their target triple.

---------

Co-authored-by: dsalinas <[email protected]>
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request May 26, 2025
@tuliom
Copy link
Contributor

tuliom commented May 27, 2025

@david-salinas Are you looking at these test failures?
Should this test run on 32-bit architectures?

@omjavaid
Copy link
Contributor

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/16494

Here is the relevant piece of the build log for the reference

Hi @david-salinas This change has disabled all 32 - bit arm buildbots into failure state since last 4 days. Kindly revert the change for now so that bots can start reporting again.

DavidSpickett added a commit to DavidSpickett/llvm-project that referenced this pull request May 27, 2025
Which fixes a test failure seen on the bots, introduced by
llvm#140286.

[ RUN      ] OffloadingBundleTest.checkExtractOffloadBundleFatBinary
ObjectTests: ../llvm/llvm/include/llvm/ADT/StringRef.h:618: StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
0 0x0a24a990 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x31a990)
1 0x0a248364 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x318364)
2 0x0a24b410 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
3 0xf46ed6f0 __default_rt_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:80:0
4 0xf46ddb06 ./csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
5 0xf471d292 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
6 0xf46ec840 gsignal ./signal/../sysdeps/posix/raise.c:27:6

Also reported on 32-bit x86.

The cause is that the code was casting the result of StringRef.find
into an int64_t. The failure value of find is StringRef::npos, which
is defined as:
static constexpr size_t npos = ~size_t(0);

So making that into an int64_t means it is > 0 and the code continued
to search for bundles that didn't exist, at an offset beyond the largest
file we could handle.

I have changed the code to use size_t throughout, as this matches the
APIs used, and it does not search backwards in the file so the offset
does not need to be signed.
DavidSpickett added a commit that referenced this pull request May 28, 2025
Which fixes a test failure seen on the bots, introduced by
#140286.
```
[ RUN      ] OffloadingBundleTest.checkExtractOffloadBundleFatBinary
ObjectTests: ../llvm/llvm/include/llvm/ADT/StringRef.h:618: StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
0 0x0a24a990 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x31a990)
1 0x0a248364 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x318364)
2 0x0a24b410 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
3 0xf46ed6f0 __default_rt_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:80:0
4 0xf46ddb06 ./csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
5 0xf471d292 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
6 0xf46ec840 gsignal ./signal/../sysdeps/posix/raise.c:27:6
```
Also reported on 32-bit x86.

I think the cause is the code was casting the result of StringRef.find
into an int64_t. The failure value of find is StringRef::npos, which is
defined as:
static constexpr size_t npos = ~size_t(0);

* size_t(0) is 32 bits of 0s
* the inverse of that is 32 bits of 1s
* Cast to int64_t needs to widen this, and it will preserve the original
value in doing so, which is 0xffffffff.
* The result is 0x00000000ffffffff, which is >= 0, so we keep searching
and try to go off the end of the file.

Or put another way, this equivalent function returns true when compiled
for a 32-bit system:
```
bool fn() {
    size_t foo = ~size_t(0);
    int64_t foo64 = (int64_t)foo;
    return foo64 >= 0;
}
```

Using size_t throughout fixes the problem. Also I don't see a reason it
needs to be a signed number, given that it always searches forward from
the current offset.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 28, 2025
… (#141620)

Which fixes a test failure seen on the bots, introduced by
llvm/llvm-project#140286.
```
[ RUN      ] OffloadingBundleTest.checkExtractOffloadBundleFatBinary
ObjectTests: ../llvm/llvm/include/llvm/ADT/StringRef.h:618: StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
0 0x0a24a990 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x31a990)
1 0x0a248364 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x318364)
2 0x0a24b410 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
3 0xf46ed6f0 __default_rt_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:80:0
4 0xf46ddb06 ./csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
5 0xf471d292 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
6 0xf46ec840 gsignal ./signal/../sysdeps/posix/raise.c:27:6
```
Also reported on 32-bit x86.

I think the cause is the code was casting the result of StringRef.find
into an int64_t. The failure value of find is StringRef::npos, which is
defined as:
static constexpr size_t npos = ~size_t(0);

* size_t(0) is 32 bits of 0s
* the inverse of that is 32 bits of 1s
* Cast to int64_t needs to widen this, and it will preserve the original
value in doing so, which is 0xffffffff.
* The result is 0x00000000ffffffff, which is >= 0, so we keep searching
and try to go off the end of the file.

Or put another way, this equivalent function returns true when compiled
for a 32-bit system:
```
bool fn() {
    size_t foo = ~size_t(0);
    int64_t foo64 = (int64_t)foo;
    return foo64 >= 0;
}
```

Using size_t throughout fixes the problem. Also I don't see a reason it
needs to be a signed number, given that it always searches forward from
the current offset.
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 28, 2025

LLVM Buildbot has detected a new failure on builder clang-armv7-global-isel running on linaro-clang-armv7-global-isel while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/39/builds/6269

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM-Unit :: Object/./ObjectTests/2/16' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Object/./ObjectTests-LLVM-Unit-1232125-2-16.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=16 GTEST_SHARD_INDEX=2 /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Object/./ObjectTests
--

Note: This is test shard 3 of 16.
[==========] Running 8 tests from 7 test suites.
[----------] Global test environment set-up.
[----------] 1 test from ArchiveTestsFixture
[ RUN      ] ArchiveTestsFixture.ArchiveChildGetBuffer
../llvm/llvm/unittests/Object/ArchiveTest.cpp:82: Skipped


[  SKIPPED ] ArchiveTestsFixture.ArchiveChildGetBuffer (0 ms)
[----------] 1 test from ArchiveTestsFixture (0 ms total)

[----------] 1 test from DXCFile
[ RUN      ] DXCFile.MisalignedStringTable
[       OK ] DXCFile.MisalignedStringTable (0 ms)
[----------] 1 test from DXCFile (0 ms total)

[----------] 2 tests from ELFObjectFileTest
[ RUN      ] ELFObjectFileTest.MachineTestForPPC
[       OK ] ELFObjectFileTest.MachineTestForPPC (0 ms)
[ RUN      ] ELFObjectFileTest.RelativeRelocationTypeTest
[       OK ] ELFObjectFileTest.RelativeRelocationTypeTest (0 ms)
[----------] 2 tests from ELFObjectFileTest (0 ms total)

[----------] 1 test from ELFTest
[ RUN      ] ELFTest.getELFRelocationTypeNameForVE
[       OK ] ELFTest.getELFRelocationTypeNameForVE (0 ms)
[----------] 1 test from ELFTest (0 ms total)

[----------] 1 test from GOFFObjectFileTest
[ RUN      ] GOFFObjectFileTest.TwoSymbols
[       OK ] GOFFObjectFileTest.TwoSymbols (0 ms)
[----------] 1 test from GOFFObjectFileTest (0 ms total)

[----------] 1 test from OffloadingBundleTest
[ RUN      ] OffloadingBundleTest.checkExtractOffloadBundleFatBinary
ObjectTests: ../llvm/llvm/include/llvm/ADT/StringRef.h:618: StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
#0 0x0fd4a9c0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Object/./ObjectTests+0x31a9c0)
#1 0x0fd48394 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Object/./ObjectTests+0x318394)
#2 0x0fd4b440 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0xf0ced6f0 __default_rt_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:80:0
#4 0xf0cddb06 ./csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
#5 0xf0d1d292 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0xf0cec840 gsignal ./signal/../sysdeps/posix/raise.c:27:6

...

@DavidSpickett
Copy link
Collaborator

That failure is the one I fixed, that bot is very far behind.

sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Utilize the new extensions to the LLVM Offloading API to extend to
llvm-objdump to handle dumping fatbin offload bundles generated by HIP.
This extension to llvm-objdump adds the option --offload-fatbin.
Specifying this option will take the input object/executable and extract
all offload fatbin bundle entries into distinct code object files with
names reflecting the source file name combined with the Bundle Entry ID.
Users can also use the --arch-name option to filter offload fatbin
bundle entries by their target triple.

---------

Co-authored-by: dsalinas <[email protected]>
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Which fixes a test failure seen on the bots, introduced by
llvm#140286.
```
[ RUN      ] OffloadingBundleTest.checkExtractOffloadBundleFatBinary
ObjectTests: ../llvm/llvm/include/llvm/ADT/StringRef.h:618: StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
0 0x0a24a990 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x31a990)
1 0x0a248364 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Object/./ObjectTests+0x318364)
2 0x0a24b410 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
3 0xf46ed6f0 __default_rt_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:80:0
4 0xf46ddb06 ./csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
5 0xf471d292 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
6 0xf46ec840 gsignal ./signal/../sysdeps/posix/raise.c:27:6
```
Also reported on 32-bit x86.

I think the cause is the code was casting the result of StringRef.find
into an int64_t. The failure value of find is StringRef::npos, which is
defined as:
static constexpr size_t npos = ~size_t(0);

* size_t(0) is 32 bits of 0s
* the inverse of that is 32 bits of 1s
* Cast to int64_t needs to widen this, and it will preserve the original
value in doing so, which is 0xffffffff.
* The result is 0x00000000ffffffff, which is >= 0, so we keep searching
and try to go off the end of the file.

Or put another way, this equivalent function returns true when compiled
for a 32-bit system:
```
bool fn() {
    size_t foo = ~size_t(0);
    int64_t foo64 = (int64_t)foo;
    return foo64 >= 0;
}
```

Using size_t throughout fixes the problem. Also I don't see a reason it
needs to be a signed number, given that it always searches forward from
the current offset.
jrbyrnes pushed a commit to jrbyrnes/llvm-project that referenced this pull request Jun 6, 2025
Utilize the new extensions to the LLVM Offloading API to extend to
llvm-objdump to handle dumping fatbin offload bundles generated by HIP.
This extension to llvm-objdump adds the option --offload-fatbin.
Specifying this option will take the input object/executable and extract
all offload fatbin bundle entries into distinct code object files with
names reflecting the source file name combined with the Bundle Entry ID.
Users can also use the --arch-name option to filter offload fatbin
bundle entries by their target triple.

---------

Co-authored-by: dsalinas <[email protected]>
jrbyrnes pushed a commit to jrbyrnes/llvm-project that referenced this pull request Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants