Home | History | Annotate | Download | only in msan
      1 include_directories(..)
      2 
      3 # Runtime library sources and build flags.
      4 set(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 
     15 set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
     16 append_no_rtti_flag(MSAN_RTL_CFLAGS)
     17 append_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS)
     18 # Prevent clang from generating libc calls.
     19 append_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
     20 
     21 set(MSAN_RUNTIME_LIBRARIES)
     22 
     23 # Static runtime library.
     24 add_custom_target(msan)
     25 set(arch "x86_64")
     26 if(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()
     39 endif()
     40 
     41 add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt)
     42 add_dependencies(msan msan_blacklist)
     43 add_dependencies(compiler-rt msan)
     44 
     45 if(COMPILER_RT_INCLUDE_TESTS)
     46   add_subdirectory(tests)
     47 endif()
     48