[sancov] moving sancov rt to sancov/ directory

Subscribers: kubabrecka, mgorny

Differential Revision: https://reviews.llvm.org/D28541

llvm-svn: 291734
This commit is contained in:
Mike Aizatsky 2017-01-12 01:19:34 +00:00
parent 63f953795e
commit 875572f358
23 changed files with 58 additions and 14 deletions

View File

@ -36,6 +36,10 @@ function(compiler_rt_build_sanitizer sanitizer)
endif()
endfunction()
if(COMPILER_RT_HAS_SANITIZER_COMMON)
add_subdirectory(sancov)
endif()
if(COMPILER_RT_BUILD_SANITIZERS)
compiler_rt_build_runtime(interception)

View File

@ -118,6 +118,7 @@ if(APPLE)
RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
RTLSanCommon
RTUbsan
CFLAGS ${ASAN_DYNAMIC_CFLAGS}
@ -131,6 +132,7 @@ else()
RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
RTLSanCommon
RTUbsan)

View File

@ -281,6 +281,7 @@ macro(add_asan_tests_for_arch_and_kind arch kind)
$<TARGET_OBJECTS:RTInterception.osx>
$<TARGET_OBJECTS:RTSanitizerCommon.osx>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.osx>
$<TARGET_OBJECTS:RTSancovLibc.osx>
$<TARGET_OBJECTS:RTLSanCommon.osx>
$<TARGET_OBJECTS:RTUbsan.osx>)
else()
@ -290,6 +291,7 @@ macro(add_asan_tests_for_arch_and_kind arch kind)
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
$<TARGET_OBJECTS:RTLSanCommon.${arch}>
$<TARGET_OBJECTS:RTUbsan.${arch}>
$<TARGET_OBJECTS:RTUbsan_cxx.${arch}>)
@ -342,6 +344,7 @@ if(ANDROID)
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
$<TARGET_OBJECTS:RTUbsan.${arch}>
$<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
${COMPILER_RT_GTEST_SOURCE}

View File

@ -20,6 +20,7 @@ foreach(arch ${CFI_SUPPORTED_ARCH})
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
CFLAGS ${CFI_CFLAGS}
PARENT_TARGET cfi)
add_compiler_rt_runtime(clang_rt.cfi_diag
@ -29,6 +30,7 @@ foreach(arch ${CFI_SUPPORTED_ARCH})
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
RTUbsan
CFLAGS ${CFI_CFLAGS} ${CFI_DIAG_CFLAGS}
PARENT_TARGET cfi)

View File

@ -23,6 +23,7 @@ foreach(arch ${DFSAN_SUPPORTED_ARCH})
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
CFLAGS ${DFSAN_CFLAGS}
PARENT_TARGET dfsan)
add_sanitizer_rt_symbols(clang_rt.dfsan

View File

@ -26,6 +26,7 @@ foreach (arch ${ESAN_SUPPORTED_ARCH})
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
CFLAGS ${ESAN_RTL_CFLAGS})
add_sanitizer_rt_symbols(clang_rt.esan
ARCHS ${arch}

View File

@ -32,6 +32,7 @@ if(COMPILER_RT_HAS_LSAN)
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
$<TARGET_OBJECTS:RTLSanCommon.${arch}>
CFLAGS ${LSAN_CFLAGS}
PARENT_TARGET lsan)

View File

@ -35,6 +35,7 @@ foreach(arch ${MSAN_SUPPORTED_ARCH})
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
$<TARGET_OBJECTS:RTUbsan.${arch}>
CFLAGS ${MSAN_RTL_CFLAGS}
PARENT_TARGET msan)

View File

@ -0,0 +1,16 @@
set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_rtti_flag(OFF SANITIZER_CFLAGS)
set(SANCOV_LIBCDEP_SOURCES
sancov_flags.cc
sanitizer_coverage_libcdep.cc)
add_compiler_rt_object_libraries(RTSancovLibc
${OS_OPTION}
ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
SOURCES ${SANCOV_LIBCDEP_SOURCES}
CFLAGS ${SANITIZER_CFLAGS}
DEFS ${SANITIZER_COMMON_DEFINITIONS})
include_directories(..)

View File

@ -12,8 +12,8 @@
//===----------------------------------------------------------------------===//
#include "sancov_flags.h"
#include "sanitizer_flag_parser.h"
#include "sanitizer_platform.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_platform.h"
#if !SANITIZER_LINUX
// other platforms do not have weak symbols out of the box.

View File

@ -13,8 +13,8 @@
#ifndef SANCOV_FLAGS_H
#define SANCOV_FLAGS_H
#include "sanitizer_flag_parser.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_internal_defs.h"
namespace __sancov {

View File

@ -9,10 +9,10 @@
// Sanitizer Coverage Controller for Trace PC Guard.
#include "sancov_flags.h"
#include "sanitizer_allocator_internal.h"
#include "sanitizer_atomic.h"
#include "sanitizer_common.h"
#include "sanitizer_symbolizer.h"
#include "sanitizer_common/sanitizer_allocator_internal.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
using namespace __sanitizer;

View File

@ -52,9 +52,7 @@ set(SANITIZER_NOLIBC_SOURCES
set(SANITIZER_LIBCDEP_SOURCES
sanitizer_common_libcdep.cc
sancov_flags.cc
sanitizer_coverage_libcdep.cc
sanitizer_coverage_libcdep_new.cc
sanitizer_coverage_mapping_libcdep.cc
sanitizer_linux_libcdep.cc
sanitizer_posix_libcdep.cc

View File

@ -954,7 +954,9 @@ SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_init() {
}
SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_dump() {
coverage_data.DumpAll();
#if SANITIZER_LINUX
__sanitizer_dump_trace_pc_guard_coverage();
#endif
}
SANITIZER_INTERFACE_ATTRIBUTE void
__sanitizer_cov_module_init(s32 *guards, uptr npcs, u8 *counters,

View File

@ -200,7 +200,8 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID)
if(APPLE)
add_sanitizer_common_lib("RTSanitizerCommon.test.osx"
$<TARGET_OBJECTS:RTSanitizerCommon.osx>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.osx>)
$<TARGET_OBJECTS:RTSanitizerCommonLibc.osx>
$<TARGET_OBJECTS:RTSancovLibc.osx>)
else()
if(CAN_TARGET_x86_64)
add_sanitizer_common_lib("RTSanitizerCommon.test.nolibc.x86_64"
@ -210,7 +211,8 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID)
foreach(arch ${SANITIZER_UNITTEST_SUPPORTED_ARCH})
add_sanitizer_common_lib("RTSanitizerCommon.test.${arch}"
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>)
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>)
endforeach()
endif()
foreach(arch ${SANITIZER_UNITTEST_SUPPORTED_ARCH})
@ -224,7 +226,8 @@ if(ANDROID)
${SANITIZER_UNITTESTS}
${COMPILER_RT_GTEST_SOURCE}
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>)
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>)
set_target_compile_flags(SanitizerTest
${SANITIZER_COMMON_CFLAGS}
${SANITIZER_TEST_CFLAGS_COMMON})

View File

@ -29,6 +29,7 @@ if(COMPILER_RT_HAS_SCUDO)
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonNoTermination.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
CFLAGS ${SCUDO_CFLAGS}
PARENT_TARGET scudo)
endforeach()

View File

@ -22,6 +22,7 @@ add_compiler_rt_runtime(clang_rt.stats
SOURCES stats.cc
OBJECT_LIBS RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
CFLAGS ${SANITIZER_COMMON_CFLAGS}
LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
PARENT_TARGET stats)

View File

@ -119,6 +119,7 @@ if(APPLE)
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
RTUbsan
CFLAGS ${TSAN_RTL_CFLAGS}
LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
@ -179,6 +180,7 @@ else()
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
$<TARGET_OBJECTS:RTUbsan.${arch}>
CFLAGS ${TSAN_RTL_CFLAGS})
add_compiler_rt_runtime(clang_rt.tsan_cxx

View File

@ -26,6 +26,7 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
CFLAGS ${DD_CFLAGS}
PARENT_TARGET dd)
@ -40,6 +41,7 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSancovLibc.${arch}>
LINK_LIBS ${DD_LINKLIBS}
PARENT_TARGET dd)
endif()

View File

@ -69,6 +69,7 @@ macro(add_tsan_unittest testname)
$<TARGET_OBJECTS:RTInterception.osx>
$<TARGET_OBJECTS:RTSanitizerCommon.osx>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.osx>
$<TARGET_OBJECTS:RTSancovLibc.osx>
$<TARGET_OBJECTS:RTUbsan.osx>)
set(TSAN_TEST_RUNTIME RTTsanTest.${testname}.${arch})
add_library(${TSAN_TEST_RUNTIME} STATIC ${TSAN_TEST_RUNTIME_OBJECTS})

View File

@ -67,6 +67,7 @@ if(APPLE)
RTUbsan_standalone
RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
PARENT_TARGET ubsan)
endif()
@ -102,6 +103,7 @@ else()
ARCHS ${UBSAN_SUPPORTED_ARCH}
OBJECT_LIBS RTSanitizerCommon
RTSanitizerCommonLibc
RTSancovLibc
RTUbsan
RTUbsan_standalone
CFLAGS ${UBSAN_CFLAGS}

View File

@ -51,7 +51,8 @@ add_compiler_rt_component(xray-fdr)
set(XRAY_COMMON_RUNTIME_OBJECT_LIBS
RTSanitizerCommon
RTSanitizerCommonLibc)
RTSanitizerCommonLibc
RTSancovLibc)
foreach(arch ${XRAY_SUPPORTED_ARCH})
if(CAN_TARGET_${arch})