diff options
author | Francis Ricci <francisjricci@gmail.com> | 2016-09-07 21:03:22 +0000 |
---|---|---|
committer | Francis Ricci <francisjricci@gmail.com> | 2016-09-07 21:03:22 +0000 |
commit | 2af3b685c4eb4d3727bd61fcbef4b5b5f3a8d7ab (patch) | |
tree | e8e8c2ddc89af2c0c2a69090c5624f3545a7e46c /lib/asan/CMakeLists.txt | |
parent | 4a0c5cdd3e3feb1a94b78f1196668e83fedfbca8 (diff) |
[compiler-rt] Allow sanitizers to be compiled for windows with clang
Summary:
A few small changes required to permit building the sanitizers
with Clang instead of only with MSVC.
Reviewers: compnerd, beanz, rnk
Subscribers: beanz, timurrrr, kubabrecka, dberris, llvm-commits
Differential Revision: https://reviews.llvm.org/D24092
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/CMakeLists.txt')
-rw-r--r-- | lib/asan/CMakeLists.txt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/asan/CMakeLists.txt b/lib/asan/CMakeLists.txt index e37705e0d..e6f3e42f2 100644 --- a/lib/asan/CMakeLists.txt +++ b/lib/asan/CMakeLists.txt @@ -212,11 +212,19 @@ else() CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + + set(DYNAMIC_RUNTIME_THUNK_CFLAGS "-DASAN_DYNAMIC_RUNTIME_THUNK") + if(MSVC) + list(APPEND DYNAMIC_RUNTIME_THUNK_CFLAGS "-Zl") + elseif(CMAKE_C_COMPILER_ID MATCHES Clang) + list(APPEND DYNAMIC_RUNTIME_THUNK_CFLAGS "-nodefaultlibs") + endif() + add_compiler_rt_runtime(clang_rt.asan_dynamic_runtime_thunk STATIC ARCHS ${arch} SOURCES asan_win_dynamic_runtime_thunk.cc - CFLAGS ${ASAN_CFLAGS} -DASAN_DYNAMIC_RUNTIME_THUNK -Zl + CFLAGS ${ASAN_CFLAGS} ${DYNAMIC_RUNTIME_THUNK_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) endif() |