[compiler-rt] r263979 - [asan] Disable thread-safe static initilization with VS 2015
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 13:08:59 PDT 2016
Author: rnk
Date: Mon Mar 21 15:08:59 2016
New Revision: 263979
URL: http://llvm.org/viewvc/llvm-project?rev=263979&view=rev
Log:
[asan] Disable thread-safe static initilization with VS 2015
ASan interceptors contain local statics which run before the CRT is
initialized. Thread-safe statics appear to rely on CRT-internal state,
and will crash without this flag.
Modified:
compiler-rt/trunk/CMakeLists.txt
Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=263979&r1=263978&r2=263979&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Mon Mar 21 15:08:59 2016
@@ -258,6 +258,12 @@ if(MSVC)
endif()
append_list_if(COMPILER_RT_HAS_Oy_FLAG /Oy- SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_GS_FLAG /GS- SANITIZER_COMMON_CFLAGS)
+ # VS 2015 (version 1900) added support for thread safe static initialization.
+ # However, ASan interceptors run before CRT initialization, which causes the
+ # new thread safe code to crash. Disable this feature for now.
+ if (MSVC_VERSION GREATER 1899)
+ list(APPEND SANITIZER_COMMON_CFLAGS /Zc:threadSafeInit-)
+ endif()
endif()
append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS)
More information about the llvm-commits
mailing list