[llvm-objdump] improve error reporting of bad mach-o ordinals

llvm-svn: 217909
This commit is contained in:
Nick Kledzik 2014-09-16 22:03:13 +00:00
parent 69c4d37b45
commit abd2987907
1 changed files with 8 additions and 2 deletions

View File

@ -2446,9 +2446,15 @@ static StringRef ordinalName(const object::MachOObjectFile *Obj, int Ordinal) {
case MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP:
return "flat-namespace";
default:
Obj->getLibraryShortNameByIndex(Ordinal-1, DylibName);
return DylibName;
if (Ordinal > 0) {
std::error_code EC = Obj->getLibraryShortNameByIndex(Ordinal-1,
DylibName);
if (EC)
return "<<ordinal too big>>";
return DylibName;
}
}
return "<<unknown special ordinal>>";
}
//===----------------------------------------------------------------------===//