Skip to content

Commit a08ab73

Browse files
committed
Revert "Add --offoading option to llvm-readobj (llvm#143342)"
Sanitizer bots are still broken. This reverts commit 07f8f08.
1 parent aeffd36 commit a08ab73

File tree

10 files changed

+10
-91
lines changed

10 files changed

+10
-91
lines changed

llvm/docs/CommandGuide/llvm-readelf.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ OPTIONS
143143

144144
Display all notes.
145145

146-
.. option:: --offloading
147-
148-
Display list of HIP offload bundles.
149-
150146
.. option:: --pretty-print
151147

152148
When used with :option:`--elf-output-style`, JSON output will be formatted in

llvm/docs/CommandGuide/llvm-readobj.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ file formats.
104104
Do not demangle symbol names in the output. This option is only for ELF and
105105
XCOFF file formats. The option is enabled by default.
106106

107-
.. option:: --offloading
108-
109-
Display list of HIP offload bundles.
110-
111107
.. option:: --relocations, --relocs, -r
112108

113109
Display the relocation entries in the file.

llvm/include/llvm/Object/OffloadBundle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ struct OffloadBundleURI {
161161
OffsetStr.getAsInteger(10, O);
162162
Str = Str.drop_front(OffsetStr.size());
163163

164-
if (!Str.consume_front("&size="))
164+
if (Str.consume_front("&size="))
165165
return createStringError(object_error::parse_failed,
166166
"Reading 'size' in URI");
167167

llvm/lib/Object/OffloadBundle.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ Error OffloadBundleFatBin::readEntries(StringRef Buffer,
8989
uint64_t EntryIDSize;
9090
StringRef EntryID;
9191

92-
if (Error Err = Reader.readInteger(EntryOffset))
93-
return Err;
92+
if (auto EC = Reader.readInteger(EntryOffset))
93+
return errorCodeToError(object_error::parse_failed);
9494

95-
if (Error Err = Reader.readInteger(EntrySize))
96-
return Err;
95+
if (auto EC = Reader.readInteger(EntrySize))
96+
return errorCodeToError(object_error::parse_failed);
9797

98-
if (Error Err = Reader.readInteger(EntryIDSize))
99-
return Err;
98+
if (auto EC = Reader.readInteger(EntryIDSize))
99+
return errorCodeToError(object_error::parse_failed);
100100

101-
if (Error Err = Reader.readFixedString(EntryID, EntryIDSize))
102-
return Err;
101+
if (auto EC = Reader.readFixedString(EntryID, EntryIDSize))
102+
return errorCodeToError(object_error::parse_failed);
103103

104104
auto Entry = std::make_unique<OffloadBundleEntry>(
105105
EntryOffset + SectionOffset, EntrySize, EntryIDSize, EntryID);
@@ -125,7 +125,7 @@ OffloadBundleFatBin::create(MemoryBufferRef Buf, uint64_t SectionOffset,
125125
// Read the Bundle Entries
126126
Error Err = TheBundle->readEntries(Buf.getBuffer(), SectionOffset);
127127
if (Err)
128-
return Err;
128+
return errorCodeToError(object_error::parse_failed);
129129

130130
return std::unique_ptr<OffloadBundleFatBin>(TheBundle);
131131
}

llvm/test/tools/llvm-readobj/ELF/AMDGPU/offloading-fail.test

Lines changed: 0 additions & 26 deletions
This file was deleted.

llvm/test/tools/llvm-readobj/ELF/AMDGPU/offloading.test

Lines changed: 0 additions & 27 deletions
This file was deleted.

llvm/tools/llvm-readobj/ObjDumper.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include "llvm/Object/Archive.h"
1717
#include "llvm/Object/Decompressor.h"
1818
#include "llvm/Object/ObjectFile.h"
19-
#include "llvm/Object/OffloadBinary.h"
20-
#include "llvm/Object/OffloadBundle.h"
2119
#include "llvm/Support/Error.h"
2220
#include "llvm/Support/FormatVariadic.h"
2321
#include "llvm/Support/ScopedPrinter.h"
@@ -232,14 +230,4 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile &Obj,
232230
}
233231
}
234232

235-
void ObjDumper::printOffloading(const object::ObjectFile &Obj) {
236-
SmallVector<llvm::object::OffloadBundleFatBin> Bundles;
237-
if (Error Err = object::extractOffloadBundleFatBinary(Obj, Bundles))
238-
reportWarning(std::move(Err), Obj.getFileName());
239-
240-
// Print out all the FatBin Bundles that are contained in this buffer.
241-
for (const auto &[Index, Bundle] : llvm::enumerate(Bundles))
242-
Bundle.printEntriesAsURI();
243-
}
244-
245233
} // namespace llvm

llvm/tools/llvm-readobj/ObjDumper.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "llvm/ADT/SmallVector.h"
1717
#include "llvm/ADT/StringRef.h"
1818
#include "llvm/Object/ObjectFile.h"
19-
#include "llvm/Object/OffloadBinary.h"
2019
#include "llvm/Support/CommandLine.h"
2120

2221
#include <unordered_set>
@@ -189,7 +188,6 @@ class ObjDumper {
189188
std::function<Error(const Twine &Msg)> WarningHandler;
190189
void reportUniqueWarning(Error Err) const;
191190
void reportUniqueWarning(const Twine &Msg) const;
192-
void printOffloading(const object::ObjectFile &Obj);
193191

194192
protected:
195193
ScopedPrinter &W;

llvm/tools/llvm-readobj/Opts.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def file_header : FF<"file-header", "Display file header">;
3232
def headers : FF<"headers", "Equivalent to setting: --file-header, --program-headers, --section-headers">;
3333
defm hex_dump : Eq<"hex-dump", "Display the specified section(s) as hexadecimal bytes">, MetaVarName<"<name or index>">;
3434
def pretty_print : FF<"pretty-print", "Pretty print JSON output">;
35-
def offloading : FF<"offloading", "Display the content of the offloading section">;
3635
def relocs : FF<"relocs", "Display the relocation entries in the file">;
3736
def section_data : FF<"section-data", "Display section data for each section shown. This option has no effect for GNU style output">;
3837
def section_details : FF<"section-details", "Display the section details">;

llvm/tools/llvm-readobj/llvm-readobj.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ static bool HashHistogram;
135135
static bool Memtag;
136136
static bool NeededLibraries;
137137
static bool Notes;
138-
static bool Offloading;
139138
static bool ProgramHeaders;
140139
static bool SectionGroups;
141140
static std::vector<std::string> SFrame;
@@ -275,7 +274,6 @@ static void parseOptions(const opt::InputArgList &Args) {
275274
opts::Memtag = Args.hasArg(OPT_memtag);
276275
opts::NeededLibraries = Args.hasArg(OPT_needed_libs);
277276
opts::Notes = Args.hasArg(OPT_notes);
278-
opts::Offloading = Args.hasArg(OPT_offloading);
279277
opts::PrettyPrint = Args.hasArg(OPT_pretty_print);
280278
opts::ProgramHeaders = Args.hasArg(OPT_program_headers);
281279
opts::SectionGroups = Args.hasArg(OPT_section_groups);
@@ -461,8 +459,6 @@ static void dumpObject(ObjectFile &Obj, ScopedPrinter &Writer,
461459
Dumper->printGnuHashTable();
462460
if (opts::VersionInfo)
463461
Dumper->printVersionInfo();
464-
if (opts::Offloading)
465-
Dumper->printOffloading(Obj);
466462
if (opts::StringTable)
467463
Dumper->printStringTable();
468464
if (Obj.isELF()) {
@@ -711,7 +707,6 @@ int llvm_readobj_main(int argc, char **argv, const llvm::ToolContext &) {
711707
opts::DynamicTable = true;
712708
opts::Notes = true;
713709
opts::VersionInfo = true;
714-
opts::Offloading = true;
715710
opts::UnwindInfo = true;
716711
opts::SectionGroups = true;
717712
opts::HashHistogram = true;

0 commit comments

Comments
 (0)