1 include_directories(..) 2 3 set(LSAN_CFLAGS 4 ${SANITIZER_COMMON_CFLAGS}) 5 6 set(LSAN_COMMON_SOURCES 7 lsan_common.cc 8 lsan_common_linux.cc) 9 10 set(LSAN_SOURCES 11 lsan_interceptors.cc 12 lsan_allocator.cc 13 lsan_thread.cc 14 lsan.cc) 15 16 set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 17 18 # The common files need to build on every arch supported by ASan. 19 # (Even if they build into dummy object files.) 20 filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH 21 x86_64 i386 powerpc64) 22 23 # Architectures supported by the standalone LSan. 24 filter_available_targets(LSAN_SUPPORTED_ARCH 25 x86_64) 26 27 set(LSAN_RUNTIME_LIBRARIES) 28 29 if(APPLE) 30 add_compiler_rt_osx_object_library(RTLSanCommon 31 ARCH ${LSAN_COMMON_SUPPORTED_ARCH} 32 SOURCES ${LSAN_COMMON_SOURCES} 33 CFLAGS ${LSAN_CFLAGS}) 34 elseif(NOT ANDROID) 35 foreach(arch ${LSAN_COMMON_SUPPORTED_ARCH}) 36 add_compiler_rt_object_library(RTLSanCommon ${arch} 37 SOURCES ${LSAN_COMMON_SOURCES} 38 CFLAGS ${LSAN_CFLAGS}) 39 endforeach() 40 41 foreach(arch ${LSAN_SUPPORTED_ARCH}) 42 add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch} 43 SOURCES ${LSAN_SOURCES} 44 $<TARGET_OBJECTS:RTInterception.${arch}> 45 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> 46 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> 47 $<TARGET_OBJECTS:RTLSanCommon.${arch}> 48 CFLAGS ${LSAN_CFLAGS}) 49 list(APPEND LSAN_RUNTIME_LIBRARIES clang_rt.lsan-${arch}) 50 endforeach() 51 endif() 52 53 if (LLVM_INCLUDE_TESTS) 54 add_subdirectory(tests) 55 endif() 56 add_subdirectory(lit_tests) 57