From patchwork Wed Feb 7 07:59:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejas Belagod X-Patchwork-Id: 1896041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=h2PKkcef; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=h2PKkcef; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TVCFw1gktz23g7 for ; Wed, 7 Feb 2024 19:00:04 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BE1E385828E for ; Wed, 7 Feb 2024 08:00:02 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2083.outbound.protection.outlook.com [40.107.15.83]) by sourceware.org (Postfix) with ESMTPS id 23F593858C60 for ; Wed, 7 Feb 2024 07:59:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23F593858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 23F593858C60 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.15.83 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1707292781; cv=pass; b=iuJ5dAK3HapEAFa5tQ/BXfvYYWtm7OrJ4KdA256778lmEts2RtSRyRoJxFRCmXnQw8/aPTKly2/4hosM1Rw7S3FAFYV71h9MjrOCs8Yj3I/wTuVPgP59F7WjLqcCrEVtOyxwXldvnK/ypDKlbAXeg45pdMVAIF+yRXczsCjwTCs= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1707292781; c=relaxed/simple; bh=FF5oUtewGez49B6Po3IyTvC3CUVaoddP5a0ypHmKmgM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=PyybzIMostMZ27uaevCnIflWVHq0so1hYYpoa7cf1Kf+deQNYjIyiOnaE2J6NaasSFo7ZmhSPhhRv5fEaHenAsQXqGivSAYzuHMpvi6xDUE/uQEAGJaULWOFPC6bSDvbq9/6j/52uOcS7AVT8NTUT7ZCrJM2sz4Jy8O2EEoNT2c= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=kJlDi2Xj6SCjQoaqCn6A+DCdilnJRlNHTFZSgcgVi5w5ZYM1cc1gwDY5zHdyPWB2LkyJ5v5iCNHbVHuoQKoXCDDdTVkq6z2KqchjS0EdK1KNV6AgrnlQLKzkxj6sRx0ph5fB2zcxBjAMH26ommQx/SpgrdTqUZ6oTmUK/8a6216KnGB/mThfiIAbgh5E5reaT6cU9esGflHOIZ6cuas2lQxtUHF1eoDOKbnzw+vOZImKppQ0LzBTPYraU8LqJZ4csBpdAFDtGuiQ+iuXkUAOi1SZv4SqSn3Pk2Dko9x9r+O2bNVwmn+RmunQT7DkAj4qFHKpfkl6jJ6QfzrKesdreg== ARC-Message-Signature: i=2; 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=3rPFvI/4GnHMxYa+ME11HAAle+bbM9DGQrRCbtEZUt0=; b=UGTnPuM3YBRKAmfspbJs10wBYaDzhZRKCVcxIjlSlp6egbacJGE2DkWEIsAicoHBnzw5wmaI4xSkxPw3jiukk7KnFNXuuHSPvVEWuuHXYYg8cKG/CLYabarqWG+fBMHW/qld3MsD78QLU5dx4RzwOQO6VT73v/hTS/Ro+fXOiD5secNefffmiD3eBR930EsqSOAYo2BzUWHdVqKYUhtcRUr2oSTBjqvOYEIy7+ra2JU+PoIei+8gMx99DBlow5w9Ppl47HZ9WzhrXa8YVHFe5clGn8aed10oBP1MDb66UdUKKxuTJ1sKL5xi8/8HyyNwfAOs7VeAZNhhZTiF1mHYVw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=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=3rPFvI/4GnHMxYa+ME11HAAle+bbM9DGQrRCbtEZUt0=; b=h2PKkcefrguy5nSNAkBReKRbVO7lo4QmOw1FxTMtoObHWSmIwU6EruEimEmartNEEViAyHpZRpgUB1hQvscST4+9sXImThOtl5UJS9KEtdAe+PebZlo47hxjsrMSGVKYWD4wKaeeNeSBsrjnA5m8xVTenbYgBvc/vwbu0BwTKe0= Received: from AS9PR06CA0050.eurprd06.prod.outlook.com (2603:10a6:20b:463::13) by AS2PR08MB8263.eurprd08.prod.outlook.com (2603:10a6:20b:552::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36; Wed, 7 Feb 2024 07:59:36 +0000 Received: from AMS1EPF00000040.eurprd04.prod.outlook.com (2603:10a6:20b:463:cafe::3a) by AS9PR06CA0050.outlook.office365.com (2603:10a6:20b:463::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Wed, 7 Feb 2024 07:59:36 +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 AMS1EPF00000040.mail.protection.outlook.com (10.167.16.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Wed, 7 Feb 2024 07:59:35 +0000 Received: ("Tessian outbound c87008563c51:v228"); Wed, 07 Feb 2024 07:59:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 833a729965ed971f X-CR-MTA-TID: 64aa7808 Received: from 7adcd1fbf101.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9A313F82-D354-476B-8B03-DBF8B91EB133.1; Wed, 07 Feb 2024 07:59:28 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7adcd1fbf101.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 07 Feb 2024 07:59:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QLVtftC8WveEYcPLHotpHbgMcmJ3kVXdixEANyUy43pqltkQetbzOjEdjlBMCJSrgPS4dBCABtJAQ5Aq/jPmo6X3FNwKb42FeMB1YoU5K75YakYL0wsNIK3X66O427hgVveLkU6ySChPD1mmSjvEIzrmEXBBpla8NIVZM2t7OWetSY7b5/9mS0t7uvVjSGkiLlqnKu2ZJ8kxde2m4tED/iIQTNcEpOV8wKlTywhyOEUA0AVDycsupk8Qv8Bs43snmJON9xHb8HdB9aG/ERi81cgjaqRGc4hlu/mF985Fgm88vc6oNA6n6jlKkHoEMsnrPyVBV1/df52rN9QFgn2mZg== 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=3rPFvI/4GnHMxYa+ME11HAAle+bbM9DGQrRCbtEZUt0=; b=VGxlu938+eIhe4dIACtRhLSa+g4lfXZi+hFS2/OEhTXkhzJJi50c9/8pX6p5uemWKI2mT4cGlLTJDmLK/6GzOnsJ/q5mz392UHlcUYSMViif9jJ+2SUmJO2VOgOBevEk99trabWcdsXCWvv93gw8+dnPgAYxDAJxLcZvBwgO+QmtDw8XxjQIbrqrfIzn7sY2dbtBfwaWphG36N+J/uMyaVSud97pLYfKv/5QGVcczgMBfB8pSHjTDFczM+J2moby3WA2rTyM7UeH6zT2wYpgVHTTj3MTXBnLB1ZlLOZSs6DdvAFceM7I8D8kydi8Fo2srkN6LQNyW3P3UNaxJQQiTQ== 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 (0) 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=3rPFvI/4GnHMxYa+ME11HAAle+bbM9DGQrRCbtEZUt0=; b=h2PKkcefrguy5nSNAkBReKRbVO7lo4QmOw1FxTMtoObHWSmIwU6EruEimEmartNEEViAyHpZRpgUB1hQvscST4+9sXImThOtl5UJS9KEtdAe+PebZlo47hxjsrMSGVKYWD4wKaeeNeSBsrjnA5m8xVTenbYgBvc/vwbu0BwTKe0= Received: from DU2P250CA0008.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:231::13) by DB9PR08MB6764.eurprd08.prod.outlook.com (2603:10a6:10:2ac::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36; Wed, 7 Feb 2024 07:59:26 +0000 Received: from DB1PEPF000509F6.eurprd02.prod.outlook.com (2603:10a6:10:231:cafe::ea) by DU2P250CA0008.outlook.office365.com (2603:10a6:10:231::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Wed, 7 Feb 2024 07:59:26 +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 DB1PEPF000509F6.mail.protection.outlook.com (10.167.242.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Wed, 7 Feb 2024 07:59:26 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX04.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.32; Wed, 7 Feb 2024 07:59:26 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 7 Feb 2024 07:59:25 +0000 Received: from a078660.blr.arm.com (10.162.46.14) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Wed, 7 Feb 2024 07:59:24 +0000 From: Tejas Belagod To: CC: Tejas Belagod , Subject: [PATCH] Arm: Fix incorrect tailcall-generation for indirect calls [PR113780] Date: Wed, 7 Feb 2024 13:29:21 +0530 Message-ID: <20240207075921.2151371-1-tejas.belagod@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB1PEPF000509F6:EE_|DB9PR08MB6764:EE_|AMS1EPF00000040:EE_|AS2PR08MB8263:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bfe3119-1d7e-4630-c0df-08dc27b2ba0b 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: e3vuvxJM56F9d0x5LOdIjnB44J/8VWLd98yUsuiz/WgQlf+Zag/dGMeK/1PQ1MimW/xFO/RybmbM0p+2HnDCoZn1MVkAihdb1IUPlRuhO4Q78gh11rNSEg19xj+2QE4/J7JCqtggP7ry3/+416HRxg3UEVuSWOYaC4OSPE6vEg9owPIU1NRZTRZMK3tjNOmF1Q+eY5icl7plbA+UFCWDdR6ioX99+YhLF49BHutjYf24/zgGPoIp2mDYXMCSkUXYQmYtfA1r6me+oNkZZb+H3WMRmQYCSHaO8cUuITCgsXShQLieQU4GO6YK8UMHJOVuMWWQ3mPgVMCgvdF4HJpRw4DUVLAidh96JmtoDPFZfFfdzXFWzsw05Tor6cFMAjpisRrkwLvQpg+PS2ffY78MqzPztUVGSXMhaTYw5cdeWyAfuj3xBtpEECLlAkqhp6AktPiYoePSVCXL6hMsFzb0NzVS8mja8uBufhOLawvMfDgUcrnEaGdBLSlXVt7IARZgBvL1v5dVuiO6d2mpb3phnASn0VjOYlQO/gf6lYN9fuwmsF1HIe22rIGv0a8T/YL0WREhehG7mhHoXyexPRg0mewbc2UQXh+9eL0sdxMQuZ+iz0hwAJD+0a22Y7bfG7cMRbcgBKCjIjPBSzbFyLF/+z0c9TSmWTphhDU+/vUCzYGuVdzjqoXwlFzwDiiwQMGBu+CUeEuuPRqmhui/RuC7+ufbhcAhc5Vwd0bVjtyr2brxFVWZO62nK5k6EmAB14J1 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:(13230031)(4636009)(136003)(39860400002)(396003)(346002)(376002)(230922051799003)(451199024)(64100799003)(82310400011)(1800799012)(186009)(46966006)(40470700004)(36840700001)(1076003)(2616005)(86362001)(26005)(426003)(41300700001)(478600001)(2906002)(44832011)(5660300002)(70586007)(316002)(54906003)(6916009)(336012)(8676002)(36756003)(8936002)(4326008)(70206006)(6666004)(36860700001)(40480700001)(40460700003)(81166007)(84970400001)(47076005)(82740400003)(356005)(7696005)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6764 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000040.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8052f6e0-75db-443d-4d9b-08dc27b2b498 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qzJR5OvWR3F5kGGCW7+iNrXsKvAIyzDU2310pWwN0OBtLO80CeLyYic6gWmeRuUNfAaFKj6Ds/pQy2RL+eAHmGz4n5WUAfhCCUWZvNTfFt/I4Z4/xVVJSwm47MeTZ9qr897+LZufouf1tE4CH4fK7AygFLDrWgY/3i2+4wOLI3Z3dYsnE8+ENAEE8Dzh2p673j9e+XWYrPlL/cWYOFbN7RsB+i93GM2EQWm0F3+l02clhu32ClVi5+DTmNqkDNzE9aAvrhWkQ8MtNG4OlndjeJBn5rykGT8e4Wb6SvAHDdQrtNKUgs1RD0OLfr1BvwCLM+AD3Ag6zB+lWQ+PbJvswm3Ssz/v/YDZRr/wbcDX4q3X4FEq/iX7XOHbNQBsaliTsXNC6GWutFPAAt77a21OgSI7MCbXVMDtRhNRjsn+yvSNzcgDYqvSx4aMcpZNwhqsJFhfGCRnMm6+bZjEoPbfLEzpylho5DXU0sAIxWR+467o2+30+7mQumTGdIXmPmfIjyaENFF7JtDNlPMUoldLG5gx5suP9qiW89XYn42uthOTxSwSJk27qCTErgIokWs8hFhuTYj0653yiBrRhrK887oAFKIUTGUptlpZYPc0CmgrbslfP0G+d4Kqmq5ZPnERVeQgKqS6iadg9X+xF8/OyRsk+/3hRUoBPZgI9dWBpdhhSeHLMqsg0LwjNq/5yTRr0P9Meyc0AGAzdZsKE8cRaZMTXWKcMwXYsEXkKzOFNAQ= 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:(13230031)(4636009)(136003)(346002)(376002)(396003)(39860400002)(230922051799003)(451199024)(64100799003)(82310400011)(1800799012)(186009)(40470700004)(36840700001)(46966006)(40460700003)(84970400001)(40480700001)(44832011)(5660300002)(2906002)(41300700001)(83380400001)(336012)(426003)(1076003)(26005)(47076005)(2616005)(86362001)(81166007)(7696005)(70206006)(54906003)(6916009)(478600001)(6666004)(36756003)(70586007)(82740400003)(36860700001)(4326008)(8936002)(8676002)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2024 07:59:35.8293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bfe3119-1d7e-4630-c0df-08dc27b2ba0b 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: AMS1EPF00000040.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8263 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org This patch fixes a bug that causes indirect calls in PAC-enabled functions to be tailcalled incorrectly when all argument registers R0-R3 are used. Tested on arm-none-eabi for armv8.1-m.main. OK for trunk? 2024-02-07 Tejas Belagod PR target/113780 * gcc/config/arm.cc (arm_function_ok_for_sibcall): Don't allow tailcalls for indirect calls with 4 or more arguments in pac-enabled functions. * gcc.target/arm/pac-sibcall.c: New. --- gcc/config/arm/arm.cc | 12 ++++++++---- gcc/testsuite/gcc.target/arm/pac-sibcall.c | 11 +++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/pac-sibcall.c diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index c44047c377a..c1f8286a4d4 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -7980,10 +7980,14 @@ arm_function_ok_for_sibcall (tree decl, tree exp) && DECL_WEAK (decl)) return false; - /* We cannot do a tailcall for an indirect call by descriptor if all the - argument registers are used because the only register left to load the - address is IP and it will already contain the static chain. */ - if (!decl && CALL_EXPR_BY_DESCRIPTOR (exp) && !flag_trampolines) + /* We cannot do a tailcall for an indirect call by descriptor or for an + indirect call in a pac-enabled function if all the argument registers + are used because the only register left to load the address is IP and + it will already contain the static chain or the PAC signature in the + case of PAC-enabled functions. */ + if (!decl + && ((CALL_EXPR_BY_DESCRIPTOR (exp) && !flag_trampolines) + || arm_current_function_pac_enabled_p())) { tree fntype = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (exp))); CUMULATIVE_ARGS cum; diff --git a/gcc/testsuite/gcc.target/arm/pac-sibcall.c b/gcc/testsuite/gcc.target/arm/pac-sibcall.c new file mode 100644 index 00000000000..c57bf7a952c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-sibcall.c @@ -0,0 +1,11 @@ +/* Testing return address signing. */ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options " -mcpu=cortex-m85 -mbranch-protection=pac-ret+leaf -O2" } */ + +void fail(void (*f)(int, int, int, int)) +{ + f(1, 2, 3, 4); +} + +/* { dg-final { scan-assembler-not "bx\tip\t@ indirect register sibling call" } } */