Evgeniy Stepanov | 0231c50 | 2012-12-25 12:39:56 +0000 | [diff] [blame] | 1 | include_directories(..) |
Evgeniy Stepanov | 78c56c3 | 2012-12-11 12:27:27 +0000 | [diff] [blame] | 2 | |
Evgeniy Stepanov | 0231c50 | 2012-12-25 12:39:56 +0000 | [diff] [blame] | 3 | # Runtime library sources and build flags. |
| 4 | set(MSAN_RTL_SOURCES |
Evgeniy Stepanov | 78c56c3 | 2012-12-11 12:27:27 +0000 | [diff] [blame] | 5 | msan.cc |
| 6 | msan_allocator.cc |
| 7 | msan_interceptors.cc |
| 8 | msan_linux.cc |
| 9 | msan_new_delete.cc |
Evgeniy Stepanov | db010da | 2012-12-26 09:32:05 +0000 | [diff] [blame] | 10 | msan_report.cc |
Evgeniy Stepanov | 78c56c3 | 2012-12-11 12:27:27 +0000 | [diff] [blame] | 11 | ) |
Evgeniy Stepanov | 0231c50 | 2012-12-25 12:39:56 +0000 | [diff] [blame] | 12 | set(MSAN_RTL_CFLAGS |
Evgeniy Stepanov | 78c56c3 | 2012-12-11 12:27:27 +0000 | [diff] [blame] | 13 | ${SANITIZER_COMMON_CFLAGS} |
Alexey Samsonov | a7e5db9 | 2013-03-13 09:18:30 +0000 | [diff] [blame] | 14 | -fno-rtti |
Evgeniy Stepanov | 78c56c3 | 2012-12-11 12:27:27 +0000 | [diff] [blame] | 15 | -fPIE |
Evgeniy Stepanov | 0231c50 | 2012-12-25 12:39:56 +0000 | [diff] [blame] | 16 | # Prevent clang from generating libc calls. |
| 17 | -ffreestanding) |
Evgeniy Stepanov | 78c56c3 | 2012-12-11 12:27:27 +0000 | [diff] [blame] | 18 | |
Evgeniy Stepanov | 0231c50 | 2012-12-25 12:39:56 +0000 | [diff] [blame] | 19 | # Static runtime library. |
Evgeniy Stepanov | 78c56c3 | 2012-12-11 12:27:27 +0000 | [diff] [blame] | 20 | set(MSAN_RUNTIME_LIBRARIES) |
Alexey Samsonov | 7eca152 | 2013-01-20 14:14:13 +0000 | [diff] [blame] | 21 | set(arch "x86_64") |
| 22 | if(CAN_TARGET_${arch}) |
| 23 | add_compiler_rt_static_runtime(clang_rt.msan-${arch} ${arch} |
| 24 | SOURCES ${MSAN_RTL_SOURCES} |
| 25 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 26 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
Peter Collingbourne | 0c547de | 2013-05-17 16:17:19 +0000 | [diff] [blame] | 27 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
Richard Smith | a06fe91 | 2013-03-23 00:31:07 +0000 | [diff] [blame] | 28 | CFLAGS ${MSAN_RTL_CFLAGS} |
| 29 | SYMS msan.syms) |
Alexey Samsonov | 7eca152 | 2013-01-20 14:14:13 +0000 | [diff] [blame] | 30 | list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}) |
| 31 | endif() |
Evgeniy Stepanov | 0231c50 | 2012-12-25 12:39:56 +0000 | [diff] [blame] | 32 | |
Alexey Samsonov | 4d1b383 | 2013-05-21 13:55:56 +0000 | [diff] [blame] | 33 | add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt) |
| 34 | |
Alexey Samsonov | 7575e0a | 2013-06-10 09:09:40 +0000 | [diff] [blame] | 35 | # We should only build MSan unit tests if we can build instrumented libcxx. |
| 36 | set(MSAN_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx) |
| 37 | if(EXISTS ${MSAN_LIBCXX_PATH}/) |
| 38 | set(MSAN_CAN_INSTRUMENT_LIBCXX TRUE) |
| 39 | else() |
| 40 | set(MSAN_CAN_INSTRUMENT_LIBCXX FALSE) |
| 41 | endif() |
| 42 | |
Evgeniy Stepanov | 0231c50 | 2012-12-25 12:39:56 +0000 | [diff] [blame] | 43 | if(LLVM_INCLUDE_TESTS) |
| 44 | add_subdirectory(tests) |
| 45 | endif() |
Evgeniy Stepanov | 9af8676 | 2013-02-11 11:34:26 +0000 | [diff] [blame] | 46 | |
| 47 | add_subdirectory(lit_tests) |