summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/MachODump.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2017-07-20 23:08:41 +0000
committerKevin Enderby <enderby@apple.com>2017-07-20 23:08:41 +0000
commit3e95bd2239236df3e1417519d7fdae6b72c94c4e (patch)
tree57b7fe7517be98c897adff09e118ebf66314669c /llvm/tools/llvm-objdump/MachODump.cpp
parentb5e9070388fac4e0ad123565290ca0a78378982d (diff)
downloadbcm5719-llvm-3e95bd2239236df3e1417519d7fdae6b72c94c4e.tar.gz
bcm5719-llvm-3e95bd2239236df3e1417519d7fdae6b72c94c4e.zip
Add error handling to the dyld compact export entries in libObject.
lld needs a matching change for this will be my next commit. Expect it to fail build until that matching commit is picked up by the bots. Like the changes in r296527 for dyld bind entires and the changes in r298883 for lazy bind, weak bind and rebase entries the export entries are the last of the dyld compact info to have error handling added. This follows the model of iterators that can fail that Lang Hanes designed when fixing the problem for bad archives r275316 (or r275361). So that iterating through the exports now terminates if there is an error and returns an llvm::Error with an error message in all cases for malformed input. This change provides the plumbing for the error handling, all the needed testing of error conditions and test cases for all of the unique error messages. llvm-svn: 308690
Diffstat (limited to 'llvm/tools/llvm-objdump/MachODump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/MachODump.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 3bab94d681a..31a3f66b1d3 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -9402,7 +9402,8 @@ void llvm::printMachOExportsTrie(const object::MachOObjectFile *Obj) {
}
}
}
- for (const llvm::object::ExportEntry &Entry : Obj->exports()) {
+ Error Err = Error::success();
+ for (const llvm::object::ExportEntry &Entry : Obj->exports(Err, Obj)) {
uint64_t Flags = Entry.flags();
bool ReExport = (Flags & MachO::EXPORT_SYMBOL_FLAGS_REEXPORT);
bool WeakDef = (Flags & MachO::EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION);
@@ -9455,6 +9456,8 @@ void llvm::printMachOExportsTrie(const object::MachOObjectFile *Obj) {
}
outs() << "\n";
}
+ if (Err)
+ report_error(Obj->getFileName(), std::move(Err));
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud