This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch PR libstdc++/51135]: Fix [4.7 Regression] SIGSEGV during exception cleanup on win32


2011/12/12 Paolo Carlini <paolo.carlini@oracle.com>:
> On 12/12/2011 07:28 PM, Kai Tietz wrote:
>>
>> Well, so we are at the variant I've shown at beginning, which is using a
>> config-macro to add optional the thiscall. Kai
>
> We are not, because the linkages were wrong, and we don't want mingw stuff
> inside the generic code. I was hoping this was clear by now.
>
> Paolo.

I think I understood that pretty well and wrote therefore that
configure-stuff should happen in configure part.  Anyway here is my
updated patch for it.

Hi,

so patch without changing signatures for other targets but IA-32 mingw.

ChangeLog

2011-12-15  Kai Tietz  <redhat.com>

	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.

Tested and regression tested for i686.w64-mingw32, and x86_64-unkown-linux-gnu.
Ok for apply?

Kai

Index: libsupc++/unwind-cxx.h
===================================================================
--- libsupc++/unwind-cxx.h	(revision 182256)
+++ libsupc++/unwind-cxx.h	(working copy)
@@ -51,7 +51,7 @@
 {
   // 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.
Index: libsupc++/eh_throw.cc
===================================================================
--- libsupc++/eh_throw.cc	(revision 182256)
+++ libsupc++/eh_throw.cc	(working copy)
@@ -59,7 +59,7 @@

 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: libsupc++/cxxabi.h
===================================================================
--- libsupc++/cxxabi.h	(revision 182256)
+++ libsupc++/cxxabi.h	(working copy)
@@ -51,6 +51,10 @@
 #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 @@

   // 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: config/os/mingw32/os_defines.h
===================================================================
--- config/os/mingw32/os_defines.h	(revision 182256)
+++ config/os/mingw32/os_defines.h	(working copy)
@@ -65,4 +65,11 @@
 // 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: config/os/mingw32-w64/os_defines.h
===================================================================
--- config/os/mingw32-w64/os_defines.h	(revision 182256)
+++ config/os/mingw32-w64/os_defines.h	(working copy)
@@ -65,4 +65,11 @@
 // 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]