2012-06-25 16:40:10 +08:00
|
|
|
# First, add the subdirectories which contain feature-based runtime libraries
|
|
|
|
# and several convenience helper libraries.
|
2013-09-02 16:57:23 +08:00
|
|
|
|
2014-02-18 15:26:58 +08:00
|
|
|
include(AddCompilerRT)
|
|
|
|
include(SanitizerUtils)
|
2014-08-09 06:01:20 +08:00
|
|
|
|
2016-07-21 15:39:55 +08:00
|
|
|
# Hoist the building of sanitizer_common on whether we're building either the
|
|
|
|
# sanitizers or xray (or both).
|
|
|
|
#
|
|
|
|
#TODO: Refactor sanitizer_common into smaller pieces (e.g. flag parsing, utils).
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND
|
|
|
|
(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY))
|
|
|
|
add_subdirectory(sanitizer_common)
|
|
|
|
endif()
|
|
|
|
|
2015-09-15 03:59:24 +08:00
|
|
|
if(COMPILER_RT_BUILD_BUILTINS)
|
|
|
|
add_subdirectory(builtins)
|
|
|
|
endif()
|
|
|
|
|
2016-08-19 23:13:21 +08:00
|
|
|
function(compiler_rt_build_runtime runtime)
|
|
|
|
string(TOUPPER ${runtime} runtime_uppercase)
|
|
|
|
if(COMPILER_RT_HAS_${runtime_uppercase})
|
|
|
|
add_subdirectory(${runtime})
|
|
|
|
foreach(directory ${ARGN})
|
|
|
|
add_subdirectory(${directory})
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(compiler_rt_build_sanitizer sanitizer)
|
|
|
|
string(TOUPPER ${sanitizer} sanitizer_uppercase)
|
|
|
|
string(TOLOWER ${sanitizer} sanitizer_lowercase)
|
|
|
|
list(FIND COMPILER_RT_SANITIZERS_TO_BUILD ${sanitizer_lowercase} result)
|
|
|
|
if(NOT ${result} EQUAL -1)
|
|
|
|
compiler_rt_build_runtime(${sanitizer} ${ARGN})
|
2015-12-10 08:40:58 +08:00
|
|
|
endif()
|
2016-08-19 23:13:21 +08:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
if(COMPILER_RT_BUILD_SANITIZERS)
|
|
|
|
compiler_rt_build_runtime(interception)
|
2015-12-10 08:40:58 +08:00
|
|
|
|
|
|
|
if(COMPILER_RT_HAS_SANITIZER_COMMON)
|
2016-01-16 08:31:29 +08:00
|
|
|
add_subdirectory(stats)
|
2015-12-10 08:40:58 +08:00
|
|
|
add_subdirectory(lsan)
|
|
|
|
add_subdirectory(ubsan)
|
|
|
|
endif()
|
|
|
|
|
2016-08-19 23:13:21 +08:00
|
|
|
compiler_rt_build_sanitizer(asan)
|
|
|
|
compiler_rt_build_sanitizer(dfsan)
|
|
|
|
compiler_rt_build_sanitizer(msan)
|
|
|
|
compiler_rt_build_sanitizer(tsan tsan/dd)
|
|
|
|
compiler_rt_build_sanitizer(safestack)
|
|
|
|
compiler_rt_build_sanitizer(cfi)
|
|
|
|
compiler_rt_build_sanitizer(esan)
|
|
|
|
compiler_rt_build_sanitizer(scudo)
|
2015-12-10 08:40:58 +08:00
|
|
|
|
2016-08-19 23:13:21 +08:00
|
|
|
compiler_rt_build_runtime(profile)
|
2016-07-20 22:14:50 +08:00
|
|
|
endif()
|
2016-07-21 15:39:55 +08:00
|
|
|
|
2016-08-19 23:13:21 +08:00
|
|
|
if(COMPILER_RT_BUILD_XRAY)
|
|
|
|
compiler_rt_build_runtime(xray)
|
2016-07-21 15:39:55 +08:00
|
|
|
endif()
|