https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/110663
Backport b4130bee6bfd34d8045f02fc9f951bcb5db9d85c Requested by: @mstorsjo >From 35d177578d70c70b38ea9d6cf7a5cceec86291e3 Mon Sep 17 00:00:00 2001 From: Zentrik <llvm.zent...@gmail.com> Date: Tue, 24 Sep 2024 21:33:57 +0100 Subject: [PATCH] Fix libFuzzer not building with pthreads on Windows (#109525) Fixes https://github.com/llvm/llvm-project/issues/106871 (cherry picked from commit b4130bee6bfd34d8045f02fc9f951bcb5db9d85c) --- compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp index db80eb383885e6..73eea07cf869ff 100644 --- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp @@ -239,6 +239,10 @@ size_t PageSize() { } void SetThreadName(std::thread &thread, const std::string &name) { +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \ + defined(_GLIBCXX_GCC_GTHR_POSIX_H) + (void)pthread_setname_np(thread.native_handle(), name.c_str()); +#else typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR); HMODULE kbase = GetModuleHandleA("KernelBase.dll"); proc ThreadNameProc = @@ -253,6 +257,7 @@ void SetThreadName(std::thread &thread, const std::string &name) { } } } +#endif } } // namespace fuzzer _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits