1include_directories(..) 2 3# Runtime library sources and build flags. 4set(MSAN_RTL_SOURCES 5 msan.cc 6 msan_allocator.cc 7 msan_chained_origin_depot.cc 8 msan_interceptors.cc 9 msan_linux.cc 10 msan_new_delete.cc 11 msan_report.cc 12 msan_thread.cc 13 ) 14 15set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS}) 16append_no_rtti_flag(MSAN_RTL_CFLAGS) 17append_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS) 18# Prevent clang from generating libc calls. 19append_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS) 20 21set(MSAN_RUNTIME_LIBRARIES) 22 23# Static runtime library. 24add_custom_target(msan) 25set(arch "x86_64") 26if(CAN_TARGET_${arch}) 27 add_compiler_rt_runtime(clang_rt.msan-${arch} ${arch} STATIC 28 SOURCES ${MSAN_RTL_SOURCES} 29 $<TARGET_OBJECTS:RTInterception.${arch}> 30 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> 31 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> 32 CFLAGS ${MSAN_RTL_CFLAGS}) 33 add_dependencies(msan clang_rt.msan-${arch}) 34 list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}) 35 if(UNIX) 36 add_sanitizer_rt_symbols(clang_rt.msan-${arch} msan.syms.extra) 37 add_dependencies(msan clang_rt.msan-${arch}-symbols) 38 endif() 39endif() 40 41add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt) 42add_dependencies(msan msan_blacklist) 43add_dependencies(compiler-rt msan) 44 45if(COMPILER_RT_INCLUDE_TESTS) 46 add_subdirectory(tests) 47endif() 48