Hi All, 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.
Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. This patch has been pre-approved by AArch64 maintainer here https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00555.html and will be committed with the rest. Thanks, Tamar gcc/ChangeLog: 2018-09-26 Tamar Christina <tamar.christ...@arm.com> * config/aarch64/aarch64.c (aarch64_layout_frame): Add assert. --
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 283f3372798c84ef74356128acf2a5be7b4ce1ad..d4b13d48d852a70848fc7c51fd867e776efb5e55 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -4050,6 +4050,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)