[compiler-rt] dc43aa4 - [asan][windows] When compiling with clang-cl or MSVC pass /Zl (that's a little L) (#85874)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 17:38:38 PDT 2024


Author: Charlie Barto
Date: 2024-03-22T17:38:34-07:00
New Revision: dc43aa439ecee90a9f51c6c1e46df8be61e0457c

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

LOG: [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 at microsoft.com>

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt
index f83ae82d42935a..601750f72175d6 100644
--- a/compiler-rt/lib/asan/CMakeLists.txt
+++ b/compiler-rt/lib/asan/CMakeLists.txt
@@ -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)

diff  --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
index f762524c333acf..f2b4ac72ae1573 100644
--- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt
+++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
@@ -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.

diff  --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt
index 3f1e12ed9ac66f..db0b33f1276ef2 100644
--- a/compiler-rt/lib/ubsan/CMakeLists.txt
+++ b/compiler-rt/lib/ubsan/CMakeLists.txt
@@ -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)
 


        


More information about the llvm-commits mailing list