Home | History | Annotate | Download | only in dd
      1 # Build for the experimental deadlock detector runtime library.
      2 
      3 include_directories(../..)
      4 
      5 set(DD_CFLAGS ${SANITIZER_COMMON_CFLAGS})
      6 append_rtti_flag(OFF DD_CFLAGS)
      7 
      8 set(DD_SOURCES
      9   dd_rtl.cc
     10   dd_interceptors.cc
     11 )
     12 
     13 set(DD_LINKLIBS)
     14 append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS)
     15 append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS)
     16 append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS)
     17 
     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
     23     STATIC
     24     ARCHS ${arch}
     25     SOURCES ${DD_SOURCES}
     26             $<TARGET_OBJECTS:RTInterception.${arch}>
     27             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
     28             $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
     29     CFLAGS ${DD_CFLAGS}
     30     PARENT_TARGET dd)
     31 
     32   add_compiler_rt_object_libraries(RTDD
     33     ARCHS ${arch}
     34     SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS})
     35 
     36   add_compiler_rt_runtime(clang_rt.dyndd
     37     SHARED
     38     ARCHS ${arch}
     39     SOURCES $<TARGET_OBJECTS:RTDD.${arch}>
     40             $<TARGET_OBJECTS:RTInterception.${arch}>
     41             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
     42             $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
     43     LINK_LIBS ${DD_LINKLIBS}
     44     PARENT_TARGET dd)
     45 endif()
     46 
     47 add_dependencies(compiler-rt dd)
     48