From db6b62a858e578fdb7f9f754f2c4bf868d951fcb Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Mon, 1 Oct 2018 12:53:34 +0000 Subject: [PATCH] stack-clash: Add LR assert to layout_frame. Since stack clash depends on the LR being saved for non-leaf functions this patch adds an assert such that if this changes we would notice this. gcc/ PR target/86486 * config/aarch64/aarch64.c (aarch64_layout_frame): Add assert. From-SVN: r264748 --- gcc/ChangeLog | 5 +++++ gcc/config/aarch64/aarch64.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 332f6dc707d..0d02631f38f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-10-01 Tamar Christina + + PR target/86486 + * config/aarch64/aarch64.c (aarch64_layout_frame): Add assert. + 2018-10-01 Jeff Law Richard Sandiford Tamar Christina diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 9fd5cb20d84..9507608da9a 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -4094,6 +4094,11 @@ aarch64_layout_frame (void) offset = 2 * UNITS_PER_WORD; } + /* With stack-clash, LR must be saved in non-leaf functions. */ + gcc_assert (crtl->is_leaf + || (cfun->machine->frame.reg_offset[R30_REGNUM] + != SLOT_NOT_REQUIRED)); + /* Now assign stack slots for them. */ for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED) -- 2.30.2