Patchwork [libgcc] : Fix PR target/55445 Always defined __SEH__ when build from trunk

login
register
mail settings
Submitter Kai Tietz
Date Nov. 25, 2012, 3:39 p.m.
Message ID <CAEwic4b=e6wycoQXnb8P_L8FoEpfx4wyyCkhMCZGw=zZAV++4g@mail.gmail.com>
Download mbox | patch
Permalink /patch/201550/
State New
Headers show

Comments

Kai Tietz - Nov. 25, 2012, 3:39 p.m.
Hi,

the issue here is that the predefined macro __SEH__ does just indicate
that SEH-infrastructure is present.  It doesn't mean that SEH is used
as exception-mechansim.  Therefore the checks in libgcc's (and as
followup in libstdc++'s) eh exception-mechansim for SEH were not
regarding that there might SjLj enabled instead.

ChangeLog

2012-11-25  Kai Tietz

	PR target/55445
	* unwind-c (__SEH__): Make sure SjLj isn't
	active.
	* unwind-generic.h: Likewise.
	* unwind-seh.c: Likewise.

Tested for multilib i686-w64-mingw32, and x86_64-w64-mingw32.  Ok for apply?

Regards,
Kai
Kai Tietz - Nov. 28, 2012, 6:01 p.m.
Ping

2012/11/25 Kai Tietz <ktietz70@googlemail.com>:
> Hi,
>
> the issue here is that the predefined macro __SEH__ does just indicate
> that SEH-infrastructure is present.  It doesn't mean that SEH is used
> as exception-mechansim.  Therefore the checks in libgcc's (and as
> followup in libstdc++'s) eh exception-mechansim for SEH were not
> regarding that there might SjLj enabled instead.
>
> ChangeLog
>
> 2012-11-25  Kai Tietz
>
>         PR target/55445
>         * unwind-c (__SEH__): Make sure SjLj isn't
>         active.
>         * unwind-generic.h: Likewise.
>         * unwind-seh.c: Likewise.
>
> Tested for multilib i686-w64-mingw32, and x86_64-w64-mingw32.  Ok for apply?
>
> Regards,
> Kai
>
> Index: unwind-c.c
> ===================================================================
> --- unwind-c.c  (Revision 193669)
> +++ unwind-c.c  (Arbeitskopie)
> @@ -109,7 +109,7 @@
>                       struct _Unwind_Exception * ue_header,
>                       struct _Unwind_Context * context)
>  #else
> -#ifdef __SEH__
> +#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
>  static
>  #endif
>  _Unwind_Reason_Code
> @@ -233,7 +233,7 @@
>    return _URC_INSTALL_CONTEXT;
>  }
>
> -#ifdef __SEH__
> +#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
>  EXCEPTION_DISPOSITION
>  __gcc_personality_seh0 (PEXCEPTION_RECORD ms_exc, void *this_frame,
>                         PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp)
> Index: unwind-generic.h
> ===================================================================
> --- unwind-generic.h    (Revision 193669)
> +++ unwind-generic.h    (Arbeitskopie)
> @@ -28,7 +28,7 @@
>  #ifndef _UNWIND_H
>  #define _UNWIND_H
>
> -#ifdef __SEH__
> +#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
>  /* Only for _GCC_specific_handler.  */
>  #include <windows.h>
>  #endif
> @@ -275,7 +275,7 @@
>  # error "What type shall we use for _sleb128_t?"
>  #endif
>
> -#ifdef __SEH__
> +#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
>  /* Handles the mapping from SEH to GCC interfaces.  */
>  EXCEPTION_DISPOSITION _GCC_specific_handler (PEXCEPTION_RECORD, void *,
>                                              PCONTEXT, PDISPATCHER_CONTEXT,
> Index: unwind-seh.c
> ===================================================================
> --- unwind-seh.c        (Revision 193669)
> +++ unwind-seh.c        (Arbeitskopie)
> @@ -28,7 +28,7 @@
>  #include "tm.h"
>  #include "unwind.h"
>
> -#ifdef __SEH__
> +#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
>
>  /* At the moment everything is written for x64, but in theory this could
>     also be used for i386, arm, mips and other extant embedded Windows.  */
> @@ -480,4 +480,4 @@
>    return _URC_END_OF_STACK;
>  #endif
>  }
> -#endif /* __SEH__ */
> +#endif /* __SEH__  && !defined (__USING_SJLJ_EXCEPTIONS__)  */
Richard Henderson - Nov. 28, 2012, 6:31 p.m.
On 11/28/2012 10:01 AM, Kai Tietz wrote:
>> 2012-11-25  Kai Tietz
>>
>>         PR target/55445
>>         * unwind-c (__SEH__): Make sure SjLj isn't
>>         active.
>>         * unwind-generic.h: Likewise.
>>         * unwind-seh.c: Likewise.
>>

Ok.


r~

Patch

Index: unwind-c.c
===================================================================
--- unwind-c.c	(Revision 193669)
+++ unwind-c.c	(Arbeitskopie)
@@ -109,7 +109,7 @@ 
 		      struct _Unwind_Exception * ue_header,
 		      struct _Unwind_Context * context)
 #else
-#ifdef __SEH__
+#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 static
 #endif
 _Unwind_Reason_Code
@@ -233,7 +233,7 @@ 
   return _URC_INSTALL_CONTEXT;
 }

-#ifdef __SEH__
+#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 EXCEPTION_DISPOSITION
 __gcc_personality_seh0 (PEXCEPTION_RECORD ms_exc, void *this_frame,
 			PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp)
Index: unwind-generic.h
===================================================================
--- unwind-generic.h	(Revision 193669)
+++ unwind-generic.h	(Arbeitskopie)
@@ -28,7 +28,7 @@ 
 #ifndef _UNWIND_H
 #define _UNWIND_H

-#ifdef __SEH__
+#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 /* Only for _GCC_specific_handler.  */
 #include <windows.h>
 #endif
@@ -275,7 +275,7 @@ 
 # error "What type shall we use for _sleb128_t?"
 #endif

-#ifdef __SEH__
+#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 /* Handles the mapping from SEH to GCC interfaces.  */
 EXCEPTION_DISPOSITION _GCC_specific_handler (PEXCEPTION_RECORD, void *,
 					     PCONTEXT, PDISPATCHER_CONTEXT,
Index: unwind-seh.c
===================================================================
--- unwind-seh.c	(Revision 193669)
+++ unwind-seh.c	(Arbeitskopie)
@@ -28,7 +28,7 @@ 
 #include "tm.h"
 #include "unwind.h"

-#ifdef __SEH__
+#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)

 /* At the moment everything is written for x64, but in theory this could
    also be used for i386, arm, mips and other extant embedded Windows.  */
@@ -480,4 +480,4 @@ 
   return _URC_END_OF_STACK;
 #endif
 }
-#endif /* __SEH__ */
+#endif /* __SEH__  && !defined (__USING_SJLJ_EXCEPTIONS__)  */