[compiler-rt] [compiler-rt] Add MinGW GCC support for Windows sanitizer runtimes (PR #209902)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 02:24:00 PDT 2026
================
@@ -332,15 +335,27 @@ ShadowExceptionHandler(PEXCEPTION_POINTERS exception_pointers) {
#endif
void InitializePlatformExceptionHandlers() {
-#if SANITIZER_WINDOWS64
+# if SANITIZER_WINDOWS64
// On Win64, we map memory on demand with access violation handler.
// Install our exception handler.
CHECK(AddVectoredExceptionHandler(TRUE, &ShadowExceptionHandler));
#endif
}
bool IsSystemHeapAddress(uptr addr) {
- return ::HeapValidate(GetProcessHeap(), 0, (void *)addr) != FALSE;
+ HANDLE process_heap = GetProcessHeap();
+ if (::HeapValidate(process_heap, 0, (void*)addr))
+ return true;
+
+# if defined(__GNUC__) && !defined(__clang__)
+ HANDLE crt_heap = (HANDLE)_get_heap_handle();
+ if (crt_heap == process_heap)
----------------
oltolm wrote:
This is only needed for MSVCRT because its private heap is distinct from the process heap. Support for MSVCRT has been deprecated in MSYS2, so I will drop this change from the PR.
https://github.com/llvm/llvm-project/pull/209902
More information about the llvm-commits
mailing list