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)
|
2015-01-19 16:26:38 +08:00
|
|
|
set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
2016-03-05 18:01:04 +08:00
|
|
|
append_rtti_flag(OFF DFSAN_COMMON_CFLAGS)
|
2014-02-18 16:07:09 +08:00
|
|
|
# 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.
|
2016-08-27 04:52:22 +08:00
|
|
|
add_compiler_rt_component(dfsan)
|
2016-07-12 05:51:56 +08:00
|
|
|
|
2014-12-06 05:22:36 +08:00
|
|
|
foreach(arch ${DFSAN_SUPPORTED_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)
|
2015-08-26 03:53:09 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.dfsan
|
|
|
|
STATIC
|
|
|
|
ARCHS ${arch}
|
2013-08-08 06:47:26 +08:00
|
|
|
SOURCES ${DFSAN_RTL_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
|
2015-08-26 03:53:09 +08:00
|
|
|
CFLAGS ${DFSAN_CFLAGS}
|
|
|
|
PARENT_TARGET dfsan)
|
2015-08-28 04:07:54 +08:00
|
|
|
add_sanitizer_rt_symbols(clang_rt.dfsan
|
|
|
|
ARCHS ${arch}
|
2015-08-27 07:12:25 +08:00
|
|
|
EXTRA dfsan.syms.extra)
|
2014-02-14 20:05:41 +08:00
|
|
|
add_dependencies(dfsan
|
|
|
|
clang_rt.dfsan-${arch}-symbols)
|
2014-12-06 05:22:36 +08:00
|
|
|
endforeach()
|
2013-08-08 06:47:26 +08:00
|
|
|
|
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})
|