Blame SOURCES/0001-Disable-threading-in-thinLTO.patch

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