Remove SymbolTable::getChunks.
When we were using a std::sort over all the chunks we needed to put them in a
single storage.
Now that we just iterate over them and use a map to find the output section,
we can avoid allocating the temporary storage.
llvm-svn: 243980
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index f702bc5..0f66e40 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -81,13 +81,15 @@
// Create output section objects and add them to OutputSections.
template <class ELFT> void Writer<ELFT>::createSections() {
SmallDenseMap<StringRef, OutputSection *> Map;
- for (Chunk *C : Symtab->getChunks()) {
- OutputSection *&Sec = Map[C->getSectionName()];
- if (!Sec) {
- Sec = new (CAlloc.Allocate()) OutputSection(C->getSectionName());
- OutputSections.push_back(Sec);
+ for (std::unique_ptr<ObjectFile<ELFT>> &File : Symtab->ObjectFiles) {
+ for (Chunk *C : File->getChunks()) {
+ OutputSection *&Sec = Map[C->getSectionName()];
+ if (!Sec) {
+ Sec = new (CAlloc.Allocate()) OutputSection(C->getSectionName());
+ OutputSections.push_back(Sec);
+ }
+ Sec->addChunk<ELFT>(C);
}
- Sec->addChunk<ELFT>(C);
}
}