1# Build for the experimental deadlock detector runtime library. 2 3include_directories(../..) 4 5set(DD_CFLAGS ${SANITIZER_COMMON_CFLAGS}) 6append_no_rtti_flag(DD_CFLAGS) 7 8set(DD_SOURCES 9 dd_rtl.cc 10 dd_interceptors.cc 11) 12 13set(DD_LINKLIBS) 14append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS) 15append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS) 16 17add_custom_target(dd) 18# Deadlock detector is currently supported on 64-bit Linux only. 19if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID) 20 set(arch "x86_64") 21 add_compiler_rt_runtime(clang_rt.dd-${arch} ${arch} STATIC 22 SOURCES ${DD_SOURCES} 23 $<TARGET_OBJECTS:RTInterception.${arch}> 24 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> 25 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> 26 CFLAGS ${DD_CFLAGS}) 27 add_dependencies(dd clang_rt.dd-${arch}) 28 29 add_compiler_rt_object_library(RTDD ${arch} 30 SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS}) 31 32 add_compiler_rt_runtime(clang_rt.dyndd-${arch} ${arch} SHARED 33 SOURCES $<TARGET_OBJECTS:RTDD.${arch}> 34 $<TARGET_OBJECTS:RTInterception.${arch}> 35 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> 36 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>) 37 target_link_libraries(clang_rt.dyndd-${arch} ${DD_LINKLIBS}) 38 add_dependencies(dd clang_rt.dyndd-${arch}) 39endif() 40 41add_dependencies(compiler-rt dd) 42