• 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_rtti_flag(OFF 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)
29set_target_properties(msan PROPERTIES FOLDER "Compiler-RT Misc")
30
31foreach(arch ${MSAN_SUPPORTED_ARCH})
32  add_compiler_rt_runtime(clang_rt.msan
33    STATIC
34    ARCHS ${arch}
35    SOURCES ${MSAN_RTL_SOURCES}
36            $<TARGET_OBJECTS:RTInterception.${arch}>
37            $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
38            $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
39            $<TARGET_OBJECTS:RTUbsan.${arch}>
40    CFLAGS ${MSAN_RTL_CFLAGS}
41    PARENT_TARGET msan)
42  add_compiler_rt_runtime(clang_rt.msan_cxx
43    STATIC
44    ARCHS ${arch}
45    SOURCES ${MSAN_RTL_CXX_SOURCES}
46            $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
47    CFLAGS ${MSAN_RTL_CFLAGS}
48    PARENT_TARGET msan)
49  list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
50                                     clang_rt.msan_cxx-${arch})
51  if(UNIX)
52    add_sanitizer_rt_symbols(clang_rt.msan
53      ARCHS ${arch}
54      EXTRA msan.syms.extra)
55    add_sanitizer_rt_symbols(clang_rt.msan_cxx
56      ARCHS ${arch}
57      EXTRA msan.syms.extra)
58    add_dependencies(msan clang_rt.msan-${arch}-symbols
59                          clang_rt.msan_cxx-${arch}-symbols)
60  endif()
61endforeach()
62
63add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt msan)
64add_dependencies(compiler-rt msan)
65
66if(COMPILER_RT_INCLUDE_TESTS)
67  add_subdirectory(tests)
68endif()
69