1 include_directories(..)
3 # Runtime library sources and build flags.
7 msan_chained_origin_depot.cpp
16 set(MSAN_RTL_CXX_SOURCES
23 msan_chained_origin_depot.h
27 msan_interface_internal.h
34 set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
35 if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
36 append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC -ftls-model=initial-exec MSAN_RTL_CFLAGS)
38 append_rtti_flag(OFF MSAN_RTL_CFLAGS)
39 if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
40 append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS)
42 # Prevent clang from generating libc calls.
43 append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
45 set(MSAN_RUNTIME_LIBRARIES)
47 # Static runtime library.
48 add_compiler_rt_component(msan)
50 foreach(arch ${MSAN_SUPPORTED_ARCH})
51 add_compiler_rt_runtime(clang_rt.msan
54 SOURCES ${MSAN_RTL_SOURCES}
55 $<TARGET_OBJECTS:RTInterception.${arch}>
56 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
57 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
58 $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
59 $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
60 $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>
61 $<TARGET_OBJECTS:RTUbsan.${arch}>
62 ADDITIONAL_HEADERS ${MSAN_RTL_HEADERS}
63 CFLAGS ${MSAN_RTL_CFLAGS}
65 add_compiler_rt_runtime(clang_rt.msan_cxx
68 SOURCES ${MSAN_RTL_CXX_SOURCES}
69 $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
70 ADDITIONAL_HEADERS ${MSAN_RTL_HEADERS}
71 CFLAGS ${MSAN_RTL_CFLAGS}
73 list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
74 clang_rt.msan_cxx-${arch})
75 if(SANITIZER_USE_SYMBOLS)
76 add_sanitizer_rt_symbols(clang_rt.msan
78 EXTRA msan.syms.extra)
79 add_sanitizer_rt_symbols(clang_rt.msan_cxx
81 EXTRA msan.syms.extra)
82 add_dependencies(msan clang_rt.msan-${arch}-symbols
83 clang_rt.msan_cxx-${arch}-symbols)
87 add_compiler_rt_resource_file(msan_ignorelist msan_ignorelist.txt msan)
88 list(APPEND MSAN_RUNTIME_LIBRARIES msan_ignorelist)
90 if(COMPILER_RT_INCLUDE_TESTS)
91 add_subdirectory(tests)