Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/lib/Object/OffloadBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ Error OffloadBundleFatBin::readEntries(StringRef Buffer,
StringRef EntryID;

if (Error EC = Reader.readInteger(EntryOffset))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: since EC usually stands for "error code" and you're using an Error not std::error_code, I'd change the name to Err or similar.

return std::move(EC);
return EC;

if (Error EC = Reader.readInteger(EntrySize))
return std::move(EC);
return EC;

if (Error EC = Reader.readInteger(EntryIDSize))
return std::move(EC);
return EC;

if (Error EC = Reader.readFixedString(EntryID, EntryIDSize))
return std::move(EC);
return EC;

auto Entry = std::make_unique<OffloadBundleEntry>(
EntryOffset + SectionOffset, EntrySize, EntryIDSize, EntryID);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
## Test that --offloading with a fatbin works correctly.
# REQUIRES: target={{x86_64-.*-linux.*}}
# REQUIRES: amdgpu-registered-target
# UNSUPPORTED: system-windows

# RUN: yaml2obj %s -o %t.elf
# RUN: not llvm-readobj --offloading %t.elf 2>&1 | \
# RUN: FileCheck %s --check-prefix=ERR -DFILE_NAME=%t.elf
# RUN: llvm-readobj --offloading %t.elf 2>&1 | \
# RUN: FileCheck %s --check-prefix=WARN -DFILE_NAME=%t.elf

# ERR: error: '{{.*}}': Stream Error: The stream is too short to perform the requested operation.
# WARN: warning: '{{.*}}': Stream Error: The stream is too short to perform the requested operation.

--- !ELF
FileHeader:
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/tools/llvm-readobj/ELF/AMDGPU/offloading.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
## Test that --offloading with a fatbin works correctly.
# REQUIRES: target={{x86_64-.*-linux.*}}
# REQUIRES: amdgpu-registered-target
# UNSUPPORTED: system-windows

# RUN: yaml2obj %s -o %t.elf
# RUN: llvm-readobj --offloading %t.elf | \
# RUN: FileCheck %s -DFILE_NAME=%t.elf
# RUN: FileCheck %s -DFILE_NAME=%t.elf

# CHECK: host-x86_64-unknown-linux-- file://[[FILE_NAME]]#offset=8192&size=0
# CHECK-NEXT: hipv4-amdgcn-amd-amdhsa--gfx908 file://[[FILE_NAME]]#offset=8192&size=4048
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-readobj/ObjDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile &Obj,
void ObjDumper::printOffloading(const object::ObjectFile &Obj) {
SmallVector<llvm::object::OffloadBundleFatBin> Bundles;
if (Error Err = object::extractOffloadBundleFatBinary(Obj, Bundles))
reportError(std::move(Err), Obj.getFileName());
reportWarning(std::move(Err), Obj.getFileName());

// Print out all the FatBin Bundles that are contained in this buffer.
for (const auto &[Index, Bundle] : llvm::enumerate(Bundles))
Expand Down