diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake index 8c04244b..131941a0 100644 --- a/cmake/Modules/HandleLibCXXABI.cmake +++ b/cmake/Modules/HandleLibCXXABI.cmake @@ -79,6 +79,7 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi") if (LIBCXX_CXX_ABI_INTREE) # Link against just-built "cxxabi" target. set(CXXABI_LIBNAME cxxabi) + set(LIBCXX_LIBCPPABI_VERSION "2" PARENT_SCOPE) else() # Assume c++abi is installed in the system, rely on -lc++abi link flag. set(CXXABI_LIBNAME "c++abi") diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 02c80d9d..fb09c63f 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -57,6 +57,10 @@ append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_FPIC_FLAG -fPIC) append_if(LIBCXX_LINK_FLAGS LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs) if ( APPLE ) + if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION) + set(LIBCXX_LIBCPPABI_VERSION "2") + endif() + if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" ) list(APPEND LIBCXX_COMPILE_FLAGS "-U__STRICT_ANSI__") list(APPEND LIBCXX_LINK_FLAGS diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py index 554b6bb7..162cddce 100644 --- a/test/libcxx/test/config.py +++ b/test/libcxx/test/config.py @@ -439,7 +439,10 @@ class Configuration(object): elif cxx_abi == 'libsupc++': self.cxx.link_flags += ['-lsupc++'] elif cxx_abi == 'libcxxabi': - self.cxx.link_flags += ['-lc++abi'] + # Don't link libc++abi explicitly on OS X because the symbols + # should be available in libc++ directly. + if self.target_info.platform() != 'darwin': + self.cxx.link_flags += ['-lc++abi'] elif cxx_abi == 'libcxxrt': self.cxx.link_flags += ['-lcxxrt'] elif cxx_abi == 'none':