public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tamar Christina <tamar.christina@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: nd@arm.com, james.greenhalgh@arm.com, Richard.Earnshaw@arm.com,
	Marcus.Shawcroft@arm.com
Subject: [PATCH 8/8][GCC][AArch64] stack-clash: Add LR assert to layout_frame.
Date: Wed, 26 Sep 2018 08:41:00 -0000	[thread overview]
Message-ID: <20180926083020.GA6256@arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

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.christina@arm.com>

	* config/aarch64/aarch64.c (aarch64_layout_frame): Add assert.

-- 

[-- Attachment #2: rb10023.patch --]
[-- Type: text/x-diff, Size: 686 bytes --]

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)


             reply	other threads:[~2018-09-26  8:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26  8:41 Tamar Christina [this message]
2018-10-09  6:38 ` Tamar Christina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180926083020.GA6256@arm.com \
    --to=tamar.christina@arm.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=james.greenhalgh@arm.com \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).