diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-08-19 15:13:21 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-08-19 15:13:21 +0000 |
commit | 2b23fdcc97d60b5fa2f6d1280a7132a82e35c815 (patch) | |
tree | 079536090daa51e8f1d0c79682ee0df6beb6ece3 /cmake | |
parent | 9f3462bee804f1ee1c17509c9e5adb8255b548d2 (diff) | |
download | compiler-rt-2b23fdcc97d60b5fa2f6d1280a7132a82e35c815.tar.gz |
build: allow building a specific set of sanitizers
Introduce a new CMake option `COMPILER_RT_SANITIZERS_TO_BUILD` which takes
either a special token `all` (default) which will preserve the current behaviour
or a CMake list of sanitizers to build. It will still perform the normal checks
if the sanitizer is requested. It only permits a further means to exclude a
particular sanitizer. This gives finer grained control than
`COMPILER_RT_BUILD_SANITIZERS` which only gives an all or nothing control.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/CompilerRTUtils.cmake | 12 | ||||
-rw-r--r-- | cmake/config-ix.cmake | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index 25692974b..af5975f02 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -76,6 +76,18 @@ macro(list_intersect output input1 input2) endforeach() endmacro() +function(list_replace input_list old new) + set(replaced_list) + foreach(item ${${input_list}}) + if(${item} STREQUAL ${old}) + list(APPEND replaced_list ${new}) + else() + list(APPEND replaced_list ${item}) + endif() + endforeach() + set(${input_list} "${replaced_list}" PARENT_SCOPE) +endfunction() + # Takes ${ARGN} and puts only supported architectures in @out_var list. function(filter_available_targets out_var) set(archs ${${out_var}}) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 92c345262..67d0c7c22 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -400,6 +400,11 @@ else() set(OS_NAME "${CMAKE_SYSTEM_NAME}") endif() +set(ALL_SANITIZERS asan;dfsan;msan;profile;tsan;safestack;cfi;esan;scudo) +set(COMPILER_RT_SANITIZERS_TO_BUILD ${ALL_SANITIZERS} CACHE STRING + "sanitizers to build if supported on the target (all;${ALL_SANITIZERS})") +list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}") + if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR (OS_NAME MATCHES "Windows" AND MSVC))) |