From 9bfcf776385b343b0743e5c528032df6c614f158 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 12 Oct 2011 10:28:55 +0000 Subject: 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 --- llvm/lib/Object/ELFObjectFile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Object/ELFObjectFile.cpp') diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index a580dd0..7add2d8 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/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); -- cgit v1.1