diff --git a/lib/Object/ELFObjectFile.cpp b/lib/Object/ELFObjectFile.cpp index a580dd07dc1..7add2d8a52e 100644 --- a/lib/Object/ELFObjectFile.cpp +++ b/lib/Object/ELFObjectFile.cpp @@ -444,8 +444,11 @@ template const typename ELFObjectFile::Elf_Shdr * ELFObjectFile ::getSection(const Elf_Sym *symb) const { - if (symb->st_shndx == ELF::SHN_XINDEX) + if (symb->st_shndx == ELF::SHN_XINDEX) { + if (!ExtendedSymbolTable.count(symb)) + return 0; return getSection(ExtendedSymbolTable.lookup(symb)); + } if (symb->st_shndx >= ELF::SHN_LORESERVE) return 0; return getSection(symb->st_shndx);