summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-01-03 01:18:48 +0000
committerEric Fiselier <eric@efcs.ca>2017-01-03 01:18:48 +0000
commit1285e4d60e60bcd166aed64d4913e4e5d0b042ad (patch)
tree092da5ae7b7db35aa28d0ad097aeb8fcc1c67c01 /libcxx
parent1c9867d0097a9fe6b669c08c7434a71cc464941d (diff)
downloadbcm5719-llvm-1285e4d60e60bcd166aed64d4913e4e5d0b042ad.tar.gz
bcm5719-llvm-1285e4d60e60bcd166aed64d4913e4e5d0b042ad.zip
Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.
This patch re-commits a previous attempt to support building libc++ w/o an ABI library. That patch was originally reverted because: 1) It forgot to teach the test suite about "default" ABI libraries. 2) Some LLVM builders don't clear the CMake cache between builds. The previous patch caused those builders to fail since their old cache entry for LIBCXX_CXX_ABI="" is no longer valid. The updated patch addresses both issues. It works around (2) by adding a hack to force the builders to update their cache entries. The hack will be removed shortly once all LLVM builders have run. Original commit message ----------------------- Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits of the C++ STL. However we also support building w/o an ABI library entirely. This patch fixes building libc++ w/o an ABI library (and incorporates the `~type_info()` fix in D28211). The main changes in this patch are: 1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default". 2) Fix CMake bits which treated "none" as "default" on OS X. 3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`. 4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined. Unfortunately this patch doesn't help clean up the macro mess that we use to configure for different ABI libraries. llvm-svn: 290849
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/CMakeLists.txt20
-rw-r--r--libcxx/cmake/Modules/HandleLibCXXABI.cmake11
-rw-r--r--libcxx/lib/CMakeLists.txt2
-rw-r--r--libcxx/lib/abi/CMakeLists.txt2
-rw-r--r--libcxx/src/exception.cpp6
-rw-r--r--libcxx/src/new.cpp6
-rw-r--r--libcxx/src/stdexcept.cpp3
-rw-r--r--libcxx/src/typeinfo.cpp12
-rw-r--r--libcxx/test/libcxx/test/config.py2
9 files changed, 45 insertions, 19 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index f254291b6ec..21d7ded33d9 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -87,13 +87,22 @@ if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC)
endif()
# ABI Library options ---------------------------------------------------------
-set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
- "Specify C++ ABI library to use." FORCE)
-set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
+set(LIBCXX_CXX_ABI "default" CACHE STRING
+ "Specify C++ ABI library to use.")
+set(CXXABIS none default libcxxabi libcxxrt libstdc++ libsupc++)
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
+# FIXME: This is a temporary hack to force LLVM buildbots to store
+# the fixed cache entry instead of the previous cache entry. This is needed
+# because some LLVM buildbots don't clear their cache. It will be removed
+# once all LLVM bots have been run.
+if (LIBCXX_CXX_ABI STREQUAL "")
+ set(LIBCXX_CXX_ABI "default" CACHE STRING
+ "Specify the C++ ABI library to use." FORCE)
+endif()
+
# Setup the default options if LIBCXX_CXX_ABI is not specified.
-if (NOT LIBCXX_CXX_ABI)
+if (LIBCXX_CXX_ABI STREQUAL "default")
find_path(
LIBCXX_LIBCXXABI_INCLUDES_INTERNAL
cxxabi.h
@@ -107,7 +116,7 @@ if (NOT LIBCXX_CXX_ABI)
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
set(LIBCXX_CXX_ABI_INTREE 1)
else()
- set(LIBCXX_CXX_ABI_LIBNAME "none")
+ set(LIBCXX_CXX_ABI_LIBNAME "default")
endif()
else()
set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}")
@@ -125,6 +134,7 @@ option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
+ AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"
AND PYTHONINTERP_FOUND
AND LIBCXX_ENABLE_SHARED)
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON)
diff --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
index 39f2aa575b4..df3b4f9f5cd 100644
--- a/libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -102,9 +102,14 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
setup_abi_lib("-DLIBCXXRT"
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
)
-elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
+elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
+ list(APPEND LIBCXX_COMPILE_FLAGS "-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY")
+elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "default")
+ # Nothing TODO
+else()
message(FATAL_ERROR
- "Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
- "supported for c++ abi."
+ "Unsupported c++ abi: '${LIBCXX_CXX_ABI_LIBNAME}'. \
+ Currently libstdc++, libsupc++, libcxxabi, libcxxrt, default and none are
+ supported for c++ abi."
)
endif ()
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt
index f37ac68ebc2..4383c07d8d2 100644
--- a/libcxx/lib/CMakeLists.txt
+++ b/libcxx/lib/CMakeLists.txt
@@ -34,7 +34,7 @@ add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}"
add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
- LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"))
+ LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"))
set(LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY ON)
endif()
diff --git a/libcxx/lib/abi/CMakeLists.txt b/libcxx/lib/abi/CMakeLists.txt
index 223dbdbcb57..e3eb3bf3994 100644
--- a/libcxx/lib/abi/CMakeLists.txt
+++ b/libcxx/lib/abi/CMakeLists.txt
@@ -5,7 +5,7 @@ if (DEFINED TARGET_TRIPLE
AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${TARGET_TRIPLE}.abilist"
AND TARGET cxx_shared
AND ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi" OR
- (APPLE AND "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none"))
+ (APPLE AND "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "default"))
AND NOT LIBCXX_ABI_UNSTABLE
AND LIBCXX_ABI_VERSION EQUAL "1")
set(LIBCXX_HAS_ABILIST_CONFIGURATION 1 CACHE INTERNAL "")
diff --git a/libcxx/src/exception.cpp b/libcxx/src/exception.cpp
index 96bd7ee59a0..ec8969aaf4c 100644
--- a/libcxx/src/exception.cpp
+++ b/libcxx/src/exception.cpp
@@ -12,7 +12,8 @@
#include "exception"
#include "new"
-#if defined(__APPLE__) && !defined(LIBCXXRT)
+#if defined(__APPLE__) && !defined(LIBCXXRT) && \
+ !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
#include <cxxabi.h>
using namespace __cxxabiv1;
@@ -106,7 +107,8 @@ bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
int uncaught_exceptions() _NOEXCEPT
{
-#if defined(__APPLE__) || defined(_LIBCPPABI_VERSION)
+#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
+ (defined(__APPLE__) || defined(_LIBCPPABI_VERSION))
// on Darwin, there is a helper function so __cxa_get_globals is private
# if _LIBCPPABI_VERSION > 1101
return __cxa_uncaught_exceptions();
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp
index 3d8b2a9d8a6..734d93136b5 100644
--- a/libcxx/src/new.cpp
+++ b/libcxx/src/new.cpp
@@ -13,7 +13,8 @@
#include "new"
-#if defined(__APPLE__) && !defined(LIBCXXRT)
+#if defined(__APPLE__) && !defined(LIBCXXRT) && \
+ !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
#include <cxxabi.h>
#ifndef _LIBCPPABI_VERSION
@@ -26,7 +27,8 @@
#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
#include <cxxabi.h>
#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
- #if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
+ #if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) || \
+ (!defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__))
static std::new_handler __new_handler;
#endif // _LIBCPPABI_VERSION
#endif
diff --git a/libcxx/src/stdexcept.cpp b/libcxx/src/stdexcept.cpp
index 90d8a34b82d..3f333309dd8 100644
--- a/libcxx/src/stdexcept.cpp
+++ b/libcxx/src/stdexcept.cpp
@@ -14,7 +14,8 @@
#include "__refstring"
/* For _LIBCPPABI_VERSION */
-#if defined(LIBCXX_BUILDING_LIBCXXABI) || defined(__APPLE__) || defined(LIBCXXRT)
+#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
+ (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(__APPLE__) || defined(LIBCXXRT))
#include <cxxabi.h>
#endif
diff --git a/libcxx/src/typeinfo.cpp b/libcxx/src/typeinfo.cpp
index 3033c9800f1..d0a7dae3802 100644
--- a/libcxx/src/typeinfo.cpp
+++ b/libcxx/src/typeinfo.cpp
@@ -8,13 +8,19 @@
//===----------------------------------------------------------------------===//
#include <stdlib.h>
-#if defined(__APPLE__) || defined(LIBCXXRT) || \
- defined(LIBCXX_BUILDING_LIBCXXABI)
+#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
+ (defined(__APPLE__) || defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI))
#include <cxxabi.h>
#endif
#include "typeinfo"
+#if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
+std::type_info::~type_info()
+{
+}
+#endif
+
#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
std::bad_cast::bad_cast() _NOEXCEPT
@@ -47,7 +53,7 @@ std::bad_typeid::what() const _NOEXCEPT
return "std::bad_typeid";
}
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
// On Darwin, the cxa_bad_* functions cannot be in the lower level library
// because bad_cast and bad_typeid are defined in his higher level library
void __cxxabiv1::__cxa_bad_typeid()
diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py
index 4551845104d..e5f4173d1cb 100644
--- a/libcxx/test/libcxx/test/config.py
+++ b/libcxx/test/libcxx/test/config.py
@@ -604,7 +604,7 @@ class Configuration(object):
self.cxx.link_flags += ['-lc++abi']
elif cxx_abi == 'libcxxrt':
self.cxx.link_flags += ['-lcxxrt']
- elif cxx_abi == 'none':
+ elif cxx_abi == 'none' or cxx_abi == 'default':
pass
else:
self.lit_config.fatal(
OpenPOWER on IntegriCloud