[llvm-commits] [llvm] r123896 - in /llvm/trunk: include/llvm/Support/ELF.h lib/Object/CMakeLists.txt lib/Object/ELFObjectFile.cpp lib/Object/ObjectFile.cpp
NAKAMURA Takumi
geek4civic at gmail.com
Thu Jan 20 00:31:52 PST 2011
Michael,
2011/1/20 Michael J. Spencer <bigcheesegs at gmail.com>:
> Author: mspencer
> Date: Thu Jan 20 00:38:47 2011
> New Revision: 123896
> --- llvm/trunk/lib/Object/ELFObjectFile.cpp (added)
> +++ llvm/trunk/lib/Object/ELFObjectFile.cpp Thu Jan 20 00:38:47 2011
> +template<support::endianness target_endianness, bool is64Bits>
> +SymbolRef ELFObjectFile<target_endianness, is64Bits>
> + ::getSymbolNext(DataRefImpl Symb) const {
> + validateSymbol(Symb);
> + ELFDataRefImpl &SymbolData = *reinterpret_cast<ELFDataRefImpl *>(&Symb);
> + const Elf_Shdr *SymbolTableSection =
> + SymbolTableSections[SymbolData.SymbolTableSectionIndex];
> +
> + ++SymbolData.SymbolIndex;
> + // Check to see if we are at the end of this symbol table.
> + if (SymbolData.SymbolIndex >= SymbolTableSection->getEntityCount()) {
> + // We are at the end. If there are other symbol tables, jump to them.
> + ++SymbolData.SymbolTableSectionIndex;
> + SymbolData.SymbolIndex = 1; // The 0th symbol in ELF is fake.
> + // Otherwise return the terminator.
> + if (SymbolData.SymbolTableSectionIndex >= SymbolTableSections.size()) {
> + SymbolData.SymbolIndex = std::numeric_limits<uint32_t>::max();
> + SymbolData.SymbolTableSectionIndex = std::numeric_limits<uint32_t>::max();
> + }
> + }
> +
> + return SymbolRef(Symb, this);
> +}
It breaks "strict aliasing".
(DataRefImpl)Symb would not be updated with g++-4.4.0 -O3 (includes
-fstrict-aliasing).
For me, "llvm-nm
test/Object/TestObjectFiles/trivial-object-test.elf-i386" hangs up
with infinite loop.
...Takumi
More information about the llvm-commits
mailing list