[PATCH] D59334: [TSan][libdispatch] Enable linking and running of tests on Linux
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 10:52:20 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL356281: [TSan][libdispatch] Enable linking and running of tests on Linux (authored by yln, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D59334?vs=190711&id=190855#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59334/new/
https://reviews.llvm.org/D59334
Files:
compiler-rt/trunk/CMakeLists.txt
compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
compiler-rt/trunk/lib/tsan/CMakeLists.txt
compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
compiler-rt/trunk/test/tsan/CMakeLists.txt
Index: compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
+++ compiler-rt/trunk/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/trunk/lib/tsan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt
+++ compiler-rt/trunk/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
Index: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
@@ -595,6 +595,7 @@
-DCMAKE_C_FLAGS=${LIBCXX_C_FLAGS}
-DCMAKE_CXX_FLAGS=${LIBCXX_CXX_FLAGS}
-DCMAKE_BUILD_TYPE=Release
+ -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
-DLLVM_PATH=${LLVM_MAIN_SRC_DIR}
-DLLVM_BINARY_DIR=${prefix}
-DLLVM_LIBRARY_OUTPUT_INTDIR=${prefix}/lib
Index: compiler-rt/trunk/test/tsan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/test/tsan/CMakeLists.txt
+++ compiler-rt/trunk/test/tsan/CMakeLists.txt
@@ -31,6 +31,9 @@
string(TOLOWER "-${arch}" TSAN_TEST_CONFIG_SUFFIX)
get_test_cc_for_arch(${arch} TSAN_TEST_TARGET_CC TSAN_TEST_TARGET_CFLAGS)
+ string(REPLACE ";" " " LIBDISPATCH_LINK_FLAGS_STRING " ${COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS}")
+ string(APPEND TSAN_TEST_TARGET_CFLAGS ${LIBDISPATCH_LINK_FLAGS_STRING})
+
string(TOUPPER ${arch} ARCH_UPPER_CASE)
set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
Index: compiler-rt/trunk/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/CMakeLists.txt
+++ compiler-rt/trunk/CMakeLists.txt
@@ -182,7 +182,26 @@
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)
+ if (COMPILER_RT_BLOCKS_RUNTIME_LIBRARY_PATH)
+ list(APPEND COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS
+ -L${COMPILER_RT_BLOCKS_RUNTIME_LIBRARY_PATH}
+ -Wl,-rpath=${COMPILER_RT_BLOCKS_RUNTIME_LIBRARY_PATH})
+ endif()
+ if (COMPILER_RT_LIBDISPATCH_LIBRARY_PATH)
+ list(APPEND COMPILER_RT_INTERCEPT_LIBDISPATCH_LINK_FLAGS
+ -L${COMPILER_RT_LIBDISPATCH_LIBRARY_PATH}
+ -Wl,-rpath=${COMPILER_RT_LIBDISPATCH_LIBRARY_PATH})
+ endif()
+ 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.190855.patch
Type: text/x-patch
Size: 3733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190315/3f72e7ab/attachment.bin>
More information about the llvm-commits
mailing list