2012-04-05 06:12:04 +08:00
|
|
|
# Build for the AddressSanitizer runtime support library.
|
|
|
|
|
2012-06-20 18:18:43 +08:00
|
|
|
set(ASAN_SOURCES
|
|
|
|
asan_allocator.cc
|
|
|
|
asan_globals.cc
|
|
|
|
asan_interceptors.cc
|
|
|
|
asan_linux.cc
|
|
|
|
asan_mac.cc
|
|
|
|
asan_malloc_linux.cc
|
|
|
|
asan_malloc_mac.cc
|
|
|
|
asan_malloc_win.cc
|
|
|
|
asan_new_delete.cc
|
|
|
|
asan_poisoning.cc
|
|
|
|
asan_posix.cc
|
|
|
|
asan_printf.cc
|
2012-08-09 16:15:46 +08:00
|
|
|
asan_report.cc
|
2012-06-20 18:18:43 +08:00
|
|
|
asan_rtl.cc
|
|
|
|
asan_stack.cc
|
|
|
|
asan_stats.cc
|
|
|
|
asan_thread.cc
|
|
|
|
asan_thread_registry.cc
|
|
|
|
asan_win.cc
|
|
|
|
)
|
2012-04-05 06:12:04 +08:00
|
|
|
|
2012-06-25 20:57:43 +08:00
|
|
|
include_directories(..)
|
|
|
|
|
2012-06-27 17:01:24 +08:00
|
|
|
set(ASAN_CFLAGS
|
|
|
|
-fPIC
|
|
|
|
-fno-exceptions
|
|
|
|
-funwind-tables
|
|
|
|
-fvisibility=hidden
|
2012-07-24 19:49:55 +08:00
|
|
|
-fno-builtin
|
|
|
|
-fomit-frame-pointer
|
|
|
|
-O3
|
2012-06-27 17:01:24 +08:00
|
|
|
)
|
2012-07-02 14:48:10 +08:00
|
|
|
if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
|
|
|
|
list(APPEND ASAN_CFLAGS -Wno-variadic-macros)
|
|
|
|
endif ()
|
2012-06-25 16:40:10 +08:00
|
|
|
|
2012-07-24 20:11:38 +08:00
|
|
|
if (APPLE)
|
|
|
|
list(APPEND ASAN_CFLAGS -mmacosx-version-min=10.5)
|
|
|
|
endif()
|
|
|
|
|
2012-06-25 16:40:10 +08:00
|
|
|
set(ASAN_COMMON_DEFINITIONS
|
2012-07-02 14:48:10 +08:00
|
|
|
ASAN_HAS_EXCEPTIONS=1
|
|
|
|
ASAN_NEEDS_SEGV=1
|
2012-06-25 20:57:43 +08:00
|
|
|
)
|
2012-06-25 16:40:10 +08:00
|
|
|
|
2012-07-25 19:15:00 +08:00
|
|
|
# FIXME: We need to build universal binaries on OS X instead of
|
|
|
|
# two arch-specific binaries.
|
|
|
|
|
2012-04-05 06:12:04 +08:00
|
|
|
if(CAN_TARGET_X86_64)
|
2012-06-25 16:40:10 +08:00
|
|
|
add_library(clang_rt.asan-x86_64 STATIC
|
|
|
|
${ASAN_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.x86_64>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.x86_64>
|
|
|
|
)
|
2012-06-27 17:01:24 +08:00
|
|
|
set_target_compile_flags(clang_rt.asan-x86_64
|
2012-07-02 14:48:10 +08:00
|
|
|
${ASAN_CFLAGS}
|
2012-06-27 17:01:24 +08:00
|
|
|
${TARGET_X86_64_CFLAGS}
|
|
|
|
)
|
2012-07-02 14:48:10 +08:00
|
|
|
set_property(TARGET clang_rt.asan-x86_64 APPEND PROPERTY COMPILE_DEFINITIONS
|
|
|
|
${ASAN_COMMON_DEFINITIONS})
|
2012-07-25 19:15:00 +08:00
|
|
|
add_clang_runtime_static_library(clang_rt.asan-x86_64)
|
2012-04-05 06:12:04 +08:00
|
|
|
endif()
|
|
|
|
if(CAN_TARGET_I386)
|
2012-06-25 16:40:10 +08:00
|
|
|
add_library(clang_rt.asan-i386 STATIC
|
|
|
|
${ASAN_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.i386>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.i386>
|
|
|
|
)
|
2012-06-27 17:01:24 +08:00
|
|
|
set_target_compile_flags(clang_rt.asan-i386
|
2012-07-02 14:48:10 +08:00
|
|
|
${ASAN_CFLAGS}
|
2012-06-27 17:01:24 +08:00
|
|
|
${TARGET_I386_CFLAGS}
|
|
|
|
)
|
2012-07-24 19:49:55 +08:00
|
|
|
set_property(TARGET clang_rt.asan-i386 APPEND PROPERTY COMPILE_DEFINITIONS
|
2012-07-02 14:48:10 +08:00
|
|
|
${ASAN_COMMON_DEFINITIONS})
|
2012-07-25 19:15:00 +08:00
|
|
|
add_clang_runtime_static_library(clang_rt.asan-i386)
|
2012-04-05 06:12:04 +08:00
|
|
|
endif()
|
2012-06-25 20:57:43 +08:00
|
|
|
|
|
|
|
if(LLVM_INCLUDE_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
2012-07-31 23:43:11 +08:00
|
|
|
|
|
|
|
# ASan output tests.
|
|
|
|
# FIXME: move all output tests from output_tests/ to lit_tests/ and get rid
|
|
|
|
# of the first directory.
|
|
|
|
add_subdirectory(lit_tests)
|