[llvm-branch-commits] [compiler-rt] release/19.x: [compiler-rt][fuzzer] SetThreadName build fix for Mingw… (PR #106908)

David CARLIER via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Sep 1 06:11:51 PDT 2024


https://github.com/devnexen created https://github.com/llvm/llvm-project/pull/106908

…in attempt (#106902)

>From 37732be4723835e6afa063b16094fef448fa61bf Mon Sep 17 00:00:00 2001
From: David CARLIER <devnexen at gmail.com>
Date: Sun, 1 Sep 2024 13:35:10 +0100
Subject: [PATCH] release/19.x: [compiler-rt][fuzzer] SetThreadName build fix
 for Mingwin attempt (#106902)

---
 compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index db80eb383885e6..b262755fa436b2 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 =
@@ -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



More information about the llvm-branch-commits mailing list