diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 5978d7b457aa..51fb96f3cf75 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -237,19 +237,14 @@ public: *P++ = NumSymbols; // nbucket *P++ = NumSymbols; // nchain - std::vector Buckets(NumSymbols); - std::vector Chains(NumSymbols); + Elf_Word *Buckets = P; + Elf_Word *Chains = P + NumSymbols; for (unsigned I = 1; I < NumSymbols; ++I) { uint32_t Hash = Hashes[I - 1] % NumSymbols; Chains[I] = Buckets[Hash]; Buckets[Hash] = I; } - - for (uint32_t V : Buckets) - *P++ = V; - for (uint32_t V : Chains) - *P++ = V; } SymbolTableSection &getDynSymSec() { return DynSymSec; }