• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1include_directories(..)
2
3set(LSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
4append_rtti_flag(OFF LSAN_CFLAGS)
5
6set(LSAN_COMMON_SOURCES
7  lsan_common.cc
8  lsan_common_linux.cc)
9
10set(LSAN_SOURCES
11  lsan.cc
12  lsan_allocator.cc
13  lsan_interceptors.cc
14  lsan_preinit.cc
15  lsan_thread.cc)
16
17set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
18
19add_custom_target(lsan)
20set_target_properties(lsan PROPERTIES FOLDER "Compiler-RT Misc")
21
22add_compiler_rt_object_libraries(RTLSanCommon
23    OS ${SANITIZER_COMMON_SUPPORTED_OS}
24    ARCHS ${LSAN_COMMON_SUPPORTED_ARCH}
25    SOURCES ${LSAN_COMMON_SOURCES}
26    CFLAGS ${LSAN_CFLAGS})
27
28if(COMPILER_RT_HAS_LSAN)
29  foreach(arch ${LSAN_SUPPORTED_ARCH})
30    add_compiler_rt_runtime(clang_rt.lsan
31      STATIC
32      ARCHS ${arch}
33      SOURCES ${LSAN_SOURCES}
34              $<TARGET_OBJECTS:RTInterception.${arch}>
35              $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
36              $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
37              $<TARGET_OBJECTS:RTLSanCommon.${arch}>
38      CFLAGS ${LSAN_CFLAGS}
39      PARENT_TARGET lsan)
40  endforeach()
41endif()
42
43add_dependencies(compiler-rt lsan)
44