[PATCH] D59334: [TSan][libdispatch] Enable linking of libcxx and tests on Linux
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 13 16:00:50 PDT 2019
yln updated this revision to Diff 190527.
yln added a comment.
Refactor CMake options. All logic is in one place now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59334/new/
https://reviews.llvm.org/D59334
Files:
compiler-rt/CMakeLists.txt
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,7 @@
else()
list(APPEND LINK_FLAGS -fsanitize=thread)
list(APPEND LINK_FLAGS -lm)
+ list(APPEND LINK_FLAGS ${COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS})
endif()
set(TSAN_RTL_HEADERS)
Index: compiler-rt/lib/tsan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/tsan/CMakeLists.txt
+++ compiler-rt/lib/tsan/CMakeLists.txt
@@ -72,10 +72,7 @@
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")
- endif()
+ list(APPEND TSAN_RTL_CFLAGS ${COMPILER_RT_INTERCEPT_LIBDISPATCH_CFLAGS})
endif()
set(TSAN_HEADERS
@@ -252,7 +249,7 @@
set(LIBCXX_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libcxx_tsan_${arch})
add_custom_libcxx(libcxx_tsan_${arch} ${LIBCXX_PREFIX}
DEPS ${TSAN_RUNTIME_LIBRARIES}
- CFLAGS ${TARGET_CFLAGS} -fsanitize=thread
+ CFLAGS ${TARGET_CFLAGS} -fsanitize=thread ${COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS}
USE_TOOLCHAIN)
list(APPEND libcxx_tsan_deps libcxx_tsan_${arch}-build)
endforeach()
Index: compiler-rt/CMakeLists.txt
===================================================================
--- compiler-rt/CMakeLists.txt
+++ compiler-rt/CMakeLists.txt
@@ -182,7 +182,20 @@
pythonize_bool(COMPILER_RT_DEBUG)
option(COMPILER_RT_INTERCEPT_LIBDISPATCH
- "Support interception of libdispatch (GCD). Requires '-fblocks'." OFF)
+ "Support interception of libdispatch (GCD). Requires '-fblocks'" OFF)
+option(COMPILER_RT_BLOCKS_RUNTIME_LIBRARY_PATH
+ "Library search path for blocks runtime (-lBlocksRuntime)" "")
+option(COMPILER_RT_LIBDISPATCH_LIBRARY_PATH
+ "Library search path for libdispatch (-ldispatch)" "")
+if (COMPILER_RT_INTERCEPT_LIBDISPATCH)
+ set(COMPILER_RT_INTERCEPT_LIBDISPATCH_CFLAGS -fblocks)
+ set(COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS)
+ append_list_if(COMPILER_RT_BLOCKS_RUNTIME_LIBRARY_PATH -L${COMPILER_RT_BLOCKS_RUNTIME_LIBRARY_PATH}
+ COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS)
+ append_list_if(COMPILER_RT_LIBDISPATCH_LIBRARY_PATH -L${COMPILER_RT_LIBDISPATCH_LIBRARY_PATH}
+ COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS)
+ list(APPEND COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS -lBlocksRuntime -ldispatch)
+endif()
if (APPLE) # Always enable on Apple platforms.
set(COMPILER_RT_INTERCEPT_LIBDISPATCH ON)
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59334.190527.patch
Type: text/x-patch
Size: 2692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190313/74f3fd6e/attachment.bin>
More information about the llvm-commits
mailing list