Skip to content

Commit 8bf105c

Browse files
authored
[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.
1 parent 2d3167f commit 8bf105c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler-rt/lib/asan/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ if(MSVC)
106106
endif()
107107
set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
108108

109+
# Win/ASan relies on the runtime functions being hotpatchable. See
110+
# https://github.com/llvm/llvm-project/pull/149444
111+
if(MSVC)
112+
list(APPEND ASAN_CFLAGS /hotpatch)
113+
endif()
114+
109115
append_list_if(MSVC /Zl ASAN_CFLAGS)
110116

111117
set(ASAN_COMMON_DEFINITIONS "")

0 commit comments

Comments
 (0)