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-06-26 23:37:14 +08:00
|
|
|
sanitizer_suppressions.cc
|
2012-12-20 13:00:13 +08:00
|
|
|
sanitizer_symbolizer_itanium.cc
|
2013-05-29 20:11:43 +08:00
|
|
|
sanitizer_symbolizer_linux.cc
|
2012-08-14 21:00:32 +08:00
|
|
|
sanitizer_symbolizer_mac.cc
|
|
|
|
sanitizer_symbolizer_win.cc
|
2013-03-14 21:54:30 +08:00
|
|
|
sanitizer_thread_registry.cc
|
2013-06-11 16:13:36 +08:00
|
|
|
sanitizer_win.cc)
|
2012-06-20 18:18:43 +08:00
|
|
|
|
2013-05-18 00:17:19 +08:00
|
|
|
set(SANITIZER_LIBCDEP_SOURCES
|
|
|
|
sanitizer_common_libcdep.cc
|
2013-05-20 23:57:44 +08:00
|
|
|
sanitizer_linux_libcdep.cc
|
2013-05-21 18:27:07 +08:00
|
|
|
sanitizer_posix_libcdep.cc
|
2013-05-21 19:38:39 +08:00
|
|
|
sanitizer_stoptheworld_linux_libcdep.cc
|
2013-05-21 20:08:37 +08:00
|
|
|
sanitizer_symbolizer_libcdep.cc
|
|
|
|
sanitizer_symbolizer_linux_libcdep.cc
|
2013-06-11 16:13:36 +08:00
|
|
|
sanitizer_symbolizer_posix_libcdep.cc)
|
2013-05-18 00:17:19 +08:00
|
|
|
|
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
|
2013-05-29 17:15:39 +08:00
|
|
|
sanitizer_allocator_internal.h
|
2012-12-21 22:04:52 +08:00
|
|
|
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
|
2013-06-20 17:19:28 +08:00
|
|
|
sanitizer_common_interceptors_ioctl.inc
|
2013-01-18 21:01:18 +08:00
|
|
|
sanitizer_common_interceptors_scanf.inc
|
2013-04-11 22:37:04 +08:00
|
|
|
sanitizer_common_syscalls.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-06-11 16:13:36 +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}
|
2013-05-18 00:17:19 +08:00
|
|
|
SOURCES ${SANITIZER_SOURCES} ${SANITIZER_LIBCDEP_SOURCES}
|
2013-01-20 22:36:12 +08:00
|
|
|
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)
|
2013-05-18 00:17:19 +08:00
|
|
|
add_library(RTSanitizerCommon.arm.android OBJECT
|
|
|
|
${SANITIZER_SOURCES} ${SANITIZER_LIBCDEP_SOURCES})
|
2013-01-19 00:05:21 +08:00
|
|
|
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-05-18 00:17:19 +08:00
|
|
|
add_compiler_rt_object_library(RTSanitizerCommonLibc ${arch}
|
|
|
|
SOURCES ${SANITIZER_LIBCDEP_SOURCES} CFLAGS ${SANITIZER_CFLAGS})
|
2013-03-21 07:49:17 +08:00
|
|
|
add_compiler_rt_static_runtime(clang_rt.san-${arch} ${arch}
|
2013-05-20 03:53:01 +08:00
|
|
|
SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
|
|
|
|
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()
|