aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2018-12-06 13:36:35 +0000
committerIain Sandoe <iains@gcc.gnu.org>2018-12-06 13:36:35 +0000
commit44d6626ced36c5bec93ae6d72d29373e9f6aa36a (patch)
treebde09a2b682011af41513423289beb79bd1bdf78 /gcc
parent31460ed2cbcd66d080b7100655ee821384b7a884 (diff)
downloadgcc-44d6626ced36c5bec93ae6d72d29373e9f6aa36a.zip
gcc-44d6626ced36c5bec93ae6d72d29373e9f6aa36a.tar.gz
gcc-44d6626ced36c5bec93ae6d72d29373e9f6aa36a.tar.bz2
Fix for PR78444 by ensuring 128b alignment at call sites.
2018-12-06 Iain Sandoe <iain@sandoe.co.uk> PR target/78444 * config/i386/darwin.h (STACK_BOUNDARY): Remove macro. * config/i386/i386.c (ix86_compute_frame_layout): Ensure at least 128b stack alignment in non-leaf functions. From-SVN: r266853
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/darwin.h3
-rw-r--r--gcc/config/i386/i386.c10
3 files changed, 15 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cded91e..4b14591 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-12-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR target/78444
+ * config/i386/darwin.h (STACK_BOUNDARY): Remove macro.
+ * config/i386/i386.c (ix86_compute_frame_layout): Ensure at least 128b
+ stack alignment in non-leaf functions.
+
2018-12-06 Jakub Jelinek <jakub@redhat.com>
PR target/87598
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 1ea5dc3..53789e7 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -111,9 +111,6 @@ extern int darwin_emit_branch_islands;
/* On Darwin, the stack is 128-bit aligned at the point of every call.
Failure to ensure this will lead to a crash in the system libraries
or dynamic loader. */
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY \
- ((profile_flag || TARGET_64BIT_MS_ABI) ? 128 : BITS_PER_WORD)
#undef MAIN_STACK_BOUNDARY
#define MAIN_STACK_BOUNDARY 128
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3e2fdfa..1d7b1f0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -11202,10 +11202,16 @@ ix86_compute_frame_layout (void)
/* 64-bit MS ABI seem to require stack alignment to be always 16,
except for function prologues, leaf functions and when the defult
incoming stack boundary is overriden at command line or via
- force_align_arg_pointer attribute. */
- if ((TARGET_64BIT_MS_ABI && crtl->preferred_stack_boundary < 128)
+ force_align_arg_pointer attribute.
+
+ Darwin's ABI specifies 128b alignment for both 32 and 64 bit variants
+ at call sites, including profile function calls.
+ */
+ if (((TARGET_64BIT_MS_ABI || TARGET_MACHO)
+ && crtl->preferred_stack_boundary < 128)
&& (!crtl->is_leaf || cfun->calls_alloca != 0
|| ix86_current_function_calls_tls_descriptor
+ || (TARGET_MACHO && crtl->profile)
|| ix86_incoming_stack_boundary < 128))
{
crtl->preferred_stack_boundary = 128;