Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / lib / msan / CMakeLists.txt
blobb9976b258deb23cdd53b9aac24a3b90943457450
1 include_directories(..)
3 # Runtime library sources and build flags.
4 set(MSAN_RTL_SOURCES
5   msan.cpp
6   msan_allocator.cpp
7   msan_chained_origin_depot.cpp
8   msan_dl.cpp
9   msan_interceptors.cpp
10   msan_linux.cpp
11   msan_report.cpp
12   msan_thread.cpp
13   msan_poisoning.cpp
14   )
16 set(MSAN_RTL_CXX_SOURCES
17   msan_new_delete.cpp
18   )
20 set(MSAN_RTL_HEADERS
21   msan.h
22   msan_allocator.h
23   msan_chained_origin_depot.h
24   msan_dl.h
25   msan_flags.h
26   msan_flags.inc
27   msan_interface_internal.h
28   msan_origin.h
29   msan_poisoning.h
30   msan_report.h
31   msan_thread.h
32   )
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)
37 endif()
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)
41 endif()
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
52     STATIC
53     ARCHS ${arch}
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}
64     PARENT_TARGET msan)
65   add_compiler_rt_runtime(clang_rt.msan_cxx
66     STATIC
67     ARCHS ${arch}
68     SOURCES ${MSAN_RTL_CXX_SOURCES}
69             $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
70     ADDITIONAL_HEADERS ${MSAN_RTL_HEADERS}
71     CFLAGS ${MSAN_RTL_CFLAGS}
72     PARENT_TARGET msan)
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
77       ARCHS ${arch}
78       EXTRA msan.syms.extra)
79     add_sanitizer_rt_symbols(clang_rt.msan_cxx
80       ARCHS ${arch}
81       EXTRA msan.syms.extra)
82     add_dependencies(msan clang_rt.msan-${arch}-symbols
83                           clang_rt.msan_cxx-${arch}-symbols)
84   endif()
85 endforeach()
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)
92 endif()