[Objdump] Fixing crash when printing symbols in ELF sections with special types.

llvm-svn: 229759
This commit is contained in:
Colin LeMahieu 2015-02-18 23:00:22 +00:00
parent de93ac8895
commit 0fc422e3ea
3 changed files with 8 additions and 2 deletions

View File

@ -314,8 +314,11 @@ std::error_code ELFObjectFile<ELFT>::getSymbolAddress(DataRefImpl Symb,
ESym->getType() == ELF::STT_FUNC)
Result &= ~1;
if (Header->e_type == ELF::ET_REL)
Result += EF.getSection(ESym)->sh_addr;
if (Header->e_type == ELF::ET_REL) {
const typename ELFFile<ELFT>::Elf_Shdr * Section = EF.getSection(ESym);
if (Section != nullptr)
Result += Section->sh_addr;
}
return object_error::success;
}

View File

@ -0,0 +1,3 @@
// RUN: llvm-objdump -t %p/Inputs/proc-specific-section-elf | FileCheck %s
CHECK: 00000000 *UND* 00000000 print