2013-05-20 19:13:33 +08:00
|
|
|
include_directories(..)
|
|
|
|
|
|
|
|
set(LSAN_CFLAGS
|
2013-08-22 21:23:22 +08:00
|
|
|
${SANITIZER_COMMON_CFLAGS}
|
|
|
|
-fno-rtti)
|
2013-05-20 19:13:33 +08:00
|
|
|
|
2013-05-21 22:12:11 +08:00
|
|
|
set(LSAN_COMMON_SOURCES
|
|
|
|
lsan_common.cc
|
|
|
|
lsan_common_linux.cc)
|
|
|
|
|
2013-05-20 19:13:33 +08:00
|
|
|
set(LSAN_SOURCES
|
2013-11-25 22:25:36 +08:00
|
|
|
lsan.cc
|
2013-05-20 19:13:33 +08:00
|
|
|
lsan_allocator.cc
|
2013-11-25 22:25:36 +08:00
|
|
|
lsan_interceptors.cc
|
|
|
|
lsan_preinit.cc
|
|
|
|
lsan_thread.cc)
|
2013-05-20 19:13:33 +08:00
|
|
|
|
|
|
|
set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
2013-05-21 22:12:11 +08:00
|
|
|
# The common files need to build on every arch supported by ASan.
|
|
|
|
# (Even if they build into dummy object files.)
|
|
|
|
filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH
|
2014-01-31 22:25:58 +08:00
|
|
|
x86_64 i386 powerpc64 arm)
|
2013-05-21 22:12:11 +08:00
|
|
|
|
2014-02-14 20:26:05 +08:00
|
|
|
add_custom_target(lsan)
|
2013-05-20 22:16:45 +08:00
|
|
|
|
2013-06-23 00:33:52 +08:00
|
|
|
if(APPLE)
|
2013-11-07 18:08:19 +08:00
|
|
|
foreach(os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS})
|
|
|
|
add_compiler_rt_darwin_object_library(RTLSanCommon ${os}
|
|
|
|
ARCH ${LSAN_COMMON_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${LSAN_COMMON_SOURCES}
|
|
|
|
CFLAGS ${LSAN_CFLAGS})
|
|
|
|
endforeach()
|
2013-06-23 00:33:52 +08:00
|
|
|
elseif(NOT ANDROID)
|
2013-05-21 22:12:11 +08:00
|
|
|
foreach(arch ${LSAN_COMMON_SUPPORTED_ARCH})
|
|
|
|
add_compiler_rt_object_library(RTLSanCommon ${arch}
|
|
|
|
SOURCES ${LSAN_COMMON_SOURCES}
|
|
|
|
CFLAGS ${LSAN_CFLAGS})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(arch ${LSAN_SUPPORTED_ARCH})
|
|
|
|
add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch}
|
|
|
|
SOURCES ${LSAN_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTLSanCommon.${arch}>
|
|
|
|
CFLAGS ${LSAN_CFLAGS})
|
2014-02-14 20:26:05 +08:00
|
|
|
add_dependencies(lsan clang_rt.lsan-${arch})
|
2013-05-21 22:12:11 +08:00
|
|
|
endforeach()
|
2013-05-20 22:16:45 +08:00
|
|
|
endif()
|