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