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.
|
|
|
|
|
[sanitizer] Move termination functions in their own file
Summary:
As suggested by kcc@ in http://reviews.llvm.org/D20084#441418, move the CheckFailed and Die functions, and their associated callback functionalities in their own separate file.
I expended the build rules to include a new rule that would not include those termination functions, so that another project can define their own.
The tests check-{a,t,m,ub,l,e,df}san are all passing.
Reviewers: llvm-commits, kcc
Subscribers: kubabrecka
Differential Revision: http://reviews.llvm.org/D20742
llvm-svn: 271055
2016-05-28 05:57:17 +08:00
|
|
|
set(SANITIZER_SOURCES_NOTERMINATION
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_allocator.cc
|
|
|
|
sanitizer_common.cc
|
2014-02-28 18:48:13 +08:00
|
|
|
sanitizer_deadlock_detector1.cc
|
2014-03-04 20:52:20 +08:00
|
|
|
sanitizer_deadlock_detector2.cc
|
2012-07-10 17:17:06 +08:00
|
|
|
sanitizer_flags.cc
|
2015-01-15 23:13:43 +08:00
|
|
|
sanitizer_flag_parser.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_libc.cc
|
2013-10-03 21:37:17 +08:00
|
|
|
sanitizer_libignore.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_linux.cc
|
2016-04-16 06:11:10 +08:00
|
|
|
sanitizer_linux_s390.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
sanitizer_mac.cc
|
2014-05-21 17:02:13 +08:00
|
|
|
sanitizer_persistent_allocator.cc
|
2013-09-06 22:20:01 +08:00
|
|
|
sanitizer_platform_limits_linux.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
|
2014-08-06 18:16:52 +08:00
|
|
|
sanitizer_procmaps_common.cc
|
|
|
|
sanitizer_procmaps_freebsd.cc
|
2013-12-25 16:01:16 +08:00
|
|
|
sanitizer_procmaps_linux.cc
|
|
|
|
sanitizer_procmaps_mac.cc
|
2012-09-11 18:50:32 +08:00
|
|
|
sanitizer_stackdepot.cc
|
2012-08-28 22:11:57 +08:00
|
|
|
sanitizer_stacktrace.cc
|
2014-11-06 06:44:36 +08:00
|
|
|
sanitizer_stacktrace_printer.cc
|
2013-06-26 23:37:14 +08:00
|
|
|
sanitizer_suppressions.cc
|
2013-10-26 07:03:29 +08:00
|
|
|
sanitizer_symbolizer.cc
|
2014-01-16 21:48:15 +08:00
|
|
|
sanitizer_symbolizer_libbacktrace.cc
|
2015-03-12 18:53:18 +08:00
|
|
|
sanitizer_symbolizer_mac.cc
|
2012-08-14 21:00:32 +08:00
|
|
|
sanitizer_symbolizer_win.cc
|
2014-01-29 17:29:16 +08:00
|
|
|
sanitizer_tls_get_addr.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
|
|
|
|
[sanitizer][esan] Add internal_sigaction_syscall
Summary:
Adds a version of sigaction that uses a raw system call, to avoid circular
dependencies and support calling sigaction prior to setting up
interceptors. The new sigaction relies on an assembly sigreturn routine
for its restorer, which is Linux x86_64-only for now.
Uses the new sigaction to initialize the working set tool's shadow fault
handler prior to libc interceptor being set up. This is required to
support instrumentation invoked during interceptor setup, which happens
with an instrumented tcmalloc or other allocator compiled with esan.
Adds a test that emulates an instrumented allocator.
Reviewers: aizatsky
Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka
Differential Revision: http://reviews.llvm.org/D21083
llvm-svn: 272676
2016-06-14 23:15:38 +08:00
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
list(APPEND SANITIZER_SOURCES_NOTERMINATION
|
|
|
|
sanitizer_linux_x86_64.S)
|
|
|
|
endif()
|
|
|
|
|
[sanitizer] Move termination functions in their own file
Summary:
As suggested by kcc@ in http://reviews.llvm.org/D20084#441418, move the CheckFailed and Die functions, and their associated callback functionalities in their own separate file.
I expended the build rules to include a new rule that would not include those termination functions, so that another project can define their own.
The tests check-{a,t,m,ub,l,e,df}san are all passing.
Reviewers: llvm-commits, kcc
Subscribers: kubabrecka
Differential Revision: http://reviews.llvm.org/D20742
llvm-svn: 271055
2016-05-28 05:57:17 +08:00
|
|
|
set(SANITIZER_SOURCES
|
|
|
|
${SANITIZER_SOURCES_NOTERMINATION} sanitizer_termination.cc)
|
|
|
|
|
2015-07-24 06:05:20 +08:00
|
|
|
# Libc functions stubs. These sources should be linked instead of
|
|
|
|
# SANITIZER_LIBCDEP_SOURCES when sanitizer_common library must not depend on
|
|
|
|
# libc.
|
|
|
|
set(SANITIZER_NOLIBC_SOURCES
|
|
|
|
sanitizer_common_nolibc.cc)
|
|
|
|
|
2013-05-18 00:17:19 +08:00
|
|
|
set(SANITIZER_LIBCDEP_SOURCES
|
|
|
|
sanitizer_common_libcdep.cc
|
2014-05-27 20:37:52 +08:00
|
|
|
sanitizer_coverage_libcdep.cc
|
|
|
|
sanitizer_coverage_mapping_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-11-07 14:33:06 +08:00
|
|
|
sanitizer_stacktrace_libcdep.cc
|
2013-05-21 19:38:39 +08:00
|
|
|
sanitizer_stoptheworld_linux_libcdep.cc
|
2013-10-26 07:03:29 +08:00
|
|
|
sanitizer_symbolizer_libcdep.cc
|
2014-09-01 21:07:50 +08:00
|
|
|
sanitizer_symbolizer_posix_libcdep.cc
|
2015-06-25 04:13:44 +08:00
|
|
|
sanitizer_unwind_linux_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
|
2014-03-05 21:55:32 +08:00
|
|
|
sanitizer_addrhashmap.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_allocator.h
|
2014-07-08 01:39:31 +08:00
|
|
|
sanitizer_allocator_interface.h
|
2013-05-29 17:15:39 +08:00
|
|
|
sanitizer_allocator_internal.h
|
2013-11-22 16:55:33 +08:00
|
|
|
sanitizer_atomic.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_atomic_clang.h
|
|
|
|
sanitizer_atomic_msvc.h
|
2014-02-12 15:05:24 +08:00
|
|
|
sanitizer_bitvector.h
|
2014-02-12 19:28:09 +08:00
|
|
|
sanitizer_bvgraph.h
|
2012-12-21 22:04:52 +08:00
|
|
|
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
|
2014-01-21 21:01:20 +08:00
|
|
|
sanitizer_common_interceptors_format.inc
|
2013-04-11 22:37:04 +08:00
|
|
|
sanitizer_common_syscalls.inc
|
2014-02-13 15:44:51 +08:00
|
|
|
sanitizer_deadlock_detector.h
|
2014-02-28 18:48:13 +08:00
|
|
|
sanitizer_deadlock_detector_interface.h
|
2015-01-15 23:13:43 +08:00
|
|
|
sanitizer_flag_parser.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_flags.h
|
2015-01-06 10:44:05 +08:00
|
|
|
sanitizer_flags.inc
|
2015-02-19 23:15:33 +08:00
|
|
|
sanitizer_interface_internal.h
|
2012-12-21 22:04:52 +08:00
|
|
|
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-10-03 21:37:17 +08:00
|
|
|
sanitizer_libignore.h
|
2013-02-27 19:22:40 +08:00
|
|
|
sanitizer_linux.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_list.h
|
2014-02-03 23:45:03 +08:00
|
|
|
sanitizer_mac.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_mutex.h
|
2014-05-21 17:02:13 +08:00
|
|
|
sanitizer_persistent_allocator.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_placement_new.h
|
2013-11-22 16:55:33 +08:00
|
|
|
sanitizer_platform.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_platform_interceptors.h
|
2013-11-22 16:55:33 +08:00
|
|
|
sanitizer_platform_limits_posix.h
|
2015-04-09 01:08:24 +08:00
|
|
|
sanitizer_posix.h
|
2012-12-21 22:04:52 +08:00
|
|
|
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
|
2014-05-21 17:02:13 +08:00
|
|
|
sanitizer_stackdepotbase.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_stacktrace.h
|
2014-11-06 06:44:36 +08:00
|
|
|
sanitizer_stacktrace_printer.h
|
2013-11-22 16:55:33 +08:00
|
|
|
sanitizer_stoptheworld.h
|
|
|
|
sanitizer_suppressions.h
|
2012-12-21 22:04:52 +08:00
|
|
|
sanitizer_symbolizer.h
|
2015-03-03 05:15:09 +08:00
|
|
|
sanitizer_symbolizer_internal.h
|
2014-01-16 21:48:15 +08:00
|
|
|
sanitizer_symbolizer_libbacktrace.h
|
2015-03-12 18:53:18 +08:00
|
|
|
sanitizer_symbolizer_mac.h
|
2013-11-22 16:55:33 +08:00
|
|
|
sanitizer_syscall_generic.inc
|
|
|
|
sanitizer_syscall_linux_x86_64.inc
|
2015-08-21 22:50:36 +08:00
|
|
|
sanitizer_syscall_linux_aarch64.inc
|
2013-06-11 16:13:36 +08:00
|
|
|
sanitizer_thread_registry.h)
|
2012-12-21 22:04:52 +08:00
|
|
|
|
2014-01-28 17:28:57 +08:00
|
|
|
set(SANITIZER_COMMON_DEFINITIONS)
|
|
|
|
|
2014-02-13 21:43:47 +08:00
|
|
|
if(MSVC)
|
2014-01-28 17:28:57 +08:00
|
|
|
list(APPEND SANITIZER_COMMON_DEFINITIONS
|
|
|
|
SANITIZER_NEEDS_SEGV=0)
|
|
|
|
else()
|
|
|
|
list(APPEND SANITIZER_COMMON_DEFINITIONS
|
|
|
|
SANITIZER_NEEDS_SEGV=1)
|
|
|
|
endif()
|
|
|
|
|
2015-04-09 16:06:49 +08:00
|
|
|
include(CheckIncludeFile)
|
|
|
|
append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
|
|
|
|
append_have_file_definition(tirpc/rpc/xdr.h HAVE_TIRPC_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
|
|
|
|
|
2014-02-18 15:52:40 +08:00
|
|
|
set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
2016-03-05 18:01:04 +08:00
|
|
|
append_rtti_flag(OFF SANITIZER_CFLAGS)
|
2012-06-25 16:40:10 +08:00
|
|
|
|
2015-04-28 07:49:39 +08:00
|
|
|
append_list_if(SANITIZER_LIMIT_FRAME_SIZE -Wframe-larger-than=570
|
2015-01-03 12:29:12 +08:00
|
|
|
SANITIZER_CFLAGS)
|
|
|
|
append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
|
|
|
|
SANITIZER_CFLAGS)
|
2013-09-11 17:57:15 +08:00
|
|
|
|
[sanitizer][esan] Add internal_sigaction_syscall
Summary:
Adds a version of sigaction that uses a raw system call, to avoid circular
dependencies and support calling sigaction prior to setting up
interceptors. The new sigaction relies on an assembly sigreturn routine
for its restorer, which is Linux x86_64-only for now.
Uses the new sigaction to initialize the working set tool's shadow fault
handler prior to libc interceptor being set up. This is required to
support instrumentation invoked during interceptor setup, which happens
with an instrumented tcmalloc or other allocator compiled with esan.
Adds a test that emulates an instrumented allocator.
Reviewers: aizatsky
Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka
Differential Revision: http://reviews.llvm.org/D21083
llvm-svn: 272676
2016-06-14 23:15:38 +08:00
|
|
|
if (LLVM_ENABLE_PEDANTIC AND UNIX AND NOT APPLE)
|
|
|
|
# With -pedantic, our .S files raise warnings about empty macro arguments
|
|
|
|
# from __USER_LABEL_PREFIX__ being an empty arg to GLUE(). Unfortunately,
|
|
|
|
# there is no simple way to test for an empty define, nor to disable just
|
|
|
|
# that warning or to disable -pedantic. There is also no simple way to
|
|
|
|
# remove -pedantic from just this file (we'd have to remove from
|
|
|
|
# CMAKE_C*_FLAGS and re-add as a source property to all the non-.S files).
|
|
|
|
set_source_files_properties(sanitizer_linux_x86_64.S
|
|
|
|
PROPERTIES COMPILE_FLAGS "-w")
|
|
|
|
endif ()
|
|
|
|
|
2012-08-10 22:45:52 +08:00
|
|
|
if(APPLE)
|
2015-08-28 06:23:27 +08:00
|
|
|
set(OS_OPTION OS ${SANITIZER_COMMON_SUPPORTED_OS})
|
2012-06-20 18:18:43 +08:00
|
|
|
endif()
|
2012-08-10 22:45:52 +08:00
|
|
|
|
2015-08-28 06:23:27 +08:00
|
|
|
add_compiler_rt_object_libraries(RTSanitizerCommon
|
|
|
|
${OS_OPTION}
|
|
|
|
ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${SANITIZER_SOURCES}
|
|
|
|
CFLAGS ${SANITIZER_CFLAGS}
|
|
|
|
DEFS ${SANITIZER_COMMON_DEFINITIONS})
|
[sanitizer] Move termination functions in their own file
Summary:
As suggested by kcc@ in http://reviews.llvm.org/D20084#441418, move the CheckFailed and Die functions, and their associated callback functionalities in their own separate file.
I expended the build rules to include a new rule that would not include those termination functions, so that another project can define their own.
The tests check-{a,t,m,ub,l,e,df}san are all passing.
Reviewers: llvm-commits, kcc
Subscribers: kubabrecka
Differential Revision: http://reviews.llvm.org/D20742
llvm-svn: 271055
2016-05-28 05:57:17 +08:00
|
|
|
add_compiler_rt_object_libraries(RTSanitizerCommonNoTermination
|
|
|
|
${OS_OPTION}
|
|
|
|
ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${SANITIZER_SOURCES_NOTERMINATION}
|
|
|
|
CFLAGS ${SANITIZER_CFLAGS}
|
|
|
|
DEFS ${SANITIZER_COMMON_DEFINITIONS})
|
2015-08-28 06:23:27 +08:00
|
|
|
add_compiler_rt_object_libraries(RTSanitizerCommonNoLibc
|
|
|
|
${OS_OPTION}
|
|
|
|
ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${SANITIZER_NOLIBC_SOURCES}
|
|
|
|
CFLAGS ${SANITIZER_CFLAGS}
|
|
|
|
DEFS ${SANITIZER_COMMON_DEFINITIONS})
|
|
|
|
add_compiler_rt_object_libraries(RTSanitizerCommonLibc
|
|
|
|
${OS_OPTION}
|
|
|
|
ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${SANITIZER_LIBCDEP_SOURCES}
|
|
|
|
CFLAGS ${SANITIZER_CFLAGS}
|
|
|
|
DEFS ${SANITIZER_COMMON_DEFINITIONS})
|
|
|
|
|
2012-09-11 18:50:32 +08:00
|
|
|
# Unit tests for common sanitizer runtime.
|
2014-02-19 19:18:47 +08:00
|
|
|
if(COMPILER_RT_INCLUDE_TESTS)
|
2012-09-11 18:50:32 +08:00
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|