[llvm-commits] [llvm] r141774 - /llvm/trunk/lib/Object/ELFObjectFile.cpp
NAKAMURA Takumi
geek4civic at gmail.com
Wed Oct 12 03:38:50 PDT 2011
Nick, please reconfirm whether my fix would be reasonable.
...Takumi
2011/10/12 NAKAMURA Takumi <geek4civic at gmail.com>:
> Author: chapuni
> Date: Wed Oct 12 05:28:55 2011
> New Revision: 141774
>
> URL: http://llvm.org/viewvc/llvm-project?rev=141774&view=rev
> Log:
> 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.
>
> Modified:
> llvm/trunk/lib/Object/ELFObjectFile.cpp
>
> Modified: llvm/trunk/lib/Object/ELFObjectFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELFObjectFile.cpp?rev=141774&r1=141773&r2=141774&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Object/ELFObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/ELFObjectFile.cpp Wed Oct 12 05:28:55 2011
> @@ -444,8 +444,11 @@
> 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);
More information about the llvm-commits
mailing list