Chandler Carruth | 479d47f | 2012-06-20 10:18:43 +0000 | [diff] [blame] | 1 | # Build system for the common Sanitizer runtime support library components. |
| 2 | # These components are shared between AddressSanitizer and ThreadSanitizer. |
| 3 | |
| 4 | set(SANITIZER_SOURCES |
| 5 | sanitizer_allocator.cc |
| 6 | sanitizer_common.cc |
Alexey Samsonov | 9b1b101 | 2012-07-10 09:17:06 +0000 | [diff] [blame] | 7 | sanitizer_flags.cc |
Chandler Carruth | 479d47f | 2012-06-20 10:18:43 +0000 | [diff] [blame] | 8 | sanitizer_libc.cc |
| 9 | sanitizer_linux.cc |
| 10 | sanitizer_mac.cc |
Evgeniy Stepanov | 9358c58 | 2013-02-19 09:19:16 +0000 | [diff] [blame] | 11 | sanitizer_platform_limits_posix.cc |
Chandler Carruth | 479d47f | 2012-06-20 10:18:43 +0000 | [diff] [blame] | 12 | sanitizer_posix.cc |
| 13 | sanitizer_printf.cc |
Alexey Samsonov | 3f3ca96 | 2012-09-11 10:50:32 +0000 | [diff] [blame] | 14 | sanitizer_stackdepot.cc |
Kostya Serebryany | 1b5ea8f | 2012-08-28 14:11:57 +0000 | [diff] [blame] | 15 | sanitizer_stacktrace.cc |
Sergey Matveev | a52e5c6 | 2013-06-26 15:37:14 +0000 | [diff] [blame] | 16 | sanitizer_suppressions.cc |
Richard Smith | ab63743 | 2012-12-20 05:00:13 +0000 | [diff] [blame] | 17 | sanitizer_symbolizer_itanium.cc |
Peter Collingbourne | 51c963a | 2013-05-29 12:11:43 +0000 | [diff] [blame] | 18 | sanitizer_symbolizer_linux.cc |
Alexey Samsonov | 6e893b6 | 2012-08-14 13:00:32 +0000 | [diff] [blame] | 19 | sanitizer_symbolizer_mac.cc |
| 20 | sanitizer_symbolizer_win.cc |
Alexey Samsonov | 6d429cd | 2013-03-14 13:54:30 +0000 | [diff] [blame] | 21 | sanitizer_thread_registry.cc |
Alexey Samsonov | d64bcf4 | 2013-06-11 08:13:36 +0000 | [diff] [blame] | 22 | sanitizer_win.cc) |
Chandler Carruth | 479d47f | 2012-06-20 10:18:43 +0000 | [diff] [blame] | 23 | |
Peter Collingbourne | 0c547de | 2013-05-17 16:17:19 +0000 | [diff] [blame] | 24 | set(SANITIZER_LIBCDEP_SOURCES |
| 25 | sanitizer_common_libcdep.cc |
Peter Collingbourne | 088ea2b | 2013-05-20 15:57:44 +0000 | [diff] [blame] | 26 | sanitizer_linux_libcdep.cc |
Peter Collingbourne | 04a2281 | 2013-05-21 10:27:07 +0000 | [diff] [blame] | 27 | sanitizer_posix_libcdep.cc |
Peter Collingbourne | 705e310 | 2013-05-21 11:38:39 +0000 | [diff] [blame] | 28 | sanitizer_stoptheworld_linux_libcdep.cc |
Peter Collingbourne | 8b3af3a | 2013-05-21 12:08:37 +0000 | [diff] [blame] | 29 | sanitizer_symbolizer_libcdep.cc |
| 30 | sanitizer_symbolizer_linux_libcdep.cc |
Alexey Samsonov | d64bcf4 | 2013-06-11 08:13:36 +0000 | [diff] [blame] | 31 | sanitizer_symbolizer_posix_libcdep.cc) |
Peter Collingbourne | 0c547de | 2013-05-17 16:17:19 +0000 | [diff] [blame] | 32 | |
Alexey Samsonov | 032e833 | 2012-12-21 14:04:52 +0000 | [diff] [blame] | 33 | # Explicitly list all sanitizer_common headers. Not all of these are |
| 34 | # included in sanitizer_common source files, but we need to depend on |
| 35 | # headers when building our custom unit tests. |
| 36 | set(SANITIZER_HEADERS |
| 37 | sanitizer_allocator.h |
Alexey Samsonov | 1f3c2fe | 2013-05-29 09:15:39 +0000 | [diff] [blame] | 38 | sanitizer_allocator_internal.h |
Alexey Samsonov | 032e833 | 2012-12-21 14:04:52 +0000 | [diff] [blame] | 39 | sanitizer_atomic_clang.h |
| 40 | sanitizer_atomic_msvc.h |
| 41 | sanitizer_atomic.h |
| 42 | sanitizer_common.h |
Evgeniy Stepanov | 4f32c0b | 2013-01-18 13:01:18 +0000 | [diff] [blame] | 43 | sanitizer_common_interceptors.inc |
Evgeniy Stepanov | 4612aba | 2013-06-20 09:19:28 +0000 | [diff] [blame] | 44 | sanitizer_common_interceptors_ioctl.inc |
Evgeniy Stepanov | 4f32c0b | 2013-01-18 13:01:18 +0000 | [diff] [blame] | 45 | sanitizer_common_interceptors_scanf.inc |
Evgeniy Stepanov | 2887a64 | 2013-04-11 14:37:04 +0000 | [diff] [blame] | 46 | sanitizer_common_syscalls.inc |
Alexey Samsonov | 032e833 | 2012-12-21 14:04:52 +0000 | [diff] [blame] | 47 | sanitizer_flags.h |
| 48 | sanitizer_internal_defs.h |
Dmitry Vyukov | b48224c | 2013-01-14 08:23:34 +0000 | [diff] [blame] | 49 | sanitizer_lfstack.h |
Alexey Samsonov | 032e833 | 2012-12-21 14:04:52 +0000 | [diff] [blame] | 50 | sanitizer_libc.h |
Kostya Serebryany | 6fb47af | 2013-02-27 11:22:40 +0000 | [diff] [blame] | 51 | sanitizer_linux.h |
Alexey Samsonov | 032e833 | 2012-12-21 14:04:52 +0000 | [diff] [blame] | 52 | sanitizer_list.h |
| 53 | sanitizer_mutex.h |
| 54 | sanitizer_placement_new.h |
| 55 | sanitizer_platform_interceptors.h |
| 56 | sanitizer_procmaps.h |
Dmitry Vyukov | 9fc0df8 | 2013-01-11 08:07:43 +0000 | [diff] [blame] | 57 | sanitizer_quarantine.h |
Alexey Samsonov | 032e833 | 2012-12-21 14:04:52 +0000 | [diff] [blame] | 58 | sanitizer_report_decorator.h |
| 59 | sanitizer_stackdepot.h |
| 60 | sanitizer_stacktrace.h |
| 61 | sanitizer_symbolizer.h |
Alexey Samsonov | d64bcf4 | 2013-06-11 08:13:36 +0000 | [diff] [blame] | 62 | sanitizer_thread_registry.h) |
Alexey Samsonov | 032e833 | 2012-12-21 14:04:52 +0000 | [diff] [blame] | 63 | |
Alexey Samsonov | 2be1e7f | 2013-03-14 13:16:35 +0000 | [diff] [blame] | 64 | set(SANITIZER_CFLAGS |
| 65 | ${SANITIZER_COMMON_CFLAGS} |
| 66 | -fno-rtti) |
Chandler Carruth | a765ffc | 2012-06-25 08:40:10 +0000 | [diff] [blame] | 67 | |
Alexey Samsonov | 0b56247 | 2012-08-13 07:41:43 +0000 | [diff] [blame] | 68 | set(SANITIZER_RUNTIME_LIBRARIES) |
Alexey Samsonov | fe51abb | 2012-08-10 14:45:52 +0000 | [diff] [blame] | 69 | if(APPLE) |
| 70 | # Build universal binary on APPLE. |
Alexey Samsonov | 5162314 | 2013-01-20 14:36:12 +0000 | [diff] [blame] | 71 | add_compiler_rt_osx_object_library(RTSanitizerCommon |
| 72 | ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH} |
Peter Collingbourne | 0c547de | 2013-05-17 16:17:19 +0000 | [diff] [blame] | 73 | SOURCES ${SANITIZER_SOURCES} ${SANITIZER_LIBCDEP_SOURCES} |
Alexey Samsonov | 5162314 | 2013-01-20 14:36:12 +0000 | [diff] [blame] | 74 | CFLAGS ${SANITIZER_CFLAGS}) |
Alexey Samsonov | 0b56247 | 2012-08-13 07:41:43 +0000 | [diff] [blame] | 75 | list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.osx) |
Alexey Samsonov | 392c50d | 2013-01-18 16:05:21 +0000 | [diff] [blame] | 76 | elseif(ANDROID) |
Peter Collingbourne | 0c547de | 2013-05-17 16:17:19 +0000 | [diff] [blame] | 77 | add_library(RTSanitizerCommon.arm.android OBJECT |
| 78 | ${SANITIZER_SOURCES} ${SANITIZER_LIBCDEP_SOURCES}) |
Alexey Samsonov | 392c50d | 2013-01-18 16:05:21 +0000 | [diff] [blame] | 79 | set_target_compile_flags(RTSanitizerCommon.arm.android |
| 80 | ${SANITIZER_CFLAGS}) |
| 81 | list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.arm.android) |
Alexey Samsonov | fe51abb | 2012-08-10 14:45:52 +0000 | [diff] [blame] | 82 | else() |
| 83 | # Otherwise, build separate libraries for each target. |
Alexey Samsonov | 43b4b9c | 2013-01-18 16:51:07 +0000 | [diff] [blame] | 84 | foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH}) |
| 85 | add_compiler_rt_object_library(RTSanitizerCommon ${arch} |
Alexey Samsonov | 392c50d | 2013-01-18 16:05:21 +0000 | [diff] [blame] | 86 | SOURCES ${SANITIZER_SOURCES} CFLAGS ${SANITIZER_CFLAGS}) |
Peter Collingbourne | 0c547de | 2013-05-17 16:17:19 +0000 | [diff] [blame] | 87 | add_compiler_rt_object_library(RTSanitizerCommonLibc ${arch} |
| 88 | SOURCES ${SANITIZER_LIBCDEP_SOURCES} CFLAGS ${SANITIZER_CFLAGS}) |
Richard Smith | 3e587a4 | 2013-03-20 23:49:17 +0000 | [diff] [blame] | 89 | add_compiler_rt_static_runtime(clang_rt.san-${arch} ${arch} |
Richard Smith | b877cb5 | 2013-05-19 19:53:01 +0000 | [diff] [blame] | 90 | SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 91 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
| 92 | CFLAGS ${SANITIZER_CFLAGS}) |
Alexey Samsonov | 43b4b9c | 2013-01-18 16:51:07 +0000 | [diff] [blame] | 93 | list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch}) |
| 94 | endforeach() |
Alexey Samsonov | fe51abb | 2012-08-10 14:45:52 +0000 | [diff] [blame] | 95 | endif() |
Alexey Samsonov | 8fc90f6 | 2012-08-08 09:46:51 +0000 | [diff] [blame] | 96 | |
Alexey Samsonov | 3f3ca96 | 2012-09-11 10:50:32 +0000 | [diff] [blame] | 97 | # Unit tests for common sanitizer runtime. |
| 98 | if(LLVM_INCLUDE_TESTS) |
Alexey Samsonov | 3f3ca96 | 2012-09-11 10:50:32 +0000 | [diff] [blame] | 99 | add_subdirectory(tests) |
| 100 | endif() |