add_subdirectory(asan)
add_subdirectory(interception)
add_subdirectory(sanitizer_common)
+ add_subdirectory(ubsan)
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# ThreadSanitizer is supported on Linux only.
add_subdirectory(tsan)
- # UndefinedBehaviorSanitizer has been tested on Linux only.
- add_subdirectory(ubsan)
endif()
# FIXME: Add support for the profile library.
set(UBSAN_RUNTIME_LIBRARIES)
-if(CAN_TARGET_X86_64)
- add_library(clang_rt.ubsan-x86_64 STATIC
+if(APPLE)
+ # Build universal binary on APPLE.
+ add_library(clang_rt.ubsan_osx STATIC
${UBSAN_SOURCES}
- $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>
+ $<TARGET_OBJECTS:RTSanitizerCommon.osx>
)
- set_target_compile_flags(clang_rt.ubsan-x86_64
- ${UBSAN_CFLAGS} ${TARGET_X86_64_CFLAGS}
- )
- list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-x86_64)
+ set_target_compile_flags(clang_rt.ubsan_osx ${UBSAN_CFLAGS})
+ filter_available_targets(UBSAN_TARGETS x86_64 i386)
+ set_target_properties(clang_rt.ubsan_osx PROPERTIES
+ OSX_ARCHITECTURES "${UBSAN_TARGETS}")
+ list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan_osx)
+else()
+ # Build separate libraries for each target.
+ if(CAN_TARGET_X86_64)
+ add_library(clang_rt.ubsan-x86_64 STATIC
+ ${UBSAN_SOURCES}
+ $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>
+ )
+ set_target_compile_flags(clang_rt.ubsan-x86_64
+ ${UBSAN_CFLAGS} ${TARGET_X86_64_CFLAGS}
+ )
+ list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-x86_64)
+ endif()
+ if(CAN_TARGET_I386)
+ add_library(clang_rt.ubsan-i386 STATIC
+ ${UBSAN_SOURCES}
+ $<TARGET_OBJECTS:RTSanitizerCommon.i386>
+ )
+ set_target_compile_flags(clang_rt.ubsan-i386
+ ${UBSAN_CFLAGS} ${TARGET_I386_CFLAGS}
+ )
+ list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-i386)
+ endif()
endif()
-if(CAN_TARGET_I386)
- add_library(clang_rt.ubsan-i386 STATIC
- ${UBSAN_SOURCES}
- $<TARGET_OBJECTS:RTSanitizerCommon.i386>
- )
- set_target_compile_flags(clang_rt.ubsan-i386
- ${UBSAN_CFLAGS} ${TARGET_I386_CFLAGS}
- )
- list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-i386)
-endif()
set_property(TARGET ${UBSAN_RUNTIME_LIBRARIES} APPEND PROPERTY
COMPILE_DEFINITIONS ${UBSAN_COMMON_DEFINITIONS})
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
-# UndefinedBehaviorSanitizer tests are currently supported on Linux only.
-if config.host_os not in ['Linux']:
+# UndefinedBehaviorSanitizer tests are currently supported on
+# Linux and Darwin only.
+if config.host_os not in ['Linux', 'Darwin']:
config.unsupported = True