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 msan_poisoning.cc 14 ) 15 16set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS}) 17append_no_rtti_flag(MSAN_RTL_CFLAGS) 18append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS) 19# Prevent clang from generating libc calls. 20append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS) 21 22set(MSAN_RUNTIME_LIBRARIES) 23 24# Static runtime library. 25add_custom_target(msan) 26foreach(arch ${MSAN_SUPPORTED_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() 39endforeach() 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