[compiler-rt] [compiler-rt][fuzzer] SetThreadName build fix for Mingwin attempt (PR #106902)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 1 04:41:20 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David CARLIER (devnexen)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/106902.diff


1 Files Affected:

- (modified) compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp (+4) 


``````````diff
diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index e0210aa0ac3651..7252d99dd375df 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -239,6 +239,7 @@ size_t PageSize() {
 }
 
 void SetThreadName(std::thread &thread, const std::string &name) {
+#if !defined(__MINGW32__)
   typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
   HMODULE kbase = GetModuleHandleA("KernelBase.dll");
   proc ThreadNameProc = reinterpret_cast<proc>(
@@ -253,6 +254,9 @@ void SetThreadName(std::thread &thread, const std::string &name) {
       }
     }
   }
+#else
+  (void)pthread_setname_np(thread.native_handle(), name.c_str());
+#endif
 }
 
 } // namespace fuzzer

``````````

</details>


https://github.com/llvm/llvm-project/pull/106902


More information about the llvm-commits mailing list