[llvm-branch-commits] [compiler-rt] release/19.x: [compiler-rt] [fuzzer] Skip trying to set the thread name on MinGW (#115167) (PR #115287)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 7 01:47:54 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport 87f4bc0acad65b1d20160d4160c7778b187125fc
Requested by: @<!-- -->mstorsjo
---
Full diff: https://github.com/llvm/llvm-project/pull/115287.diff
1 Files Affected:
- (modified) compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp (+5-4)
``````````diff
diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index 73eea07cf869ff..da3eb3cfb34063 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -239,10 +239,11 @@ 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
+#ifndef __MINGW32__
+ // Not setting the thread name in MinGW environments. MinGW C++ standard
+ // libraries can either use native Windows threads or pthreads, so we
+ // don't know with certainty what kind of thread handle we're getting
+ // from thread.native_handle() here.
typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
HMODULE kbase = GetModuleHandleA("KernelBase.dll");
proc ThreadNameProc =
``````````
</details>
https://github.com/llvm/llvm-project/pull/115287
More information about the llvm-branch-commits
mailing list