From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2067.outbound.protection.outlook.com [40.107.105.67]) by sourceware.org (Postfix) with ESMTPS id 9BFD23858D20 for ; Mon, 9 Jan 2023 14:58:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BFD23858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6RcudwA/Kw2LufMUdP/UiNiF4bD6hshs2R8owFDhx8s=; b=ymfMpHj9PlQehhFf0FQgl1tE7Q6fg8XmhZwOzDzD4TsSZdUaAIuzCDEPLvVbVF53Xyu3nId/k5VN0SLCPbwjrg/HlriB8ffcTnJbeJgyEtmDu5yIC4u37oZ7iSMz9Rf6TZz07BnM8DYZfwRNosTXHkFuAWUFhr/0fo4hSFEIFig= Received: from AM6P193CA0107.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::48) by GV2PR08MB8124.eurprd08.prod.outlook.com (2603:10a6:150:74::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 14:58:20 +0000 Received: from VI1EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:88:cafe::28) by AM6P193CA0107.outlook.office365.com (2603:10a6:209:88::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 14:58:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VI1EUR03FT039.mail.protection.outlook.com (100.127.144.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 14:58:19 +0000 Received: ("Tessian outbound 333ca28169fa:v132"); Mon, 09 Jan 2023 14:58:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0e15fc1460976f6b X-CR-MTA-TID: 64aa7808 Received: from 1817285b7964.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C1AD491E-DF2C-43C8-BE84-B43C6CF40FB8.1; Mon, 09 Jan 2023 14:58:11 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1817285b7964.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 09 Jan 2023 14:58:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hIL5BwnwkzFB4NgUfBHFdjUDznhi+GxyoHgJZ/FpfufqZeBU/TY915VX1NE7M7dfUZ6KQUzu0G13yEbaOCXvawEPJSuHIwU/IZDWqEzG+Jus340rcNdFOHHN2OsK6cMf/q7O3UrfMxDKt4FVxuutyL3X9PY1Ff5Bl9Y6BlXgu+HNXVn0zZIEQGCdXUTJIp8kDC7wtmkSXIVIH7FKWNcMMU4RJHBDTnGUfVo2sKRgj9xDl4FxMpcrWzkyICxn+oPV1niMqX6JrKX666CBV3eJ9hFUjrnpfMHUlQD1QRmuj1yyVCu4BHk3kTB24ufYXi+3+tAY/AunJX8cLED+AeiWfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6RcudwA/Kw2LufMUdP/UiNiF4bD6hshs2R8owFDhx8s=; b=kF3Uql2boiNJxy7cr6wGBTzIr1jGuS+hRgLkfrAT1LyVIRHfgcaiNSTknk2CF+FNW6piEcq8piDXzLjpze4Dz6t8th5tsDhcmrKBiKXbsZxsQQvbzjdnGI5H7azY1XOS1VbwvD1z3ZkfQainFU0Ed89G8eFhxqLfSiwAylFXWO1pWdp5GbDhYh1BCvS+lLaXyf/aJoEyLO8vOGkTDcAJabFThazbesRwdSnYQNzGCeFd/CnbqtndYa106xgK9sP5HYLFmG22uIPr7bS2zuGjfPtjvcktjLGDPJ5a2gyizCCUaKTHT4SXnv8UQR6sPaFHczMN2yRpIFL193aUwzgrYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6RcudwA/Kw2LufMUdP/UiNiF4bD6hshs2R8owFDhx8s=; b=ymfMpHj9PlQehhFf0FQgl1tE7Q6fg8XmhZwOzDzD4TsSZdUaAIuzCDEPLvVbVF53Xyu3nId/k5VN0SLCPbwjrg/HlriB8ffcTnJbeJgyEtmDu5yIC4u37oZ7iSMz9Rf6TZz07BnM8DYZfwRNosTXHkFuAWUFhr/0fo4hSFEIFig= Received: from DB6PR0801CA0056.eurprd08.prod.outlook.com (2603:10a6:4:2b::24) by AS8PR08MB9503.eurprd08.prod.outlook.com (2603:10a6:20b:61d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 14:58:06 +0000 Received: from DBAEUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:2b:cafe::96) by DB6PR0801CA0056.outlook.office365.com (2603:10a6:4:2b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 14:58:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT038.mail.protection.outlook.com (100.127.143.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 14:58:06 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 9 Jan 2023 14:58:06 +0000 Received: from e124257 (10.34.105.24) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:58:05 +0000 From: Andrea Corallo To: Andrea Corallo via Gcc-patches CC: Richard Earnshaw , nd , "Richard Earnshaw" Subject: Re: [PATCH 9/15] arm: Set again stack pointer as CFA reg when popping if necessary References: Date: Mon, 9 Jan 2023 15:58:05 +0100 In-Reply-To: (Andrea Corallo via Gcc-patches's message of "Wed, 26 Oct 2022 10:49:28 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT038:EE_|AS8PR08MB9503:EE_|VI1EUR03FT039:EE_|GV2PR08MB8124:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e6ca9fd-e17c-4135-6e60-08daf251f263 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6aeNkDp4UYditv/zOWm8uHGFpFTsdNE1kGFhxdecokDdvmgPooVB8vp4uTlu9m09KVV6z/IiFMbvPrY0Y4pmQviIP9Ac2U8fBKISNqNLSflEZ2CmNhK18usbMt8ZbOT1ShtDAjaOYhzvHSvQlprXHorcznLwaBIM25odxcLxtu6TGNdK6cGL6SN51lUv+qQGnI3KQXFb7zSIN5unoXF439QP0PQTdeq0QG2xj7WBJjAC7v1RlRQAqFG/WLPD7J95IVyqoUtu3+/UuZm5NS4U2cdoVE51EU28nd1Q1JfB9P6t+xMBb4Ve9ypA09MuRbCIWdnoItpK3rkaK2Cy5jBbnAF2mXR3SJVbUYYxzg/lwimtLk3i6VMMZcitMKWgNJvHT1glv7NkjZZ7b5BDXJfEeqmyLdZpZ4qQ2DHPdkdXtezhSJh0vJKGhEyp6RN3QN3oYFjA97z8qYtIf/OX0+XEzby/Fgb3O9U3DdgZobY7xB+XzyuGHptOmr3PXOjPNfGshglo6T3n02HuM9TTjUfzPye45p56HTBf87C9Ja+GvJR2F3xDUVNE2VjiPO9cSJRX70VCRqUZzvg+Jg3r8CdQTcW4gWqq6uFs2lNJbbZ62qc2CTnGXCUELvSonOtpko1D9wRiQta3jz8JcvkZ1OV1UCUOZa+vDq37Y9OyQSKrLIvIj7877/v4QMj3RtC0h2w3D/FM5lWS+TKJ/f0yphTFMw== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(346002)(376002)(39860400002)(136003)(396003)(451199015)(36840700001)(46966006)(40480700001)(36756003)(86362001)(54906003)(316002)(6916009)(70586007)(478600001)(2906002)(5660300002)(44832011)(70206006)(8676002)(41300700001)(4326008)(36860700001)(83380400001)(82740400003)(81166007)(356005)(2616005)(26005)(8936002)(53546011)(186003)(426003)(47076005)(336012)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9503 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 38055875-9301-41e6-52fd-08daf251ea78 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AEZq3LtHxlPfhHLxHW0bKmRp6hvVqLv7oaztMmaSahN1M+drO1/Cl1/qJ6g2xtR8tDLHZSovdL3R1wVRNfJZPUtqqsi8TJrtSW5eG/GlloNoAiCjF+Np8EEFNBymB2szDRVZBxbtrpc/2jGPxFTk2uNIzFlajAxm9Gd6lcz0bUFR2+ecZcveLvqIujw330z6AlqA5cdthdvlXPhKYBVKZA87GOSY88WDUprE6Y3nXGoBWzdCMHjTjt91KfpQiAodXIa3ZbRR5YG2bxVScaj9G6OzvlgUpOWTKK6O8WT7spNIOjnru4qKv4uo3zMOIuu9Rdx95174FqU61ZPZBcfj7MU+VZjpV6L+oLW/8WBYvsw22YgRjOaGckZqqTfoTBtumavp7KDtSGla1O8jfNrm8rUDED2qHQjqyYcA0t8I/ixuXoWMGzbuuzTeHS8XgMProCa/xon7u6alIuVOs1bzuLa4IbpkutcnEG8KHcxPOC+i7h9z3TrFUQrtayN5WCmlJgu2HD9a4iW7y3C12R9likNWVvFqiIY+vIG/E1QO+fR2QRWN7XX6OYz1kDnhkbDD90lqall/OKA8rLhJU540r4f5yfe3SoVXm7IgJekMr5LIVbxB8F29aWu1oEKHy7PsJzhjLFAH480dXTqR5IsscLyg2jh9ty8n4mPl8q3r7ceEvHOXNpj6oZ0jAawv2V55+MpIECWmmIKSxWc8Sd2KxQ== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(136003)(39860400002)(346002)(451199015)(36840700001)(46966006)(40470700004)(47076005)(426003)(82310400005)(40460700003)(86362001)(54906003)(316002)(6916009)(36756003)(40480700001)(81166007)(82740400003)(83380400001)(186003)(53546011)(336012)(2616005)(26005)(2906002)(44832011)(478600001)(5660300002)(8936002)(36860700001)(8676002)(4326008)(70586007)(70206006)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 14:58:19.8128 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e6ca9fd-e17c-4135-6e60-08daf251f263 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8124 X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Andrea Corallo via Gcc-patches writes: > Richard Earnshaw writes: > >> On 27/09/2022 16:24, Kyrylo Tkachov via Gcc-patches wrote: >>> >>>> -----Original Message----- >>>> From: Andrea Corallo >>>> Sent: Tuesday, September 27, 2022 11:06 AM >>>> To: Kyrylo Tkachov >>>> Cc: Andrea Corallo via Gcc-patches ; Richard >>>> Earnshaw ; nd >>>> Subject: Re: [PATCH 9/15] arm: Set again stack pointer as CFA reg when >>>> popping if necessary >>>> >>>> Kyrylo Tkachov writes: >>>> >>>>> Hi Andrea, >>>>> >>>>>> -----Original Message----- >>>>>> From: Gcc-patches >>>>> bounces+kyrylo.tkachov=arm.com@gcc.gnu.org> On Behalf Of Andrea >>>>>> Corallo via Gcc-patches >>>>>> Sent: Friday, August 12, 2022 4:34 PM >>>>>> To: Andrea Corallo via Gcc-patches >>>>>> Cc: Richard Earnshaw ; nd >>>>>> Subject: [PATCH 9/15] arm: Set again stack pointer as CFA reg when >>>> popping >>>>>> if necessary >>>>>> >>>>>> Hi all, >>>>>> >>>>>> this patch enables 'arm_emit_multi_reg_pop' to set again the stack >>>>>> pointer as CFA reg when popping if this is necessary. >>>>>> >>>>> >>>>> From what I can tell from similar functions this is correct, but could you >>>> elaborate on why this change is needed for my understanding please? >>>>> Thanks, >>>>> Kyrill >>>> >>>> Hi Kyrill, >>>> >>>> sure, if the frame pointer was set, than it is the current CFA register. >>>> If we request to adjust the current CFA register offset indicating it >>>> being SP (while it's actually FP) that is indeed not correct and the >>>> incoherence we will be detected by an assertion in the dwarf emission >>>> machinery. >>> Thanks, the patch is ok >>> Kyrill >>> >>>> >>>> Best Regards >>>> >>>> Andrea >> >> Hmm, wait. Why would a multi-reg pop be updating the stack pointer? > > Hi Richard, > > not sure I understand, isn't any pop updating SP by definition? Back on this, compiling: ======= int i; void foo (int); int bar() { foo (i); return 0; } ======= With -march=armv8.1-m.main+fp -mbranch-protection=pac-ret+leaf -mthumb -O0 -g Produces the following asm for bar. bar: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 1, uses_anonymous_args = 0 pac ip, lr, sp push {r3, r7, ip, lr} add r7, sp, #0 ldr r3, .L3 ldr r3, [r3] mov r0, r3 bl foo movs r3, #0 mov r0, r3 pop {r3, r7, ip, lr} aut ip, lr, sp bx lr The offending instruction causing the ICE (without this patch) when emitting dwarf is "pop {r3, r7, ip, lr}". The current CFA reg when emitting the multipop is R7 (the frame pointer). If is not the multipop that has the duty to restore SP as current CFA here which other instruction should do it? Best Regards Andrea