summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Barto <chbarto@microsoft.com>2024-09-06 11:00:30 -0700
committerCharlie Barto <chbarto@microsoft.com>2024-09-06 11:01:00 -0700
commit3667ecd4735b1309efd0d644409673f906d1bdb1 (patch)
treee166fc83e5c2d1f80d5084fa9b838d92eec3c393
parent75239e2d3c66c1a2521e154392498ae45abad350 (diff)
set the C runtime linkage to /MD only for sanitizer_common, interception, and asan. Keep the other sanitizers as /MT since they don't support OneDLLusers/chbarto/test_onedll
-rw-r--r--compiler-rt/CMakeLists.txt6
-rw-r--r--compiler-rt/lib/asan/CMakeLists.txt8
-rw-r--r--compiler-rt/lib/asan/tests/CMakeLists.txt1
-rw-r--r--compiler-rt/lib/interception/CMakeLists.txt8
-rw-r--r--compiler-rt/lib/sanitizer_common/CMakeLists.txt8
5 files changed, 25 insertions, 6 deletions
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index a15c88119dd1..deb6994f4818 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -382,11 +382,7 @@ endif()
if(MSVC)
- # asan on windows only supports the release dll version of the runtimes, in the interest of
- # only having one asan dll to support/test. Having asan statically linked
- # with the runtime might be possible, but it multiplies the number of scenerios to test.
- # the program USING sanitizers can use whatever version of the runtime it wants to.
- set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
+ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
# Remove any /M[DT][d] flags, and strip any definitions of _DEBUG.
# Since we're using CMAKE_MSVC_RUNTIME_LIBRARY (CMP0091 set to NEW),
diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt
index 58e844993f65..c700fcd74edc 100644
--- a/compiler-rt/lib/asan/CMakeLists.txt
+++ b/compiler-rt/lib/asan/CMakeLists.txt
@@ -97,7 +97,13 @@ SET(ASAN_HEADERS
)
include_directories(..)
-
+if(MSVC)
+ # asan on windows only supports the release dll version of the runtimes, in the interest of
+ # only having one asan dll to support/test. Having asan statically linked
+ # with the runtime might be possible, but it multiplies the number of scenerios to test.
+ # the program USING sanitizers can use whatever version of the runtime it wants to.
+ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
+endif()
set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_list_if(MSVC /Zl ASAN_CFLAGS)
diff --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt
index 7bed4989f6e0..0c4b0361ec49 100644
--- a/compiler-rt/lib/asan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/asan/tests/CMakeLists.txt
@@ -104,6 +104,7 @@ set(ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS
set(ASAN_UNITTEST_INSTRUMENTED_LIBS)
set(ASAN_UNITTEST_NOINST_LINK_FLAGS ${ASAN_UNITTEST_COMMON_LINK_FLAGS})
+append_list_if(MSVC -Wl,-nodefaultlib:msvcrt ASAN_UNITTEST_NOINST_LINK_FLAGS)
if(NOT APPLE)
append_list_if(COMPILER_RT_HAS_LIBM -lm ASAN_UNITTEST_NOINST_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LIBDL -ldl ASAN_UNITTEST_NOINST_LINK_FLAGS)
diff --git a/compiler-rt/lib/interception/CMakeLists.txt b/compiler-rt/lib/interception/CMakeLists.txt
index abe9229340be..fe7fa27fbc78 100644
--- a/compiler-rt/lib/interception/CMakeLists.txt
+++ b/compiler-rt/lib/interception/CMakeLists.txt
@@ -14,6 +14,14 @@ set(INTERCEPTION_HEADERS
interception_win.h
)
+if(MSVC)
+ # asan on windows only supports the release dll version of the runtimes, in the interest of
+ # only having one asan dll to support/test. Having asan statically linked
+ # with the runtime might be possible, but it multiplies the number of scenerios to test.
+ # the program USING sanitizers can use whatever version of the runtime it wants to.
+ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
+endif()
+
include_directories(..)
set(INTERCEPTION_CFLAGS ${SANITIZER_COMMON_CFLAGS})
diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
index 41c3888275a0..556a64f30174 100644
--- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt
+++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
@@ -211,6 +211,14 @@ set(SANITIZER_IMPL_HEADERS
sanitizer_win_thunk_interception.h
)
+if(MSVC)
+ # asan on windows only supports the release dll version of the runtimes, in the interest of
+ # only having one asan dll to support/test. Having asan statically linked
+ # with the runtime might be possible, but it multiplies the number of scenerios to test.
+ # the program USING sanitizers can use whatever version of the runtime it wants to.
+ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
+endif()
+
include_directories(..)
set(SANITIZER_COMMON_DEFINITIONS