• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_report.cc
11  msan_thread.cc
12  msan_poisoning.cc
13  )
14
15set(MSAN_RTL_CXX_SOURCES
16  msan_new_delete.cc)
17
18
19set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
20append_no_rtti_flag(MSAN_RTL_CFLAGS)
21append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS)
22# Prevent clang from generating libc calls.
23append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
24
25set(MSAN_RUNTIME_LIBRARIES)
26
27# Static runtime library.
28add_custom_target(msan)
29foreach(arch ${MSAN_SUPPORTED_ARCH})
30  add_compiler_rt_runtime(clang_rt.msan
31    STATIC
32    ARCHS ${arch}
33    SOURCES ${MSAN_RTL_SOURCES}
34            $<TARGET_OBJECTS:RTInterception.${arch}>
35            $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
36            $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
37            $<TARGET_OBJECTS:RTUbsan.${arch}>
38    CFLAGS ${MSAN_RTL_CFLAGS}
39    PARENT_TARGET msan)
40  add_compiler_rt_runtime(clang_rt.msan_cxx
41    STATIC
42    ARCHS ${arch}
43    SOURCES ${MSAN_RTL_CXX_SOURCES}
44            $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
45    CFLAGS ${MSAN_RTL_CFLAGS}
46    PARENT_TARGET msan)
47  list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
48                                     clang_rt.msan_cxx-${arch})
49  if(UNIX)
50    add_sanitizer_rt_symbols(clang_rt.msan
51      ARCHS ${arch}
52      EXTRA msan.syms.extra)
53    add_sanitizer_rt_symbols(clang_rt.msan_cxx
54      ARCHS ${arch}
55      EXTRA msan.syms.extra)
56    add_dependencies(msan clang_rt.msan-${arch}-symbols
57                          clang_rt.msan_cxx-${arch}-symbols)
58  endif()
59endforeach()
60
61add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt)
62add_dependencies(msan msan_blacklist)
63add_dependencies(compiler-rt msan)
64
65if(COMPILER_RT_INCLUDE_TESTS)
66  add_subdirectory(tests)
67endif()
68