We shouldn't call parallle_for_each if -no-thread is given.

llvm-svn: 287948
This commit is contained in:
Rui Ueyama 2016-11-25 20:20:57 +00:00
parent 92d91569a1
commit 6066641423
1 changed files with 12 additions and 9 deletions

View File

@ -801,15 +801,18 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
// MergeInputSection::splitIntoPieces needs to be called before // MergeInputSection::splitIntoPieces needs to be called before
// any call of MergeInputSection::getOffset. Do that. // any call of MergeInputSection::getOffset. Do that.
parallel_for_each(Symtab.Sections.begin(), Symtab.Sections.end(), auto Fn = [](InputSectionBase<ELFT> *S) {
[](InputSectionBase<ELFT> *S) { if (!S->Live)
if (!S->Live) return;
return; if (S->Compressed)
if (S->Compressed) S->uncompress();
S->uncompress(); if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S))
if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S)) MS->splitIntoPieces();
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. // Write the result to the file.
writeResult<ELFT>(); writeResult<ELFT>();