Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / lib / lsan / CMakeLists.txt
blob8e9861cd6b7c0946aca4f21bf2f1ef06833d7d9c
1 include_directories(..)
3 set(LSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
4 append_rtti_flag(OFF LSAN_CFLAGS)
6 # Too many existing bugs, needs cleanup.
7 append_list_if(COMPILER_RT_HAS_WNO_FORMAT -Wno-format LSAN_CFLAGS)
9 set(LSAN_COMMON_SOURCES
10   lsan_common.cpp
11   lsan_common_fuchsia.cpp
12   lsan_common_linux.cpp
13   lsan_common_mac.cpp
14   )
16 set(LSAN_SOURCES
17   lsan.cpp
18   lsan_allocator.cpp
19   lsan_fuchsia.cpp
20   lsan_interceptors.cpp
21   lsan_linux.cpp
22   lsan_mac.cpp
23   lsan_malloc_mac.cpp
24   lsan_posix.cpp
25   lsan_preinit.cpp
26   lsan_thread.cpp
27   )
29 set(LSAN_HEADERS
30   lsan.h
31   lsan_allocator.h
32   lsan_common.h
33   lsan_flags.inc
34   lsan_thread.h
35   )
37 set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
39 add_compiler_rt_object_libraries(RTLSanCommon
40     OS ${SANITIZER_COMMON_SUPPORTED_OS}
41     ARCHS ${LSAN_COMMON_SUPPORTED_ARCH}
42     SOURCES ${LSAN_COMMON_SOURCES}
43     ADDITIONAL_HEADERS ${LSAN_HEADERS}
44     CFLAGS ${LSAN_CFLAGS})
46 if(COMPILER_RT_HAS_LSAN)
47   add_compiler_rt_component(lsan)
48   if(APPLE)
49     set(LSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
51     add_weak_symbols("lsan" WEAK_SYMBOL_LINK_FLAGS)
52     add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
54     add_compiler_rt_runtime(clang_rt.lsan
55       SHARED
56       OS ${LSAN_SUPPORTED_OS}
57       ARCHS ${LSAN_SUPPORTED_ARCH}
58       SOURCES ${LSAN_SOURCES}
59       ADDITIONAL_HEADERS ${LSAN_HEADERS}
60       OBJECT_LIBS RTLSanCommon
61                   RTInterception
62                   RTSanitizerCommon
63                   RTSanitizerCommonLibc
64                   RTSanitizerCommonCoverage
65                   RTSanitizerCommonSymbolizer
66       CFLAGS ${LSAN_CFLAGS}
67       LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
68       LINK_LIBS ${LSAN_LINK_LIBS}
69       PARENT_TARGET lsan)
70   else()
71     foreach(arch ${LSAN_SUPPORTED_ARCH})
72       add_compiler_rt_runtime(clang_rt.lsan
73         STATIC
74         ARCHS ${arch}
75         SOURCES ${LSAN_SOURCES}
76                 $<TARGET_OBJECTS:RTInterception.${arch}>
77                 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
78                 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
79                 $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
80                 $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
81                 $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>
82                 $<TARGET_OBJECTS:RTLSanCommon.${arch}>
83         ADDITIONAL_HEADERS ${LSAN_HEADERS}
84         CFLAGS ${LSAN_CFLAGS}
85         PARENT_TARGET lsan)
86     endforeach()
87   endif()
88 endif()