Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | # Build for the experimental deadlock detector runtime library. |
| 2 | |
| 3 | include_directories(../..) |
| 4 | |
| 5 | set(DD_CFLAGS ${SANITIZER_COMMON_CFLAGS}) |
| 6 | append_no_rtti_flag(DD_CFLAGS) |
| 7 | |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 8 | set(DD_SOURCES |
| 9 | dd_rtl.cc |
| 10 | dd_interceptors.cc |
| 11 | ) |
| 12 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 13 | set(DD_LINKLIBS) |
| 14 | append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS) |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 15 | append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 16 | append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS) |
| 17 | |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 18 | add_custom_target(dd) |
| 19 | # Deadlock detector is currently supported on 64-bit Linux only. |
| 20 | if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID) |
| 21 | set(arch "x86_64") |
| 22 | add_compiler_rt_runtime(clang_rt.dd-${arch} ${arch} STATIC |
| 23 | SOURCES ${DD_SOURCES} |
| 24 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 25 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 26 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 27 | CFLAGS ${DD_CFLAGS}) |
| 28 | add_dependencies(dd clang_rt.dd-${arch}) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 29 | |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 30 | add_compiler_rt_object_libraries(RTDD |
| 31 | ARCH ${arch} |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 32 | SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS}) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 33 | |
Stephen Hines | 6a211c5 | 2014-07-21 00:49:56 -0700 | [diff] [blame] | 34 | add_compiler_rt_runtime(clang_rt.dyndd-${arch} ${arch} SHARED |
| 35 | SOURCES $<TARGET_OBJECTS:RTDD.${arch}> |
| 36 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 37 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 38 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 39 | target_link_libraries(clang_rt.dyndd-${arch} ${DD_LINKLIBS}) |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 40 | add_dependencies(dd clang_rt.dyndd-${arch}) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 41 | endif() |
| 42 | |
| 43 | add_dependencies(compiler-rt dd) |