summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt9
-rw-r--r--lib/ubsan/CMakeLists.txt7
-rw-r--r--test/lit.common.cfg4
-rw-r--r--test/lit.common.configured.in1
-rw-r--r--test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp2
-rw-r--r--test/ubsan/TestCases/TypeCheck/vptr.cpp2
6 files changed, 23 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4932ac221..4a5f25775 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -327,6 +327,15 @@ if(APPLE)
endif()
endif()
+if(APPLE AND SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.9")
+ # Mac OS X prior to 10.9 had problems with exporting symbols from
+ # libc++/libc++abi.
+ set(SANITIZER_CAN_USE_CXXABI FALSE)
+else()
+ set(SANITIZER_CAN_USE_CXXABI TRUE)
+endif()
+pythonize_bool(SANITIZER_CAN_USE_CXXABI)
+
add_subdirectory(include)
set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx)
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt
index fc3f8f359..f9222dafd 100644
--- a/lib/ubsan/CMakeLists.txt
+++ b/lib/ubsan/CMakeLists.txt
@@ -28,11 +28,16 @@ set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CFLAGS})
add_custom_target(ubsan)
if(APPLE)
+ set(UBSAN_COMMON_SOURCES ${UBSAN_SOURCES})
+ if(SANITIZER_CAN_USE_CXXABI)
+ list(APPEND UBSAN_COMMON_SOURCES ${UBSAN_CXX_SOURCES})
+ endif()
+
# Common parts of UBSan runtime.
add_compiler_rt_object_libraries(RTUbsan
OS ${SANITIZER_COMMON_SUPPORTED_OS}
ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH}
- SOURCES ${UBSAN_SOURCES} ${UBSAN_CXX_SOURCES}
+ SOURCES ${UBSAN_COMMON_SOURCES}
CFLAGS ${UBSAN_CXXFLAGS})
if(COMPILER_RT_HAS_UBSAN)
diff --git a/test/lit.common.cfg b/test/lit.common.cfg
index 2a5d01ccc..4fafc41a8 100644
--- a/test/lit.common.cfg
+++ b/test/lit.common.cfg
@@ -90,6 +90,10 @@ compiler_rt_debug = getattr(config, 'compiler_rt_debug', False)
if not compiler_rt_debug:
config.available_features.add('compiler-rt-optimized')
+sanitizer_can_use_cxxabi = getattr(config, 'sanitizer_can_use_cxxabi', True)
+if sanitizer_can_use_cxxabi:
+ config.available_features.add('cxxabi')
+
lit.util.usePlatformSdkOnDarwin(config, lit_config)
def is_darwin_lto_supported():
diff --git a/test/lit.common.configured.in b/test/lit.common.configured.in
index 4a5966e44..f250e8275 100644
--- a/test/lit.common.configured.in
+++ b/test/lit.common.configured.in
@@ -27,6 +27,7 @@ set_default("python_executable", "@PYTHON_EXECUTABLE@")
set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
set_default("compiler_rt_libdir", "@COMPILER_RT_LIBRARY_OUTPUT_DIR@")
set_default("emulator", "@COMPILER_RT_EMULATOR@")
+set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
# LLVM tools dir can be passed in lit parameters, so try to
# apply substitution.
diff --git a/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp b/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
index a77680efd..09deac143 100644
--- a/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
+++ b/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
@@ -1,6 +1,8 @@
// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
+// REQUIRES: cxxabi
+
struct S { virtual int f() { return 0; } };
struct T : virtual S {};
diff --git a/test/ubsan/TestCases/TypeCheck/vptr.cpp b/test/ubsan/TestCases/TypeCheck/vptr.cpp
index 6c7955b43..a95edf918 100644
--- a/test/ubsan/TestCases/TypeCheck/vptr.cpp
+++ b/test/ubsan/TestCases/TypeCheck/vptr.cpp
@@ -24,7 +24,7 @@
// RUN: echo "vptr_check:S" > %t.loc-supp
// RUN: UBSAN_OPTIONS="suppressions='%t.loc-supp'" not %run %t x- 2>&1 | FileCheck %s --check-prefix=CHECK-LOC-SUPPRESS
-// REQUIRES: stable-runtime
+// REQUIRES: stable-runtime, cxxabi
#include <new>
#include <assert.h>
#include <stdio.h>