re PR target/51135 (SIGSEGV during exception cleanup on win32)

PR libstdc++/51135
        * libsupc++/unwind-cxx.h (__cxa_exception): Mark
        exceptionDestructor by _GLIBCXX_CDTOR_CALLABI.
        * libsupc++/eh_throw.cc (__cxa_throw): Mark destructor
        function argument by _GLIBCXX_CDTOR_CALLABI.
        * libsupc++/cxxabi.h (__cxa_throw): Likewise.
        (_GLIBCXX_CDTOR_CALLABI): Add empty default
        definition.
        * config/os/mingw32-w64/os_defines.h (_GLIBCXX_CDTOR_CALLABI): Define
        for IA-32 target as __thiscall.
        * config/os/mingw32/os_defines.h (_GLIBCXX_CDTOR_CALLABI): Likewise.

From-SVN: r182410
This commit is contained in:
Kai Tietz 2011-12-16 19:43:06 +01:00
parent 134f529521
commit 2ecb85c86b
5 changed files with 21 additions and 3 deletions

View File

@ -65,4 +65,11 @@
// ioctlsocket function doesn't work for normal file-descriptors. // ioctlsocket function doesn't work for normal file-descriptors.
#define _GLIBCXX_NO_IOCTL 1 #define _GLIBCXX_NO_IOCTL 1
// See libstdc++/51135
// Class constructors/destructors have __thiscall calling-convention on
// IA 32-bit
#if defined (__i386__)
#define _GLIBCXX_CDTOR_CALLABI __thiscall
#endif
#endif #endif

View File

@ -65,4 +65,11 @@
// ioctlsocket function doesn't work for normal file-descriptors. // ioctlsocket function doesn't work for normal file-descriptors.
#define _GLIBCXX_NO_IOCTL 1 #define _GLIBCXX_NO_IOCTL 1
// See libstdc++/51135
// Class constructors/destructors have __thiscall calling-convention on
// IA 32-bit
#if defined (__i386__)
#define _GLIBCXX_CDTOR_CALLABI __thiscall
#endif
#endif #endif

View File

@ -51,6 +51,10 @@
#include <bits/cxxabi_tweaks.h> #include <bits/cxxabi_tweaks.h>
#include <bits/cxxabi_forced.h> #include <bits/cxxabi_forced.h>
#ifndef _GLIBCXX_CDTOR_CALLABI
#define _GLIBCXX_CDTOR_CALLABI
#endif
#ifdef __cplusplus #ifdef __cplusplus
namespace __cxxabiv1 namespace __cxxabiv1
{ {
@ -596,7 +600,7 @@ namespace __cxxabiv1
// Throw the exception. // Throw the exception.
void void
__cxa_throw(void*, std::type_info*, void (*) (void *)) __cxa_throw(void*, std::type_info*, void (_GLIBCXX_CDTOR_CALLABI *) (void *))
__attribute__((__noreturn__)); __attribute__((__noreturn__));
// Used to implement exception handlers. // Used to implement exception handlers.

View File

@ -59,7 +59,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
extern "C" void extern "C" void
__cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo, __cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo,
void (*dest) (void *)) void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
{ {
// Definitely a primary. // Definitely a primary.
__cxa_refcounted_exception *header __cxa_refcounted_exception *header

View File

@ -51,7 +51,7 @@ struct __cxa_exception
{ {
// Manage the exception object itself. // Manage the exception object itself.
std::type_info *exceptionType; std::type_info *exceptionType;
void (*exceptionDestructor)(void *); void (_GLIBCXX_CDTOR_CALLABI *exceptionDestructor)(void *);
// The C++ standard has entertaining rules wrt calling set_terminate // The C++ standard has entertaining rules wrt calling set_terminate
// and set_unexpected in the middle of the exception cleanup process. // and set_unexpected in the middle of the exception cleanup process.