From aa3673064c5cc2009d4a75d0ab8a553e99861ccb Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 23 Feb 2015 17:56:15 -0500 Subject: [PATCH] build: remove libstdc++ backwards-compat Backwards-compatibility for libstdc++ is not limited to straightforward abi changes. Symbol visibility also needs to be taken into consideration, and that really can't be addressed simply. Instead, just static-link libstdc++ for backwards-compat. --- configure.ac | 2 +- src/Makefile.am | 2 - src/compat/glibcxx_compat.cpp | 94 ----------------------------------- 3 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 src/compat/glibcxx_compat.cpp diff --git a/configure.ac b/configure.ac index 9dd3f17d8..006c5f38a 100644 --- a/configure.ac +++ b/configure.ac @@ -133,7 +133,7 @@ AC_ARG_ENABLE([lcov], AC_ARG_ENABLE([glibc-back-compat], [AS_HELP_STRING([--enable-glibc-back-compat], - [enable backwards compatibility with glibc and libstdc++])], + [enable backwards compatibility with glibc])], [use_glibc_compat=$enableval], [use_glibc_compat=no]) diff --git a/src/Makefile.am b/src/Makefile.am index 7644f6b32..37dfd5dba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -280,7 +280,6 @@ libbitcoin_util_a_SOURCES = \ if GLIBC_BACK_COMPAT libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp -libbitcoin_util_a_SOURCES += compat/glibcxx_compat.cpp endif # cli: shared between bitcoin-cli and bitcoin-qt @@ -372,7 +371,6 @@ libbitcoinconsensus_la_SOURCES = \ if GLIBC_BACK_COMPAT libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp - libbitcoinconsensus_la_SOURCES += compat/glibcxx_compat.cpp endif libbitcoinconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS) diff --git a/src/compat/glibcxx_compat.cpp b/src/compat/glibcxx_compat.cpp deleted file mode 100644 index 4f2771e57..000000000 --- a/src/compat/glibcxx_compat.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2009-2014 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include -#include -#include -#include - -#ifndef _GLIBCXX_USE_NOEXCEPT -#define _GLIBCXX_USE_NOEXCEPT throw() -#endif - -namespace std -{ -const char* bad_exception::what() const throw() -{ - return "std::bad_exception"; -} - -const char* bad_cast::what() const throw() -{ - return "std::bad_cast"; -} - -const char* bad_alloc::what() const throw() -{ - return "std::bad_alloc"; -} - -namespace __detail -{ -struct _List_node_base { - void _M_hook(std::__detail::_List_node_base* const __position) throw() __attribute__((used)) - { - _M_next = __position; - _M_prev = __position->_M_prev; - __position->_M_prev->_M_next = this; - __position->_M_prev = this; - } - - void _M_unhook() __attribute__((used)) - { - _List_node_base* const __next_node = _M_next; - _List_node_base* const __prev_node = _M_prev; - __prev_node->_M_next = __next_node; - __next_node->_M_prev = __prev_node; - } - - _List_node_base* _M_next; - _List_node_base* _M_prev; -}; -} // namespace detail - -template ostream& ostream::_M_insert(bool); -template ostream& ostream::_M_insert(long); -template ostream& ostream::_M_insert(double); -template ostream& ostream::_M_insert(unsigned long); -template ostream& ostream::_M_insert(const void*); -template ostream& __ostream_insert(ostream&, const char*, streamsize); -template istream& istream::_M_extract(long&); -template istream& istream::_M_extract(unsigned short&); - -out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT {} - -length_error::~length_error() _GLIBCXX_USE_NOEXCEPT {} - -// Used with permission. -// See: https://github.com/madlib/madlib/commit/c3db418c0d34d6813608f2137fef1012ce03043d - -void ctype::_M_widen_init() const -{ - char __tmp[sizeof(_M_widen)]; - for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i) - __tmp[__i] = __i; - do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen); - - _M_widen_ok = 1; - // Set _M_widen_ok to 2 if memcpy can't be used. - for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i) - if (__tmp[__i] != _M_widen[__i]) { - _M_widen_ok = 2; - break; - } -} - -void __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__)); -void __throw_out_of_range_fmt(const char* err, ...) -{ - // Safe and over-simplified version. Ignore the format and print it as-is. - __throw_out_of_range(err); -} - -} // namespace std