# Build for the AddressSanitizer runtime support library. 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 asan_rtl.cc asan_stack.cc asan_stats.cc asan_thread.cc asan_thread_registry.cc asan_win.cc ) include_directories(..) set(ASAN_CFLAGS -fPIC -fno-exceptions -funwind-tables -fvisibility=hidden -fno-builtin -fomit-frame-pointer -O3 ) if (SUPPORTS_NO_VARIADIC_MACROS_FLAG) list(APPEND ASAN_CFLAGS -Wno-variadic-macros) endif () if (APPLE) list(APPEND ASAN_CFLAGS -mmacosx-version-min=10.5) endif() set(ASAN_COMMON_DEFINITIONS ASAN_HAS_EXCEPTIONS=1 ASAN_NEEDS_SEGV=1 ) # FIXME: We need to build universal binaries on OS X instead of # two arch-specific binaries. if(CAN_TARGET_X86_64) add_library(clang_rt.asan-x86_64 STATIC ${ASAN_SOURCES} $ $ ) set_target_compile_flags(clang_rt.asan-x86_64 ${ASAN_CFLAGS} ${TARGET_X86_64_CFLAGS} ) set_property(TARGET clang_rt.asan-x86_64 APPEND PROPERTY COMPILE_DEFINITIONS ${ASAN_COMMON_DEFINITIONS}) add_clang_runtime_static_library(clang_rt.asan-x86_64) endif() if(CAN_TARGET_I386) add_library(clang_rt.asan-i386 STATIC ${ASAN_SOURCES} $ $ ) set_target_compile_flags(clang_rt.asan-i386 ${ASAN_CFLAGS} ${TARGET_I386_CFLAGS} ) set_property(TARGET clang_rt.asan-i386 APPEND PROPERTY COMPILE_DEFINITIONS ${ASAN_COMMON_DEFINITIONS}) add_clang_runtime_static_library(clang_rt.asan-i386) endif() if(LLVM_INCLUDE_TESTS) add_subdirectory(tests) endif()