[compiler-rt] r240617 - [CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9.
Alexey Samsonov
vonosmas at gmail.com
Wed Jun 24 17:57:42 PDT 2015
Author: samsonov
Date: Wed Jun 24 19:57:42 2015
New Revision: 240617
URL: http://llvm.org/viewvc/llvm-project?rev=240617&view=rev
Log:
[CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9.
Summary:
This patch implements step 1 from
https://llvm.org/bugs/show_bug.cgi?id=23539#c10
I'd appreciate if you could test it on Mac OS and verify that parts of UBSan
runtime that reference C++ ABI symbols are properly excluded, and fix ASan/UBSan
builds.
Test Plan: regression test suite
Reviewers: thakis, hans
Subscribers: llvm-commits, zaks.anna, kubabrecka
Differential Revision: http://reviews.llvm.org/D10621
Modified:
compiler-rt/trunk/CMakeLists.txt
compiler-rt/trunk/lib/ubsan/CMakeLists.txt
compiler-rt/trunk/test/lit.common.cfg
compiler-rt/trunk/test/lit.common.configured.in
compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp
Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=240617&r1=240616&r2=240617&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Wed Jun 24 19:57:42 2015
@@ -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)
Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=240617&r1=240616&r2=240617&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Wed Jun 24 19:57:42 2015
@@ -28,11 +28,16 @@ set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CF
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)
Modified: compiler-rt/trunk/test/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.cfg?rev=240617&r1=240616&r2=240617&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lit.common.cfg Wed Jun 24 19:57:42 2015
@@ -90,6 +90,10 @@ compiler_rt_debug = getattr(config, 'com
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():
Modified: compiler-rt/trunk/test/lit.common.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.configured.in?rev=240617&r1=240616&r2=240617&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.configured.in (original)
+++ compiler-rt/trunk/test/lit.common.configured.in Wed Jun 24 19:57:42 2015
@@ -27,6 +27,7 @@ set_default("python_executable", "@PYTHO
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.
Modified: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp?rev=240617&r1=240616&r2=240617&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp Wed Jun 24 19:57:42 2015
@@ -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 {};
Modified: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp?rev=240617&r1=240616&r2=240617&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp Wed Jun 24 19:57:42 2015
@@ -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>
More information about the llvm-commits
mailing list