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)
|
2013-08-08 06:47:26 +08:00
|
|
|
set(DFSAN_RTL_CFLAGS
|
|
|
|
${SANITIZER_COMMON_CFLAGS}
|
|
|
|
# Prevent clang from generating libc calls.
|
|
|
|
-ffreestanding)
|
|
|
|
|
|
|
|
# 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})
|
|
|
|
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}>
|
|
|
|
CFLAGS ${DFSAN_RTL_CFLAGS} -fPIE)
|
|
|
|
add_compiler_rt_static_runtime(clang_rt.dfsan-libc-${arch} ${arch}
|
|
|
|
SOURCES ${DFSAN_RTL_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
|
|
|
CFLAGS ${DFSAN_RTL_CFLAGS} -fPIC -DDFSAN_NOLIBC)
|
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})
|