From f4d4ada2e920136870468f43e0f3c1efa265f2f7 Mon Sep 17 00:00:00 2001 From: serge-sans-paille 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 template struct rebind { typedef fuzzer_allocator other; }; + + template< class U, class... Args > + void construct( U* p, Args&&... args ) { + std::allocator::construct(p, std::forward(args)...); + } + }; template 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 &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