diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-11-25 20:20:57 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-11-25 20:20:57 +0000 |
| commit | 6066641423cdc3c4c87f15b90e58cd2928df1b48 (patch) | |
| tree | b838768cac7b2422afc02f830579cc0d86c7b75a | |
| parent | 92d91569a19dff0941ba6f90470227dfc4f880d1 (diff) | |
| download | bcm5719-llvm-6066641423cdc3c4c87f15b90e58cd2928df1b48.tar.gz bcm5719-llvm-6066641423cdc3c4c87f15b90e58cd2928df1b48.zip | |
We shouldn't call parallle_for_each if -no-thread is given.
llvm-svn: 287948
| -rw-r--r-- | lld/ELF/Driver.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 9f1bb7464be..27914282cdd 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -801,15 +801,18 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) { // MergeInputSection::splitIntoPieces needs to be called before // any call of MergeInputSection::getOffset. Do that. - parallel_for_each(Symtab.Sections.begin(), Symtab.Sections.end(), - [](InputSectionBase<ELFT> *S) { - if (!S->Live) - return; - if (S->Compressed) - S->uncompress(); - if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S)) - MS->splitIntoPieces(); - }); + auto Fn = [](InputSectionBase<ELFT> *S) { + if (!S->Live) + return; + if (S->Compressed) + S->uncompress(); + if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S)) + MS->splitIntoPieces(); + }; + if (Config->Threads) + parallel_for_each(Symtab.Sections.begin(), Symtab.Sections.end(), Fn); + else + std::for_each(Symtab.Sections.begin(), Symtab.Sections.end(), Fn); // Write the result to the file. writeResult<ELFT>(); |

