diff options
-rw-r--r-- | lld/ELF/OutputSections.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 781d9728dee..9179d197e7f 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1064,8 +1064,13 @@ template <class ELFT> void OutputSection<ELFT>::writeTo(uint8_t *Buf) { ArrayRef<uint8_t> Filler = Script<ELFT>::X->getFiller(this->Name); if (!Filler.empty()) fill(Buf, this->getSize(), Filler); - parallel_for_each(Sections.begin(), Sections.end(), - [=](InputSection<ELFT> *C) { C->writeTo(Buf); }); + if (Config->Threads) { + parallel_for_each(Sections.begin(), Sections.end(), + [=](InputSection<ELFT> *C) { C->writeTo(Buf); }); + } else { + for (InputSection<ELFT> *C : Sections) + C->writeTo(Buf); + } // Linker scripts may have BYTE()-family commands with which you // can write arbitrary bytes to the output. Process them if any. Script<ELFT>::X->writeDataBytes(this->Name, Buf); |