[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: https://github.com/llvm/llvm-project/pull/81677

Co-authored-by: Amy Wishnousky <amyw@microsoft.com>
This commit is contained in:
Charlie Barto 2024-03-22 17:38:34 -07:00 committed by GitHub
parent 20e0bacd05
commit dc43aa439e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 0 deletions

View File

@ -85,6 +85,9 @@ SET(ASAN_HEADERS
include_directories(..)
set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_list_if(MSVC /Zl ASAN_CFLAGS)
set(ASAN_COMMON_DEFINITIONS ${COMPILER_RT_ASAN_SHADOW_SCALE_DEFINITION})
append_rtti_flag(OFF ASAN_CFLAGS)

View File

@ -218,6 +218,8 @@ include_directories(..)
set(SANITIZER_COMMON_DEFINITIONS
HAVE_RPC_XDR_H=${HAVE_RPC_XDR_H})
# note: L not I, this is nodefaultlibs for msvc
append_list_if(MSVC /Zl SANITIZER_COMMON_CFLAGS)
set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
# Too many existing bugs, needs cleanup.

View File

@ -41,6 +41,7 @@ set(UBSAN_HEADERS
include_directories(..)
set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_list_if(MSVC /Zl UBSAN_CFLAGS)
append_rtti_flag(OFF UBSAN_CFLAGS)
append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CFLAGS)