2013-08-08 06:47:26 +08:00
|
|
|
include_directories(..)
|
|
|
|
|
|
|
|
# Runtime library sources and build flags.
|
|
|
|
set(DFSAN_RTL_SOURCES
|
2013-08-16 05:18:53 +08:00
|
|
|
dfsan.cc
|
|
|
|
dfsan_custom.cc
|
|
|
|
dfsan_interceptors.cc)
|
2014-02-18 16:07:09 +08:00
|
|
|
set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
|
|
|
# Prevent clang from generating libc calls.
|
2014-10-16 06:47:54 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS)
|
2013-08-08 06:47:26 +08:00
|
|
|
|
|
|
|
# Static runtime library.
|
2014-02-14 20:05:41 +08:00
|
|
|
add_custom_target(dfsan)
|
2013-08-08 06:47:26 +08:00
|
|
|
set(arch "x86_64")
|
|
|
|
if(CAN_TARGET_${arch})
|
2014-02-18 16:07:09 +08:00
|
|
|
set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS})
|
2014-10-16 06:47:54 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS)
|
2014-03-31 21:45:36 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.dfsan-${arch} ${arch} STATIC
|
2013-08-08 06:47:26 +08:00
|
|
|
SOURCES ${DFSAN_RTL_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
|
2014-02-18 16:07:09 +08:00
|
|
|
CFLAGS ${DFSAN_CFLAGS})
|
|
|
|
set(DFSAN_NOLIBC_CFLAGS ${DFSAN_COMMON_CFLAGS} -DDFSAN_NOLIBC)
|
2014-03-31 21:45:36 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.dfsan-libc-${arch} ${arch} STATIC
|
2013-08-08 06:47:26 +08:00
|
|
|
SOURCES ${DFSAN_RTL_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
2014-02-18 16:07:09 +08:00
|
|
|
CFLAGS ${DFSAN_NOLIBC_CFLAGS})
|
2013-08-30 06:49:00 +08:00
|
|
|
add_sanitizer_rt_symbols(clang_rt.dfsan-${arch} dfsan.syms.extra)
|
2014-02-14 20:05:41 +08:00
|
|
|
add_dependencies(dfsan
|
|
|
|
clang_rt.dfsan-${arch}
|
|
|
|
clang_rt.dfsan-${arch}-symbols)
|
2013-08-08 06:47:26 +08:00
|
|
|
endif()
|
|
|
|
|
2014-02-18 22:28:53 +08:00
|
|
|
set(dfsan_abilist_filename ${COMPILER_RT_OUTPUT_DIR}/dfsan_abilist.txt)
|
2013-08-15 02:54:06 +08:00
|
|
|
add_custom_target(dfsan_abilist ALL
|
2014-05-01 07:31:45 +08:00
|
|
|
DEPENDS ${dfsan_abilist_filename})
|
2014-02-18 22:28:53 +08:00
|
|
|
add_custom_command(OUTPUT ${dfsan_abilist_filename}
|
2013-08-15 02:54:06 +08:00
|
|
|
VERBATIM
|
|
|
|
COMMAND
|
|
|
|
cat ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt
|
2014-11-06 01:21:06 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1404_abilist.txt
|
2014-02-18 22:28:53 +08:00
|
|
|
> ${dfsan_abilist_filename}
|
2014-11-06 01:21:06 +08:00
|
|
|
DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
|
2014-02-14 20:05:41 +08:00
|
|
|
add_dependencies(dfsan dfsan_abilist)
|
2014-02-18 22:28:53 +08:00
|
|
|
install(FILES ${dfsan_abilist_filename}
|
|
|
|
DESTINATION ${COMPILER_RT_INSTALL_PATH})
|
2014-02-18 17:33:45 +08:00
|
|
|
|
|
|
|
add_dependencies(compiler-rt dfsan)
|