Skip to content

Commit dc43aa4

Browse files
Charlie Bartoamyw-msft
andauthored
[asan][windows] When compiling with clang-cl or MSVC pass /Zl (that's a little L) (#85874)
/Zl is the equivalent of -nodefaultlibs. The idea here is to make sure that the asan runtime doesn't have any defaultlibs directives, which makes it easier to mix an asan runtime built with the dynamic CRT with an application built with the static CRT (or vise-versa). This is part of the overall effort to remove the static asan runtime on windows entirely: #81677 Co-authored-by: Amy Wishnousky <[email protected]>
1 parent 20e0bac commit dc43aa4

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

compiler-rt/lib/asan/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ SET(ASAN_HEADERS
8585
include_directories(..)
8686

8787
set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
88+
89+
append_list_if(MSVC /Zl ASAN_CFLAGS)
90+
8891
set(ASAN_COMMON_DEFINITIONS ${COMPILER_RT_ASAN_SHADOW_SCALE_DEFINITION})
8992

9093
append_rtti_flag(OFF ASAN_CFLAGS)

compiler-rt/lib/sanitizer_common/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ include_directories(..)
218218
set(SANITIZER_COMMON_DEFINITIONS
219219
HAVE_RPC_XDR_H=${HAVE_RPC_XDR_H})
220220

221+
# note: L not I, this is nodefaultlibs for msvc
222+
append_list_if(MSVC /Zl SANITIZER_COMMON_CFLAGS)
221223
set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
222224

223225
# Too many existing bugs, needs cleanup.

compiler-rt/lib/ubsan/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ set(UBSAN_HEADERS
4141
include_directories(..)
4242

4343
set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
44+
append_list_if(MSVC /Zl UBSAN_CFLAGS)
4445
append_rtti_flag(OFF UBSAN_CFLAGS)
4546
append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CFLAGS)
4647

0 commit comments

Comments
 (0)