This is an archive of the discontinued LLVM Phabricator instance.

[TSan][libdispatch] Enable linking and running of tests on Linux
ClosedPublic

Authored by yln on Mar 13 2019, 2:55 PM.

Details

Summary

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.

Event Timeline

yln created this revision.Mar 13 2019, 2:55 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added subscribers: llvm-commits, Restricted Project, mgorny, kubamracek. · View Herald Transcript
yln updated this revision to Diff 190527.Mar 13 2019, 4:00 PM

Refactor CMake options. All logic is in one place now.

yln updated this revision to Diff 190711.Mar 14 2019, 12:54 PM

Provide necessary linker flags when compiling tests.

This looks fine to me, but I think we need @dvyukov to sign off on this.

yln retitled this revision from [TSan][libdispatch] Enable linking of libcxx and tests on Linux to [TSan][libdispatch] Enable linking and running of tests on Linux.Mar 14 2019, 1:42 PM
yln edited the summary of this revision. (Show Details)
dvyukov accepted this revision.Mar 14 2019, 11:38 PM

I don't see any problems (because I don't understand cmake), so I am signing off :)

This revision is now accepted and ready to land.Mar 14 2019, 11:38 PM
This revision was automatically updated to reflect the committed changes.
beanz added a subscriber: beanz.May 28 2019, 4:35 PM
beanz added inline comments.
compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
598 ↗(On Diff #190855)

FYI, this isn't safe to do. CMAKE_TRY_COMPILE_TARGET_TYPE was added in CMake 3.6, and LLVM and Compiler-RT support building with CMake 3.4 and up.