[ELF2] Don't allocate more SymbolBodies than needed.

Differential Revision:	http://reviews.llvm.org/D12605

llvm-svn: 246802
This commit is contained in:
Davide Italiano 2015-09-03 20:25:54 +00:00
parent 246e618e77
commit 34812ba258

View File

@ -110,7 +110,7 @@ template <class ELFT> void elf2::ObjectFile<ELFT>::initializeSymbols() {
if (FirstNonLocal > NumSymbols)
error("Invalid sh_info in symbol table");
Syms = llvm::make_range(Syms.begin() + FirstNonLocal, Syms.end());
SymbolBodies.reserve(NumSymbols);
SymbolBodies.reserve(NumSymbols - FirstNonLocal);
for (const Elf_Sym &Sym : Syms)
SymbolBodies.push_back(createSymbolBody(StringTable, &Sym));
}