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") |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 22 | add_compiler_rt_runtime(clang_rt.dd |
| 23 | STATIC |
| 24 | ARCHS ${arch} |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 25 | SOURCES ${DD_SOURCES} |
| 26 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 27 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 28 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 29 | CFLAGS ${DD_CFLAGS} |
| 30 | PARENT_TARGET dd) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 31 | |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 32 | add_compiler_rt_object_libraries(RTDD |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 33 | ARCHS ${arch} |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 34 | SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS}) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 35 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 36 | add_compiler_rt_runtime(clang_rt.dyndd |
| 37 | SHARED |
| 38 | ARCHS ${arch} |
Stephen Hines | 6a211c5 | 2014-07-21 00:49:56 -0700 | [diff] [blame] | 39 | SOURCES $<TARGET_OBJECTS:RTDD.${arch}> |
| 40 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 41 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 42 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
| 43 | LINK_LIBS ${DD_LINKLIBS} |
| 44 | PARENT_TARGET dd) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 45 | endif() |
| 46 | |
| 47 | add_dependencies(compiler-rt dd) |