diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt --- a/compiler-rt/lib/tsan/CMakeLists.txt +++ b/compiler-rt/lib/tsan/CMakeLists.txt @@ -18,6 +18,8 @@ -DTSAN_DEBUG_OUTPUT=2) endif() +set(TSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS}) + set(TSAN_RTL_CFLAGS ${TSAN_CFLAGS}) append_list_if(COMPILER_RT_HAS_MSSE3_FLAG -msse3 TSAN_RTL_CFLAGS) append_list_if(SANITIZER_LIMIT_FRAME_SIZE -Wframe-larger-than=530 @@ -75,6 +77,7 @@ # Libdispatch support for non-Apple platforms requires '-fblocks'. if (NOT APPLE) list(APPEND TSAN_RTL_CFLAGS "-fblocks") + list(APPEND TSAN_LINK_LIBS BlocksRuntime dispatch) endif() endif() @@ -112,8 +115,6 @@ if(APPLE) add_asm_sources(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S rtl/tsan_rtl_aarch64.S) - set(TSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS}) - add_weak_symbols("ubsan" WEAK_SYMBOL_LINK_FLAGS) add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS) @@ -202,6 +203,7 @@ $ ADDITIONAL_HEADERS ${TSAN_HEADERS} CFLAGS ${TSAN_RTL_CFLAGS} + LINK_LIBS ${TSAN_LINK_LIBS} PARENT_TARGET tsan) add_compiler_rt_runtime(clang_rt.tsan_cxx STATIC