1 include_directories(..) 2 3 # Runtime library sources and build flags. 4 set(DFSAN_RTL_SOURCES 5 dfsan.cc 6 dfsan_custom.cc 7 dfsan_interceptors.cc) 8 set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS}) 9 append_no_rtti_flag(DFSAN_COMMON_CFLAGS) 10 # Prevent clang from generating libc calls. 11 append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS) 12 13 # Static runtime library. 14 add_custom_target(dfsan) 15 foreach(arch ${DFSAN_SUPPORTED_ARCH}) 16 set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS}) 17 append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS) 18 add_compiler_rt_runtime(clang_rt.dfsan 19 STATIC 20 ARCHS ${arch} 21 SOURCES ${DFSAN_RTL_SOURCES} 22 $<TARGET_OBJECTS:RTInterception.${arch}> 23 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> 24 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> 25 CFLAGS ${DFSAN_CFLAGS} 26 PARENT_TARGET dfsan) 27 add_sanitizer_rt_symbols(clang_rt.dfsan 28 ARCHS ${arch} 29 EXTRA dfsan.syms.extra) 30 add_dependencies(dfsan 31 clang_rt.dfsan-${arch}-symbols) 32 endforeach() 33 34 set(dfsan_abilist_filename ${COMPILER_RT_OUTPUT_DIR}/dfsan_abilist.txt) 35 add_custom_target(dfsan_abilist ALL 36 DEPENDS ${dfsan_abilist_filename}) 37 add_custom_command(OUTPUT ${dfsan_abilist_filename} 38 VERBATIM 39 COMMAND 40 cat ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt 41 ${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1404_abilist.txt 42 > ${dfsan_abilist_filename} 43 DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt) 44 add_dependencies(dfsan dfsan_abilist) 45 install(FILES ${dfsan_abilist_filename} 46 DESTINATION ${COMPILER_RT_INSTALL_PATH}) 47 48 add_dependencies(compiler-rt dfsan) 49