[compiler-rt] 8bf105c - [asan] Build the Windows runtime with /hotpatch (#154694)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 01:40:08 PDT 2025


Author: Hans Wennborg
Date: 2025-08-22T10:40:04+02:00
New Revision: 8bf105cb01995762dff195397ecc11bf52221e9a

URL: https://github.com/llvm/llvm-project/commit/8bf105cb01995762dff195397ecc11bf52221e9a
DIFF: https://github.com/llvm/llvm-project/commit/8bf105cb01995762dff195397ecc11bf52221e9a.diff

LOG: [asan] Build the Windows runtime with /hotpatch (#154694)

Win/ASan relies on the runtime's functions being 16-byte aligned so it
can intercept them with hotpatching. This used to be true (but not
guaranteed) until #149444.

Passing /hotpatch will give us enough alignment and generally ensure
that the functions are hotpatchable.

Added: 
    

Modified: 
    compiler-rt/lib/asan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt
index d1d229e3e6d40..7d07ec765c005 100644
--- a/compiler-rt/lib/asan/CMakeLists.txt
+++ b/compiler-rt/lib/asan/CMakeLists.txt
@@ -106,6 +106,12 @@ if(MSVC)
 endif()
 set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 
+# Win/ASan relies on the runtime functions being hotpatchable. See
+# https://github.com/llvm/llvm-project/pull/149444
+if(MSVC)
+  list(APPEND ASAN_CFLAGS /hotpatch)
+endif()
+
 append_list_if(MSVC /Zl ASAN_CFLAGS)
 
 set(ASAN_COMMON_DEFINITIONS "")


        


More information about the llvm-commits mailing list