Blob Blame History Raw
From f4d4ada2e920136870468f43e0f3c1efa265f2f7 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Thu, 25 Feb 2021 14:12:57 +0100
Subject: [PATCH] [PATCH][compiler-rt] Workaround libstdc++ limitation wrt.
 thread copy

---
 compiler-rt/lib/fuzzer/FuzzerDefs.h     | 6 ++++++
 compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/fuzzer/FuzzerDefs.h b/compiler-rt/lib/fuzzer/FuzzerDefs.h
index 1a2752a..abfbb8d 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDefs.h
+++ b/compiler-rt/lib/fuzzer/FuzzerDefs.h
@@ -50,6 +50,12 @@ template<typename T>
 
       template<class Other>
       struct rebind { typedef fuzzer_allocator<Other> other;  };
+
+      template< class U, class... Args >
+      void construct( U* p, Args&&... args ) {
+        std::allocator<T>::construct(p, std::forward<Args>(args)...);
+      }
+
   };
 
 template<typename T>
diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
index 447cafc..2fce139 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -294,7 +294,7 @@ static int RunInMultipleProcesses(const Vector<std::string> &Args,
   std::thread Pulse(PulseThread);
   Pulse.detach();
   for (unsigned i = 0; i < NumWorkers; i++)
-    V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
+    V.emplace_back(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors);
   for (auto &T : V)
     T.join();
   return HasErrors ? 1 : 0;
-- 
1.8.3.1