[compiler-rt] Revert fuzzer windows changes (PR #83551)

David CARLIER via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 02:15:21 PST 2024


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

None

>From 6a07a4ffc0ba29add5a8e0645752619dc797d728 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen at gmail.com>
Date: Fri, 1 Mar 2024 10:14:08 +0000
Subject: [PATCH 1/2] Revert "[compiler-rt][fuzzer] windows build unbreak
 proposal. (#83538)"

This reverts commit 062d78ef58ac26e1c6f82201151428d0b89cca21.
---
 compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index 39ab9e241b5914..13f9a67a2f0fe3 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -18,18 +18,15 @@
 #include <errno.h>
 #include <io.h>
 #include <iomanip>
+#include <libloaderapi.h>
 #include <signal.h>
 #include <stdio.h>
+#include <stringapiset.h>
 #include <sys/types.h>
-// clang-format off
 #include <windows.h>
-// These must be included after windows.h.
-// archicture need to be set before including
-// libloaderapi
-#include <libloaderapi.h>
-#include <stringapiset.h>
+
+// This must be included after windows.h.
 #include <psapi.h>
-// clang-format on
 
 namespace fuzzer {
 

>From c522d4882740b449079bc6dec9c5400aa745d132 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen at gmail.com>
Date: Fri, 1 Mar 2024 10:14:45 +0000
Subject: [PATCH 2/2] Revert "[compiler-rt][Fuzzer] SetThreadName windows
 implementation new try. (#76761)"

This reverts commit 2cdf611c02392112860e661e8251efa8b1335cc2.
---
 compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index 13f9a67a2f0fe3..71770166805f78 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -18,10 +18,8 @@
 #include <errno.h>
 #include <io.h>
 #include <iomanip>
-#include <libloaderapi.h>
 #include <signal.h>
 #include <stdio.h>
-#include <stringapiset.h>
 #include <sys/types.h>
 #include <windows.h>
 
@@ -236,20 +234,8 @@ size_t PageSize() {
 }
 
 void SetThreadName(std::thread &thread, const std::string &name) {
-  typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
-  HMODULE kbase = GetModuleHandleA("KernelBase.dll");
-  proc ThreadNameProc =
-      reinterpret_cast<proc>(GetProcAddress, "SetThreadDescription");
-  if (proc) {
-    std::wstring buf;
-    auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), -1, nullptr, 0);
-    if (sz > 0) {
-      buf.resize(sz);
-      if (MultyByteToWideChar(CP_UTF8, 0, name.data(), -1, &buf[0], sz) > 0) {
-        (void)ThreadNameProc(thread.native_handle(), buf.c_str());
-      }
-    }
-  }
+  // TODO ?
+  // to UTF-8 then SetThreadDescription ?
 }
 
 } // namespace fuzzer



More information about the llvm-commits mailing list