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.
|
|
|
|
append_if(DFSAN_COMMON_CFLAGS COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding)
|
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})
|
|
|
|
append_if(DFSAN_CFLAGS COMPILER_RT_HAS_FPIE_FLAG -fPIE)
|
2013-08-08 06:47:26 +08:00
|
|
|
add_compiler_rt_static_runtime(clang_rt.dfsan-${arch} ${arch}
|
|
|
|
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)
|
2013-08-08 06:47:26 +08:00
|
|
|
add_compiler_rt_static_runtime(clang_rt.dfsan-libc-${arch} ${arch}
|
|
|
|
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()
|
|
|
|
|
2013-08-15 02:54:06 +08:00
|
|
|
add_custom_target(dfsan_abilist ALL
|
|
|
|
SOURCES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt)
|
|
|
|
add_custom_command(OUTPUT ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
|
|
|
|
VERBATIM
|
|
|
|
COMMAND
|
|
|
|
cat ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt
|
2013-08-16 05:18:53 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1204_abilist.txt
|
2013-08-15 02:54:06 +08:00
|
|
|
> ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
|
2013-08-16 05:18:53 +08:00
|
|
|
DEPENDS done_abilist.txt libc_ubuntu1204_abilist.txt)
|
2014-02-14 20:05:41 +08:00
|
|
|
add_dependencies(dfsan dfsan_abilist)
|
2013-08-15 02:54:06 +08:00
|
|
|
install(FILES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
|
|
|
|
DESTINATION ${LIBCLANG_INSTALL_PATH})
|