From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86501 invoked by alias); 26 Sep 2018 08:35:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 80381 invoked by uid 89); 26 Sep 2018 08:30:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:sk:EUR01-H, H*RU:sk:EUR01-H, Hx-spam-relays-external:sk:EUR01-H X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-he1eur01on0044.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Sep 2018 08:30:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ovxibErj/rNqyvhpLEX0lH0HRyi41K2VsGO33zk3pVY=; b=CKQZkQYxzx3brHLrk3cnZMtHJXlgma+tx7psj+MH2r9gLvgob5l3IPccFgycc0MsxZgz6FJAG9YMYMODnsAuDi/Ffnm5gl0np5fZdybnyqVa2P2C6dQQ66bTTOVvKOO0KR5lsbWt5fIZdCbd5A51FArcVp0YJslX6/sbWg1hkTA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tamar.Christina@arm.com; Received: from arm.com (217.140.106.52) by AM4PR0802MB2307.eurprd08.prod.outlook.com (2603:10a6:200:5f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Wed, 26 Sep 2018 08:30:24 +0000 Date: Wed, 26 Sep 2018 08:41:00 -0000 From: Tamar Christina 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. Message-ID: <20180926083020.GA6256@arm.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="DocE+STaALJfprDB" Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Return-Path: tamar.christina@arm.com Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg01502.txt.bz2 --DocE+STaALJfprDB Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-length: 533 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 * config/aarch64/aarch64.c (aarch64_layout_frame): Add assert. -- --DocE+STaALJfprDB Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="rb10023.patch" Content-length: 686 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) --DocE+STaALJfprDB--