From 7f29c6fcd31ea7fdba8be602cc6fee2d2016fcd3 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 11 Dec 2018 16:34:40 -0500 Subject: [PATCH] Disable threading in thinLTO /usr/bin/ld.gold does not support threaded plugins if gold itself has not been linked against pthread. https://bugzilla.redhat.com/show_bug.cgi?id=1636479#c16 --- lib/LTO/LTO.cpp | 26 +------------------------- tools/gold/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp index 68d210cb..e4369c7f 100644 --- a/lib/LTO/LTO.cpp +++ b/lib/LTO/LTO.cpp @@ -914,7 +914,6 @@ public: namespace { class InProcessThinBackend : public ThinBackendProc { - ThreadPool BackendThreadPool; AddStreamFn AddStream; NativeObjectCache Cache; TypeIdSummariesByGuidTy TypeIdSummariesByGuid; @@ -931,7 +930,6 @@ public: const StringMap &ModuleToDefinedGVSummaries, AddStreamFn AddStream, NativeObjectCache Cache) : ThinBackendProc(Conf, CombinedIndex, ModuleToDefinedGVSummaries), - BackendThreadPool(ThinLTOParallelismLevel), AddStream(std::move(AddStream)), Cache(std::move(Cache)) { // Create a mapping from type identifier GUIDs to type identifier summaries. // This allows backends to use the type identifier GUIDs stored in the @@ -996,34 +994,12 @@ public: assert(ModuleToDefinedGVSummaries.count(ModulePath)); const GVSummaryMapTy &DefinedGlobals = ModuleToDefinedGVSummaries.find(ModulePath)->second; - BackendThreadPool.async( - [=](BitcodeModule BM, ModuleSummaryIndex &CombinedIndex, - const FunctionImporter::ImportMapTy &ImportList, - const FunctionImporter::ExportSetTy &ExportList, - const std::map - &ResolvedODR, - const GVSummaryMapTy &DefinedGlobals, - MapVector &ModuleMap, - const TypeIdSummariesByGuidTy &TypeIdSummariesByGuid) { - Error E = runThinLTOBackendThread( + return runThinLTOBackendThread( AddStream, Cache, Task, BM, CombinedIndex, ImportList, ExportList, ResolvedODR, DefinedGlobals, ModuleMap, TypeIdSummariesByGuid); - if (E) { - std::unique_lock L(ErrMu); - if (Err) - Err = joinErrors(std::move(*Err), std::move(E)); - else - Err = std::move(E); - } - }, - BM, std::ref(CombinedIndex), std::ref(ImportList), std::ref(ExportList), - std::ref(ResolvedODR), std::ref(DefinedGlobals), std::ref(ModuleMap), - std::ref(TypeIdSummariesByGuid)); - return Error::success(); } Error wait() override { - BackendThreadPool.wait(); if (Err) return std::move(*Err); else diff --git a/tools/gold/CMakeLists.txt b/tools/gold/CMakeLists.txt index d2580329..c3bf1b72 100644 --- a/tools/gold/CMakeLists.txt +++ b/tools/gold/CMakeLists.txt @@ -15,4 +15,5 @@ if( LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR ) gold-plugin.cpp ) + endif() -- 2.18.1