diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2011-10-12 10:28:55 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2011-10-12 10:28:55 +0000 |
commit | 18dcb87f6beb228011545e0210c842d6741d5805 (patch) | |
tree | 82fa6168a5b0a96987d9bb289da80ed6b5f6cac3 /lib/Object/ELFObjectFile.cpp | |
parent | a2e87912d826b1843bb5b1058670f09b87aea905 (diff) |
lib/Object/ELFObjectFile.cpp: Fix undefined behavior for MC/ELF/many-section.s not to fail (on msvc).
DenseMap::lookup(k) would return "default constructor value" when k was not met. It would be useless when value type were POD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | lib/Object/ELFObjectFile.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Object/ELFObjectFile.cpp b/lib/Object/ELFObjectFile.cpp index a580dd07dc..7add2d8a52 100644 --- a/lib/Object/ELFObjectFile.cpp +++ b/lib/Object/ELFObjectFile.cpp @@ -444,8 +444,11 @@ template<support::endianness target_endianness, bool is64Bits> const typename ELFObjectFile<target_endianness, is64Bits>::Elf_Shdr * ELFObjectFile<target_endianness, is64Bits> ::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); |