Peter Collingbourne | 5cbab07 | 2013-08-07 22:47:26 +0000 | [diff] [blame] | 1 | include_directories(..) |
| 2 | |
| 3 | # Runtime library sources and build flags. |
| 4 | set(DFSAN_RTL_SOURCES |
Peter Collingbourne | 12b0809 | 2013-08-15 21:18:53 +0000 | [diff] [blame] | 5 | dfsan.cc |
| 6 | dfsan_custom.cc |
| 7 | dfsan_interceptors.cc) |
Evgeniy Stepanov | 0540f41 | 2015-01-19 08:26:38 +0000 | [diff] [blame] | 8 | set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS}) |
| 9 | append_no_rtti_flag(DFSAN_COMMON_CFLAGS) |
Alexey Samsonov | 878a9a5 | 2014-02-18 08:07:09 +0000 | [diff] [blame] | 10 | # Prevent clang from generating libc calls. |
Kuba Brecka | 14c0c59 | 2014-10-15 22:47:54 +0000 | [diff] [blame] | 11 | append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS) |
Peter Collingbourne | 5cbab07 | 2013-08-07 22:47:26 +0000 | [diff] [blame] | 12 | |
| 13 | # Static runtime library. |
Alexey Samsonov | f6cf6ab | 2014-02-14 12:05:41 +0000 | [diff] [blame] | 14 | add_custom_target(dfsan) |
Peter Collingbourne | fd860bc | 2014-12-05 21:22:36 +0000 | [diff] [blame] | 15 | foreach(arch ${DFSAN_SUPPORTED_ARCH}) |
Alexey Samsonov | 878a9a5 | 2014-02-18 08:07:09 +0000 | [diff] [blame] | 16 | set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS}) |
Kuba Brecka | 14c0c59 | 2014-10-15 22:47:54 +0000 | [diff] [blame] | 17 | append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS) |
Chris Bieneman | d160260 | 2015-08-25 19:53:09 +0000 | [diff] [blame] | 18 | add_compiler_rt_runtime(clang_rt.dfsan |
| 19 | STATIC |
| 20 | ARCHS ${arch} |
Peter Collingbourne | 5cbab07 | 2013-08-07 22:47:26 +0000 | [diff] [blame] | 21 | SOURCES ${DFSAN_RTL_SOURCES} |
| 22 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 23 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 24 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
Chris Bieneman | d160260 | 2015-08-25 19:53:09 +0000 | [diff] [blame] | 25 | CFLAGS ${DFSAN_CFLAGS} |
| 26 | PARENT_TARGET dfsan) |
Chris Bieneman | f12cf13 | 2015-08-27 20:07:54 +0000 | [diff] [blame] | 27 | add_sanitizer_rt_symbols(clang_rt.dfsan |
| 28 | ARCHS ${arch} |
Chris Bieneman | bfc74bd | 2015-08-26 23:12:25 +0000 | [diff] [blame] | 29 | EXTRA dfsan.syms.extra) |
Alexey Samsonov | f6cf6ab | 2014-02-14 12:05:41 +0000 | [diff] [blame] | 30 | add_dependencies(dfsan |
Alexey Samsonov | f6cf6ab | 2014-02-14 12:05:41 +0000 | [diff] [blame] | 31 | clang_rt.dfsan-${arch}-symbols) |
Peter Collingbourne | fd860bc | 2014-12-05 21:22:36 +0000 | [diff] [blame] | 32 | endforeach() |
Peter Collingbourne | 5cbab07 | 2013-08-07 22:47:26 +0000 | [diff] [blame] | 33 | |
Alexey Samsonov | 1181a10 | 2014-02-18 14:28:53 +0000 | [diff] [blame] | 34 | set(dfsan_abilist_filename ${COMPILER_RT_OUTPUT_DIR}/dfsan_abilist.txt) |
Peter Collingbourne | 0e51eda | 2013-08-14 18:54:06 +0000 | [diff] [blame] | 35 | add_custom_target(dfsan_abilist ALL |
Chandler Carruth | c42ddde | 2014-04-30 23:31:45 +0000 | [diff] [blame] | 36 | DEPENDS ${dfsan_abilist_filename}) |
Alexey Samsonov | 1181a10 | 2014-02-18 14:28:53 +0000 | [diff] [blame] | 37 | add_custom_command(OUTPUT ${dfsan_abilist_filename} |
Peter Collingbourne | 0e51eda | 2013-08-14 18:54:06 +0000 | [diff] [blame] | 38 | VERBATIM |
| 39 | COMMAND |
| 40 | cat ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt |
Peter Collingbourne | 113ff7f | 2014-11-05 17:21:06 +0000 | [diff] [blame] | 41 | ${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1404_abilist.txt |
Alexey Samsonov | 1181a10 | 2014-02-18 14:28:53 +0000 | [diff] [blame] | 42 | > ${dfsan_abilist_filename} |
Peter Collingbourne | 113ff7f | 2014-11-05 17:21:06 +0000 | [diff] [blame] | 43 | DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt) |
Alexey Samsonov | f6cf6ab | 2014-02-14 12:05:41 +0000 | [diff] [blame] | 44 | add_dependencies(dfsan dfsan_abilist) |
Alexey Samsonov | 1181a10 | 2014-02-18 14:28:53 +0000 | [diff] [blame] | 45 | install(FILES ${dfsan_abilist_filename} |
| 46 | DESTINATION ${COMPILER_RT_INSTALL_PATH}) |
Alexey Samsonov | 63a4af7 | 2014-02-18 09:33:45 +0000 | [diff] [blame] | 47 | |
| 48 | add_dependencies(compiler-rt dfsan) |