aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/rs6000/darwin.h38
2 files changed, 40 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cc940c8..349716f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-28 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR target/85669
+ * config/rs6000/darwin.h (STACK_BOUNDARY): New.
+ (RS6000_STARTING_FRAME_OFFSET): Adjust to preserve 16byte alignment.
+ (STACK_DYNAMIC_OFFSET): Likewise.
+
2018-10-27 Sandra Loosemore <sandra@codesourcery.com>
PR target/80024
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 6b0f18e..2b5628c 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -159,17 +159,45 @@ extern int darwin_emit_branch_islands;
#undef RS6000_PIC_OFFSET_TABLE_REGNUM
#define RS6000_PIC_OFFSET_TABLE_REGNUM 31
-/* Pad the outgoing args area to 16 bytes instead of the usual 8. */
+/* Darwin's stack must remain 16-byte aligned for both 32 and 64 bit
+ ABIs. */
+
+#undef STACK_BOUNDARY
+#define STACK_BOUNDARY 128
+
+/* Offset within stack frame to start allocating local variables at.
+ For supported Darwin versions, FRAME_GROWS_DOWNWARD is true, therefore
+ this value is the offset to the END of the first local allocated.
+
+ On the RS/6000, the frame pointer is the same as the stack pointer,
+ except for dynamic allocations. So we start after the fixed area and
+ outgoing parameter area.
+
+ If the function uses dynamic stack space (CALLS_ALLOCA is set), that
+ space needs to be aligned to STACK_BOUNDARY, i.e. the sum of the
+ sizes of the fixed area and the parameter area must be a multiple of
+ STACK_BOUNDARY. */
#undef RS6000_STARTING_FRAME_OFFSET
#define RS6000_STARTING_FRAME_OFFSET \
- (RS6000_ALIGN (crtl->outgoing_args_size, 16) \
- + RS6000_SAVE_AREA)
+ (cfun->calls_alloca \
+ ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \
+ : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA))
+
+/* Offset from the stack pointer register to an item dynamically
+ allocated on the stack, e.g., by `alloca'.
+
+ The default value for this macro is `STACK_POINTER_OFFSET' plus the
+ length of the outgoing arguments. The default is correct for most
+ machines. See `function.c' for details.
+
+ This value must be a multiple of STACK_BOUNDARY (hard coded in
+ `emit-rtl.c'). */
#undef STACK_DYNAMIC_OFFSET
#define STACK_DYNAMIC_OFFSET(FUNDECL) \
- (RS6000_ALIGN (crtl->outgoing_args_size.to_constant (), 16) \
- + (STACK_POINTER_OFFSET))
+ RS6000_ALIGN (crtl->outgoing_args_size.to_constant() \
+ + STACK_POINTER_OFFSET, 16)
/* Darwin uses a function call if everything needs to be saved/restored. */