]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix target/78444 on x86/Darwin.
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 24 Dec 2018 12:47:58 +0000 (12:47 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Mon, 24 Dec 2018 12:47:58 +0000 (12:47 +0000)
2018-12-24  Iain Sandoe  <iain@sandoe.co.uk>

Backport from mainline
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: r267406

gcc/ChangeLog
gcc/config/i386/darwin.h
gcc/config/i386/i386.c

index cb5532156ddf2e76e95d84b253952d5aaefe88a5..2950768e0077436730576b60d51a985c7da512be 100644 (file)
@@ -1,3 +1,13 @@
+2018-12-24  Iain Sandoe  <iain@sandoe.co.uk>
+
+       Backport from mainline
+       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-24  Iain Sandoe  <iain@sandoe.co.uk>
 
        Backport from mainline
index 3a4beb05904f72d41e68a7d4fcc98daa7cc2c117..ebaa15a219921a4255724d191b16dbe858902355 100644 (file)
@@ -85,9 +85,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
index 637ac5fa98ec26d6df6068f9b3a5fbc712489e1e..1ca7109976fc5b696172f9d7786f68da0428fe88 100644 (file)
@@ -12788,10 +12788,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;