Index: lib/asan/CMakeLists.txt =================================================================== --- lib/asan/CMakeLists.txt +++ lib/asan/CMakeLists.txt @@ -125,6 +125,7 @@ RTInterception RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTLSanCommon RTUbsan CFLAGS ${ASAN_DYNAMIC_CFLAGS} @@ -138,6 +139,7 @@ RTInterception RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTLSanCommon RTUbsan) Index: lib/asan/tests/CMakeLists.txt =================================================================== --- lib/asan/tests/CMakeLists.txt +++ lib/asan/tests/CMakeLists.txt @@ -251,6 +251,7 @@ $ $ $ + $ $ $) else() @@ -260,6 +261,7 @@ $ $ $ + $ $ $ $) @@ -283,6 +285,7 @@ $ $ $ + $ $ $ ${COMPILER_RT_GTEST_SOURCE} Index: lib/cfi/CMakeLists.txt =================================================================== --- lib/cfi/CMakeLists.txt +++ lib/cfi/CMakeLists.txt @@ -30,6 +30,7 @@ OBJECT_LIBS RTInterception RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTUbsan CFLAGS ${CFI_CFLAGS} ${CFI_DIAG_CFLAGS} PARENT_TARGET cfi) Index: lib/hwasan/CMakeLists.txt =================================================================== --- lib/hwasan/CMakeLists.txt +++ lib/hwasan/CMakeLists.txt @@ -78,7 +78,8 @@ RTInterception RTSanitizerCommon RTSanitizerCommonLibc - RTUbsan + RTSanitizerCommonCoverage + RTUbsan CFLAGS ${HWASAN_RTL_CFLAGS} PARENT_TARGET hwasan) add_compiler_rt_runtime(clang_rt.hwasan_cxx @@ -112,7 +113,8 @@ RTInterception RTSanitizerCommon RTSanitizerCommonLibc - RTUbsan + RTSanitizerCommonCoverage + RTUbsan # The only purpose of RTHWAsan_dynamic_version_script_dummy is to # carry a dependency of the shared runtime on the version script. # Replacing it with a straightforward Index: lib/lsan/CMakeLists.txt =================================================================== --- lib/lsan/CMakeLists.txt +++ lib/lsan/CMakeLists.txt @@ -43,6 +43,7 @@ RTInterception RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage CFLAGS ${LSAN_CFLAGS} LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS} LINK_LIBS ${LSAN_LINK_LIBS} @@ -56,6 +57,7 @@ $ $ $ + $ $ CFLAGS ${LSAN_CFLAGS} PARENT_TARGET lsan) Index: lib/msan/CMakeLists.txt =================================================================== --- lib/msan/CMakeLists.txt +++ lib/msan/CMakeLists.txt @@ -40,6 +40,7 @@ $ $ $ + $ $ CFLAGS ${MSAN_RTL_CFLAGS} PARENT_TARGET msan) Index: lib/sanitizer_common/CMakeLists.txt =================================================================== --- lib/sanitizer_common/CMakeLists.txt +++ lib/sanitizer_common/CMakeLists.txt @@ -64,10 +64,6 @@ set(SANITIZER_LIBCDEP_SOURCES sanitizer_common_libcdep.cc sanitizer_allocator_checks.cc - sancov_flags.cc - sanitizer_coverage_fuchsia.cc - sanitizer_coverage_libcdep_new.cc - sanitizer_coverage_win_sections.cc sanitizer_linux_libcdep.cc sanitizer_mac_libcdep.cc sanitizer_posix_libcdep.cc @@ -77,6 +73,12 @@ sanitizer_symbolizer_posix_libcdep.cc sanitizer_unwind_linux_libcdep.cc) +set(SANITIZER_COVERAGE_SOURCES + sancov_flags.cc + sanitizer_coverage_fuchsia.cc + sanitizer_coverage_libcdep_new.cc + sanitizer_coverage_win_sections.cc) + # Explicitly list all sanitizer_common headers. Not all of these are # included in sanitizer_common source files, but we need to depend on # headers when building our custom unit tests. @@ -208,6 +210,12 @@ SOURCES ${SANITIZER_LIBCDEP_SOURCES} CFLAGS ${SANITIZER_CFLAGS} DEFS ${SANITIZER_COMMON_DEFINITIONS}) +add_compiler_rt_object_libraries(RTSanitizerCommonCoverage + ${OS_OPTION} + ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH} + SOURCES ${SANITIZER_COVERAGE_SOURCES} + CFLAGS ${SANITIZER_CFLAGS} + DEFS ${SANITIZER_COMMON_DEFINITIONS}) set(SANITIZER_NO_WEAK_HOOKS_CFLAGS ${SANITIZER_CFLAGS}) list(APPEND SANITIZER_NO_WEAK_HOOKS_CFLAGS "-DSANITIZER_SUPPORTS_WEAK_HOOKS=0") Index: lib/scudo/CMakeLists.txt =================================================================== --- lib/scudo/CMakeLists.txt +++ lib/scudo/CMakeLists.txt @@ -51,6 +51,7 @@ SOURCES ${SCUDO_SOURCES} OBJECT_LIBS RTSanitizerCommonNoTermination RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTInterception RTUbsan CFLAGS ${SCUDO_CFLAGS} @@ -70,6 +71,7 @@ SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES} OBJECT_LIBS RTSanitizerCommonNoTermination RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTInterception RTUbsan RTUbsan_cxx Index: lib/tsan/CMakeLists.txt =================================================================== --- lib/tsan/CMakeLists.txt +++ lib/tsan/CMakeLists.txt @@ -114,6 +114,7 @@ OBJECT_LIBS RTInterception RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTUbsan CFLAGS ${TSAN_RTL_CFLAGS} LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS} @@ -163,6 +164,7 @@ $ $ $ + $ $ CFLAGS ${TSAN_RTL_CFLAGS} PARENT_TARGET tsan) Index: lib/tsan/tests/CMakeLists.txt =================================================================== --- lib/tsan/tests/CMakeLists.txt +++ lib/tsan/tests/CMakeLists.txt @@ -22,6 +22,7 @@ $ $ $ + $ $) set(TSAN_TEST_RUNTIME RTTsanTest) add_library(${TSAN_TEST_RUNTIME} STATIC ${TSAN_TEST_RUNTIME_OBJECTS}) Index: lib/ubsan/CMakeLists.txt =================================================================== --- lib/ubsan/CMakeLists.txt +++ lib/ubsan/CMakeLists.txt @@ -76,6 +76,7 @@ RTUbsan_standalone RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTInterception LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} PARENT_TARGET ubsan) @@ -88,6 +89,7 @@ RTUbsan_standalone RTSanitizerCommonNoHooks RTSanitizerCommonLibcNoHooks + RTSanitizerCommonCoverage RTInterception LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} PARENT_TARGET ubsan) @@ -154,6 +156,7 @@ SOURCES ubsan_init_standalone_preinit.cc OBJECT_LIBS RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTUbsan RTUbsan_standalone RTInterception @@ -173,6 +176,7 @@ ARCHS ${UBSAN_SUPPORTED_ARCH} OBJECT_LIBS RTSanitizerCommon RTSanitizerCommonLibc + RTSanitizerCommonCoverage RTUbsan RTUbsan_cxx RTUbsan_standalone