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})
|
2017-06-28 05:10:46 +08:00
|
|
|
if(${runtime} STREQUAL tsan)
|
|
|
|
add_subdirectory(tsan/dd)
|
|
|
|
endif()
|
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()
|
|
|
|
|
2017-06-28 03:32:39 +08:00
|
|
|
foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
|
|
|
|
compiler_rt_build_runtime(${sanitizer})
|
|
|
|
endforeach()
|
2017-09-19 02:13:47 +08:00
|
|
|
endif()
|
2015-12-10 08:40:58 +08:00
|
|
|
|
2017-10-02 13:03:55 +08:00
|
|
|
if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
|
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()
|
2017-08-22 07:25:50 +08:00
|
|
|
|
|
|
|
if(COMPILER_RT_BUILD_LIBFUZZER)
|
|
|
|
compiler_rt_build_runtime(fuzzer)
|
|
|
|
endif()
|