[TSan][libdispatch] Enable linking and running of tests on Linux
authorJulian Lettner <jlettner@apple.com>
Fri, 15 Mar 2019 17:52:27 +0000 (17:52 +0000)
committerJulian Lettner <jlettner@apple.com>
Fri, 15 Mar 2019 17:52:27 +0000 (17:52 +0000)
commit764c2165e8523980c5efc806dca08dceef2728a9
tree2446353591ab5276ce2f3d45614e8e45e0d2202e
parentd238bf7855a3c1f2ff2cf375992bee0c8b3c3356
[TSan][libdispatch] Enable linking and running of tests on Linux

When COMPILER_RT_INTERCEPT_LIBDISPATCH is ON the TSan runtime library
now has a dependency on the blocks runtime and libdispatch. Make sure we
set all the required linking options.

Also add cmake options for specifying additional library paths to
instruct the linker where to search for libdispatch and the blocks
runtime. This allows us to build TSan runtime with libdispatch support
without installing those libraries into default linker library paths.

`CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY` is necessary to avoid
aborting the build due to failing the link step in CMake's
check_c_compiler test.

Reviewed By: dvyukov, kubamracek

Differential Revision: https://reviews.llvm.org/D59334

llvm-svn: 356281
compiler-rt/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/lib/tsan/CMakeLists.txt
compiler-rt/lib/tsan/tests/CMakeLists.txt
compiler-rt/test/tsan/CMakeLists.txt