]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/51135 (SIGSEGV during exception cleanup on win32)
authorKai Tietz <ktietz@gcc.gnu.org>
Fri, 16 Dec 2011 18:43:06 +0000 (19:43 +0100)
committerKai Tietz <ktietz@gcc.gnu.org>
Fri, 16 Dec 2011 18:43:06 +0000 (19:43 +0100)
        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

libstdc++-v3/config/os/mingw32-w64/os_defines.h
libstdc++-v3/config/os/mingw32/os_defines.h
libstdc++-v3/libsupc++/cxxabi.h
libstdc++-v3/libsupc++/eh_throw.cc
libstdc++-v3/libsupc++/unwind-cxx.h

index 160c1ffda58597c392710df0c7aa877dcdb3ab31..f82e25c76a7301cc2fbc3f9eb4c03be13d3de515 100644 (file)
 // ioctlsocket function doesn't work for normal file-descriptors.
 #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
index 160c1ffda58597c392710df0c7aa877dcdb3ab31..f82e25c76a7301cc2fbc3f9eb4c03be13d3de515 100644 (file)
 // ioctlsocket function doesn't work for normal file-descriptors.
 #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
index aeaf4ccf4aaee954d778e1a6f1a77e57ab6e0d0e..b924fc1707959ddd3eeb02fe1da5bd9f7a595a7d 100644 (file)
 #include <bits/cxxabi_tweaks.h>
 #include <bits/cxxabi_forced.h>
 
+#ifndef _GLIBCXX_CDTOR_CALLABI
+#define _GLIBCXX_CDTOR_CALLABI
+#endif
+
 #ifdef __cplusplus
 namespace __cxxabiv1
 {
@@ -596,7 +600,7 @@ namespace __cxxabiv1
 
   // Throw the exception.
   void
-  __cxa_throw(void*, std::type_info*, void (*) (void *))
+  __cxa_throw(void*, std::type_info*, void (_GLIBCXX_CDTOR_CALLABI *) (void *))
   __attribute__((__noreturn__));
 
   // Used to implement exception handlers.
index 0e7083c9033147b20b9300bade471982a26d1c84..a3d2b0d24b2f8340342fe84a10617011196d2e97 100644 (file)
@@ -59,7 +59,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
 
 extern "C" void
 __cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo,
-                        void (*dest) (void *))
+                        void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
 {
   // Definitely a primary.
   __cxa_refcounted_exception *header
index 3ce32e969f56ea482b070173765ac278c0e045fc..b0cdeae1150dd043089dda9b7bf4534557dc77ba 100644 (file)
@@ -51,7 +51,7 @@ struct __cxa_exception
 {
   // Manage the exception object itself.
   std::type_info *exceptionType;
-  void (*exceptionDestructor)(void *);
+  void (_GLIBCXX_CDTOR_CALLABI *exceptionDestructor)(void *);
 
   // The C++ standard has entertaining rules wrt calling set_terminate
   // and set_unexpected in the middle of the exception cleanup process.