From f6d5475e20e44a5d5bd0d75c3109848c03ba459f Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 21 Jul 2016 20:03:37 +0000 Subject: [PATCH] Disable thread safe statics in clang-cl, they call the CRT Also remove the needless static that was using them. llvm-svn: 276327 --- compiler-rt/CMakeLists.txt | 2 +- compiler-rt/lib/asan/asan_win.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 1699460e46a4..488dcea8ae11 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -198,7 +198,7 @@ if(MSVC) # 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) + if (MSVC_VERSION GREATER 1899 OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") list(APPEND SANITIZER_COMMON_CFLAGS /Zc:threadSafeInit-) endif() endif() diff --git a/compiler-rt/lib/asan/asan_win.cc b/compiler-rt/lib/asan/asan_win.cc index 6b289963568e..a4eb600b606b 100644 --- a/compiler-rt/lib/asan/asan_win.cc +++ b/compiler-rt/lib/asan/asan_win.cc @@ -235,7 +235,7 @@ void AsanOnDeadlySignal(int, void *siginfo, void *context) { // Exception handler for dealing with shadow memory. static LONG CALLBACK ShadowExceptionHandler(PEXCEPTION_POINTERS exception_pointers) { - static uptr page_size = GetPageSizeCached(); + uptr page_size = GetPageSizeCached(); // Only handle access violations. if (exception_pointers->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION) { -- GitLab