This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug target/78444] Wrong prologue stack alignment for implicit dtor on x86_64-darwin*


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78444

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
Thanks, that confirms my expectation that this could/would affect other
targets.

I had previously posted the fragment below for review - and will update that
thread shortly.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 163682bdff..405bfd082b 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -11530,6 +11530,15 @@ ix86_compute_frame_layout (void)
       crtl->preferred_stack_boundary = 128;
       crtl->stack_alignment_needed = 128;
     }
+  else if (TARGET_MACHO && crtl->preferred_stack_boundary < 128
+          && !crtl->is_leaf)
+    {
+      /* Darwin's ABI specifies 128b alignment for both 32 and
+        64 bit variants at call sites.  So we apply this if the
+        current function is not a leaf.  */
+      crtl->preferred_stack_boundary = 128;
+      crtl->stack_alignment_needed = 128;
+    }

   stack_alignment_needed = crtl->stack_alignment_needed / BITS_PER_UNIT;
   preferred_alignment = crtl->preferred_stack_boundary / BITS_PER_UNIT;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]