2012-06-20 18:18:43 +08:00
|
|
|
# Build system for the common Sanitizer runtime support library components.
|
|
|
|
# These components are shared between AddressSanitizer and ThreadSanitizer.
|
|
|
|
|
|
|
|
set(SANITIZER_SOURCES
|
|
|
|
sanitizer_allocator.cc
|
|
|
|
sanitizer_common.cc
|
2012-07-10 17:17:06 +08:00
|
|
|
sanitizer_flags.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_libc.cc
|
|
|
|
sanitizer_linux.cc
|
|
|
|
sanitizer_mac.cc
|
2013-02-19 17:19:16 +08:00
|
|
|
sanitizer_platform_limits_posix.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_posix.cc
|
|
|
|
sanitizer_printf.cc
|
2012-09-11 18:50:32 +08:00
|
|
|
sanitizer_stackdepot.cc
|
2012-08-28 22:11:57 +08:00
|
|
|
sanitizer_stacktrace.cc
|
2013-03-15 22:37:21 +08:00
|
|
|
sanitizer_stoptheworld_linux.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_symbolizer.cc
|
2012-12-20 13:00:13 +08:00
|
|
|
sanitizer_symbolizer_itanium.cc
|
2012-08-14 21:00:32 +08:00
|
|
|
sanitizer_symbolizer_linux.cc
|
|
|
|
sanitizer_symbolizer_mac.cc
|
|
|
|
sanitizer_symbolizer_win.cc
|
2013-03-14 21:54:30 +08:00
|
|
|
sanitizer_thread_registry.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_win.cc
|
|
|
|
)
|
|
|
|
|
2012-12-21 22:04:52 +08:00
|
|
|
# Explicitly list all sanitizer_common headers. Not all of these are
|
|
|
|
# included in sanitizer_common source files, but we need to depend on
|
|
|
|
# headers when building our custom unit tests.
|
|
|
|
set(SANITIZER_HEADERS
|
|
|
|
sanitizer_allocator.h
|
|
|
|
sanitizer_atomic_clang.h
|
|
|
|
sanitizer_atomic_msvc.h
|
|
|
|
sanitizer_atomic.h
|
|
|
|
sanitizer_common.h
|
2013-01-18 21:01:18 +08:00
|
|
|
sanitizer_common_interceptors.inc
|
|
|
|
sanitizer_common_interceptors_scanf.inc
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_flags.h
|
|
|
|
sanitizer_internal_defs.h
|
2013-01-14 16:23:34 +08:00
|
|
|
sanitizer_lfstack.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_libc.h
|
2013-02-27 19:22:40 +08:00
|
|
|
sanitizer_linux.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_list.h
|
|
|
|
sanitizer_mutex.h
|
|
|
|
sanitizer_placement_new.h
|
|
|
|
sanitizer_platform_interceptors.h
|
|
|
|
sanitizer_procmaps.h
|
2013-01-11 16:07:43 +08:00
|
|
|
sanitizer_quarantine.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_report_decorator.h
|
|
|
|
sanitizer_stackdepot.h
|
|
|
|
sanitizer_stacktrace.h
|
|
|
|
sanitizer_symbolizer.h
|
2013-03-14 21:54:30 +08:00
|
|
|
sanitizer_thread_registry.h
|
2012-12-21 22:04:52 +08:00
|
|
|
)
|
|
|
|
|
2013-03-14 21:16:35 +08:00
|
|
|
set(SANITIZER_CFLAGS
|
|
|
|
${SANITIZER_COMMON_CFLAGS}
|
|
|
|
-fno-rtti)
|
2012-06-25 16:40:10 +08:00
|
|
|
|
2012-08-13 15:41:43 +08:00
|
|
|
set(SANITIZER_RUNTIME_LIBRARIES)
|
2012-08-10 22:45:52 +08:00
|
|
|
if(APPLE)
|
|
|
|
# Build universal binary on APPLE.
|
2013-01-20 22:36:12 +08:00
|
|
|
add_compiler_rt_osx_object_library(RTSanitizerCommon
|
|
|
|
ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${SANITIZER_SOURCES}
|
|
|
|
CFLAGS ${SANITIZER_CFLAGS})
|
2012-08-13 15:41:43 +08:00
|
|
|
list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.osx)
|
2013-01-19 00:05:21 +08:00
|
|
|
elseif(ANDROID)
|
|
|
|
add_library(RTSanitizerCommon.arm.android OBJECT ${SANITIZER_SOURCES})
|
|
|
|
set_target_compile_flags(RTSanitizerCommon.arm.android
|
|
|
|
${SANITIZER_CFLAGS})
|
|
|
|
list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.arm.android)
|
2012-08-10 22:45:52 +08:00
|
|
|
else()
|
|
|
|
# Otherwise, build separate libraries for each target.
|
2013-01-19 00:51:07 +08:00
|
|
|
foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH})
|
|
|
|
add_compiler_rt_object_library(RTSanitizerCommon ${arch}
|
2013-01-19 00:05:21 +08:00
|
|
|
SOURCES ${SANITIZER_SOURCES} CFLAGS ${SANITIZER_CFLAGS})
|
2013-01-19 00:51:07 +08:00
|
|
|
list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch})
|
|
|
|
endforeach()
|
2012-06-20 18:18:43 +08:00
|
|
|
endif()
|
2012-08-10 22:45:52 +08:00
|
|
|
|
2012-09-11 18:50:32 +08:00
|
|
|
# Unit tests for common sanitizer runtime.
|
|
|
|
if(LLVM_INCLUDE_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|