]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR target/90458
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 15 Feb 2023 22:32:12 +0000 (23:32 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 15 Feb 2023 22:44:13 +0000 (23:44 +0100)
This is the incompatibility of -fstack-clash-protection with Windows SEH.
Now the Windows ports always enable TARGET_STACK_PROBE, which means that
the stack is always probed (out of line) so -fstack-clash-protection does
nothing more.

gcc/
PR target/90458
* config/i386/i386.cc (ix86_compute_frame_layout): Disable the
effects of -fstack-clash-protection for TARGET_STACK_PROBE.
(ix86_expand_prologue): Likewise.

gcc/config/i386/i386.cc

index 962f8c82b48acd485e4c707ea091d3774c1375b2..669b1efdb62ce81be149dbf58a68d76ef26672bd 100644 (file)
@@ -6818,7 +6818,9 @@ ix86_compute_frame_layout (void)
         stack clash protections are enabled and the allocated frame is
         larger than the probe interval, then use pushes to save
         callee saved registers.  */
-      || (flag_stack_clash_protection && to_allocate > get_probe_interval ()))
+      || (flag_stack_clash_protection
+         && !ix86_target_stack_probe ()
+         && to_allocate > get_probe_interval ()))
     frame->save_regs_using_mov = false;
 
   if (ix86_using_red_zone ()
@@ -8703,8 +8705,11 @@ ix86_expand_prologue (void)
       sse_registers_saved = true;
     }
 
-  /* If stack clash protection is requested, then probe the stack.  */
-  if (allocate >= 0 && flag_stack_clash_protection)
+  /* If stack clash protection is requested, then probe the stack, unless it
+     is already probed on the target.  */
+  if (allocate >= 0
+      && flag_stack_clash_protection
+      && !ix86_target_stack_probe ())
     {
       ix86_adjust_stack_and_probe (allocate, int_registers_saved, false);
       allocate = 0;