This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/78444] Wrong prologue stack alignment for implicit dtor on x86_64-darwin*
- From: "iains at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 Nov 2018 08:58:55 +0000
- Subject: [Bug target/78444] Wrong prologue stack alignment for implicit dtor on x86_64-darwin*
- Auto-submitted: auto-generated
- References: <bug-78444-4@http.gcc.gnu.org/bugzilla/>
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;