summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm/llvm-nm.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-nm/llvm-nm.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-nm/llvm-nm.cpp')
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index ea47891250f..e6378a74306 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -1226,7 +1226,9 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
if (DyldInfoOnly || AddDyldInfo ||
HFlags & MachO::MH_NLIST_OUTOFSYNC_WITH_DYLDINFO) {
unsigned ExportsAdded = 0;
- for (const llvm::object::ExportEntry &Entry : MachO->exports()) {
+ Error Err = Error::success();
+ for (const llvm::object::ExportEntry &Entry : MachO->exports(Err,
+ MachO)) {
bool found = false;
bool ReExport = false;
if (!DyldInfoOnly) {
@@ -1362,6 +1364,8 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
}
}
}
+ if (Err)
+ error(std::move(Err), MachO->getFileName());
// Set the symbol names and indirect names for the added symbols.
if (ExportsAdded) {
EOS.flush();
OpenPOWER on IntegriCloud