[PATCH] D59163: [TSan] Linux: link in BlocksRuntime and libdispatch if necessary
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 14:39:34 PDT 2019
yln updated this revision to Diff 190157.
yln added a comment.
Support linking of unit tests on Linux.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59163/new/
https://reviews.llvm.org/D59163
Files:
compiler-rt/lib/tsan/CMakeLists.txt
compiler-rt/lib/tsan/tests/CMakeLists.txt
Index: compiler-rt/lib/tsan/tests/CMakeLists.txt
===================================================================
--- compiler-rt/lib/tsan/tests/CMakeLists.txt
+++ compiler-rt/lib/tsan/tests/CMakeLists.txt
@@ -45,6 +45,9 @@
else()
list(APPEND LINK_FLAGS -fsanitize=thread)
list(APPEND LINK_FLAGS -lm)
+ if (COMPILER_RT_INTERCEPT_LIBDISPATCH)
+ list(APPEND LINK_FLAGS -lBlocksRuntime -ldispatch)
+ endif()
endif()
set(TSAN_RTL_HEADERS)
Index: compiler-rt/lib/tsan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/tsan/CMakeLists.txt
+++ 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
@@ -72,9 +74,9 @@
if(COMPILER_RT_INTERCEPT_LIBDISPATCH)
list(APPEND TSAN_SOURCES rtl/tsan_libdispatch.cc)
- # Libdispatch support for non-Apple platforms requires '-fblocks'.
if (NOT APPLE)
- list(APPEND TSAN_RTL_CFLAGS "-fblocks")
+ list(APPEND TSAN_RTL_CFLAGS -fblocks)
+ list(APPEND TSAN_LINK_LIBS BlocksRuntime dispatch)
endif()
endif()
@@ -112,8 +114,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 +202,7 @@
$<TARGET_OBJECTS:RTUbsan.${arch}>
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59163.190157.patch
Type: text/x-patch
Size: 1867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190311/a5f949e2/attachment.bin>
More information about the llvm-commits
mailing list