[compiler-rt] 7c4cffd - [compiler-rt][fuzzer] SetThreadName build fix for Mingwin attempt (#106902)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 1 05:35:14 PDT 2024
Author: David CARLIER
Date: 2024-09-01T13:35:10+01:00
New Revision: 7c4cffd9d8be424e9e9542be9aec3b5a6f69073e
URL: https://github.com/llvm/llvm-project/commit/7c4cffd9d8be424e9e9542be9aec3b5a6f69073e
DIFF: https://github.com/llvm/llvm-project/commit/7c4cffd9d8be424e9e9542be9aec3b5a6f69073e.diff
LOG: [compiler-rt][fuzzer] SetThreadName build fix for Mingwin attempt (#106902)
Added:
Modified:
compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
Removed:
################################################################################
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
More information about the llvm-commits
mailing list