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 | 9bfcf776385b343b0743e5c528032df6c614f158 (patch) | |
tree | 9d0ca3803f0e3155b54d96a3fb7aa21fdd737d74 /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 5a793d3762af67dcdb4280f830d50c0385e500fa (diff) | |
download | bcm5719-llvm-9bfcf776385b343b0743e5c528032df6c614f158.tar.gz bcm5719-llvm-9bfcf776385b343b0743e5c528032df6c614f158.zip |
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.
llvm-svn: 141774
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index a580dd07dc1..7add2d8a52e 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/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); |