From patchwork Wed Apr 9 10:36:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 110101 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 908653861836 for ; Wed, 9 Apr 2025 10:39:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 908653861836 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=S5aCfaug; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=S5aCfaug X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20614.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::614]) by sourceware.org (Postfix) with ESMTPS id 9ABAD384A892 for ; Wed, 9 Apr 2025 10:37:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9ABAD384A892 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 9ABAD384A892 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2614::614 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1744195046; cv=pass; b=rDeA5Hq3gfhGNR/59sgFqWJCmFftBPlgi9npCX5pQFWYZItjp3JlwBdj4JwzgKJ6KDeD4gjKszhxeg/rb2yQH0elhE/ERIM0/liSSBEugSODB/Mg8i9ddWEZZo6QPyTyCUPJ/Htoq01D7ole4VwQWaNeYnuomQJR8Asxe1Do4No= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1744195046; c=relaxed/simple; bh=KoT7HP0RDIUyvjJ9bR2swL06C2aoCGUhCMqwwzeAPY8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ffPXvClnYJx/1062YRCm1Ax7BgcqZHOSBx3+upJ4sTxgu+9Ro3WR3sMw8M47Ji0wszKiKAQxGQcR0n+MHQo/eKC8u+qRkQDV626uFv56aIVTw5fVj3MDGF8J0vbBTKNUUHHcV+OkVTfLckwRgHhfnBNLUaI0WANbpH9F7V+OdPY= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9ABAD384A892 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Qxgyz9FXq+xSFy1tQbehjPZPah5RQwk6E0pr75JiKE6/QGvcJW0u7msHUt/Ywcm1RjxtVVvYt/Ni3VFEL/LoFEAe4+pykx+/lKXZ0KKfRC1EIpkNQJnohykXvAmQplle5wOQh3aB2NPVdD61I+DvO4gb1Sp3/j3Ozx++YIYPFzCT2omf4Osse1eSaDIKd7defWVeh6gaV5nNQG94W4svRPh9TvbZGdRlsNxDpkuiyEDijYH+amvh797LZsd7PagqOZwmZul1bZqpO1MdU0QD+kbZZlx39WhsXgpWApYhFqwipFhbnbPgAGkHxE2t9YfZJWZFz76g6v1dlVpYUXjtJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=DECESQcVEZEhNGRVm7B4F3PpdFJbpSBGcp5Dpg7GLcs=; b=UKhvKm7mnOZZj1OHkZ3WOcSmotyvTUwY02I67vYzeCv4cRZVUIESG3734isxkrlhpZzhebaxYlTwrOWzJvRPh9L9aYTXDllXzGR2Z2IMGn5q6N7A4lKdoexSZb2ah+Oy6cJuH0UkUVzR9K+JUpE9HQTd/A93G5t/TQOTEUAIqNyFPr1B50lhp116I45vXXbPlHgWXSoaY4XmAGB1Z68vBN+viINkrZEMMFUAaRi0U1uSxv71lokUGduKmnXRI/0keokdZWqk+KAvVfFvzAoy9dSun4HaqnJo2EomfXwDhaXL87wzPxA58XAhIw89haqIhPdggW/6CqcTPy7DXhcEvw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 4.158.2.129) smtp.rcpttodomain=sourceware.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=arm.com; arc=pass (0 oda=0 ltdi=1) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DECESQcVEZEhNGRVm7B4F3PpdFJbpSBGcp5Dpg7GLcs=; b=S5aCfaug8LM6Fmb9f8CXtrI4pPqjrUKIPnPmBLHpFCsOCiYVOcjbJmHO5cbzHRTjvu2QXQuUU7Gs8SzgyfbunBoOMrQALjU07ANSiLXgFBFUqpk/sZw2f2iBSZY7aluusAOJxzXC+GG+m/Pt76zrXMhr1NOr+Le0uFUdw3FfcwI= Received: from AS4PR09CA0016.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::8) by VI1PR08MB5373.eurprd08.prod.outlook.com (2603:10a6:803:131::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8583.43; Wed, 9 Apr 2025 10:37:17 +0000 Received: from AMS1EPF00000044.eurprd04.prod.outlook.com (2603:10a6:20b:5d4:cafe::76) by AS4PR09CA0016.outlook.office365.com (2603:10a6:20b:5d4::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.36 via Frontend Transport; Wed, 9 Apr 2025 10:37:16 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by AMS1EPF00000044.mail.protection.outlook.com (10.167.16.41) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Wed, 9 Apr 2025 10:37:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aaVKYwK71cLWrT8YvJ7OkQbzZHKKzoxL/pKLOr4Wv4nf5VRRWyR4VwQjm7PEpOm8nEWagGPREOc3UDl3xKrkqvuvnNfMDQwoCZFwNNzF/IBvuYEOBvkgt+UbVPl3dccs3rOtoEzU0EViYIEnLOlxKqB8qCiT9KvJjQ1j96c6ra7a3pDW316XF2qV1dqsK+GAL4vERh+ZPilLA6eGl4Mc3Mdv0kcS4i/rv22N+HNK8K6TyZBj0wAVJmKa1elqoLsnSakM0ioRUvefHLbPF9FPVetY3hWTFDqJ9tFPb/MRNNEaT/qXSlh/RwWNbxjSu1JP352lstrYPG7cuQ8VVZkSiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=DECESQcVEZEhNGRVm7B4F3PpdFJbpSBGcp5Dpg7GLcs=; b=lJ4s581sy8k5YrYhDSqyU82ZFf9J3SGWxYR4tpPaF9zsaba/zCMhFlLTBSQ4DBjewx2Ke3UkJZxnTZUgT/V6PlxrLlu5hrAtHdyr/Jn9g/WR+hbLB+DQDsVi3JT8keVtj+8qldeQrq1b4DklrJxKIPIr6uvxEoOdEDhxvPQOm0IC47iIN78yMRKLUYy6lbEK8TwEK/LojSAbHIdfLvbAZ3Eb3rScihFnwxo3YyfXYiefoS1DO284lAnpdFWEnJOi/7B+11KPvGNr4tFHCT77n0P6w/DKWxpxX/63MI+MblPeDEWhHfnIIzsCKaHu15GXZJTA7XS3+CJs5LInDy9+qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 172.205.89.229) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=fail (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=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DECESQcVEZEhNGRVm7B4F3PpdFJbpSBGcp5Dpg7GLcs=; b=S5aCfaug8LM6Fmb9f8CXtrI4pPqjrUKIPnPmBLHpFCsOCiYVOcjbJmHO5cbzHRTjvu2QXQuUU7Gs8SzgyfbunBoOMrQALjU07ANSiLXgFBFUqpk/sZw2f2iBSZY7aluusAOJxzXC+GG+m/Pt76zrXMhr1NOr+Le0uFUdw3FfcwI= Received: from AM9P250CA0010.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::15) by AS2PR08MB9546.eurprd08.prod.outlook.com (2603:10a6:20b:60d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.34; Wed, 9 Apr 2025 10:36:42 +0000 Received: from AM4PEPF00027A5D.eurprd04.prod.outlook.com (2603:10a6:20b:21c:cafe::69) by AM9P250CA0010.outlook.office365.com (2603:10a6:20b:21c::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8632.22 via Frontend Transport; Wed, 9 Apr 2025 10:36:39 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 172.205.89.229) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; Received: from nebula.arm.com (172.205.89.229) by AM4PEPF00027A5D.mail.protection.outlook.com (10.167.16.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8632.13 via Frontend Transport; Wed, 9 Apr 2025 10:36:39 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX05.Arm.com (10.240.25.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 9 Apr 2025 10:36:37 +0000 Received: from PW070M4K.arm.com (10.57.82.178) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 9 Apr 2025 10:36:37 +0000 From: Matthieu Longo To: CC: Alan Modra , Hans-Peter Nilsson , "Jan Beulich" , Richard Earnshaw , Jens Remus , Matthieu Longo Subject: [PATCH v1 1/1] Enable arch-specific CFI directives and DWARF instructions only when required by the target (part 1) Date: Wed, 9 Apr 2025 11:36:11 +0100 Message-ID: <20250409103611.407140-2-matthieu.longo@arm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250409103611.407140-1-matthieu.longo@arm.com> References: <20250409103611.407140-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5D:EE_|AS2PR08MB9546:EE_|AMS1EPF00000044:EE_|VI1PR08MB5373:EE_ X-MS-Office365-Filtering-Correlation-Id: 4318f686-9c50-49a2-f487-08dd77527ec7 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info-Original: zC1lRios5k+/NzLYtlYzajYOX6vNT7Mbfx5DUyaCu9HfMM5jmpQ4bm4fx2Iruzu3jb8EHjrcyCP5H/p/z84d+NP8vljImnpy7YkADYZLM7VtRZ1BDDxD3UBtH6uLG2ji7YG9mkb3hJCNHpqWKYi136jzbRG+TKNrBV4RvTh1dFSQpzPCB2wV6VFOhpEACUDGNiIK5kgLYD8uoXxXHmNHbnYRFkToegceJtsobQsttu2aaDDjprldu0oGPFOi1Al3Svvk9ByZnwCsmvaaRV/1YrNvBJJ6qWuAqbeaQuzWusoCj9PIHePxpW0I5QdOA9PO7h7eDdO6o0HbWdUBsECRCZPbhsUYdGEp3JEYjAm1UIk+vwsY4wlZ2dHzHuVD5xwpQgpPZC6Tqa44//GJ5RUWeBoss3ByVrpAMEyJ6TraVFgkOn/PR+bfHA5P56xVeEWqbPqWXY8SmvxO41gjI9gc46WhG5HpSb5HxcVPX1visru2BBd0i7NSWOWC8RW6KxDVw7SdLAYIx8qwTxzNv/0akulUh8xQ5mhmGgb+BrX1hZzu8iUAg3OHKFf+UTMDGSBVTHxUoD2RH72eguQiNeeYQ02ivrwhAdJJgJwedkyogEsqyX+hdVylM+KuWJaHOOSY1HYsf4vwyOZCXuYtJ4RqHadygrWkZyJX9QEIFtN2sL6hZ6dnZwXLrwzj/DLWtum8fK7lWHBEhh3QWXH6hHLXwMrUdXeqEbR7iNFZBQAoxs90oIgqkiPHw4/XIj4dE9oA6QP733cg20PMX6jhY5nEw5JJLZVsXKYtcDO0mOKKJjvfANJFkP6xsdJhmbYwIKB9d1Y0oXJy7pvZrcXbWcsyJHXRlGH1ae6UraUbdI0bfey0a/bX5jOyi1LluDmBPPHRhYRjZ30dQpkcHFSX7iDEPIwUyoZg0eAVLD8bPWxnzxC8VRYeSDrxBMBI7y88h/uu3d9/fVvol8DmJzLlRSRaDmeLjVuycOOqm2qCvbNWTFOMZwDhPUbT8k+5idwYJhoDIngREhkqgv1Kotb9SzxVaLiiyrMN51pZw8c5NGspYatta55cfnbpi7SQLyDqyDVXLJbesqFkPhv/g/coMe+ocXyd6JnWMGah4l+zbWZZS/Ud1lOevj11l6Hd3WIuD6GkN3CD2o1trPJWihf93aZszTum79yD9WuJ37ogc3cBF6iFD8bVncg+rUpurugkpQ9JhVVFWlpbg3PCE9EK1zTI3Vdn1nshLvPtvhTnytxmR3CTjyI2ysM71L2Xo7PjFbc4ixH17tCHqaQukwwIcT212qmbdjRGvuImtrhwa4pcE1qtZoU1TFXNATABLGfkb1H0DlahVXlOCjvNIIBbyKlJjUhkK2Kit/mEqlNzGmzQ2xVs+B2kNKrkC/Hif6rroNq6xGQjH8W6mNgayLWkkjRN68o1WmA5cZ8WDV+4ZDVyVVk= X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9546 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000044.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a3d765a0-7434-4995-66d8-08dd77526948 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024|35042699022|14060799003; X-Microsoft-Antispam-Message-Info: XGxsm31IcqUkmIfl7rk49WDmwvi09vJqBqPwERL+kBDrX6771zkPNAeecvdwOJYkJSWw94X4miocLJD907SxrbWOpontI3d0kUIH6BJ99g1H4/lT7PSb+d9w0VlWtNGaHFCm1UoKajpIL5XA4+HOsRwy3laknfPLxycH84NNCRZo2MixPo0AHAKHqTJgsy1yrySdYdSnOmyxfSWzqJmilMbpAgVpudwI8TLweMqgjgI7MAYy7gp0fbUOT6rUetyYhsg/iGO9sqHh9Ob84m4T83sCETtu79PoFa3aqaSuteS3DJhX3KXXApGv9Swl86uBGgZXgTc+rJJ6hr/uVROnhhf+f8smnTZKVi0/iZRBWxPK6NDn0YDj8GuGudASj16z6J1FebXleteL6W55zgfOKT0SGlWFk3QhE5UctTD6JwZo7Q9J2CKiPnhWmuBrO2Rj7dxt0+kOGq5xVoewlj9KslA+0jnmF5TBhJQf6U/0/iNLDgUFMSQAY4a7EncJ30JQZE8i8tExWd2oyTKBWGvz5k7vWQ7r0JHQgJvEinHoLhD1VKvUdd/g+w10dg4U4ozZGKjmMYBiGdQHLROaOqVz3w/RG6wUWylhp4Vhyfy0FGbFzEVVhA+W+Qo+CRxJMhmsiJcZ0x4urU/Ei3hoTOMtbr6F1kBwdTl1b5xnziYvlT7tOcJg8GJUwvHCZzU48nNdPR1VIhvk5/0lrfN1GCUOtj62SQHxvRwkmn0ARrwrt3skYHs6E562rHbWtrXSD797RG3AaWYyTaiw4UFIv3GfdlK8jD+V3t26SEIyB6exuKTAlE6TTNUFjFqT8HPQ88jaipNAegJBvzrnURi0REFt8Z8GR+LozEhYi29ELb3oy+E/dnHKFTJove5hbn8PQ1jwDrbH73+LwEQgm/ic0ZP4OZv+2KezG3uJwFDmkvv3gxSkGXfH/eTAoNtWXs7NTzMyj/zRdxn4PGxfJQZ9NMuVImGojzx5xuHHTgeAJxl+lYNV5ENoDI30vnez6+CnOiThWxJuZ7H2rjnr4dgydlVrdYvo1I4aBQy02NuYOz2uPwdfR44dshkenbIYJ4lQRp6GUyg9g8fJEzS1rX8tI/FrhPLRxPox4cpAnf02lvHYb9oL5BcLDPDXnG1aYgIFBhDeUggd/UG9cnxSr1XoC1xGWsgvvPztn7lTVLfTt+yaI67FEeqwOOTjdlQlVNeOBsC6gzMQe/RxQmwmD1SXfkO91AR7CbbXJh/zUz1dCpk5MwQXvpg2OOlsUzZgJGry3hZeqoq1Rj0O7iAga7WqkwnPunVUhWUeQ/RNVRVJO7tINKexu4dIm6d5cw89CxXpyoWp0QCj00jiF6kcgFPmjgW7XR6ERt/OGH7re9fRrb4wTaZldtsli/vCvVAPKyBidLwXpWkhahfo9xwDtxICYl8iVOxxxb++9amRo0Y8VNBv28c= X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024)(35042699022)(14060799003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2025 10:37:15.2348 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4318f686-9c50-49a2-f487-08dd77527ec7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF00000044.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5373 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org DWARF 5 standard provides a space for vendor-specific DWARF directives. Binutils currently defines GNU-specific DWARF directives and vendor-specific ones for AArch64, SGI/MIPS, and Sparc architectures. The architecture specific code is not guarded. This has caused confusion in the past, and .cfi_window_save (a Sparc-specific directive) was used on AArch64 in place of .cfi_negate_ra_state, the defined directive by the "DWARF extensions on AArch64" document (see [1]). Gas only supports one target architecture (the one selected with --target), whereas others tools like readelf, objdump, etc. deduce the target architecture from the input object at runtime. Hence, using TC_ definitions to enable/disable DWARF directives at compilation time outside of gas is excluded. Since Gas is target-specific, the solution consists in detecting whether dwarf2.def is included from Gas or somewhere else. To do so, a new define MODULE_GAS was added in configure.ac to allow to detect the inclusion provenance, and the two following behaviors can be observed in dwarf2.def: - if MODULE_GAS is defined (included from gas folder), the architecture- specific DWARF instructions are enabled/disabled via TC_ defines. - if MODULE_GAS is undefined (included from bfd and binutils folders), all the DWARF instructions are defined (as it is today). In bfd, the architecture of the input object is detected at runtime using bfd_get_arch, and only the architecture-specific instructions matching the target of the object are considered during the processing. This patch deliberately excluded from the scope binutils/dwarf.c that also requires a check of the architecture at runtime. This part will be addressed in a follow-up patch. [1]: https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#id2 --- bfd/elf-eh-frame.c | 90 +++++++++++++++++++++++++++++++++++++++------- gas/config.in | 3 ++ gas/configure | 4 +++ gas/configure.ac | 2 ++ gas/dw2gencfi.c | 33 ++++++++++++++--- gas/gen-sframe.c | 35 ++++-------------- include/dwarf2.def | 38 ++++++++++++++++---- 7 files changed, 154 insertions(+), 51 deletions(-) diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 78b3ecb5a7d..cd2b5f03346 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -338,12 +338,79 @@ next_cie_fde_offset (const struct eh_cie_fde *ent, return sec->size; } +static bool +skip_cfa_op_aarch64 (bfd_byte op, + bfd_byte **iter ATTRIBUTE_UNUSED, + bfd_byte *end ATTRIBUTE_UNUSED) +{ + switch (op) + { + case DW_CFA_AARCH64_negate_ra_state: + case DW_CFA_AARCH64_negate_ra_state_with_pc: + /* No arguments. */ + return true; + + default: + return false; + } +} + +static bool +skip_cfa_op_mips (bfd_byte op, + bfd_byte **iter, + bfd_byte *end) +{ + switch (op) + { + case DW_CFA_MIPS_advance_loc8: + return skip_bytes (iter, end, 8); + + default: + return false; + } +} + +static bool +skip_cfa_op_sparc (bfd_byte op, + bfd_byte **iter ATTRIBUTE_UNUSED, + bfd_byte *end ATTRIBUTE_UNUSED) +{ + switch (op) + { + case DW_CFA_GNU_window_save: + /* No arguments. */ + return true; + + default: + return false; + } +} + +static bool +skip_cfa_op_arch_specific (enum bfd_architecture arch, + bfd_byte **iter, bfd_byte *end, + bfd_byte op) +{ + switch (arch) + { + case bfd_arch_aarch64: + return skip_cfa_op_aarch64 (op, iter, end); + case bfd_arch_mips: + return skip_cfa_op_mips (op, iter, end); + case bfd_arch_sparc: + return skip_cfa_op_sparc (op, iter, end); + default: + return false; + } +} + /* Assume that the bytes between *ITER and END are CFA instructions. Try to move *ITER past the first instruction and return true on success. ENCODED_PTR_WIDTH gives the width of pointer entries. */ static bool -skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) +skip_cfa_op (enum bfd_architecture arch, bfd_byte **iter, bfd_byte *end, + unsigned int encoded_ptr_width) { bfd_byte op = 0; bfd_vma length; @@ -351,15 +418,14 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) if (!read_byte (iter, end, &op)) return false; - switch (op & 0xc0 ? op & 0xc0 : op) + op = op & 0xc0 ? op & 0xc0 : op; + switch (op) { case DW_CFA_nop: case DW_CFA_advance_loc: case DW_CFA_restore: case DW_CFA_remember_state: case DW_CFA_restore_state: - case DW_CFA_GNU_window_save: - case DW_CFA_AARCH64_negate_ra_state_with_pc: /* No arguments. */ return true; @@ -410,10 +476,9 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) case DW_CFA_advance_loc4: return skip_bytes (iter, end, 4); - case DW_CFA_MIPS_advance_loc8: - return skip_bytes (iter, end, 8); - default: + if (op >= DW_CFA_lo_user && op <= DW_CFA_hi_user) + return skip_cfa_op_arch_specific (arch, iter, end, op); return false; } } @@ -424,8 +489,8 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) ENCODED_PTR_WIDTH is as for skip_cfa_op. */ static bfd_byte * -skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width, - unsigned int *set_loc_count) +skip_non_nops (enum bfd_architecture arch, bfd_byte *buf, bfd_byte *end, + unsigned int encoded_ptr_width, unsigned int *set_loc_count) { bfd_byte *last; @@ -437,7 +502,7 @@ skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width, { if (*buf == DW_CFA_set_loc) ++*set_loc_count; - if (!skip_cfa_op (&buf, end, encoded_ptr_width)) + if (!skip_cfa_op (arch, &buf, end, encoded_ptr_width)) return 0; last = buf; } @@ -994,7 +1059,8 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, include the padding. */ length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size); set_loc_count = 0; - insns_end = skip_non_nops (insns, end, length, &set_loc_count); + insns_end = skip_non_nops (bfd_get_arch (abfd), insns, end, length, + &set_loc_count); /* If we don't understand the CFA instructions, we can't know what needs to be adjusted there. */ if (insns_end == NULL @@ -1025,7 +1091,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, { if (*p == DW_CFA_set_loc) this_inf->set_loc[++cnt] = p + 1 - start; - REQUIRE (skip_cfa_op (&p, end, length)); + REQUIRE (skip_cfa_op (bfd_get_arch (abfd), &p, end, length)); } } diff --git a/gas/config.in b/gas/config.in index bb896244640..4f58c40d35b 100644 --- a/gas/config.in +++ b/gas/config.in @@ -173,6 +173,9 @@ /* Choose a default ABI for MIPS targets. */ #undef MIPS_DEFAULT_ABI +/* Building gas module */ +#undef MODULE_GAS + /* Define value for nds32_arch_name */ #undef NDS32_DEFAULT_ARCH_NAME diff --git a/gas/configure b/gas/configure index 16a8937f53a..b4fbc7922e4 100755 --- a/gas/configure +++ b/gas/configure @@ -12993,6 +12993,10 @@ cat >>confdefs.h <<_ACEOF _ACEOF + +$as_echo "#define MODULE_GAS 1" >>confdefs.h + + for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. diff --git a/gas/configure.ac b/gas/configure.ac index e97ec598b6f..d81746542e8 100644 --- a/gas/configure.ac +++ b/gas/configure.ac @@ -937,6 +937,8 @@ AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}", [Target CPU.]) AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", [Target vendor.]) AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.]) +AC_DEFINE(MODULE_GAS, 1, [Building gas module]) + AC_PROG_YACC AM_PROG_LEX diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index a21ae322488..d025da35676 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -720,9 +720,16 @@ const pseudo_typeS cfi_pseudo_table[] = { "cfi_same_value", dot_cfi, DW_CFA_same_value }, { "cfi_remember_state", dot_cfi, DW_CFA_remember_state }, { "cfi_restore_state", dot_cfi, DW_CFA_restore_state }, - { "cfi_window_save", dot_cfi, DW_CFA_GNU_window_save }, +#if TC_AARCH64 + /* cfi_window_save is an alias of cfi_negate_ra_state which is kept for + backward-compatibility concerns. */ + { "cfi_window_save", dot_cfi, DW_CFA_AARCH64_negate_ra_state }, { "cfi_negate_ra_state", dot_cfi, DW_CFA_AARCH64_negate_ra_state }, { "cfi_negate_ra_state_with_pc", dot_cfi, DW_CFA_AARCH64_negate_ra_state_with_pc }, +#endif /* TC_AARCH64 */ +#if TC_SPARC + { "cfi_window_save", dot_cfi, DW_CFA_GNU_window_save }, +#endif /* TC_SPARC */ { "cfi_escape", dot_cfi_escape, 0 }, { "cfi_signal_frame", dot_cfi, CFI_signal_frame }, { "cfi_personality", dot_cfi_personality, 0 }, @@ -919,13 +926,21 @@ dot_cfi (int arg) cfi_add_CFA_restore_state (); break; - case DW_CFA_GNU_window_save: - cfi_add_CFA_insn (DW_CFA_GNU_window_save); +#if TC_AARCH64 + case DW_CFA_AARCH64_negate_ra_state: + cfi_add_CFA_insn (DW_CFA_AARCH64_negate_ra_state); break; case DW_CFA_AARCH64_negate_ra_state_with_pc: cfi_add_CFA_insn (DW_CFA_AARCH64_negate_ra_state_with_pc); break; +#endif /* TC_AARCH64 */ + +#if TC_SPARC + case DW_CFA_GNU_window_save: + cfi_add_CFA_insn (DW_CFA_GNU_window_save); + break; +#endif /* TC_SPARC */ case CFI_signal_frame: frchain_now->frch_cfi_data->cur_fde_data->signal_frame = 1; @@ -1824,13 +1839,21 @@ output_cfi_insn (struct cfi_insn_data *insn) out_one (insn->insn); break; - case DW_CFA_GNU_window_save: - out_one (DW_CFA_GNU_window_save); +#if TC_AARCH64 + case DW_CFA_AARCH64_negate_ra_state: + out_one (DW_CFA_AARCH64_negate_ra_state); break; case DW_CFA_AARCH64_negate_ra_state_with_pc: out_one (DW_CFA_AARCH64_negate_ra_state_with_pc); break; +#endif /* TC_AARCH64 */ + +#if TC_SPARC + case DW_CFA_GNU_window_save: + out_one (DW_CFA_GNU_window_save); + break; +#endif /* TC_SPARC */ case CFI_escape: { diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index 5b5e7b14b3a..3a5ecda47de 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -1257,6 +1257,8 @@ sframe_xlate_do_restore (struct sframe_xlate_ctx *xlate_ctx, return SFRAME_XLATE_OK; } +#if TC_AARCH64 + /* Translate DW_CFA_AARCH64_negate_ra_state into SFrame context. Return SFRAME_XLATE_OK if success. */ @@ -1287,30 +1289,7 @@ sframe_xlate_do_aarch64_negate_ra_state_with_pc (struct sframe_xlate_ctx *xlate_ return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ } -/* Translate DW_CFA_GNU_window_save into SFrame context. - DW_CFA_GNU_window_save is a DWARF Sparc extension, but is multiplexed with a - directive of DWARF AArch64 extension: DW_CFA_AARCH64_negate_ra_state. - The AArch64 backend of GCC 14 and older versions was emitting mistakenly the - Sparc CFI directive (.cfi_window_save). From GCC 15, the AArch64 backend - only emits .cfi_negate_ra_state. For backward compatibility, the handler for - .cfi_window_save needs to check whether the directive was used in a AArch64 - ABI context or not. - Return SFRAME_XLATE_OK if success. */ - -static int -sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx, - struct cfi_insn_data *cfi_insn) -{ - unsigned char abi_arch = sframe_get_abi_arch (); - - /* Translate DW_CFA_AARCH64_negate_ra_state into SFrame context. */ - if (abi_arch == SFRAME_ABI_AARCH64_ENDIAN_BIG - || abi_arch == SFRAME_ABI_AARCH64_ENDIAN_LITTLE) - return sframe_xlate_do_aarch64_negate_ra_state (xlate_ctx, cfi_insn); - - as_warn (_("skipping SFrame FDE; .cfi_window_save")); - return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ -} +#endif /* TC_AARCH64 */ /* Handle DW_CFA_expression in .cfi_escape. @@ -1622,14 +1601,14 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx, case DW_CFA_restore: err = sframe_xlate_do_restore (xlate_ctx, cfi_insn); break; - /* DW_CFA_AARCH64_negate_ra_state is multiplexed with - DW_CFA_GNU_window_save. */ - case DW_CFA_GNU_window_save: - err = sframe_xlate_do_gnu_window_save (xlate_ctx, cfi_insn); +#if TC_AARCH64 + case DW_CFA_AARCH64_negate_ra_state: + err = sframe_xlate_do_aarch64_negate_ra_state (xlate_ctx, cfi_insn); break; case DW_CFA_AARCH64_negate_ra_state_with_pc: err = sframe_xlate_do_aarch64_negate_ra_state_with_pc (xlate_ctx, cfi_insn); break; +#endif /* TC_AARCH64 */ case DW_CFA_register: err = sframe_xlate_do_register (xlate_ctx, cfi_insn); break; diff --git a/include/dwarf2.def b/include/dwarf2.def index 6d6c0e0cc39..c9dd3e4aae3 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -780,20 +780,46 @@ DW_CFA (DW_CFA_val_offset, 0x14) DW_CFA (DW_CFA_val_offset_sf, 0x15) DW_CFA (DW_CFA_val_expression, 0x16) +/* Users extensions. + Note: DW_CFA_lo_user and DW_CFA_hi_user can be aliased to used as extension. + This is a closed interval. */ DW_CFA (DW_CFA_lo_user, 0x1c) -DW_CFA (DW_CFA_hi_user, 0x3f) -/* SGI/MIPS specific. */ +/* For gas, we disable the extensions according to the target architecture. */ +#ifdef MODULE_GAS +/* SGI/MIPS specific extensions. */ +#ifdef TC_MIPS DW_CFA (DW_CFA_MIPS_advance_loc8, 0x1d) -/* AArch64 extensions. */ +#endif /* TC_MIPS */ + +/* AArch64 specific extensions. */ +#ifdef TC_AARCH64 DW_CFA (DW_CFA_AARCH64_negate_ra_state_with_pc, 0x2c) -/* GNU extensions. - NOTE: DW_CFA_GNU_window_save is multiplexed on Sparc and AArch64. */ +DW_CFA (DW_CFA_AARCH64_negate_ra_state, 0x2d) +/* NOTE: DW_CFA_GNU_window_save is multiplexed on Sparc and AArch64. */ +DW_CFA_DUP (DW_CFA_GNU_window_save, 0x2d) +#endif /* TC_AARCH64 */ + +/* Sparc specific extensions. */ +#ifdef TC_SPARC DW_CFA (DW_CFA_GNU_window_save, 0x2d) -DW_CFA_DUP (DW_CFA_AARCH64_negate_ra_state, 0x2d) +#endif /* TC_SPARC */ +#else +/* SGI/MIPS specific extensions. */ +DW_CFA (DW_CFA_MIPS_advance_loc8, 0x1d) +/* AArch64 specific extensions. */ +DW_CFA (DW_CFA_AARCH64_negate_ra_state_with_pc, 0x2c) +DW_CFA (DW_CFA_AARCH64_negate_ra_state, 0x2d) +/* NOTE: DW_CFA_GNU_window_save is multiplexed on Sparc and AArch64. */ +DW_CFA_DUP (DW_CFA_GNU_window_save, 0x2d) +#endif + +/* GNU extensions. */ DW_CFA (DW_CFA_GNU_args_size, 0x2e) DW_CFA (DW_CFA_GNU_negative_offset_extended, 0x2f) +DW_CFA (DW_CFA_hi_user, 0x3f) + DW_END_CFA /* Index attributes in the Abbreviations Table. */