BB: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/13820/steps/check-llvm%20asan/logs/stdio
rL371074 revealed a bug in llvm-nm.
This patch fixes it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371318
91177308-0d34-0410-b5e6-
96231b3b80d8
static char getNMSectionTagAndName(SymbolicFile &Obj, basic_symbol_iterator I,
StringRef &SecName) {
uint32_t Symflags = I->getFlags();
- if (isa<ELFObjectFileBase>(&Obj)) {
+ if (ELFObjectFileBase *ELFObj = dyn_cast<ELFObjectFileBase>(&Obj)) {
if (Symflags & object::SymbolRef::SF_Absolute)
SecName = "*ABS*";
else if (Symflags & object::SymbolRef::SF_Common)
return '?';
}
+ if (*SecIOrErr == ELFObj->section_end())
+ return '?';
+
Expected<StringRef> NameOrErr = (*SecIOrErr)->getName();
if (!NameOrErr) {
consumeError(NameOrErr.takeError());