@@ -45,14 +45,15 @@ else()
45
45
set (USE_LIBCXX_default FALSE )
46
46
endif ()
47
47
48
- option (BUILD_SHARED_LIBS "Build mutable as a shared library" OFF )
49
- option (ENABLE_SANITIZERS "Build mutable with address and UB sanitizers" ON )
50
- option (ENABLE_SANITY_FIELDS "Build mutable with sanity fields enabled" ON )
51
- option (USE_LIBCXX "Use libcxx (aka. libc++), LLVM's new implementation of the C++ standard library, instead of GNU's libstdc++" ${USE_LIBCXX_default} )
52
- option (USE_LLD "Use LLD, a linker from the LLVM project" ${HAS_LLD} )
48
+ option (BUILD_SHARED_LIBS "Build mutable as a shared library" OFF )
49
+ option (ENABLE_SANITIZERS "Build mutable with address and UB sanitizers" ON )
50
+ option (ENABLE_THREAD_SANITIZER "Build mutable with thread sanitizer" OFF )
51
+ option (ENABLE_SANITY_FIELDS "Build mutable with sanity fields enabled" ON )
52
+ option (USE_LIBCXX "Use libcxx (aka. libc++), LLVM's new implementation of the C++ standard library, instead of GNU's libstdc++" ${USE_LIBCXX_default} )
53
+ option (USE_LLD "Use LLD, a linker from the LLVM project" ${HAS_LLD} )
53
54
54
55
# Enable backends
55
- option (WITH_V8 "Build with the V8-based WebAssembly execution backend." ON )
56
+ option (WITH_V8 "Build with the V8-based WebAssembly execution backend." ON )
56
57
57
58
if (${BUILD_SHARED_LIBS} )
58
59
set (LIB_TYPE SHARED )
@@ -159,10 +160,18 @@ if(${USE_LLD})
159
160
add_link_options ("-fuse-ld=lld" )
160
161
endif ()
161
162
163
+ if (${ENABLE_SANITIZERS} AND ${ENABLE_THREAD_SANITIZER} )
164
+ message (SEND_ERROR "ENABLE_SANITIZERS and ENABLE_THREAD_SANITIZER are mutually exclusive. Cannot combine UBSan and ASan with ThreadSan." )
165
+ endif ()
166
+
162
167
if (${ENABLE_SANITIZERS} )
163
168
message ("[mutable] Compiling with address and UB sanitizers" )
164
169
add_compile_options (-fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -fsanitize-link-c++-runtime )
165
170
add_link_options (-fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -fsanitize-link-c++-runtime )
171
+ elseif (${ENABLE_THREAD_SANITIZER} )
172
+ message ("[mutable] Compiling with thread sanitizer" )
173
+ add_compile_options (-fsanitize=thread -fsanitize-link-c++-runtime )
174
+ add_link_options (-fsanitize=thread -fsanitize-link-c++-runtime )
166
175
endif ()
167
176
168
177
if (${ENABLE_SANITY_FIELDS} )
0 commit comments