[llvm-branch-commits] [compiler-rt] release/19.x: Fix libFuzzer not building with pthreads on Windows (#109525) (PR #110663)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Oct 1 06:12:24 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport b4130bee6bfd34d8045f02fc9f951bcb5db9d85c
Requested by: @<!-- -->mstorsjo
---
Full diff: https://github.com/llvm/llvm-project/pull/110663.diff
1 Files Affected:
- (modified) compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp (+5)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/110663
More information about the llvm-branch-commits
mailing list