Peter Collingbourne | eee71ae | 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 | 6e4c46d | 2013-08-15 21:18:53 +0000 | [diff] [blame] | 5 | dfsan.cc |
| 6 | dfsan_custom.cc |
| 7 | dfsan_interceptors.cc) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 8 | set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS}) |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 9 | append_no_rtti_flag(DFSAN_COMMON_CFLAGS) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 10 | # Prevent clang from generating libc calls. |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 11 | append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS) |
Peter Collingbourne | eee71ae | 2013-08-07 22:47:26 +0000 | [diff] [blame] | 12 | |
| 13 | # Static runtime library. |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 14 | add_custom_target(dfsan) |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 15 | foreach(arch ${DFSAN_SUPPORTED_ARCH}) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 16 | set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS}) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 17 | append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS) |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 18 | add_compiler_rt_runtime(clang_rt.dfsan |
| 19 | STATIC |
| 20 | ARCHS ${arch} |
Peter Collingbourne | eee71ae | 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}> |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 25 | CFLAGS ${DFSAN_CFLAGS} |
| 26 | PARENT_TARGET dfsan) |
| 27 | add_sanitizer_rt_symbols(clang_rt.dfsan |
| 28 | ARCHS ${arch} |
| 29 | EXTRA dfsan.syms.extra) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 30 | add_dependencies(dfsan |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 31 | clang_rt.dfsan-${arch}-symbols) |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 32 | endforeach() |
Peter Collingbourne | eee71ae | 2013-08-07 22:47:26 +0000 | [diff] [blame] | 33 | |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 34 | set(dfsan_abilist_filename ${COMPILER_RT_OUTPUT_DIR}/dfsan_abilist.txt) |
Peter Collingbourne | e8d2034 | 2013-08-14 18:54:06 +0000 | [diff] [blame] | 35 | add_custom_target(dfsan_abilist ALL |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 36 | DEPENDS ${dfsan_abilist_filename}) |
| 37 | add_custom_command(OUTPUT ${dfsan_abilist_filename} |
Peter Collingbourne | e8d2034 | 2013-08-14 18:54:06 +0000 | [diff] [blame] | 38 | VERBATIM |
| 39 | COMMAND |
| 40 | cat ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 41 | ${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1404_abilist.txt |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 42 | > ${dfsan_abilist_filename} |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 43 | DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 44 | add_dependencies(dfsan dfsan_abilist) |
| 45 | install(FILES ${dfsan_abilist_filename} |
| 46 | DESTINATION ${COMPILER_RT_INSTALL_PATH}) |
Peter Collingbourne | e8d2034 | 2013-08-14 18:54:06 +0000 | [diff] [blame] | 47 | |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 48 | add_dependencies(compiler-rt dfsan) |