diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index accc8ef33fcd..daac487e6c9b 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -24,15 +24,21 @@ namespace lld { namespace coff { void SymbolTable::addFile(std::unique_ptr FileP) { +#if LLVM_ENABLE_THREADS + std::launch Policy = std::launch::async; +#else + std::launch Policy = std::launch::deferred; +#endif + InputFile *File = FileP.get(); Files.push_back(std::move(FileP)); if (auto *F = dyn_cast(File)) { ArchiveQueue.push_back( - std::async(std::launch::async, [=]() { F->parse(); return F; })); + std::async(Policy, [=]() { F->parse(); return F; })); return; } ObjectQueue.push_back( - std::async(std::launch::async, [=]() { File->parse(); return File; })); + std::async(Policy, [=]() { File->parse(); return File; })); if (auto *F = dyn_cast(File)) { ObjectFiles.push_back(F); } else if (auto *F = dyn_cast(File)) {