re PR libstdc++/49818 (libsupc++ does not export __cxa_get_globals or related functions)

2011-10-10  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/49818
	* config/abi/pre/gnu.ver (CXXABI_1.3.6): Add symbols.
	* testsuite/util/testsuite_abi.cc: Same.
	* libsupc++/unwind-cxx.h: Move required eh API...
	* libsupc++/cxxabi.h: ... to here. Add required forward declarations.
	Use _GLIBCXX_NOTHROW.
	* libsupc++/pure.cc (__cxa_deleted_virtual): Add.
	* libsupc++/eh_alloc.cc: Use _GLIBCXX_NOTHROW.
	* libsupc++/eh_catch.cc: Same.
	* libsupc++/eh_globals.cc: Same.
	* libsupc++/eh_type.cc: Same.

From-SVN: r179769
This commit is contained in:
Benjamin Kosnik 2011-10-10 19:03:39 +00:00 committed by Benjamin Kosnik
parent 13d563f074
commit 50da34bb1b
10 changed files with 145 additions and 91 deletions

View File

@ -1,3 +1,17 @@
2011-10-10 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/49818
* config/abi/pre/gnu.ver (CXXABI_1.3.6): Add symbols.
* testsuite/util/testsuite_abi.cc: Same.
* libsupc++/unwind-cxx.h: Move required eh API...
* libsupc++/cxxabi.h: ... to here. Add required forward declarations.
Use _GLIBCXX_NOTHROW.
* libsupc++/pure.cc (__cxa_deleted_virtual): Add.
* libsupc++/eh_alloc.cc: Use _GLIBCXX_NOTHROW.
* libsupc++/eh_catch.cc: Same.
* libsupc++/eh_globals.cc: Same.
* libsupc++/eh_type.cc: Same.
2011-10-07 Jonathan Wakely <jwakely.gcc@gmail.com>
* testsuite/util/testsuite_allocator.h (uneq_allocator): Add

View File

@ -104,7 +104,7 @@ GLIBCXX_3.4 {
std::logic_error*;
std::locale::[A-Za-e]*;
std::locale::facet::[A-Za-z]*;
std::locale::facet::_S_get_c_locale*;
std::locale::facet::_S_get_c_locale*;
std::locale::facet::_S_clone_c_locale*;
std::locale::facet::_S_create_c_locale*;
std::locale::facet::_S_destroy_c_locale*;
@ -145,7 +145,7 @@ GLIBCXX_3.4 {
std::strstream*;
std::strstreambuf*;
# std::t[a-q]*;
std::t[a-g]*;
std::t[a-g]*;
std::th[a-h]*;
std::th[j-q]*;
std::th[s-z]*;
@ -238,7 +238,7 @@ GLIBCXX_3.4 {
_ZNKSs8_M_limit*;
_ZNKSs9_M_ibeginEv;
_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_E*;
_ZNKSs7compare*;
_ZNKSs7compare*;
_ZNKSs5c_strEv;
_ZNKSs8capacityEv;
_ZNKSs4copyEPc[jmy][jmy];
@ -435,10 +435,10 @@ GLIBCXX_3.4 {
# std::locale destructors
_ZNSt6localeD*;
# std::locale::facet destructors
_ZNSt6locale5facetD*;
# std::locale::_Impl constructors, destructors
_ZNSt6locale5_ImplC*;
_ZNSt6locale5_ImplD*;
@ -447,7 +447,7 @@ GLIBCXX_3.4 {
_ZNSt8ios_baseD*;
_ZNSt8ios_base4InitD*;
# bool std::has_facet
# bool std::has_facet
_ZSt9has_facetIS*;
# std::use_facet
@ -486,7 +486,7 @@ GLIBCXX_3.4 {
# std::time_get_byname
_ZNSt15time_get_byname*;
# std::time_put
_ZNSt8time_put*;
_ZNKSt8time_put*;
@ -569,7 +569,7 @@ GLIBCXX_3.4 {
_ZNK11__gnu_debug16_Error_formatter13_M_print_word*;
_ZNK11__gnu_debug16_Error_formatter15_M_print_string*;
_ZNK11__gnu_debug16_Error_formatter8_M_error*;
# exceptions as functions
_ZSt16__throw_bad_castv;
_ZSt17__throw_bad_allocv;
@ -809,11 +809,11 @@ GLIBCXX_3.4 {
};
GLIBCXX_3.4.1 {
_ZNSt12__basic_fileIcE4fileEv;
} GLIBCXX_3.4;
GLIBCXX_3.4.2 {
_ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4fileEv;
@ -825,7 +825,7 @@ GLIBCXX_3.4.2 {
} GLIBCXX_3.4.1;
GLIBCXX_3.4.3 {
# stub functions from libmath
acosf;
acosl;
@ -969,7 +969,7 @@ GLIBCXX_3.4.10 {
_ZNKSt4hashIeEclEe;
_ZSt17__verify_grouping*;
_ZNSt8__detail12__prime_listE;
_ZNSt3tr18__detail12__prime_listE;
@ -992,7 +992,7 @@ GLIBCXX_3.4.10 {
} GLIBCXX_3.4.9;
GLIBCXX_3.4.11 {
# atomic
__atomic_flag_for_address;
__atomic_flag_wait_explicit;
@ -1328,16 +1328,16 @@ CXXABI_1.3 {
__cxa_rethrow;
__cxa_throw;
__cxa_type_match;
__cxa_vec_ctor;
__cxa_vec_cctor;
__cxa_vec_cleanup;
__cxa_vec_ctor;
__cxa_vec_delete;
__cxa_vec_delete2;
__cxa_vec_delete3;
__cxa_vec_delete;
__cxa_vec_dtor;
__cxa_vec_new;
__cxa_vec_new2;
__cxa_vec_new3;
__cxa_vec_new;
__gxx_personality_v0;
__gxx_personality_sj0;
__dynamic_cast;
@ -1491,3 +1491,12 @@ CXXABI_1.3.5 {
_ZTVSt16nested_exception;
} CXXABI_1.3.4;
CXXABI_1.3.6 {
__cxa_allocate_dependent_exception;
__cxa_free_dependent_exception;
__cxa_get_exception_ptr;
__cxa_deleted_virtual;
} CXXABI_1.3.5;

View File

@ -123,17 +123,6 @@ namespace __cxxabiv1
void
__cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW;
// Pure virtual functions.
void
__cxa_pure_virtual(void) __attribute__ ((__noreturn__));
// Exception handling.
void
__cxa_bad_cast();
void
__cxa_bad_typeid();
// DSO destruction.
int
__cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW;
@ -141,6 +130,20 @@ namespace __cxxabiv1
int
__cxa_finalize(void*);
// Pure virtual functions.
void
__cxa_pure_virtual(void) __attribute__ ((__noreturn__));
void
__cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
// Exception handling auxillary.
void
__cxa_bad_cast() __attribute__((__noreturn__));
void
__cxa_bad_typeid() __attribute__((__noreturn__));
/**
* @brief Demangling routine.
@ -185,6 +188,7 @@ namespace __cxxabiv1
char*
__cxa_demangle(const char* __mangled_name, char* __output_buffer,
size_t* __length, int* __status);
#ifdef __cplusplus
}
} // namespace __cxxabiv1
@ -547,30 +551,89 @@ namespace __cxxabiv1
__upcast_result& __restrict __result) const;
};
// Exception handling forward declarations.
struct __cxa_exception;
struct __cxa_refcounted_exception;
struct __cxa_dependent_exception;
struct __cxa_eh_globals;
extern "C"
{
// Dynamic cast runtime.
// src2dst has the following possible values
// >-1: src_type is a unique public non-virtual base of dst_type
// dst_ptr + src2dst == src_ptr
// -1: unspecified relationship
// -2: src_type is not a public base of dst_type
// -3: src_type is a multiple public non-virtual base of dst_type
extern "C" void*
void*
__dynamic_cast(const void* __src_ptr, // Starting object.
const __class_type_info* __src_type, // Static type of object.
const __class_type_info* __dst_type, // Desired target type.
ptrdiff_t __src2dst); // How src and dst are related.
// Exception handling runtime.
// The __cxa_eh_globals for the current thread can be obtained by using
// either of the following functions. The "fast" version assumes at least
// one prior call of __cxa_get_globals has been made from the current
// thread, so no initialization is necessary.
__cxa_eh_globals*
__cxa_get_globals() _GLIBCXX_NOTHROW __attribute__ ((__const__));
__cxa_eh_globals*
__cxa_get_globals_fast() _GLIBCXX_NOTHROW __attribute__ ((__const__));
// Allocate memory for the primary exception plus the thrown object.
void*
__cxa_allocate_exception(size_t) _GLIBCXX_NOTHROW;
// Free the space allocated for the primary exception.
void
__cxa_free_exception(void*) _GLIBCXX_NOTHROW;
// Throw the exception.
void
__cxa_throw(void*, std::type_info*, void (*) (void *))
__attribute__((__noreturn__));
// Used to implement exception handlers.
void*
__cxa_get_exception_ptr(void*) _GLIBCXX_NOTHROW __attribute__ ((__pure__));
void*
__cxa_begin_catch(void*) _GLIBCXX_NOTHROW;
void
__cxa_end_catch();
void
__cxa_rethrow() __attribute__((__noreturn__));
// Returns the type_info for the currently handled exception [15.3/8], or
// null if there is none.
extern "C" std::type_info*
std::type_info*
__cxa_current_exception_type() _GLIBCXX_NOTHROW __attribute__ ((__pure__));
// GNU Extensions.
// Allocate memory for a dependent exception.
__cxa_dependent_exception*
__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW;
// Free the space allocated for the dependent exception.
void
__cxa_free_dependent_exception(__cxa_dependent_exception*) _GLIBCXX_NOTHROW;
} // extern "C"
// A magic placeholder class that can be caught by reference
// to recognize foreign exceptions.
class __foreign_exception
{
virtual ~__foreign_exception() _GLIBCXX_NOTHROW;
virtual ~__foreign_exception() throw();
virtual void __pure_dummy() = 0; // prevent catch by value
};

View File

@ -1,5 +1,5 @@
// -*- C++ -*- Allocate exception objects.
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2011
// Free Software Foundation, Inc.
//
// This file is part of GCC.
@ -94,7 +94,7 @@ namespace
}
extern "C" void *
__cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) throw()
__cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW
{
void *ret;
@ -139,7 +139,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) throw()
extern "C" void
__cxxabiv1::__cxa_free_exception(void *vptr) throw()
__cxxabiv1::__cxa_free_exception(void *vptr) _GLIBCXX_NOTHROW
{
char *base = (char *) emergency_buffer;
char *ptr = (char *) vptr;
@ -158,7 +158,7 @@ __cxxabiv1::__cxa_free_exception(void *vptr) throw()
extern "C" __cxa_dependent_exception*
__cxxabiv1::__cxa_allocate_dependent_exception() throw()
__cxxabiv1::__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW
{
__cxa_dependent_exception *ret;
@ -202,7 +202,7 @@ __cxxabiv1::__cxa_allocate_dependent_exception() throw()
extern "C" void
__cxxabiv1::__cxa_free_dependent_exception
(__cxa_dependent_exception *vptr) throw()
(__cxa_dependent_exception *vptr) _GLIBCXX_NOTHROW
{
char *base = (char *) dependents_buffer;
char *ptr = (char *) vptr;

View File

@ -1,5 +1,5 @@
// -*- C++ -*- Exception handling routines for catching.
// Copyright (C) 2001, 2003, 2004, 2009 Free Software Foundation, Inc.
// Copyright (C) 2001, 2003, 2004, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@ -28,7 +28,7 @@
using namespace __cxxabiv1;
extern "C" void *
__cxxabiv1::__cxa_get_exception_ptr(void *exc_obj_in) throw()
__cxxabiv1::__cxa_get_exception_ptr(void *exc_obj_in) _GLIBCXX_NOTHROW
{
_Unwind_Exception *exceptionObject
= reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
@ -37,7 +37,7 @@ __cxxabiv1::__cxa_get_exception_ptr(void *exc_obj_in) throw()
}
extern "C" void *
__cxxabiv1::__cxa_begin_catch (void *exc_obj_in) throw()
__cxxabiv1::__cxa_begin_catch (void *exc_obj_in) _GLIBCXX_NOTHROW
{
_Unwind_Exception *exceptionObject
= reinterpret_cast <_Unwind_Exception *>(exc_obj_in);

View File

@ -1,5 +1,5 @@
// -*- C++ -*- Manage the thread-local exception globals.
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011
// Free Software Foundation, Inc.
//
// This file is part of GCC.
@ -47,7 +47,7 @@ using namespace __cxxabiv1;
namespace
{
abi::__cxa_eh_globals*
get_global() throw()
get_global() _GLIBCXX_NOTHROW
{
static __thread abi::__cxa_eh_globals global;
return &global;
@ -55,11 +55,11 @@ namespace
} // anonymous namespace
extern "C" __cxa_eh_globals*
__cxxabiv1::__cxa_get_globals_fast() throw()
__cxxabiv1::__cxa_get_globals_fast() _GLIBCXX_NOTHROW
{ return get_global(); }
extern "C" __cxa_eh_globals*
__cxxabiv1::__cxa_get_globals() throw()
__cxxabiv1::__cxa_get_globals() _GLIBCXX_NOTHROW
{ return get_global(); }
@ -110,7 +110,7 @@ struct __eh_globals_init
static __eh_globals_init init;
extern "C" __cxa_eh_globals*
__cxxabiv1::__cxa_get_globals_fast() throw()
__cxxabiv1::__cxa_get_globals_fast() _GLIBCXX_NOTHROW
{
__cxa_eh_globals* g;
if (init._M_init)
@ -121,7 +121,7 @@ __cxxabiv1::__cxa_get_globals_fast() throw()
}
extern "C" __cxa_eh_globals*
__cxxabiv1::__cxa_get_globals() throw()
__cxxabiv1::__cxa_get_globals() _GLIBCXX_NOTHROW
{
__cxa_eh_globals* g;
if (init._M_init)
@ -148,11 +148,11 @@ __cxxabiv1::__cxa_get_globals() throw()
#else
extern "C" __cxa_eh_globals*
__cxxabiv1::__cxa_get_globals_fast() throw()
__cxxabiv1::__cxa_get_globals_fast() _GLIBCXX_NOTHROW
{ return &eh_globals; }
extern "C" __cxa_eh_globals*
__cxxabiv1::__cxa_get_globals() throw()
__cxxabiv1::__cxa_get_globals() _GLIBCXX_NOTHROW
{ return &eh_globals; }
#endif

View File

@ -1,5 +1,5 @@
// -*- C++ -*- Exception handling routines for catching.
// Copyright (C) 2001, 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2001, 2008, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@ -33,7 +33,7 @@ namespace __cxxabiv1
// Returns the type_info for the currently handled exception [15.3/8], or
// null if there is none.
extern "C"
std::type_info *__cxa_current_exception_type () throw()
std::type_info *__cxa_current_exception_type () _GLIBCXX_NOTHROW
{
__cxa_eh_globals *globals = __cxa_get_globals ();
__cxa_exception *header = globals->caughtExceptions;

View File

@ -1,5 +1,5 @@
// -*- C++ -*-
// Copyright (C) 2000, 2001, 2009 Free Software Foundation
// Copyright (C) 2000, 2001, 2009, 2011 Free Software Foundation
//
// This file is part of GCC.
//
@ -49,3 +49,10 @@ __cxxabiv1::__cxa_pure_virtual (void)
writestr ("pure virtual method called\n");
std::terminate ();
}
extern "C" void
__cxxabiv1::__cxa_deleted_virtual (void)
{
writestr ("deleted virtual method called\n");
std::terminate ();
}

View File

@ -36,6 +36,7 @@
#include <cstddef>
#include "unwind.h"
#include <bits/atomic_word.h>
#include <cxxabi.h>
#pragma GCC visibility push(default)
@ -143,47 +144,6 @@ struct __cxa_eh_globals
#endif
};
// The __cxa_eh_globals for the current thread can be obtained by using
// either of the following functions. The "fast" version assumes at least
// one prior call of __cxa_get_globals has been made from the current
// thread, so no initialization is necessary.
extern "C" __cxa_eh_globals *__cxa_get_globals () throw()
__attribute__ ((__const__));
extern "C" __cxa_eh_globals *__cxa_get_globals_fast () throw()
__attribute__ ((__const__));
// Allocate memory for the primary exception plus the thrown object.
extern "C" void *__cxa_allocate_exception(std::size_t thrown_size) throw();
// Free the space allocated for the primary exception.
extern "C" void __cxa_free_exception(void *thrown_exception) throw();
// Allocate memory for a dependent exception.
extern "C" __cxa_dependent_exception*
__cxa_allocate_dependent_exception() throw();
// Free the space allocated for the dependent exception.
extern "C" void
__cxa_free_dependent_exception(__cxa_dependent_exception *ex) throw();
// Throw the exception.
extern "C" void __cxa_throw (void *thrown_exception,
std::type_info *tinfo,
void (*dest) (void *))
__attribute__((__noreturn__));
// Used to implement exception handlers.
extern "C" void *__cxa_get_exception_ptr (void *) throw()
__attribute__ ((__pure__));
extern "C" void *__cxa_begin_catch (void *) throw();
extern "C" void __cxa_end_catch ();
extern "C" void __cxa_rethrow () __attribute__((__noreturn__));
// These facilitate code generation for recurring situations.
extern "C" void __cxa_bad_cast () __attribute__((__noreturn__));
extern "C" void __cxa_bad_typeid () __attribute__((__noreturn__));
// @@@ These are not directly specified by the IA-64 C++ ABI.
// Handles re-checking the exception specification if unexpectedHandler

View File

@ -204,6 +204,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("CXXABI_1.3.3");
known_versions.push_back("CXXABI_1.3.4");
known_versions.push_back("CXXABI_1.3.5");
known_versions.push_back("CXXABI_1.3.6");
known_versions.push_back("CXXABI_LDBL_1.3");
}
compat_list::iterator begin = known_versions.begin();