2017-11-13 20:57:54 +08:00
|
|
|
# Needed for lit support in standalone builds.
|
2016-02-18 00:38:54 +08:00
|
|
|
include(AddLLVM)
|
|
|
|
|
2017-11-13 20:57:54 +08:00
|
|
|
configure_compiler_rt_lit_site_cfg(
|
2014-02-14 19:00:07 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)
|
|
|
|
|
2017-03-10 01:02:16 +08:00
|
|
|
# BlocksRuntime (and most of builtins) testsuites are not yet ported to lit.
|
2014-02-14 19:00:07 +08:00
|
|
|
# add_subdirectory(BlocksRuntime)
|
2014-02-14 19:42:22 +08:00
|
|
|
|
2014-02-19 18:04:29 +08:00
|
|
|
set(SANITIZER_COMMON_LIT_TEST_DEPS)
|
2017-09-16 11:26:03 +08:00
|
|
|
|
2017-10-02 13:03:55 +08:00
|
|
|
if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
|
2017-09-16 11:26:03 +08:00
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
|
|
|
|
endif()
|
|
|
|
|
2014-02-18 15:52:40 +08:00
|
|
|
# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
|
|
|
|
# and run tests with tools from the host toolchain.
|
2014-02-19 18:04:29 +08:00
|
|
|
if(NOT ANDROID)
|
2019-02-12 12:13:58 +08:00
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD AND NOT RUNTIMES_BUILD)
|
2014-02-19 18:04:29 +08:00
|
|
|
# Use LLVM utils and Clang from the same build tree.
|
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
|
[build] Rename clang-headers to clang-resource-headers
Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].
I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.
[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html
Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille
Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits
Tags: #clang, #sanitizers, #lldb, #openmp, #llvm
Differential Revision: https://reviews.llvm.org/D58791
llvm-svn: 355340
2019-03-05 05:19:53 +08:00
|
|
|
clang clang-resource-headers FileCheck count not llvm-config llvm-nm llvm-objdump
|
2016-11-15 01:37:50 +08:00
|
|
|
llvm-readobj llvm-symbolizer compiler-rt-headers sancov)
|
2015-07-03 06:08:38 +08:00
|
|
|
if (WIN32)
|
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
|
|
|
|
endif()
|
2014-02-19 18:04:29 +08:00
|
|
|
endif()
|
2016-04-07 07:18:09 +08:00
|
|
|
if(CMAKE_HOST_UNIX)
|
2014-02-18 15:52:40 +08:00
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2017-06-28 03:18:01 +08:00
|
|
|
function(compiler_rt_test_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()
|
|
|
|
|
2014-02-14 19:42:22 +08:00
|
|
|
# Run sanitizer tests only if we're sure that clang would produce
|
|
|
|
# working binaries.
|
|
|
|
if(COMPILER_RT_CAN_EXECUTE_TESTS)
|
2017-03-10 01:02:16 +08:00
|
|
|
if(COMPILER_RT_BUILD_BUILTINS)
|
|
|
|
add_subdirectory(builtins)
|
|
|
|
endif()
|
2017-04-26 15:35:36 +08:00
|
|
|
if(COMPILER_RT_BUILD_SANITIZERS)
|
2017-06-28 03:18:01 +08:00
|
|
|
compiler_rt_test_runtime(interception)
|
|
|
|
|
|
|
|
compiler_rt_test_runtime(lsan)
|
2017-06-28 01:24:26 +08:00
|
|
|
# CFI tests require diagnostic mode, which is implemented in UBSan.
|
2017-06-28 03:18:01 +08:00
|
|
|
compiler_rt_test_runtime(ubsan cfi)
|
|
|
|
compiler_rt_test_runtime(sanitizer_common)
|
2017-08-31 03:29:11 +08:00
|
|
|
|
2018-04-10 06:38:26 +08:00
|
|
|
# OpenBSD not supporting asan, cannot run the tests
|
2018-09-05 01:08:47 +08:00
|
|
|
if(COMPILER_RT_BUILD_LIBFUZZER AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD" AND NOT ANDROID)
|
2017-08-31 03:29:11 +08:00
|
|
|
compiler_rt_test_runtime(fuzzer)
|
|
|
|
endif()
|
2017-06-28 03:18:01 +08:00
|
|
|
|
2017-06-28 03:32:39 +08:00
|
|
|
foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
|
2017-06-28 03:52:35 +08:00
|
|
|
# cfi testing is gated on ubsan
|
|
|
|
if(NOT ${sanitizer} STREQUAL cfi)
|
|
|
|
compiler_rt_test_runtime(${sanitizer})
|
|
|
|
endif()
|
2017-06-28 03:32:39 +08:00
|
|
|
endforeach()
|
2017-09-19 02:13:47 +08:00
|
|
|
endif()
|
2017-10-02 13:03:55 +08:00
|
|
|
if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
|
2017-06-28 03:18:01 +08:00
|
|
|
compiler_rt_test_runtime(profile)
|
[sanitizer] Initial implementation of a Hardened Allocator
Summary:
This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator.
It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast.
The following were implemented:
- additional consistency checks on the allocation function parameters and on the heap chunks;
- use of checksum protected chunk header, to detect corruption;
- randomness to the allocator base;
- delayed freelist (quarantine), to mitigate use after free and overall determinism.
Additional mitigations are in the works.
Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc
Subscribers: kubabrecka, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D20084
llvm-svn: 271968
2016-06-07 09:20:26 +08:00
|
|
|
endif()
|
2017-06-28 03:18:01 +08:00
|
|
|
if(COMPILER_RT_BUILD_XRAY)
|
|
|
|
compiler_rt_test_runtime(xray)
|
2016-08-08 11:10:22 +08:00
|
|
|
endif()
|
2019-05-01 02:13:22 +08:00
|
|
|
if(COMPILER_RT_BUILD_CRT AND COMPILER_RT_HAS_CRT)
|
|
|
|
add_subdirectory(crt)
|
|
|
|
endif()
|
Add simple runtime tests for shadowcallstack
Summary:
ShadowCallStack does not yet have a runtime provided by compiler-rt, but
this change includes simple tests that make use of a very minimal
runtime in test/shadowcallstack/minimal_runtime.h
Reviewers: pcc, kcc, delcypher, eugenis, filcab
Reviewed By: pcc
Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers, kcc
Differential Revision: https://reviews.llvm.org/D44803
llvm-svn: 329210
2018-04-05 01:53:33 +08:00
|
|
|
# ShadowCallStack does not yet provide a runtime with compiler-rt, the tests
|
|
|
|
# include their own minimal runtime
|
|
|
|
add_subdirectory(shadowcallstack)
|
2014-02-14 19:42:22 +08:00
|
|
|
endif()
|
2014-02-20 20:36:26 +08:00
|
|
|
|
|
|
|
if(COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
# Now that we've traversed all the directories and know all the lit testsuites,
|
|
|
|
# introduce a rule to run to run all of them.
|
|
|
|
get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
|
|
|
|
get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
|
2016-08-20 06:17:48 +08:00
|
|
|
add_lit_target(check-compiler-rt
|
2014-02-20 20:36:26 +08:00
|
|
|
"Running all regression tests"
|
|
|
|
${LLVM_LIT_TESTSUITES}
|
|
|
|
DEPENDS ${LLVM_LIT_DEPENDS})
|
2016-08-20 06:17:48 +08:00
|
|
|
if(NOT TARGET check-all)
|
|
|
|
add_custom_target(check-all)
|
|
|
|
endif()
|
2016-09-02 02:26:51 +08:00
|
|
|
add_custom_target(compiler-rt-test-depends DEPENDS ${LLVM_LIT_DEPENDS})
|
2016-08-20 06:17:48 +08:00
|
|
|
add_dependencies(check-all check-compiler-rt)
|
2014-02-20 20:36:26 +08:00
|
|
|
endif()
|