x86, v2: Define LIBGCC2_UNWIND_ATTRIBUTE on ia32 [PR104781]

Message ID Yih6aEjWuKNKsESO@tucnak
State New
Headers
Series x86, v2: Define LIBGCC2_UNWIND_ATTRIBUTE on ia32 [PR104781] |

Commit Message

Jakub Jelinek March 9, 2022, 9:59 a.m. UTC
  On Wed, Mar 09, 2022 at 08:18:38AM +0100, Richard Biener wrote:
> I wonder if this is a good case for general-regs-only instead?  At
> least no-sse cannot be functionally equivalent (since then we would
> not have needed general-regs-only ...).

I think general-regs-only is approx. equivalent to no-mmx,no-sse,
we don't really need/want mmx in the unwinder I guess.

The following seems to work fine too, regtested with
-O2 -msse2 -mfpmath=sse -mstackrealign in {C,CXX,XC,TC}FLAGS on i686-linux
(where without the patch it fails to build).

2022-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR target/104781
	* config/i386/i386.h (LIBGCC2_UNWIND_ATTRIBUTE): Define for ia32.



	Jakub
  

Comments

Richard Biener March 9, 2022, 11:30 a.m. UTC | #1
On Wed, 9 Mar 2022, Jakub Jelinek wrote:

> On Wed, Mar 09, 2022 at 08:18:38AM +0100, Richard Biener wrote:
> > I wonder if this is a good case for general-regs-only instead?  At
> > least no-sse cannot be functionally equivalent (since then we would
> > not have needed general-regs-only ...).
> 
> I think general-regs-only is approx. equivalent to no-mmx,no-sse,
> we don't really need/want mmx in the unwinder I guess.
> 
> The following seems to work fine too, regtested with
> -O2 -msse2 -mfpmath=sse -mstackrealign in {C,CXX,XC,TC}FLAGS on i686-linux
> (where without the patch it fails to build).

LGTM.

> 2022-03-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/104781
> 	* config/i386/i386.h (LIBGCC2_UNWIND_ATTRIBUTE): Define for ia32.
> 
> --- gcc/config/i386/i386.h.jj	2022-02-25 21:59:29.356291326 +0100
> +++ gcc/config/i386/i386.h	2022-03-09 10:00:38.242376504 +0100
> @@ -2848,6 +2848,12 @@ extern enum attr_cpu ix86_schedule;
>  #define NUM_X86_64_MS_CLOBBERED_REGS 12
>  #endif
>  
> +/* __builtin_eh_return can't handle stack realignment, so restrict to
> +   general regs in 32-bit libgcc functions that call it.  */
> +#ifndef __x86_64__
> +#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((target ("general-regs-only")))
> +#endif
> +
>  /*
>  Local variables:
>  version-control: t
> 
> 
> 	Jakub
> 
>
  

Patch

--- gcc/config/i386/i386.h.jj	2022-02-25 21:59:29.356291326 +0100
+++ gcc/config/i386/i386.h	2022-03-09 10:00:38.242376504 +0100
@@ -2848,6 +2848,12 @@  extern enum attr_cpu ix86_schedule;
 #define NUM_X86_64_MS_CLOBBERED_REGS 12
 #endif
 
+/* __builtin_eh_return can't handle stack realignment, so restrict to
+   general regs in 32-bit libgcc functions that call it.  */
+#ifndef __x86_64__
+#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((target ("general-regs-only")))
+#endif
+
 /*
 Local variables:
 version-control: t