From patchwork Mon Mar 10 17:51:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107595 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 73A973858C2C for ; Mon, 10 Mar 2025 17:59:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73A973858C2C 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=Ah2cgTzY; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=Ah2cgTzY X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061f.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::61f]) by sourceware.org (Postfix) with ESMTPS id 29A313858D39 for ; Mon, 10 Mar 2025 17:52:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29A313858D39 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 29A313858D39 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2614::61f ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629146; cv=pass; b=LqwzAQNufpKVFeHX5F3XSH3FJhoy/uYkKfpxONOtJlLrSiDHcWdNiVCYb8cFnSgU5nxEJcJBOxtupmLw3YmZkesGAY2ZL7TBQoH7ztoN6p5+i479IIzaPef/V6tl0YFcMSqM4aUdgpVaNJhRRfEUZtIPsyYz3//KkwWHss+yBqY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629146; c=relaxed/simple; bh=oyaY5+m3JYWM2CtHvwjkbLgANm2NAhmv/swFSa16B28=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=fcM3YjwJ6Um+7bgmVEa4y397Qi+3IzUp/zlGdNEaWRcKxVGiAE2lCrwAUir+BhrrEcrb+AA+fvM3Mr1XGkZ0bFcdcP5vbaFqOTZJkgpo0mJ2BCCed8CGrA17zbhdTBkpJ2c6PPxC7VUkocAFqKO0QTnQ0k0iE0JyWHHnIr9vYa0= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29A313858D39 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=yKLKw3sYwtNZUwRjNTSSQCrvhkrvPVOsNfXnEz9IdXn1f7ZgZ7+nw5ZrpPbC+hIwUQlMNs0PkvJADbGoxCz8rPjs+DBFX5a2l/KhWoOa494K/cL5CwPlva4L0uPUGYkIqDevovqfaAzMty+QrOLKTQgvvIz6QkmZ/XJ2uYwce12z4mgyrFB8BHw5/DaDAGEqKrAq2QHxyj0c3Kx12qY4mJjS+sgzLh6SX42QZP0vfQCu9CtLfodi5R2+8uAc7kH8MRKjimI/tgXl7axZS7tzx1w+uhM0IWv2jUD1v6d0wNY5Rovpgz4CjvIiRH7hQX4bvgauAMxRCV2vxyR6eduzWA== 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=TwGPWuDAbmsSNMn7p61Z1T9pUOXw5d8LyMFUpHvhYhk=; b=XhA/py+40AN/N5zLFatR9XzVnWEgM0HSbgj0I4n+71fN6eoUuwrjfhzdZhFRdifho1ZwSzmQg2xVv254Gs1kSKid2G2gPnWafzZTuvUcflHP7eQwfd43NdhPq++e/pz9PPpIy6cotbEeUkE54XvM/I6XtO/f2ofPfa//9pagR4fPz43vZDATVcIiesUW6EUvpJyQik/xBIPc/Q1HGTZBIq0z6y2whYOQEU7Ok5R9LuXMOMg3AJKCM+TqQjFYbR897xPKS1qbecbC8HRNbT47yG4WYbil++NwyVR6GmcUrj6OFDWcZ3+ClWtdTyCajsrIbv+PkKDMkLfkVw4vWwGvkg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=TwGPWuDAbmsSNMn7p61Z1T9pUOXw5d8LyMFUpHvhYhk=; b=Ah2cgTzY/1Q3Lk4YsJaB2xohiQAC99V8PXgmH570TviGZzZffvrdUVddwN5L/dg4k9XDGqoKX34mvg5DHEZhBL+VJ1LfYKGdNIq6YQYzVdCa67mlt3dzC100T2loM3kml3bTeq5tOTfWVXiRV1r2oMG+yCmzwR5kwIDcTv6wCOI= Received: from DUZPR01CA0086.eurprd01.prod.exchangelabs.com (2603:10a6:10:46a::13) by DU0PR08MB7857.eurprd08.prod.outlook.com (2603:10a6:10:3b3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:52:16 +0000 Received: from DU6PEPF00009526.eurprd02.prod.outlook.com (2603:10a6:10:46a:cafe::f3) by DUZPR01CA0086.outlook.office365.com (2603:10a6:10:46a::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:16 +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=arm.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 DU6PEPF00009526.mail.protection.outlook.com (10.167.8.7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:16 +0000 Received: ("Tessian outbound 93a06e49d4fd:v585"); Mon, 10 Mar 2025 17:52:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9c3d531540b5ad44 X-TessianGatewayMetadata: sU7Kv3FHePwfGSxHTShPkE0vF415vz+lN6E/TLfTkJhKwl2h2QkF15p7L1Qe5L0WcgCmqQr9/IqNa0aGcinEM8Rwgt/K7VLTvXlGV/r9axABtVazomXdOQ6vUn1xgCpkIjiSIoKdnccG6/MX4tkaUQoUImJYQrSPGXK+u6SZZME= X-CR-MTA-TID: 64aa7808 Received: from La16e72b78324.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 788B76E2-5407-4C3F-9D36-57F15135613C.1; Mon, 10 Mar 2025 17:52:09 +0000 Received: from OSPPR02CU001.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id La16e72b78324.2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:52:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tLahPXjsaqAhVJJVkzvoxtHunJ2yptQ5nqh2PxLhOqNjdDYg75mlMopelCbr3myh1BIA+Kmx0zDoiV5XKAtuOxEl2qEJ6RlA9HCnQNqfMYJXRwMznWApoyj05ZjTKvs6b+07M9dC7STxvYD0z93jt5DF5SaCc46iPUDrqdZtdOGsuK4GBBL/uPFq0Tkx+DpB+ezO8QDemKVoJBlrOG/Rq+2kmNR043Xnhg5FEZN8nUhY0KvpgOzE4ZYFTPor7apGEMfTAMoFmdfAiycn+XmzxpbbKG89MNFjAJ4ReeHntvW7mizs7aIk/QiTiTaRk/xs8E2sKlos2iK8B9q8NwLiPA== 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=TwGPWuDAbmsSNMn7p61Z1T9pUOXw5d8LyMFUpHvhYhk=; b=uw6gBOxwHLoM5+1UHBkKPROQWOQZ5SVRm9qr6D8DshrIVqy5c40MwhAggJhZF45pZ7eFWvMgkQQZkzMbn41GmCdgnsMsxx3Y1LW5tOT0gltBAV10VX3y4KuIdrpY2LvKDGwTYM1pYfoypSWx/ION/inEf32lSvyM8KEtbYIHYiEVWuigInN4i+JrP3lZD+YO1X1XCmEu4xURhhHJEUIgGn21bLzcxGzIwPSlpjOdBfU1/Cr8LwPc7rsWsXIYSFmiu1kB7pzPRu4Coopaf+IN631fz+EPqu3J7ix433DpeqNHy02CCgshmt7GPKfiTKvjJSTgL1iWeMGSq380p+iqRA== 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=TwGPWuDAbmsSNMn7p61Z1T9pUOXw5d8LyMFUpHvhYhk=; b=Ah2cgTzY/1Q3Lk4YsJaB2xohiQAC99V8PXgmH570TviGZzZffvrdUVddwN5L/dg4k9XDGqoKX34mvg5DHEZhBL+VJ1LfYKGdNIq6YQYzVdCa67mlt3dzC100T2loM3kml3bTeq5tOTfWVXiRV1r2oMG+yCmzwR5kwIDcTv6wCOI= Received: from AS4P195CA0022.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5d6::10) by AM0PR08MB5475.eurprd08.prod.outlook.com (2603:10a6:208:188::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:52:01 +0000 Received: from AMS0EPF00000195.eurprd05.prod.outlook.com (2603:10a6:20b:5d6:cafe::b1) by AS4P195CA0022.outlook.office365.com (2603:10a6:20b:5d6::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:01 +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 AMS0EPF00000195.mail.protection.outlook.com (10.167.16.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:01 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Mar 2025 17:51:53 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:51:52 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 01/15] libiberty: add implementations of common methods for type-sensitive doubly linked lists Date: Mon, 10 Mar 2025 17:51:14 +0000 Message-ID: <20250310175131.1217374-2-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF00000195:EE_|AM0PR08MB5475:EE_|DU6PEPF00009526:EE_|DU0PR08MB7857:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a859d3b-f9f0-44fc-6e9d-08dd5ffc4ba4 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info-Original: O1OKb9XOiG5LobMK29djfh/M+FPG7Wb0ytuOp5zBrK3qO9UCK4yxD4CxFP7yOo+sWuykHPTBj+/pRA/hg6EhXupvHYh5Efld4WI4xM5Sj3gs9u8rOSfS++b/oUBA5X/qjOpMVj499j39k/jbVwINg5hGvgyXHCRx6mYkuY4BIQvoKeHZsEvO9c3rXlWxqw4qnPEwyeLYwI6J10V8/eXst/mUCIsffPH0+pAsb/NAHzwYF75bAyicfGBSxd/SJq93vyql05cq98kXOOQDhXmIrb1JOg5Ack8ZrPB4uWH9CLv98+Mbt0XrsnNHSEu9PNE8rgxyHPhPNKH3EH5pk12zC21HFjnUwRSJm+pLURbqcdkpN8VgZk/JC3t7G937p2v1yNCyRlJin3ZE0RWSB/kXr/6ayN0aRU0Sbcu5F1ugS4mak2IY0V58mmr/6GxrHzRyeHMWrSRV45yVdNoYWeAsgYCyfTxUeNTIygZfdNm35iVF420snPBhRZjVz8IrbNrTsoynPEejfKJU5g8KAcw67h2NOoQRg9+PH+3Lv1srths+hwoea4VGRbiJBWABIhHMBrrk8BQuYQBfZpWrA/3muxyv3gniPbfIUmDXfUfhoHgB1P/NTtgiqN4nKI+B/RD+DzLESe4wL1nC1MGPUTeF6fTC3P8qxYwRS/HI59iCAp3hs18iWRmL5ZtJ60b3OJJVmAT2SQ78Rvc/r8Pzq1VrOi5/eAqJzpRLhtIZecXFUBfJdybtn3swrLCbLseak9/VaPIbEZ+ydJJ4fuvqtsze/zdUOj9l4b4D4Qd79HC6Y13VqHC3jSl37IESLCnpdSymkC1oPyXN9k4dkWwB0cK4uxTdHolxswr2TYR3TcXO6xZsu7JpyDhftvvZLj74oG1nnYT3PO9f1X50s48tqOpVZnFU2VrasKnfmENECm2OnlbX5uWtIkB38By4T5nSfXFkA6RyPGINMZ79p8fWnLErB2sTPlyinu9IAfy5RWaYDYvuLVo5lcO+r64ENJcHNjQ69qMe45F0BD8GR/6k3uaYkxyXTpXA7GUXOy9m3wbmY7/uFcQQx8TONZcWLcIbtfVAagHrYZvp8nTQdUSDjTv7nLZIYH+hW1mDYQhU09kWI3evgT/a15r58cAkqdUhu4mTkf77N0TZJNEx790mj9m8LIedND7EnmpsXl/YTISnK7yCbH0xHPTj04hAFbqk/ncc4SZ7thdHpZWDdftjtSHy/I48qTu2ZIIkrIjzx5bDhLTNR1zTA3hvwaS2JenOMficNnZcO5X85kTlsFmAkuoyuqrfAMhdg2oMwdDKgozIdRik78MY5Ukg8ALYA2TTgwrhpKbdu4dqxYH0O0mX3MOqWg5yhEDNAZC+W+7+AHYK6t5JFePPA7YnF967vLn7LyhItWq5oQSRduMlDluzsk+DO3Mm8YPXnycGDLZSvY0fjqs= 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5475 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:5d6::10]; domain=AS4P195CA0022.EURP195.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU6PEPF00009526.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 75836800-8991-4edc-3c71-08dd5ffc42cd X-Microsoft-Antispam: BCL:0; ARA:13230040|14060799003|1800799024|35042699022|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: PDBiVLKky+mUuwnfuk6JwLivWg74gGVm/gzCZr6Vb60u3MD7gvLausYxXKclJWUQk4LVUIWqMkz3DkpF43HQEyNzF3xAW2zENEyiV5+exTrn48adSdTuIPpMZvzKM5Lr2y9gRwBiLbWuU9ZIBv0kNyiAUJ/RQwyXxELXtIbP6Af7Jm8H8iaFYdnquDl/T1560apytTC4fF2JWoQMBfdS7tNDVJJb33IrSsbs0i7HJAbtYj7uhjqvJaTidXmJRZI6evVJcfoiBFNsGlh29zSKUpLYq36ILw+F1TrCD/opX8Qz0+Fn8lph/w1xFHVB1F2Okc6RPU/0Od5K2k3SiCxy84HamfCsrkZVV+a6UwNHzEmSsHndCwOWxjqHaySigXKVM2VBNScXA16Oo31/K/3OaMfkWcfSW5Nizy7drtVGwAJPj96I+/JgIg/+GtsXTPIFDJ1le+9BGZ6de3HKzoLSmARmuarIGsox19EElsLqgVA+5oRw0Kg5PdZTJ2OciTrHGJZZGeZaTubqeyIIVz7rD4wvd2q/y5CpMWTprTLrUHvV1QKM4nVfiWmnQNTZuDjWPw0fnbWevMQkvexYlXq9taXLroJ/eCq891SDDqzCrsj8xz79wQnh4e8qzkZ+1hf37LC8Zw9YD2QDedXg9ki/7XLls3QUFgKuej4Sjh+ZSVxk7a03NO0GdGu0bpda0/gSU5vmhDbjA+FQ/7Gm2/v6ClngkVilKqAfpJ+yLPlTtaYEprnGK8mUcEp10GqsXmaJsDdUHMOpl35efwo4ZuK3xM/vSBxgl7ItNoZpzEXIw2NJ5cOQRvbgZIyWOBuMMRb1BXUmvwsY+9dIb2Wdpc9M/iOrIDWMeaEp6a1B1yWm1sBrF5h8FHjJtW+bmXSXWyXNGwsiIGJhnpiXy4+TuajYoLzf7NVMoSp7FIRaPJo3KxWsM79qEdGjW07HJJ82jkqpjuQ4A6jcKrX40f3EhAK0NnfEGTC7EJXYquyzsEFJWnnoxa6eu97RP0Ovx41E6KTmheDMF3UL9DKb+1AZea5mD0yKZiJdsBba012CeGBiZBtlH3bXgfZ1eRXSLVCSw7j6uutryyUZI9dnYGKgxCM7Efv/CXOMrC7dnwETNKyYQk4E5K3X17NakC33UC8xgN70qzzDKHQHYxeDW96ht+XJOpi+GgI6cILb8suSzC4DBsl2wEnXPf65QX/I956Ozqt8XrQicm4InCf2B7J8p8knH9WlGBA6BbrfuldKXoQhegv06+M8e2sqtCeb5W6KNLtgYVIPC6okvlpP88f03rcjS8PZwhcKcyVZcwFez4tBHyBBkI2vclt+pmdnrdmH+R9zraViBuv2fWAXOH/tcn/8Mqjw65QDL9TuqEmLlJBpnHIAUcWR2eHGbaMTMWOueXNsz2bvKP9CVHg9bbmPqI55yZzGxZ49sjZeIot4T45F//k= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(14060799003)(1800799024)(35042699022)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:52:16.1943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a859d3b-f9f0-44fc-6e9d-08dd5ffc4ba4 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: DU6PEPF00009526.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7857 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 Those methods's implementation is relying on duck-typing at compile time. The structure corresponding to the node of a doubly linked list needs to define attributes 'prev' and 'next' which are pointers on the type of a node. The structure wrapping the nodes and others metadata (first, last, size) needs to define pointers 'first_', and 'last_' of the node's type, and an integer type for 'size'. Mutative methods are bundled together and are declarable once via a same macro. The merge sort is bundled separately. There are 3 types of macros: 1. for the declaration of protypes: to use in a header file for a public declaration, or as a forward declaration in the souce file for private declaration. 2. for the declaration of the implementation: always to use in a source file. 3. for the invokation of the functions. The methods are declarable public or private via the second argument of the declaration macros. List of currently implemented methods: - LINKED_LIST_: - APPEND: insert a node at the end of the list. - PREPEND: insert a node at the beginning of the list. - INSERT_BEFORE: insert a node before the given node. - POP_FRONT: remove the first node of the list. - POP_BACK: remove the last node of the list. - REMOVE: remove the given node from the list. - LINKED_LIST_MERGE_SORT: a merge sort implementation. --- include/double-linked-list.h | 313 +++++++++++++++++++++++++ libiberty/Makefile.in | 1 + libiberty/testsuite/Makefile.in | 12 +- libiberty/testsuite/test-linked-list.c | 244 +++++++++++++++++++ 4 files changed, 569 insertions(+), 1 deletion(-) create mode 100644 include/double-linked-list.h create mode 100644 libiberty/testsuite/test-linked-list.c diff --git a/include/double-linked-list.h b/include/double-linked-list.h new file mode 100644 index 00000000000..4bd41933d71 --- /dev/null +++ b/include/double-linked-list.h @@ -0,0 +1,313 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + + +#pragma once + +#include + + +/*********************** + * Mutative operations * + ***********************/ + +#define LINKED_LIST_MUTATIVE_OPS_PROTOTYPE(LWRAPPERTYPE, LTYPE, EXPORT) \ + EXPORT void \ + LTYPE##_append (LWRAPPERTYPE *wrapper, LTYPE *new_); \ + \ + EXPORT void \ + LTYPE##_prepend (LWRAPPERTYPE *wrapper, LTYPE *new_); \ + \ + EXPORT void \ + LTYPE##_insert_before (LWRAPPERTYPE *wrapper, \ + LTYPE *new_, \ + LTYPE *where); \ + \ + EXPORT LTYPE * \ + LTYPE##_pop_front (LWRAPPERTYPE *wrapper); \ + \ + EXPORT LTYPE * \ + LTYPE##_pop_back (LWRAPPERTYPE *wrapper); \ + \ + EXPORT LTYPE * \ + LTYPE##_remove (LWRAPPERTYPE *wrapper, LTYPE *node) + + +#define LINKED_LIST_APPEND(LTYPE) LTYPE##_append +#define LINKED_LIST_PREPEND(LTYPE) LTYPE##_prepend +#define LINKED_LIST_INSERT_BEFORE(LTYPE) LTYPE##_insert_before +#define LINKED_LIST_POP_FRONT(LTYPE) LTYPE##_pop_front +#define LINKED_LIST_POP_BACK(LTYPE) LTYPE##_pop_back +#define LINKED_LIST_REMOVE(LTYPE) LTYPE##_remove + + +#define LINKED_LIST_MUTATIVE_OPS_DECL(LWRAPPERTYPE, LTYPE, EXPORT) \ +/* Note: all the mutative operations below also update the data in */ \ +/* the wrapper, i.e. first_, last_ and size. */ \ +\ +/* Append the given node new_ to the exising list. */ \ +EXPORT void \ +LTYPE##_append (LWRAPPERTYPE *wrapper, LTYPE *new_) \ +{ \ + if (wrapper->last_) \ + { \ + new_->prev = wrapper->last_; \ + wrapper->last_->next = new_; \ + } \ + else \ + { \ + new_->prev = NULL; \ + wrapper->first_ = new_; \ + } \ + wrapper->last_ = new_; \ + ++wrapper->size; \ +} \ +\ +/* Prepend the given node new_ to the exiting list. */ \ +EXPORT void \ +LTYPE##_prepend (LWRAPPERTYPE *wrapper, LTYPE *new_) \ +{ \ + if (wrapper->first_ == NULL) \ + wrapper->last_ = new_; \ + else \ + { \ + new_->next = wrapper->first_; \ + wrapper->first_->prev = new_; \ + } \ + wrapper->first_ = new_; \ + ++wrapper->size; \ +} \ +\ +/* Insert the given node new_ after where in the existing list. */ \ +/* If where == NULL, the insertion is equivalent to an append. */ \ +/* If where == first_, the insertion is equivalent to a prepend. */ \ +EXPORT void \ +LTYPE##_insert_before (LWRAPPERTYPE *wrapper, \ + LTYPE *new_, \ + LTYPE *where) \ +{ \ + if (where == wrapper->first_) \ + LTYPE##_prepend (wrapper, new_); \ + else if (where == NULL) \ + LTYPE##_append (wrapper, new_); \ + else \ + { \ + where->prev->next = new_; \ + new_->prev = where->prev; \ + where->prev = new_; \ + new_->next = where; \ + ++wrapper->size; \ + } \ +} \ +\ +/* Pop the first node of the list. */ \ +EXPORT LTYPE * \ +LTYPE##_pop_front (LWRAPPERTYPE *wrapper) \ +{ \ + LTYPE *front_node = wrapper->first_; \ + if (front_node != NULL) \ + { \ + wrapper->first_ = front_node->next; \ + if (front_node->next != NULL) \ + { \ + front_node->next->prev = NULL; \ + front_node->next = NULL; \ + } \ + if (wrapper->last_ == front_node) \ + wrapper->last_ = NULL; \ + --wrapper->size; \ + } \ + return front_node; \ +} \ +\ +/* Pop the last node of the list. */ \ +EXPORT LTYPE * \ +LTYPE##_pop_back (LWRAPPERTYPE *wrapper) \ +{ \ + LTYPE *back_node = wrapper->last_; \ + if (back_node != NULL) \ + { \ + wrapper->last_ = back_node->prev; \ + if (back_node->prev != NULL) \ + { \ + back_node->prev->next = NULL; \ + back_node->prev = NULL; \ + } \ + if (wrapper->first_ == back_node) \ + wrapper->first_ = NULL; \ + --wrapper->size; \ + } \ + return back_node; \ +} \ +\ +/* Remove the given node from the existing list, and return the */ \ +/* previous node. */ \ +EXPORT LTYPE * \ +LTYPE##_remove (LWRAPPERTYPE *wrapper, LTYPE *node) \ +{ \ + LTYPE *previous = NULL; \ + \ + if (node->prev != NULL) \ + { \ + node->prev->next = node->next; \ + if (node->next == NULL) \ + wrapper->last_ = node->prev; \ + else \ + node->next->prev = node->prev; \ + previous = node->prev; \ + --wrapper->size; \ + } \ + else \ + LTYPE##_pop_front (wrapper); \ + \ + node->next = NULL; \ + node->prev = NULL; \ + \ + return previous; \ +} + + +/*********** + * Sorting * + ***********/ + +#define _LINKED_LIST_MERGE_SORT(LTYPE) _##LTYPE##_merge_sort + +#define LINKED_LIST_MERGE_SORT(LTYPE) LTYPE##_merge_sort + +#define _LINKED_LIST_MERGE_SORT_PROTOTYPE(LTYPE, EXPORT) \ + EXPORT LTYPE * \ + _##LTYPE##_merge_sort (LTYPE *node, int (*fn_cmp)(LTYPE *, LTYPE *)) + +#define LINKED_LIST_MERGE_SORT_PROTOTYPE(LWRAPPERTYPE, LTYPE, EXPORT) \ + EXPORT void \ + LTYPE##_merge_sort (LWRAPPERTYPE *wrapper, int (*fn_cmp)(LTYPE *, LTYPE *)) + +#define LINKED_LIST_MERGE_SORT_DECL(LWRAPPERTYPE, LTYPE, EXPORT) \ + \ +static LTYPE * \ +_##LTYPE##_merge_sort_compute_turtle (LTYPE *node) \ +{ \ + if (node == NULL) \ + return node; \ + \ + LTYPE *turtle = node, *hare = node->next; \ + while (hare != NULL && hare->next != NULL) \ + { \ + turtle = turtle->next; \ + hare = hare->next->next; \ + } \ + return turtle; \ +} \ + \ +static LTYPE * \ +_##LTYPE##_merge_sort_merge (LTYPE *l_left, LTYPE *l_right, \ + int (*fn_cmp) (LTYPE *, LTYPE *)) \ +{ \ + if (l_left == NULL) \ + return l_right; \ + else if (l_right == NULL) \ + return l_left; \ + \ + LTYPE *l_out, *current = NULL; \ + \ + LTYPE * _update (LTYPE *n) \ + { \ + if (current == NULL) \ + { \ + current = n; \ + l_out = current; \ + n->prev = NULL; \ + } \ + else \ + { \ + current->next = n; \ + n->prev = current; \ + current = n; \ + } \ + \ + return n->next; \ + } \ + \ + LTYPE *l_l = l_left, *l_r = l_right; \ + while (l_l != NULL && l_r != NULL) \ + { \ + int cmp = fn_cmp (l_l, l_r); \ + if (cmp <= 0) \ + l_l = _update (l_l); \ + else \ + l_r = _update (l_r); \ + } \ + \ + for (; l_l != NULL; l_l = l_l->next) \ + { \ + current->next = l_l; \ + l_l->prev = current; \ + current = current->next; \ + } \ + \ + for (; l_r != NULL; l_r = l_r->next) \ + { \ + current->next = l_r; \ + l_r->prev = current; \ + current = current->next; \ + } \ + \ + return l_out; \ +} \ + \ +/* Merge sort implementation taking the first node of the list to */ \ +/* sort, and the comparison function. Returns the first node of the */ \ +/* sorted list. */ \ +/* Note: use this if you don't care about updating the information */ \ +/* in the wrapper. */ \ +EXPORT LTYPE * \ +_##LTYPE##_merge_sort (LTYPE *node, int (*fn_cmp)(LTYPE *, LTYPE *)) \ +{ \ + assert (fn_cmp != NULL); \ + if (node == NULL) \ + return NULL; \ + else if (node->next == NULL) \ + return node; \ + \ + LTYPE *left_end = _##LTYPE##_merge_sort_compute_turtle (node); \ + LTYPE *left_begin = node; \ + LTYPE *right_begin = left_end->next; \ + /* break the list. */ \ + left_end->next = NULL; \ + right_begin->prev = NULL; \ + \ + left_begin = _##LTYPE##_merge_sort (left_begin, fn_cmp); \ + right_begin = _##LTYPE##_merge_sort (right_begin, fn_cmp); \ + return _##LTYPE##_merge_sort_merge (left_begin, right_begin, fn_cmp); \ +} \ + \ +/* Merge sort wrapper that the end-user should be using as it updates */ \ +/* the first_ and last_ metadata of the list in wrapper as well. */ \ +/* If the user does not want to pay the cost of the update of the */ \ +/* data, it can directly use _##LTYPE##_merge_sort_merge. */ \ +EXPORT void \ +LTYPE##_merge_sort (LWRAPPERTYPE *wrapper, int (*fn_cmp)(LTYPE *, LTYPE *)) \ +{ \ + wrapper->first_ = _##LTYPE##_merge_sort (wrapper->first_, fn_cmp); \ + \ + if (wrapper->first_ == NULL || wrapper->first_->next == NULL) \ + wrapper->last_ = wrapper->first_; \ + else \ + for (LTYPE *node = wrapper->first_; \ + node != NULL; \ + node = node->next) \ + wrapper->last_ = node; \ +} diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index b11df756b4b..a92491ca4cf 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -236,6 +236,7 @@ CONFIGURED_OFILES = ./asprintf.$(objext) ./atexit.$(objext) \ INSTALLED_HEADERS = \ $(INCDIR)/ansidecl.h \ $(INCDIR)/demangle.h \ + $(INCDIR)/double-linked-list.h \ $(INCDIR)/dyn-string.h \ $(INCDIR)/fibheap.h \ $(INCDIR)/floatformat.h \ diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in index 2b0883c7630..f3aa5f7f236 100644 --- a/libiberty/testsuite/Makefile.in +++ b/libiberty/testsuite/Makefile.in @@ -45,7 +45,8 @@ all: check: @CHECK@ really-check: check-cplus-dem check-d-demangle check-rust-demangle \ - check-pexecute check-expandargv check-strtol + check-pexecute check-expandargv check-strtol \ + check-linked-list # Run some tests of the demangler. check-cplus-dem: test-demangle $(srcdir)/demangle-expected @@ -69,6 +70,10 @@ check-expandargv: test-expandargv check-strtol: test-strtol ./test-strtol +# Check the linked list functionality +check-linked-list: test-linked-list + ./test-linked-list + # Run the demangler fuzzer fuzz-demangler: demangler-fuzzer ./demangler-fuzzer @@ -90,6 +95,10 @@ test-strtol: $(srcdir)/test-strtol.c ../libiberty.a $(TEST_COMPILE) -DHAVE_CONFIG_H -I.. -o test-strtol \ $(srcdir)/test-strtol.c ../libiberty.a +test-linked-list: $(srcdir)/test-linked-list.c + $(TEST_COMPILE) -DHAVE_CONFIG_H -I.. -o test-linked-list \ + $(srcdir)/test-linked-list.c + demangler-fuzzer: $(srcdir)/demangler-fuzzer.c ../libiberty.a $(TEST_COMPILE) -o demangler-fuzzer \ $(srcdir)/demangler-fuzzer.c ../libiberty.a @@ -104,6 +113,7 @@ mostlyclean: rm -f test-pexecute rm -f test-expandargv rm -f test-strtol + rm -f test-linked-list rm -f demangler-fuzzer rm -f core clean: mostlyclean diff --git a/libiberty/testsuite/test-linked-list.c b/libiberty/testsuite/test-linked-list.c new file mode 100644 index 00000000000..0a249eca294 --- /dev/null +++ b/libiberty/testsuite/test-linked-list.c @@ -0,0 +1,244 @@ +#include +#include +#include + +#include "double-linked-list.h" + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +/* Implementation */ + +typedef int T; + +typedef struct ListNodeType +{ + T value; + struct ListNodeType *next; + struct ListNodeType *prev; +} ListNodeType; + +ListNodeType * l_new_node (T value) +{ + ListNodeType *n = malloc (sizeof (ListNodeType)); + n->next = NULL; + n->prev = NULL; + n->value = value; + return n; +} + +typedef struct LinkedListWrapperType +{ + ListNodeType *first_; + ListNodeType *last_; + size_t size; +} LinkedListWrapperType; + +int compare_nodes (ListNodeType *n1, ListNodeType *n2) +{ + if (n1->value == n2->value) + return 0; + else if (n1->value < n2->value) + return -1; + else + return 1; +} + +LINKED_LIST_MUTATIVE_OPS_DECL (LinkedListWrapperType, ListNodeType, static) +LINKED_LIST_MERGE_SORT_DECL (LinkedListWrapperType, ListNodeType, static) + +ListNodeType * find_last_node (ListNodeType *head) +{ + if (head == NULL) + return NULL; + + ListNodeType *n = head; + while (n->next != NULL) + n = n->next; + + return n; +} + +void l_print (ListNodeType *node) +{ + for (ListNodeType *l = node; l != NULL; l = l->next) + printf ("%d ", l->value); + printf ("\n"); +} + +void l_reverse_print (ListNodeType *last_node) +{ + for (ListNodeType *l = last_node; l != NULL; l = l->prev) + printf ("%d ", l->value); + printf ("\n"); +} + +struct test_data_t +{ + T const *content; + size_t size; +}; + +bool run_test (const struct test_data_t *expect, + LinkedListWrapperType *current, + bool reversed) +{ + ListNodeType *node = (reversed) ? current->last_ : current->first_; + bool passed = true; + for (int i=0; isize && node != NULL; ++i) + { + if (reversed) + { + if (expect->content[expect->size - 1 - i] != node->value) + { + printf ("FAIL: mismatching expected (%d) VS current (%d).\n", + expect->content[expect->size - 1 - i], node->value); + passed = false; + } + if (node->prev == NULL && current->first_ != node) + { + printf ("FAIL: first_ is not matching the first node.\n"); + passed = false; + } + } + else + { + if (expect->content[i] != node->value) + { + printf ("FAIL: mismatching expected (%d) VS current (%d).\n", + expect->content[i], node->value); + passed = false; + } + if (node->next == NULL && current->last_ != node) + { + printf ("FAIL: last_ is not matching the last node.\n"); + passed = false; + } + } + + if (!passed) + return false; + + if (reversed) + node = node->prev; + else + node = node->next; + } + + if (node != NULL) + { + printf ("FAIL: the list is longer than expected.\n"); + passed = false; + } + if (expect->size != current->size) + { + printf ("FAIL: size (%d) is not matching the real size of the list (%d).\n", + current->size, expect->size); + passed = false; + } + + return passed; +} + +bool check(const char *op, + const struct test_data_t *expect, + LinkedListWrapperType *wrapper) +{ + bool success = true; + bool res; + + l_print (wrapper->first_); + res = run_test (expect, wrapper, false); + printf ("%s: test-linked-list::%s: check forward conformity\n", + res ? "PASS": "FAIL", op); + success &= res; + + l_reverse_print (wrapper->last_); + res = run_test (expect, wrapper, true); + printf ("%s: test-linked-list::%s: check backward conformity\n", + res ? "PASS": "FAIL", op); + success &= res; + + return success; +} + +const int EXPECT_0 [] = { 10, 4, 3, 1, 9, 2 }; +const int EXPECT_1 [] = { 1, 2, 3, 4, 9, 10 }; +const int EXPECT_2 [] = { 11, 1, 2, 3, 4, 9, 10 }; +const int EXPECT_3 [] = { 11, 1, 2, 3, 4, 9, 8, 10 }; +const int EXPECT_4 [] = { 11, 2, 3, 4, 9, 8, 10 }; +const int EXPECT_5 [] = { 2, 3, 4, 8, 9, 10, 11 }; +const int EXPECT_6 [] = { 3, 4, 8, 9, 10, 11 }; +const int EXPECT_7 [] = { 3, 4, 8, 9, 10 }; +const struct test_data_t test_data[] = { + { .content = EXPECT_0, .size = sizeof(EXPECT_0) / sizeof(EXPECT_0[0]) }, + { .content = EXPECT_1, .size = sizeof(EXPECT_1) / sizeof(EXPECT_1[0]) }, + { .content = EXPECT_2, .size = sizeof(EXPECT_2) / sizeof(EXPECT_2[0]) }, + { .content = EXPECT_3, .size = sizeof(EXPECT_3) / sizeof(EXPECT_3[0]) }, + { .content = EXPECT_4, .size = sizeof(EXPECT_4) / sizeof(EXPECT_4[0]) }, + { .content = EXPECT_5, .size = sizeof(EXPECT_5) / sizeof(EXPECT_5[0]) }, + { .content = EXPECT_6, .size = sizeof(EXPECT_6) / sizeof(EXPECT_6[0]) }, + { .content = EXPECT_7, .size = sizeof(EXPECT_7) / sizeof(EXPECT_7[0]) }, +}; + +int main (void) +{ + int failures = 0; + + LinkedListWrapperType wrapper = { + .first_ = NULL, + .last_ = NULL, + .size = 0, + }; + + /* Append nodes. */ + LINKED_LIST_APPEND(ListNodeType) (&wrapper, l_new_node (10)); + LINKED_LIST_APPEND(ListNodeType) (&wrapper, l_new_node (4)); + LINKED_LIST_APPEND(ListNodeType) (&wrapper, l_new_node (3)); + LINKED_LIST_APPEND(ListNodeType) (&wrapper, l_new_node (1)); + LINKED_LIST_APPEND(ListNodeType) (&wrapper, l_new_node (9)); + LINKED_LIST_APPEND(ListNodeType) (&wrapper, l_new_node (2)); + + failures += ! check ("append", &test_data[0], &wrapper); + + /* Sort nodes (without updating wrapper). */ + wrapper.first_ = + _LINKED_LIST_MERGE_SORT(ListNodeType) (wrapper.first_, compare_nodes); + wrapper.last_ = find_last_node (wrapper.first_); + + failures += ! check ("sort", &test_data[1], &wrapper); + + /* Save a reference to this node for later. */ + ListNodeType *n_to_remove = wrapper.first_; + + /* Prepend node. */ + LINKED_LIST_PREPEND(ListNodeType) (&wrapper, l_new_node (11)); + failures += ! check ("prepend", &test_data[2], &wrapper); + + /* Insert node. */ + LINKED_LIST_INSERT_BEFORE(ListNodeType) (&wrapper, l_new_node (8), wrapper.last_); + failures += ! check ("insert_before", &test_data[3], &wrapper); + + /* Remove a node. */ + LINKED_LIST_REMOVE(ListNodeType) (&wrapper, n_to_remove); + failures += ! check ("remove", &test_data[4], &wrapper); + + /* Sort nodes. */ + LINKED_LIST_MERGE_SORT(ListNodeType) (&wrapper, compare_nodes); + failures += ! check ("sort", &test_data[5], &wrapper); + + /* Pop front. */ + LINKED_LIST_POP_FRONT(ListNodeType) (&wrapper); + failures += ! check ("pop_front", &test_data[6], &wrapper); + + /* Pop back. */ + LINKED_LIST_POP_BACK(ListNodeType) (&wrapper); + failures += ! check ("pop_back", &test_data[7], &wrapper); + + exit (failures ? EXIT_FAILURE : EXIT_SUCCESS); +} From patchwork Mon Mar 10 17:51:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107591 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 A8C3A385840B for ; Mon, 10 Mar 2025 17:55:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8C3A385840B 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=YyZ1CsqM; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=YyZ1CsqM X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20631.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::631]) by sourceware.org (Postfix) with ESMTPS id 5C0C43858C56 for ; Mon, 10 Mar 2025 17:52:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C0C43858C56 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 5C0C43858C56 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::631 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629155; cv=pass; b=YkqPuyvU4/Hjfz9UMY30jacBBZEPpDldhPDpUfLFtRKkb9rbebTkOQWUCKGgE88+aCEJQ8QvEzY2RxvQJp2CBNDn6OSo199ZpL2rYqDSxi6PsLQMSK6+UVsJvfMj6ZlYET/W9XYQQSM+e+XFixjzo7CTxhkatXHv6oek+lQpKvw= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629155; c=relaxed/simple; bh=ti3D0djlLoi50Q00kmDefMyyV5svE42nOwgOpXkYQtg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=HEfkHcVQp1kNDyDmBRRbcCN1Ut9vWCyXs/NUG1vDSC8AxKG3/dHkBgAdaSDEOCtlCa4aDn6TEmQ6hnwX1HUmP6ZsoZn4J8c4/WuIw1vDB83tacpKKLd9KkEXSU7ABskYHyRqprQN4Ub3UdLlZB298cNv92eKTh9gzv8SHXq6WGQ= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C0C43858C56 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=lnDLBHC6g5lNajVj9nEB/zHyNTBynpZS7Ovvqh0mDVYrqZ7HePsFia5otTPT+XDlXYAsfBPs/mRad8g5GQpVEmE9zk94rNs3uJmCCWXuUxgw8hjwJm3hzLCeYw+HRYME+IX9vTJOl5W0NET47ku77MpmKP7anL2fjuObwpUFz4iCjRtcMMj+xA9TpAlggx0Qw369B1DPxc4eLrpkGXZsFxdDXsVqEjYJ4V3D/SsyE353eZmjTCffqyNUnkZJ9WMumrMkRCPzho6T1TqrQEouToO4wKnHqOw0qNCZFFEDs9b80lUQFjC+F+jzUpdC9lRlC2Ff9ukQ0KffSikn1rQsaw== 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=yH/PiKb6oZT4KSo127ZaehFlOAS78FyXESmRFxLTj4w=; b=Wl/1H+xbNalYVnwpItvMFecuo+SXTtsEqVQtiV9Jf25aVWldmLlK26FPikjol4pFaA4ybgms3cFNOx+T+WFdyrhWHHXdUmrgxoz7acYSeoGGkDU1U9ODfQER3y8a89sGoP4iysEnZ4YO41mlHIXJ5+1sv+7tjOfDmBQdMv4Z4n9BaHBzZ4gwgjpiHmNexSMoaJs3vns4yW0c5jeAVbusxVuG02JKn98PU+6MwPz6+MTKf1FHzqqdrBnEOvOCb5xaszZBDQZ6A+493QQDKwne4oX4alr7QvehnMZ1vlpAebXdLTssvyuchMfLOtjVfH37IDaUHZiKMNYfDyHnfncWtg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=yH/PiKb6oZT4KSo127ZaehFlOAS78FyXESmRFxLTj4w=; b=YyZ1CsqMvyF5iLf4d+X+1cyFd1lWia316ex0uScQyu2eUEGzk9lhg3bx/PhIyAGdL4wyhYDhxs8YZQHYebcJhxPJi6BCLkVxkUovM+IRJUDoqbXmJJsbRLCMq5lIDISDlZRLT7lfRfRpO7JnpRHmUAWf8NKB4zFnxqxGwm5Wvuw= Received: from DUZPR01CA0345.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::28) by DB9PR08MB7557.eurprd08.prod.outlook.com (2603:10a6:10:304::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:52:28 +0000 Received: from DU2PEPF0001E9C6.eurprd03.prod.outlook.com (2603:10a6:10:4b8:cafe::8e) by DUZPR01CA0345.outlook.office365.com (2603:10a6:10:4b8::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:28 +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=arm.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 DU2PEPF0001E9C6.mail.protection.outlook.com (10.167.8.75) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:28 +0000 Received: ("Tessian outbound bc832f6acacf:v585"); Mon, 10 Mar 2025 17:52:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4ae768df8691df0b X-TessianGatewayMetadata: iOgZ1ZOvHyq86AwDTuZqyPOKdANwIld6ywIxz1zBk9nvWAkxdNIbar3kzmmKTagEe8yGex2nfMSAMuT7bLf5gJfBK9BpSvL7NhHQLwgcSQqvMuxS0XzKEdPXNaISUsVrJ6QFTyfk0X4LNNt2jBKE3WIHLDXyl2Uzo+JBtVbtXX8= X-CR-MTA-TID: 64aa7808 Received: from Ld0414c92e702.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B197C756-6ECF-4B3A-A452-B26A967101EB.1; Mon, 10 Mar 2025 17:52:16 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Ld0414c92e702.2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:52:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UTcEu/JYUHfvgZMX/sFxmSQJgT/8y7pf6LcOJ4FjCbFRba+vMiBdv7gEJcrTSJTOSFVcTYNIq/79YXo/mkzRbNp7vW+XhJVfutK4tDbyGqRzTq+D2mceBqeTZNYRfBRp5E8SrMUaLosCarMqZnaS7EXHmci6W8hTEA+3a5sPl1biudRKG6VPD/ThGzUth8KXijQci4RSXdCH9O55WZqzVCA1EZy0BPuScvyN672HhAz0fUPxAUqqHbT4ET4NV0tfyMuniRtNcjJxMBZr0ICFt9W8y4ihnJ29yZnGpvbNNnj7/F47qOKLpfeGMaujQnXn8cAZ0gDPPzQGfxk//cWWyQ== 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=yH/PiKb6oZT4KSo127ZaehFlOAS78FyXESmRFxLTj4w=; b=TMJGiAbWw/dL0aIiU6hllQNdLiFcnMpCPGYnTmUT/2dwLlrqGw4ZQNFE52KIXP2Z9gMFWHH55W3fBRZDieG4i3OEraM/t4e56KZGhYKx7ltoKFBM8rE/uH/dx9IMBCZVEArDz5uxb6lCwkSMo4oHh+0il7bl2JdFMQV9FZDth17h6yvvF9IBlo26nd7BABie4bLOhdXdhhos5Px+H3jGxvgEP1YM4lZVW78z5e4yEugS0MUlydNVJqdYJbuG5r5oa9HZvOy5P5GeyyNzobcYwx8iHygxDAtbMpRHaUVMu+t55iRjToiS4caNGuubl5laNlqcUO7hQgI3MLvhwHmSgA== 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=yH/PiKb6oZT4KSo127ZaehFlOAS78FyXESmRFxLTj4w=; b=YyZ1CsqMvyF5iLf4d+X+1cyFd1lWia316ex0uScQyu2eUEGzk9lhg3bx/PhIyAGdL4wyhYDhxs8YZQHYebcJhxPJi6BCLkVxkUovM+IRJUDoqbXmJJsbRLCMq5lIDISDlZRLT7lfRfRpO7JnpRHmUAWf8NKB4zFnxqxGwm5Wvuw= Received: from AS9PR05CA0155.eurprd05.prod.outlook.com (2603:10a6:20b:496::8) by GVXPR08MB10985.eurprd08.prod.outlook.com (2603:10a6:150:1f6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:52:10 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:496:cafe::60) by AS9PR05CA0155.outlook.office365.com (2603:10a6:20b:496::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:10 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:09 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Mar 2025 17:52:03 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:52:03 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Richard Ball , "Matthieu Longo" Subject: [PATCH v0 02/15] Build attributes: add new abstractions for subsections and attributes Date: Mon, 10 Mar 2025 17:51:15 +0000 Message-ID: <20250310175131.1217374-3-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|GVXPR08MB10985:EE_|DU2PEPF0001E9C6:EE_|DB9PR08MB7557:EE_ X-MS-Office365-Filtering-Correlation-Id: 13fccdcb-83ea-4e14-e105-08dd5ffc52d0 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info-Original: 3diGHnke1jZu18vPlA2byhUzPLRXUe6jNMi9S3BH8RPHyRxnHhHonzzF07h3FH1rimliYa7O37YFCvkD10uQlRn5B7dgzOU3mA+PWw6VTYezun2xcjyW1Q4wGw7Ok0L7G2cYpwa+fmmvqFb1gESLkdIzRLWaPNUpH860Der1mf/q+oHGWAq8Bdyk3HY59HCvlWjpWB4ZbhY4ur9x+JNTEJxRy6uf7GPM1HmOGzOLi9530TLcCajcjEZSsn9A1q1HQKQeZGx1D6QdQNCeSx1rTDU2dwYYUlw5v1y/UnswMGzfj/K4Cs25KSiRAWFu/YlBrqRbx2UAMJt/Wtgx2sd1oOBriP+4ptvLSHpknXbZ4VSraS7/8GHhDe/NUfOleYdQwqDtAPncVyp4q8KZ6dayfIBJfehZIol8Mq8m8ll9yhL/KL16pAQZ5bqkiMyIhHuVxC7WpXvUnTnnE7RjVMPo/nL8V/bk0QJa1byq+4ijB1IGy9NsMEKrILLFKoih80NP9WRZkZVKTAonOGhUEfHM5PI+SMD28U/g1xNRlre+owGFuNunQYbxQ+1Y1icLpDVtK1VcvV/TFD+j1rqkWqhrbzfQY5GlievMQXnwOmLa0LT7/XvpRCFXxlphFlnGp9kFEXkKpufKes4vbjrqiC6frRdrKD2pjAQSrXNTu9nRzlm3le7Fk//rCnXaEeQYRSWe5Gk5vG0tmT18iXSV5aB8y+rfZFoeqNgy1aL4NzGsMRja18WliG17WWppXYCHgLzgo38Fcn+Rvq/J6KQ80K85CTZwLab2l+7k7J1bA3vbMvPeTfDUbkNPNM8iGDgEvs95guME7COllFG/OimX5stIMNAXHUgl/4vqtlrHOe2NYB0BterjuVY27hP3QY3dGmKqNC0mDyCICSX22llLFOQgjUB/D75qRVltBMwNefrWMrNFSGU1wRpaTxH4/yDAki2/dk3RHaSJNUnw2Bv9YOn44kaD8UuWQ+YBajcsEWUal5Jvt0OY4U298eQqZ3C9a1Z0rbMAQKcNOjzCO20FHSJmc9iXlWnME2UUSu6/X9CoxoWAE9wYmoMZ8Hgd0JggYU8KRNKPuRNHn4QGKJ9khY7NvkyDEJZpeajf9EJy8Q+SWRp0UXpYEYJzsNjN95QN2iBvIhltGk9g8zTK1hlJGmvqoN49Lh+iOBYJ/2baOgeW43xOmzcWP4CBcIIoFNjCyoDGdx4pFdvUHQkJc6bxpQZAP7MMUK8cuQ0z72d/PFayzm9VksRDESLNvzFQ7D7ER6BoNO+fnn4d+bnhITsSw+q8kOr13vXLYahtEz94v5Cy5l04dmGIwrM4/B4Hk1rQr2KYV0xakhqf4uJ0CYy3h7iztctkOxng3rYqjqx1Gu+jo9Pe34vfXxeqt5hVJidbBYRoE2Xr2gjILf4uFaIg7b62ap6d8+4Atck5eD+jqNbpeUYiLio1FDjgXPQR5LVeKtDa6ri9yJT3HNAD/TTnnTw7bx2aatSqj0RIorpIrQZrVtw= 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10985 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:496::8]; domain=AS9PR05CA0155.eurprd05.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF0001E9C6.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: da693fa0-c585-4730-859a-08dd5ffc4773 X-Microsoft-Antispam: BCL:0; ARA:13230040|14060799003|1800799024|36860700013|35042699022|82310400026|376014; X-Microsoft-Antispam-Message-Info: cO/lEbalNfdz65WlRgld8w5Hkxq38xMZS6aSpLfZDxSg4MPKR1kO/+mC5fZWXbL6qgvLD/4SKiuz/jlNkObj+3wEXpsWaYdDDXNU9iwXW7wPjuHON0jEGnPv6kdMSIYL2pKVLwbh5b1RCgk5NQd1T/jBnSC8JMk5TgS1acMH4buqeibA7krsVFLGnBPLTxEBhSpA+E/UcKOTAL7q/sr8BP1JCfvLVlHMo2WVgCm5K4UlfGrpRAh8uJkw0ZCTYoFltimVldvEY7DoWwiu5sjxLqZxRoNQm2bFZcBg2blyJrtykF6WgqGjfjvdBF05VaFbtr5tCkqfXmawTJYqYMsLqcRbaRhfU19fkCZ2733MLC+wgaoMEDcRnhJYYNXHPmHTIo0O6Eu74HDa14TXliE+N96PHb4hmlinKZzvgk2Z4Lv1kKr3daZleuOcyYuuIn79AzaqdU8UsAcsROjhONngq3TgmvSCRrgPGR52aYSbID045M0HKOOK/M8tLaA1LOpLY1vmFYDRjL5cNjmzioU6ASChyt1vTyEWQ+rotGkBRb1M1F+xjajSGOhD8lnMct3gc3wHatw6wp64RJ7tKA8MO7a6tFnY1ycecZ2a6o2HgnguO3qtEF0t6T5nf9buBUDVjMeyCUmuLYPKVERNxvhKk5nBZC8uIlnr+bItEjcFZePmSBd4aafj7/1NFJydSsQlIs3ic/r8YTJgyRqTAihcD2pD5liM0VYq711hHXgF72pxGw0j1OioxhDDlltKZh3zBu0+jnbQ1+Sx01s+3wKyDBzPFDYLSR7Vumx8vN+INi2ucxc74a74nRRznL49NkybN22xw5QktyjJJJRz48GFF0WbARzdOLE6MAVkOLXR9VAfvM9Q6DPKKYlyRQYLMfQy1/ycj0psrHLqx/Xzf9hmEFLJU5eY7B8+0PKwqRXXN9V15IExoWpe1f9bWDYR59PExx/XBiboKVQx5m9M7tHZuRR3385dJUpiLZZTM/N8lrq2a4kHNa1OYInhBg6DbTcgXIqJS0FQ0SasjFizpFyQiAiYXuiwKOUthQnVUgIdqPSoz8V6H8DcVc9j8Epm6lzjyY/t2isGV86kPuo+8hcD/v3ACwzkXrNOef8uKde5AuQ2+Ce9TvWGeazRkQYRm1KNl6eH6yho1wS3X8RlJAy7/8CjrCRyRUiQ+UTjyPyOavHz+dp5fg/CctMrC0c/x2vJj8OB8Wd/uyX3LM9E1O8qdzwVfPmO5Zo7UCrjBgA5kNYQzA8eGJmjd4rHdsfxIqC4RN+G0lWtft4bH+FpyalNOaHhNorr+5JK5yrTgD8XtjOnGnLJpjVFxqKo1/2N82oUu30/z6criB+DFuY+sPYJTTyXu/lLCjdSMbACRqsBI1Ys2bA5Ovf3Vzay9Dldt1GUjGfbIQbpOB9qujK1hefLvsjTDBeFmYIguXoF9bmYKFzUXCzkOBNzxr6QoFz/+CEz9uHZZB5I/4U8/yTh7/SSJc5KiGkSkwdleVzunBBtmSw= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(14060799003)(1800799024)(36860700013)(35042699022)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:52:28.2296 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13fccdcb-83ea-4e14-e105-08dd5ffc52d0 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: DU2PEPF0001E9C6.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7557 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 From: Richard Ball Co-Authored-By: Matthieu Longo --- bfd/Makefile.am | 2 +- bfd/Makefile.in | 2 +- bfd/elf-attrs.c | 209 +++++++++++++++++++++++++++++++++++++++++ bfd/elf-attrs.h | 102 ++++++++++++++++++++ bfd/elf-bfd.h | 42 ++++++++- bfd/elfnn-aarch64.c | 13 +++ bfd/elfxx-target.h | 6 +- bfd/po/SRC-POTFILES.in | 1 + 8 files changed, 372 insertions(+), 5 deletions(-) create mode 100644 bfd/elf-attrs.h diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 4987ac9cccc..0339db6b2b6 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -707,7 +707,7 @@ SOURCE_HFILES = \ elf32-metag.h elf32-nds32.h elf32-ppc.h \ elf32-rx.h elf32-score.h elf32-sh-relocs.h elf32-spu.h \ elf32-tic6x.h elf32-tilegx.h elf32-tilepro.h elf32-v850.h \ - elf64-hppa.h elf64-ppc.h elf64-tilegx.h \ + elf64-hppa.h elf64-ppc.h elf64-tilegx.h elf-attrs.h \ elf-bfd.h elfcode.h elfcore.h elf-hppa.h elf-linker-x86.h \ elf-linux-core.h elf-nacl.h elf-s390.h elf-vxworks.h \ elfxx-aarch64.h elfxx-ia64.h elfxx-mips.h elfxx-riscv.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 1543af7984a..ecc91d733af 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1171,7 +1171,7 @@ SOURCE_HFILES = \ elf32-metag.h elf32-nds32.h elf32-ppc.h \ elf32-rx.h elf32-score.h elf32-sh-relocs.h elf32-spu.h \ elf32-tic6x.h elf32-tilegx.h elf32-tilepro.h elf32-v850.h \ - elf64-hppa.h elf64-ppc.h elf64-tilegx.h \ + elf64-hppa.h elf64-ppc.h elf64-tilegx.h elf-attrs.h \ elf-bfd.h elfcode.h elfcore.h elf-hppa.h elf-linker-x86.h \ elf-linux-core.h elf-nacl.h elf-s390.h elf-vxworks.h \ elfxx-aarch64.h elfxx-ia64.h elfxx-mips.h elfxx-riscv.h \ diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index a6a72369afd..634843b5162 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -20,6 +20,7 @@ #include "sysdep.h" #include "bfd.h" +#include "double-linked-list.h" #include "libiberty.h" #include "libbfd.h" #include "elf-bfd.h" @@ -476,6 +477,19 @@ gnu_obj_attrs_arg_type (unsigned int tag) int _bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, unsigned int tag) { + if (get_elf_backend_data (abfd)->obj_attrs_version == 2) + { + BFD_ASSERT (elf_obj_attr_subsections (abfd).last_ != NULL); + switch (elf_obj_attr_subsections (abfd).last_->encoding) + { + case ULEB128: + return ATTR_TYPE_FLAG_INT_VAL; + case NTBS: + return ATTR_TYPE_FLAG_STR_VAL; + } + } + + /* Version 1. */ switch (vendor) { case OBJ_ATTR_PROC: @@ -822,6 +836,201 @@ _bfd_elf_merge_unknown_attribute_list (bfd *ibfd, bfd *obfd) return result; } +obj_attr_v2 * +_bfd_elf_obj_attr_v2_init (unsigned int tag, + union obj_attr_value_v2 vals) +{ + obj_attr_v2 *attr = (obj_attr_v2*) malloc (sizeof (obj_attr_v2)); + memset ((void *) attr, 0, sizeof (obj_attr_v2)); + attr->tag = tag; + attr->vals = vals; + return attr; +} + +void +_bfd_elf_obj_attr_v2_free (obj_attr_v2 * attr, obj_attr_encoding_v2 encoding) +{ + if (encoding == NTBS && attr->vals.string_val != NULL) + free ((void *) attr->vals.string_val); + free (attr); +} + +obj_attr_v2 * +_bfd_elf_obj_attr_v2_copy (obj_attr_v2 *other, + obj_attr_encoding_v2 encoding) +{ + union obj_attr_value_v2 vals; + if (encoding == NTBS) + vals.string_val = + (other->vals.string_val != NULL) + ? strdup (other->vals.string_val) + : NULL; + else + vals.uint_val = other->vals.uint_val; + + obj_attr_v2 *copy =_bfd_elf_obj_attr_v2_init (other->tag, vals); + copy->status = other->status; + return copy; +} + +#define SWAP(a, b) do { typeof(a) temp = a; a = b; b = temp; } while (0) + +void +_bfd_elf_obj_attr_v2_swap (obj_attr_subsection_v2 *s, + obj_attr_v2 *a1, obj_attr_v2 *a2) +{ + SWAP (a1->next, a2->next); + SWAP (a1->prev, a2->prev); + + if (s->first_ == a1) + s->first_ = a2; + else if (s->first_ == a2) + s->first_ = a1; + + if (s->last_ == a1) + s->last_ = a2; + else if (s->last_ == a2) + s->last_ = a1; +} + +int +_bfd_elf_obj_attr_v2_cmp (obj_attr_v2 *a1, obj_attr_v2 *a2) +{ + if (a1->tag < a2->tag) + return -1; + else if (a1->tag > a2->tag) + return 1; + else + return 0; +} + +/* Find the object attribute matching the given tag (object attributes v2 only). + Note: The parameter 'sorted' specifies whether the given list is sorted or + not. If the list of attributes is sorted, the linear search stops as soon as + it finds an attribute with a greater tag. */ +obj_attr_v2 * +obj_attr_v2_find_by_tag (obj_attr_subsection_v2 *subsec, + uint32_t tag, + bool sorted) +{ + for (obj_attr_v2 *attr = subsec->first_; + attr != NULL; + attr = attr->next) + if (attr->tag == tag) + return attr; + else if (sorted && attr->tag > tag) + break; + return NULL; +} + +LINKED_LIST_MUTATIVE_OPS_DECL(obj_attr_subsection_v2, obj_attr_v2, /* public */) +LINKED_LIST_MERGE_SORT_DECL(obj_attr_subsection_v2, obj_attr_v2, /* public */) + +obj_attr_subsection_v2 * +_bfd_elf_obj_attr_subsection_v2_init (const char* name, + obj_attr_subsection_scope_v2 scope, + bool optional, + obj_attr_encoding_v2 encoding) +{ + obj_attr_subsection_v2* subsection = (obj_attr_subsection_v2*) + malloc (sizeof (obj_attr_subsection_v2)); + memset ((void *) subsection, 0, sizeof (obj_attr_subsection_v2)); + subsection->name = name; + subsection->scope = scope; + subsection->optional = optional; + subsection->encoding = encoding; + return subsection; +} + +void +_bfd_elf_obj_attr_subsection_v2_free (obj_attr_subsection_v2 *subsec) +{ + for (obj_attr_v2 *attr = subsec->first_; attr != NULL; attr = attr->next) + _bfd_elf_obj_attr_v2_free (attr, subsec->encoding); + free (subsec); +} + +obj_attr_subsection_v2 * +_bfd_elf_obj_attr_subsection_v2_copy (obj_attr_subsection_v2 const *other) +{ + obj_attr_subsection_v2* new_subsec = + _bfd_elf_obj_attr_subsection_v2_init (other->name, other->scope, + other->optional, other->encoding); + for (obj_attr_v2* attr = other->first_; + attr != NULL; + attr = attr->next) + { + obj_attr_v2* new_attr = _bfd_elf_obj_attr_v2_copy (attr, other->encoding); + LINKED_LIST_APPEND(obj_attr_v2) (new_subsec, new_attr); + } + return new_subsec; +} + +void +_bfd_elf_obj_attr_subsection_v2_swap (obj_attr_subsection_list *plist, + obj_attr_subsection_v2 *s1, + obj_attr_subsection_v2 *s2) +{ + SWAP (s1->next, s2->next); + SWAP (s1->prev, s2->prev); + + if (plist->first_ == s1) + plist->first_ = s2; + else if (plist->first_ == s2) + plist->first_ = s1; + + if (plist->last_ == s1) + plist->last_ = s2; + else if (plist->last_ == s2) + plist->last_ = s1; +} + +int +_bfd_elf_obj_attr_subsection_v2_cmp (obj_attr_subsection_v2 *s1, + obj_attr_subsection_v2 *s2) +{ + int res = strcmp (s1->name, s2->name); + if (res != 0) + return res; + + if (s1->optional < s2->optional) + return -1; + else if (s1->optional > s2->optional) + return 1; + + if (s1->encoding < s2->encoding) + return -1; + if (s1->encoding > s2->encoding) + return 1; + else + return 0; +} + +/* Find the subsection matching the given name. + Note: The parameter sorted specified whether the given list is sorted or not. + If the list of subsections is sorted, the linear search stops as soon as it + finds a subsection name with a greater order. */ +obj_attr_subsection_v2 * +obj_attr_subsection_v2_find_by_name (obj_attr_subsection_v2 *first, + const char *name, + bool sorted) +{ + for (obj_attr_subsection_v2 *s = first; + s != NULL; + s = s->next) + { + int cmp = strcmp (s->name, name); + if (cmp == 0) + return s; + else if (sorted && cmp > 0) + break; + } + return NULL; +} + +LINKED_LIST_MUTATIVE_OPS_DECL(obj_attr_subsection_list, obj_attr_subsection_v2, /* public */) +LINKED_LIST_MERGE_SORT_DECL(obj_attr_subsection_list, obj_attr_subsection_v2, /* public */) + bool _bfd_elf_write_section_build_attributes (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED) { diff --git a/bfd/elf-attrs.h b/bfd/elf-attrs.h new file mode 100644 index 00000000000..5d41bb98538 --- /dev/null +++ b/bfd/elf-attrs.h @@ -0,0 +1,102 @@ +/* ELF attributes support (based on ARM EABI attributes). + Copyright (C) 2025 Free Software Foundation, Inc. + Written by Cygnus Support. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#pragma once + +#include + +/* -------------------- + Object attributes v2 + -------------------- */ + +typedef enum obj_attr_encoding_v2 +{ + ULEB128 = 0, + NTBS = 1, +} obj_attr_encoding_v2; + +typedef union obj_attr_value_v2 { + uint32_t uint_val; + const char* string_val; +} obj_attr_value_v2; + +typedef struct obj_attr_v2 { + /* The name/tag of an attribute. */ + uint32_t tag; + + /* The value assigned to an attribute, can be ULEB128 or NTBS. */ + union obj_attr_value_v2 vals; + + /* The next attribute in the list or NULL. */ + struct obj_attr_v2 *next; + + /* The previous attribute in the list or NULL. */ + struct obj_attr_v2 *prev; + +} obj_attr_v2; + +typedef enum obj_attr_subsection_scope_v2 +{ + SUBSEC_PUBLIC = 0, + SUBSEC_PRIVATE = 1, +} obj_attr_subsection_scope_v2; + +typedef struct obj_attr_subsection_v2 { + /* The name of the subsection. */ + const char *name; + + /* The scope of the subsection. */ + obj_attr_subsection_scope_v2 scope; + + /* Is this subsection optional ? Can it be skipped ? */ + bool optional; + + /* The value encoding of attributes in this subsection. */ + obj_attr_encoding_v2 encoding; + + /* The next subsection in the list, or NULL. */ + struct obj_attr_subsection_v2 *next; + + /* The previous subsection in the list, or NULL. */ + struct obj_attr_subsection_v2 *prev; + + /* A pointer to the first node of the list. */ + struct obj_attr_v2* first_; + + /* A pointer to the last node of the list. */ + struct obj_attr_v2* last_; + + /* The size of the list. */ + uint32_t size; + +} obj_attr_subsection_v2; + +typedef struct obj_attr_subsection_list +{ + /* A pointer to the first node of the list. */ + obj_attr_subsection_v2 *first_; + + /* A pointer to the last node of the list. */ + obj_attr_subsection_v2 *last_; + + /* The size of the list. */ + uint64_t size; +} obj_attr_subsection_list; diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 5903d857faa..6c326d5db72 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -24,9 +24,11 @@ #include +#include "double-linked-list.h" #include "elf/common.h" #include "elf/external.h" #include "elf/internal.h" +#include "elf-attrs.h" #include "bfdlink.h" #ifndef ENABLE_CHECKING @@ -1630,13 +1632,15 @@ struct elf_backend_data /* The section name to use for a processor-standard attributes section. */ const char *obj_attrs_section; - /* Return 1, 2 or 3 to indicate what type of arguments a - processor-specific tag takes. */ + /* Return 1, 2 or 3 to indicate what type of arguments a tag takes. */ int (*obj_attrs_arg_type) (int); /* The section type to use for an attributes section. */ unsigned int obj_attrs_section_type; + /* The version of object attributes (1 or 2). */ + unsigned int obj_attrs_version; + /* This function determines the order in which any attributes are written. It must be defined for input in the range LEAST_KNOWN_OBJ_ATTRIBUTE..NUM_KNOWN_OBJ_ATTRIBUTES-1 (this range @@ -2160,6 +2164,11 @@ struct elf_obj_tdata obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES]; obj_attribute_list *other_obj_attributes[2]; + /* Object attributes v2: attributes of the same category are stored inside + the same subsection. A subsection can only hold attributes with the same + data type. */ + obj_attr_subsection_list obj_attr_subsections; + /* Linked-list containing information about every Systemtap section found in the object file. Each section corresponds to one entry in the list. */ @@ -2253,6 +2262,7 @@ struct elf_obj_tdata (elf_known_obj_attributes (bfd) [OBJ_ATTR_PROC]) #define elf_other_obj_attributes_proc(bfd) \ (elf_other_obj_attributes (bfd) [OBJ_ATTR_PROC]) +#define elf_obj_attr_subsections(bfd) (elf_tdata (bfd) -> obj_attr_subsections) #define elf_properties(bfd) (elf_tdata (bfd) -> properties) #define elf_has_no_copy_on_protected(bfd) \ (elf_tdata(bfd) -> has_no_copy_on_protected) @@ -3083,6 +3093,34 @@ extern bool _bfd_elf_merge_unknown_attribute_list (bfd *, bfd *); extern Elf_Internal_Shdr *_bfd_elf_single_rel_hdr (asection *sec); extern bool elf_read_notes (bfd *, file_ptr, bfd_size_type, size_t); +extern obj_attr_v2 *_bfd_elf_obj_attr_v2_init (unsigned int, + union obj_attr_value_v2); +extern void _bfd_elf_obj_attr_v2_free (obj_attr_v2 *, obj_attr_encoding_v2); +extern obj_attr_v2 *_bfd_elf_obj_attr_v2_copy (obj_attr_v2 *, + obj_attr_encoding_v2); +extern void _bfd_elf_obj_attr_v2_swap (obj_attr_subsection_v2 *, + obj_attr_v2 *, obj_attr_v2 *); +extern int _bfd_elf_obj_attr_v2_cmp (obj_attr_v2 *, obj_attr_v2 *); +extern obj_attr_v2 * +obj_attr_v2_find_by_tag (obj_attr_subsection_v2 *, uint32_t, bool); +LINKED_LIST_MUTATIVE_OPS_PROTOTYPE(obj_attr_subsection_v2, obj_attr_v2, extern); +_LINKED_LIST_MERGE_SORT_PROTOTYPE(obj_attr_v2, extern); +LINKED_LIST_MERGE_SORT_PROTOTYPE(obj_attr_subsection_v2, obj_attr_v2, extern); +extern obj_attr_subsection_v2 *_bfd_elf_obj_attr_subsection_v2_init (const char*, + obj_attr_subsection_scope_v2, bool, obj_attr_encoding_v2); +extern void _bfd_elf_obj_attr_subsection_v2_free (obj_attr_subsection_v2 *); +extern obj_attr_subsection_v2 *_bfd_elf_obj_attr_subsection_v2_copy + (obj_attr_subsection_v2 const*); +extern void _bfd_elf_obj_attr_subsection_v2_swap (obj_attr_subsection_list *, + obj_attr_subsection_v2 *, obj_attr_subsection_v2 *); +extern int _bfd_elf_obj_attr_subsection_v2_cmp (obj_attr_subsection_v2 *, + obj_attr_subsection_v2 *s2); +extern obj_attr_subsection_v2 * obj_attr_subsection_v2_find_by_name + (obj_attr_subsection_v2 *, const char *, bool); +LINKED_LIST_MUTATIVE_OPS_PROTOTYPE(obj_attr_subsection_list, obj_attr_subsection_v2, extern); +_LINKED_LIST_MERGE_SORT_PROTOTYPE(obj_attr_subsection_v2, extern); +LINKED_LIST_MERGE_SORT_PROTOTYPE(obj_attr_subsection_list, obj_attr_subsection_v2, extern); + extern bool _bfd_elf_parse_gnu_properties (bfd *, Elf_Internal_Note *); extern elf_property_list * _bfd_elf_find_property diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 548da1f8b30..21fc99c4c98 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -10760,8 +10760,21 @@ const struct elf_size_info elfNN_aarch64_size_info = #define elf_backend_extern_protected_data 0 #define elf_backend_hash_symbol elf_aarch64_hash_symbol +/* elf_backend_obj_attrs_vendor is unused for AArch64. It is replaced by the + concept of subsections, each one having its own name defined by the + assembly directive "aeabi_subsection". */ +#undef elf_backend_obj_attrs_vendor +#define elf_backend_obj_attrs_vendor "aeabi" #undef elf_backend_obj_attrs_section #define elf_backend_obj_attrs_section SEC_AARCH64_ATTRIBUTES +/* elf_backend_obj_attrs_arg_type is unused as the type of an attribute is + determined by looking up at the current subsection, not the value of the + tag. */ +#define elf_backend_obj_attrs_arg_type NULL +#undef elf_backend_obj_attrs_section_type +#define elf_backend_obj_attrs_section_type SHT_AARCH64_ATTRIBUTES +#undef elf_backend_obj_attrs_version +#define elf_backend_obj_attrs_version 2 #include "elfNN-target.h" diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 625243cac94..cff508dbbce 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -556,6 +556,9 @@ #ifndef elf_backend_obj_attrs_section_type #define elf_backend_obj_attrs_section_type SHT_GNU_ATTRIBUTES #endif +#ifndef elf_backend_obj_attrs_version +#define elf_backend_obj_attrs_version 1 /* Default version. */ +#endif #ifndef elf_backend_obj_attrs_order #define elf_backend_obj_attrs_order NULL #endif @@ -808,7 +811,7 @@ #ifndef elf_backend_symbol_section_index #define elf_backend_symbol_section_index NULL #endif - + #ifndef elf_match_priority #define elf_match_priority \ (ELF_ARCH == bfd_arch_unknown ? 2 : ELF_OSABI == ELFOSABI_NONE ? 1 : 0) @@ -934,6 +937,7 @@ static const struct elf_backend_data elfNN_bed = elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type, + elf_backend_obj_attrs_version, elf_backend_obj_attrs_order, elf_backend_obj_attrs_handle_unknown, elf_backend_parse_gnu_properties, diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index 54b078b8295..4b8ccfbe2c8 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -132,6 +132,7 @@ ecoff.c ecofflink.c ecoffswap.h elf-attrs.c +elf-attrs.h elf-bfd.h elf-eh-frame.c elf-hppa.h From patchwork Mon Mar 10 17:51:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107600 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 8E7103858C5F for ; Mon, 10 Mar 2025 18:04:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E7103858C5F 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=WuH0xXNc; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=WuH0xXNc X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::600]) by sourceware.org (Postfix) with ESMTPS id 93C503858C2C for ; Mon, 10 Mar 2025 17:52:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 93C503858C2C 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 93C503858C2C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::600 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629168; cv=pass; b=tDjAy5/GPjqLxO9xa2CdgUfQ3P2SFh62eabCzPZY74+6TV/9jtF3hEFdKiJOk8JsRlrUtuJy1IGpjrOIXD0Yc45ckTvZTJsiqTDEgxPgnBeSWQI1HnnqSzWVGf9g1ASzokcQaT6MwQIO/YkHrABqfzslqqcD3oMua6Ck/bRdrLc= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629168; c=relaxed/simple; bh=K01lMNL9M+1FHjnxVbuMvnXy//cxPFnatfPaJcTjby8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=aqLJRX3baLv0V9ycH2a1Zcohluk5+B4UMHnLFNbko54k5ehr7pWLrrDT1FDvOllE8JNe7mTrd5dATh/cqHisb43kFIy4OKxh4S8aBCL3ZV+AwZgbJni5rsFStDzGo7Rt+dspYxY58ANpF9/3ObU/CNkp0U0oyPO2mNQIx7Ugw64= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93C503858C2C ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=i3Emj/kcMX6/n1MISS5Kr71hmet/VO+F/TALQAtFuFDxg6defGtDrnTiCZ7CsgWedK62sNoS7osagildoqMJfM5P1RTO4kKivlK8tW6Th4t+IVtKMnf4HroLlPbUuDsm3TwuhPvyowziqejYLzBpw40x5IDCXiJKHpoiM+WwfJfC4qYybcSXwL+m+nPQ86jiRxHvEc2BAEBoD4vY8n6mY0HGsuaXFL0mX2rWt9ZnfyT5X+ATUvIGgFJ4UBD5J6rMzEwtOoEZb/mQGwXAGejcQ9sLHYNt5b51rm35LW6cUgoVljVNBl1hPTQCobbe/IukzXMpvz+w1f0c6pD7rST/vg== 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=W0SjhevTXmaSt7Yk39bM1bJWkuPyPbrP7UkNG54eOoY=; b=n2ZW5SgSXtAU10PK0aJSQdq9VrZA/8XV1N96XljbDtSqU+i2RfmRwuODtnkA0xeHquHjs03HxVuQwTf21bLgRyfVIV8jVAIBTpYNofvO4hTB/jGfFEMiI9juYKyJ4/PnELoClMUYPQg21tz5KR/aPsMOHucXWREeS2poVFCxhuwkg5pEikP6LiW/YVaykEI6LpMqxKwO++Uf/fGhf36S9ojSaoMTeryHxcq8j4e+Kf9EgOg9sgErUaDwJA3LL9QsqyMCNizmNkwIISpmxdhMAE4Z7A241EBzv2nXaGuSH2Jyr53NhrLnIgOe3eBV/u8ycx9NczFXjFCOBZGxvZy98Q== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=W0SjhevTXmaSt7Yk39bM1bJWkuPyPbrP7UkNG54eOoY=; b=WuH0xXNcrjBkFyUV9/KM2XEzCTUvKoxy7dO6udfSkDThDhGwplIcrp/SypddmmH4V0pgK2FrJVBhJvCCt7Yem1Kgmm4/E8ooXhlNhO6QZqXh3vIreZD9S3sjJYsyIlFuQkta6ixq2Lqw6ZDSQweDDMLrMZ+gDapBlOoAFTOOmBI= Received: from AM7PR03CA0029.eurprd03.prod.outlook.com (2603:10a6:20b:130::39) by DB9PR08MB7676.eurprd08.prod.outlook.com (2603:10a6:10:37f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:52:40 +0000 Received: from AM3PEPF0000A797.eurprd04.prod.outlook.com (2603:10a6:20b:130:cafe::80) by AM7PR03CA0029.outlook.office365.com (2603:10a6:20b:130::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:40 +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=arm.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 AM3PEPF0000A797.mail.protection.outlook.com (10.167.16.102) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:40 +0000 Received: ("Tessian outbound 7c48d84d1965:v585"); Mon, 10 Mar 2025 17:52:40 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bd8e9e2950e72dd2 X-TessianGatewayMetadata: gs18mMQGLXvyQzDS1B5U79BwR3qqOhV8ny9vNHdIYjvPSnp8lp89psxWZmbQZHla/g4VY76NxOyrD/VvXZQhcZ0jiAdo+IdFVSndJRLtd1rKfdIw1WeA+IR+Up7osMQmE9ieT21WtLEQtnpliJQ7ctYx9Bi51ii+7bUqTrJv1fU= X-CR-MTA-TID: 64aa7808 Received: from Ldeb1b6ded6d3.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 036AEA10-BBA6-4DD7-BE79-1E91A113382D.1; Mon, 10 Mar 2025 17:52:33 +0000 Received: from DB3PR0202CU003.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Ldeb1b6ded6d3.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:52:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jxm0RIrrh+VZJevUT5EAgQ4rgDEHaoErBgoacACyIO5elMWgWVnoq5UrCnX3mq/trh18j6KfrJPaoXST3l/XKB5xgWLk+xpHps19YJ8qrxz8jkDJAfLTV+QUJIe2mvTtqSWr2vl4IvKCD6O5E/FAtYQ+O/rVvBRqKqGMEc5UgLa+RM1w3SuLlCyoWwVCoG5SdvJE2ySV1wed0WNQ5ngVx7tAqvz1Qm3CqHa35lWYNcfT3icoQv0u0dIwz4zW4+WdpqdDiSQY6+Qt9pPpqhWLd+EKyulYHalBJSG0eTxcSJa/F0b6yIKL0q2QiV3y81i7fZOrX1L9NMFyTS9I3B1KRA== 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=W0SjhevTXmaSt7Yk39bM1bJWkuPyPbrP7UkNG54eOoY=; b=rIixUSCCYkaLKeYmqlEtGXrH5XBW7Qc7FSXxoTtyix0hyVccQQskKzAJSbNT5XU/rIwSG9WkiycH6/o7dm8zX1X0rNgzh6qMhzp46gnqHEckABx6S1yqsLtnNOxWu7pSFIJMeqtuKJK2dU+A961z+PzB4IZG623JRNoJhoB4khhhzgKSl1L5ro+ObnLNMCgzUn+zRS7cOAZtFvR6YKmmvS67QlPki52o7SzJHwN3/dXBy0TaqY37qiKnJWeC90/fJxSJrZ54Zps+aE/GPYnmrLVC6Jcz3lKga1lrgBklHi7j5aUotlR29Y2BRM8S4QFZoVTI11JC+u51jiSPSnnzDg== 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=W0SjhevTXmaSt7Yk39bM1bJWkuPyPbrP7UkNG54eOoY=; b=WuH0xXNcrjBkFyUV9/KM2XEzCTUvKoxy7dO6udfSkDThDhGwplIcrp/SypddmmH4V0pgK2FrJVBhJvCCt7Yem1Kgmm4/E8ooXhlNhO6QZqXh3vIreZD9S3sjJYsyIlFuQkta6ixq2Lqw6ZDSQweDDMLrMZ+gDapBlOoAFTOOmBI= Received: from CWLP265CA0446.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:1b7::16) by DU0PR08MB8140.eurprd08.prod.outlook.com (2603:10a6:10:3ef::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:52:29 +0000 Received: from AM4PEPF00027A5F.eurprd04.prod.outlook.com (2603:10a6:400:1b7:cafe::69) by CWLP265CA0446.outlook.office365.com (2603:10a6:400:1b7::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:29 +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 AM4PEPF00027A5F.mail.protection.outlook.com (10.167.16.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:29 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Mon, 10 Mar 2025 17:52:15 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) 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.39; Mon, 10 Mar 2025 17:52:14 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:52:14 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Richard Ball , "Matthieu Longo" Subject: [PATCH v0 03/15] gas: parse object attributes v2 Date: Mon, 10 Mar 2025 17:51:16 +0000 Message-ID: <20250310175131.1217374-4-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5F:EE_|DU0PR08MB8140:EE_|AM3PEPF0000A797:EE_|DB9PR08MB7676:EE_ X-MS-Office365-Filtering-Correlation-Id: e08da5ca-73e1-4305-bf3b-08dd5ffc5a07 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info-Original: 3umPQdBYAwTHwHc9f9JJAez5F8JIvC0jHwAVHheHPeveJ+4ss/OYayIYtSSb9yjgOkLgML0awgR8PAzgtXW6W/qUdSSR39yh19VnwT64ewBTegG9n+5E75mruKcCDLl2xrWIDtUcmcHln9gtFkwzDndBkw2OX9hq1tv2kwqru+s5P2enhc17G3aSyhmWJE8RlJqKC8pfX3gJus91+mqBEMiBJAKK7z3tg20zHCtY5l5sNgWpArB4Ca+/4Hu0KtNBfJSR3+ZgKY3ddO6538w+ypjsR28GiXHQvsi1+XRNElLNqEcyABxTTOD9UlEsDtwwJ/4sWEC0Xx4oAFjTQXKc3r1hPkevTNXqZNehPi5awEydNdfUEAaDHWtZVFF8Yta49jTOknKD0n7Xpnx1/zeBWNXYYBhLvqy1f3AU5MQxw+Zo+01veNP1arxwLyDUeuR9CIj6bWKcNffQpf7fqBjAlW+mESoZvl+KdibynQAEuXNFFv5FbwIZKSd6UvoEfnoE/y2B4KUg5nlB1lzG0/2SlMPdwCv5SCn0RU/G+9vdgPhyeYFKul3Fkaa7ydn0J2VuOZmxcO3kb/sImvcTjj24BJZdglvlDi9/Q56evQ9Lyo09KvtEUGdcmQnUOdcKDK8wVjUqP2Qb0iMigVMhqhIMSn90gLGgjem7jhwoCztR3XGxdOereGZ7dCy3hSoHQD73LwrnjA8zs/4pDZH5iwsbJbg6v8lIaubnk9EVKQlkwSLixbeqKfUlC5/jGkNbBFLHMPa+kCNHkZ0Y/rziYsgorAziR5SyeBruACSFTIJhU0sd2mRlrAvOqA3olRR8TvHtCOZGgcAe/fwvRi3vr0dkViz3vCEst7fvHMeMLvGxmHdWp63J+c7muvE7QDPwenmATdN16mxU5dhMMql5ZgWkmjk52+/7Qm5JNZ3EPGzsqA7qKS2yt/8UcfnLX2BOwyKHvus54PmbS9XeaXBkVnXIbypkdukFKY0Bzmzsjj2ggIIyACq/lbDvO/54T3oHIjO+A86O2OUP5ziITqmbP3D3mhPfr4G1IrSNyA4M4NM9QIQ5cSlFjiIFxRHSa+5JfFHaKo6x+njWU4lLvy8F3CESHJ23Sq5OX3aG+JDaQdRI18CICR3IJWf8Y83COmCWZtTzwJqUvFgACJseBUfFjnstSBxxBSl3J4bczgaubzhuat9rBKkRUWAtKYMeK28TWLbzxgHKqbi4GzjQal8DAoh885FKwZ8uj6PIR59puHybmSzNsZ/Sie5rf0+P2/IVXwMJRFIVvo2B57P+MTku5k9ir0kdNtoLQQtC7ox6UqTl/Bw8/hmxtd+56POD7guOc7OXWGn1cIp/plRBF/j/FY43HOlNz8Cn4mamZzyfddjqkOpE+/0pvDbva+mZgfyQ4PDd52Vxuga+fOWviQbbXPfEfml9iQKeto16rFWgmXHYOy2JuaIB7fxE3sCezzoYD1YH6P5f6b/TQNRxHxsQ3jbSLTv55rWekIpzubcBgOGzL9M= 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)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8140 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:400:1b7::16]; domain=CWLP265CA0446.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c447a690-b33c-4623-6d13-08dd5ffc5387 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|14060799003|36860700013|1800799024|35042699022; X-Microsoft-Antispam-Message-Info: 8jZ8ZnjNuMjXfLi9N1iZot5ArtYSpWyhix8PQnvryb/ZnZTGGH6HVjhgrYbDwdYAgB/30WgCNafPhMUUpd5+Me4Iwl3Itccetqix0t3ehfepxRZzo1lxBCtipM8Tkf4L+nV9NNPPKAs5BjEY1aAyM20oWYTxJvd7xq/1XgrHp+RQaS/WksDW3OoImfwwVsUBWEGZJcO2ncyI+pfdbQGJy3OfqzLpaYS/vokkvn3u1/nuN0tttzBqU1IPEzXYxXgAZcvyUhogZgbnSYDLxva9wSYcCiE06S5RG43+UXgg6eQoDGEhutG2e6BdWFwK6Oxfa5VGS3HEZgDB3WMemMSha6RinW6s18oG/sxr5J7kEYW/pGpaHjBKtB3hikxZU/urtA7Yw2SkXp7+S8J6rdQ52v1SPUMjCtNmF3gcwo9Sb5myA3Namfm+wBwJE+NAiTcaEmn+wrVelcVnZdMFno93DiyyUm6vnmD8sfhzcDqGj2Hu92CoB0qVrjboEp7sNZ47W/fiqgbwlIYf5+7JGg3igo6wC9Pxe6cHNPELAG1hLy9SxJM1n4KJydgQ1XFC/I12D6flmJaPC2BiarNVmun5VvyT3nyVfeiLB8pol4dAUAcQvHj0x41JAe1GDCNQ/OO6RPQJCKlSnAHlj9vH2ctnrNlynvC56brXP4cwj0V/2EW2npkt1/hyqliTPB/Y1A88XExZQnaCE2fIYQLqHkpUXDkwoLhX0GHm9oQ13JrD3WL+psBXe6UHhR82bFm7F7QiXQUr28GbOy36o3iTNLgezTAiBEGpHa9K6KdvO/Hot7oMJy9fGFucPj7TIGiwKnbtZZe8rXD3b4fbYiYAvxrFZW3icexN8/h/Q6vd0RFVXx8EPHP/c7hiYxZ5jxjWCZHx19c+XPt0hXsA/fdMmjzciBERAjqnoweBWRIlP6Xkd4vRgucIDIhszJ3rM0JqyilcaqeGW4TchuT/TJeq5An5zrFTh1W39/DeFD9mQnhtz8y5l2Dih5nzHi8GSpLdeZ3Sk1jwqm4ianYt+2EjyklE2zYYbpp/5jGL17ShZSawx310GkHRQ7EabCUgITPQCEp/m7o1PtucX3+fSyY76SjM7/HCFXkpCz+Qi1i2CKa8pDPM0isjKuypZa2b4D2YqnRwopvjlSAYC3kS6A1d4tCv9AmMyKNYdotTh9r3ZImeMGQYBOTATdhBNf4ByqSvlBb7WY81Gr9CIhkU1l1pIWyYe+Bx+IRclgZ/aYEpHCDeICov58IWlpd0DcmL0oM7wTg5vqZonKGud20WCgPYcrzrek4lB7lqD9w2YmzXhzvf4lf8/alg16e16YQkqnypBJipQqleV+5dYsSWsfE/086pSPf4+UMvpu87YWu/LlH70llvkYD8D/3KQWWrPr+sIz0dVoSbo5XiQr+6SL62NZMiXGrkgQDpxa+cJWiEOYRn51R1cVhNyU8Lh1z9pPIqtdefIkUXAGdUupkRMczCX5bBf6fuSj0rhmkaPgEUadYgfAI= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(14060799003)(36860700013)(1800799024)(35042699022); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:52:40.2551 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e08da5ca-73e1-4305-bf3b-08dd5ffc5a07 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: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7676 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 From: Richard Ball Co-Authored-By: Matthieu Longo --- gas/config/obj-elf.c | 411 ++++++++++++++++++++++++++++++++++++++++ gas/config/obj-elf.h | 27 +++ gas/config/tc-aarch64.c | 102 ++++++++++ gas/config/tc-aarch64.h | 5 + 4 files changed, 545 insertions(+) diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 0eb809cc15e..2d920942316 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -41,6 +41,10 @@ #include "elf/alpha.h" #endif +#ifdef TC_AARCH64 +#include "elf/aarch64.h" +#endif + #ifdef TC_MIPS #include "elf/mips.h" #endif @@ -2127,6 +2131,413 @@ obj_elf_seen_attribute (int vendor, unsigned int tag) return false; } +static bool +extract_string_literal (attribute_arg_value* arg_out) +{ + skip_whitespace (input_line_pointer); + + if (*input_line_pointer != '"') + { + as_bad ("Missing token '\"' for expected string: %c", *input_line_pointer); + return false; + } + + arg_out->type = STRING_VALUE; + int len; + arg_out->value.string = demand_copy_C_string (&len); + if (len > 0) + { + arg_out->optional_set = true; + return true; + } + + arg_out->value.string = NULL; + return false; +} + +static bool +extract_identifier (bool (*char_predicate) (char), attribute_arg_value* arg_out) +{ + expressionS exp; + + /* Try to extract a value from the identifier. */ + if (ISDIGIT (*input_line_pointer)) + { + expression (& exp); + if (exp.X_op != O_constant) + { + as_bad (_("invalid value, expected an integer literal")); + goto bad_integer_literal; + } + int val = exp.X_add_number; + arg_out->optional_set = true; + arg_out->type = ULEB128_VALUE; + arg_out->value.u64 = val; + return true; + } + + /* Try to extract a symbol. */ + const char *s = input_line_pointer; + unsigned int i = 0; + for (; char_predicate (*input_line_pointer); ++input_line_pointer) + i++; + if (i == 0) + return false; + char* val = xmemdup0 (s, i); + arg_out->optional_set = true; + arg_out->type = STRING_VALUE; + arg_out->value.string = val; + return true; + +bad_integer_literal: + ignore_rest_of_line (); + return false; +} + +typedef struct obj_attr_v2_known_identifier +{ + const char *name; + const uint32_t val; +} obj_attr_v2_known_identifier; + +static bool +obj_attr_v2_lookup_known_symbol ( + const char *identifier, + const obj_attr_v2_known_identifier known_identifiers[], + const size_t N_identifiers, + uint32_t *val_out) +{ + if (identifier == NULL || known_identifiers == NULL || N_identifiers == 0) + return false; + + for (size_t i = 0; i < N_identifiers; ++i) + if (!strcmp (known_identifiers[i].name, identifier)) + { + *val_out = known_identifiers[i].val; + return true; + } + return false; +} + +static int +obj_attr_v2_look_symbol_table (const char *name) +{ + if (name == NULL) + return -1; + + symbolS *symbolP; + symbolP = symbol_find (name); + if (symbolP == NULL) + return -1; + + if (! S_IS_DEFINED (symbolP)) + return -1; + + valueT val = S_GET_VALUE (symbolP); + DEBUG_TRACE ("Resolved symbol '%s' to %lu", name, val); + return val; +} + +static bool +obj_attr_parse_arg (attribute_arg_type arg_type, + const obj_attr_v2_known_identifier known_identifiers[], + const size_t N_identifiers, + bool skip_backend_symbol_attribute_lookup, + attribute_arg_value *arg_out) +{ + bool match_symbol (char c) + { + return ISALNUM (c) || c == '_'; + } + + /* Note: for now, symbol look-up for string literals is not available. */ + if (arg_type == STRING_VALUE) + return extract_string_literal (arg_out); + + /* Try to extract an identifier (symbol, integer literal). */ + if (! extract_identifier (&match_symbol, arg_out)) + return false; + + /* The identifier is fully resolved. */ + if (arg_out->type == ULEB128_VALUE) + return true; + + /* The identifier is a symbol, let's try to resolve it using the provided list + of known symbols. */ + gas_assert (arg_out->type == STRING_VALUE); + uint32_t resolved_symbol_value; + if (obj_attr_v2_lookup_known_symbol (arg_out->value.string, + known_identifiers, + N_identifiers, + &resolved_symbol_value)) + { + free ((void *) arg_out->value.string); + arg_out->value.u64 = resolved_symbol_value; + arg_out->type = ULEB128_VALUE; + return true; + } + + int resolved_symbol; + if (skip_backend_symbol_attribute_lookup) + { + /* Try to resolve the name using the symbol table for this compilation + unit. */ + resolved_symbol = obj_attr_v2_look_symbol_table (arg_out->value.string); + if (resolved_symbol == -1) + goto bad; + } + +#ifndef CONVERT_SYMBOLIC_ATTRIBUTE + #define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1 +#endif + + /* Note: for now, CONVERT_SYMBOLIC_ATTRIBUTE can only handle integers. */ + resolved_symbol = CONVERT_SYMBOLIC_ATTRIBUTE (arg_out->value.string); + if (resolved_symbol == -1) + { + /* Try to resolve the name using the symbol table for this compilation + unit. */ + resolved_symbol = obj_attr_v2_look_symbol_table (arg_out->value.string); + if (resolved_symbol == -1) + goto bad; + } + + free ((void *) arg_out->value.string); + arg_out->value.u64 = resolved_symbol; + arg_out->type = ULEB128_VALUE; + return true; + +bad: + as_bad ("unknown symbol: %s", arg_out->value.string); + free ((void *) arg_out->value.string); + return false; +} + +void +obj_elf_obj_attr_v2_free_args (attribute_arg_value *args, size_t n) +{ + for (size_t i = 0; i < n; ++i) + if (args[i].type == STRING_VALUE && args[i].value.string != NULL) + free ((void *) args[i].value.string); + free (args); +} + +attribute_arg_value * +obj_elf_subsection_obj_attr_v2_parse_args (int nargs, ...) +{ + bool match_subsection_char (char c) + { + return ISALNUM (c) || c == '_' || c == '-'; + } + + va_list args; + va_start (args, nargs); + + attribute_arg_value* attrs = calloc (nargs, sizeof (attribute_arg_value)); + + for (int count = 0; count < nargs; ++count) + { + skip_whitespace (input_line_pointer); + + attribute_arg_type type_next_arg = va_arg (args, attribute_arg_type); + + if (type_next_arg == SECTION_IDENTIFIER) + { + if (!extract_identifier (&match_subsection_char, &attrs[count])) + { + as_bad (_("Invalid token for section name: %c"), *input_line_pointer); + goto bad; + } + gas_assert (attrs[count].type == STRING_VALUE); + attrs[count].type = SECTION_IDENTIFIER; + } + else if (type_next_arg == ULEB128_VALUE || type_next_arg == STRING_VALUE) + { + const obj_attr_v2_known_identifier known_identifiers[] = + { + {"ULEB128", 0}, + {"uleb128", 0}, + {"NTBS", 1}, + {"ntbs", 1}, + {"optional", 1}, + {"required", 0}, + }; + if (! obj_attr_parse_arg ( + type_next_arg, known_identifiers, + ARRAY_SIZE (known_identifiers), + /* skip_backend_symbol_attribute_lookup */ true, + &attrs[count])) + goto bad; + } + + if (count + 1 < nargs && skip_past_comma (&input_line_pointer) == -1) + goto bad; + } + + va_end (args); + demand_empty_rest_of_line (); + + return attrs; + +bad: + obj_elf_obj_attr_v2_free_args (attrs, nargs); + va_end (args); + as_bad (_("Expected , , ")); + ignore_rest_of_line (); + return NULL; +} + +attribute_arg_value * +obj_elf_obj_attr_v2_parse_args (int nargs, ...) +{ + if (elf_obj_attr_subsections (stdoutput).last_ == NULL) + { + as_bad (_("A subsection has to be declared before declaring attributes")); + ignore_rest_of_line (); + return NULL; + } + + va_list args; + va_start (args, nargs); + + attribute_arg_value* attrs = calloc (nargs, sizeof (attribute_arg_value)); + + for (int count = 0; count < nargs; ++count) + { + skip_whitespace (input_line_pointer); + + attribute_arg_type type_next_arg = va_arg (args, attribute_arg_type); + + gas_assert (type_next_arg == ATTRIBUTE_KEY + || type_next_arg == ATTRIBUTE_VALUE); + + if (type_next_arg == ATTRIBUTE_KEY) + { + if (! obj_attr_parse_arg ( + type_next_arg, NULL, 0, + /* skip_backend_symbol_attribute_lookup */ false, + &attrs[count])) + goto bad; + } + else if (type_next_arg == ATTRIBUTE_VALUE) + { + obj_attr_encoding_v2 expected_value_type = + elf_obj_attr_subsections (stdoutput).last_->encoding; + gas_assert (expected_value_type == ULEB128 + || expected_value_type == NTBS); + + if (! obj_attr_parse_arg ( + expected_value_type == ULEB128 ? ULEB128_VALUE : STRING_VALUE, + NULL, 0, /* skip_backend_symbol_attribute_lookup */ true, + &attrs[count])) + goto bad; + } + + if ((count + 1 < nargs) && (skip_past_comma (&input_line_pointer) == -1)) + goto bad; + } + + va_end (args); + demand_empty_rest_of_line (); + + return attrs; + +bad: + obj_elf_obj_attr_v2_free_args (attrs, nargs); + + va_end (args); + as_bad (_("expected , ")); + ignore_rest_of_line (); + return NULL; +} + +void +obj_elf_record_subsection_obj_attr_v2 (const char* name, + bool optional, + obj_attr_encoding_v2 encoding) +{ + obj_attr_subsection_v2* already_recorded_subsec = + obj_attr_subsection_v2_find_by_name + (elf_obj_attr_subsections (stdoutput).first_, name, false); + + if (already_recorded_subsec != NULL) + { + /* Check for mismatching redefinition of the subsection, i.e. the names + match but the properties are different. */ + if ((already_recorded_subsec->optional != optional) + || (already_recorded_subsec->encoding != encoding)) + { + as_bad (_("Recalled subsections must have the same parameters")); + return; + } + /* Move the existing subsection to the last position. */ + LINKED_LIST_REMOVE(obj_attr_subsection_v2) ( + &elf_obj_attr_subsections (stdoutput), already_recorded_subsec); + LINKED_LIST_APPEND(obj_attr_subsection_v2) ( + &elf_obj_attr_subsections (stdoutput), already_recorded_subsec); + } + else + { + const char *vendor_name = + get_elf_backend_data (stdoutput)->obj_attrs_vendor; + obj_attr_subsection_scope_v2 scope = + (strncmp (name, vendor_name, strlen (vendor_name)) == 0) + ? SUBSEC_PUBLIC + : SUBSEC_PRIVATE; + + obj_attr_subsection_v2* new_subsection = + _bfd_elf_obj_attr_subsection_v2_init (name, scope, optional, encoding); + LINKED_LIST_APPEND(obj_attr_subsection_v2) ( + &elf_obj_attr_subsections (stdoutput), new_subsection); + } +} + +void +obj_elf_record_obj_attr_v2 (uint64_t key, attribute_arg_value *value) +{ + union obj_attr_value_v2 obj_attr_vals; + if (value->type == ULEB128_VALUE) + obj_attr_vals.uint_val = value->value.u64; + else + { + /* Move the string. */ + obj_attr_vals.string_val = xstrdup (value->value.string); + value->value.string = NULL; + } + + obj_attr_v2* obj_attr = _bfd_elf_obj_attr_v2_init (key, obj_attr_vals); + if (value->type == STRING_VALUE) + obj_attr_vals.string_val = NULL; + + /* Go over the list of already recorded attributes and check for + redefinitions (which are forbidden). */ + bool skip_recording = false; + obj_attr_v2* recorded_attr = obj_attr_v2_find_by_tag + (elf_obj_attr_subsections (stdoutput).last_, obj_attr->tag, false); + if (recorded_attr != NULL) + { + if ((value->type == ULEB128_VALUE + && recorded_attr->vals.uint_val != obj_attr->vals.uint_val) || + (value->type == STRING_VALUE + && strcmp (recorded_attr->vals.string_val, obj_attr->vals.string_val) != 0)) + as_bad (_("Attribute %u cannot be redefined"), recorded_attr->tag); + skip_recording = true; + } + + if (skip_recording) + { + if (value->type == STRING_VALUE && obj_attr->vals.string_val != NULL) + free ((void *) obj_attr->vals.string_val); + free (obj_attr); + return; + } + + gas_assert (elf_obj_attr_subsections (stdoutput).last_ != NULL); + gas_assert (obj_attr != NULL); + LINKED_LIST_APPEND(obj_attr_v2) ( + elf_obj_attr_subsections (stdoutput).last_, obj_attr); +} + /* Parse an attribute directive for VENDOR. Returns the attribute number read, or zero on error. */ diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h index c8b57406685..5ef1701b5ac 100644 --- a/gas/config/obj-elf.h +++ b/gas/config/obj-elf.h @@ -54,6 +54,23 @@ extern int mips_flag_mdebug; #endif #endif +typedef enum { + SECTION_IDENTIFIER, + ULEB128_VALUE, + STRING_VALUE, + ATTRIBUTE_KEY, + ATTRIBUTE_VALUE, +} attribute_arg_type; + +typedef struct { + union { + const char* string; + uint64_t u64; + } value; + bool optional_set; + attribute_arg_type type; +} attribute_arg_value; + enum elf_visibility { visibility_unchanged = 0, @@ -206,6 +223,16 @@ extern struct fix * obj_elf_get_vtable_inherit (void); extern struct fix * obj_elf_get_vtable_entry (void); extern bool obj_elf_seen_attribute (int, unsigned int); + +extern attribute_arg_value * + obj_elf_subsection_obj_attr_v2_parse_args (int nargs, ...); +extern attribute_arg_value * + obj_elf_obj_attr_v2_parse_args (int nargs, ...); +extern void obj_elf_obj_attr_v2_free_args (attribute_arg_value *, size_t); +extern void obj_elf_record_subsection_obj_attr_v2 (const char *, bool, + obj_attr_encoding_v2); +extern void obj_elf_record_obj_attr_v2 (uint64_t, attribute_arg_value *); + extern int obj_elf_vendor_attribute (int); /* BFD wants to write the udata field, which is a no-no for the diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index ff40726ba75..4cad09c8e91 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -2401,6 +2401,56 @@ s_tlsdescldr (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); } + +/* Parse a .aeabi_subsection directive. */ +static void +s_aarch64_aeabi_subsection (int ignored ATTRIBUTE_UNUSED) +{ + const size_t N_ARGS = 3; + attribute_arg_value* args = + obj_elf_subsection_obj_attr_v2_parse_args ( + N_ARGS, SECTION_IDENTIFIER, ULEB128_VALUE, ULEB128_VALUE); + + bool is_valid_boolean (uint64_t value) + { + return value == 0 || value == 1; + } + + bool is_valid_optional (uint64_t value) + { + return value == 0 || value == 1; + } + + if (args == NULL) + return; + + if (! is_valid_boolean (args[1].value.u64)) + as_bad (("Expected subsection values for are 0 or 1")); + if (! is_valid_optional (args[2].value.u64)) + as_bad (("Expected subsection values for are 0 or 1")); + + obj_elf_record_subsection_obj_attr_v2 (args[0].value.string, + args[1].value.u64, + args[2].value.u64); + + obj_elf_obj_attr_v2_free_args (args, N_ARGS); +} + +/* Parse a .aeabi_attribute directive. */ +static void +s_aarch64_aeabi_attribute (int ignored ATTRIBUTE_UNUSED) +{ + const size_t N_ARGS = 2; + attribute_arg_value* args = + obj_elf_obj_attr_v2_parse_args (2, ATTRIBUTE_KEY, ATTRIBUTE_VALUE); + + if (args == NULL) + return; + + obj_elf_record_obj_attr_v2 (args[0].value.u64, &args[1]); + + obj_elf_obj_attr_v2_free_args (args, N_ARGS); +} #endif /* OBJ_ELF */ #ifdef TE_PE @@ -2481,6 +2531,8 @@ const pseudo_typeS md_pseudo_table[] = { {"tlsdesccall", s_tlsdesccall, 0}, {"tlsdescldr", s_tlsdescldr, 0}, {"variant_pcs", s_variant_pcs, 0}, + {"aeabi_subsection", s_aarch64_aeabi_subsection, 0}, + {"aeabi_attribute", s_aarch64_aeabi_attribute, 0}, #endif #if defined(OBJ_ELF) || defined(OBJ_COFF) {"word", s_aarch64_cons, 4}, @@ -11320,4 +11372,54 @@ aarch64_elf_copy_symbol_attributes (symbolS *dest, symbolS *src) S_SET_SIZE (dest, S_GET_SIZE (src)); } } + +static bool +aarch64_obj_attr_v2_lookup_known_symbol (const char *identifier, uint32_t *val) +{ + if (identifier == NULL) + return false; + + /* IMPORTANT: This list must be alphabetically sorted. */ + static const struct + { + const char *name; + const uint32_t val; + } known_identifiers[] = + { + {"Tag_Feature_BTI", 0}, + {"Tag_Feature_GCS", 2}, + {"Tag_Feature_PAC", 1}, + {"Tag_PAuth_Platform", 1}, + {"Tag_PAuth_Schema", 2}, + }; + + for (unsigned i = 0; i < ARRAY_SIZE (known_identifiers); ++i) + { + int cmp = strcmp (known_identifiers[i].name, identifier); + if (cmp == 0) + { + *val = known_identifiers[i].val; + return true; + } + else if (cmp > 0) + break; + } + return false; +} + +/* Convert a symbol related to object attribute v2 to its corresponding + integer value. */ +int +aarch64_convert_symbolic_attribute (const char *name) +{ + if (name == NULL) + return -1; + + uint32_t value = 0; + /* Try to resolve the name against a known list of identifiers. */ + if (aarch64_obj_attr_v2_lookup_known_symbol (name, &value)) + return value; + + return -1; +} #endif diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index acf1ce4aa03..1499ec6938d 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -344,4 +344,9 @@ void tc_pe_dwarf2_emit_offset (symbolS *, unsigned int); #endif /* TE_PE */ +#ifdef OBJ_ELF +#define CONVERT_SYMBOLIC_ATTRIBUTE(name) aarch64_convert_symbolic_attribute (name) +extern int aarch64_convert_symbolic_attribute (const char *); +#endif + #endif /* TC_AARCH64 */ From patchwork Mon Mar 10 17:51:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107596 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 5CF23385842C for ; Mon, 10 Mar 2025 18:00:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CF23385842C 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=nSwdpgR2; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=nSwdpgR2 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061c.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::61c]) by sourceware.org (Postfix) with ESMTPS id ECFDC3858CDB for ; Mon, 10 Mar 2025 17:52:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECFDC3858CDB 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 ECFDC3858CDB Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::61c ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629168; cv=pass; b=SQhZLHYVzdhaZQwCIO3MFno2j2Ua6F4OBtElr8YeUW3G8F1bnx3FNIDFuAvrbKc/nYS05B3DCJeNULHtHJRPFB5ve3Z5fLNo6g6HkSLj0v9adeMa/Spd7GXn0+yq2BaLQ1Pr/BUFeNNfH0dm7tuEgjY44QAhGceQquh0psRxkV8= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629168; c=relaxed/simple; bh=ViuqvMw14BhTXB+8bhmf7c9eNwCcSSLQGsOCvZvtQMQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=VxdNuS9XI7/RK50P9ye8gWqiAjtmBjDeQDTmxFq9E6gG17lIjMYqRf9ZnvbP0l0WaWaYTuq7LFFhqbJG5bgYCIta4d67GT9Ghp4CDTaaaZywLyJybclOM+pRfFpCSt8d3b21y9zXjKFQWx5CzLL5SUOhzRV6DS8DbfgXs2mkzHI= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECFDC3858CDB ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=SFkdGPEeJWPvkl2HofqVW4xQBdAQNBUFvUXtPi18Iv0OR9hq3mGRHm+B4HyE2pa2Nwhh26sABcqw4as8FBQwh3YH9pC+9AXtC7SSfdluTYcgRbvfc2KjLCWIdWtVIX9rMJcC42o4qKEeYdarCf1ZKwZ03PEeql5nDU1i7VCUQQ5BKud+QuLAp1/TN88YDeD5pq2pTkfH41BDar3CxkP9g+sP/0PWfiOwkQSAoszth6+K1euSf1cmdPmuNsUAtHBM2PFpeAHODcTU5B/5bUP5o3gfR+SItGSAGxwCJpDR5DVdPYC7FDCUw2OcqWAN3qy0vGdlMThY4qYZnzv5+RsRUw== 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=z9uJPOv/+iaBWCpZcUS0xa0zhr5sILy/2j9U5Z1Vvuk=; b=iIG/TvNgg4Noif0HuwjoAZffpkvQYXS3YmuZpp9CYhjM1WiikdQtNWboFpXGqKJaLGSmXFxAniYSdPxuQMPRtbxGNdkkKvxOxa5xSmHvrl3sDm9NWocRW6Ptqfe21sjZIyu+yJ6kX+XMTSsvMpWFJljXr4r6Zmrzuqb0aCsH3Ppb2V+nBZ0rbrHf5ELLvlQ2umOjbbpZoYlZLJNEoEmheiQZXh6SobL9YevSiMVKTCefQkA3j0ovqQmRtDPjxFuyJ4ZHfE/QvSfgKryvK179EYSKLPBxaEEO75kNyuswlj+ST/ZgXn2uGPG/vEyLDzUVodCgSy0nEU3NOv2EfsPwGQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=z9uJPOv/+iaBWCpZcUS0xa0zhr5sILy/2j9U5Z1Vvuk=; b=nSwdpgR2dFVOOecMyfsC1oA/vmgSun+bAKdF13A5bkc+NIBpV4iUMaw8dDmRcRih2pIHlhNUheFC85VhkIbPqBupR7EHKVC2H0x57iqXj9mjOz0+QpPVmHTndhKJlCtBa53xMx5momGI3ukAkX8jepQNV0uPgwyQR/3Q+KssaH0= Received: from DU2PR04CA0230.eurprd04.prod.outlook.com (2603:10a6:10:2b1::25) by DB5PR08MB10062.eurprd08.prod.outlook.com (2603:10a6:10:48f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:52:43 +0000 Received: from DB1PEPF000509FB.eurprd03.prod.outlook.com (2603:10a6:10:2b1:cafe::6a) by DU2PR04CA0230.outlook.office365.com (2603:10a6:10:2b1::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:43 +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=arm.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 DB1PEPF000509FB.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:43 +0000 Received: ("Tessian outbound bc832f6acacf:v585"); Mon, 10 Mar 2025 17:52:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7b920fed5c26dd3f X-TessianGatewayMetadata: vvxOyeJ+SJNneTAPMKL0kRLm1jfrTsmAVBAXQkxF7wSXVJXemCA+6ksb/U8FDo2mbKk6Zpyj5Irm7Wzeh3xzz/Md9tC9nF7HWLL3PjZrByuA1o3DdbLtpx8adtMh9MFh1bld4Ut+zZ3/2LUeVkuLKZbkY8wgSRMIipkW0p/mUeM= X-CR-MTA-TID: 64aa7808 Received: from L99e66e4fa2ff.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1072740C-5083-4D46-8EE1-B86425480363.1; Mon, 10 Mar 2025 17:52:35 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L99e66e4fa2ff.2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:52:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GqV3QYNI77NDXlCvpiaw/nBmMH3STw0cVknLQ51Ah/EZOQW5bXvRyt2i9AXFu11HTHM+gAvvsJ0y/2TRrsZkZCv+4nTzLEZbWFMmR/HYKrDctxXeQW4I5/aspXvqzHIl/quy7tE5KsWrZucjd2Id7jHnfIdRMFEsCGj2rzvHQbPou3Xihhd0N00ilZAU59kXMwyMrJ0MOfm063UCRmaGH+p9GPp3F9NSaooBKKuuENbKTWOeeG4BWza6fM4gEegF5QDrgmrwhKnGdIEt8wogbfTyhFBQpLv0zlY7UU31DfYXOjXWqcL2kHLUM3Bkc1CpGrQI106W45kWBoCwtKH+Mw== 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=z9uJPOv/+iaBWCpZcUS0xa0zhr5sILy/2j9U5Z1Vvuk=; b=SKaOkfHRWGtCH8lolTJIqjel0bwbyIFj51g+BRlQeZnckDMWX653nVTpLvQr70iSPOBaoQXt8EZMRIdzYchyYZW5aZPlxhHSbzgMNbVmqqfOdqZwxuIy01Sv/ffXDo3l+UROmXgwalL+nmxF3Vka/0mh+to4mkTIb3z0mdhq79ynILZojLiOgy7mEbTKL+N2AQK7GQYYWg2ls1U/tK98Ai5keQkmyJerXML6ImTRA1x97fk0RJqJVgM8VS31UybmTMI/F0kwfNlVke55vAgFml7qFCMGQkpjnmGteNZTH5rQGI4egLD0Vl/WZqzmVJEv5ezrTSxHP8nkLzuUAem+sg== 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=z9uJPOv/+iaBWCpZcUS0xa0zhr5sILy/2j9U5Z1Vvuk=; b=nSwdpgR2dFVOOecMyfsC1oA/vmgSun+bAKdF13A5bkc+NIBpV4iUMaw8dDmRcRih2pIHlhNUheFC85VhkIbPqBupR7EHKVC2H0x57iqXj9mjOz0+QpPVmHTndhKJlCtBa53xMx5momGI3ukAkX8jepQNV0uPgwyQR/3Q+KssaH0= Received: from CWLP265CA0451.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:1b7::11) by DB9PR08MB6618.eurprd08.prod.outlook.com (2603:10a6:10:263::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:52:34 +0000 Received: from AM4PEPF00027A5F.eurprd04.prod.outlook.com (2603:10a6:400:1b7:cafe::ee) by CWLP265CA0451.outlook.office365.com (2603:10a6:400:1b7::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:33 +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 AM4PEPF00027A5F.mail.protection.outlook.com (10.167.16.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:33 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Mon, 10 Mar 2025 17:52:26 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) 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.39; Mon, 10 Mar 2025 17:52:25 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:52:25 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 04/15] gas/write.c: add missing flag SEC_HAS_CONTENT on object attributes section Date: Mon, 10 Mar 2025 17:51:17 +0000 Message-ID: <20250310175131.1217374-5-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5F:EE_|DB9PR08MB6618:EE_|DB1PEPF000509FB:EE_|DB5PR08MB10062:EE_ X-MS-Office365-Filtering-Correlation-Id: 7327edb8-5c65-433c-7a2e-08dd5ffc5bb8 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info-Original: 53J7LVdEydtJgTtTtTot3vYVbtuJCojvX8gR+sQd1jikzXmabt3e7E3+9d/xZk3FDZukDDNK9DtWMZjSauvPeuxCHRJmK1r8xg+4X+jl3pptJKsCZHWCeI+uG9KV9YnD/3Jlox2RiDOFex/qs9FYghPHfBs004c2VZrQcqwC6xp38D/WpiqFRCwI3z3ElYrAYgKuU+G89bnqssVfuMYytdQfqNqmUUHgNb0dC1wuEwz6NUpl+4K3apmTMw9Bmc0a4OPvvDIXpUjF6FWj8oeaFfZKhqMW1qNw5Ml/cip3SpKQV0ahBtkZPy58FcCHiBHSUh4YEgQNHUE1QjC9PVXSwHOLbgeMLSoe6M81u7K39TpZSQ23Gph8S13p7Y8jpZXpm/iNNya4Y7PbvLDHPQfJWVcaT56BOqLLQsjrI4KTa2YQFRnigYPc2PWqvJxRwXtgApi9y2ri3x8HGKjaMiFCd/09HqA0n7Gga1i3qbupHGOOLdSvEHc9Ewimh7RyPnNcfIRsKRsPDYASQxDD2zHkYKVjE7fqNw4jiTO5O/+SPlnuSRIegfgbIB1MDcAgEyUkX9LqzC3XF0uzA7T7+DZIDKDTr6pA/23plXpJ6aHH0SaVVhG8gFUUwSwLROWpqKAoiIFDdgCXLZVIhRTAPNSSMQuWQsKQBci92ZqluiT2zgUZf0pSLNRZleBn2tX+fjKDsL0HYpG3bmv6LD9+I44vuFSwdRzh/IysZhWi2GKyCiIZq8FgziiC8Y7amuR0Y4XR60ioOmXnHfD8sbFz+yBVaWInzXsdpN4GQkYWqZbL9sIzsdghdyslxSwKStm54GdmVrJwExbDXMDqn/xdkDOVw1+c0hE3pq8mSekYkcFUkLpRmonPeo7taywItV1LsdyVg0dbwXLO4qbhHk3rDUiXTLLMyUqXa0OPLv32q0dWkz7eWUVPEvDGbWI6Gi5FXQoBsEQTrAp08oJlFJIZB3KxBHbMK1w4slCTpsUiWV6h1XKgwBgpvSKnBJxm1dpEbEMVPJWe8Dfq4GEyAn2Lx/Qyl1y3wjb1zI0uQM7Z987pRrixCQ7ELRtx+q/2SX5gDnGdyaZ/ZmarjEepHiveyztQ+Hykje65nVwO+ElesNlBBpHeEDamru/UhY+zA/iqaa12EPvnxhQ2mheGv31jKQy3/+6rE07vdpF48CvFlWAgXcLFVE1vMRIBazaGbFxs/c0pjsx6Mtsprt2OL1F48UbcRu/IpYBa3nNhtntV1GYPll5o40GcHTMeMKkc+B1N/pF3K5YEL8hPzgb5humQrWtx40dCQOkoI7NOCL3QEXlooipZdoulYu2LMspB3R2w4C7VDPEcjcc6nrTpLU57XqCCVXUchZkj4QHXeftpHGzmLmDFA5jplM5J2oCzFYm3MM1wdWsROqv1t/ObmsLIQZHXK4yujOZoOCskv2e3Wtfjml5FCWZOCV4ar3lyXmKn+CZdMG8NuFZcfG3xP2KEf12f6Hv/i6QO3f2F/e3ooKkzDpg= 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)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6618 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:400:1b7::11]; domain=CWLP265CA0451.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509FB.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 755b0308-ee8e-4fae-b0cd-08dd5ffc5633 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|14060799003|35042699022|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 9ueZJpL2ehcS91ktkt7B9ZQHotg90M1lDVjNtmYsfD6CtBCTbgzIn14wXKtdUHeKqhV5jBdwosq+TKbb9L18HpMRrRjuB1gmhK7vzuHjppKIPDDQZYYLL/A5eD0fJVAw4CnQ4FYR1RudrIXY5lK4xi6S+ZVfV4czfMzo2f2F82ou1Q6h2V2Px5eK5Vua7Mh2gJtINLZ4Jc/i53S5UBcCCDURlkwoxY+l7cTJbQSXm7WVWHacyTC0N/pi/pjRQ5rOWHB+X5nuse11IcRhA2Fem8zscl+hNf4Ih/nMJ1UNMyRu6lC0Rk5nc1TYaAMqBz681neH0xc/pzwqWeiwSRVmoN2Byc/3koBurrKwrzr7NIzCSTjl/2F5D5gf/9TagybJi6bc5zgtqyXtd3hqteiEB4LzSw8i1xJbnlcUB14tfF6PHEjNmpG2KP6B7hbgG+SxGZVlxcQcbI/K2O6jwb8bFe9XOLSuVgn8PGXwu1hzpRQBQELDwrSAvmhGLRth1hRZjOsjzaj7cCc8SNgCK1yXTwo+yGNdqtjyhZUtc59Xhr06NRBAw8AM4f+VqpMaHMmKedGgolYZcGxUWb0whPy0axb+/fjvEo4QhQWGP3PVOKVFd++bt8DP4Z5qGC2gAnnrWpbJO2COBROV9ry7Wu1MISP29eZYVCCE9dEIbKyFB1H9/nXG39T5jC7ksndFwUdvpYs7bbDZWVc2J8w51DOjdy9ag6VNYCjUvnDqzC1SQxuALLOk58gfMlKsunKP1zeevrF2573meDjLaXPqSNFd87Hnl1z31nxRceIV1WNhjdEUNnA/dxaYluZHqtZ92ZWTaprMbglb2V+BKlbr2zfH8rKcB08gv0QdoNt4xAHvrWyUkUBVGWFaqwmfLWIzWcdlxqbF2ewgUWNepK0yz4pi2sBvP91H8kxqgaMWbP0lq5UGqMq4xVXeK5hNni6vsHtDZjrLdA9P3uzJsqa944GuTJizSUzLOlX6IiXX6lEB9GoN0D3AnT1KKECkZju7gxJ5kvIAedDeU4hsnB3NQUJoYjP9FxR+haFenwAGBqvv8dxHTVYwNV0EJEL3xF1u8vGbEkP/GTjj/B0M9JY7vMIq7y7CtmAudYAop7cJGiDNaFUoLcs7GNQAQoQMTVetJrNY7Tmxjw7kjK7BoXoJX/4nD40vlg3acd20k9h1kyj+ux1CUy3KorWKfAZ9gfC4Qc9Jb28I6McO8FMN0MJh2/rdSLAof72T0QJdTxrvmmXYPRFOy8DOaDqX12QIKJ0FX9AThLSimyZXdMAWD1TmF7uTDfCC5GQql2Eaio9YLBEPS2KKzPi+zoH2SA7TU5BygwlEBaowuXbprFKp0wPVusGUFp5Va7zm1tZXjckBUNVp0QDG1gVX/hc/4j9c7nGtNd86IzrQwxdhiVVNCVNrMjPbK3aciInj3oDyKsQu1QLjKdhRNBLSzWWeJjbB/0q65d95/39Rb1LUiRGP7frIdgKadf7QofMfsPyHmJgH0RdrW6s= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(376014)(14060799003)(35042699022)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:52:43.1067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7327edb8-5c65-433c-7a2e-08dd5ffc5bb8 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: DB1PEPF000509FB.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB10062 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 --- gas/write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gas/write.c b/gas/write.c index c725841d505..476d8e42081 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1936,7 +1936,7 @@ create_obj_attrs_section (void) segT s = subseg_new (name, 0); elf_section_type (s) = get_elf_backend_data (stdoutput)->obj_attrs_section_type; - bfd_set_section_flags (s, SEC_READONLY | SEC_DATA); + bfd_set_section_flags (s, SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); frag_now_fix (); char *p = frag_more (size); bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size); From patchwork Mon Mar 10 17:51:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107592 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 1C3443858CD1 for ; Mon, 10 Mar 2025 17:55:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C3443858CD1 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=Hu/yeW5e; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=Hu/yeW5e X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20611.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::611]) by sourceware.org (Postfix) with ESMTPS id 1A6703858CDB for ; Mon, 10 Mar 2025 17:53:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A6703858CDB 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 1A6703858CDB Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::611 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629195; cv=pass; b=qZQ1ak8dnMERoFiISLsJNf1ocJEvDbUIikD5eu1DXekQvTsOY+D/2am8ByLZYa5rqlwT30x7pG2+0nyEZS/oPeqIk3LNLGS++sUPtSNGl7mnGt3whsSNEdFjSlEJ3Apet/vubP0d0thIaHx3BKl8MUWIIUQcz7hxkPfpCJMFn6Q= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629195; c=relaxed/simple; bh=rvaWl9FN9mRAw+Ceh4dwDCrqXXdmiSmlQPatjuIDN3Q=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=pBE0XIIfIqXIdrQ2YQXVs36LIc4ipyBxFvGvV3o+vk0dP/t4gNeu7HffiXgczLZmt5vCGsnVeHeYQrb3lA4TjNA1RFe+CgHaUMfgjmc7oU8Ofu7ggbW2Z4QKFzZw4+pcnhcyxENtK2h5VYcsLTxlNN0bzkFdgw9nahrCZK9dIaI= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A6703858CDB ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=bYWNBSBMK8NSvp/fS8mLM+VLkVTBwBJ3R2CcqIiYlRnylIBAtfdacPum+RfmI1ds8iQJXvdVWvhErpWzEHyt1Fm4qCqIqWhHHH4klhgIj98k/J9DKlfC+VWaULIIHqKS2TGaTVAx/K3UXcuwgRvJXe0M4TcSCTiNyhLh498a5j4qi5vQ6zkO7plNNb5U9BtWpmBY14tXsjl2dpLZqy4HbdVKjH7zpr72WEJ0QeziwJyXP0gm6ai9ST1X09T30kfPqFvwtm5kFG21qaGUnyJ+DT19wnimAOjehQlWCRg8CEzqYNJQ/u7oeihTBkAsQ3RmRj1XU3zAjZ0AKeRmPZWyXw== 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=V2/LHVcZv6SMcVQJm1a+EXeTwNk1Ddjulq4ALxB1J+c=; b=sc3xWs/l2jRWwFpKMqJV9DmGOhvbJmSzxhLyK1P5G/3WxMUh8QaZzYIO+PKTcFdZ3o0k3UVlRLBBzSLcw3yNXiIBrk/M2RGohIuRfP4zsmOgL834IfIaJmDOZYUynrcgvyPVzLEGnzMVA9mttPOy1YtWPOTAA/aE9QEA3QqykpB7gFgOVTi5JDezgOubcjESpxWOb7dS+ItNNgZjyZezN+nDDL3dWoab4e+xnkATRd4b77NIERHXIqLckTjjhz9vAxa/4e5keIs/uyVvpDO0Vs96ymqtb/FErigvXtVyvUXRjDhKZ7qEYoa3OhRsSzi6wlrv/BDbZhqTN8K3087ngw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=V2/LHVcZv6SMcVQJm1a+EXeTwNk1Ddjulq4ALxB1J+c=; b=Hu/yeW5ekKSW3cnbi5pBA7x8FTlIDhK35LzuSO2SZGi7PhnRotkeYqEC7VvsaSBmKZVMoQyX71lRJiFjSi+PSA9Q1+ubmPGLyxIapIDhx+l8tRQYJnGy61G4ptzbnxhT4Viqec3JInmiywzoGQdklBxDPHvEKbaWKiuhVWmhWC8= Received: from DUZPR01CA0257.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b5::29) by AS2PR08MB9125.eurprd08.prod.outlook.com (2603:10a6:20b:5e5::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:10 +0000 Received: from DB1PEPF000509F7.eurprd02.prod.outlook.com (2603:10a6:10:4b5:cafe::11) by DUZPR01CA0257.outlook.office365.com (2603:10a6:10:4b5::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:09 +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=arm.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 DB1PEPF000509F7.mail.protection.outlook.com (10.167.242.153) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:09 +0000 Received: ("Tessian outbound a81432d5988b:v585"); Mon, 10 Mar 2025 17:53:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7e9556cc23119d2e X-TessianGatewayMetadata: x69PAKOnL5daxrEYpNPcwd6Z30yUZuND5Os5UvhEwd+ZzEHUOmzfv23zG+abeuQsY22eFmUAQt47z0eMa1d1pNy4kFpksgNhYYJ7tVT+y6Epn2fbwM/b12/+8Ma64esgMCGX/GlHMxE/RCsYMX1U8azaXL1dLTx2byOgOK0ne28= X-CR-MTA-TID: 64aa7808 Received: from L1e7c45563be8.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9DEEEC1C-B15E-49D8-A1FC-75036EB5A486.1; Mon, 10 Mar 2025 17:53:03 +0000 Received: from OSPPR02CU001.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L1e7c45563be8.2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RskoDj33OJny7bdIEQ9dPpoKBNOyZUXddq0xRO2R4UrMZ4TpeHf+dWrpe1Hv95+KAZy9HiiUoQmATRPT+N4f/s3h+ujKy+MSZ9xlgI62Bf1J9InGH+sd8c9CMytl82HzCB3WXAKHXbwCF6rwhB/DBbK7S+1FNElEMIzyvGoZfPBKKUmdzr5Nu0wjHRPCNdy0K4cCRcw37Nai4XuxDRZQT+7RFrGnciZAJ9QXR4jc2fVaW8H0C8mmIhqf3DScbSHx2eQbkSy6JdDxAVBEtvBt+IJNjzoWKpOsrbLUP8JSj7XZxVuXW+hAWSo0+NZFaxNmOrwVAsuSXPBayA4Outh9Og== 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=V2/LHVcZv6SMcVQJm1a+EXeTwNk1Ddjulq4ALxB1J+c=; b=Y6PbqTpzYNHVusconRN3xQAYst2Q2IQq5n1WPjrXWF5ymNTo/KkzY8NEJfur6ni27SCBDeQTftiSNOZQ8DIHNIBg5mNflv/uaYhQJEk6Mh6iqSdW1T4FZu5jTYsOVlo2QUutRHG+3+UuldicYdy2RShbtuYU3bciWsnxoNpQf3MJ+dmrfq+71bGIcqNunJxRFxWuheW7AG343Vs0/75ulJIdLtumynyE63DqB/BIecSsx+O5SVTE1/g64IvmOeR3WemJX7hb3CG6O9Di8+s+Hc6Onz6YncwEd9XxleWHZ11RW6vP+qg+1+zPPUgQT4F0CLgH08qQIcaal2p9Jcer8Q== 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=V2/LHVcZv6SMcVQJm1a+EXeTwNk1Ddjulq4ALxB1J+c=; b=Hu/yeW5ekKSW3cnbi5pBA7x8FTlIDhK35LzuSO2SZGi7PhnRotkeYqEC7VvsaSBmKZVMoQyX71lRJiFjSi+PSA9Q1+ubmPGLyxIapIDhx+l8tRQYJnGy61G4ptzbnxhT4Viqec3JInmiywzoGQdklBxDPHvEKbaWKiuhVWmhWC8= Received: from CWLP265CA0311.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:5d::35) by VE1PR08MB5629.eurprd08.prod.outlook.com (2603:10a6:800:1a6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:52:59 +0000 Received: from AM4PEPF00027A64.eurprd04.prod.outlook.com (2603:10a6:401:5d:cafe::68) by CWLP265CA0311.outlook.office365.com (2603:10a6:401:5d::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:52:59 +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 AM4PEPF00027A64.mail.protection.outlook.com (10.167.16.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:52:58 +0000 Received: from AZ-NEU-EXJ01.Arm.com (10.240.25.132) 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; Mon, 10 Mar 2025 17:52:36 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EXJ01.Arm.com (10.240.25.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Mar 2025 17:52:36 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:52:35 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Richard Ball , "Matthieu Longo" Subject: [PATCH v0 05/15] bfd: write object attributes v2 Date: Mon, 10 Mar 2025 17:51:18 +0000 Message-ID: <20250310175131.1217374-6-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A64:EE_|VE1PR08MB5629:EE_|DB1PEPF000509F7:EE_|AS2PR08MB9125:EE_ X-MS-Office365-Filtering-Correlation-Id: 653e9ba2-0876-4b78-3bb1-08dd5ffc6b92 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info-Original: =?utf-8?q?VghA69HbLkwTAB8Y+ut8Gr?= =?utf-8?q?uoxM3MRaNf69niNZIb030dwHYDfRWUDXYXoyXK+UIpY85iEL+5wwnc0TvFpHdWPZL?= =?utf-8?q?4vrhOG/4ON0f2Cik378+jQdEtD5/xjsWR2po9ssxMlRJ6U3JvLI93I8IwlUivA8k7?= =?utf-8?q?0NyXRgnbK6vG41WEutv0g1xc/sAemL/wJoNz9X/Xh8NRmnszIgS+Zmrh1bdLH6OeO?= =?utf-8?q?lLA79NvRYxaJb+OHF6tWKUvJauJC/5LzeGchf+1rIVQM64hfLY1+yJdnMw5/l4TmJ?= =?utf-8?q?bbjFLRgKK6FcLxribg2Mk5/AzksF6pwFmOQXZqEjbZYpjlTEry3Me8pe4uvlJ/Ihf?= =?utf-8?q?WQNOHpyzUCSsUI7QewYRpg1q10dJpT6UEI4hwuBQNzcZH5PXpwE7TBguzC4Q00MqF?= =?utf-8?q?sHjA2jMqLdilZdBoiSbQmTRa4RyZVm+ZskKE/9I0lEgy+qPzZyEFwd8hIUiapB1+9?= =?utf-8?q?YZk5TyGget3k5Z7VsHkgzZfH9e+aMtSZdTzLMFRLS9LJHVnPEA+Oz9bDvYbz/6W++?= =?utf-8?q?riDYQk03kF5Esz9Yo31MvcUoSYru7mKKzE5MxtS5Gd3KAiLj9mWEGuqwEwA2UmTnW?= =?utf-8?q?gEWmb2dnRdKy9RBwnhmU57ApiODPPrVbHGlsgl+guhH8RjN3OUET8mZzQFM/0m1R6?= =?utf-8?q?Lh11PDA9BAN+xMd/v5cE5rfbGWFGqIrapBmzVmbtTcawociFkvLEN5kXKozRGen1o?= =?utf-8?q?EMTevW+u3UZ4UbuUtW96hwcQvnbRoZGVq24NHk3/z57BpQjYcAWJO54LAzGLEjdt+?= =?utf-8?q?hZT5Ilo+j2u7k4kTGFSAWsnJg0AwRqIh2C65Cg/LptG6PNAZu0B2hPyX4+k5mFyCu?= =?utf-8?q?u86ykWzlep3xKQar+2KHPXfqVV4q1hyDc7efcHu9GKifQPlG/qQPtxU9ZM74A8IYu?= =?utf-8?q?ENBa7uOAV9s4hyXpJe0IlyK9hWANNHFLUcR9Wl9Kr52c1BsmFtaevELrhVOaSwrrY?= =?utf-8?q?6bNXM1QvFiFTH63rE8lATbVAaSeYvtTu6gN6+r2c3PfV4OLqgYaDwVcN+lPIVvyfy?= =?utf-8?q?YG1ds0bF2kwrPCLgYbdxvNNFZiihE9ni883yosqJ+siVzYTP6sbfZPHeWzoJxR8H8?= =?utf-8?q?qjBy9CDs6+MZCbv9eHcv03DBP5lN0Pz28IGrx8D3kZ5J3DcthNR84GI3CyFFMa+mL?= =?utf-8?q?NlXl28XoeJC13HEG8rDGs6tERG9hs1DzEbwFfflNqKm/8tjFjBsm3U/qOXLdC+zTs?= =?utf-8?q?N4vsksIDc/SKZHU/T5SfgK/DVX/wh6tIAtx5gd9skum163rYKPm2B6oCXdqZXH9fD?= =?utf-8?q?gPcX2iQx2Vac4zHsOL+pBqlpZFeCXd+trYoJSkddV7Yz9Vm7kYUB1CV5Etkod8sCf?= =?utf-8?q?8uYgCgXOUf8E/+sJkZL781BZ/f5bVmGEMsTUbARrJhszoWuAHNdSKt2bcrPuMZT3b?= =?utf-8?q?2Tl5LYlfCV0TL2zWtD5TQcGRUBmXe14Cshku9Kztpq8W16c+TH1cKSbhsVffNJQ?= =?utf-8?q?=3D?= 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)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5629 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:401:5d::35]; domain=CWLP265CA0311.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509F7.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: bf7749c3-7009-4924-5b94-08dd5ffc652a X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|14060799003|36860700013|1800799024|35042699022; X-Microsoft-Antispam-Message-Info: =?utf-8?q?hVxUCtiLF9xuZFR7sL17Q3VPzETlYb5?= =?utf-8?q?QhEoLpkya68hdXjP8qZ0hAKFrZBcdrDV8We59PP6eo7zJcNapi0+xtyN2pxZxKGyu?= =?utf-8?q?8E6LuBMXKYT/zyT34oNUkAQVsWdCJCwsObI1pXV03KCTpMpltkaB4FEoa74kXzJ0S?= =?utf-8?q?GEdR/SpGT2tkq24S1YCeMEfiAKtvAl68ADqoJFv2vd4Q4R6QdnPOO8qtYilqiVDDq?= =?utf-8?q?AKRmLcOXJxmFsOgTvnarAu99K6r5yvFdgamG99HsuDwK9FtcpVjRqv4f4DWUMPfuZ?= =?utf-8?q?7YkP12NGAvVDPFZRvg425Fn9oDYozXu3E8tGCX3VglCvFvevKLKk4UFIZxxAjwfS4?= =?utf-8?q?3SVjvyWVWSdcyyt7O+e13ZuDgd+Jb3uM6wxCCsck7+p+MW1xOjvMYk2eRGD+5ec3E?= =?utf-8?q?5/oVs8fyUKLplZOP5WPeJmNfTorlaQUNKtiQd+DZQ7B9zzHd0bGdNuZBoFbTW/3Be?= =?utf-8?q?raeTWFGzNITNn/SwC6R7nIweZF+OQtFmdhsNxA2jbvfzK9bV9Oel2YSMmI2EuGMt/?= =?utf-8?q?hSNISDTnj+SFw0/3vynYwh4JYD+sdK5HEFcZ++xQ5M3zkoyyFk4Em2cx6JCKpuj60?= =?utf-8?q?LynnIkVBB0U6gNLP0SMIxdp/rqzYfxrjyn2fK8VWwwSPBiN6c+lQUJ59gp/NZLcn/?= =?utf-8?q?Q7mGlczTZsMxC9Gu4JUGL3NK6BoXtAk5taDAHaPu7MnQwrP3Xms9O3EdtOnDaFrE3?= =?utf-8?q?zLj5VOV9m+MAtVHoCpNi8+c60D+SwJ5gRA8PxJzHxX/AQFlP6Oz2KOm5EnVg5HFLM?= =?utf-8?q?3mtJDlMm0sXhTPR5WojL2mAl6gO+wjRwra89Lx8w9W2ya0MelEdtK8ToUuBrluF49?= =?utf-8?q?pyjb4fyY6SGRLJb0lg5RK96gXJYNxMFyzXGjO3pBNOWvwrVnVKYzU35xsarvhsucz?= =?utf-8?q?yo0QiYoKzE+N0KuK2bfutCGMnnOYvb5s05CYAW047CuiVCd7oJ2LOkJzCQP7eB+XJ?= =?utf-8?q?I8d9NbO84+rXS0uURYT0lYibupYvzEv4Ef8VJkZV0bsxtl0l8L98/6QN9AOmNUI9y?= =?utf-8?q?jQn+DWPsp3jWUsrgnLe3jBo016QLiu30vmBJF789xbN4QaQj/L/pbw68bK3EQ9dKW?= =?utf-8?q?U9CoJ9ut8LoPUAqGp+msL0B9iCns/6l7C6fuXjobul/0vNmS3Heo2eIV9r6ZqV2X5?= =?utf-8?q?4jv2IKrMl/xmJ8w4ztbouC3hjYU5K66YHIjrm00hR9uR8KYYosG0RloWa4dsADMVM?= =?utf-8?q?vOj1+gHW8ow+MMSJN5JLV/XFcjcZ8nSyqUA2myqai8T9jChUwgw3rsTBLkGJ2du90?= =?utf-8?q?4YAxJxC7yW5Ps60mwbOvXJeU67fpNBSG8dqiCWAq26wZCuL4mX/1b9vbSoxiiDnGz?= =?utf-8?q?P1DvmvFV/uWa7Ay+QXzvH+tmeJkQxRYiw/L1KehWMUNdy1z0lVNOizuT63W+Axd4D?= =?utf-8?q?2pZy59kTp2yXhiKhrNeq7207r4zCPhmJSHkA6wmkGos4gdPfpa+4ZI=3D?= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(14060799003)(36860700013)(1800799024)(35042699022); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:53:09.7152 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 653e9ba2-0876-4b78-3bb1-08dd5ffc6b92 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: DB1PEPF000509F7.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9125 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 From: Richard Ball Co-Authored-By: Matthieu Longo --- bfd/elf-attrs.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++-- bfd/elf-bfd.h | 1 + gas/write.c | 2 + 3 files changed, 154 insertions(+), 4 deletions(-) diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index 634843b5162..ab3c80573e5 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -118,7 +118,51 @@ bfd_elf_obj_attrs_v1_size (bfd *abfd) size = vendor_obj_attrs_v1_size (abfd, OBJ_ATTR_PROC); size += vendor_obj_attrs_v1_size (abfd, OBJ_ATTR_GNU); if (size > 0) - size += sizeof(uint8_t); /* */ + size += sizeof(uint8_t); /* */ + return size; +} + +/* Return the size of a single attribute. */ +static bfd_vma +obj_attr_v2_size (obj_attr_v2 *attr, obj_attr_encoding_v2 type) +{ + bfd_vma size; + + size = uleb128_size (attr->tag); + if (type == ULEB128) + size += uleb128_size (attr->vals.uint_val); + if (type == NTBS) + size += strlen (attr->vals.string_val) + 1; // +1 for '\0' + return size; +} + +/* Return the size of a subsection. */ +static bfd_vma +obj_attr_subsection_v2_size (obj_attr_subsection_v2 *subsec) +{ + bfd_vma size = sizeof(uint32_t); // + size += strlen (subsec->name) + 1; // NTBS: vendor-name so +1 for '\0' + size += 2 * sizeof(uint8_t); // + // * + for (obj_attr_v2 *attr = subsec->first_; + attr != NULL; + attr = attr->next) + size += obj_attr_v2_size (attr, subsec->encoding); + return size; +} + +/* Return the size of an build attributes section. */ +static bfd_vma +vendor_section_obj_attr_v2_size (bfd *abfd) +{ + obj_attr_subsection_v2 *subsec = elf_obj_attr_subsections (abfd).first_; + if (subsec == NULL) + return 0; + + bfd_vma size = sizeof(uint8_t); // + // [ NTBS: vendor-name ]* + for (; subsec != NULL; subsec = subsec->next) + size += obj_attr_subsection_v2_size (subsec); return size; } @@ -126,7 +170,9 @@ bfd_elf_obj_attrs_v1_size (bfd *abfd) bfd_vma bfd_elf_obj_attr_size (bfd *abfd) { - return bfd_elf_obj_attrs_v1_size (abfd); + return (get_elf_backend_data (abfd)->obj_attrs_version == 2) + ? vendor_section_obj_attr_v2_size (abfd) + : bfd_elf_obj_attrs_v1_size (abfd); } /* Write VAL in uleb128 format to P, returning a pointer to the @@ -213,7 +259,7 @@ write_obj_attr_section_v1 (bfd *abfd, bfd_byte *buffer, bfd_vma size) { bfd_byte *p = buffer; - /* */ + /* */ *(p++) = 'A'; for (int vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; ++vendor) @@ -228,11 +274,112 @@ write_obj_attr_section_v1 (bfd *abfd, bfd_byte *buffer, bfd_vma size) BFD_ASSERT (p <= buffer + size); } +static bfd_byte * +write_obj_attr_v2 (bfd_byte *p, obj_attr_v2* attr, obj_attr_encoding_v2 type) +{ + p = write_uleb128 (p, attr->tag); + switch (type) + { + case ULEB128: + { + p = write_uleb128 (p, attr->vals.uint_val); + } + break; + case NTBS: + { + size_t len = strlen (attr->vals.string_val) + 1; // +1 for '\0' + memcpy (p, attr->vals.string_val, len); + p += len; + } + break; + } + return p; +} + +static bfd_byte * +write_obj_attr_subsection_v2 (bfd *abfd, + obj_attr_subsection_v2* subsec, + bfd_byte *p) +{ + // + bfd_vma subsec_size = obj_attr_subsection_v2_size (subsec); + bfd_put_32 (abfd, subsec_size, p); + p += sizeof (uint32_t); + + // NTBS: vendor-name + size_t vendor_name_size = strlen (subsec->name) + 1; // +1 for '\0' + memcpy (p, subsec->name, vendor_name_size); + p += vendor_name_size; + + // -- -- + // + p = write_uleb128 (p, subsec->optional); + // + p = write_uleb128 (p, subsec->encoding); + // * + for (obj_attr_v2 *attr = subsec->first_; attr != NULL; attr = attr->next) + p = write_obj_attr_v2 (p, attr, subsec->encoding); + return p; +} + +static void +obj_attr_subsection_v2_sort (obj_attr_subsection_list *plist) +{ + for (obj_attr_subsection_v2 *subsec = plist->first_; + subsec != NULL; + subsec = subsec->next) + LINKED_LIST_MERGE_SORT(obj_attr_v2) (subsec, _bfd_elf_obj_attr_v2_cmp); + + LINKED_LIST_MERGE_SORT(obj_attr_subsection_v2) + (plist, _bfd_elf_obj_attr_subsection_v2_cmp); +} + +static void +write_obj_attr_section_v2 (bfd *abfd, bfd_byte *buffer, bfd_vma size) +{ + bfd_vma section_size = vendor_section_obj_attr_v2_size (abfd); + if (section_size == 0) + return; + + bfd_byte *p = buffer; + + // + *(p++) = 'A'; + + // [ NTBS: vendor-name ]* + for (obj_attr_subsection_v2* subsec = elf_obj_attr_subsections (abfd).first_; + subsec != NULL; + subsec = subsec->next) + p = write_obj_attr_subsection_v2 (abfd, subsec, p); + + /* We didn't overrun the buffer. */ + BFD_ASSERT (p <= buffer + size); + /* We wrote as many data as it was computed by + vendor_section_obj_attr_using_subsections_size(). */ + BFD_ASSERT (section_size == (long unsigned int)(p - buffer)); +} + +/* Finalize the content of object attributes before writing. */ +void +bfd_elf_obj_attr_finalize_content (bfd *abfd) +{ + if (get_elf_backend_data (abfd)->obj_attrs_version == 2) + /* Before dumping the data, sort subsections in alphabetical order, and + attributes according to their tag in numerical order. This is useful + for diagnostic tools so that they dump the same output even if the + subsections or their attributes were not declared in the same order in + different files. */ + obj_attr_subsection_v2_sort (&elf_obj_attr_subsections (abfd)); +} + /* Write the contents of the object attributes section to CONTENTS. */ void bfd_elf_set_obj_attr_contents (bfd *abfd, bfd_byte *buffer, bfd_vma size) { - write_obj_attr_section_v1 (abfd, buffer, size); + if (get_elf_backend_data (abfd)->obj_attrs_version == 2) + write_obj_attr_section_v2 (abfd, buffer, size); + else + write_obj_attr_section_v1 (abfd, buffer, size); } /* Allocate/find an object attribute. */ diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 6c326d5db72..3e825299a56 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -3064,6 +3064,7 @@ extern bfd *_bfd_elf64_bfd_from_remote_memory int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type)); extern bfd_vma bfd_elf_obj_attr_size (bfd *); +extern void bfd_elf_obj_attr_finalize_content (bfd *); extern void bfd_elf_set_obj_attr_contents (bfd *, bfd_byte *, bfd_vma); extern int bfd_elf_get_obj_attr_int (bfd *, int, unsigned int); extern obj_attribute *bfd_elf_add_obj_attr_int diff --git a/gas/write.c b/gas/write.c index 476d8e42081..2b5da1970a8 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1939,6 +1939,8 @@ create_obj_attrs_section (void) bfd_set_section_flags (s, SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); frag_now_fix (); char *p = frag_more (size); + + bfd_elf_obj_attr_finalize_content (stdoutput); bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size); subsegs_finish_section (s); From patchwork Mon Mar 10 17:51:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107602 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 1DEF13858D20 for ; Mon, 10 Mar 2025 18:08:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DEF13858D20 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=pSWlvEho; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=pSWlvEho X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20624.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::624]) by sourceware.org (Postfix) with ESMTPS id 66AC43858D20 for ; Mon, 10 Mar 2025 17:53:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66AC43858D20 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 66AC43858D20 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2613::624 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629208; cv=pass; b=lbg+igjtnCjyEMHW+HmXrmnEidER1RN8YFe72jIhPqA8g/EvQoYM1SoVU/9ehRacbegABady1dhrzxtFNXhJKnjgZ3ZEuA2XyG+oi8a9hfNVn43Ga4RF4M4dkQ+BgRbgDFfoLiPuX5WNz8+6jD0ZLGVGQbu8nJlUb79YazfnJhY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629208; c=relaxed/simple; bh=xAcpbajCAssZWfyg1SVFNVgVFJfXVnAbnqBCKLJmGOA=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=GYRMrcNzD18Ccun64nn13t7ueu9yK5M8c4D7OndLuc3rmG8cyVd/93vmltcHy+WNHDJgeyN2XmZvpnNhB2lN1JhBy94uQXyWX7a0jKsShPayFSzp0zziTTBXdU+ebOyBJwjN3uBC8JgACyM4El4RbXz4K5LvyVf7iwkfLau+6eY= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66AC43858D20 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=cRdonPPruA7+i+uttSA9cEBWpVvWGf3cWPUVleZNNIPgSjRQhqNuPk0pWjKTg6koyKoX0gkSRLYXb4JoqjpaE7crgWffAotOl3aC66ItHXLZjlilBR9H3z3DSHOfVHuTD5spaJRn7ETjQaUTK4UFa655XJmzmJmv0EOBL/wFMPkixLjkTkkrP9mywREO0/ariSIM9mok1f2i3FnX0Es788t6x/Q7NK51k1OWAi6cjRou1zT4TV5RY47r5SaQ/CCMIz0BXecS/NJTPyOIql7AjD3InFc4pN/I9G/x7dkC3t4frSH4FBdeb5wROHBqxgzeoSuCqJjJ7nIi3HmcX/mAvg== 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=x5ilwI7rNnEhKjjlAz6Upiiv6ai3g3W5xXTWjnoNL6o=; b=LvBo7FRkJvHA5BB5VHpzXB0XCCzp0VDmfjDSYoQfKDSnVBdm3In4krz5K2ERdX4WrqS7nEib0n78dTbrbeVh4DZFNsV1yl4nZlKjFNpvT2lJwl0oKX5lSflucWX7JRUijJdKgdzPXxvLJx5L7lK2RK5zESqmTx4ZdwmkOOu6RIHGjcJWZJ4iDobMOgbVtb0yONQT3hKXNsJyTkqc3Nb9ONWrKCnvHSBFEPirDUIEYmfvjkdfNRS49vjGGXZNuyBNPpiRH0huLq3ZTblH4uqLu6P9hulbNeh9hOQeyz5zH+h7qxGlUCACHVwh0GPxZIbXO9hMmgibDwVgnA42rO0wOw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=x5ilwI7rNnEhKjjlAz6Upiiv6ai3g3W5xXTWjnoNL6o=; b=pSWlvEholyLWAZnuVZg2jWvNxCvhQnzXP0OOUwAV8uZUM8GLA6VMXPrRrxPOdabfJe+EmUFoVALWIOtTxrAnaRYuA4pNxGxl3C3mT0KiNYSL3Kcv4JK/u06MHIIAHvYWoNYqStORpovYWjuC8EY2ZT6dnkzPXr7Z/WeHJv1zSn0= Received: from AM7PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:20b:130::40) by PAWPR08MB9830.eurprd08.prod.outlook.com (2603:10a6:102:2e2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:23 +0000 Received: from AM3PEPF0000A797.eurprd04.prod.outlook.com (2603:10a6:20b:130:cafe::29) by AM7PR03CA0030.outlook.office365.com (2603:10a6:20b:130::40) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:23 +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=arm.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 AM3PEPF0000A797.mail.protection.outlook.com (10.167.16.102) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:22 +0000 Received: ("Tessian outbound c3a902884497:v585"); Mon, 10 Mar 2025 17:53:22 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 54465d8fb2612aac X-TessianGatewayMetadata: rLrzC7RblDPsWPxZ5Sl1MzpkjtXr4oHzdG7wSl0IWqtDUE3jAG9+/CR6NIGeLht2USMUf55SYQUWgNYVy8+P8I/dKmeCN0v5rEfYZ8T4Nz5UeiaaX/ixNG7FGbq4+rUOInZGcoChWzTni81SJCyFmKyEheoh3MIdhIcqm/RNiyo= X-CR-MTA-TID: 64aa7808 Received: from L2d8635209609.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6A18DE5C-D4BB-46FE-BE44-B671F8A0BB95.1; Mon, 10 Mar 2025 17:53:15 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L2d8635209609.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qAhmSHoNy7Uc1VRe3Wb7DfiAG69l3p0teL9mrfcbvPTSfjU5pRUDDz8YYrlhG1YoEHxPKXAvIb+qtVWmmPCd30+B9sdxQr04nomknyJhm69Etf16wmJ+hiiVE2iihP3ApGYyS6GnUbcEHqaF5b5PO09psdXpJhWw+cEgI2nqw6tzSJLkHV7z9aRVv5p3uyLmbXL+T2AC3vG76smvn4iKNbDBnreWpAZDJ3alGdEbenZ5+jCWQCmgVNHWYmmhb4GWvO3iKz9sIYSDy6d2HUtoZJkuFu0h9uu8J5rfussJCb55z8/dAvCVMi5Lt9Mas1nigH8/gISPn3oGMkiz4Z6BpQ== 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=x5ilwI7rNnEhKjjlAz6Upiiv6ai3g3W5xXTWjnoNL6o=; b=k+Nq34VgiGigmaoxfVXEPW3IxFXYGNfryJ4RWvit/Ab4n2pxGv6vkCvDibGj5neyqaDAIWKauXNnuEWy55cppBr747m3VTVcntp8bPmFCmYXNaH07cbCv5tbJoVQo5LOC2KPAl9+h1lh8nDsMkZI51jvpkFQMUunpHZGIO9/oVCeu0xLatGffaGSBb5+P9Y4l84KM/ByNX1uZ2t+bfno02ulPlbdk/rcqvWaawzexDzEYN59SQaYay5hdlbEJYpSTor1B0wzW2wjzJl4V68yDq/pZlEkZEvua6a0PUlD37IVhzr8Jh/iyUg5ObJfgXx2Yy8X5VHac+CTdW2eE+QAYg== 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=x5ilwI7rNnEhKjjlAz6Upiiv6ai3g3W5xXTWjnoNL6o=; b=pSWlvEholyLWAZnuVZg2jWvNxCvhQnzXP0OOUwAV8uZUM8GLA6VMXPrRrxPOdabfJe+EmUFoVALWIOtTxrAnaRYuA4pNxGxl3C3mT0KiNYSL3Kcv4JK/u06MHIIAHvYWoNYqStORpovYWjuC8EY2ZT6dnkzPXr7Z/WeHJv1zSn0= Received: from AS4PR10CA0025.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::14) by DBBPR08MB6219.eurprd08.prod.outlook.com (2603:10a6:10:20d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:53:12 +0000 Received: from AM4PEPF00027A5D.eurprd04.prod.outlook.com (2603:10a6:20b:5d8:cafe::cc) by AS4PR10CA0025.outlook.office365.com (2603:10a6:20b:5d8::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:12 +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.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:11 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Mon, 10 Mar 2025 17:52:47 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) 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.39; Mon, 10 Mar 2025 17:52:46 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:52:46 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Richard Ball , "Matthieu Longo" Subject: [PATCH v0 06/15] readelf: add support to dump build attributes v2 Date: Mon, 10 Mar 2025 17:51:19 +0000 Message-ID: <20250310175131.1217374-7-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5D:EE_|DBBPR08MB6219:EE_|AM3PEPF0000A797:EE_|PAWPR08MB9830:EE_ X-MS-Office365-Filtering-Correlation-Id: ee20ae25-b02a-4a5e-8856-08dd5ffc735a x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info-Original: 3NZRoezUPbKayZubDQcxOucWhBNIKzUCrmFNyeyhLytncVnduRRIl6tczCgOiZkmTeq8ngM4Ad3V5lRxmbRDE7w/7lzZehnTCJFniBxtuGsEdfJsESwKX5aO3eLeNtkagOA8mYOduBjlp3PDeQPO6cs9Ay7U5zDU8AsQLFZNVD7/LFBT00ivhsw/lfJfoo/wCL57ao/CmZ42k7DmZmQASQF6lquUpb+84vdEuJc3HQlqXz012gydLUOMl3wD4YEZ+2NA0eIi9iDzSuAPOcS5YPseYqdCA1FFNIR6ujv0vXtjBS7Rb3EkpgnV6xrpS0G3FqFDB8vZk+As0Ov0mU7OLFA/lHCbpNtKPfgSqOz8BZCvELPhoSfksnkmZTAUEKzI3CjemzaLBBgsN+NcZ34NDUnALDsUYPUwlQ9t4MsKZ3ktdcAvyqnoQhCXuv8fYXvW21rQBMpc9x/Q12akDNUcRc7m3+ZD8PsYBU7+1SMiJ1FY4BmjxauuBHiTZPk0rkbn6t9rGz6uMBIrnrE8zvwK4c2oFqwbGf0f36MyNMuh0+RThzkBaXlVv5P93d0/psVbBuLjXOHKW4qfnuvMYivUtiVy/FIQPZpDh3MLu2TJ/9dTD7BMZlPips/qOPcx7ZVMBoOmG9K+B4v9H1bHnAay287txjz9ZrHM4ZtOpRLmKdZ0hOjaYrFxUfhQZoRT43cqJKTUTjzKgj/l/DxWWi4sXSs4u7vBi2ba5Y+ppt1hpAx2Ta8fjJrnle+XBbcQfmseVcXA3g7EgY58F6G/ELMv5o7jkrOCtRk58XS5cJiZ2aw9qZMwz8F3WtDm273KFJuVnToO4gHCsZ6fEyoMdheqCVvBDG9vEJvFC9CugJQFSFO9gMSk5ISU3S7J6/uvw1jokSqNXV69Mboa9kwZNcdfVkZtuZVT5yKE+bYCVrjhCu/SUf4VnVZueblH/A8y2+T8ome0SbfcBi7Xag+jhb3pRmkjZjUYwz+8INO1CK2Z6DrdafXdgHOahKckVgqdn9mgRuJVArmB1s1R8eoTo0SGSYYszaOBHqcwcu4eC/SHBup7CHcgXEUS/nZej/XiQgy0Jmv15CinoC02NO6/JDktM/ZieuDh5CcVbQR84G7No+RIkdV4QzvT8vcQRoab+4NfMZHKoM50JJc+TgtPbbTPgR+2EmwuTlzfEVRDL1pc1mgRN0RIu4Kn/5VFhVpn0/jTc3oCKpkYZVW/nllw8B+gyvLQnCV1hUz7NoMkZEG9oMf+phqnr6dfmhtmSBosLP+LWUfbKzr6o04/ILFoxLSXpcWrH1kTq32b7XS3a1EiW8LwXt9glS5d8uBN31Jp8PQ0yewi+aVDM8RFqcCgy+V3StB1StuzNyDCoxWb83mSXryQ6Eiw0sknMusYHNtO8nzAXPOxlxiw1KU7oDf8IAj345tLHMT/r/Y61itq5qxYoq9u9t6Zz9Z2EOZEV4UaLrW7AHrXTJyggXLSR6GWkxjw08fwoi4a036IR+CweBZda7s= 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6219 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:5d8::14]; domain=AS4PR10CA0025.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 23b7109f-95fd-4b08-d445-08dd5ffc6cc6 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|14060799003|36860700013|35042699022|1800799024; X-Microsoft-Antispam-Message-Info: hQBiT9NB8vQ8e4h2zPilE9Oe8lpjy0YyXsDl7FyRQ7pWX/qo12+Ae532s3qJwaLacDTTxbSDBmajF/AVDUV5MupAGTKrpZVPjxGSeEp7svG2nJgtmt78HXorDmfqPmxRaGNUd3sOGKXTyyG1Q+2QWFo9U4sq7z3mZJRLAy9ONjGVXxNzwMn81SbkI7m253kP9liFgCi+ds48hEaA3i7claZNvVJgMh/uSXgm6s7RUu1746PgMfhvhAdxQ7dHb3z/1Yn8c7va5sjTSNmlvVCaB2WmObZiUm0TAYP6aXOzJNAmCKvlIKrQzcXsCWTi+lDhPomPkfy3Ytu43JdyUIfWIgxIfoyXTIjheHX+ijPuhhiHrA8r+TCaCzr4nscLKwVRqiH9QIK7ao9l+7W/2IRfAzUVM4fsupXuw2YfbWLuLnvJ1LWftFnPMiXsYGsV6axxmcu+o+52TuoUfkNJUI6B90XhxNVBwEfh8UExiKaWxhsBkhVV6KRQzotPwj9sMKJyePBunX9BbVGZveCsGq9HL6hGm/X50746INEWC6b4DwsXcA8lo9bP107in7El9cBGoyJMG6Xrx4ST8Bzfv67uKeh00CbH8f46C9lSnYc/ozeMXVYIOvpB/DrM+vZXGagkoZ/6A41dDfAvrnxWDmYX50O78Dq1rchyJ+/Bo6F09XGDRA3NwZ4VnuozwSXCrunSblC2oIwZeNzcdLfvbrlDhgc/j4WthCYaWN78RAL8KbxDunmhrwJVj7U5sxlh9mZkx/pFZ05LtAlvqO/6dJdEjp2UVb0BARm22iKQm/Yq/WGGMTYzj0BkJXMtcLuxhzQhBmvzqJu62KGPQEM6I/PmiPhB4SoF8ggZiub/+aW97sEhj1cv1SVM6SaG7gYVX0P1wz3659rCBq7oBxSQw6CufEtxAmD6lnUVyKqJW/cVuwZ9Fje+AeMbRrWfHO0erpCEXbn9ZJoQrJp7WAhduYfZX6TL3wJ8M4uaEJwdwsXUTrWczx9u/xiY2st9wmv4dNWJ7mnJt0vOYPd/ZLXt7LU4j0kBTtHvqtsdvVMAcSwlHqk4wxyUrjbusxR3uTzxVPAA3iCWLTeHBYNqVB3PnsFtr4w2n1zpbxHjmviGlumoPnhAPzraeJ4dC6lU/PnPwcTM2xPecHTvmu4XbwcpB24J4Zn/QxOeZVfRR8rf6ygkslwR+desN7FjQ8o1Pzb+T7rhiRzzO+r7K6Sp/DC04KLxlumVByll7b/l6XR5wt8NusW/jq964r8k4teKp35PSuNGB0QJpNe6rjqZruKtNFG/SvTxni0G19bBXu27+D+Ur+gvFxIkWObkT1oLeUbPrl2Ui8InyE6CtS6odZ1HTpgHSvpFXFYC31kewOvWaihkweD4Aejj5JPrslRaN5LYw77rPK8kIpCtgpKrsX6qI3VXq//2pqq1qweeRL79Vy7sX6pBgn/qcyfk6wl3DRfHRfgA2KZU3ZJD43ebI7uIEM9aXVssCFt//hsfhKPNBSAOHLY= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(14060799003)(36860700013)(35042699022)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:53:22.7563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee20ae25-b02a-4a5e-8856-08dd5ffc735a 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: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9830 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 From: Richard Ball Co-Authored-By: Matthieu Longo --- bfd/elf-attrs.h | 18 +++ binutils/readelf.c | 261 ++++++++++++++++++++++++++++++++++++++++++ include/elf/aarch64.h | 13 +++ 3 files changed, 292 insertions(+) diff --git a/bfd/elf-attrs.h b/bfd/elf-attrs.h index 5d41bb98538..a4af0da1f68 100644 --- a/bfd/elf-attrs.h +++ b/bfd/elf-attrs.h @@ -100,3 +100,21 @@ typedef struct obj_attr_subsection_list /* The size of the list. */ uint64_t size; } obj_attr_subsection_list; + +typedef struct +{ + const uint32_t tag; + const char * name; + union obj_attr_value_v2 default_value; +} known_tag_v2; + +#define OBJ_ATTR_TAG_v2(s) "Tag_" # s +typedef struct +{ + const char *subsec_name; + const known_tag_v2 *known_tags; + const bool optional; + const obj_attr_encoding_v2 encoding; + const size_t len; +} known_subsection_v2; + diff --git a/binutils/readelf.c b/binutils/readelf.c index dd1871d8c75..b69180e4e33 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -58,6 +58,7 @@ #define BFD64 #include "bfd.h" +#include "elf-attrs.h" #include "bucomm.h" #include "elfcomm.h" #include "demanguse.h" @@ -19456,6 +19457,263 @@ free_data: return res; } +static unsigned char * +display_attr_v2 (unsigned char * cursor, + const unsigned char * const end, + const char *subsec_name, + obj_attr_encoding_v2 value_encoding) +{ + static const known_tag_v2 known_tags_aeabi_feature_and_bits [] = + { + {Tag_Feature_BTI, "Feature_BTI", {0}}, + {Tag_Feature_PAC, "Feature_PAC", {0}}, + {Tag_Feature_GCS, "Feature_GCS", {0}}, + }; + static const known_tag_v2 known_tags_aeabi_pauthabi [] = + { + {Tag_PAuth_Platform, "PAuth_Platform", {0}}, + {Tag_PAuth_Schema, "PAuth_Schema", {0}}, + }; + static const known_subsection_v2 known_subsections[] = + { + { + .subsec_name = "aeabi_feature_and_bits", + .known_tags = known_tags_aeabi_feature_and_bits, + .optional = true, + .encoding = ULEB128, + .len = sizeof (known_tags_aeabi_feature_and_bits), + }, + { + .subsec_name = "aeabi_pauthabi", + .known_tags = known_tags_aeabi_pauthabi, + .optional = false, + .encoding = ULEB128, + .len = sizeof (known_tags_aeabi_pauthabi), + }, + }; + + const known_subsection_v2 * + identify_subsection_ (const char* name) + { + for (unsigned i = 0; i < ARRAY_SIZE (known_subsections); ++i) + if (strcmp (name, known_subsections[i].subsec_name) == 0) + return &known_subsections[i]; + return NULL; + } + + const known_tag_v2 * + identify_tag_ (const known_subsection_v2* subsec, + uint32_t tag) + { + for (unsigned i = 0; i < subsec->len; ++i) + { + const known_tag_v2 *known_tag = &subsec->known_tags[i]; + if (known_tag->tag == tag) + return known_tag; + } + return NULL; + } + + uint32_t tag; + READ_ULEB (tag, cursor, end); + + const known_tag_v2 *tag_info = NULL; + const known_subsection_v2 *subsec_info = identify_subsection_ (subsec_name); + if (subsec_info != NULL) + tag_info = identify_tag_ (subsec_info, tag); + + if (tag_info != NULL) + printf (" Tag_%s: ", tag_info->name); + else + printf (" Tag_unknown_%u: ", tag); + + switch (value_encoding) + { + case NTBS: + cursor = display_tag_value (-1, cursor, end); + break; + case ULEB128: + cursor = display_tag_value (0, cursor, end); + break; + } + + return cursor; +} + +typedef struct { + bool err; + uint64_t read; +} BufferReadOp_t ; + +static BufferReadOp_t +elf_parse_attrs_subsection_v2 (unsigned char* cursor, + const uint64_t max_read, + const char* public_name) +{ + BufferReadOp_t op = { .err = false, .read = 0 }; + + const uint32_t F_SUBSECTION_LEN = sizeof(uint32_t); + /* The minimum subsection length is 5: 4 bytes for the length itself, and 1 + byte for an empty NUL-terminated string, and no vendor-data. */ + const uint32_t F_MIN_SUBSECTION_DATA_LEN = F_SUBSECTION_LEN + 1; + + if (max_read <= F_SUBSECTION_LEN) + { + error (_("Build attributes section ends prematurely\n")); + return op; + } + uint32_t subsection_len = byte_get (cursor, F_SUBSECTION_LEN); + op.read += F_SUBSECTION_LEN; + cursor += F_SUBSECTION_LEN; + if (subsection_len > max_read) + { + error (_("Bad subsection length (%u > max=%lu)\n"), + subsection_len, max_read); + // error, but still try to display the content until meeting a more serious error. + subsection_len = max_read; + op.err = true; + } + /* PR 17531: file: 001-101425-0.004 */ + else if (subsection_len < F_MIN_SUBSECTION_DATA_LEN) + { + error (_("Subsection length of %u is too small\n"), subsection_len); + op.err = true; + return op; + } + + size_t subsection_name_len = strnlen ((char *) cursor, subsection_len) + 1; + if (subsection_name_len >= subsection_len) + { + error (_("Subsection name seems corrupted (missing '\\0')\n")); + op.err = true; + return op; + } + //if (subsection_name_len == 0) + // // do something here when the string is '\0' + + unsigned char * const end = cursor + subsection_len - F_SUBSECTION_LEN; + while (cursor < end) + { + const char* subsec_name = (const char*) cursor; + printf (_(" - Name: %s\n"), subsec_name); + bool public_subsection = + strncmp (subsec_name, public_name, strlen (public_name)) == 0; + cursor += subsection_name_len; + op.read += subsection_name_len; + + printf (" Scope: %s\n", public_subsection ? "public" : "private"); + printf (" Length: %u\n", subsection_len); + + uint8_t optional; + READ_ULEB (optional, cursor, end); + op.read += 1; + + if (optional > 1) + { + error (_("Optional value seems corrupted, got %u but only" + " 0x0 (false) or 0x1 (true) are valid values."), optional); + op.err = true; + op.read = subsection_len; + return op; + } + + printf (" Optional: %s\n", optional ? "True" : "False"); + + uint8_t value_encoding_raw; + READ_ULEB (value_encoding_raw, cursor, end); + op.read += 1; + + if (value_encoding_raw > NTBS) + { + error (_("Attribute type seems corrupted, got %u but only 0x0 (ULEB128)" + " or 0x1 (NTBS) are valid types."), value_encoding_raw); + op.err = true; + op.read = subsection_len; + return op; + } + + enum obj_attr_encoding_v2 value_encoding = value_encoding_raw; + switch (value_encoding) + { + case ULEB128: + printf (" Encoding: ULEB128\n"); + break; + case NTBS: + printf (" Encoding: asciz\n"); + break; + } + + printf (" Values:\n"); + while (cursor < end) + { + unsigned char* cursor_new = + display_attr_v2 (cursor, end, subsec_name, value_encoding); + op.read += (cursor_new - cursor); + cursor = cursor_new; + } + putchar ('\n'); + } + + if (cursor != end) + abort(); + + return op; +} + +static bool +process_attributes_v2 (Filedata *filedata, + const char *public_name, + uint32_t section_type) +{ + /* Find the section header so that we get the size. */ + Elf_Internal_Shdr *sec_hdr = find_section_by_type (filedata, section_type); + if (sec_hdr == NULL) + /* No section, exit without error. */ + return true; + + unsigned char * const data = (unsigned char*) + get_data (NULL, filedata, sec_hdr->sh_offset, 1, sec_hdr->sh_size, + _("build attributes")); + if (data == NULL) + return false; + + unsigned char *cursor = data; + bool res = true; + + /* The first character is the version of the attributes. + Currently only version 1, (aka 'A') is recognised here. */ + if (*cursor != 'A') + { + error (_("Unknown attributes version '%c'(%d) - expecting 'A'\n"), + *cursor, *cursor); + res = false; + goto free_data; + } + + ++cursor; + + printf (("Subsections:\n")); + BufferReadOp_t op; + for (uint64_t remaining = sec_hdr->sh_size - 1; // already read 'A' + remaining > 1; + remaining -= op.read, cursor += op.read) + { + op = elf_parse_attrs_subsection_v2 (cursor, remaining, public_name); + if (op.err) + { + error (_("Cannot parse subsection at offset %lx"), + sec_hdr->sh_size - remaining); + res = false; + goto free_data; + } + } + +free_data: + free ((void*) data); + + return res; +} + /* DATA points to the contents of a MIPS GOT that starts at VMA PLTGOT. Print the Address, Access and Initial fields of an entry at VMA ADDR and return the VMA of the next entry, or -1 if there was a problem. @@ -23444,6 +23702,9 @@ process_arch_specific (Filedata * filedata) display_arm_attribute, display_generic_attribute); + case EM_AARCH64: + return process_attributes_v2 (filedata, "aeabi", SHT_AARCH64_ATTRIBUTES); + case EM_MIPS: case EM_MIPS_RS3_LE: return process_mips_specific (filedata); diff --git a/include/elf/aarch64.h b/include/elf/aarch64.h index e218e07fa73..c076174a7ac 100644 --- a/include/elf/aarch64.h +++ b/include/elf/aarch64.h @@ -57,6 +57,19 @@ #define STO_AARCH64_VARIANT_PCS 0x80 /* Symbol may follow different call convention from the base PCS. */ +/* Tags used in aeabi_feature_and_bits subsection. */ +typedef enum Tag_Feature_XXX { + Tag_Feature_BTI = 0, + Tag_Feature_PAC = 1, + Tag_Feature_GCS = 2, +} Tag_Feature_XXX; + +/* Tags used in aeabi_pauthabi subsection. */ +typedef enum Tag_PAuth_XXX { + Tag_PAuth_Platform = 1, + Tag_PAuth_Schema = 2, +} Tag_PAuth_XXX; + /* Relocation types. */ START_RELOC_NUMBERS (elf_aarch64_reloc_type) From patchwork Mon Mar 10 17:51:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107594 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 02E8D3858C2C for ; Mon, 10 Mar 2025 17:56:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02E8D3858C2C 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=NQWaYdXW; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=NQWaYdXW X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on20603.outbound.protection.outlook.com [IPv6:2a01:111:f403:260c::603]) by sourceware.org (Postfix) with ESMTPS id A63B13858D38 for ; Mon, 10 Mar 2025 17:53:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A63B13858D38 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 A63B13858D38 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:260c::603 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629213; cv=pass; b=VorhhwENEO7vfSG6Z+B20rffME93emxq1m2v0GAKP9WYgkwcOUrNdHWp3f43A15S21kmMyTzSuIpwI6oAUyKEW+5AXdLXg59zuiAo7PiAurS6VMqqTBeuCao5g71dbMb6NymyMXMs3N0mcyPJqFrxs6UMfdvh+6ZgGxDPrJnjoU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629213; c=relaxed/simple; bh=V+u58InFFIJYN2mVw8Ep0+W/MJUYUsNteJx5w0eywnY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Yw4b7NNxltTzA7BUl7K+u2I38B4J4P8l83qVzv5RkuzryksG8B36bMJAdNhtWYubWqUILNCgVZn1U9+0K0WtCYslefSQgagpvqiqwLGXJyj4YMbs1UHLFSGphXZY38SFQ2jvyCxe/yMxUGBXBum6w3zHvSWsbj2UjFgHesUg0bM= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A63B13858D38 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=VOTmY1CMdJMTMnOhhO5Z+dD8EfQntSf+/RXO7ZK3uOqsfp1tV9RIOF9Ip3xU4ZNVWKANHfzK/nKDYCEw/7Q+cecDL1WKxcUzjcuQh5lPMDiVR5Lxam136R1H5HYdh5G4Qq3zHX4raysVTjQYgYRM9aT3U/LOmIAfO8e9JbEdi5omq8S5eA9zXDaaBXfxhVImByZDPHkllYAwksBwEP3+xQbTe9ZGCr3/LOBjcvmiuRdceCrA8EPaGCia6a1qeOP5DZbI+/NKQIrphpUBwiQWCFj1rbyMlMWQwl0S51WblP/wVaBdsEyM99jwCXzv9XzNWEVSlWEJ6P7RsmcWoKWstA== 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=ceUA5IxD5b2Sw//Wgp6F0zbEqo0NXz1NPBMLeVNWPWU=; b=mnYk+0GVMR0Li5ve0ISX40KmKYR7L6bjJWZ9fqUHKc+czMB7bJ4aq1BoED9QgyEbdl1P4kSa86hO37zfO75AVeLD9BbZoNa0AwJ+s/4TtBoV3ch2HyczyuYVw32JkZnWNouTtKBJO59Qonfxp2jdEunzvJz45Xtb8wfIXmyBXWOCSNn8a5+LA0z7nI0rzVH/osjR4GCGRC0mkbc/ZOqoTOMZfhnHHkkgBvKTQRwLgSaHBLTxmb+jqukpdBrdSO6gOCB/zl6tzCrNNVRSIeaxkkWF1UOkAli5eqRrDw5tIWAllgD1IvJEsVnikh+/zEYR9O0x6ndrruGO3eKsm69l9Q== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=ceUA5IxD5b2Sw//Wgp6F0zbEqo0NXz1NPBMLeVNWPWU=; b=NQWaYdXWT+A+sjpDKF0YzqfVrOFp123ZyNgDz2LE5qMgFLpQT2aZzUTtywMDHZrkJB+voYlj7io1Sd2fDjeXpML3xCTwMGLMM7bKRm2PgxMU3/USX8st1nPxAn2hrdRh+X4WbrQ/bUF8O6rbZfxV6bQ9i3KgYdVBi0Z8N/BLQ1M= Received: from DB7PR03CA0098.eurprd03.prod.outlook.com (2603:10a6:10:72::39) by AS8PR08MB6360.eurprd08.prod.outlook.com (2603:10a6:20b:33e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:28 +0000 Received: from DB1PEPF000509F3.eurprd02.prod.outlook.com (2603:10a6:10:72:cafe::d4) by DB7PR03CA0098.outlook.office365.com (2603:10a6:10:72::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:28 +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=arm.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 DB1PEPF000509F3.mail.protection.outlook.com (10.167.242.149) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:28 +0000 Received: ("Tessian outbound bc832f6acacf:v585"); Mon, 10 Mar 2025 17:53:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: de2299f05c057441 X-TessianGatewayMetadata: SHIuln8x+PJ9bvHbE2PAEy7xqeIHq3b+QLynN4mYhW33YnYHsiFQuBJ0UTz4S6XmNwhQv3BiDGnX9FHdSoRyNXVUqC5i96cuIopgLEdSzYxFIu9cqLeKUDi8JcfKg8u2+AK26krhafiBcmx7er+Rq/8w/VOtHkWuAoi9pRtOzRE= X-CR-MTA-TID: 64aa7808 Received: from Lce5ccf86c632.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3ECA185A-8A1D-49E8-AC94-93692B525E0C.1; Mon, 10 Mar 2025 17:53:20 +0000 Received: from AS8PR04CU009.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lce5ccf86c632.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oI5mGscS6fGFbnqFeau5q0nZ8DUNWIc7LWosL04ur3GxkoZWfy94NHdqo17lcuMslJFaN/Yvv+y8V/d4kh048wflYc4A2KdNpLNY/EzP2PH2v8X+jGfHiBTuFLX6eQl4zdMjzacsboqB76GcErbNR76b48FRvQGJY2mFGuFSDVagguS1/P3p3OeUwAwyuMUEMuo23NhLV88325w3mcpH64f6qaJDzq9i6taDBoOVLXbhzGt29aAGcCF/N+S2D/fPculsRcgbIa8kT8G2h61dovYXIG/3ANvdxH/goVtb7A/ge0DcGqoOsRRazb1HXPB0yfQcletLXLw1YxvJnvkQLw== 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=ceUA5IxD5b2Sw//Wgp6F0zbEqo0NXz1NPBMLeVNWPWU=; b=YLlb2t7hNOLCaPp6F6lXYa9wMzBfiNxylDqHTN79+/Q52we1q1ImsvlCvwam6G9LQJnFIMdyWw+fFYeNoNF0fl9K01bRFnPhButk497cXwHPrF3tc3JeFbubwTgZ0IeLD8WLfnpDq/X6Z+skTCiJefP3QhrNbFKU88qfxFVsfhBL/YQE5sD4F6s6fZIE5A0hejsJEKOfROgw84R7gMJ6hMxMAWEq37W9E3s6y4AmLNfPgX9qjAKWY0vAsMYk7XCM5PYVreDNf6QxqnclfCyJuoVNP3GZfI85ZXkBhgAFSJWln8wVa6grB5xDlWlapegYJ9XFWkU7nrdKSeQjVpgATw== 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=ceUA5IxD5b2Sw//Wgp6F0zbEqo0NXz1NPBMLeVNWPWU=; b=NQWaYdXWT+A+sjpDKF0YzqfVrOFp123ZyNgDz2LE5qMgFLpQT2aZzUTtywMDHZrkJB+voYlj7io1Sd2fDjeXpML3xCTwMGLMM7bKRm2PgxMU3/USX8st1nPxAn2hrdRh+X4WbrQ/bUF8O6rbZfxV6bQ9i3KgYdVBi0Z8N/BLQ1M= Received: from AM6P193CA0141.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::46) by DB3PR08MB8985.eurprd08.prod.outlook.com (2603:10a6:10:43f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:53:15 +0000 Received: from AM4PEPF00027A5E.eurprd04.prod.outlook.com (2603:10a6:209:85:cafe::2f) by AM6P193CA0141.outlook.office365.com (2603:10a6:209:85::46) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:15 +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 AM4PEPF00027A5E.mail.protection.outlook.com (10.167.16.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:15 +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; Mon, 10 Mar 2025 17:52:57 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:52:57 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Richard Ball , "Matthieu Longo" Subject: [PATCH v0 07/15] gas tests: add new tests for build attributes Date: Mon, 10 Mar 2025 17:51:20 +0000 Message-ID: <20250310175131.1217374-8-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5E:EE_|DB3PR08MB8985:EE_|DB1PEPF000509F3:EE_|AS8PR08MB6360:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e7f9ac3-6d45-490f-0219-08dd5ffc767e x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info-Original: FPuvu7vzzMJSdlQf+6pfB9B8Tnac9IR/1ZAf+845BD1wYk7pfIJun1tO0alWYQSrQdxhrhyUkqR4K6gwDWDozYMjfYQn74qZjR5+q4e1WHwq3V2HfVx+oXJQMjWc9ixgLR0xXou7mw4/Kz7J3GEP9VFCoY/6mtLTWkvCMfAsXg6mZbVqsrceJuDp/QyXXj1dKWli7EoNeQFLiN5RFjBmuqbjw8rUAOrJBrDU3hsnbcz1RofkBmLye6X9O4ulTQyUxDxDuEEgEWpaz+EvJBRdM5M703UxyfuR3Lo7ce5orctbiQRHNsgzttLrzmhZApzLUEpI1nztahRJpYxJTZup46AsACKgdqm45zC04CfQJzH49gn2xE5Up5CDV+1Wjv0VZY9g2HAE0HzLZsKDzfziEsAnRPPKIhcOzM2/jU0E/zoLvfqYKbloM0yMqabH3gg/H5sSlcPapyRF7nGAoSc5fpWJFLhVvCOemNjcnaoMQV23q4g8JMJugOVufHSrjr6G6PtTe+OVpBOr7MtPeLeU6IAnTLXsf+Ntj10Ux6Q3HNJm5Sn1alf+JeRP37Di6m4blYuDiQJ7PKTOEQBdHrPUR3aLJ4hf+HGQcMUKibWAC8Oi7c3iz2B3ELsEsIwZ/KrRXAYsqew4NFMZ1Rkscv/leE+gbf+7x+vsQROqbwMfyEa8nG1ROiuOT1o0U57dxC9rhSKEMdi9qoojbF3PnH0itKlqsC8fglPuOhie0PwATfIVP0z8/qNjwM4sWLuOUPwjFdVHLCgtKajzhfuHrhcXdOF+XUIsGgdswEbPv1khG7mPvWUqAey4VYHfWjX/siQua78Q4py4qOyPJMpJqM1MSQrvmXYnIqJ+M6sqBb9jJ5oZRj8HpiXW/bpVMc5HkzijCvajuP71lK5UDSt/BKXxHwZqjblB8rLwxSoL00Rjc3tam43D+G+Uk5HzEdukNP9mxr4CojSNArFo55jkqkDzceywbMNmvVkgmpWHwxLq7vqSjJAbikw0e/Ue1Cg35JXH+SLhd4x0y9j/N7WJOKG22HyXYTua71Z9l/T/NAyl2cffQoTxKUcz93Z3LMPLNzJjy/YXmc8zlFdMLiRZWfgLRNfYTdC/XI28/eY4oRx8pG8wU2kUKk0txPSmH9OSU8fNg3VXDl13upy3muqY7QBvnezOrBCkEZwc2mrAHee03ZJUHJI0xGnW3A013KqkSuUqANAh7ATHP/ad8hvm0fGvHMWsml478FQiwj+SqThj/zIJFqvxNFgeJO9tFM6lPBh/RtIIVhTCXbIRVcH4fCe/SVa/0QT4/3Y1GwQotggYrWYkBdnEEcy5jYqpBaAQuGt0ojSVaLk2OKOL94gh96c7GBnr22jUyv1y+C4NYSQ3oNs9i1URkitselAw8CdWX6v8OMz+YXexFvZ+7ntge0u54x3AiAcBvPCDvpJQQqmvQqubiONthBdN7POwzZmNvcRpGUQ83+5aHeToLKZkPEe9NiltLMJxwsh8SklNNYqKPRo= 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)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB8985 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:209:85::46]; domain=AM6P193CA0141.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509F3.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e7b88c63-e027-4b87-6508-08dd5ffc6ef7 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|14060799003|36860700013|35042699022|1800799024; X-Microsoft-Antispam-Message-Info: UEPthnxqIT+T4igBkVo/8UuI5skMuhS77nBOWn8jIq+eTfEhN/M6blTtdwkUWBDqHtp5Vh+kxIegJmIp4e5zcQNePf9kB3eC2WWkYARqkNZKMvixoGyUdembIJkd32xe1b7t/TFxRJosbXlpWKAXFuEWmLiJHHyJ8V92DBgNjOZIjbMe693tQLO7b5p1AO6FqRL/4Vznjyu3joy0FeNP98LxCN9XIidctTu06deu1PFXmPY/tmmYYqCRcWOtIXBSNsdRmBHxSlkP5fS+RIcKcrUrI4Q2nG4XdOvokMT7jlWhTMuMvTe8RxBaFApuLMCq5HZgSbSXjMl6luSkv5wL5mcAiNLHRZPvy78PwbVBMn5c9MCJLbXLUwz+nrsLydtH1Lh//0ApE3ZvbEfh+lpq7QF0Ju7F1d5wlUO9RGDEMyy6q9ZESxL2Qngp3Y+R2KoecA0JuX31m/7brqJxxOn3LZ4tb3vJ97H8JFACelBHq9bV1HmdtTFDrzA9sZPgyW38BuHby/Z/tIgAIzlo0cdTOuBwdQYvaeGhShtsgPZSeIgr+Vt2LjBbRCQrK+Lh2nUDDeW/s8nvSpr3r7E0D3TByn8gTt/apvxLcUe+bmMC2aRV7gvc/M1fkgRNucpcyGyXVSeImeOqfGtENeYQ1VBk77JTV9RLFnId5bhpWpZtFTez1dymZym0iMSiNnl3iSNN+ZX1UO/zBShPdlj7NPIp2NDqILulDDsiweBF6KPNl8c2BJOdKMFWNBkx4yDCXPcYu60ommAYhBRYHDWDlqdijwGX4ygHxt3RqnqGRpW8CKA+MzUahK1Wp3fcVz+o8Ky7QmqNBmd7440fVPG2Lva25gDVBaPiaU7vN/Gh1YIKAwM9Oa45e6oLKiy1HoISwXP9B/oyeH/D2yIZeeiaOYtJAzn8OC6dS0dljrQNgGBF+aymcVvyItgrWZJNbTRDritO1K5h21amq85f9LdDjGip95i2I2WOO91DInwEKd5cy/kdaVXOWzBR8y3meF20WRy+OKU3p4kvah2vLDCoSoFKIB0idi1saWGKxrpMBaFlnXZaOTui9hWUuqBfoeoZO9ltLDq2DSJRiJ+TCnJG8c/v4DrOPvG0W7265etXDxOaU8h8T+7imhkNabYAxR58hPK1ZBt/+sK1rcbd9d/lTq14qmYDtrCpgKeV0fSnbd89QFIuTIdsUzIOl9DDsn8wHqDYNNwu4J0b/8TxxQxCWC8YRNMcc+vA7nY2NXBd60DwVr3bGYLF1WrT2gPqsc4qU9BKeFG3tVD0QMYdtrKRfWnTnZPIbClc7QnHlD+vK7MZsqPdUpHaBgqxqVpXvc6qn1FRCekhlTLKl/BJ+DEmXpLCCJGYxXzrMFgS56u06tJB0E7CWjTXnvNxbOJqm3c2dhZnUdKJpLK/0P9r1Tpd2TIfDnIHSQu9TWEsu7yGREPfFJ8LJnMYC6oXiMGdZMB8L9es1BT56tjMnhFz4F64VrRbAoeeH45H3oZLtXCvnGL7QJg= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(14060799003)(36860700013)(35042699022)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:53:28.0689 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1e7f9ac3-6d45-490f-0219-08dd5ffc767e 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: DB1PEPF000509F3.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6360 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, PROLO_LEO1, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 From: Richard Ball The added tests cover the parsing of the new assembly directives (aeabi_subsection and aeabi_attribute), the serialization of the build attributes data into an object file, and the deserialization of the data via readelf. Co-Authored-By: Matthieu Longo --- .../aarch64-build-attributes.exp | 23 ++++++ .../gas/aarch64/build-attributes/ba-1.d | 51 +++++++++++++ .../gas/aarch64/build-attributes/ba-1.s | 30 ++++++++ .../aarch64/build-attributes/ba-failures-1.d | 14 ++++ .../aarch64/build-attributes/ba-failures-1.s | 28 +++++++ .../ba-interleaved-subsections.d | 35 +++++++++ .../ba-interleaved-subsections.s | 32 ++++++++ .../build-attributes/ba-subsection-parsing.d | 75 +++++++++++++++++++ .../build-attributes/ba-subsection-parsing.s | 21 ++++++ 9 files changed, 309 insertions(+) create mode 100644 gas/testsuite/gas/aarch64/build-attributes/aarch64-build-attributes.exp create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-1.d create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-1.s create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.d create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.s create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.d create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.s create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.d create mode 100644 gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.s diff --git a/gas/testsuite/gas/aarch64/build-attributes/aarch64-build-attributes.exp b/gas/testsuite/gas/aarch64/build-attributes/aarch64-build-attributes.exp new file mode 100644 index 00000000000..7d8269d6b0f --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/aarch64-build-attributes.exp @@ -0,0 +1,23 @@ +# Copyright (C) 2025 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +# +# AArch64 tests for the build attributes +# + +if {[istarget aarch64*-*-*]} { + run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +} diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-1.d b/gas/testsuite/gas/aarch64/build-attributes/ba-1.d new file mode 100644 index 00000000000..3c1d43096e4 --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-1.d @@ -0,0 +1,51 @@ +# name: EABI build attributes: several subsections into .ARM.attributes +# source: ba-1.s +# as: +# readelf: -A + +Subsections: + - Name: aeabi_foo_1 + Scope: public + Length: 20 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_3: 1 \(0x1\) + + - Name: aeabi_foo_2 + Scope: public + Length: 31 + Optional: False + Encoding: asciz + Values: + Tag_unknown_2: "TEST2" + Tag_unknown_4: "TEST" + + - Name: aeabi_foo_3 + Scope: public + Length: 24 + Optional: False + Encoding: asciz + Values: + Tag_unknown_4: "TEST" + + - Name: aeabi_foo_4 + Scope: public + Length: 24 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 1 \(0x1\) + Tag_unknown_2: 1 \(0x1\) + + - Name: foo_1 + Scope: private + Length: 20 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 1 \(0x1\) + Tag_unknown_2: 1 \(0x1\) + Tag_unknown_3: 1 \(0x1\) diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-1.s b/gas/testsuite/gas/aarch64/build-attributes/ba-1.s new file mode 100644 index 00000000000..4bc27c008f3 --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-1.s @@ -0,0 +1,30 @@ +.set ATTR_TYPE_uleb128, 0 +.set ATTR_TYPE_asciz, 1 + +.set SUBSEC_required, 0 +.set SUBSEC_optional, 1 + +.aeabi_subsection foo_1, 1, ATTR_TYPE_uleb128 + +.set Tag_Feature_foo, 2 +.set Tag_Feature_bar, 3 + +.aeabi_attribute Tag_Feature_bar, 1 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 +.aeabi_attribute Tag_Feature_foo, 1 + +.aeabi_subsection aeabi_foo_1, 1, ATTR_TYPE_uleb128 +.aeabi_attribute Tag_Feature_bar, 1 + +.aeabi_subsection aeabi_foo_2, 0, ATTR_TYPE_asciz +.aeabi_attribute 4, "TEST" +.aeabi_attribute 2, "TEST2" + +.aeabi_subsection aeabi_foo_3, required, ntbs +.aeabi_attribute 4, "TEST" + +.aeabi_subsection aeabi_foo_4, optional, ULEB128 +.aeabi_attribute Tag_Feature_BTI, 1 +.aeabi_attribute Tag_Feature_GCS, 1 +.aeabi_attribute Tag_Feature_PAC, 1 diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.d b/gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.d new file mode 100644 index 00000000000..f732ad5a560 --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.d @@ -0,0 +1,14 @@ +# name: EABI build attributes: error cases +# source: ba-failures-1.s +# as: +#error: \A[^\n]*\.s: Assembler messages:\n +#error: [^\n]*\.s:[0-9]+: Error: A subsection has to be declared before declaring attributes\n +#error: [^\n]*\.s:[0-9]+: Error: Attribute 1 cannot be redefined\n +#error: [^\n]*\.s:[0-9]+: Error: Attribute 4 cannot be redefined\n +#error: [^\n]*\.s:[0-9]+: Error: Invalid token for section name: \.\n +#error: [^\n]*\.s:[0-9]+: Error: Expected , , \n +#error: [^\n]*\.s:[0-9]+: Error: Recalled subsections must have the same parameters\n +#error: [^\n]*\.s:[0-9]+: Error: Recalled subsections must have the same parameters\n +#error: [^\n]*\.s:[0-9]+: Error: Recalled subsections must have the same parameters\n +#error: [^\n]*\.s:[0-9]+: Error: Expected subsection values for are 0 or 1\n +#error: [^\n]*\.s:[0-9]+: Error: Expected subsection values for are 0 or 1 \ No newline at end of file diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.s b/gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.s new file mode 100644 index 00000000000..9b86d25cb74 --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-failures-1.s @@ -0,0 +1,28 @@ +.set ATTR_TYPE_uleb128, 0 +.set ATTR_TYPE_asciz, 1 + +/* The definition of an attribute cannot appear before a subsection was + declared. */ +.aeabi_attribute 1, 0 + +/* aeabi_attribute with the same key should have the same value in the same + compilation unit. */ +.aeabi_subsection vendor_1_subsection_1, optional, uleb128 +.aeabi_attribute 1, 0 +.aeabi_attribute 1, 1 + +.aeabi_subsection vendor_1_subsection_2, optional, ntbs +.aeabi_attribute 4, "ABC" +.aeabi_attribute 4, "DEF" + +/* Invalid subsection name should raise an error. */ +.aeabi_subsection .vendor, optional, uleb128 + +/* Subsections with the same name should have the same parameters. */ +.aeabi_subsection vendor_1_subsection_3, required, ntbs +.aeabi_subsection vendor_1_subsection_3, optional, ntbs +.aeabi_subsection vendor_1_subsection_3, required, uleb128 +.aeabi_subsection vendor_1_subsection_3, optional, uleb128 + +/* Wrong values for optional and format. */ +.aeabi_subsection vendor_1_subsection_4, 2, 2 diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.d b/gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.d new file mode 100644 index 00000000000..32bc8f06c5c --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.d @@ -0,0 +1,35 @@ +# name: EABI build attributes: correct context switching between interleaved subsections +# source: ba-interleaved-subsections.s +# as: +# readelf: -A + +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 1 \(0x1\) + + - Name: aeabi_pauthabi + Scope: public + Length: 25 + Optional: False + Encoding: ULEB128 + Values: + Tag_PAuth_Platform: 1 \(0x1\) + Tag_PAuth_Schema: 1 \(0x1\) + + - Name: foo_1 + Scope: private + Length: 20 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_1: 1 \(0x1\) + Tag_unknown_2: 0 \(0x0\) + Tag_unknown_3: 0 \(0x0\) + Tag_unknown_4: 0 \(0x0\) diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.s b/gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.s new file mode 100644 index 00000000000..bb884bb1368 --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-interleaved-subsections.s @@ -0,0 +1,32 @@ +.aeabi_subsection aeabi_pauthabi, required, uleb128 + +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 + +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 + +.aeabi_subsection foo_1, optional, uleb128 +.aeabi_attribute 1, 1 + +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_attribute Tag_PAuth_Schema, 1 + +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_GCS, 1 + +.aeabi_subsection foo_1, optional, uleb128 +.aeabi_attribute 2, 0 + +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_attribute Tag_PAuth_Platform, 1 + +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_PAC, 0 + +.aeabi_subsection foo_1, optional, uleb128 +.aeabi_attribute 3, 0 +.aeabi_attribute 4, 0 + +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_PAC, 0 diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.d b/gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.d new file mode 100644 index 00000000000..38af4d5fd12 --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.d @@ -0,0 +1,75 @@ +# name: EABI build attributes: parsing of subsections +# source: ba-subsection-parsing.s +# as: +# readelf: -A + +Subsections: + - Name: foo_01 + Scope: private + Length: 13 + Optional: False + Encoding: ULEB128 + Values: + + - Name: foo_02 + Scope: private + Length: 13 + Optional: False + Encoding: asciz + Values: + + - Name: foo_03 + Scope: private + Length: 13 + Optional: True + Encoding: ULEB128 + Values: + + - Name: foo_04 + Scope: private + Length: 13 + Optional: True + Encoding: asciz + Values: + + - Name: foo_05 + Scope: private + Length: 13 + Optional: False + Encoding: ULEB128 + Values: + + - Name: foo_06 + Scope: private + Length: 13 + Optional: True + Encoding: ULEB128 + Values: + + - Name: foo_07 + Scope: private + Length: 13 + Optional: True + Encoding: asciz + Values: + + - Name: foo_08 + Scope: private + Length: 13 + Optional: False + Encoding: asciz + Values: + + - Name: foo_09 + Scope: private + Length: 13 + Optional: False + Encoding: ULEB128 + Values: + + - Name: foo_10 + Scope: private + Length: 13 + Optional: True + Encoding: asciz + Values: diff --git a/gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.s b/gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.s new file mode 100644 index 00000000000..5b6ed4eb1b2 --- /dev/null +++ b/gas/testsuite/gas/aarch64/build-attributes/ba-subsection-parsing.s @@ -0,0 +1,21 @@ +.set ATTR_TYPE_uleb128, 0 +.set ATTR_TYPE_asciz, 1 + +.set SUBSEC_required, 0 +.set SUBSEC_optional, 1 + +/* Integer literals. */ +.aeabi_subsection foo_01, 0, 0 +.aeabi_subsection foo_02, 0, 1 +.aeabi_subsection foo_03, 1, 0 +.aeabi_subsection foo_04, 1, 1 + +/* Known identifiers. */ +.aeabi_subsection foo_05, required, uleb128 +.aeabi_subsection foo_06, optional, ULEB128 +.aeabi_subsection foo_07, optional, ntbs +.aeabi_subsection foo_08, required, NTBS + +/* Symbol look-up. */ +.aeabi_subsection foo_09, SUBSEC_required, ATTR_TYPE_uleb128 +.aeabi_subsection foo_10, SUBSEC_optional, ATTR_TYPE_asciz From patchwork Mon Mar 10 17:51:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107597 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 58C543858427 for ; Mon, 10 Mar 2025 18:01:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58C543858427 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=M18sloS/; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=M18sloS/ X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazlp170130007.outbound.protection.outlook.com [IPv6:2a01:111:f403:c20a::7]) by sourceware.org (Postfix) with ESMTPS id 9F22F3858CD9 for ; Mon, 10 Mar 2025 17:53:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F22F3858CD9 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 9F22F3858CD9 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c20a::7 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629214; cv=pass; b=GsD2kFJkwA7pBMhzNH71SYKQQFgy6G+aw0hl5fOl9eRWgay4J4PjsigB+o6zfwBmlpL8BJVPQgf84qO7KZnrwrnHh1kL5/4NK5IgbXYillnmpcy0LdFhGgiMoCl02gldCBYO+Desxf3oC8Q1Yvyl2wom5UF/ld1ZeGzl3GJbLEU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629214; c=relaxed/simple; bh=iB6uSHITLEVKkYSsiooPaZ+/7+31KllWXFcxY26BcOg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Ej4BlWlGT/5H8mHmAFQnr4SHOnZv3JbF8dfy4c74sUpEvHnPfKUEnADSrfmAqHEulnVN9nYchgI3cXUnngN3dTSnzGf6Yf4vwm5ENxuIdueW7YOF7khqaDApt21ioOwA6t5LdBpYOXBAqwW04wpgPhKa/4poFjI8KeM8/RL5kv4= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F22F3858CD9 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=RWxWa+FRCUfyDVzb133zH/BlAAlzKiPgQSuZt+hv7QsHBoGo0W86DO1uz4rswOAeR7wSoBo8Iv77tf/TkM6l2bv9pqVg8z7ddwEoct6NdvMG5QyPJEzp7LXkP2MMBv+jVmD8ven/yXhm7BUn3kLQ7f+Mc/N27P3vuLkdZGa0o/pP5rVa6bpaqjzv7VzCgXVFzmyGo2HoG4QjQ7MN1/gvYnS3Y8DHvj/Ts9zi4TRSdQwpqXbNnPhSOKZnTQa86jIpJwtFVaRbzI4zqdnfsLUBN0+wTZpNI8CeiWFd5TdQOquTrwGaZww/UEjB2pwPZ37hALu6c5SVWm3pBzdOovPoTg== 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=UHglbQQHtfcX/cJjbjtkm1OBgogHCoNHmnmAYcSiZEk=; b=YMBP5bwjhWfhtAuh579/OvuUXoyaN/z1O7NO8A/l6Ifk9EODhwXVhnaLuUgzwK3gqt4LpZ2jO0OC2ZqNt65fffQmj0LNv0wlN+vn9CGSbo0qVWzjCFXkedgJmovqPWtJJFJW+Yja21aKzfus0nklCue6CXuxulG7bGRYJJXYG3sUux1YCy7+HnKnNYwKUi6iWutngLtYJTvpXMYX8ev2YrNggPkVJc4sdMFYaXac5+2jxn0DUXCHSSfDS2E0C9Zx/dRtcs24p3VoqsclMkrHkAWXiaAHAAbBo4rOGY6NVK4aArqsNB1pyseLHeTl22RLw61Cqj3mzU6/bwXBeBa0Hw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=UHglbQQHtfcX/cJjbjtkm1OBgogHCoNHmnmAYcSiZEk=; b=M18sloS/ap6D1uiEgtdnPkZ14dJva2vTJZP0AlG3i+LiR2K0t7b6sLaPa8OWBIK52fc99g9CHODfiCYIiVQx9mafxmfN68Nov57jjEjedn9nO3pHwkXBsELTWITOfZs9QgCxA7RrJUqzKOBRHZpV76HIHjmP2nbKAfvuFBZlBnA= Received: from AM0PR03CA0009.eurprd03.prod.outlook.com (2603:10a6:208:14::22) by AS8PR08MB6632.eurprd08.prod.outlook.com (2603:10a6:20b:31c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:31 +0000 Received: from AMS0EPF000001A9.eurprd05.prod.outlook.com (2603:10a6:208:14:cafe::4d) by AM0PR03CA0009.outlook.office365.com (2603:10a6:208:14::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:31 +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=arm.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 AMS0EPF000001A9.mail.protection.outlook.com (10.167.16.149) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:31 +0000 Received: ("Tessian outbound a81432d5988b:v585"); Mon, 10 Mar 2025 17:53:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d9db2ba4aa3128ba X-TessianGatewayMetadata: 1gMyFhQc9uV04PDsonqowTcZ1TB29nD9VPu40eFcgtfcshprKZBYEmc+Rvuhgk57uHmmxflQ5FaFkehZfDTpOcA9v0NFAJ+dOxyiR8ajtV8dqAZBJXPIicYAvGN1ZV9brKWFv7xC0HAnmz6Lik3j4TK1V66GZeEKKTQyUO3eM+g= X-CR-MTA-TID: 64aa7808 Received: from Lf89ebe8b185c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 069E19E7-E91C-4A58-8A4A-C5438A295EFD.1; Mon, 10 Mar 2025 17:53:24 +0000 Received: from EUR03-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lf89ebe8b185c.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LcVi5m9EtgXOwYNX3g+VU1UPR/v98kqO7rqoMK/2ElECxfh6O3eRkpc8ZrC27cXgxtsHQ5LhgMqakVXqCq4+YTQ/pLzevdV3aItGVdBOPC4THkwaIHUDQF5sqbebepBPC3MpwUlmS215uxkUb/QqkkKEAb5SD+5hDrMypV4yAWe5rtmc9ZPC0Yxr5o8CoqgFjFmxlB56PaBDD2wp8LfbTiAAnmuLsNFwNl7TyGG0Xde0vdpgV34CFfTBSuWh4BF/1UDFdowV8jWF1xOXFqvknS04gyTCVixHUVibAiECsEAMEQXpPLmbWuuczbV+esVxv+6TB7XP+r9F3veZOCrB5Q== 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=UHglbQQHtfcX/cJjbjtkm1OBgogHCoNHmnmAYcSiZEk=; b=YW9MidxzE95gw+iuXzOfSXEgD7f7vN18kwsed0MDGIbV6wySDBen6I7JEUjLdoVcQC2JHQIOOyuTXcaE2Shceql1coDORsv6YBinZ3WWGuVXydHRBoCTiYzr/hVsrSCkIvy3Wc660fpClEuIuqPGz8jsH03/8rrOL0fcf3tamHYZ/dAh99OPMmQR2nJpbkOzNlw7camVj9Q2U1zjXkTA8ELrJrfkt+DYvbRxKny4G4vJrbBUmS2w+HynzPo3kcNLWKaIW5S7WVw966pxyVXgoO8gyCETaExdf8lg21TCS1m1WVLeAnDsCyf7AV5hZw7bRFuc+vgIAV5MbZMx+fy9aA== 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=UHglbQQHtfcX/cJjbjtkm1OBgogHCoNHmnmAYcSiZEk=; b=M18sloS/ap6D1uiEgtdnPkZ14dJva2vTJZP0AlG3i+LiR2K0t7b6sLaPa8OWBIK52fc99g9CHODfiCYIiVQx9mafxmfN68Nov57jjEjedn9nO3pHwkXBsELTWITOfZs9QgCxA7RrJUqzKOBRHZpV76HIHjmP2nbKAfvuFBZlBnA= Received: from AM6P193CA0133.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::38) by GV2PR08MB9877.eurprd08.prod.outlook.com (2603:10a6:150:dd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:53:17 +0000 Received: from AM4PEPF00027A5E.eurprd04.prod.outlook.com (2603:10a6:209:85:cafe::9a) by AM6P193CA0133.outlook.office365.com (2603:10a6:209:85::38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:17 +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 AM4PEPF00027A5E.mail.protection.outlook.com (10.167.16.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:17 +0000 Received: from AZ-NEU-EXJ01.Arm.com (10.240.25.132) 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; Mon, 10 Mar 2025 17:53:08 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EXJ01.Arm.com (10.240.25.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Mar 2025 17:53:08 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:53:07 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 08/15] bfd: parse build attributes v2's section in input object files Date: Mon, 10 Mar 2025 17:51:21 +0000 Message-ID: <20250310175131.1217374-9-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5E:EE_|GV2PR08MB9877:EE_|AMS0EPF000001A9:EE_|AS8PR08MB6632:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c45b426-6d32-4298-6a69-08dd5ffc7864 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|36860700013|82310400026; X-Microsoft-Antispam-Message-Info-Original: JNaUXvT8QzydTBuk4y3Mo61vuibitYi7/5zK9HXPBz9hIonNyGI+Q4MddJmQbW5IG8e/l2zisg9smYPuwsXvn+A3j9TYYPWJkVFU2ih+yLUu68rVSYtNXBDhuE8zmQAghPVlBwQZMH+md6/QeXbhQUwPiDPrXdHdgK87Nfl0Q1zXLYCitoV/lzyQNGxsP9U56UF6VWp6+C04X8M+w8YF1oev6BA58ioRMxqAnIIgMKD79Pf5DcUHbIIG5HpSwnlFH5Jnqu2rKENgp1AY53evIvhMy9m2xeW29q9rq4asSbCOxJR/Jsx89TR4YOLoG4Kpi7JAUqT8PfjZ9Eag/ThOGnRxvaNHX7MC4WRqxpXARgJvGIGu9B4B4NmFYZbcjga2Z5a1O+caO996CtY8o7Y2s9GYQ3hC0fsqUPxGcgBtT9tyG6zE6w4OocKvDGQh5T+9Hf4oGp/+rzGWq9FMZj9vb2Jk/RwlkW/Cz2fRpLI4tsKLggbBQjyASDYxgKEGYDzGRRbNme8VYrD9vTJ6oBtTrhIQRQDUgFcEYX/sV0exWghNWrU/Gjkx9cOtIOFmaKHrZ48WgHbMCHmDuHuXA+KLA+14s4yJ0O45mErOaGgdF/AJS0D8rJZx+RAkYV6mGR7cAA6HAxNCscY/iSdNpq57pkI+f7IFogvj1zV98Ll/2nri3HpqOINtHINoOn4Z2AEExNOko63fEAPRuiGA7Rg5hSPRRmXyKxtkzKqsHlbWymiTNdLjcHZhjeS/AzQUtvRUCCF4CjHjNty6NKd3i9PBjbs0Dtzb3Tqvb46/2y/KrhK8SdFiCJ+bB14PJIf7f2bRWYm+R89dTJESVIofHgaB1ooWGSadME9pF7f2+IEB5T8kKsIiRRSpdUh3QUMh1Ja8T/QR9NGwFqxEkqnqxYWRbXH2Cbarx93N7pprQPx65mmWFPczg8TWZhtdebOPN/tk7lRFoWJaVlFUGyy5CEbgdW3YAg7LHv0rTMJE3AnQzzNteZ3jnaxcEH6X/LZx3NEhYHwHMSsh2O1IgOP9+LYGzn4hN/HePLZ7v6rYe/4Ro9Enc1mfT4jMwWNlQFeW732FPnjgRo9jELswnLTxbpdK4nKorrByqGGY0zQCnVNzXsY3tPatvgB9tbAcI3PLmM0sHXNMsV3J6C5c3uo3gPtKu4+pbIhrzgNogHfbPRDSXULg4lReyUPrl+k+pHuzXgv4sZiW7SU/2Wu/73WyQ8uMBpGi1WlmC7Tee7iPiLAQVQmyle6PvnrzojLqUDabJUHxN3C79jjqzBPERVVLSVcBhQhSYAbSHx7gJgKtYg9yOIvtkXBRErxgE6459VGnkyWUIvbH2rP+DiwLvLdqWlc0uaDqvxC/lTjp47oPXvgBUIn2pRPgg3UHfmTScFbOx5FA2t7PgBwCy9nlLYNyiX2KxlntQhYCGDA7vZpEnd6VSIXi2ucZDXyByo6tFte8g3OxknhjyVtqOWmasv/I84rp/g== 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)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB9877 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:209:85::38]; domain=AM6P193CA0133.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A9.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: efeda3ca-d5d9-465c-597f-08dd5ffc6fef X-Microsoft-Antispam: BCL:0; ARA:13230040|14060799003|35042699022|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: TiOZ33gLikk1zXq5wksJM74dHvJcZcw4SWgQZRMXn8CKygX8gsZNnRn57UIGTSRUQLj/uBxYG5Z0ysRuKAa1/rpUHx5goEdzagpnSFhde7GSF7Utm6j4Ss/YjkGEgd/4+z7wd0fEFDoJR9crkIe5N2n7cKs8HrS9J2SpQmvKLjQ3ChbrATtlgPdzGfJx6+Hx4yAQ+bxAhaoL4ZWj0/79IzOFeedoc9r6cMtkh1owb1L7XMHPCr7pQHi9NMLqDecVrgzOMTcUzFjq/Tq487w6QvTKjhp6/00tANcpQRwV8Iu01geo0xVS0RZn++9qIw96v7x2HeVkL7hY+B0a18vqip6UtUjOrkiH3s/XpaLED/AlSA7zZcgib5+kFZGpTiwBe++yPTKdt31V9VZ04f2aYBK0Ju+INmYjp8iKT6FsgIhhObXJqcT5qe+HN3I6a3d466rx9YPMlEqWJmL9hpOL6oLwTb5tQ/kY76LmYP/bgWmVPYhxDXj727WJ0drZVvw4zpsH3fofDkp2orQerNKkYoG8DKgg9WbbvSFhQmTePJZfdE5FeR6ATAPeiGWg7MSInffaoW7i/xYw4o0GjAb2hfbrle8UiQ8o9d3s+Tdn4U0cOvpuwTEpbpa/0lB58b+1mn8m3XMZMSffy9B/eEDhRzKVed1hWd6U5Kp3tYios7YbQvtul3tYNcvLJtrJiQfbiobTW2p1mh6j4dumUkGDvfKkhz3COv4t8WCOIAa2eGO6VqU+wwcT+lRTfiE7rGIg3V160Fogwy1kvHqiQGkasyHpD6lZAltt9bWFRzPB48uPK9TgXyl3WuGGtplk6bK+GdoRWBvhGjEfssaJZJR4YaoK0sg59zdQiq4MmrWD5bKgi7lMrtrLYBB2W1CQln/ZUq63WBrX6LJPtpPvIXoY2ek8jzGhkryms6rLyScsYTSEqckLvfoU3Kt7fx/TypRZqiII2eAiN8fO8EMXm5jdSFfwlrSSibuyNRf7nJqBhCiKAKHS8sQdefZHeWcirQZS83//9MCknNHUHe7cWvnBHne/3cEwb018FJ76CEHUnh9QCxLDkQyOFIeKzFqwHdzj3iup8wyQinpvj6xe2cyPMQoyByJfqoO/NJ4iLa60AUcVQJIwPPXEaLOcO2yX5aqLVQO4ze1LECmG41iY3k7PREgIGNhAHJ0Qhvw0lFupVMvyWDRxWWTgZQ4G6J0/LJYkI8BZWK3LcZf9EH0lHMjZZPWcG1oOjcwu+psjfTtx3HsqhUbwUhXWQ+KyglRa5KXy/xQBhElfwBzV2FqVmOwHyXyOUDfmlXdeZ+A2B/a9eLnJQasjJRUmvVnEPOe3+i0Q4Wb5l9mknqy5mRsSGDoONlocyI7j4eUvbm0fWUjK9SdxpGzo1iU+kzzYpp73gsuWLoK8ZxIIfTeDXPJMlRtmtsK+oowf6dBA5qQJ1YWWOCiofco/YsnU0dt6lhPLJkTkhNNYM+0E75Cy2Da/P8EK+g== 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(14060799003)(35042699022)(1800799024)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:53:31.2097 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c45b426-6d32-4298-6a69-08dd5ffc7864 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: AMS0EPF000001A9.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6632 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, 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: 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 --- bfd/elf-attrs.c | 214 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 212 insertions(+), 2 deletions(-) diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index ab3c80573e5..bd8ae56678a 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -774,7 +774,214 @@ bfd_elf_parse_attr_section_v1 (bfd *abfd, } } -/* Parse an object attributes section. */ +/* An helper struct for parsing returning the parsed object, the number of bytes + read, and whether or not an error occurred. */ +typedef struct { + /* Was an error met during parsing. */ + bool err; + /* How many bytes were read ? (until error if an error occurred) */ + uint64_t read; + /* The parsed object. */ + void *object; +} BufferReadOp_t ; + +#define READ_ULEB128(abfd, var, cursor, end, op) \ + do \ + { \ + bfd_byte *_begin = cursor; \ + (var) = _bfd_safe_read_leb128 (abfd, &cursor, false, end);\ + op.read += cursor - _begin; \ + } \ + while (0) + +#define READ_NTBS(abfd, var, cursor, end, op) \ + do \ + { \ + (var) = strdup ((const char*) cursor); \ + size_t read_ = strnlen (var, end - cursor) + 1; \ + op.read += read_; \ + (cursor) += read_; \ + } \ + while (0) + +#define READ_UINT8(abfd, var, cursor, end, op) \ + do \ + { \ + (var) = bfd_get_8 (abfd, (cursor)); \ + (cursor) += sizeof(uint8_t); \ + op.read += sizeof(uint8_t); \ + } \ + while (0) + +/* Parse an objet attribute (v2 only). */ +static BufferReadOp_t +bfd_elf_parse_attr_v2 (bfd *abfd, + bfd_byte *cursor, + bfd_byte *const end, + obj_attr_encoding_v2 attr_type) +{ + BufferReadOp_t op = { .err = false, .read = 0, .object = NULL }; + + uint32_t attr_tag; + READ_ULEB128 (abfd, attr_tag, cursor, end, op); + + union obj_attr_value_v2 vals; + switch (attr_type) + { + case NTBS: + READ_NTBS (abfd, vals.string_val, cursor, end, op); + break; + case ULEB128: + READ_ULEB128 (abfd, vals.uint_val, cursor, end, op); + break; + } + + op.object = _bfd_elf_obj_attr_v2_init (attr_tag, vals); + return op; +} + +/* Parse a subsection (object attributes v2 only). */ +static BufferReadOp_t +bfd_elf_parse_attrs_subsection_v2 (bfd *abfd, + bfd_byte *cursor, + const uint64_t max_read) +{ + BufferReadOp_t op = { .err = false, .read = 0, .object = NULL }; + + const uint32_t F_SUBSECTION_LEN = sizeof(uint32_t); + /* The minimum subsection length is 5: 4 bytes for the length itself, and 1 + byte for an empty NUL-terminated string, and no vendor-data. */ + const uint32_t F_MIN_SUBSECTION_DATA_LEN = F_SUBSECTION_LEN + 1; + + if (max_read <= F_SUBSECTION_LEN) + { + _bfd_error_handler (_("%pB: error: attributes subsection ends " + "prematurely"), abfd); + bfd_set_error (bfd_error_malformed_archive); + return op; + } + + uint32_t subsection_len = bfd_get_32 (abfd, cursor); + op.read += F_SUBSECTION_LEN; + cursor += F_SUBSECTION_LEN; + if (subsection_len > max_read) + { + _bfd_error_handler (_("%pB: error: bad subsection length (%u > max=%lu)"), + abfd, subsection_len, max_read); + bfd_set_error (bfd_error_malformed_archive); + op.err = true; + return op; + } + /* PR 17531: file: 001-101425-0.004 */ + else if (subsection_len < F_MIN_SUBSECTION_DATA_LEN) + { + _bfd_error_handler (_("%pB: error: subsection length of %u is too small"), + abfd, subsection_len); + bfd_set_error (bfd_error_malformed_archive); + op.err = true; + return op; + } + + size_t subsection_name_len = strnlen ((char *) cursor, subsection_len) + 1; + if (subsection_name_len >= subsection_len) + { + _bfd_error_handler (_("%pB: error: subsection name seems corrupted " + "(missing '\\0')"), abfd); + bfd_set_error (bfd_error_malformed_archive); + op.err = true; + return op; + } + /* Note: if the length of the subsection name is 0 (i.e. the string is '\0'), + it is still considered a valid name, even if it is not particularly + usefull. */ + + unsigned char * const end = cursor + subsection_len - F_SUBSECTION_LEN; + BFD_ASSERT (cursor < end); + + const char* subsection_name; + READ_NTBS (abfd, subsection_name, cursor, end, op); + + uint8_t optional_raw; + READ_UINT8 (abfd, optional_raw, cursor, end, op); + + if (optional_raw > 1) + { + _bfd_error_handler (_("%pB: error: optional value seems corrupted, got" + " %u but only 0x0 (false) or 0x1 (true) are " + "valid values."), abfd, optional_raw); + bfd_set_error (bfd_error_malformed_archive); + op.err = true; + free ((void*) subsection_name); + return op; + } + + uint8_t attr_type_raw; + READ_UINT8 (abfd, attr_type_raw, cursor, end, op); + if (attr_type_raw > NTBS) + { + _bfd_error_handler (_("%pB: error: attribute type seems corrupted, got" + " %u but only 0x0 (ULEB128) or 0x1 (NTBS) are " + "valid types."), abfd, attr_type_raw); + bfd_set_error (bfd_error_malformed_archive); + op.err = true; + free ((void*) subsection_name); + return op; + } + + const char *vendor_name = get_elf_backend_data (abfd)->obj_attrs_vendor; + obj_attr_subsection_scope_v2 scope = + (strncmp (subsection_name, vendor_name, strlen (vendor_name)) == 0) + ? SUBSEC_PUBLIC + : SUBSEC_PRIVATE; + + obj_attr_subsection_v2 *subsec = + _bfd_elf_obj_attr_subsection_v2_init (subsection_name, scope, optional_raw, + attr_type_raw); + while (cursor < end) + { + BufferReadOp_t op_ = + bfd_elf_parse_attr_v2 (abfd, cursor, end, attr_type_raw); + LINKED_LIST_APPEND(obj_attr_v2) (subsec, op_.object); + op.read += op_.read; + cursor += op_.read; + } + + op.object = subsec; + + BFD_ASSERT (cursor == end); + + return op; +} + +/* Parse the list of subsections (object attributes v2 only). */ +static void +bfd_elf_parse_attr_section_v2 (bfd *abfd, + Elf_Internal_Shdr * hdr, + bfd_byte *cursor) +{ + obj_attr_subsection_list *subsecs = &elf_obj_attr_subsections (abfd); + BufferReadOp_t op; + for (uint64_t remaining = hdr->sh_size - 1; // already read 'A' + remaining > 0; + remaining -= op.read, cursor += op.read) + { + op = bfd_elf_parse_attrs_subsection_v2 (abfd, cursor, remaining); + if (op.err) + { + _bfd_error_handler (_("%pB: error: could not parse subsection at " + "offset %lx"), + abfd, hdr->sh_size - remaining); + bfd_set_error (bfd_error_wrong_format); + break; + } + else + LINKED_LIST_APPEND(obj_attr_subsection_v2) (subsecs, + (obj_attr_subsection_v2 *) op.object); + } +} + +/* Parse an object attributes section. + Note: The parsing setup is common between object attributes v1 and v2. */ void _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) { @@ -812,7 +1019,10 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) ++cursor; - bfd_elf_parse_attr_section_v1 (abfd, hdr, cursor); + if (get_elf_backend_data (abfd)->obj_attrs_version == 2) + bfd_elf_parse_attr_section_v2 (abfd, hdr, cursor); + else + bfd_elf_parse_attr_section_v1 (abfd, hdr, cursor); free_data: free (data); From patchwork Mon Mar 10 17:51:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107604 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 205AC3858433 for ; Mon, 10 Mar 2025 18:12:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 205AC3858433 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=gakqXAfv; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=gakqXAfv X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazlp170110001.outbound.protection.outlook.com [IPv6:2a01:111:f403:c200::1]) by sourceware.org (Postfix) with ESMTPS id C6BFD3858D20 for ; Mon, 10 Mar 2025 17:53:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6BFD3858D20 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 C6BFD3858D20 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c200::1 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629222; cv=pass; b=iJtOyrdWYHCkOqnPupNICaVpFWUz0TqLR5PSdkssoXHU5vUxkwXdD6bC0FkhpgWvascKP/YeygFnyeuHFJrmJqnuf3My8KW6qSuiAd4Gc4Ona1+sxjtwXO90LieU8rwyXykz0hVqixvzf9prDN59G7Rn3lV/0U1aFflU/s3W0x4= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629222; c=relaxed/simple; bh=/oTqH9tS7yJOwf/0bWaMA8cmZNJMunOdOwb0Wo6+ZCw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=HzOMfOR2tNrj5wsFacQ0x1557c1tQDzW4zX++ovN1u96V7I3/Jer8yie8+GZjxrj9kPyHis+2zQujCilBBWSOqLBEaktyVPS6csUs5EmVZ0C3BMmjGI6e6E0qJKN8o8knJoy9ZnZmSZhlXUIqMSbyt7aSOKH9qzI2TViWay9ZUc= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6BFD3858D20 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=saEDFf8J1UFBLfRu4CvZeGFWxWGdw2bSIIwXImzlyrc7fH682XyrbUV2pJVcEXdGuHn4tTr0jkeoPI7bGJo1KBXHeq8ZUZQad6I5BY1g5j3Vp5F7mPo+mQaauRl3NeFN1hHMYPHwO01UvQBDAhhS6r+ow3AaThcUdOHE8UEMeW8BtgOWtfdpLWbvKb6ihwnBmJOCyd645AHXTvC94RUexKFgcUZ3hE4bb2anG9DN2u6hyUb+PD8fO98UVFsSU/Ocl4GG4Q8t2UVlab2gr7gEakVsemKZuM+O89lJNx26+a38lgoXr3B3MMNVPrF9FgtXfzz85l7kH2YPJptOdTXN1g== 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=2D8I7Bbbwr47YucG2UopZeBTEM7jpXYtV7xDViyMEIw=; b=EqPKfmgI9qzdFQJ/5CWzAv7emEoXeg4Qt+R3wPTlduk+QoxkA/zNG0bhls0VdFDHJZq0SD+bK9IypiUD9a96qlUwSQm3xFRlK5YElDS1GOgPBwdRWLVicnWUkPrJbO4qs3APcB8B9VMHJxxoNkV4AZ+d3BE1CM7MD30bJ722K2n4j8qOqhEmvgdN6vCZWKL9F4NfHw7oFhColeR2Y6vMql9HjO6R4cdXWDSq9825jnEh9VMMgRUTYaKrzWupfUFWg2anw5wWmpVJzENXwGUUB4ipmxz0jiNI3/kMBbs7xR1v7KuXL7aZTBfNK9mfgWYT2hLoCISPL+gETLtrJxfZiQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=2D8I7Bbbwr47YucG2UopZeBTEM7jpXYtV7xDViyMEIw=; b=gakqXAfv9prd4meB+IyvsARlUjGxB45RgjvQVmGupurTTUUQTzimeYrtTEuKUqZcJhyfcIhRajLlC/+KDl0VbyO/cjGKeTEzr9iRWdbq3sX/TcYUeSceml4QybQy5aHgr/nvUmbnow2r9KI0sKPmmj11qDsVjMYtfz/GxElurFs= Received: from DB8PR03CA0011.eurprd03.prod.outlook.com (2603:10a6:10:be::24) by PAVPR08MB8918.eurprd08.prod.outlook.com (2603:10a6:102:323::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:33 +0000 Received: from DB5PEPF00014B94.eurprd02.prod.outlook.com (2603:10a6:10:be:cafe::36) by DB8PR03CA0011.outlook.office365.com (2603:10a6:10:be::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.24 via Frontend Transport; Mon, 10 Mar 2025 17:53:33 +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=arm.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 DB5PEPF00014B94.mail.protection.outlook.com (10.167.8.232) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:33 +0000 Received: ("Tessian outbound a81432d5988b:v585"); Mon, 10 Mar 2025 17:53:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9e3626a9e0b22111 X-TessianGatewayMetadata: uvsgJojzl3NzAIQnSJv5za4viVljVEIbZWQO6/vNv0SDXDSNT+3VVKpfuKGCE2z0HmojSEBFE9nm3piIewp5BnCXFh0uyCc6DuMMixEkcxU74Xf8RW1Q1PR+Mobkmk8jQ4Ks5eV+0A5DpX7gyjKUJvWxxNJFfw3yaZHSyq+ZP3Y= X-CR-MTA-TID: 64aa7808 Received: from Lbcf11df86013.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9A9BCA2D-9051-4CE8-958D-2A542261609D.1; Mon, 10 Mar 2025 17:53:26 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lbcf11df86013.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wSupd0jOGgjXig8+VaSj6/7IrrWur7KfJO4uEpAw3zL4ZUgrfSj1QpughBWGzPmaZ5djBe4itURjzTSNEDgWL8bjXGLQ+Mk84kgpgvBv4tG2XBzZZAeWjA7wIAWPxNPTc2wp5egEG+n9nhFZSO6cbvxzo+B1v0hBX8Gc7m6No+c3SL36dfU8klDO5gaPh4QsLPICGs+zShaju5iFDOtMQJGf+mDi9rzBV5qijg6gxdZ05P4OVadFHgk4PS/kskJCQpyY/B+cPRdgDB7grFjVAlHo2x7ywUjvX6Ur7B0kB8zrYSGNGOncIYJWeZtQ1cb7z5+/AiHxYff13B2FuoAEQw== 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=2D8I7Bbbwr47YucG2UopZeBTEM7jpXYtV7xDViyMEIw=; b=twZL5T5nZZSB4ogXS329FUDscP4oAXzY56cVS4dCeLtCuTjUPk3ifprwyV4kDwtCi/6haxUhorqCqEmA3qra1OTqLWalB+9llj6OmsXN+p36vzwDvYckF/PTBHT4GChTdbFZC+hQCHqReO03WrELdUDnxPAdn64e7JhvM4yfZcoDcmeiiY+KlhMgPLvuGqcRlxOWMPnNB9rBlsp2Uxcm3aiz6/L6TrYW9+SlTUkfhV71M3f0V9juuK+tDdiYkd/SIVz4NptjNVOULi1zPgCF/nsSpulnEAkYwKgXumRrT3Z5gZFpbvqoUPpr0NG0GnES9fTMVXDNx/2jjOL1Ls9YHQ== 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=2D8I7Bbbwr47YucG2UopZeBTEM7jpXYtV7xDViyMEIw=; b=gakqXAfv9prd4meB+IyvsARlUjGxB45RgjvQVmGupurTTUUQTzimeYrtTEuKUqZcJhyfcIhRajLlC/+KDl0VbyO/cjGKeTEzr9iRWdbq3sX/TcYUeSceml4QybQy5aHgr/nvUmbnow2r9KI0sKPmmj11qDsVjMYtfz/GxElurFs= Received: from AS4P191CA0017.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::7) by PA4PR08MB5981.eurprd08.prod.outlook.com (2603:10a6:102:e2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:24 +0000 Received: from AMS0EPF00000196.eurprd05.prod.outlook.com (2603:10a6:20b:5d9:cafe::3) by AS4P191CA0017.outlook.office365.com (2603:10a6:20b:5d9::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:24 +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 AMS0EPF00000196.mail.protection.outlook.com (10.167.16.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:24 +0000 Received: from AZ-NEU-EXJ01.Arm.com (10.240.25.132) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Mar 2025 17:53:19 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EXJ01.Arm.com (10.240.25.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Mar 2025 17:53:18 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:53:18 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 09/15] bfd: add support for copying object attributes v2 Date: Mon, 10 Mar 2025 17:51:22 +0000 Message-ID: <20250310175131.1217374-10-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF00000196:EE_|PA4PR08MB5981:EE_|DB5PEPF00014B94:EE_|PAVPR08MB8918:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f3e6e9f-c611-4ba6-6da5-08dd5ffc7981 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info-Original: ZJ9JtF+wHv+qyzJ4Rgqj+XZPWOHSarCnoScPcrF6B+y7db3h7o6Fkj8wppJAlOAN+bnyoLYlykF4Pa5oRfYFJAq5oHa/6hcuLu1QKUqVjWZe/K6TyWHHzGVM8IhmW4po/TXuusJogrl9mUQly/vu64UhFKAdVk8LOOIoYevtF5EO5u10gMV3z7edHwtAZKLWU04XGzMg0Lm/qo2+NWJoUNM4FWhZGUl6FM1OB/Rqwq6WlPn1ufFYY8hJSbXoig+PN0WUik3pIj5+ioH6dmgmkrrPBcD4uMb4ehsW5Ftop9mhuJHWwE0zQF6F6DDTMB9aHXcnyBHXbJtezXbjaLWpjgYwh+wLWgglJ8tm3xoRJ9pdtMQTUL5rz7yvNUqjFpfNKElZZBrHdM/AwBqtNaqlpj2q3xaMztHcD9eUw0IatigPxXstK9NsB61JUgTy1YvU31xLf70LiPfAcnpX51LBoXhGMQpyHHiS7mm6Kl0Q6yrz1TUteXcLFKRM54zXWQyYXXXgI8d+3Y/uBAtHs0FhGN5Wp0X4zJrgcIXnKjXk/M1j6G/e6xWbTWRLVcFX8dJad1NQNfrf1bKeBoxfawJOnUUfG+5ucNd/Nh9zhtSFve/JC1CMHa7OiBlOea/3KRVIv026W/r0oTDRBe8QHZ7RFMoOMTH6dw0Tavm8lGO2L5u7EKPNgVmQYdjRXafMPpTayLTP8jkENzhCRPRLvEiSuMTyW2+icfVYKvVMTOrd2LUzaZ9W9HQp8muQZg1zm1bI8hyZ1aSegWG3bd+ilBEhkNxHIKCPrrtMuCYFRWDtSc6k7yITfdwD+rDU28h0EzW9II3+Wa9SOZL0O+DqDzmdrsoGZWi5kGiGuCIHAo4ayR1wL9dBu2JOo/3NdQhrKPJ9aD6vASzIGgleZGcNPAa1V9EgbZidFEyLye0y+f5gnSrGhVLcXnfF3UTgL5KlXublLFS+UwEZ8fayvwpGfVJ9aFARVouFT1T7OHkJEyo8Y4LjfT7WcHCFZWvJYaHMoPasdXNC4GuWvK8JPyWLKqumns4Y9yOebFYd5CIjZ8Sq2SYpfNlSYOX9cITC1gGk7ReFy6jWViJ7f4oJLXuD5ixN7I5Os3JGGosrrqBzd8XRAV10NuGhclbVoRKJn9Jz2ir5g0MM7x3KycAE4JOrJC6DqWhTx4sWlZbR5Io2nAbgjW++cdmmzq5Dai86Qy+0T+p4Z4505/ZbAe9FPDmsC5xUg8EVNcU5/4gq4B+Cl7oSfJtvsfXGwlLd4FYUCn+zMNfoSNtfSpUM6DGie2wXESNVlp6dsXKFI3MsDAShofHMdr2jUdZUFdEKhnvZhFD0aY3xO2cQFml5Rb47ZPp6HeWuo8hXoyVM4U37WDiz9HuTLvV5lqk3xs+zy3diHvF93sYheYEHd6NluttS9J/R3FyRSfpdQzZP9LFCnXvyQk6gBqgH454n3MM3byG+LEGqG+/09pMl2urS6tW/wGjcq5hER9GEXsTqpX3SC51bTjRJRPE= 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5981 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:5d9::7]; domain=AS4P191CA0017.EURP191.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5PEPF00014B94.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: cbb1fe4c-d358-4912-9f75-08dd5ffc7468 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|14060799003|36860700013|1800799024|35042699022; X-Microsoft-Antispam-Message-Info: u+DWqii2HclADOrOVBuxEYB+uZZ5yJ8opK89IZ86EUjlDU4EXV4aeOYh/Dcvb7vPrg2T8EL3+FAQNVkTpJSSNlX1vqZKVRXlFXb0vzKcThOvV9H/iexFDBQWTuloy2HGIMgatg8PfuOml0qM4C5s8z6/cc5LEN+xO/Wc34uvv9KLVFpOxLFHM/PJRUJpBSVTWWqgAbQTQDeh2E8OjT0/c3BWl2TIpJfuLzkg28EJHCdXoqQINkJubBD9ugABTJqWtJfplS3nxIx3NGHiverGu7wwP41xVM3T+2E38XgolVqtiSasKd0YEpPqs7mGNmGwUYPdzzQ3PpxY5GElkyh6ybptzlv1Rllwbwtq79plSfiEw3FeGse2Lz8tQ9eYmLHV4k/FNHXvDnU7TPpKL/K4a9H9w7gJRUfcm3346+URS7WROTixXZ3N/kZ7irJmDDtW2nG7pn36vc0HxnIinETTpN/HJwBNfkAzyO8wrSE2MaMYAq+ufek1PyPOWQQ7UZ0zuudtCcpsH/BNMgFbidtbUlfPfrFGlwIINUh8EKY0/Imz5etuN/nZuMHRSU94/LgOY/z5th8yGDXH19jD7SvWXRJexesRCK8ciX4CZNvXUA1WXMCc56W2ALTq9xH7rPDjuGQa+rRUjjU0s+uFxDGgor7qAskTneWxUeEwcJsegpyUB10AK35xv77vdylcTWW7ezpXVVFQR+7T0v3yaDlpFtL6d9i9Wwz+nrh3l9xpSYXg5A/4Wiip27KKySo9VXa2M9hVcie2W6imZMx8DH7doE+KhCdJSKeyg0RTNMl8n2y0Z+m98kbPWfQAislQX2Xqx1IgNZ3DJVZQq/QkXMhC2Q5esHdZ5MJcpvY5VUhcjwy6AVd4JzFQTS5WYx97gLRPPY1OgDoBHBZbgvKN6QgkQ8dNVh6bahFMKL7EhyBvSzhJslznWrxPwJhhG9gz6PB6aMpBoNXIDoasiQAVXgIZAOS5F6zZrJWNfjeZNm5I6W3mpo6c2Tb20LIxrA5Uwnbw+DlRId7We/EH9I9w8JUXF1VhuTQVGtnIeWu0kxO0rJ99GKzMT5iU50M1/f1FJkbziZOiYhBnV5R+xaxUNpeD+vap45i1mtFjFtmWBUS7BbfDKwjuz8cqkQS0n0O426/r4A4WoO4krEkXcfGhSUrRu/pjyX5lR5Kny1AnZGnNC85HUgrflvydaTv3lkAdbHEvWXBhmp1NEpjvCPwiO+zvkQFWp09Btot5M4yCEwplea0G9MCQzjMG3T7FB/D0XpIfwsosJ9CPn43TR+b1daeY5IFs7jCSVSU9jL+SuuZWj7tETjgr37I7JsSgyb96bpOPs8PVjFRLz8bYjgzFGYyxscfqCc9nIO316tiZHPdiJPdilH4flG5ZOCeyGX2une8DeDpAx1w2tio+Lzbr5Ysz/9ib5e+bI0rXJPazHNUjxQq4UQ7nNqfwe/xESvmmHf4pVhbYem7A+ROpjXxJM4dkAVw+BUYcOqS53/VMx6RRIuo= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(14060799003)(36860700013)(1800799024)(35042699022); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:53:33.1401 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f3e6e9f-c611-4ba6-6da5-08dd5ffc7981 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: DB5PEPF00014B94.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB8918 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 --- bfd/elf-attrs.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index bd8ae56678a..12a81181c11 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -541,9 +541,8 @@ bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor, unsigned int tag, return elf_add_obj_attr_int_string (abfd, vendor, tag, i, s, NULL); } -/* Copy the object attributes from IBFD to OBFD. */ -void -_bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd) +static void +_bfd_elf_copy_obj_attributes_v1 (bfd *ibfd, bfd *obfd) { obj_attribute *in_attr; obj_attribute *out_attr; @@ -604,6 +603,36 @@ _bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd) } } +static void +_bfd_elf_copy_obj_attributes_v2 (bfd *ibfd, bfd *obfd) +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return; + + obj_attr_subsection_list *in_attr_subsecs = &elf_obj_attr_subsections (ibfd); + obj_attr_subsection_list *out_attr_subsecs = &elf_obj_attr_subsections (obfd); + + for (obj_attr_subsection_v2* isubsec = in_attr_subsecs->first_; + isubsec != NULL; + isubsec = isubsec->next) + { + obj_attr_subsection_v2* osubsec = + _bfd_elf_obj_attr_subsection_v2_copy (isubsec); + LINKED_LIST_APPEND(obj_attr_subsection_v2) (out_attr_subsecs, osubsec); + } +} + +/* Copy the object attributes from IBFD to OBFD. */ +void +_bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd) +{ + if (get_elf_backend_data (ibfd)->obj_attrs_version == 2) + _bfd_elf_copy_obj_attributes_v2 (ibfd, obfd); + else + _bfd_elf_copy_obj_attributes_v1 (ibfd, obfd); +} + /* Determine whether a GNU object attribute tag takes an integer, a string or both. */ static int From patchwork Mon Mar 10 17:51:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107605 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 AB0ED3858CDB for ; Mon, 10 Mar 2025 18:14:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB0ED3858CDB 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=ppImqYw9; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=ppImqYw9 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20620.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::620]) by sourceware.org (Postfix) with ESMTPS id 092833858D38 for ; Mon, 10 Mar 2025 17:53:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 092833858D38 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 092833858D38 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::620 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629229; cv=pass; b=elLaHcIl2SW9QmoyEWa/TrnpX8rXS2mcjHwp6tnu2YHHSq1nbWTXOkzgeHPawlWSM33guOtvVrVUPyAmeqPUoIvOFbwM1v++yk03X2GdguRzpp4G9/14bp2K/K5ht3b2DnglJuZlUWu2C/bNAUBPwTBQNz8iaGS1m2Nyb5NwRh4= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629229; c=relaxed/simple; bh=N5iR6kmW45Pz7Enwn4rjiecttW2Ibov9aPQWvn4cTfo=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=n4QOx1zFbGcoJfrwo/ZMKteC89568EATFY9T59IGOBuxOrfr8R1IHao/EyF+oOcGOgnbYYnacX+28o6X7oLuTW285rJgndIhxzJocWBtN62mAA21dy8V4DTDHHg8vkuilZTMyRZBD01P0AZ2IzAIuPv+Xbq5qsBtctsvYNJVXOo= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 092833858D38 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=QUBpxt8Gq4OdcMtWtjCWGU6b5w4+FMm2cLPM9WIQ88yzTre+h9YKOu4SzYLALS9xcx6f3wbaxoDt2D1TuBCsfC5MaW+E4Cj/GU6DHH0ruO+BgUXaEdroyv2BAPJ/IhnFJl2S1ydecXOpwYLJ1NdKVOIEQOs4X937XYmOdzggdVWb7VkSdkboIL9NfcpawTMHRp0EBFEHw7to5TgXdlYqoFuA/NIra9oRO6BZ3KpyWkyT+AzzNcDtj6ZxtwfrwIEYB9htXavFdQXVKxsLvOkGiOd0JOted/lia5tnGYTQVHiAEgHTW7KtYvwAJOf+Q9oeQBk+4iRK6YVCHxaSuAMetA== 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=HnNpfcLBHF+0eJHWdzQVgaqzScaZjzhtgOYjb4dL9bw=; b=MQFzUqbAW58kjsfG1VlS5jCWFu7024D1wvwP4UwB2rXw/X12JAD40PgzQhxLg2sGrywFll7TBwzhOIU88eWhmymVjHmxQuObFQLssVH93xDOkyzTjlXhpm3rA41aE1tYmDcpU68zbbTjSK1w0Qr4poBxkuiWuY9TGzwnfhsJP0nSugX2p+/e3uYpmuwjMHWGtWmFXaNw4aHQes3se6xWGN76aijYo1UsJ76SEvW8WnspchhKgnWV2+jgGmjFBizlnrAdgdy75/qG3QvUkM8BMr6H+iRLTT4HT1aDRGW7KTQiRqVm7sSjxVkQfyDeMyqlxjMYwxuZBJ3AvttnjO69vg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=HnNpfcLBHF+0eJHWdzQVgaqzScaZjzhtgOYjb4dL9bw=; b=ppImqYw9JNPd7U3YTVHFmL8NczrHmgW4gyoTDPE9Zzi9Oo/WUzCpLmdpkiaP8iaHFYn6D9pCIa9J9OsO1S1LblexlMIhzKMWP/ATFiGMpepDNToPwq+gnGZkF7Is2u/iiuu/lHhtFw7SIr7qCuTJu7Y73CHYuhhZbH8bo8FN6oE= Received: from DU6P191CA0061.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:53e::14) by PAWPR08MB9066.eurprd08.prod.outlook.com (2603:10a6:102:342::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:45 +0000 Received: from DU6PEPF0000B622.eurprd02.prod.outlook.com (2603:10a6:10:53e:cafe::37) by DU6P191CA0061.outlook.office365.com (2603:10a6:10:53e::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:45 +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=arm.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 DU6PEPF0000B622.mail.protection.outlook.com (10.167.8.139) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:45 +0000 Received: ("Tessian outbound c3a902884497:v585"); Mon, 10 Mar 2025 17:53:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 64ce313d2d17f524 X-TessianGatewayMetadata: RwBVHK2igva6WuvvqkunBiPJnIT8XKFIIBskLE/svDLI6zn26ammH/5oSt1VrNXTVaXDZnqlInjHZlCvqVmucL+ekCvS0JxoCd/9uRGHw9/NvqC5KBjK1w9d+wkLKjqNCiWRonROpo3T2tJF5l3ZrmqcRPs6eS7ymqW/KasPZGE= X-CR-MTA-TID: 64aa7808 Received: from Le9c45e4995a6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AD6FFC39-81BB-41C4-AB93-5B29CCB58E75.1; Mon, 10 Mar 2025 17:53:34 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Le9c45e4995a6.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o0ZNnRzrMv0Hj493xXiXkfpXbu/eVXZp8JPxORtOIBqmwvOHLZ/Q+OaQ3uHlLZjwQkN7eAQjdScmdEQVywpbrSzt8e/kh6egW9Qer9MU0XKXkOeCg3LU9WrdTte5YRTYjk3nm54gEJ92QJTEpJi6nf7TkBCVB/ERQdwoB6QomTsSNlRX+f82Dt56Y4VQhc/K6/Vv7/kYoZb2wJUDqKTS6j+KLdUZHf3HsA0XP2l4+Qun8+PWMPvfGVRlQCI8wAdiUefWSSnHjJ0V22Q5msX5XOjOw9ZzJOW3GmamikB2zrQLHrxgv9c8kQaVkPL5BlsNe5JhLhKRMzeWgrcmP3IZ3Q== 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=HnNpfcLBHF+0eJHWdzQVgaqzScaZjzhtgOYjb4dL9bw=; b=vuRtfxEYBPNYFlQmu52RKjsdflIYdzLV5J3U1jsFIAWE0sbs4yANb1kOonLaYW4e6btWQi5JEJFm42LYJh51U37XDpwuPQFOxTBD8PGyhEH6xirat+SnPQLOv08RSVxHfbGXMSgDMUrtOdvbGAoxYeHeKqnZHnKfOkyePMqvv1DKNrhcivvtkhvYLg6VT+PM5eazWjTUWGQgZPwl5Do9BsRSCsS3/cCPk0lU4XWme/MlpxD7e5AuVjUo0GRrglNfvq5DLFaTE4V1npLW1JpM5K++U5Z8ve92KlQdt4NIT0S3pNXtGpMe++OVlUaS2rEOKC39qHLs7J2YnEevk2yAHQ== 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=HnNpfcLBHF+0eJHWdzQVgaqzScaZjzhtgOYjb4dL9bw=; b=ppImqYw9JNPd7U3YTVHFmL8NczrHmgW4gyoTDPE9Zzi9Oo/WUzCpLmdpkiaP8iaHFYn6D9pCIa9J9OsO1S1LblexlMIhzKMWP/ATFiGMpepDNToPwq+gnGZkF7Is2u/iiuu/lHhtFw7SIr7qCuTJu7Y73CHYuhhZbH8bo8FN6oE= Received: from CWLP265CA0539.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:18d::16) by AS2PR08MB8748.eurprd08.prod.outlook.com (2603:10a6:20b:544::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:32 +0000 Received: from AM4PEPF00027A5E.eurprd04.prod.outlook.com (2603:10a6:400:18d:cafe::38) by CWLP265CA0539.outlook.office365.com (2603:10a6:400:18d::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:32 +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 AM4PEPF00027A5E.mail.protection.outlook.com (10.167.16.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:32 +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; Mon, 10 Mar 2025 17:53:29 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:53:29 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 10/15] objcopy tests: copy accurately build attributes data from an object to another Date: Mon, 10 Mar 2025 17:51:23 +0000 Message-ID: <20250310175131.1217374-11-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5E:EE_|AS2PR08MB8748:EE_|DU6PEPF0000B622:EE_|PAWPR08MB9066:EE_ X-MS-Office365-Filtering-Correlation-Id: d734f844-3a76-4703-468a-08dd5ffc80e1 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info-Original: 08jDWmU9H0Fh0EG34arlGH/f5fclsxhu/09VAmw1EqoZl18zr8ZvIJQKTNnmZIVTLLiYT1jwWnogjVHDUyDNjHjdnLUbvGRVQMF3de9tt9PvQVF8ljd30KTi5CdJVG5VtjpCVySKza5dmJU2271b+PxP6+CYJjCwf4ThcfM1aKjuTPxwDPbGPHF5hsBmNCiZf9Mu82Vj+VEKF8xwtOAnY3Gna4Vn9zaw5KUhw/tpQtOV+euoaLeDQxXinCSwOiW9NyXAUFEnR+6DDmQwbejnvvWPvVlqlN/X5LerMrBZ1x904P8JuO5fZvRbu5QqNrH++XPVEVDlPgynnChJV1/VNPEwfuIMhdFpwyJgZ+FYHh4+++qo5bczp6s+dV7Bvf5bvbujN0k2GjP0x2UBSHJRDf7Ex3aw69/tHWZXDlvdWKPIcKIeJBw4K28Theb0NIyJlp0sCnK2po1lhRh/5AtqpzjuEM4Amu9iuFYAAjHNZ8R5WV6aXpyZ33RtfYO3xsGOdeXVTvKL07sxg0nWEVeGTAhhpfcJkRBHSRLaxjSwKpfGrobfMz5Yi6L2Ys2F4kagkNLl54zoH8h4t/viuK7IrEonxOLi21xEDG7W1ugG9rYWdY8wG4o96gPWVIL9CqeXN/bvwj1SYQ3HMTolBrzTd9WYuqP2tmOoUGMQlxSaRioo6WNz10EznoaQ4/RxhU7re6gniWTyyOaLLA1HseLHoMP25w8dtSD/Auq2+QPhv+QUT41Bt4eP4ZfTPHHd1NuSE42wFOuKJlmKq391AAjKdcnlXwbV/7KHSTRvQi2mAPFqZUd365oI1Pelp4YJEpOwwAS4ydCU5m/XmhG7jUkNuXIzizgOMjA9QvvO9omx9VI9b5I6VJggppaIhKTWknBR2inncuFs3X8OUDLceDRu6w7UoncAkSajBpTsFteLoLzYop6N1tDD8aT16L1I9ki4n8dRjPUh5C8+BrOHkZpvDCeilL5eo9z47/jj1plGn5D0gofJjmab4/yXB6UoXUx6smuDlq9kq31dUOXncxWw5wY5Z0O+zfTw/Bta1UvcxUW9J3qSYnhMtbxiUsIyqH931tW6MJVMHfuoE6R9nnw/d4TriPXkyl7+LM0wx5lftX4lsdRO8Pyj7vXTkVBpJ0PerUC37F+ZqqdDJ4gRnw5aYVCzLZVKsdsnmnp9uiSFaQ86bZJ96fsStev6mbK8e8FkfRAYOJumv614WXla1FcPE7UY2it27gEv8OYx1rQuQs40YyiJGv0Vp6iNXc1u7swaOJFy1UVYEEGfGjSvY5+XSEGAJf975e8VKGRi7mU83YvUY+ppFzTop8zGLbM9dr3rGvwexR/4zcB93Rj9KY0hwZK+FtM7SyhazaL7EsSxo6WCv5JGXtBMoHXbAxNy6C8Bz6xwmQOw0aV1aUTuQSre2oh1oOv+XTBMDVRxXklCmT9tPnFEdvrZ8DQxDjQR1Iu+3tBfISLDHR1vCrpZhyA1f1S1J8/WgnNPurRX9y7RNAc= 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)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8748 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:400:18d::16]; domain=CWLP265CA0539.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU6PEPF0000B622.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 50766119-e756-4052-2d60-08dd5ffc78e0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|14060799003|36860700013|1800799024|35042699022; X-Microsoft-Antispam-Message-Info: cVBE9X4iso+C5I2daB6E/ayQqUucFDYzMvofphwBjc4VvkhRKVRV3M6QLYTU8w74/IPoa19yuz1quRSO4pnc6FIyvdA4eR9qQEqHHBg+lgccOzcwYBvIKuXchfang8lLJhudvN1hWLLBDM+Jz6F3Qt6M6vlRwnMPaRxwi54gZtNv5i1XAqlov/uGehwaQoVDgOdXKemQv1UYwwCCcwTe6ifz5w4RAjLUbRsPmVdS0hV8WiBiJtR33xcU1u1coNDWchmJ6+pRfbQ0RNOfqRj5yFyBB8nGtv/OFPLVhSp6iGgorTyV3hLo/XrLFCLXA8SsInOLyFTcGuOJiKkClx5xW+HhBVQJHaC50dF5zvxTLdtoY4KrwW1mIk+m/6x9WgehclU39Gt4iBx0qmjs+JI5/D4f6f+2YA5kSZNOGVSIhW+3wD2dHVD//n0bO7ePvmKDUGgqHNZ6Y3T/PVQFudZ3CXH2KCJ63JjMdvfzM2+rRaiC43Fz+pzv7ODK4RwTmRHHGucSehy1RUuvad8XheUGdmhNnSzl6gMTAiRgbRUUGtZ0Pv4H4EkCBgANpSk4xo9feVZ7/8sF2Nwza8oqvVdgDxioGUB2/YgnNYqSu6491nxLf4r83gUvReL7lCIANdDhseUOuB7PVlsVgTXGNF+SOLyGPn5Dflpi01lPaE3XL+DNGHhp3PdBtlYCdfkQaO6Jaa2L+wYXVVw4p7RD+CJ03KrUdmO36EbftkGSECaNBiaUosvZTlSL4iEJEu3Orp2FUWh8uoW5M7f9AHVllX/VLqS0FGVIUZr0IoWdfcz+8k5Na1uTI0Osbw7lbwUCYz4fWfK2yHz9jb/aq7NAI7TyGwGeo87OOCnFeZMkrY9FuN1ir2hFNDdz4nWFCqMK3w+ZRaT3TmL4icjZwHhrmUPk3/1pYr8JRRqkAN/xbl2KI9nexuib9jPPvs9NklkuTdtG9f1QlDz/9ccWYW4YIXcjzisSSTO/jimeRhhP02AYrbMkucENsWcoL0B8CE9dghDufwvVKQ9UOGbDfUjXZ6rMGYQOFtBxKjQ0tKW9aVQP6STL91TIM2QfMTXU0FKXaWRkEx45v7QcU9CWIOEys0M/QveA99G3VBJ+UJAnDRAKdM7CYPJQ4OTsU/4uyJa16m8sQYm96QlJajg5Gq58ci43YcKaYqdCt9p3jXQg2u4X37fNCaQxwgM+cvuGqTeyipVDhYKNZdj1UF8RkHhZeLUT4lkVfhL97kwWD50lbeOKgiKec+KGccvP55R9pBwNiX7SRltXL1vY9bI0GkNtoQtx1YSt4qDdPIZIviTBiECN1r1zF/lxY+yIwPgTsMaiYUziGLqWs8uubUesEJzgir4ZVPzSYaF8C5dpHMikmR5NwIFBeDAcEO3iFWehgZpedfBNIE9KJPByhRr+YfXKY7Kl12JonVVoC1WFlc35YHUG9ETRAefgf4BXa/UVgMa3TfebZWo2C6CX/x5g6esNtYBgzyXBpzkTzaWLeqzzmgqa2pg= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(14060799003)(36860700013)(1800799024)(35042699022); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:53:45.5123 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d734f844-3a76-4703-468a-08dd5ffc80e1 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: DU6PEPF0000B622.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9066 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 --- .../binutils-all/aarch64/build-attributes.d | 52 +++++++++++++++++++ .../binutils-all/aarch64/build-attributes.s | 31 +++++++++++ 2 files changed, 83 insertions(+) create mode 100644 binutils/testsuite/binutils-all/aarch64/build-attributes.d create mode 100644 binutils/testsuite/binutils-all/aarch64/build-attributes.s diff --git a/binutils/testsuite/binutils-all/aarch64/build-attributes.d b/binutils/testsuite/binutils-all/aarch64/build-attributes.d new file mode 100644 index 00000000000..a401749991d --- /dev/null +++ b/binutils/testsuite/binutils-all/aarch64/build-attributes.d @@ -0,0 +1,52 @@ +#name: Copy AEABI build attributes from an object to another. +#PROG: objcopy +#source: build-attributes.s +#readelf: -A + +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 1 \(0x1\) + + - Name: aeabi_pauthabi + Scope: public + Length: 23 + Optional: False + Encoding: ULEB128 + Values: + Tag_PAuth_Schema: 1 \(0x1\) + + - Name: foo_1 + Scope: private + Length: 20 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_1: 1 \(0x1\) + Tag_unknown_2: 0 \(0x0\) + Tag_unknown_3: 0 \(0x0\) + Tag_unknown_4: 0 \(0x0\) + + - Name: foo_2 + Scope: private + Length: 16 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 1 \(0x1\) + + - Name: foo_3 + Scope: private + Length: 26 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "hello" + Tag_unknown_1: "world" diff --git a/binutils/testsuite/binutils-all/aarch64/build-attributes.s b/binutils/testsuite/binutils-all/aarch64/build-attributes.s new file mode 100644 index 00000000000..bd9665f9f6d --- /dev/null +++ b/binutils/testsuite/binutils-all/aarch64/build-attributes.s @@ -0,0 +1,31 @@ +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_attribute Tag_PAuth_Schema, 1 + +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 +.aeabi_attribute Tag_Feature_PAC, 0 +.aeabi_attribute Tag_Feature_GCS, 1 + +.aeabi_subsection foo_1, optional, uleb128 +.aeabi_attribute 1, 1 + +.aeabi_subsection foo_2, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 + +.aeabi_subsection foo_1, optional, uleb128 +.aeabi_attribute 2, 0 + +.aeabi_subsection foo_2, optional, uleb128 +.aeabi_attribute 1, 1 + +.aeabi_subsection foo_1, optional, uleb128 +.aeabi_attribute 2, 0 + +.aeabi_subsection foo_1, optional, uleb128 +.aeabi_attribute 3, 0 +.aeabi_attribute 4, 0 + +.aeabi_subsection foo_3, optional, ntbs +.aeabi_attribute 0, "hello" +.aeabi_attribute 1, "world" From patchwork Mon Mar 10 17:51:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107598 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 2FB463858C2C for ; Mon, 10 Mar 2025 18:02:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FB463858C2C 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=l0SVhTJP; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=l0SVhTJP X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazlp170130004.outbound.protection.outlook.com [IPv6:2a01:111:f403:c200::4]) by sourceware.org (Postfix) with ESMTPS id 837123858D20 for ; Mon, 10 Mar 2025 17:53:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 837123858D20 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 837123858D20 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c200::4 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629236; cv=pass; b=qf+YcjfEpqUuM8dUDxiKHOM4YyWV//i9fiV7T0H2TNksJlIFF/PAQzonBKtZxSh/lfT0YrpAfoS701CJowj6zC9+5Zo70MVY/cdiHoLh8b+FipaUQ+OSvKn8x5t+ZZzJWyVcYsEbk4838BBlyPP9stLWouqJwKuHF4Kal7Shu6k= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629236; c=relaxed/simple; bh=d0TgtdRClD7f6ho3gcggYAX0fsaqiwcW9PQNF98NvOY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=LaqNFblW3lheO0y4jZLIn48UCj0sjRnjR44SL/wZW0UjBMAVaZkHgUACuO7lj7w1/toM/QNhZNMxpJkL7YyZvzl1+hTA3YMoywxiVN2QqVmbyehxdxpcjQN+Imq3Mbzu9BalInrQCP7zCln5zb3IvT/eP6TmYghploV4vx7l2W8= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 837123858D20 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Yj0RQh5M0DKkemADbqpbbQO319b6Es4teKUz8Mzgr5XZWyB9Iek1U9Trs4xy9vHz74+3EMP4y+Df2D+shCMY5jB1JqU9FoNrM7dxcQpCiFiUSx73IaM6l4hRrLpcuz8xVGZtC1Q+pk8D3RWWOu2WDd1KAhj87FZg9uL0rJb4O45ocu1sOSWpUp7NAS1J/xpBZbpBoNJ4UoEnOrAXEdOpo+alopn9g1zhZuskjqQiCmjzmODG9f6IknNWkSLwo7zEkPnZfdu87icng/gNDnRIu2M4CSfNOW1f9FuevPOZkczWVvGPbX+LmXw6YKb7+FrViEu/xXDVZHVlzfBI/NPdAQ== 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=t4bq+s616XCIuyX+m75lvsblRdAm5FrcWA5g/N7yiYs=; b=Py/0pDQ8cauWFstx5ICHLCk1PySgI+ivuFoVPjfqJ5vz3cWNYtqGdD/wVF9cuFbsR2HddBdyHRG7hcvOgc6wYEiOB39S41F97QAMzifRbA8ufyoCcF46/IrCObtwDZZQjHey4UQth+cfUpsruK4Oecz30VrLRcoduxR0mZq7cPTaF7JLC6nd7goAexf50j+BmU3iYDiLJw1RBY4kOs4raTssQWC0hm8VcbWPDOG3gsvF8fCu3NJ9wkQQk465YwY/mdCG1Rcz0bvkHRLQP6H+zWXuvZ7ZFDJ2NNy/iZjDKKRLkieaFCHIMoZNWEM/Qe4jSHLQSacecP4lkmFx+PH9jg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=t4bq+s616XCIuyX+m75lvsblRdAm5FrcWA5g/N7yiYs=; b=l0SVhTJP4kpwj7VkY9i4q7nbtCLOEPiwpHRztoPAr1P9ChMB/8U2TKrg2xArjuOa1Rr2eqG0aMQZv43HcK20RcBbOLhpzDPUQnoNG/iXdGhjo3vSLx2/fHNw5lQA3YN5wOGBtSWnKaE5qmIaKFLwBw/aq7EesE5mSllBXzumJGc= Received: from DU2PR04CA0260.eurprd04.prod.outlook.com (2603:10a6:10:28e::25) by GV2PR08MB8485.eurprd08.prod.outlook.com (2603:10a6:150:c3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:51 +0000 Received: from DU2PEPF00028D00.eurprd03.prod.outlook.com (2603:10a6:10:28e:cafe::3c) by DU2PR04CA0260.outlook.office365.com (2603:10a6:10:28e::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:50 +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=arm.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 DU2PEPF00028D00.mail.protection.outlook.com (10.167.242.184) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:50 +0000 Received: ("Tessian outbound bc832f6acacf:v585"); Mon, 10 Mar 2025 17:53:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: eaf3efd07504afb3 X-TessianGatewayMetadata: c4BBEP0pSn6MVQ2weeuV1bnNyXJgWsjryRla4QFtqtCAwXmAq1tIcUCtXQJxln1zMQJU77NcxuJx8M9Age3vGaA5KvZIuSdehLnfQiUAPC0oU1Jj/wruwbDvBBxVKq9PjpDfFKWrrcQSeY94OyYVpcGqnyXxLp2ZwI7S+sWowsg= X-CR-MTA-TID: 64aa7808 Received: from L7d375c424e48.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A17909BD-A771-4EBF-AAC3-6E8C51710370.1; Mon, 10 Mar 2025 17:53:43 +0000 Received: from DU2PR03CU002.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L7d375c424e48.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LdrjkH+7j+rp41J0eFFXKak5+YQvuQJjlZjenY5duaq5++V0upQ/5SmOoWOEtMwIZSOdDE0mJTlNuyY8hQpx3ZZGZ6143KeQEcT1ePOMcP/5yrtKzXquzRP485kTOgCIRCfItBSalfmlMiSK2jFXoyx2MWCnTmugXTXJRZM2UpzyazhlhxBUfonLvVYL8Yp+SGv2+0Ws7/qeHVk3KG67DlwNXzU7BDpUE/6sWBpjyTUTiAjIzUyhV0Llggp3AAT2XX61zFX5dq72A2T+ofx77hnq6iut8hdsw4rva5Ojjr7aUE4g/9o41dPfa5gPtNGyemUpP0C5QF9G9ZRG/cLUhA== 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=t4bq+s616XCIuyX+m75lvsblRdAm5FrcWA5g/N7yiYs=; b=i0EmZ96q37KjM0SMVZAEstVJAjRbQr0rvqV9hL3Bye0SNt3zNM7SwhACSQyc9PcxKnVS5rkiOXF3DorTERnVeH5o8/fRTxyrz4/MmWXMsnvMMSy3qNvanIf1TOqJc9UiExAHZ2fwbacJVjdIHiWB48I4QykALpHMdhaiimOzyZE7vXl4Yxb6MXSPwBWX5k1OLulafpthW63iL47/qnlq35jYwjzg3iXCj89DzqxLACYAbOBmGVqU/fLNOr33LJt1vBEiu3TwP7wLXKtJimNOsvj54EQ08K5buOGCLkGocqgMdy9iJ3xRj2YVuYXKCwl5+Ie2DE/QpivYs/d6JiBdug== 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=t4bq+s616XCIuyX+m75lvsblRdAm5FrcWA5g/N7yiYs=; b=l0SVhTJP4kpwj7VkY9i4q7nbtCLOEPiwpHRztoPAr1P9ChMB/8U2TKrg2xArjuOa1Rr2eqG0aMQZv43HcK20RcBbOLhpzDPUQnoNG/iXdGhjo3vSLx2/fHNw5lQA3YN5wOGBtSWnKaE5qmIaKFLwBw/aq7EesE5mSllBXzumJGc= Received: from AS8P189CA0014.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:31f::34) by AS4PR08MB7759.eurprd08.prod.outlook.com (2603:10a6:20b:516::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:40 +0000 Received: from AM4PEPF00027A63.eurprd04.prod.outlook.com (2603:10a6:20b:31f:cafe::54) by AS8P189CA0014.outlook.office365.com (2603:10a6:20b:31f::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:40 +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 AM4PEPF00027A63.mail.protection.outlook.com (10.167.16.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:40 +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; Mon, 10 Mar 2025 17:53:40 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:53:39 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 11/15] bfd: merge duplicated subsections into one after parsing Date: Mon, 10 Mar 2025 17:51:24 +0000 Message-ID: <20250310175131.1217374-12-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A63:EE_|AS4PR08MB7759:EE_|DU2PEPF00028D00:EE_|GV2PR08MB8485:EE_ X-MS-Office365-Filtering-Correlation-Id: caba40a4-ce2a-453b-deff-08dd5ffc83c6 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|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info-Original: JdWpVssKLYr/RACJVNxPKHN/ClyeeXN//H8Pc+7b2oITmJA3pZ3hrKsEQ489VrNZvaj+VGKv8ou0eI4W8hVOYJOb8JenGYpKoauO/GIE0koBHofQ3pcLQHw+PRWrdPIcYyq4R/tKofxJ2on4aSGiUNMzThNkncY7QGEtmAP7bHIonoKVOfY7LZD+9whfm6cHiqMriZnFbBArXqzLCCiJKjOfXVn+IURR4uxAq0easf7NftksWmwICMIK5Crj9jYUuG9zHbpnk5r0vJjTxNtkjE+Esizr8EjV4qKaWQQgXVd/2fmrE6tS2/LQ1ujr49emDc6pnR43PZ9A8MhH2FfKG6oHJDA0tOtOCDcSgHkxl6dZQD5RPDK770nwAwns/XJIxDmEnRWcyPdWKAnVJd1sT16KnQuBcmGyCMIA+ZaVM/KXcD5k6jHETrL+8QrtBQPIELWKCwUVuvEoZRGfUlvAGE+iTVluO+L36QweTd2KHhk1Hhvmb9s63bJtBL9v97Kq1j1DHQuKzwF2YzgBkRfpjrf11CJoPYpqSyRy0XYRtmYoOV/pwnREDzkXsnku7Bb9NaeJMPb0quNI6P7FfK7yAUkjrfblLJvyy4KSgsbLxKmHNtl1BbjxUa/EiRAo+co6mC7poKlZcLChEHf+rpu2tIIEVHYUkYbZemJGqA7VH7MMyVe5PPUAMTLlna5YYVvgQjiTR9X3re3ckq1Z6DAIemrbCD2ig6rUE17nrCcKBrFA1jBzNbpgpQAw1CYr5q68RnlnEHxEZvmTAs6iwg4gRQlcyQ/d6AoAkphFa4o7GMVXhirOCX4TLJNgeSe4vKVvcqUgKtfIz8mVCGD712XoimwRIu5olYRW44dz7MkvEJT9EGvumk52IYSuxle9lakH3/la13AszkOMVCSK/ERrR7UBNfj5QWy4fEMsALiE9fPIRsn05Rw+spSL/Qv5pFHn82m24RAl+GhSSPNO+GWmP8sxwWAGMGDKJouqMvL3kVX0BA0PZfFmEy6hQ8+2atpxV4LDLYvgXuzzCBageIOJmoiyFC+90GWDfSs1ZVLS8wVi673kQY2pOSOp9sa11dbl5zYaMKU9IqkPkKtwaJyJJRn5UA9jQQxyPb+5fMahBM8Vmv143TacSgx0KHWqk/LjOmRmzc4v+kRyO8BAIk7Qb8k8YwdIiuC3TJV3q/f5JyuNLkXMzaaJyuXs7IKbxBXZbaXswx+QxOHPOhhQENZjPtM/5TKrIS7j8/WTEhL6oUiIApI8SCEslpilUDrsKCCrSUTqtKKPMaZ9ORrA6Fmnsky0arlWg7KC8ZdRBFmJKEayqcKuj/3u47413by4XLW+syLTbMeD8XqErh7XevENGQUk2sKKWbhAW2GfUHjboIVZYn7k1HG2tntIIxaDNdJ17Jke7GM68g6SyJg59ARniVmHTSTpdBJPgy0+uJB580Tb13qrW3hUKsDXvz0/Nlfg2zRKUqrez2i94g2K4ipxP2JDvd2O3iIM2YKCz09MeqM= 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)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7759 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:31f::34]; domain=AS8P189CA0014.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D00.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 24aa9201-8dfe-48d1-f1cb-08dd5ffc7e11 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|35042699022|82310400026|376014|14060799003; X-Microsoft-Antispam-Message-Info: rb/q3agawlJ0UMPJYkQuLGzwHwoLA6ESpQI66piHjeDDRQ3pM24oDQf5/QvqF58mPqsseusnSqin5lKXMmwT9Z2bfWspV5V1wpqXqGZP2GBEdN9BOi9lfu3o6mzT+XCKndMnGREFKdWtPeOKsYDUL9/o0yHLG/3lolA2Godxl0ZrKhMul39GvLHwjtiWa9qY7W6brqXh4xeDEfZRg56z9DpKKuWbQu46eF5RcGJ+eAgEdP0QEypWUK/JCdyjFLH6HK06Y54PZ8SjOJyqESva4l33soVC6TTBwFrU5Po8Yux5rh0BiUacbhHlI5ohb766ctdIiMvmTYhpSbK6iCObMK+8UAFMGEOHSkju/8r1leisw+eZawjEc5imKy0RuYAMnq/ilB3/lEDsiixL9OjaKGIk1q7x29YxB4b0PnO5SHGvNlIoMjuZtYx+niaXUSii30UNvN6FX2StHu0jjBXR7k6MKyBJjTPGdKOpi1qhl4DM0YvwgQ3XJ4BroBcJzRxecXNkMoSHbbYJcrfN6v+83pFP0SmBBEYLoxJxMKqfCEemRO6ISAAxXrWKAG9xxqUEQwmgHn8KeSWk4Bk6SIM7rl+DSO7ymiGIv129AwdzgJQYXmDLreC61aRu/yeZqXD3Qt/GZVWDkmxihsfMuZ8ePQ9zkslAR0dEiGq7p5qYLEEc7rBLAM5MZKXNqe2cwJnMdfYG64YiVWVrKuSb47nYd5kJAXE04uhQaIpy4OHiih2IUnsLJUqfqO6VFxgJhsxdyrNUGuWAXfrZdgpuGEG2Htvt0M228Zk2byHFio3lk6HKvuCtYkH258iClgS+ovxgG4gRMdvsDW9spe6jwKgwmB4sttopHfuDdpvetzyI7Yik0N4lmbFEP2KjtgJ2C+dThO7mEv5HWAIGqBtF4CWs3alR56bG0ekJqSNqJKLMCC/EoBXfJ5lMi7dOZVIFLTJTvf4wfvsVDEiiSD5uPOPcf7QmNOTGBxu8uQQMQ0D9e+SzrOHsJnPkXRsLA2mi6PPj1hV1d1vbvVAhB7o0No3oHHmHfCaW6e7Hfr/iOF6oLVkR4mHpYiVLmBxH7fPRZCUQT0Ci3sJDaNStV7CWhB6RDpnJIQxUPtaD9Ru5Z2J/gOJAJVORIMhPY7LSixrJjfFw0oXIRVPG8+Dw5cdZ3KTgjXRAAOkpqbNJNU7pTOPraWvBRSdee7Ltupl+XZ7eCIzFXkS9qKuAhr4xpBJHpjY8PQ2nIJgj47JuvFwri9d33+e/iOMac1B089V1PDfLD5xLZ1RJHz5kzmt7Ol7KgM5omtaDPec1OTvwlNVV9Sd/wsySWWhPg70/5bR7qU/r4ut4tdmVq1LKOYeQipeQoLw+XROL5rd79myJFKi6xeyEVgo4BRHBZKmI6+5Sg2k2RaJpHZvDkhipj5JgCq1AKHc9/4xdufVKWU6npuhdccaig0Y/ZIdRWyZ5fcRIdxNdgthNf7uXBUGb+jM9e8CzrV+57K5JPn1q3vx6FbZgJhXF7dw= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(35042699022)(82310400026)(376014)(14060799003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:53:50.3568 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caba40a4-ce2a-453b-deff-08dd5ffc83c6 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: DU2PEPF00028D00.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8485 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 Several subsections with the same name can be present inside an object file depending on how it was generated. Gas won't generate such an object as it is able to detect scattered declaration of a subsection, and merge its content before the serialization. However, others assemblers than Gas might keep the subsections separated, and opted for delegating the merge to the linker. Additionally, a subsection can be populated before the parsing the attributes section if some GNU properties are convertible to build attributes. In order to make the merge logic between object files simpler, the deserializer is able to handle to perform an union of the duplicated subsections inside an object. Since the same deserializaton code is used by objcopy, it means that objcopy won't simply copy the data to the output object, but will also merge duplicated subsections together, so the readelf output between the two objects will be different. This might be seen as a bug but, given that gas will never generate such an object, I would argue that it is an acceptable design choice. --- bfd/elf-attrs.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index 12a81181c11..49c301326f2 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -982,6 +982,78 @@ bfd_elf_parse_attrs_subsection_v2 (bfd *abfd, return op; } +/* Merge two subsections together (object attributes v2 only). + The result is stored into subsec1. subsec2 is destroyed. + Return true if the merge was successful, false otherwise. */ +static bool +obj_attr_subsection_v2_destructive_merge (bfd *abfd, + obj_attr_subsection_v2 *subsec1, + obj_attr_subsection_v2 *subsec2) +{ + BFD_ASSERT (subsec1->encoding == subsec2->encoding + && subsec1->optional == subsec2->optional); + + /* Sort the subsections before merging them together. */ + LINKED_LIST_MERGE_SORT(obj_attr_v2) (subsec1, _bfd_elf_obj_attr_v2_cmp); + subsec2->first_ = _LINKED_LIST_MERGE_SORT(obj_attr_v2) + (subsec2->first_, _bfd_elf_obj_attr_v2_cmp); + + bool success = true; + + obj_attr_v2 *a1 = subsec1->first_; + obj_attr_v2 *a2 = subsec2->first_; + while (a1 != NULL && a2 != NULL) + { + if (a1->tag < a2->tag) + {} /* Nothing to do, a1 is already in subsec1. */ + else if (a1->tag > a2->tag) + { + /* a2 is missing in subsec1, add it. */ + obj_attr_v2 *previous = LINKED_LIST_REMOVE(obj_attr_v2) (subsec2, a2); + LINKED_LIST_INSERT_BEFORE(obj_attr_v2) (subsec1, a2, a1); + a2 = previous; + } + else + { + if (subsec1->encoding == ULEB128 + && a1->vals.uint_val != a2->vals.uint_val) + { + success = false; + _bfd_error_handler (_("%pB: error: found 2 subsections with the " + "same name '%s' and found conflicting values (0x%x vs 0x%x) for" + " object attribute 'Tag_unknown_%u'"), abfd, subsec1->name, + a1->vals.uint_val, a2->vals.uint_val, a1->tag); + } + else if (subsec1->encoding == NTBS + && strcmp (a1->vals.string_val, a2->vals.string_val) != 0) + { + success = false; + _bfd_error_handler (_("%pB: error: found 2 subsections with the " + "same name '%s' and found conflicting values ('%s' vs '%s') for" + " object attribute 'Tag_unknown_%u'"), abfd, subsec1->name, + a1->vals.string_val, a2->vals.string_val, a1->tag); + } + } + a1 = a1->next; + a2 = a2->next; + } + + for (; a2 != NULL; a2 = a2->next) + { + /* a2 is missing in subsec1, add it. */ + obj_attr_v2 *previous = LINKED_LIST_REMOVE(obj_attr_v2) (subsec2, a2); + LINKED_LIST_INSERT_BEFORE(obj_attr_v2) (subsec1, a2, a1); + a2 = previous; + } + + /* If a1 != NULL, we don't care since it is already in subsec1. */ + + /* Destroy subsec2 before exiting. */ + _bfd_elf_obj_attr_subsection_v2_free (subsec2); + + return success; +} + /* Parse the list of subsections (object attributes v2 only). */ static void bfd_elf_parse_attr_section_v2 (bfd *abfd, @@ -1003,10 +1075,26 @@ bfd_elf_parse_attr_section_v2 (bfd *abfd, bfd_set_error (bfd_error_wrong_format); break; } + + /* Before appending the parsed subsection, check if this subsection was + already recorded (this can happen when a GNU property was parsed, and + converted to its equivalent object attributes). If so, try to merge it + with the existing one. */ + obj_attr_subsection_v2 *parsed_subsec = + (obj_attr_subsection_v2 *) op.object; + obj_attr_subsection_v2 *subsec = obj_attr_subsection_v2_find_by_name + (elf_obj_attr_subsections (abfd).first_, parsed_subsec->name, false); + if (subsec == NULL) + LINKED_LIST_APPEND(obj_attr_subsection_v2) (subsecs, parsed_subsec); else - LINKED_LIST_APPEND(obj_attr_subsection_v2) (subsecs, - (obj_attr_subsection_v2 *) op.object); + obj_attr_subsection_v2_destructive_merge (abfd, subsec, parsed_subsec); } + + /* Sort all the subsections and object attributes as they might not have been + inserted in the right order. From now on, the subsections and attributes + will be assumed to be always sorted. Any additive mutation will need to + preserve the order. */ + obj_attr_subsection_v2_sort (subsecs); } /* Parse an object attributes section. From patchwork Mon Mar 10 17:51:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107593 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 6BB613858CD1 for ; Mon, 10 Mar 2025 17:56:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BB613858CD1 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=UAU6kA8w; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=UAU6kA8w X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20621.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::621]) by sourceware.org (Postfix) with ESMTPS id 16705385840A for ; Mon, 10 Mar 2025 17:54:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16705385840A 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 16705385840A Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2613::621 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629246; cv=pass; b=Ul+6jYLa26nHVUmpRwog+ccDBU3ukhOxXjda/iVmAihhbF+p5LUOoXWpztZdhP2+XdLhDbsrPciJzfxJTULBRiQ5riZJW+MPWWm29E8iugvk1Kmp7cgDZ+2oxk3wPmM1xsfr1MeQ1h3m3oovnIX9ZwfWQVm7A3Kj1t1nIQkHHdU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629246; c=relaxed/simple; bh=DqjPQGBX8ZriIfMtIrF8p79G4LYvZZHX028m7fXmdzw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=kabQo1XqTwyGOGX9TaIupsF/rjb6ZY79+b9iYYLHdQcVDZVAcNKzk2RO0JfE5wJnQ3FjYYv3BoV4Ez6l50k4DxOM/5NiptLmm8q60+AoflXWHiyadOqQl2IXSfKjF8ji+j8TAEmvrxAjiOFgdVJq7/P5HE18Zvh/Xx671AOSTY8= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16705385840A ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=DKwC5wjUvGWI4v/CI/nylQSL04oTEbpBZpOvZ59gif8NA9V3aaxbXJpAQWcabOj6DKyYgsZD5pO65UwYVkYQeP4FTywSCq2V/EJVZgsESi7KIflgSG5uFrv/OzMVVTgN+YN7oZBiSq9HUvh0Ny6R2xZGxgQoUwLYyTe0zdu1mJxjrFWjcfimvEd9v8Dj9zqJGmGVrNDD5wKuYk3rmxt5aEITjxFWH7YqLecpIVxaaAQe1X2tr1UHZJj6eOAcqIgs+LlFTgkrQ0hQCi0U9jUjRL1lo4XF45Auxy8sexOGDla2zUgdPuv/TbwB5t2zXmjLIaY4WJ+W1iTxmICiEwopwg== 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=jMG28s/NqpI3JRiDzF3i0V7JnoZ2n2q+H2sdUXsZ75A=; b=kHUI28siVkD6kDnGp8mjsJt0sWC6WMvk/gFc8E60LMRqMKamHCEVFSmpDigFJscatrVIFm4lx3aMcgPUr+U1x4/W6jZq/WeUMDkWGP2YTC/+DNQv17E+sgNyy+hS/jV2JjjQpdFVtJ3vvw//m1x3HZ9/l0WXo31lSAgbtxrpC3nqXBF/ZBImR9SDDhgm7p0nwgwR8ArP1ymFI53e0ADpM0iTFpA/m9YLLpM97unxomhpl1q0YdMXE/toYovYNvFbYi2AQPILJNQHL5xiu7BXwvEFHfnYlH55XcJE8P7dNfEagXudS5Ulv6thKEKVCETkh/SAL3gsdXfp4IRWyoOaRg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=jMG28s/NqpI3JRiDzF3i0V7JnoZ2n2q+H2sdUXsZ75A=; b=UAU6kA8wWSggufjP20Aqjs9eDfa5It0gt8VhWrXET1PJp11Enjkcks+SE2nnUflqIs7bp9zRyLaVkyn/937j/IrwjIrBdbVgGZJX3jpK5Obxud9hKwvxKVGasHWnxk9uW6P55pqQ/c7+0+f+sZrc9UOFIwzTl0sU429HnFiDEug= Received: from DU7P190CA0030.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:550::7) by AM0PR08MB5331.eurprd08.prod.outlook.com (2603:10a6:208:187::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:54:03 +0000 Received: from DU2PEPF00028D11.eurprd03.prod.outlook.com (2603:10a6:10:550:cafe::8f) by DU7P190CA0030.outlook.office365.com (2603:10a6:10:550::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:54:03 +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=arm.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 DU2PEPF00028D11.mail.protection.outlook.com (10.167.242.25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:54:03 +0000 Received: ("Tessian outbound a60532193129:v585"); Mon, 10 Mar 2025 17:54:03 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2db11c57ac0440fe X-TessianGatewayMetadata: P9kirCCEpz643KXxo5QhO39obSnwKJPYP6isLuDu51LMlNUmQ/PgUCGnxNMDdeNsA+Ma0T1sBTJvXkB9U6DwidQ3Q0iFj6bB0FFAZv9q6/SwTp5r5C6zdQSDHU2mwSk+8LjBDkcSAc+Gg+0dew7wKiodgC016bTDp3J3oTvpRcw= X-CR-MTA-TID: 64aa7808 Received: from L7b40069c9237.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2725BA33-5B28-4631-8F2C-DE92BF6D4A6E.1; Mon, 10 Mar 2025 17:53:57 +0000 Received: from EUR03-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L7b40069c9237.2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:53:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z//GVBaMgPsHj+XRo9tSOQ2PQFHqIwQWeoUXM0BQqTb6oIGiXkNQUo7s9N2PzCb+b+2GalTilov+KLRz9D3pAQ+KmyMc9Qj0Ab3ZkKy5REqsEaMpnyZfxCKOHHBrFuFLscaz/hbTw0c4+7AzNmwUaDvPcXTxp0eD4S3bzXBzxJzbzLplnMJ67v9FOr2LKQm5plx7KoQo6ooUre6btHvQY+IbbiBK/ikz9WGMHadVyB3wkTTzwblT7SmsWO+HX5A9OE0VL1yCgpkQhvR1OLsFZe6hMe9SQJGoJA/IP7aANGECD/NfG4FZmn3IErV+qYYHTmzonoDBN6nltyE2Eu7Spg== 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=jMG28s/NqpI3JRiDzF3i0V7JnoZ2n2q+H2sdUXsZ75A=; b=tJdvBgWhqRk7UobPdNlNyrm/x3PiQoEk9bGo8sujWvt4113VkX3rAPbRfCpDQ/Gua2kFd0NluKd7D31vPdTibH1d28jXqc2S3KnEqkMW7Xn4bopXHb2Z1DHFg+/Z6OdJxvJGUFKyIlQ4ro9P4TYu3SFHQsbBWqngRj15HDpuxtRe50kmeE8EwOjnxtU7N+kSXEjElOyi2sPFJYkIfuSB4jfDK1V5vbCrcYCr8k2x50O/y52O7XB9bnZPaYE96eV2fWQ/us9mPbOuJGbnAe9HBGPzAsZEs/FNB0G+d89tUJzCGxHHSKK0rQx2m+3oMLa2t2YveVlqEGkTGztNYpSoRg== 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=jMG28s/NqpI3JRiDzF3i0V7JnoZ2n2q+H2sdUXsZ75A=; b=UAU6kA8wWSggufjP20Aqjs9eDfa5It0gt8VhWrXET1PJp11Enjkcks+SE2nnUflqIs7bp9zRyLaVkyn/937j/IrwjIrBdbVgGZJX3jpK5Obxud9hKwvxKVGasHWnxk9uW6P55pqQ/c7+0+f+sZrc9UOFIwzTl0sU429HnFiDEug= Received: from CWLP265CA0454.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:1b7::8) by DB9PR08MB7771.eurprd08.prod.outlook.com (2603:10a6:10:397::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:53:52 +0000 Received: from AM4PEPF00027A5F.eurprd04.prod.outlook.com (2603:10a6:400:1b7:cafe::b1) by CWLP265CA0454.outlook.office365.com (2603:10a6:400:1b7::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:53:52 +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 AM4PEPF00027A5F.mail.protection.outlook.com (10.167.16.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:53:51 +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; Mon, 10 Mar 2025 17:53:50 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:53:50 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 12/15] ld's BAs merge saga, step one: generic merge works on its own without backend support Date: Mon, 10 Mar 2025 17:51:25 +0000 Message-ID: <20250310175131.1217374-13-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5F:EE_|DB9PR08MB7771:EE_|DU2PEPF00028D11:EE_|AM0PR08MB5331:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f2e0f2e-f449-43a8-7dc5-08dd5ffc8b8a x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info-Original: sX6aYPQQ7ewyoVgCg+hTftiR8QsFGQpMWV6OL/0MopvZ86kOfnIqhZs8XDZ1FoXMS6SFMolFxT1sOBpH+EUA0ilsGvwbDOopvnjpg8AwtkKtRshapKL+bd0/YiEq+ROUaA0EwxsbCK/ReTIlNeEsCqS1y2NhZRKTOXWM4sglFJjW/gjpwCOdCCJXCgJhuXCTwVpKb2yP50RvGXOawKj/THfdyHBWKf5xhj+pFrUDM94X3xTwn2h81hOJzgnRLsgyrQ1m4Fw0+OOkctMNQ0iZwBlw2gTmwEL5uhl1KdXHYKmRcb4pxhN1wvzexPUtPnupnjrGr8lzWjHKOAiXRysTMhCcl40jU8SVntxkP0CFu9b92ch5xeCcpy8bpeTQMycu7/SWoyUqrKyfSe7c0f+XmYc0ewLLlCm7RvyFu9KsWPLOHVE7EUHTq45M+4BQWnD0mPH7FemIaGOc9IMAvn8lSUgPOGUz4Bo2S7x6OUdnyoZUmmGGHpNOw+uFrSf/rz4MBIK5bVibF3I0y9Msm6y0LojpIR19g2IPz0Ys8x2taTcnXHcHLgLUR541b0qto0fHNpgwIsyrPCjwhVB00Bf629R+FazZgqFYWKIaIMIKuAevaTC4EZEG/wvNg3IkkR1wExE2vlwlQCEJQ9jf2O1vjCjnEwK8Z80SnYvld6+aSBq9AUVroAOXoa7e6EB/kZ1Jk+qqVRCZog0PCLcQpWG/DsStZos25QLbn/PefFSGd4zSPWyqsO9+/iTBoLX9GrEybUYdF9RxqRTTz06IABMLvC9/RQG0MqBAN2jeVrAgIhDWjpw5q/Mjigi5lT3PRbx3a/yquImZF5ewPpkpI1pW2Ib6nquuHHsk4dO904VUZUu489BFLUJSuIkY6eKrCNm/YoZN5pBWAq8MJdm5RfNERm//RRkYMLQRt7RY9X4itmR3pospQmt05h5tQ5Ud8qRu0JtakDC8sn5zJr7nEZzCaU4EPhyuDKUDHn+59TfzqBV7YJm+kaZRf6pghZoh0GUmSdlKLPmsac8zRqWl3Psyh3yOMQN7HT3gt9sj3qupaWNFx9AAWkeRNA9hjzSlou6PIipeAsZUnXA5+3gKwDI00FMX4BKsfCmmxqD4lsovEKO02c0a6X1XIQ1HXqpbSHHPNyeNEGQP/jDye1YvGoXOqhiFUfTsniPfIZGB13g7o+WGphCGXD4e40CKYjFL7Nwba/vm22ecY0in8MCz7XQ2S/RtRJ23WmdXXUyoqhCGw5FEWRM02v1CYOeGcDEbOta0+tBtLwbj9t5XmieRrq9eIxPSp0jy7SidsPHNS1GzON7iwfx3WZ0at48kIGCWH0TalHsKQIT184le8F58+nAWxToSj91LHa1ZSzUY/nT/pkXnF0SqgaeYZUHGKG1j89LCeNO/YsbSpDEnL/wNi9DHpVg+BKgAn92JoRarRLF3LymhNPPbXp2nDGUdXO3jM+R08CJ6UF2CH1m4GF5KlNiXU2G1wEBjN7xcGR/ihierdrY= 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7771 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:400:1b7::8]; domain=CWLP265CA0454.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D11.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a91f8939-9ce0-4ea2-8757-08dd5ffc84bd X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|35042699022|1800799024|376014|82310400026|14060799003; X-Microsoft-Antispam-Message-Info: V7Pu2258E++DzLF705AKkCUR1/5zQKfIoIOdS6oA/3+zofaeff4uOtuk7QW421zuOJhSgMwPot7XudhJuNZvH9pUgCXmpG7JLwn8CLzU6Sk5MH6Mh2Nwi9ODgGT5zJhefVZihLO8++UOYnNtCoH1Ti/MSKnmYyQkKH3TOoWFUFTupEUC7p30wcPRj9GV/cGegPFBobi6+PL6XPPDyEHMJOu40hspFIxLBJdOA1O3/MjBhWTgNmm985fPXQ0eHnFfBrhIu9pmBqj55j6AEBAUayQj6ZT5zo8Ij9l8luc0fQhBBOx/KQj3yJhaI5eHKi1MNPl3wSziZzE/9rgPO8MCpoV7P86Tb4cPgeIwkPjglwZA8JLt0Voe0wdZRiQGCN/oLtJnWy4i4+hmE4Wo3hRuiLmgdYRPTqLZUrx4Zi3rWMfy5HD95b/CRPIJ/ynjAp904MQgVoZXqdfHXgd+l4vkqH7X2BBMnbd7+4tVdJe6ff2SQiW1f4AF/RAP6+dDudyuUcn2OR4FcxXomiO1O2YFriZsT+MGjDZjgdNvg+SpOQpPI095GxN/6aXxYnwVCNJWYpFSFqwgNh5fGcYeY6qieRPwf3zsEe+IZI4oqY0zOU8W3ewfbUuL8XSaqtRIsgu+iH/ggGYadT9Hs9iJyeOxDLhwU+jChc5/TCe0iSxbkH3yeaqPmj5Y3T9/kvPGpI+4uC57ozQBDME/fgilKXeSe9K6q48LjuRBy2odvyVcynx4dWVp7UXNjuZgVQGkLZhp6WjZylsXrdTg4gfwLV54vUz6s9H52FCaztjupQ28oeJ2e9dKR29y2iJ/74RZyr15zOL4i0Bg14eikmgqbMlEd3oqUISqIRHIIYSl/Zvsfmo0YbmEK1OXAaDwh3Eux0bAwAM6+PE3dsSPVJWm0iLwogaLB1Hs0FsFPHGv+rgpsxi11aFulrP+mXPqKqMfvhms0BnHkBGfsec3l53K/rf2j1JoGBxuIPIp2K4OSOLMilpjbNl2hmOBlOXQ914KfsidDHtCDYuInRYN/WsdmBi3Ks56TRb21xBqnuL6ku30XoJiR3NtwkETjNH3DgSgHgAD+8QTteDyQk2QapM/MBC3pFwkKvnxmhFp9cItof5p1SjqWREBNEoUPQypknXFgpiyzBzKi90+YYF0dtbQUigKZ2BnGEvszrnW2QY3aNt1HUVvYbEGMA+JSsZ++7Qoka/YZhjcYfqe8KM/R/xwR7HNoxYlYzfSGLZt6VDaxwAlC7JQC6+TGwYLeQHewnKTYOg4v4/u8TRnUtmn+Bw7OGN9CWIEBV3TFGvraeSiVCv1HSkS1TyQUHKctc6/5Br5oCb4CMGh6UTI0kjasjcIEgqlc0HrQ3wp/MNLWFCh0PO5jGKXRZIEFhGQep7FrnVuAKOGqPB2TXvgHdH79pih0ZqTnGlQnXG48jmwD3Rg3y3LrI/J4h8D5G8XwjHuollgv/0RHVye44QO+JLMeA9B/0TJwiKT13O7HJwIVEaQ+/I2nnU= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(36860700013)(35042699022)(1800799024)(376014)(82310400026)(14060799003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:54:03.3984 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f2e0f2e-f449-43a8-7dc5-08dd5ffc8b8a 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: DU2PEPF00028D11.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5331 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 - setup_build_attributes called before setup_gnu_properties. - take into account relevant GNU properties in inputs (if implemented by the backend) when parsing the GNU property notes, and pre-populate the object attributes. - translate BAs to GNU properties (if implemented by the backend) as further compatibility checks against shared objects can be performed by the linker. Additionally, the runtime linker does not understand BAs yet, so a translation of some BAs is required. --- bfd/elf-attrs.c | 1249 ++++++++++++++++++++++++++++++++++++++++++++ bfd/elf-attrs.h | 76 +++ bfd/elf-bfd.h | 33 ++ bfd/elf.c | 22 +- bfd/elfxx-target.h | 32 ++ ld/ldelf.c | 1 + 6 files changed, 1408 insertions(+), 5 deletions(-) diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index 49c301326f2..02bfd7ab594 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -382,6 +382,1227 @@ bfd_elf_set_obj_attr_contents (bfd *abfd, bfd_byte *buffer, bfd_vma size) write_obj_attr_section_v1 (abfd, buffer, size); } +typedef struct +{ + bfd *pbfd; + bool has_build_attributes; + asection* sec; +} bfd_search_result_t; + +static bfd_search_result_t +bfd_linear_search_one_with_build_attributes (struct bfd_link_info *info) +{ + bool + bfd_has_build_attributes (bfd *abfd, bfd_search_result_t *res) + { + if (elf_obj_attr_subsections (abfd).size == 0) + return false; + res->has_build_attributes = true; + + const char *sec_name = get_elf_backend_data (abfd)->obj_attrs_section; + if ((res->sec = bfd_get_section_by_name (abfd, sec_name)) == NULL) + return false; + return true; + } + + const struct elf_backend_data *output_bfd + = get_elf_backend_data (info->output_bfd); + unsigned int elfclass = output_bfd->s->elfclass; + int elf_machine_code = output_bfd->elf_machine_code; + + bool + bfd_is_non_dynamic_elf_object (bfd *abfd) + { + return (bfd_get_flavour (abfd) == bfd_target_elf_flavour) + && (abfd->section_count != 0) + && ((abfd->flags & DYNAMIC) == 0) + && (elf_machine_code == get_elf_backend_data (abfd)->elf_machine_code) + && (elfclass == get_elf_backend_data (abfd)->s->elfclass); + } + + bfd_search_result_t res = { + .pbfd = NULL, + .has_build_attributes = false, + .sec = NULL, + }; + + for (bfd *abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) + if (bfd_is_non_dynamic_elf_object (abfd)) + { + res.pbfd = abfd; + if (bfd_has_build_attributes (abfd, &res)) + break; + } + return res; +} + +/* Create a build attributes section for the given bfd input. */ +static asection * +create_build_attributes_section (struct bfd_link_info *info, + bfd *ebfd) +{ + asection *sec; + const char* sec_name = get_elf_backend_data (ebfd)->obj_attrs_section; + sec = bfd_make_section_with_flags (ebfd, + sec_name, + (SEC_READONLY + | SEC_HAS_CONTENTS + | SEC_DATA)); + if (sec == NULL) + info->callbacks->einfo ( + _("%F%P: failed to create %s section\n"), sec_name); + + unsigned align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3; + if (!bfd_set_section_alignment (sec, align)) + info->callbacks->einfo (_("%F%pA: failed to align section\n"), sec); + + elf_section_type (sec) = get_elf_backend_data (ebfd)->obj_attrs_section_type; + + bfd_set_section_size (sec, bfd_elf_obj_attr_size (ebfd)); + + return sec; +} + +/* The first two tags in gnu-testing namespace are known, and so have a name and + can be initialized to the default value ('0' or NULL) depending on the + encoding specified on the subsection. Any tags above 1 will be considered + unknown, so will be default initialized in the same way but its status will + be set to obj_attr_subsection_v2_unknown. */ +static const known_tag_v2 known_tags_gnu_testing [] = +{ + {0, "GNUTestTag_0", .default_value = {0}}, + {1, "GNUTestTag_1", .default_value = {0}}, +}; + +static known_subsection_v2 obj_attr_v2_known_gnu_subsections[] = +{ + { + /* Note: the currently set values for the subsection name, its optionality, + and encoding are irrelevant for a testing subsection. These values are + unused. This entry is only a placeholder for list of known GNU testing + tags. */ + .subsec_name = NULL, + .known_tags = known_tags_gnu_testing, + .optional = true, + .encoding = ULEB128, + .len = sizeof (known_tags_gnu_testing) / sizeof (known_tag_v2), + }, + /* Note for the future: GNU subsections can be added here below. */ +}; + +static bool +gnu_testing_namespace (const char *subsec_name) +{ + return strncmp ("gnu-testing-", subsec_name, 12) == 0; +} + +const known_subsection_v2 * +identify_subsection (const struct elf_backend_data *be, + const char* name) +{ + /* Check known backend subsections. */ + const known_subsection_v2 *known_subsections = be->obj_attr_v2_known_subsections; + const size_t known_subsections_size = be->obj_attr_v2_known_subsections_size; + + for (unsigned i = 0; i < known_subsections_size; ++i) + { + int cmp = strcmp (known_subsections[i].subsec_name, name); + if (cmp == 0) + return &known_subsections[i]; + else if (cmp > 0) + break; + } + + /* Check known GNU subsections. */ + /* Note for the future: search known GNU subsections here. Don't forget to + skip the first entry (placeholder for GNU testing subsection). */ + + /* Check whether this subsection is a GNU testing subsection. */ + if (gnu_testing_namespace (name)) + return &obj_attr_v2_known_gnu_subsections[0]; + + return NULL; +} + +static const known_tag_v2 * +identify_tag (const known_subsection_v2* subsec, uint32_t tag) +{ + for (unsigned i = 0; i < subsec->len; ++i) + { + const known_tag_v2 *known_tag = &subsec->known_tags[i]; + if (known_tag->tag == tag) + return known_tag; + else if (known_tag->tag > tag) + break; + } + return NULL; +} + +const known_tag_v2 * +known_obj_attr_v2_find_by_tag (const struct elf_backend_data *be, + const char* subsec_name, uint32_t tag) +{ + const known_subsection_v2 *subsec_info = + identify_subsection (be, subsec_name); + if (subsec_info != NULL) + { + const known_tag_v2 *tag_info = identify_tag (subsec_info, tag); + return tag_info; + } + return NULL; +} + +const char * +obj_attr_v2_tag_to_string (const struct elf_backend_data *be, + const char* subsec_name, + uint32_t tag) +{ + const known_tag_v2 *tag_info = + known_obj_attr_v2_find_by_tag (be, subsec_name, tag); + if (tag_info != NULL) + return tag_info->name; + return NULL; +} + +static void +obj_attr_v2_overwrite_with_default (struct bfd_link_info *info, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *attr) +{ + const struct elf_backend_data *be = get_elf_backend_data (info->output_bfd); + + const known_tag_v2 *tag_info = + known_obj_attr_v2_find_by_tag (be, subsec->name, attr->tag); + if (tag_info == NULL) + { + attr->status = obj_attr_v2_unknown; + if (subsec->encoding == ULEB128) + attr->vals.uint_val = 0; + else + attr->vals.string_val = NULL; + return; + } + + if (be->obj_attr_v2_default_value != NULL + && be->obj_attr_v2_default_value (info, tag_info, subsec, attr)) + {} + else if (subsec->encoding == NTBS) + { + if (tag_info->default_value.string_val != NULL) + { + if (attr->vals.string_val != NULL) + free ((void *) attr->vals.string_val); + attr->vals.string_val = strdup (tag_info->default_value.string_val); + } + else + attr->vals.string_val = NULL; + } + else + attr->vals.uint_val = tag_info->default_value.uint_val; +} + +static obj_attr_v2 * +obj_attr_v2_tag_default (struct bfd_link_info *info, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *attr) +{ + obj_attr_v2 *new_attr = _bfd_elf_obj_attr_v2_copy (attr, subsec->encoding); + obj_attr_v2_overwrite_with_default (info, subsec, new_attr); + return new_attr; +} + +/* The currently supported merge policy in the testing GNU namespace. + - bitwise AND: apply bitwise AND. + - bitwise OR: apply bitwise OR. + - String-ADD: concatenates strings together with a '+' in-between. + Note: Such policies should only be used for testing. */ +typedef enum { + SUBSECTION_TESTING_MERGE_UNSUPPORTED = 0, + SUBSECTION_TESTING_MERGE_AND_POLICY = 1, + SUBSECTION_TESTING_MERGE_OR_POLICY = 2, + SUBSECTION_TESTING_MERGE_ADD_POLICY = 3, +} gnu_testing_merge_policy; + +/* The GNU policy are detected from the name of the subsection. It should follow + the following pattern: "gnu-testing-XXXXXX-MERGE-". */ +static gnu_testing_merge_policy +gnu_testing_merge_subsection (const char *subsec_name) +{ + if (! gnu_testing_namespace (subsec_name)) + return SUBSECTION_TESTING_MERGE_UNSUPPORTED; + + size_t subsec_name_len = strlen (subsec_name); + if (strcmp ("-MERGE-AND", subsec_name + subsec_name_len - 10) == 0) + return SUBSECTION_TESTING_MERGE_AND_POLICY; + else if (strcmp ("-MERGE-OR", subsec_name + subsec_name_len - 9) == 0) + return SUBSECTION_TESTING_MERGE_OR_POLICY; + else if (strcmp ("-MERGE-ADD", subsec_name + subsec_name_len - 10) == 0) + return SUBSECTION_TESTING_MERGE_ADD_POLICY; + else + return SUBSECTION_TESTING_MERGE_UNSUPPORTED; +} + +/* Merge policy Integer-AND: apply bitwise AND between REF and RHS. */ +obj_attr_v2_merge_result +obj_attr_v2_tag_merge_AND (struct bfd_link_info *info, + bfd *abfd, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *ref, obj_attr_v2 *rhs, + obj_attr_v2 *frozen) +{ + (void) info; + (void) abfd; + (void) frozen; + + BFD_ASSERT (subsec->encoding == ULEB128); + + obj_attr_v2_merge_result res = { + .merge = true, + .vals.uint_val = 0, + .reason = NONE, + }; + + uint32_t original_value = ref->vals.uint_val; + res.vals.uint_val = (ref->vals.uint_val & rhs->vals.uint_val); + res.merge = (res.vals.uint_val != original_value); + if (res.vals.uint_val == original_value) + res.reason = SAME_VALUE_AS_REF; + + return res; +} + +/* Merge policy Integer-OR: apply bitwise OR between REF and RHS. */ +static obj_attr_v2_merge_result +obj_attr_v2_tag_merge_OR (struct bfd_link_info *info, + bfd *abfd, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *ref, obj_attr_v2 *rhs, + obj_attr_v2 *frozen) +{ + (void) info; + (void) abfd; + (void) frozen; + + BFD_ASSERT (subsec->encoding == ULEB128); + + obj_attr_v2_merge_result res = { + .merge = true, + .vals.uint_val = 0, + .reason = NONE, + }; + + uint32_t original_value = ref->vals.uint_val; + res.vals.uint_val = (ref->vals.uint_val | rhs->vals.uint_val); + res.merge = (res.vals.uint_val != original_value); + if (res.vals.uint_val == original_value) + res.reason = SAME_VALUE_AS_REF; + + return res; +} + +/* Merge policy String-ADD: concatenates strings together adding a '+' character + in-between. */ +static obj_attr_v2_merge_result +obj_attr_v2_tag_merge_ADD (struct bfd_link_info *info, + bfd *abfd, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *ref, obj_attr_v2 *rhs, + obj_attr_v2 *frozen) +{ + (void) info; + (void) abfd; + BFD_ASSERT (subsec->encoding == NTBS); + + size_t frozen_s_size = 0; + if (frozen && frozen->vals.string_val) + frozen_s_size = strlen (frozen->vals.string_val); + + obj_attr_v2_merge_result res = { + .merge = false, + .vals.uint_val = 0, + .reason = NONE, + }; + + if (ref->vals.string_val && rhs->vals.string_val) + { + res.merge = true; + size_t ref_s_size = strlen (ref->vals.string_val); + size_t rhs_s_size = strlen (rhs->vals.string_val); + char *buffer = malloc (ref_s_size + 1 + rhs_s_size + 1); + res.vals.string_val = buffer; + memcpy (buffer, ref->vals.string_val, ref_s_size); + buffer += ref_s_size; + *buffer = '+'; + ++buffer; + memcpy (buffer, rhs->vals.string_val, rhs_s_size + 1); + } + else if (ref->vals.string_val) + { + // Nothing to do, frozen (if not NULL) should already be merged with it. + res.reason = SAME_VALUE_AS_REF; + } + else if (rhs->vals.string_val) + { + res.merge = true; + if (frozen_s_size == 0) + { + res.vals.string_val = rhs->vals.string_val; + rhs->vals.string_val = NULL; + } + else + { + size_t rhs_s_size = strlen (rhs->vals.string_val); + char *buffer = malloc (frozen_s_size + 1 + rhs_s_size + 1); + res.vals.string_val = buffer; + memcpy (buffer, frozen->vals.string_val, frozen_s_size); + buffer += frozen_s_size; + *buffer = '+'; + ++buffer; + memcpy (buffer, rhs->vals.string_val, rhs_s_size + 1); + } + } + return res; +} + +/* True, the tag needs to be merged, False don't merge. */ +static +obj_attr_v2_merge_result +_bfd_elf_obj_attr_v2_tag_merge (struct bfd_link_info *info, + bfd *abfd, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *lhs, obj_attr_v2 *rhs, + obj_attr_v2 *frozen, bool frozen_as_abfd) +{ + obj_attr_v2_merge_result res = { + .merge = false, + .vals.uint_val = 0, + .reason = NONE, + }; + + gnu_testing_merge_policy policy; + + if (get_elf_backend_data (abfd)->obj_attr_v2_tag_merge != NULL) + { + if (frozen_as_abfd) + { + obj_attr_v2 *tmp = lhs; + lhs = rhs; + rhs = tmp; + } + res = get_elf_backend_data (abfd)->obj_attr_v2_tag_merge (info, abfd, + subsec, lhs, rhs, frozen); + } + + /* Note for the future: the merge of generic object attributes should be + added here, between the architecture-specific merge, and the reserved GNU + testing namespace. */ + + /* GNU testing merge policies are looked up last. If none is detected, the + subsection is considered unmergeable. */ + if (! res.merge && res.reason == UNSUPPORTED) + { + if ((policy = gnu_testing_merge_subsection (subsec->name)) + != SUBSECTION_TESTING_MERGE_UNSUPPORTED) + { + /* Only the first two attributes can be merged, others won't and will + be discarded. */ + if (lhs->tag <= 1) + { + if (policy == SUBSECTION_TESTING_MERGE_AND_POLICY) + res = obj_attr_v2_tag_merge_AND (info, abfd, subsec, lhs, rhs, + frozen); + else if (policy == SUBSECTION_TESTING_MERGE_OR_POLICY) + res = obj_attr_v2_tag_merge_OR (info, abfd, subsec, lhs, rhs, + frozen); + else if (policy == SUBSECTION_TESTING_MERGE_ADD_POLICY) + res = obj_attr_v2_tag_merge_ADD (info, abfd, subsec, lhs, rhs, + frozen); + } + } + } + + return res; +} + +static void +obj_attr_v2_default_append (struct bfd_link_info *info, + obj_attr_subsection_v2 *s_abfd_missing, + obj_attr_v2 *a_ref) +{ + obj_attr_v2 *new_attr = obj_attr_v2_tag_default (info, s_abfd_missing, a_ref); + LINKED_LIST_APPEND(obj_attr_v2) (s_abfd_missing, new_attr); +} + +static obj_attr_subsection_v2 * +obj_attr_subsection_v2_defaults (struct bfd_link_info *info, + obj_attr_subsection_v2 *subsec) +{ + obj_attr_subsection_v2 *new_subsec = + _bfd_elf_obj_attr_subsection_v2_init (subsec->name, subsec->scope, + subsec->optional, subsec->encoding); + + for (obj_attr_v2 *attr = subsec->first_; + attr != NULL; + attr = attr->next) + obj_attr_v2_default_append (info, new_subsec, attr); + + return new_subsec; +} + +static obj_attr_subsection_v2 * +obj_attr_subsection_v2_perfect_match (struct bfd_link_info *info, + bfd *ref_bfd, bfd *abfd, + obj_attr_subsection_v2 *s_ref, + obj_attr_subsection_v2 *s_abfd) +{ + const struct elf_backend_data *be = get_elf_backend_data (abfd); + + void + report_missing_required_obj_attr (bfd * ebfd, uint32_t tag) + { + const char* tag_s = obj_attr_v2_tag_to_string (be, s_ref->name, tag); + if (tag_s) + info->callbacks->einfo ( + _("%X%pB: error: missing required object attribute '%s' in subsection " + "'%s'\n" ), ebfd, tag_s, s_ref->name); + else + info->callbacks->einfo ( + _("%X%pB: error: missing required object attribute 'Tag_unknown_%u' in " + "subsection '%s'\n" ), ebfd, tag, s_ref->name); + } + + void + report_mismatching_required_obj_attr (obj_attr_v2 *a_ref, obj_attr_v2 *a_abfd) + { + const char* tag_s = obj_attr_v2_tag_to_string (be, s_ref->name, a_ref->tag); + if (s_ref->encoding == ULEB128) + { + if (tag_s) + info->callbacks->einfo ( + _("%X%pB, %pB: error: mismatching values 0x%x and 0x%x for " + "required object attribute '%s' in subsection '%s'\n"), + ref_bfd, abfd, a_ref->vals.uint_val, a_abfd->vals.uint_val, + obj_attr_v2_tag_to_string (be, s_ref->name, a_abfd->tag), s_ref->name); + else + info->callbacks->einfo ( + _("%X%pB, %pB: error: mismatching values 0x%x and 0x%x for " + "required object attribute 'Tag_unknown_%u' in subsection '%s'\n"), + ref_bfd, abfd, a_ref->vals.uint_val, a_abfd->vals.uint_val, + a_abfd->tag, s_ref->name); + } + else + { + if (tag_s) + info->callbacks->einfo ( + _("%X%pB, %pB: error: mismatching values '%s' and '%s' for " + "required object attribute '%s' in subsection '%s'\n"), + ref_bfd, abfd, a_ref->vals.string_val, a_abfd->vals.string_val, + obj_attr_v2_tag_to_string (be, s_ref->name, a_abfd->tag), s_ref->name); + else + info->callbacks->einfo ( + _("%X%pB, %pB: error: mismatching values '%s' and '%s' for " + "required object attribute 'Tag_unknown_%u' in subsection '%s'\n"), + ref_bfd, abfd, a_ref->vals.string_val, a_abfd->vals.string_val, + a_abfd->tag, s_ref->name); + } + } + + bool success = true; + obj_attr_v2 *a_ref = s_ref->first_; + obj_attr_v2 *a_abfd = s_abfd->first_; + while (a_ref != NULL && a_abfd != NULL) + { + if (a_ref->tag < a_abfd->tag) + { + success = false; + report_missing_required_obj_attr (abfd, a_ref->tag); + a_ref = a_ref->next; + } + else if (a_ref->tag > a_abfd->tag) + { + success = false; + report_missing_required_obj_attr (ref_bfd, a_abfd->tag); + a_abfd = a_abfd->next; + } + else + { + if (s_ref->encoding == ULEB128) + { + if (a_ref->vals.uint_val != a_abfd->vals.uint_val) + { + success = false; + report_mismatching_required_obj_attr (a_ref, a_abfd); + } + } + else if (s_ref->encoding == NTBS) + { + if (strcmp (a_ref->vals.string_val, a_abfd->vals.string_val) != 0) + { + success = false; + report_mismatching_required_obj_attr (a_ref, a_abfd); + } + } + a_ref = a_ref->next; + a_abfd = a_abfd->next; + } + } + + for (; a_abfd != NULL; a_abfd = a_abfd->next) + { + success = false; + report_missing_required_obj_attr (ref_bfd, a_abfd->tag); + } + + for (; a_ref != NULL; a_ref = a_ref->next) + { + success = false; + report_missing_required_obj_attr (abfd, a_ref->tag); + } + + return success ? s_ref : NULL; +} + +static obj_attr_v2 * +search_obj_attr_v2_by_tag (obj_attr_v2 *attr_first, uint32_t tag) +{ + for (obj_attr_v2* attr = attr_first; attr != NULL; attr = attr->next) + { + if (attr->tag == tag) + return attr; + else if (attr->tag > tag) + break; + } + return NULL; +} + +static +obj_attr_subsection_v2 * +handle_optional_subsection_merge (struct bfd_link_info *info, + bfd *ref_bfd, bfd *abfd, + obj_attr_subsection_v2 *s_ref, + obj_attr_subsection_v2 *s_abfd, + obj_attr_subsection_v2 *s_frozen) +{ + (void) info; + bool frozen_as_abfd = (ref_bfd == abfd); + obj_attr_v2 *a_ref = s_ref->first_; + obj_attr_v2 *a_abfd = s_abfd->first_; + obj_attr_v2 *a_frozen_first = (s_frozen != NULL) ? s_frozen->first_ : NULL; + while (a_ref != NULL && a_abfd != NULL) + { + uint32_t searched_frozen_tag = + (a_ref->tag < a_abfd->tag) + ? a_ref->tag + : a_abfd->tag; + obj_attr_v2 *a_frozen = + search_obj_attr_v2_by_tag (a_frozen_first, searched_frozen_tag); + if (a_frozen != NULL) + a_frozen_first = a_frozen; + + if (a_ref->tag < a_abfd->tag) + { + obj_attr_v2 *a_default = obj_attr_v2_tag_default (info, s_abfd, a_ref); + obj_attr_v2_merge_result res = + _bfd_elf_obj_attr_v2_tag_merge (info, abfd, s_ref, a_ref, a_default, + a_frozen, frozen_as_abfd); + _bfd_elf_obj_attr_v2_free (a_default, s_ref->encoding); + if (res.merge) + a_ref->vals = res.vals; + else if (res.reason == UNSUPPORTED) + a_ref->status = obj_attr_v2_unknown; + a_ref = a_ref->next; + } + else if (a_ref->tag > a_abfd->tag) + { + obj_attr_v2 *a_default = obj_attr_v2_tag_default (info, s_ref, a_abfd); + obj_attr_v2_merge_result res = + _bfd_elf_obj_attr_v2_tag_merge (info, abfd, s_ref, a_default, a_abfd, + a_frozen, frozen_as_abfd); + if (res.merge || res.reason == SAME_VALUE_AS_REF) + { + a_default->vals = res.vals; + LINKED_LIST_INSERT_BEFORE(obj_attr_v2) (s_ref, a_default, a_ref); + } + else + _bfd_elf_obj_attr_v2_free (a_default, s_ref->encoding); + a_abfd = a_abfd->next; + } + else + { + obj_attr_v2_merge_result res = + _bfd_elf_obj_attr_v2_tag_merge (info, abfd, s_ref, a_ref, a_abfd, + a_frozen, frozen_as_abfd); + if (res.merge) + a_ref->vals = res.vals; + else if (res.reason == UNSUPPORTED) + a_ref->status = obj_attr_v2_unknown; + a_ref = a_ref->next; + a_abfd = a_abfd->next; + } + } + + for (; a_abfd != NULL; a_abfd = a_abfd->next) + { + obj_attr_v2 *a_default = obj_attr_v2_tag_default (info, s_ref, a_abfd); + obj_attr_v2_merge_result res = + _bfd_elf_obj_attr_v2_tag_merge (info, abfd, s_ref, a_default, a_abfd, + NULL, false); + if (res.merge || res.reason == SAME_VALUE_AS_REF) + { + a_default->vals = res.vals; + LINKED_LIST_APPEND(obj_attr_v2) (s_ref, a_default); + } + else + _bfd_elf_obj_attr_v2_free (a_default, s_ref->encoding); + } + + for (; a_ref != NULL; a_ref = a_ref->next) + { + obj_attr_v2 *a_frozen = search_obj_attr_v2_by_tag (a_frozen_first, a_ref->tag); + if (a_frozen != NULL) + a_frozen_first = a_frozen; + + obj_attr_v2 *a_default = obj_attr_v2_tag_default (info, s_abfd, a_ref); + obj_attr_v2_merge_result res = + _bfd_elf_obj_attr_v2_tag_merge (info, abfd, s_ref, a_ref, a_default, + a_frozen, frozen_as_abfd); + _bfd_elf_obj_attr_v2_free (a_default, s_ref->encoding); + if (res.merge) + a_ref->vals = res.vals; + else if (res.reason == UNSUPPORTED) + a_ref->status = obj_attr_v2_unknown; + } + + return s_ref; +} + +static obj_attr_subsection_v2 * +handle_subsection_merge (struct bfd_link_info *info, bfd *ref_bfd, bfd *abfd, + obj_attr_subsection_v2 *s_ref, obj_attr_subsection_v2 *s_abfd, + obj_attr_subsection_v2 *s_frozen) +{ + if (! s_ref->optional) + return obj_attr_subsection_v2_perfect_match (info, ref_bfd, abfd, s_ref, s_abfd); + return handle_optional_subsection_merge (info, ref_bfd, abfd, s_ref, s_abfd, s_frozen); +} + +static bool +handle_subsection_missing (struct bfd_link_info *info, bfd *ref_bfd, bfd *abfd, + obj_attr_subsection_v2 *s_ref, obj_attr_subsection_v2 *s_frozen) +{ + if (! s_ref->optional) + { + info->callbacks->einfo (_("%X%pB: error: missing required object " + "attributes subsection %s\n" ), abfd, s_ref->name); + return false; + } + + /* Compute default values of the missing attributes in ABFD, but present in + REF, and merge ABFD's generated subsection with the one of REF. */ + obj_attr_subsection_v2 *s_abfd = + obj_attr_subsection_v2_defaults (info, s_ref); + obj_attr_subsection_v2 *merged = + handle_subsection_merge (info, ref_bfd, abfd, s_ref, s_abfd, s_frozen); + _bfd_elf_obj_attr_subsection_v2_free (s_abfd); + return merged != NULL; +} + +static bool +handle_subsection_additional (struct bfd_link_info *info, bfd *ref_bfd, bfd *abfd, + obj_attr_subsection_v2 *s_ref_next, obj_attr_subsection_v2 *s_abfd, + obj_attr_subsection_v2 *s_frozen) +{ + if (! s_abfd->optional) + { + info->callbacks->einfo (_("%X%pB: error: missing required object " + "attributes subsection %s\n" ), ref_bfd, s_abfd->name); + return false; + } + + /* Compute default values of the missing attributes in REF, but present in + ABFD, and merge REF's generated subsection with the one of ABFD. */ + obj_attr_subsection_v2 *s_ref = + obj_attr_subsection_v2_defaults (info, s_abfd); + obj_attr_subsection_v2 *s_merged = + handle_subsection_merge (info, ref_bfd, abfd, s_ref, s_abfd, s_frozen); + BFD_ASSERT (s_merged == s_ref); // FIXME: I am not sure whether that it is true or false. If true, eliminate next free. + if (s_ref != s_merged) + _bfd_elf_obj_attr_subsection_v2_free (s_ref); + if (s_merged != NULL) + { + LINKED_LIST_INSERT_BEFORE(obj_attr_subsection_v2) ( + &elf_obj_attr_subsections (ref_bfd), s_merged, s_ref_next); + } + return (s_merged != NULL); +} + +const char * +obj_attr_subsection_v2_optional_to_string (bool optional) +{ + return optional ? "optional" : "required"; +} + +const char * +obj_attr_encoding_v2_to_string (obj_attr_encoding_v2 encoding) +{ + return (encoding == ULEB128) ? "uleb128" : "ntbs"; +} + +static bool +check_mismatching_parameters (struct bfd_link_info *info, bfd *f1, bfd *f2, + obj_attr_subsection_v2 *s1, + obj_attr_subsection_v2 *s2) +{ + if (! gnu_testing_namespace (s1->name)) + { + /* Check whether the subsection is known, and if so, match against the + expected properties. + Note: this piece of code must be guarded against gnu-testing + subsections, as the backend method looks up at the known subsections. + Since the "fictive" entry for gnu-testing known subsection has random + values for its encoding and optionality, it won't be able to detect + mismatching parameters correctly. */ + bool match_known = true; + if (get_elf_backend_data (f2)->obj_attr_subsection_v2_match_known != NULL) + match_known = get_elf_backend_data (f2) + ->obj_attr_subsection_v2_match_known (info, f2, s2); + if (! match_known) + return true; + } + + bool mismatch = (s1->encoding != s2->encoding) + || (s1->optional != s2->optional); + + if (mismatch) + { + if (f1 != NULL) + info->callbacks->einfo (_("%X%pB, %pB: error: parameters of subsection" + " '%s' are mismatching. (%s, %s) VS (%s, %s)\n"), f1, f2, s1->name, + obj_attr_subsection_v2_optional_to_string (s1->optional), + obj_attr_encoding_v2_to_string (s1->encoding), + obj_attr_subsection_v2_optional_to_string (s2->optional), + obj_attr_encoding_v2_to_string (s2->encoding)); + else + info->callbacks->einfo (_("%X%pB: error: parameters of subsection" + " '%s' are corrupted. (%s, %s) VS (%s, %s)\n"), f2, s1->name, + obj_attr_subsection_v2_optional_to_string (s1->optional), + obj_attr_encoding_v2_to_string (s1->encoding), + obj_attr_subsection_v2_optional_to_string (s2->optional), + obj_attr_encoding_v2_to_string (s2->encoding)); + } + + return mismatch; +} + +static bool +obj_attr_subsection_v2_merge_frozen (struct bfd_link_info *info, + bfd *abfd, + obj_attr_subsection_v2 *s_frozen) +{ + if (s_frozen == NULL) + return true; + + bool success = true; + + obj_attr_subsection_v2 *s_abfd = elf_obj_attr_subsections (abfd).first_; + while (s_frozen != NULL && s_abfd != NULL) + { + int cmp = strcmp (s_abfd->name, s_frozen->name); + if (cmp < 0) /* ABFD has a subsection that FROZEN doesn't have. */ + { + /* No need to try to merge anything here. */ + s_abfd = s_abfd->next; + } + else if (cmp > 0) /* FROZEN has a subsection that ABFD doesn't have. */ + { + success &= handle_subsection_additional (info, abfd, abfd, + s_abfd, s_frozen, s_frozen); + s_frozen = s_frozen->next; + } + else /* Both ABFD and frozen have the subsection. */ + { + bool mismatch = check_mismatching_parameters (info, NULL, abfd, + s_frozen, s_abfd); + success &= ! mismatch; + if (mismatch) + /* FROZEN cannot be corrupted as it is generated from the command + line arguments. If it is corrupted, it is a bug. */ + s_abfd->status = obj_attr_subsection_v2_corrupted; + else + success &= (handle_subsection_merge (info, abfd, abfd, + s_abfd, s_frozen, s_frozen) != NULL); + + s_abfd = s_abfd->next; + s_frozen = s_frozen->next; + } + } + + /* No need to go through the remaining sections of ABFD, only mismatch against + FROZEN are interesting. */ + + for (; s_frozen != NULL; s_frozen = s_frozen->next) + success &= handle_subsection_additional (info, abfd, abfd, + elf_obj_attr_subsections (abfd).last_, s_frozen, s_frozen); + + return success; +} + +static bool +obj_attr_subsection_v2_merge (struct bfd_link_info *info, + bfd *ref_bfd, bfd *abfd) +{ + bool success = true; + obj_attr_subsection_list *out_frozen_subsecs = + &elf_obj_attr_subsections (info->output_bfd); + obj_attr_subsection_list *abfd_subsecs = &elf_obj_attr_subsections (abfd); + obj_attr_subsection_list *ref_subsecs = &elf_obj_attr_subsections (ref_bfd); + + obj_attr_subsection_v2 *s_frozen_first = out_frozen_subsecs->first_; + obj_attr_subsection_v2 *s_abfd = abfd_subsecs->first_; + obj_attr_subsection_v2 *s_ref = ref_subsecs->first_; + + /* Translate object attributes from abfd to GNU properties if they have an + equivalence. */ + _bfd_elf_translate_relevant_obj_attrs_to_gnu_props (abfd); + + while (s_abfd != NULL && s_ref != NULL) + { + int cmp = strcmp (s_ref->name, s_abfd->name); + + if (cmp < 0) /* REF has a subsection that ABFD doesn't have. */ + { + if (s_ref->status != obj_attr_subsection_v2_ok) + { + s_ref = s_ref->next; + continue; + } + + obj_attr_subsection_v2 *s_frozen = + obj_attr_subsection_v2_find_by_name (s_frozen_first, s_ref->name, true); + + /* Mismatching between REF and FROZEN already done in + obj_attr_subsection_v2_merge_frozen. */ + success &= handle_subsection_missing (info, ref_bfd, abfd, s_ref, + s_frozen); + + if (s_frozen != NULL) + s_frozen_first = s_frozen->next; + s_ref = s_ref->next; + } + else if (cmp > 0) /* ABFD has a subsection that REF doesn't have. */ + { + if (s_abfd->status != obj_attr_subsection_v2_ok) + { + s_abfd = s_abfd->next; + continue; + } + + obj_attr_subsection_v2 *s_frozen = + obj_attr_subsection_v2_find_by_name (s_frozen_first, s_abfd->name, true); + if (s_frozen != NULL) + { + /* Check any mismatch against ABFD and FROZEN. */ + bool mismatch = check_mismatching_parameters (info, NULL, abfd, + s_frozen, s_abfd); + success &= ! mismatch; + if (mismatch) + s_abfd->status = obj_attr_subsection_v2_corrupted; + else + success &= handle_subsection_additional (info, ref_bfd, abfd, + s_ref, s_abfd, s_frozen); + } + else + success &= handle_subsection_additional (info, ref_bfd, abfd, s_ref, + s_abfd, NULL); + + if (s_frozen != NULL) + s_frozen_first = s_frozen->next; + s_abfd = s_abfd->next; + } + else /* Both REF and ABFD have the subsection. */ + { + if (s_ref->status != obj_attr_subsection_v2_ok) + { + s_ref = s_ref->next; + s_abfd = s_abfd->next; + continue; + } + + obj_attr_subsection_v2 *s_frozen = + obj_attr_subsection_v2_find_by_name (s_frozen_first, s_ref->name, true); + if (s_frozen != NULL) + { + bool mismatch = check_mismatching_parameters (info, NULL, abfd, + s_frozen, s_abfd); + success &= ! mismatch; + if (mismatch) + s_abfd->status = obj_attr_subsection_v2_corrupted; + else + { + success &= (handle_subsection_merge (info, ref_bfd, abfd, + s_ref, s_abfd, s_frozen) + != NULL); + } + } + else + { + bool mismatch = check_mismatching_parameters (info, ref_bfd, abfd, + s_ref, s_abfd); + success &= ! mismatch; + if (mismatch) + s_abfd->status = obj_attr_subsection_v2_corrupted; + else + success &= (handle_subsection_merge (info, ref_bfd, abfd, s_ref, + s_abfd, NULL) != NULL); + } + + if (s_frozen != NULL) + s_frozen_first = s_frozen->next; + s_ref = s_ref->next; + s_abfd = s_abfd->next; + } + } + + for (; s_abfd != NULL; s_abfd = s_abfd->next) + { + if (s_abfd->status != obj_attr_subsection_v2_ok) + continue; + + obj_attr_subsection_v2 *s_frozen = + obj_attr_subsection_v2_find_by_name (s_frozen_first, s_abfd->name, true); + if (s_frozen != NULL) + { + bool mismatch = check_mismatching_parameters (info, NULL, abfd, + s_frozen, s_abfd); + success &= ! mismatch; + if (mismatch) + s_abfd->status = obj_attr_subsection_v2_corrupted; + else + success &= handle_subsection_additional (info, ref_bfd, abfd, + ref_subsecs->last_, s_abfd, s_frozen); + } + else + success &= handle_subsection_additional (info, ref_bfd, abfd, + ref_subsecs->last_, s_abfd, NULL); + } + + for (; s_ref != NULL; s_ref = s_ref->next) + { + if (s_ref->status != obj_attr_subsection_v2_ok) + continue; + + obj_attr_subsection_v2 *s_frozen = + obj_attr_subsection_v2_find_by_name (s_frozen_first, s_ref->name, true); + /* No need to check for matching parameters here as frozen has already + been checked against ref. */ + success &= handle_subsection_missing (info, ref_bfd, abfd, s_ref, s_frozen); + } + + return success; +} + +static void +mark_unknown_subsections (bfd *abfd) +{ + const struct elf_backend_data *be = get_elf_backend_data (abfd); + for (obj_attr_subsection_v2* subsec = elf_obj_attr_subsections (abfd).first_; + subsec != NULL; + subsec = subsec->next) + { + if (identify_subsection (be, subsec->name) == NULL) + subsec->status = obj_attr_subsection_v2_unknown; + } +} + +static bfd * +bfd_elf_merge_build_attributes (struct bfd_link_info *info, bfd *ref_bfd) +{ + const struct elf_backend_data *be_out = + get_elf_backend_data (info->output_bfd); + unsigned int elfclass = be_out->s->elfclass; + int elf_machine_code = be_out->elf_machine_code; + + bool + valid_elf_object (bfd *abfd) + { + return ((abfd->flags & (DYNAMIC | BFD_PLUGIN | BFD_LINKER_CREATED)) == 0) + && (bfd_get_flavour (abfd) == bfd_target_elf_flavour) + && (elf_machine_code == get_elf_backend_data (abfd)->elf_machine_code) + && (elfclass == get_elf_backend_data (abfd)->s->elfclass); + } + + mark_unknown_subsections (ref_bfd); + + bool success = true; + for (bfd *abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) + if (abfd != ref_bfd && valid_elf_object (abfd)) + { + mark_unknown_subsections (abfd); + success &= obj_attr_subsection_v2_merge (info, ref_bfd, abfd); + } + + return success ? ref_bfd : NULL; +} + +/* Prune the given attribute, and return the next one. */ +static obj_attr_v2 * +obj_attr_v2_prune (obj_attr_subsection_v2 *subsec, + obj_attr_v2 *attr) +{ + obj_attr_v2 *next = attr->next; + LINKED_LIST_REMOVE(obj_attr_v2) (subsec, attr); + _bfd_elf_obj_attr_v2_free (attr, subsec->encoding); + return next; +} + +/* Prune the given subsection, and return the next one. */ +static obj_attr_subsection_v2 * +obj_attr_subsection_v2_prune (obj_attr_subsection_list *plist, + obj_attr_subsection_v2 *subsec) +{ + obj_attr_subsection_v2 *next = subsec->next; + LINKED_LIST_REMOVE(obj_attr_subsection_v2) (plist, subsec); + _bfd_elf_obj_attr_subsection_v2_free (subsec); + return next; +} + +static void +info_obj_attr_v2_prune (struct bfd_link_info *info, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *attr) +{ + const struct elf_backend_data *be = get_elf_backend_data (info->output_bfd); + const char *attr_s = obj_attr_v2_tag_to_string (be, subsec->name, attr->tag); + if (attr_s) + info->callbacks->minfo (_("Removed attribute '%s' from '%s'\n"), attr_s, + subsec->name); + else + info->callbacks->minfo (_("Removed attribute 'Tag_unknown_%u' from '%s'\n"), + attr->tag, subsec->name); +} + +static void +info_obj_attr_subsection_v2_prune (struct bfd_link_info *info, + obj_attr_subsection_v2 *subsec) +{ + info->callbacks->minfo (_("Removed subsection '%s'\n"), subsec->name); +} + +/* Prune any attributes with a status different from obj_attr_v2_ok in the + given subsection. */ +static void +obj_attr_v2_filter_prune (struct bfd_link_info *info, + obj_attr_subsection_v2 *subsec) +{ + for (obj_attr_v2 *attr = subsec->first_; + attr != NULL;) + { + if (attr->status != obj_attr_v2_ok) + { + info_obj_attr_v2_prune (info, subsec, attr); + attr = obj_attr_v2_prune (subsec, attr); + } + else + attr = attr->next; + } +} + +/* Prune any subsection with a status different from obj_attr_subsection_v2_ok + in the given list of subsections. */ +static void +obj_attr_subsection_v2_filter_prune (struct bfd_link_info *info, + obj_attr_subsection_list *plist) +{ + for (obj_attr_subsection_v2 *subsec = plist->first_; + subsec != NULL;) + { + if (subsec->status == obj_attr_subsection_v2_ok) + obj_attr_v2_filter_prune (info, subsec); + + if (subsec->size == 0 || subsec->status != obj_attr_subsection_v2_ok) + { + info_obj_attr_subsection_v2_prune (info, subsec); + subsec = obj_attr_subsection_v2_prune (plist, subsec); + } + else + subsec = subsec->next; + } +} + +static bfd * +bfd_elf_prune_build_attributes (struct bfd_link_info *info, bfd *abfd) +{ + if (abfd == NULL) + return NULL; + + obj_attr_subsection_list *plist = &elf_obj_attr_subsections (abfd); + obj_attr_subsection_v2_filter_prune (info, plist); + return (plist->size != 0) ? abfd : NULL; +} + +bfd * +_bfd_elf_link_setup_build_attributes (struct bfd_link_info *info) +{ + obj_attr_subsection_list *frozen_ = + &elf_obj_attr_subsections (info->output_bfd); + + bfd_search_result_t res = + bfd_linear_search_one_with_build_attributes (info); + + /* If res.pbfd is NULL, it means that it didn't find any ELF object files. */ + if (res.pbfd == NULL) + return NULL; + + /* No frozen object attributes and no object file, so nothing to do. */ + if (!res.has_build_attributes && frozen_->size == 0) + return NULL; + /* If frozen object attributes were set by some command-line options, we still + need to emit warnings / errors if there are incompatibilities. */ + + if (res.sec == NULL) + res.sec = create_build_attributes_section (info, res.pbfd); + + /* Sort the frozen subsections and attributes in case that they were not + inserted in the correct order. */ + obj_attr_subsection_v2_sort (frozen_); + + /* Translate object attributes from res.pbfd to GNU properties if they have an + equivalence, before distorting them with the merge. */ + _bfd_elf_translate_relevant_obj_attrs_to_gnu_props (res.pbfd); + + /* Emit warnings / errors (if any) when merging res.pbfd against frozen. + res.pbfd will be used as the ref and will be accumulating the merge result. + It means that we will lose its information. */ + bool success = true; + success &= obj_attr_subsection_v2_merge_frozen (info, res.pbfd, + frozen_->first_); + + /* Merge build attributes sections. */ + info->callbacks->minfo (_("\n")); + info->callbacks->minfo (_("Merging build attributes\n")); + info->callbacks->minfo (_("\n")); + + res.pbfd = bfd_elf_merge_build_attributes (info, res.pbfd); + success &= (res.pbfd != NULL); + res.pbfd = bfd_elf_prune_build_attributes (info, res.pbfd); + + if (res.pbfd && elf_obj_attr_subsections (res.pbfd).size > 0) + { + /* Shallow-copy the build attributes into output_bfd. */ + elf_obj_attr_subsections (info->output_bfd) = + elf_obj_attr_subsections (res.pbfd); + + /* Note: the build attributes section in the output object is copied from + the input object which was used for the merge (res.pbfd). No need to + create it here. However, so that the section is copied to the output + object, the size must be different from 0. For now, we will set this + size to 1. The real size will be set later. */ + res.sec->size = 1; + } + + return success ? res.pbfd : NULL; +} + /* Allocate/find an object attribute. */ static obj_attribute * elf_new_obj_attr (bfd *abfd, int vendor, unsigned int tag) @@ -1097,6 +2318,32 @@ bfd_elf_parse_attr_section_v2 (bfd *abfd, obj_attr_subsection_v2_sort (subsecs); } +/* Translate the relevant GNU properties to object attributes v2. */ +void +_bfd_elf_translate_relevant_gnu_props_to_obj_attrs (bfd *abfd) +{ + const struct elf_backend_data *be = get_elf_backend_data (abfd); + if (be->translate_relevant_gnu_props_to_obj_attrs == NULL) + return; + + for (elf_property_list *p = elf_properties (abfd); p != NULL; p = p->next) + be->translate_relevant_gnu_props_to_obj_attrs (abfd, p); +} + +/* Translate the relevant object attributes v2 to GNU properties. */ +void +_bfd_elf_translate_relevant_obj_attrs_to_gnu_props (bfd *abfd) +{ + const struct elf_backend_data *be = get_elf_backend_data (abfd); + if (be->translate_relevant_obj_attrs_to_gnu_props == NULL) + return; + + for (obj_attr_subsection_v2 *subsec = elf_obj_attr_subsections (abfd).first_; + subsec != NULL; + subsec = subsec->next) + be->translate_relevant_obj_attrs_to_gnu_props (abfd, subsec); +} + /* Parse an object attributes section. Note: The parsing setup is common between object attributes v1 and v2. */ void @@ -1318,6 +2565,7 @@ _bfd_elf_obj_attr_v2_init (unsigned int tag, memset ((void *) attr, 0, sizeof (obj_attr_v2)); attr->tag = tag; attr->vals = vals; + attr->status = obj_attr_v2_ok; return attr; } @@ -1413,6 +2661,7 @@ _bfd_elf_obj_attr_subsection_v2_init (const char* name, subsection->scope = scope; subsection->optional = optional; subsection->encoding = encoding; + subsection->status = obj_attr_subsection_v2_ok; return subsection; } diff --git a/bfd/elf-attrs.h b/bfd/elf-attrs.h index a4af0da1f68..628638cc847 100644 --- a/bfd/elf-attrs.h +++ b/bfd/elf-attrs.h @@ -33,11 +33,24 @@ typedef enum obj_attr_encoding_v2 NTBS = 1, } obj_attr_encoding_v2; +extern const char * +obj_attr_encoding_v2_to_string (obj_attr_encoding_v2); + typedef union obj_attr_value_v2 { uint32_t uint_val; const char* string_val; } obj_attr_value_v2; +typedef enum obj_attr_v2_status +{ + /* An attribute that is unknown to the linker, and so cannot be merged. */ + obj_attr_v2_unknown = 0, + /* An attribute that was reported as corrupted. */ + obj_attr_v2_corrupted, + /* A valid attribute. */ + obj_attr_v2_ok, +} obj_attr_v2_status; + typedef struct obj_attr_v2 { /* The name/tag of an attribute. */ uint32_t tag; @@ -45,6 +58,9 @@ typedef struct obj_attr_v2 { /* The value assigned to an attribute, can be ULEB128 or NTBS. */ union obj_attr_value_v2 vals; + /* The attribute status after merge. */ + obj_attr_v2_status status; + /* The next attribute in the list or NULL. */ struct obj_attr_v2 *next; @@ -59,6 +75,16 @@ typedef enum obj_attr_subsection_scope_v2 SUBSEC_PRIVATE = 1, } obj_attr_subsection_scope_v2; +typedef enum obj_attr_subsection_v2_status +{ + /* A subsection that is unknown to the linker, and so cannot be merged. */ + obj_attr_subsection_v2_unknown = 0, + /* A subsection that was reported as corrupted. */ + obj_attr_subsection_v2_corrupted, + /* A valid subsection. */ + obj_attr_subsection_v2_ok, +} obj_attr_subsection_v2_status; + typedef struct obj_attr_subsection_v2 { /* The name of the subsection. */ const char *name; @@ -87,8 +113,14 @@ typedef struct obj_attr_subsection_v2 { /* The size of the list. */ uint32_t size; + /* The subsection status after merge. */ + obj_attr_subsection_v2_status status; + } obj_attr_subsection_v2; +extern const char * +obj_attr_subsection_v2_optional_to_string (bool); + typedef struct obj_attr_subsection_list { /* A pointer to the first node of the list. */ @@ -118,3 +150,47 @@ typedef struct const size_t len; } known_subsection_v2; +struct elf_backend_data; + +extern const known_subsection_v2 * +identify_subsection (const struct elf_backend_data *, const char*); + +extern const known_tag_v2 * +known_obj_attr_v2_find_by_tag (const struct elf_backend_data *, + const char*, uint32_t); + +extern const char * +obj_attr_v2_tag_to_string (const struct elf_backend_data *, const char*, + uint32_t); + +enum obj_attr_v2_merge_result_reason +{ + /* Default: everything is ok. */ + NONE = 0, + /* The result value of the merge is the same as REF. */ + SAME_VALUE_AS_REF, + /* No implementation of a merge for this attribute exists. */ + UNSUPPORTED, + /* The merge failed, an error message should be logged. */ + ERROR, +}; +typedef struct { + /* Should the merge be performed ? */ + bool merge; + /* The merged value. */ + union obj_attr_value_v2 vals; + /* If the merge should not be performed, give the reason to differentiate + error cases from normal cases. Typically, if REF already is set to the + same value as the merged result, no merge is needed, and this is not an + error. */ + enum obj_attr_v2_merge_result_reason reason; +} obj_attr_v2_merge_result; + +/* Re-usable merge policies.*/ +/* For now, only AND-merge is used by AArch64 backend. Additional policies + (Integer-OR, String-ADD) are part of the GNU testing namespace. If they + appear to be usefull for a backend at some point, they should be exposed + to the backend here below. */ +extern obj_attr_v2_merge_result +obj_attr_v2_tag_merge_AND (struct bfd_link_info *, bfd *, obj_attr_subsection_v2 *, + obj_attr_v2 *, obj_attr_v2 *, obj_attr_v2 *); diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 3e825299a56..e8e8428c8e4 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1641,6 +1641,31 @@ struct elf_backend_data /* The version of object attributes (1 or 2). */ unsigned int obj_attrs_version; + /* The known subsections and attributes (v2 only). */ + const known_subsection_v2 *obj_attr_v2_known_subsections; + /* The size of the array of known subsections. */ + const size_t obj_attr_v2_known_subsections_size; + + /* Translate the relevant GNU properties to object attributes v2. */ + void (*translate_relevant_gnu_props_to_obj_attrs) (bfd *, + elf_property_list *); + + /* Translate the relevant object attributes v2 to GNU properties. */ + void (*translate_relevant_obj_attrs_to_gnu_props) (bfd *, + obj_attr_subsection_v2 *); + + /* Check build attributes subsection v2 against expected properties. */ + bool (*obj_attr_subsection_v2_match_known) (struct bfd_link_info *, bfd *, + obj_attr_subsection_v2 *); + + /* Get default value for an attribute. */ + bool (*obj_attr_v2_default_value) (struct bfd_link_info *, + const known_tag_v2 *, obj_attr_subsection_v2 *, obj_attr_v2 *); + + /* Merge a build attribute v2. */ + obj_attr_v2_merge_result (*obj_attr_v2_tag_merge) (struct bfd_link_info *, + bfd *, obj_attr_subsection_v2 *, obj_attr_v2 *, obj_attr_v2 *, obj_attr_v2 *); + /* This function determines the order in which any attributes are written. It must be defined for input in the range LEAST_KNOWN_OBJ_ATTRIBUTE..NUM_KNOWN_OBJ_ATTRIBUTES-1 (this range @@ -1662,6 +1687,9 @@ struct elf_backend_data bool (*merge_gnu_properties) (struct bfd_link_info *, bfd *, bfd *, elf_property *, elf_property *); + /* Set up build attributes. */ + bfd *(*setup_build_attributes) (struct bfd_link_info *); + /* Set up GNU properties. */ bfd *(*setup_gnu_properties) (struct bfd_link_info *); @@ -3083,9 +3111,14 @@ extern obj_attribute *bfd_elf_add_obj_attr_int_string extern bool _bfd_elf_write_section_build_attributes (bfd *, struct bfd_link_info *); +extern bfd *_bfd_elf_link_setup_build_attributes + (struct bfd_link_info *); + extern char *_bfd_elf_attr_strdup (bfd *, const char *); extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *); extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, unsigned int); +extern void _bfd_elf_translate_relevant_gnu_props_to_obj_attrs (bfd *); +extern void _bfd_elf_translate_relevant_obj_attrs_to_gnu_props (bfd *); extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *); extern bool _bfd_elf_merge_object_attributes (bfd *, struct bfd_link_info *); diff --git a/bfd/elf.c b/bfd/elf.c index 3f8bc838bfb..03c29bf6e51 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -11446,17 +11446,29 @@ elfobj_grok_gnu_build_id (bfd *abfd, Elf_Internal_Note *note) static bool elfobj_grok_gnu_note (bfd *abfd, Elf_Internal_Note *note) { + bool res; switch (note->type) { - default: - return true; - case NT_GNU_PROPERTY_TYPE_0: - return _bfd_elf_parse_gnu_properties (abfd, note); + res = _bfd_elf_parse_gnu_properties (abfd, note); + if (res) + { + uint32_t version = get_elf_backend_data (abfd)->obj_attrs_version; + + if (version == 2) + _bfd_elf_translate_relevant_gnu_props_to_obj_attrs (abfd); + } + break; case NT_GNU_BUILD_ID: - return elfobj_grok_gnu_build_id (abfd, note); + res = elfobj_grok_gnu_build_id (abfd, note); + break; + + default: + res = true; + break; } + return res; } static bool diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index cff508dbbce..1fffc9194c9 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -559,6 +559,27 @@ #ifndef elf_backend_obj_attrs_version #define elf_backend_obj_attrs_version 1 /* Default version. */ #endif +#ifndef elf_backend_obj_attr_v2_known_subsections +#define elf_backend_obj_attr_v2_known_subsections NULL +#endif +#ifndef elf_backend_obj_attr_v2_known_subsections_size +#define elf_backend_obj_attr_v2_known_subsections_size 0 +#endif +#ifndef elf_backend_translate_relevant_gnu_props_to_obj_attrs +#define elf_backend_translate_relevant_gnu_props_to_obj_attrs NULL +#endif +#ifndef elf_backend_translate_relevant_obj_attrs_to_gnu_props +#define elf_backend_translate_relevant_obj_attrs_to_gnu_props NULL +#endif +#ifndef elf_backend_obj_attr_subsection_v2_match_known +#define elf_backend_obj_attr_subsection_v2_match_known NULL +#endif +#ifndef elf_backend_obj_attr_v2_default_value +#define elf_backend_obj_attr_v2_default_value NULL +#endif +#ifndef elf_backend_obj_attr_v2_tag_merge +#define elf_backend_obj_attr_v2_tag_merge NULL +#endif #ifndef elf_backend_obj_attrs_order #define elf_backend_obj_attrs_order NULL #endif @@ -571,6 +592,9 @@ #ifndef elf_backend_merge_gnu_properties #define elf_backend_merge_gnu_properties NULL #endif +#ifndef elf_backend_setup_build_attributes +#define elf_backend_setup_build_attributes _bfd_elf_link_setup_build_attributes +#endif #ifndef elf_backend_setup_gnu_properties #define elf_backend_setup_gnu_properties _bfd_elf_link_setup_gnu_properties #endif @@ -938,10 +962,18 @@ static const struct elf_backend_data elfNN_bed = elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type, elf_backend_obj_attrs_version, + elf_backend_obj_attr_v2_known_subsections, + elf_backend_obj_attr_v2_known_subsections_size, + elf_backend_translate_relevant_gnu_props_to_obj_attrs, + elf_backend_translate_relevant_obj_attrs_to_gnu_props, + elf_backend_obj_attr_subsection_v2_match_known, + elf_backend_obj_attr_v2_default_value, + elf_backend_obj_attr_v2_tag_merge, elf_backend_obj_attrs_order, elf_backend_obj_attrs_handle_unknown, elf_backend_parse_gnu_properties, elf_backend_merge_gnu_properties, + elf_backend_setup_build_attributes, elf_backend_setup_gnu_properties, elf_backend_fixup_gnu_properties, elf_backend_compact_eh_encoding, diff --git a/ld/ldelf.c b/ld/ldelf.c index f4f27fc3873..e16899db9b8 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -1291,6 +1291,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, } } + get_elf_backend_data (link_info.output_bfd)->setup_build_attributes (&link_info); get_elf_backend_data (link_info.output_bfd)->setup_gnu_properties (&link_info); /* Do not allow executable files to be used as inputs to the link. */ From patchwork Mon Mar 10 17:51:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107601 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 3B0A03858D39 for ; Mon, 10 Mar 2025 18:07:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B0A03858D39 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=e299xNHF; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=e299xNHF X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20611.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::611]) by sourceware.org (Postfix) with ESMTPS id 307503858404 for ; Mon, 10 Mar 2025 17:54:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 307503858404 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 307503858404 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2614::611 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629263; cv=pass; b=bGlEb4AdPi4sUjmUkcDJ1Ukis9nXJ4V8EPgHyGcb7pi7tRD+wEMaqgFK5e4E6Mmkn1kHFE7Xb25gU7ugPr5qBPRE8sGs78SKOgK37gZUu+zmRc4uHsMVV1D7m9W2UsNEYMsPopFESB1n6fOEa4l6RtR7IdjyPAEbFDipwsLWSTc= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629263; c=relaxed/simple; bh=tK3FBbgOUPtRCXwKhHPKCdqHD774RQ1s5O9AKkrfWJA=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=sHnrTtZ9VI9gKoyCFefSr2Ux77mCqT4XssqNbpiSD1eLDFf3M7+uLbJeUnP6CrfkkLCHl2Fa+BLXyLcaqDEkARpXKScKkN1a0/h8FeXB5h396fL2xJrSwAbxQKISJHLJzLE1JgxiVn5Vq4/+kFlVJI27X5NsZKCxR/pUcY+W3os= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 307503858404 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=I99JVOSxREEG4mnXRDyLe8oxXnecbPKCp9XC4c5/13yFpAXzhCU9/t5w7WXdEg155G+xCxtLhbanvjRC8YgddzKuawZ1i4QjMghti2Mmr1hjwS466RLeONJfavFeoWGK/uHiVtc9bGrO1mxkaNmpTDnJmCW7otGw7velWNDDUhjYfni/KnyDm3rxbPYtLlx0hQwX4m6thQfxW6BwHwQklbUy78O7R4YxC6lfdR9M8BjkXhnFmpwtN2hdVCIPe59frzrmK5YQEu9pnYdFXAOUzEEVQekjXBA13dHm4Uob92i4Aq0pp0yPPLs2psAGF3qiIOBfOQAJCZAK1m7KfWcsYg== 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=XpvR/5CnBJB5mpRWNEeDyJN57zsjSMSmCpQEdyZqXIA=; b=FOLlYifoyLmRUBwsHw99iji1+8fnx6C/saFo6MZdW4w1TCGWNsxvBxm3h61Xep8vZRS5NsEWeEW99EFeEm/6C2FzTJaQnlMyK3JZCs0sTlBX857aMBmDEkETzbzzGCVdFLrwvOF76C3ND9hj2DzxDF07CVUhe2WT5rwS+/wCx4YjxpLjmdwdHklTODnL57FO8WVam9TKIThuG/FA5BQwq//fSKrz1sRP6Ys9CKkWKOSu+fs9H1JiP/N9PBMcRrEOGqWtgKPiuypsYG2+8MkbpBUR1o+NyprIbk4TD0oIvR5YPxaHRteTk8LB9Zda06p8iPGm4+fL+LBIp1TOZBHL0w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=XpvR/5CnBJB5mpRWNEeDyJN57zsjSMSmCpQEdyZqXIA=; b=e299xNHFx45BkYgbNgxQwhNygKKXCue0WLpv9Tn3W+35+g/rdlh75JabmyPndxIogtFHSbRxZImPtkvD20qLRQo9WDVv2/wgNs+YQYKTtFLeVuLDHjG/UNGpqkcEMhmzu8KJ1qJbhr1Rv3ZTt2s82NBkCer28RnV6ObOpN2RnRo= Received: from DB9PR02CA0026.eurprd02.prod.outlook.com (2603:10a6:10:1d9::31) by GV1PR08MB8715.eurprd08.prod.outlook.com (2603:10a6:150:85::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:54:15 +0000 Received: from DB1PEPF000509F8.eurprd02.prod.outlook.com (2603:10a6:10:1d9:cafe::36) by DB9PR02CA0026.outlook.office365.com (2603:10a6:10:1d9::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:54:15 +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=arm.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 DB1PEPF000509F8.mail.protection.outlook.com (10.167.242.154) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:54:15 +0000 Received: ("Tessian outbound c3a902884497:v585"); Mon, 10 Mar 2025 17:54:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ce327ce995e80420 X-TessianGatewayMetadata: bp7sBFlP+6+HUqmUnJI3oCm8/bJPm9IJU1xqy0mCgcQpAIRWr5hygZcpzaN7XtW5zaTjAiqASme/fug8mlNpxmS29Es5F4+XjJhn0x5m5pL6+tcQg5H3MTKNeKhZ36IFocftJAOOCQWKDG+cF2U/1DadBxar6t3fsrK5lZLnWf4= X-CR-MTA-TID: 64aa7808 Received: from Lb5084e097bec.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4AABCAF6-33CE-448E-B57B-81527B71F7C3.1; Mon, 10 Mar 2025 17:54:08 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lb5084e097bec.2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:54:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hzPz8mBYpkdXUE5SumfDN4UMrGW53JKXDz93i5l9cqklWLeOXPJQRfz8apdaL7PlzsjOq20F5vwyD5Iutur4LO4KCUHSHE1FlSnBKsGGSd9YoUojwXAqOrOS1yoPZp5tHSvw1VvzNY9Q+NNApaF5m8XLGYai36FugfuplzJPiaPfRZChb1Wbm97FdY7QKvZUueSgOhqzrrxk8Lm7EuOrB5S0m9gL4LsXmmvsZbAk/mzfkHRTDMmqIzFygW0cRMXoXQq1I3PRo35KQwxa2fBv9J0+oOlhWaG4vQiBVST8p+gjgGXyBH/1Gu0e+FNhVDGwaSV8YKcYSF5KWNmyqehpgw== 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=XpvR/5CnBJB5mpRWNEeDyJN57zsjSMSmCpQEdyZqXIA=; b=TSTm2oVW6oTqQXdYHn6eyziDuXfa7nXhaa8gC2BuJSbPzIHEx+Y2DQZBZzVMwN2Ifxn/UO9DVQ6RjJztDef3KA1cFIyNK/UgRV6CuChGmH+G6Edukg+q7eiQOFfghCcXFvLQoTWJo6aZrhK4MXOQ3PoT3SDQXF0qtlNzDSlrWftlqrMSsDKk642M0/XLtDQOvUZKNSPhtSVFwpboOBZKCe0cy72LRWfT578HqJyIDirHB9jk3ueO0NGhvw7Ww0moxH+Ltfx18tLxLAlS6n2qh5+c4AykD0lm0ltdL7hC1FmEec0Hsd9AVKhg11BABQSJHlKVb5x5jII2aU3NMznTkA== 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=XpvR/5CnBJB5mpRWNEeDyJN57zsjSMSmCpQEdyZqXIA=; b=e299xNHFx45BkYgbNgxQwhNygKKXCue0WLpv9Tn3W+35+g/rdlh75JabmyPndxIogtFHSbRxZImPtkvD20qLRQo9WDVv2/wgNs+YQYKTtFLeVuLDHjG/UNGpqkcEMhmzu8KJ1qJbhr1Rv3ZTt2s82NBkCer28RnV6ObOpN2RnRo= Received: from AS8P189CA0019.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:31f::32) by GV2PR08MB9374.eurprd08.prod.outlook.com (2603:10a6:150:d0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.26; Mon, 10 Mar 2025 17:54:03 +0000 Received: from AM4PEPF00027A63.eurprd04.prod.outlook.com (2603:10a6:20b:31f:cafe::e7) by AS8P189CA0019.outlook.office365.com (2603:10a6:20b:31f::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:54:03 +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 AM4PEPF00027A63.mail.protection.outlook.com (10.167.16.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:54:03 +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; Mon, 10 Mar 2025 17:54:01 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:54:01 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 13/15] ld tests: generic merge coverage for build attributes Date: Mon, 10 Mar 2025 17:51:26 +0000 Message-ID: <20250310175131.1217374-14-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A63:EE_|GV2PR08MB9374:EE_|DB1PEPF000509F8:EE_|GV1PR08MB8715:EE_ X-MS-Office365-Filtering-Correlation-Id: 765d3223-7de2-44da-62ce-08dd5ffc929a x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info-Original: roNyGitl65qVFvrZjNdfO6TqwMmoA6A0uKPPbBrDUOW5J5snEEkACp2BN30b2KDRXoBz4p2elV8aH4mrLN5kdRxq4l7ufsjrRsjZYATVvifg1ZqbiNQtub6Ru+wSv0b6hxIaDoK+wwkBrvipRU30abFVqx9N+Wi4f/2TKn7egb2Qe+/ffDvhdTnb8P2BPV0ynCXkSSYQ+gR3JePy5Cuw0U/6nVzuCyL8T89LXkIz/co+LZVMTPLtEyG2ibvxRhy2BC5+ktaztpBaFOdamaoCaUGzYp4uVgOXo9HJECNsZ0fSXN0GORIUFdf+Fpw8Y1swIGc4kJKntB7qIv+IgJYKVtCEgaGS0DpzIdkoM9rfb6kANa845hf04Vm3oPtnbP+DmWSbwDZy/tG7/zbzBYcZLTTi56F7Vxcy3TJD1mUXbml8O1mLz1iN4vNTjsu6dhJ/N03Q4U+V3VB8t+GxSu6PrLkwbhpBZPnzcKVmzu7BnobwdTC2gPxdZbRj476CWlrvwl87+QcXWTm82HSkJkNnck7J07nLWhuFZ6yIsJUZWVbS9bVAisJB2WbDPMMcEUPzleDeEAD53UOkQk8SeNHTnzzm6n8yVht9HlPlRU5xjwRdzc3O6PGURbu4R06egIAZ1w8tYiWAro+zUUsyyuEvjV4WX/jniJqytLXKFuK5MGsfnxTJHEKyLmrv9ahcB4xmdqC6HaPuuoaKEz6au8rpzgCgIG9vebZBudhQsUQolASVRWxqGmcb9xpyCO1eyL2emeLcjj0FFiR2pmMRyBWdV3inEE4CQ896lMJC10NjvFKZCNEtr3KBHqFp8ZE8nN1H6nPjPDHsD8ebqy7e6ChLe/c6pwVuI+di71pHoclh9rd7ESZ2GNkFpwBrogjHPUN0uxXfygREbwiTdrUJzYwpGBLEZGfwDdqA2SttFo595/1zs/XQmusBDND4cUeEKYcx97caQ/M0jcZ9Axt4tidujlQlaJAA/Ljknlz7jUNgqmGfsY+tcP902TpVwGbpEjRWU1RXnuzdhoLpKcvKLvj24eI4Ql2xTvQa82aX+xCYCqq2C9am9jSAg6VhiTZdqiVQe5kH4XQ0T0q5ag8glWkY8zZZTOg0T6HbeHZ7uYVBD3U+5jvdCJ82UpSZJRe7wCC10Op0U1I6ymR65daszI6L2iuXfuY8lwSlHK72hZhJHC8F/qWorKZNunLm70jvjx5Xu2nKv4txD0MIDXHnTqtG4Ei5L2bFdmIkTVi5lyVoCYqRKTgDq6cahnT0eBHazb8WPb67MGaCv6E5WX8GaKEzby8npCSZIhrdTN/X6zBHmWrSdJNuyTnRgA7zTnUYOUQGuAzfJlZiWboVic7Q3aW72okeYUeeiEbxzxnaj3x127NdnwcFHNZ6rY6VloNBtJVxjG1Oh8fDxwTmUaqgA1bwB/aiYsPX7WU8+vivKgBTUhbMnrgWW8yUlZhuZMwaxvzmAeCwKpYyhdFRWa4np6B/17GZmp8siQ8AskkY+DNEO30= 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB9374 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:31f::32]; domain=AS8P189CA0019.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509F8.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 35d63daa-e051-4174-e44e-08dd5ffc8b6c X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|14060799003|376014|36860700013|35042699022|1800799024; X-Microsoft-Antispam-Message-Info: /mgG9vmCj2Qbz1ZvficgVZ2gIQxRipZDy7iDCF989eNlF1i3XKZrfQbEktz9Yi05lJKw7mRePvmqva7Vg2y8cAqwV6jgLfPnWmlDoh3ubWimvHjXYmtacfWIZw9EuSyyLgQLCX9I3ThUHG4lpTAmuO56vNX8wxu821059FZEO1Kp4pmk7UGxfFMZ1ZGFiV+bSFSA/YXSn3A4HhC9nkrlkCkgmCZt9Bm0KFAWKElngItBiTKEdkXQbbEVTUPywtAMBFxqqGFksx3BajvfGTVR1pDrLVqaLdijSlrmQyteiS7hTeF2NkSPYguCNd2We8f0ipctMdwPZ6IkIZZdue5cq55mU9SYOvUgTklLoWc933/KGiRKlm4s3NzyoEtqgsVfO62eU4cu2Db9jCZMPcrTJTIsr37YrU6A2+JZAhoYouTOEbwzgXOVj398WP5JF4BDIvo4FR8Cv6YH3uJbQSwBbSdtVDtruMtx+MiyvUmp22030oYJv+hvoewOj1A33qAH18QyLxACwOgarr82GtGOzwQMyMHzW8tEA4UHop+mHdpN6yT9QM1/uQpcUsFQ2ZscoJM9ZxHc9NZlb+3tXtv72cPGkdpeAXrnE076pkawS0sb1pcffLFfizXc5sXDA0P5fI6o3b2+2c3PLTYLur8Lj7vuXcEX1Xl3+1TC01u7q/9PhL+Fss43tiXtqQ31Q8sPHC2Cx4rAs8Jr0YZLJ9Vz0Wf5OyKU95bnghCOXOpwuRdfRtAxOM9vK0YS0ca7jGcQL61/KaNxg9JPQAXcsY2LPt6hU/ezIfZlPx47Ssh9ODnTVwI0M2JFM6sELVKTYred0XkONjwGiKjAfm81R3z3EDjPe55mS529GYT7M5maMyjqs4lLfVyHOfzKCzsu4XhKJfK6VZnx3yy6H56MwoLpZqGoDbpK6cPXmZO6ApNFHJczWeTZ1IMl7fa7WKOP7kRdhqLJeXk7N+JdTlwR3U8THS5iGXz45GMJhPrT8pzq1sLTJw5hbFF/mdov6qyfr1IeinmiDBqUi+es+SmJMHpF4jZ2prEHOvE0zzbazGl06hw+gNk69K5ir1UzVyKlkGF2XgVoFkt9bk/I183/PwWGAJGCKOtn299breph0TT+lJnKSIQGg/MsuagHEy5K5MXGqy9oqJQhpg7YdMtRMbnev095KKBsiL0EExOo9NoLf0EDHk1zACpXA6v8mqJw4cwlciz4pOGE8ZjQA782zpMVAER+PoCO9huj3xjXhhcgpCpaG/5CG/w2tSxe+leWF6JfAUZoWANW4U4AD8JaphpyRjOwuscADP30L91Ikm2Z5OUsquf7Rx36BIzaAuL0cPyu5BFFdmpQgzAwFTzT7WjwVS1gcIs1g5ZOrVn7QaQfKQTOjmEZKxY+jmFf0TEecm+n0f68aHreAvyMZ5tcK4puQ8Zw2dguPCa35eNu+hAy47bjhpBO6wijSLyrZBhGT1cA40fh9KAbG9llJssyKUfPwDsxPdbOqBUaRkPazBlrxeg= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(82310400026)(14060799003)(376014)(36860700013)(35042699022)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:54:15.2467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 765d3223-7de2-44da-62ce-08dd5ffc929a 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: DB1PEPF000509F8.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8715 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 - only one input object is copied to the output object - merge two inputs with optional subsections of both types ULEB128 and NTBS, which contains same, additional, and missing attributes. - mismatch subsection properties. - combine matching required subsections. - combine non-matching required subsections. - prune unknown attributes in known subsections. - prune unknown subsections. --- .../aarch64-build-attributes.exp | 47 ++++++++++++++++ .../build-attributes/ba-1-all-optional-1.s | 15 ++++++ .../build-attributes/ba-1-all-optional-2.s | 15 ++++++ ...ismatch-subsec-props-with-all-optional-1.d | 7 +++ ...ismatch-subsec-props-with-all-optional-1.s | 2 + .../build-attributes/ba-1-one-file.d | 42 +++++++++++++++ ...-1-two-files-all-optional-1more-1missing.d | 53 +++++++++++++++++++ ...nknown-and-known-attr-known-subsection-1.s | 11 ++++ ...nknown-and-known-attr-known-subsection-2.s | 11 ++++ ...-unknown-and-known-attr-known-subsection.d | 25 +++++++++ ...ba-2-mix-unknown-and-known-subsections-1.s | 19 +++++++ ...ba-2-mix-unknown-and-known-subsections-2.s | 19 +++++++ .../ba-2-mix-unknown-and-known-subsections.d | 26 +++++++++ .../ba-2-required-subsec-A-1.s | 3 ++ .../ba-2-required-subsec-A-2.s | 3 ++ .../build-attributes/ba-2-required-subsec-B.s | 3 ++ .../ba-2-required-subsec-nok.d | 7 +++ .../ba-2-required-subsec-ok.d | 16 ++++++ 18 files changed, 324 insertions(+) create mode 100644 ld/testsuite/ld-aarch64/build-attributes/aarch64-build-attributes.exp create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-1-one-file.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-1-two-files-all-optional-1more-1missing.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-B.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-nok.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-ok.d diff --git a/ld/testsuite/ld-aarch64/build-attributes/aarch64-build-attributes.exp b/ld/testsuite/ld-aarch64/build-attributes/aarch64-build-attributes.exp new file mode 100644 index 00000000000..dda5df8e489 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/aarch64-build-attributes.exp @@ -0,0 +1,47 @@ +# Expect script for AARCH64 ELF tests related to GNU properties. +# Copyright (C) 2025 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +# Exclude non-aarch64-ELF targets. +if { ![is_elf_format] || ![istarget "aarch64*-*-*"] } { + return +} + +load_file $srcdir/$subdir/../lib/aarch64-elf-lib.exp + +set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] + +# See definition of run_ld_link_tests in testsuite/lib/ld-lib.exp for more +# details. +# set aarch64elflinktests { +# {"Build bti-plt-so for PLT tests" +# "-shared" "" +# "-I$srcdir/$subdir -defsym __property_bti__=1" +# {bti-plt-so.s} {} "libbti-plt-so.so"} +# } + +# if [check_shared_lib_support] { +# run_ld_link_tests $aarch64elflinktests +# } + +foreach t $test_list { + # We need to strip the ".d", but can leave the dirname. + run_dump_test [file rootname $t] \ + [list [list as "-I\$srcdir/\$subdir"]] +} \ No newline at end of file diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-1.s new file mode 100644 index 00000000000..48662096d2b --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-1.s @@ -0,0 +1,15 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 0 + +.aeabi_subsection gnu-testing-ba-2-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 0 +.aeabi_attribute 1, 1 + +.aeabi_subsection gnu-testing-ba-3-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "hello" +.aeabi_attribute 1, "world" + +.aeabi_subsection gnu-testing-ba-5-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "hello" +.aeabi_attribute 1, "world" diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-2.s new file mode 100644 index 00000000000..669fc769a2b --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-1-all-optional-2.s @@ -0,0 +1,15 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 + +.aeabi_subsection gnu-testing-ba-2-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 + +.aeabi_subsection gnu-testing-ba-4-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "foo" +.aeabi_attribute 1, "bar" + +.aeabi_subsection gnu-testing-ba-5-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "foo" +.aeabi_attribute 1, "bar" diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.d b/ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.d new file mode 100644 index 00000000000..684da464345 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.d @@ -0,0 +1,7 @@ +# name: Build attributes: mismatch subsection properties with ba-1-all-optional-1 +# source: ba-1-all-optional-1.s +# source: ba-1-mismatch-subsec-props-with-all-optional-1.s +# as: +# ld: -shared +#error: \A[^\n]*ba-1-all-optional-1\.o, [^:]*ba-1-mismatch-subsec-props-with-all-optional-1\.o: error: parameters of subsection 'gnu-testing-ba-1-MERGE-AND' are mismatching. \(optional, uleb128\) VS \(required, uleb128\)\n +#error: [^\n]*ba-1-all-optional-1\.o, [^:]*ba-1-mismatch-subsec-props-with-all-optional-1\.o: error: parameters of subsection 'gnu-testing-ba-2-MERGE-AND' are mismatching. \(optional, uleb128\) VS \(optional, ntbs\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.s new file mode 100644 index 00000000000..4e7d7d29060 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-1-mismatch-subsec-props-with-all-optional-1.s @@ -0,0 +1,2 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, required, uleb128 +.aeabi_subsection gnu-testing-ba-2-MERGE-AND, optional, ntbs diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-1-one-file.d b/ld/testsuite/ld-aarch64/build-attributes/ba-1-one-file.d new file mode 100644 index 00000000000..4f80f092675 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-1-one-file.d @@ -0,0 +1,42 @@ +# name: Build attributes: only one input object is copied to the output object +# source: ba-1-all-optional-1.s +# as: +# ld: -shared +# readelf: --arch-specific + +Subsections: + - Name: gnu-testing-ba-1-MERGE-AND + Scope: private + Length: 37 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 0 \(0x0\) + + - Name: gnu-testing-ba-2-MERGE-AND + Scope: private + Length: 37 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 0 \(0x0\) + Tag_unknown_1: 1 \(0x1\) + + - Name: gnu-testing-ba-3-MERGE-ADD + Scope: private + Length: 47 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "hello" + Tag_unknown_1: "world" + + - Name: gnu-testing-ba-5-MERGE-ADD + Scope: private + Length: 47 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "hello" + Tag_unknown_1: "world" diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-1-two-files-all-optional-1more-1missing.d b/ld/testsuite/ld-aarch64/build-attributes/ba-1-two-files-all-optional-1more-1missing.d new file mode 100644 index 00000000000..1b271424497 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-1-two-files-all-optional-1more-1missing.d @@ -0,0 +1,53 @@ +# name: Build attributes: 2 files, all optional, 1 more, 1 missing +# source: ba-1-all-optional-1.s +# source: ba-1-all-optional-2.s +# as: +# ld: -shared +# readelf: --arch-specific + +Subsections: + - Name: gnu-testing-ba-1-MERGE-AND + Scope: private + Length: 37 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 0 \(0x0\) + + - Name: gnu-testing-ba-2-MERGE-AND + Scope: private + Length: 37 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 0 \(0x0\) + Tag_unknown_1: 1 \(0x1\) + + - Name: gnu-testing-ba-3-MERGE-ADD + Scope: private + Length: 47 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "hello" + Tag_unknown_1: "world" + + - Name: gnu-testing-ba-4-MERGE-ADD + Scope: private + Length: 43 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "foo" + Tag_unknown_1: "bar" + + - Name: gnu-testing-ba-5-MERGE-ADD + Scope: private + Length: 55 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "hello\+foo" + Tag_unknown_1: "world\+bar" + diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-1.s new file mode 100644 index 00000000000..0076d693231 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-1.s @@ -0,0 +1,11 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 +.aeabi_attribute 2, 1 // Unknown tag +.aeabi_attribute 3, 1 // Unknown tag + +.aeabi_subsection gnu-testing-ba-2-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "foo" +.aeabi_attribute 1, "bar" +.aeabi_attribute 2, "foo2" // Unknown tag +.aeabi_attribute 3, "foo3" // Unknown tag diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-2.s new file mode 100644 index 00000000000..db468d5ae62 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection-2.s @@ -0,0 +1,11 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 +.aeabi_attribute 2, 1 // Unknown tag +.aeabi_attribute 4, 1 // Unknown tag + +.aeabi_subsection gnu-testing-ba-2-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "foo" +.aeabi_attribute 1, "bar" +.aeabi_attribute 2, "foo2" // Unknown tag +.aeabi_attribute 4, "foo4" // Unknown tag diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection.d b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection.d new file mode 100644 index 00000000000..5d710c981ce --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-attr-known-subsection.d @@ -0,0 +1,25 @@ +# name: Build attributes: unknown attribute inside known subsection should be removed from the output. +# source: ba-2-mix-unknown-and-known-attr-known-subsection-1.s +# source: ba-2-mix-unknown-and-known-attr-known-subsection-2.s +# as: +# ld: -shared +# readelf: --arch-specific + +Subsections: + - Name: gnu-testing-ba-1-MERGE-AND + Scope: private + Length: 37 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 1 \(0x1\) + + - Name: gnu-testing-ba-2-MERGE-ADD + Scope: private + Length: 51 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "foo\+foo" + Tag_unknown_1: "bar\+bar" diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-1.s new file mode 100644 index 00000000000..07c328ac5f2 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-1.s @@ -0,0 +1,19 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 0 + +.aeabi_subsection private-1, optional, uleb128 +.aeabi_attribute 0, 0 +.aeabi_attribute 1, 1 + +.aeabi_subsection private-2, optional, ntbs +.aeabi_attribute 0, "hello" +.aeabi_attribute 1, "world" + +.aeabi_subsection private-4, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 + +.aeabi_subsection gnu-testing-ba-2-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "hello" +.aeabi_attribute 1, "world" diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-2.s new file mode 100644 index 00000000000..1ba63da6fe9 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections-2.s @@ -0,0 +1,19 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 + +.aeabi_subsection private-1, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 + +.aeabi_subsection private-2, optional, ntbs +.aeabi_attribute 0, "foo" +.aeabi_attribute 1, "bar" + +.aeabi_subsection private-3, optional, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 + +.aeabi_subsection gnu-testing-ba-2-MERGE-ADD, optional, ntbs +.aeabi_attribute 0, "foo" +.aeabi_attribute 1, "bar" diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections.d b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections.d new file mode 100644 index 00000000000..eeeb7d33c7b --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-mix-unknown-and-known-subsections.d @@ -0,0 +1,26 @@ +# name: Build attributes: unknown subsections are removed from the output. +# source: ba-2-mix-unknown-and-known-subsections-1.s +# source: ba-2-mix-unknown-and-known-subsections-2.s +# as: +# ld: -shared +# readelf: --arch-specific + +Subsections: + - Name: gnu-testing-ba-1-MERGE-AND + Scope: private + Length: 37 + Optional: True + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 0 \(0x0\) + + - Name: gnu-testing-ba-2-MERGE-ADD + Scope: private + Length: 55 + Optional: True + Encoding: asciz + Values: + Tag_unknown_0: "hello\+foo" + Tag_unknown_1: "world\+bar" + diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-1.s new file mode 100644 index 00000000000..1d4ef909820 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-1.s @@ -0,0 +1,3 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, required, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 0 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-2.s new file mode 100644 index 00000000000..1d4ef909820 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-A-2.s @@ -0,0 +1,3 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, required, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 0 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-B.s b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-B.s new file mode 100644 index 00000000000..4b33b0bcc85 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-B.s @@ -0,0 +1,3 @@ +.aeabi_subsection gnu-testing-ba-1-MERGE-AND, required, uleb128 +.aeabi_attribute 0, 1 +.aeabi_attribute 1, 1 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-nok.d b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-nok.d new file mode 100644 index 00000000000..118543f7af3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-nok.d @@ -0,0 +1,7 @@ +# name: Build attributes: combine non-matching required subsections +# source: ba-2-required-subsec-A-1.s +# source: ba-2-required-subsec-B.s +# source: ba-2-required-subsec-A-2.s +# as: +# ld: -shared +#error: \A[^\n]*ba-2-required-subsec-A-1\.o, [^:]*ba-2-required-subsec-B\.o: error: mismatching values 0x0 and 0x1 for required object attribute 'GNUTestTag_1' in subsection 'gnu-testing-ba-1-MERGE-AND' diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-ok.d b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-ok.d new file mode 100644 index 00000000000..67242e2b9c5 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-2-required-subsec-ok.d @@ -0,0 +1,16 @@ +# name: Build attributes: combine matching required subsections +# source: ba-2-required-subsec-A-1.s +# source: ba-2-required-subsec-A-2.s +# as: +# ld: -shared +# readelf: --arch-specific + +Subsections: + - Name: gnu-testing-ba-1-MERGE-AND + Scope: private + Length: 37 + Optional: False + Encoding: ULEB128 + Values: + Tag_unknown_0: 1 \(0x1\) + Tag_unknown_1: 0 \(0x0\) From patchwork Mon Mar 10 17:51:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107599 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 AA5C03858CDB for ; Mon, 10 Mar 2025 18:04:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA5C03858CDB 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=ZM4cuwnv; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=ZM4cuwnv X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20617.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::617]) by sourceware.org (Postfix) with ESMTPS id BCB2F3858CD9 for ; Mon, 10 Mar 2025 17:54:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BCB2F3858CD9 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 BCB2F3858CD9 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2613::617 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629283; cv=pass; b=EtBxqQxRH6pBQrljclCfJiR1tKYgUxcT9bgsR2ps8HBNhF8M78vsnC1kkODioAgkTkNrwF2OUKZI8Tbzk1yz+27qZeNSAqD6PzG16TkULH59dGBqLOOaCaeWdY9uXwPis0NcNbzMQ5bfmcfEztFoKdp8Iv8NDa6XVSBGbZSpy/Q= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629283; c=relaxed/simple; bh=huEMV48iZAIiCXuDN9+5l852FRyrarkneu9yA0Q1zHM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ZzTETrU+F719vVIwaK15jy3ZR6jYlyu1jEJ8D0SFfsrori/Doa+aHp27USiRUfsw03Tga3Wfw6oaJOqsRSwMWQtBoNbXSk3Ndp06tyLpGwnrvKBhtsrLQTheZD10UDLS+xzWZENMiUr8pOnz61S9gNBTKytqZxE5xyr0DaYx4u0= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCB2F3858CD9 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=uj+IaMGrH1UbOIcQgP8jC3DeB4UDoCaSHwKVIieqOOEO33bQJoVolQ3w0zs7HPgPTHMMoY9ik5pTZCOWJEXgla45OZVG1/AXZeuaDdUAQieKKj158II2oduF4jn1YkV9KXuDC08myyVTjTgG1IFi4FTIWc3SME1ZKlO8Vy0ywjgxA1ZHAuT59BzcYYyQWbD+O+yqzmfnptgu9Xaok6l+KMlX1wSxOjm2SMDE7jOJvecXletXPKGq0gmuTc9UkJEnhR7KdzHK498FOxFSfOnKlnlB9YpCNzc3d09ccPWAcB9nh0yubqX5uz+8rQmaIsjuwGjDdCL8083RJ0mF9/X9dw== 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=TgUBmLYrfOpn8LmnKJ0y8zOTdE4Jwhykyy/eCVta7HU=; b=Eq3u7E9trsyAzhvdxzy9J/T9qNiFl1bcVEFeWHR4F+pBnOY/4AHzYSPem67+IRLUw+wQ/1D8ue/FcyJ/UMIdbKxbK3Ijyb2iV/equgpQvO6Vp7A3Qv3AaE2CsGURP2/+7MaJN888z2RXkTtqqhyxPFJOGo9o5BfJBLX2PpGMeXGl1niYAjP+JOSAn90GYcHR+FaaD9UrHOSeV8X8m38sGUsBkoto2ft+YsJPsRtgOJZArr0DPdpiIWFN6fv7BD9bbEIBRcdJQka3YitD/bfeJSgT/HewoaOFfXNbp1dbBbDW7s27MP1BvJSLCT5Dd4jMCu3me8nYYEWstU+bnPQJ+w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=TgUBmLYrfOpn8LmnKJ0y8zOTdE4Jwhykyy/eCVta7HU=; b=ZM4cuwnvPc5Or1mkd8pGmzkLQ6Krt/d6onh5MZ+bmPy/YaMIZm5iRvZf97VJGQ42y396lrwRKOt020u/xELjswM1aRHDrmxR7h5ZHmlpZ8wTp2Y7sg/49oa30gDhYmwuaK2f3hEkjHOz3uQ7dcmgfezUbTJwoI5AzDeRMgaWbwc= Received: from AS9PR04CA0086.eurprd04.prod.outlook.com (2603:10a6:20b:50e::24) by AM8PR08MB5842.eurprd08.prod.outlook.com (2603:10a6:20b:1d7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:54:37 +0000 Received: from AM3PEPF0000A796.eurprd04.prod.outlook.com (2603:10a6:20b:50e:cafe::3f) by AS9PR04CA0086.outlook.office365.com (2603:10a6:20b:50e::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.24 via Frontend Transport; Mon, 10 Mar 2025 17:54:37 +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=arm.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 AM3PEPF0000A796.mail.protection.outlook.com (10.167.16.101) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:54:35 +0000 Received: ("Tessian outbound 7c48d84d1965:v585"); Mon, 10 Mar 2025 17:54:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8ff5e8ed673c317e X-TessianGatewayMetadata: d7I+b0xrKIo0ywLQE7qc1u6T6u24Sd+AJ2MUHCtbDGRcAEb6vHO89/8WIMl+lDax4cnoxNfuyFAp8oyBqgTM/Qlie3xJMoDv2Yu52lDOCsC4NAEEy/NrtHu3purAfH41jpfu18pyBtQvL7O6iMAoUOkw+GwE82vCqoCkHYPydAY= X-CR-MTA-TID: 64aa7808 Received: from L200465245386.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F6CB811B-EEF1-4574-8FC8-5120AF565AF3.1; Mon, 10 Mar 2025 17:54:28 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L200465245386.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:54:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=THXO3m2+82yLbs6HXhs91Q/YPnVu8q5Q5Pa+1qQbRuQYRDZEEmwJJ2ZO+TurP0z75G3ppASd8U4K3QwgoJ1iQxtKRHCeDqb8nUOAadHgnrkdj1MGBYRqcnds/wIe4itoCdkCGTLj599AnFEGqMLAn27ysXTGsz5TZVsZBLx9aXMakDF9GKE4Pcehl80G6p7Htq5fIov9w8fqL824AvKZpA226e3KRyTi8SVoGd5eafejdkMfz0dWc7DcEOc4jwrbzQzeISN+kOPPZphYIJaMx2IDX/zHUIrmfXUquIm6f/jx5r3OjA3QZ4X6djc/nc09ZUx9RbeCQH0AKebHsIv+Fw== 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=TgUBmLYrfOpn8LmnKJ0y8zOTdE4Jwhykyy/eCVta7HU=; b=Wrlx6UintYGVdeWLYu9+Z3FAAIKfbOwXzS2WJ/MSsjiV3jHCs4drCSz0VQUnYOZ8GBMjJ8OiPrd7XwMQ607j934rVh1GDE4qWCSBLisBSpkqrj4EhZrvgW37vwXEkaYjgQZLnKmGZryE4gosVzX3i5QPLD4OxYBDePGbTg6EuABkfVbPLuBrSH+ob0zDrvUVHiOYqRK8VYXJi3FRUzk42H1GsxTou3L903sFoXZ7ofesplJPla3UndmR34Hu4K1ke8wwfZe3k9uLAML6qgji82q3pgafMmN+dcOZ+SsUmarlANVO/EGvJMmY0BR1hd728WsjuSMgk5iX3LNtkqBREg== 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=TgUBmLYrfOpn8LmnKJ0y8zOTdE4Jwhykyy/eCVta7HU=; b=ZM4cuwnvPc5Or1mkd8pGmzkLQ6Krt/d6onh5MZ+bmPy/YaMIZm5iRvZf97VJGQ42y396lrwRKOt020u/xELjswM1aRHDrmxR7h5ZHmlpZ8wTp2Y7sg/49oa30gDhYmwuaK2f3hEkjHOz3uQ7dcmgfezUbTJwoI5AzDeRMgaWbwc= Received: from AS8P189CA0008.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:31f::16) by AM9PR08MB6001.eurprd08.prod.outlook.com (2603:10a6:20b:2d5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:54:22 +0000 Received: from AM4PEPF00027A63.eurprd04.prod.outlook.com (2603:10a6:20b:31f:cafe::42) by AS8P189CA0008.outlook.office365.com (2603:10a6:20b:31f::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.27 via Frontend Transport; Mon, 10 Mar 2025 17:54:22 +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 AM4PEPF00027A63.mail.protection.outlook.com (10.167.16.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:54:22 +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; Mon, 10 Mar 2025 17:54:11 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:54:11 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 14/15] ld's BAs merge saga, step two: AArch64 backend's support for AEABI-specific BAs Date: Mon, 10 Mar 2025 17:51:27 +0000 Message-ID: <20250310175131.1217374-15-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A63:EE_|AM9PR08MB6001:EE_|AM3PEPF0000A796:EE_|AM8PR08MB5842:EE_ X-MS-Office365-Filtering-Correlation-Id: 24d8a962-11b3-412f-cf42-08dd5ffc9efb 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|36860700013|82310400026|13003099007; X-Microsoft-Antispam-Message-Info-Original: 7aT7Y49bzNQFy2Wlq2E+X02IAVdPXskSpirqBCunhpB2dki4aPvihf2NchX3K/t748MTrfoRSIWMcY9aqBx+tuf/1Uay0M+vqJVC8TkrpUj9k2DQmqwVBKZvWE7iV6RKvs/HuermhD2kY7oS/wFjW053O6sZ+RgW7xmbcAAlb1tNu+2aFKn9/HR/QoRD6WP1LIGusRK+WJIY4vbFMghsBycLm86EXcCvFU6jzlDX9KH5I4LytvsWIb/mrEtU9pPcmOkxx1VhenJbdINj0HsyJfxbOrfoOwMlr9cnfJf8wmk93bKdZh4AX0UUScjsM42ehYeEx33pHP38fLZuD82FYWMhK+59bDDLdlrgoyF+4WodX/9p2q++lfF24wcNFdgmHJ5zKDO72atVjvD/qNjPJeVBL5YFaPkGGxA6ZLh8i/X1fldrCL7xwWLascwMRV8x68ymIPL/5nG40U6+oz5btriDw6McsU0G5p8mjXoUpDEPcAZzQGr2rIWb6ctUnXLB65DmwYfch3MjuLfX9TUvOwhQ7EOEFUMFsdVWZCgI0iV5pnyn8x4Ip8ooNT97lgbmSDodM04EHIh8BbhcW7iogFKBTR1xHSoUuYtKEqma94ISctS4Bg3bfpTv9j3Kb/ka3KffrMkVYOHSzjaE/8TGextynoBweatzWgrz29AVDmkQFtM9XOxojB8KN88xHpAAZBKZmHoN9DD8Nb2C+VKEQBz32l85chXJ97yaJbRv08CCmzVBGu55F3GX+PtGD2TWtkqQGGbpfrXXy95vph1rTrzcwDVZC79rfkVePkUBJsYy08uZ7JBYlL2zULWd+Atfo86OotT0n7c2LYJv3kxvNfY8rgsFZTHW9+jOozjT7lgZyic/rwZG5LdYXw/Q1IaTyMIfjFejUxy8ZqojM4timIsvs6ax5Q9VCCeYF2jc/qx5pPGRsdsgcAB0MPgOtr3SctUIQG1+a9b6DA7O/bbu57OhpuY4RiGekEVjqbHUxcvH+hQKeIeGFrAXtSJrvNfE7NGD4p3n/W5zhETTRGBc5YViXD3gQ8Sixd2MTI0FXxxF3za4fS+4zw3uhyP6gWM4feNGdVjlJ6GutMd+ETjI1peeCuJyOSYY8wJ2GoHI7ZmXlwGeF/vjNbocHkQyGfOG8tTO5Wg8YBwkxiK7Iu9vVkoEVTEeOO+wtLyD4NJ+QNYm9pvay4EtP0x6lrUuqsO65WH++9KDmGU21WVI7MhQlhFMz7+UB3lrCoIf+KWSp7tqFdDwlFbBPyXfSsHjPmg5ZwR0hgy+rYf2yRF3VsDZIdd8RlRIXI37sfcAqIxeWWV1qTALX2voSIxDhpXfAFQWo9SACF8cGcFpA2wJMFKRrszw4lIfFnmUJC9s42l66D9395DUuKM7XXDAHjxaKezSlvBr/8aaT/w0SrYVIZeWyasOo1QDhaKn6IfUzR2379rZTw/bannCTGGVngFxhmhak8xKPU0sHN0pHcPD6pCuCiLE/clYdyKrFX3Zt67LxWc= 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)(36860700013)(82310400026)(13003099007); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6001 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:31f::16]; domain=AS8P189CA0008.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A796.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: bcebcada-8df7-45c2-c46e-08dd5ffc96ef X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|1800799024|35042699022|14060799003|82310400026|13003099007; X-Microsoft-Antispam-Message-Info: v+Full106aPq/E2VcOvAuHrM2m4v+waCteZ37YlsHIGncWV4iWMuSjFsA5iPI8NjZKrj/vFIf+9Em6GDDMruTLnIud99s1VOQZvZRqLg3Y3tKNQZvHkQRfL2IMu/NWRLJbhKPSAsCFbRquU9ZOR60X0Yibqtww/hPa5DF/pJdk5mOrkCI0vcYtzuPjenmE9lK/K3T+3ew58vFqgdhPnn/7XqgP8Qnum4PgWIWEeyHjfD5Y4S86/hLA/puAXECviyBrZp0laQsXGw5UYRVwdGX1Rr/ki4ibINUjeycoHH/DbE9nRTKf7jkke1y5+9AuWg0LgILdjc8HvZr+zzjwHyKpeJfri5Cq/XZVEeIlurfndOZMS49zd9aDWwxYdAx1OfJrvuwkVONzLYZPSK9uoYillOwmOlTFXszXh2WoUusrKsQ6FkCM4zrXxP8v6ZeyOIL6hLefZkyqTLF1VEA/hk7BQZ+9WjHwR4JRMKhg7LmpvecHaMBQnupU9KclteXRgz3VwBNPXfPCtzT7Gql1CXItWCrIDpnotJ362ycHsF3ww5fMNLZ4FBFsnhPSGW40R6Y/P2Np4xWsyXeOc4k6ThOk4t606xzkqIBGOS5wfEOaa7fY8lZPbz9H9PY04TlvA24YIc+ocQQ/vKbf2Z8246DdCCAqxR1+ajuAVyGg3npb/9wP1sk/FLCWLj64U/OycR/Y+v0tEIki3dpvPGyN9gAgNXmXOlzl7QEFXJDK1D4wSZZLoaDTvFOJQ+osN42H4p4p9xm3SC+E9AaMEUkyBJIq1pZ1si8IuMXbc51UgEGHTy52VurW+0qOT9iJF1a9GvsrhmXrt8uUYLVr2PhLoE0tteH06zLvgi34D0YC4Pj2OFmi6HxQfkV8q9oh/ZuI17OlFyRBOGie5zdjPy5772DvgpvbeqrW391vg0LYTSXCA2QcYr2OfyHJjhASiE7veKJ+AwYngsBShV0WgOW4SvgC24d4pukpCQ/Y9xHMY4q62hSQfuD8q/WAaYyIylDaTgCa/jN9uLtKvbwn+3YCCPshq253yvO6vgz9i+xkr+fdPum4p7K9PQ6A4fijuOzTNMSNQhJ3btPVObmmpqelmOaTKqF3ZuFtB520+ePZUH5pB8fR1ClqKbMosHMcvNDtk/0AW+EaLtla6jBTiuto0RHISeEPgCbN6qP4sZF6/ow/ZunZYvCkkwMKQ4v735zR57QjWDCEPyfWecNqZjQPFoVibPHNqXpLbnHoN0PUHtYMAKLBBxnf/65AK5O7KEGWohQJVIk5pOJ8sUZVaPO762K9/dOtHpcRBafx3XkouN0Fbp66zwhdMGxoi5iGjKVKa+G5SqxfEQl1pvfB/H5+F4+44ULmEvPthiqbZO6d0olqD70tT4O72X1iP1oMDgif8AwD1Vvn8cvXtbm8sy30u5sbxAK01NHJHbOcwNIbGn9oINVChgXUR/UCTX5rjHGSxJ7Z5h1iNdWYBLScOK2Z5sH+UDeTa2HpKYjOMXJf202ks= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(36860700013)(376014)(1800799024)(35042699022)(14060799003)(82310400026)(13003099007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:54:35.9553 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24d8a962-11b3-412f-cf42-08dd5ffc9efb 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: AM3PEPF0000A796.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5842 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 - declare known subsections and tags for AEABI build attributes. - define AArch64 backend handlers for: - obj_attr_subsection_v2_match_known - obj_attr_v2_default_value - obj_attr_v2_tag_merge - setup_build_attributes - translate_relevant_gnu_props_to_obj_attrs - translate_relevant_obj_attrs_to_gnu_props - set global build attributes from command-line options for BTI and GCS. - translate GNU_PROPERTY_AARCH64_FEATURE_1_AND in input files to its BAs equivalents. - report incompatibilities for BTI and GCS. - set BTI PLT type depending on the merge result. - translate BAs in subsection "aeabi_feature_and_bits" to GNU_PROPERTY_AARCH64_FEATURE_1_AND as GNU properties are required for the runtime linker (it does not understand BAs yet). --- bfd/elfnn-aarch64.c | 101 ++++++++++++++- bfd/elfxx-aarch64.c | 306 ++++++++++++++++++++++++++++++++++++++++++-- bfd/elfxx-aarch64.h | 36 ++++++ 3 files changed, 426 insertions(+), 17 deletions(-) diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 21fc99c4c98..9bb36fd550c 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -5023,27 +5023,54 @@ bfd_elfNN_aarch64_set_options (struct bfd *output_bfd, elf_aarch64_tdata (output_bfd)->no_enum_size_warning = no_enum_warn; elf_aarch64_tdata (output_bfd)->no_wchar_size_warning = no_wchar_warn; + /* The global list of build attributes used to save requested features from + the command-line options. */ + obj_attr_subsection_v2 *attrs_subsection = + _bfd_elf_obj_attr_subsection_v2_init ("aeabi_feature_and_bits", + SUBSEC_PUBLIC, true, ULEB128); + /* Note: gnu_property_aarch64_feature_1_and was initialized to 0 by bfd_zalloc(). */ if (sw_protections->plt_type & PLT_BTI) - elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and - |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; + { + elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and + |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; + _bfd_aarch64_record_obj_attr_v2 (attrs_subsection, Tag_Feature_BTI, true); + } + + /* Note: Contrarilly to PLT_BTI, (sw_protections->plt_type & PLT_PAC) == true + does not mean that Tag_Feature_PAC should also be set to true. The PAC + build attribute is only there to mirror the existing GNU properties. + Adding a property for PAC was in retrospect a mistake as it does not carry + valuable information. The only use it does have is informational: if the + property is set on the output ELF object, then someone went to the trouble + of enabling it on all the input objects. */ switch (sw_protections->gcs_type) { case GCS_ALWAYS: - elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and - |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + { + elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and + |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + _bfd_aarch64_record_obj_attr_v2 (attrs_subsection, Tag_Feature_GCS, true); + } break; case GCS_NEVER: - elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and - &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + { + elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and + &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + _bfd_aarch64_record_obj_attr_v2 (attrs_subsection, Tag_Feature_GCS, false); + } break; case GCS_IMPLICIT: /* GCS feature on the output bfd will be deduced from input objects. */ break; } + if (attrs_subsection->size > 0) + LINKED_LIST_APPEND(obj_attr_subsection_v2) ( + &elf_obj_attr_subsections (output_bfd), attrs_subsection); + elf_aarch64_tdata (output_bfd)->sw_protections = *sw_protections; /* Inherit the value from '-z gcs-report' if the option '-z gcs-report-dynamic' was not set on the command line. However, the inheritance mechanism is @@ -10395,7 +10422,8 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, return true; } -/* Check if BTI enabled PLTs are needed. Returns the type needed. */ +/* Check if BTI-enabled (and/or PAC-enabled) PLTs are needed. + Returns the type needed. */ static aarch64_plt_type get_plt_type (bfd *abfd) { @@ -10515,6 +10543,41 @@ elfNN_aarch64_backend_symbol_processing (bfd *abfd, asymbol *sym) sym->flags |= BSF_KEEP; } +/* Implement elf_backend_setup_build_attributes for AArch64. */ +static bfd * +elfNN_aarch64_link_setup_build_attributes (struct bfd_link_info *info) +{ + bfd *pbfd = _bfd_aarch64_elf_link_setup_build_attributes (info); + + struct elf_aarch64_obj_tdata * tdata = elf_aarch64_tdata (info->output_bfd); + + /* When BTI is forced on the command line, information flows from plt_type to + the frozen build attributes (a.k.a FROZEN), so plt_type has already been + set and FROZEN don't have any effect on plt_type. + Whereas if BTI is inferred from the input bfds, information flows from + output build attributes to plt_type. If the property GNU_PROPERTY_AARCH64 + _FEATURE_1_BTI has been set on all the input bfds, then BTI is set on the + output bfd and plt_type is updated accordingly. + + Important note: this is not true for GNU_PROPERTY_AARCH64_FEATURE_1_PAC. + See more explanation in bfd_elfNN_aarch64_set_options. */ + obj_attr_subsection_v2 *aeabi_feature_and_bits_subsec = + obj_attr_subsection_v2_find_by_name ( + elf_obj_attr_subsections (info->output_bfd).first_, + "aeabi_feature_and_bits", true); + if (aeabi_feature_and_bits_subsec != NULL) + { + obj_attr_v2 *attr_bti = obj_attr_v2_find_by_tag + (aeabi_feature_and_bits_subsec, Tag_Feature_BTI, true); + if (attr_bti && attr_bti->vals.uint_val == 1) + tdata->sw_protections.plt_type |= PLT_BTI; + } + + setup_plt_values (info, tdata->sw_protections.plt_type); + + return pbfd; +} + /* Implement elf_backend_setup_gnu_properties for AArch64. It serves as a wrapper function for _bfd_aarch64_elf_link_setup_gnu_properties to account for the effect of GNU properties of the output_bfd. */ @@ -10732,9 +10795,27 @@ const struct elf_size_info elfNN_aarch64_size_info = #define elf_backend_symbol_processing \ elfNN_aarch64_backend_symbol_processing +#define elf_backend_setup_build_attributes \ + elfNN_aarch64_link_setup_build_attributes + #define elf_backend_setup_gnu_properties \ elfNN_aarch64_link_setup_gnu_properties +#define elf_backend_translate_relevant_gnu_props_to_obj_attrs \ + _bfd_aarch64_translate_relevant_gnu_props_to_obj_attrs + +#define elf_backend_translate_relevant_obj_attrs_to_gnu_props \ + _bfd_aarch64_translate_relevant_obj_attrs_to_gnu_props + +#define elf_backend_obj_attr_subsection_v2_match_known \ + _bfd_aarch64_obj_attr_subsection_v2_match_known + +#define elf_backend_obj_attr_v2_default_value \ + _bfd_aarch64_obj_attr_v2_default_value + +#define elf_backend_obj_attr_v2_tag_merge \ + _bfd_aarch64_obj_attr_v2_tag_merge + #define elf_backend_merge_gnu_properties \ elfNN_aarch64_merge_gnu_properties @@ -10775,6 +10856,12 @@ const struct elf_size_info elfNN_aarch64_size_info = #define elf_backend_obj_attrs_section_type SHT_AARCH64_ATTRIBUTES #undef elf_backend_obj_attrs_version #define elf_backend_obj_attrs_version 2 +/* Object attributes v2 specific values. */ +#undef elf_backend_obj_attr_v2_known_subsections +#define elf_backend_obj_attr_v2_known_subsections \ + aarch64_obj_attr_v2_known_subsections +#undef elf_backend_obj_attr_v2_known_subsections_size +#define elf_backend_obj_attr_v2_known_subsections_size 2 #include "elfNN-target.h" diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index 45a02058e81..31810f9eb19 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -21,6 +21,7 @@ #include "sysdep.h" #include "bfd.h" #include "elf-bfd.h" +#include "elf/aarch64.h" #include "elfxx-aarch64.h" #include "libbfd.h" #include @@ -868,6 +869,279 @@ _bfd_aarch64_elf_check_gnu_properties_linked_dynamic_objects ( pbfd); } +/* Note: this array has to be sorted. */ +static const known_tag_v2 known_tags_aeabi_feature_and_bits [] = +{ + {Tag_Feature_BTI, OBJ_ATTR_TAG_v2(Feature_BTI), .default_value.uint_val = 0}, + {Tag_Feature_PAC, OBJ_ATTR_TAG_v2(Feature_PAC), .default_value.uint_val = 0}, + {Tag_Feature_GCS, OBJ_ATTR_TAG_v2(Feature_GCS), .default_value.uint_val = 0}, +}; +/* This is a required subsection to use PAuthABI (which is currently + unsupported by GCC). A value of 0 for any the tags below means that + the user did not permit this entity to use the PAuthABI. + Note: this array has to be sorted. */ +static const known_tag_v2 known_tags_aeabi_pauthabi [] = +{ + {Tag_PAuth_Platform, OBJ_ATTR_TAG_v2(PAuth_Platform), .default_value.uint_val = 0}, + {Tag_PAuth_Schema, OBJ_ATTR_TAG_v2(PAuth_Schema), .default_value.uint_val = 0}, +}; + +/* Note: this array is exported by the backend, and needs to be sorted. */ +const known_subsection_v2 aarch64_obj_attr_v2_known_subsections[] = +{ + { + .subsec_name = "aeabi_feature_and_bits", + .known_tags = known_tags_aeabi_feature_and_bits, + .optional = true, + .encoding = ULEB128, + .len = sizeof (known_tags_aeabi_feature_and_bits) / sizeof (known_tag_v2), + }, + { + .subsec_name = "aeabi_pauthabi", + .known_tags = known_tags_aeabi_pauthabi, + .optional = false, + .encoding = ULEB128, + .len = sizeof (known_tags_aeabi_pauthabi) / sizeof (known_tag_v2), + }, +}; + +void +_bfd_aarch64_record_obj_attr_v2 (obj_attr_subsection_v2 *subsec, + Tag_Feature_XXX feature_tag, + uint32_t value) +{ + union obj_attr_value_v2 data; + data.uint_val = value; + obj_attr_v2 *attr = _bfd_elf_obj_attr_v2_init (feature_tag, data); + LINKED_LIST_APPEND(obj_attr_v2) (subsec, attr); +} + +/* Translate the relevant GNU properties to object attributes v2. */ +void +_bfd_aarch64_translate_relevant_gnu_props_to_obj_attrs ( + bfd *abfd, + elf_property_list *p) +{ + void + _record_tag_value (obj_attr_subsection_v2 *subsec, + Tag_Feature_XXX tag, + bool value) + { + obj_attr_v2 *attr; + attr = obj_attr_v2_find_by_tag (subsec, tag, false); + if (attr != NULL) + { + if (attr->vals.uint_val != value) + { + /* translate_relevant_gnu_props_to_obj_attrs is only called when + parsing .note.gnu.property section, and this happens before the + parsing of the build attributes. + If we find an existing value for the given object attributes and + this value is different from the new one, it can mean two things: + - either the values are conflicting, and we need to raise an + error. + - either there are several GNU properties AARCH64_FEATURE_1_AND + which were recorded, but its final value is the result of the + merge of those separate values. + For now, only case 2 occurs. */ + uint32_t merged_val = attr->vals.uint_val | value; + _bfd_aarch64_record_obj_attr_v2 (subsec, tag, merged_val); + } + // else: nothing to do + } + else + _bfd_aarch64_record_obj_attr_v2 (subsec, tag, value); + } + + if (p->property.pr_type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + elf_property *prop = &p->property; + BFD_ASSERT (prop->pr_kind == property_number); + + obj_attr_subsection_v2 *subsec = obj_attr_subsection_v2_find_by_name + (elf_obj_attr_subsections (abfd).first_, "aeabi_feature_and_bits", false); + + bool new_subsec = false; + if (subsec == NULL) + { + subsec = _bfd_elf_obj_attr_subsection_v2_init ( + "aeabi_feature_and_bits", SUBSEC_PUBLIC, true, ULEB128); + new_subsec = true; + } + + bool bti_bit = prop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI; + bool pac_bit = prop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_PAC; + bool gcs_bit = prop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + + _record_tag_value (subsec, Tag_Feature_BTI, bti_bit); + _record_tag_value (subsec, Tag_Feature_PAC, pac_bit); + _record_tag_value (subsec, Tag_Feature_GCS, gcs_bit); + + if (new_subsec) + LINKED_LIST_APPEND(obj_attr_subsection_v2) ( + &elf_obj_attr_subsections (abfd), subsec); + } +} + +void +_bfd_aarch64_translate_relevant_obj_attrs_to_gnu_props ( + bfd *abfd, + obj_attr_subsection_v2 *subsec) +{ + /* Note: there is no need to create the GNU properties section here. It will + be handled later by setup_gnu_properties. */ + + if (strcmp (subsec->name, "aeabi_feature_and_bits") == 0) + { + uint32_t gnu_property_aarch64_features = 0; + + for (obj_attr_v2 *attr = subsec->first_; attr != NULL; attr = attr->next) + { + if (attr->tag == Tag_Feature_BTI && attr->vals.uint_val == 1) + gnu_property_aarch64_features |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; + else if (attr->tag == Tag_Feature_PAC && attr->vals.uint_val == 1) + gnu_property_aarch64_features |= GNU_PROPERTY_AARCH64_FEATURE_1_PAC; + else if (attr->tag == Tag_Feature_GCS && attr->vals.uint_val == 1) + gnu_property_aarch64_features |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + } + + /* Note: _bfd_elf_get_property find the existing property, or create one. + The insertion is already done by it. */ + elf_property *prop = + _bfd_elf_get_property (abfd, GNU_PROPERTY_AARCH64_FEATURE_1_AND, 4); + prop->u.number |= gnu_property_aarch64_features; + prop->pr_kind = property_number; + } +} + +/* Check whether a subsection is known, and if so, whether the current + properties of the subsection match the expected ones. + Return True if the subsection is known from the backend, OR all the + properties of the subsection match the expected. False otherwise. */ +bool +_bfd_aarch64_obj_attr_subsection_v2_match_known (struct bfd_link_info *info, + bfd *abfd, + obj_attr_subsection_v2 *subsec) +{ + const known_subsection_v2 *subsec_info = + identify_subsection (get_elf_backend_data (abfd), subsec->name); + + bool match = true; + if (subsec_info == NULL) + return match; + + if (subsec_info->encoding != subsec->encoding) + { + info->callbacks->einfo (_("%X%pB: error: encoding property of subsection " + "'%s' was incorrectly set. Got '%s', expected '%s'.\n"), + abfd, subsec->name, + obj_attr_encoding_v2_to_string (subsec->encoding), + obj_attr_encoding_v2_to_string (subsec_info->encoding)); + match = false; + } + if (subsec_info->optional != subsec->optional) + { + info->callbacks->einfo (_("%X%pB: error: optional property of subsection " + "'%s' was incorrectly set. Got '%s', expected '%s'.\n"), + abfd, subsec->name, + obj_attr_subsection_v2_optional_to_string (subsec->optional), + obj_attr_subsection_v2_optional_to_string (subsec_info->optional)); + match = false; + } + return match; +} + +/* True if the default value for the tag is managed by the backend. + False otherwise. */ +bool +_bfd_aarch64_obj_attr_v2_default_value (struct bfd_link_info *info, + const known_tag_v2 *tag_info, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *attr) +{ + (void) info; + (void) tag_info; + (void) subsec; + (void) attr; + + /* For now, there is no default value set by the backend. The default BTI and + GCS values are set by the respective command-line options '-z force-bti' + and '-z gcs'. */ + + return false; +} + +/* True, the tag needs to be merged, False don't merge. */ +obj_attr_v2_merge_result +_bfd_aarch64_obj_attr_v2_tag_merge (struct bfd_link_info *info, + bfd *abfd, + obj_attr_subsection_v2 *subsec, + obj_attr_v2 *lhs, obj_attr_v2 *rhs, + obj_attr_v2 *frozen) +{ + obj_attr_v2_merge_result res = { + .merge = false, + .vals.uint_val = 0, + .reason = NONE, + }; + + /* No need to list required sections here, they are handled separately as + they require a perfect one-to-one match for all the tag values. */ + if (strcmp (subsec->name, "aeabi_feature_and_bits") == 0) + { + BFD_ASSERT (subsec->encoding == ULEB128 && subsec->optional); + const known_tag_v2 *tag_info = + known_obj_attr_v2_find_by_tag (get_elf_backend_data (abfd), + subsec->name, lhs->tag); + if (tag_info == NULL) + { + info->callbacks->einfo (_("%pB: warning: cannot merge unknown tag " + "Tag_unknown_%u (=0x%x) in subsection '%s'.\n"), abfd, rhs->tag, + rhs->vals.uint_val, subsec->name); + res.reason = UNSUPPORTED; + return res; + } + + /* For now, there is no different between the tags of this section, all + will be merged in the same way. */ + res = obj_attr_v2_tag_merge_AND (info, abfd, subsec, lhs, rhs, frozen); + + const aarch64_protection_opts *sw_protections + = &elf_aarch64_tdata (info->output_bfd)->sw_protections; + aarch64_feature_marking_report bti_report = sw_protections->bti_report; + aarch64_feature_marking_report gcs_report = sw_protections->gcs_report; + + if ((rhs->tag == Tag_Feature_BTI) && (bti_report != MARKING_NONE) + && (sw_protections->plt_type & PLT_BTI) && (rhs->vals.uint_val == 0)) + _bfd_aarch64_elf_check_bti_report (info, abfd); + + if ((rhs->tag == Tag_Feature_GCS) && (gcs_report != MARKING_NONE) + && (sw_protections->gcs_type == GCS_ALWAYS) && (rhs->vals.uint_val == 0)) + _bfd_aarch64_elf_check_gcs_report (info, abfd); + + /* Make sure that frozen bits don't disappear from REF when it will be + compared to the next file. */ + if (frozen != NULL) + res.vals.uint_val |= frozen->vals.uint_val; + } + else + res.reason = UNSUPPORTED; + + return res; +} + +bfd * +_bfd_aarch64_elf_link_setup_build_attributes (struct bfd_link_info *info) +{ + bfd *pbfd = _bfd_elf_link_setup_build_attributes (info); + + /* Set the flag marking whether the merge of build attributes was done so + that setup_gnu_properties does not raise the same errors/warning again. */ + elf_aarch64_tdata (info->output_bfd)->ba_merge_done = true; + + return pbfd; +} + /* Find the first input bfd with GNU property and merge it with GPROP. If no such input is found, add it to a new section at the last input. Update GPROP accordingly. */ @@ -888,14 +1162,24 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info) Note: If there is no .gnu.note.property section, we might think that elf_properties (res.pbfd) is always NULL. However, this is not always - true. In PR23900: old linkers were treating .note.gnu.property as a - generic note section, so old objects might contain properties inside - .note instead of .note.gnu.property. In this case, the section won't be - detected but the properties are still parsed. Consequently, - elf_properties (res.pbfd) is populated and different from NULL (see - https://sourceware.org/bugzilla/show_bug.cgi?id=23900 for more - details). */ - if (res.sec == NULL && elf_properties (res.pbfd) == NULL) + true for the following reasons: + - PR23900: old linkers were treating .note.gnu.property as a generic + note section, so old objects might contain properties inside .note + instead of .note.gnu.property. In this case, the section won't be + detected but the properties are still parsed. Consequently, + elf_properties (res.pbfd) is populated and different from NULL (see + https://sourceware.org/bugzilla/show_bug.cgi?id=23900 for more + details). + - since the introduction of the build attributes, once the merge + of the BAs is done, some of the BAs can be translated to GNU + properties like GNU_PROPERTY_AARCH64_FEATURE_1_AND. In this case, + we need to check explicitly for the presence of the GNU properties + that might be added by the BAs merge. */ + if (res.sec == NULL + && (elf_properties (res.pbfd) == NULL + || _bfd_elf_find_property (elf_properties (res.pbfd), + GNU_PROPERTY_AARCH64_FEATURE_1_AND, + NULL))) _bfd_aarch64_elf_create_gnu_property_section (info, res.pbfd); /* Merge the found input property with output properties. Note: if no @@ -1110,7 +1394,8 @@ _bfd_aarch64_elf_check_bti_report (struct bfd_link_info *info, bfd *ebfd) { struct elf_aarch64_obj_tdata *tdata = elf_aarch64_tdata (info->output_bfd); - if (tdata->sw_protections.bti_report == MARKING_NONE) + if (elf_aarch64_tdata (info->output_bfd)->ba_merge_done + || tdata->sw_protections.bti_report == MARKING_NONE) return; ++tdata->n_bti_issues; @@ -1144,7 +1429,8 @@ _bfd_aarch64_elf_check_gcs_report (struct bfd_link_info *info, bfd *ebfd) } else { - if (tdata->sw_protections.gcs_report == MARKING_NONE) + if (elf_aarch64_tdata (info->output_bfd)->ba_merge_done + || tdata->sw_protections.gcs_report == MARKING_NONE) return; ++tdata->n_gcs_issues; if (tdata->n_gcs_issues > GNU_PROPERTY_ISSUES_MAX) diff --git a/bfd/elfxx-aarch64.h b/bfd/elfxx-aarch64.h index 506f4a93c9d..c30f41b30c0 100644 --- a/bfd/elfxx-aarch64.h +++ b/bfd/elfxx-aarch64.h @@ -107,6 +107,9 @@ struct elf_aarch64_obj_tdata /* Software protections options. */ struct aarch64_protection_opts sw_protections; + /* The merge of build attributes already occured. */ + bool ba_merge_done; + /* Number of reported BTI issues. */ int n_bti_issues; @@ -209,6 +212,39 @@ _bfd_aarch64_elf_write_core_note (bfd *, char *, int *, int, ...); #define elf_backend_grok_psinfo _bfd_aarch64_elf_grok_psinfo #define elf_backend_write_core_note _bfd_aarch64_elf_write_core_note +extern const known_subsection_v2 aarch64_obj_attr_v2_known_subsections[]; + +extern bfd * +_bfd_aarch64_elf_link_setup_build_attributes (struct bfd_link_info *); + +extern void +_bfd_aarch64_record_obj_attr_v2 (obj_attr_subsection_v2 *, Tag_Feature_XXX, + uint32_t); + +extern void +_bfd_aarch64_translate_relevant_gnu_props_to_obj_attrs (bfd *, + elf_property_list *); + +extern void +_bfd_aarch64_translate_relevant_obj_attrs_to_gnu_props (bfd *, + obj_attr_subsection_v2 *); + +extern bool +_bfd_aarch64_obj_attr_subsection_v2_match_known (struct bfd_link_info *, + bfd *, + obj_attr_subsection_v2 *); + +extern bool +_bfd_aarch64_obj_attr_v2_default_value (struct bfd_link_info *, + const known_tag_v2 *, + obj_attr_subsection_v2 *, + obj_attr_v2 *); + +extern obj_attr_v2_merge_result +_bfd_aarch64_obj_attr_v2_tag_merge (struct bfd_link_info *, bfd *, + obj_attr_subsection_v2 *, obj_attr_v2 *, + obj_attr_v2 *, obj_attr_v2 *); + extern bfd * _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *); From patchwork Mon Mar 10 17:51:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 107603 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 4F4633858C31 for ; Mon, 10 Mar 2025 18:12:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F4633858C31 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=rUR0BB+b; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=rUR0BB+b X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20627.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::627]) by sourceware.org (Postfix) with ESMTPS id C611D385840C for ; Mon, 10 Mar 2025 17:54:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C611D385840C 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 C611D385840C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::627 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629281; cv=pass; b=Vh/+MrzLutIfif8XpIUISsEHnvxHf73rEomsEbE13MF4Op+s3y9UKECpsN3aebbTtHXPJ75GUbJLF19P09kliMYevDoU+ob1InIljrso06ggRLuQ224+6M6JamSmtUl6ZKY2rq5hi8RxL4vqj2d2PGZt9fAUCkW8a/2jdJVBgJY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1741629281; c=relaxed/simple; bh=ary4G6t+QwH3CBq5BX1/14/Ar0VNgdpgWW02qVdz3rY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=C+avS+bpztoPbIE35zv19rCgSYxPJahW0r5QfHoAfUH3hFwWpoevh8HsVCZPtyH1ayPBujFMdyZlL2GVFvdXOqxipekuWLGwm2McdSYp8T7/WMQ/TrbvsOZwsJ8C0YkUNoNgXnzr0foCBGOFr6vaUGz7jqnmxGhMJh9lPrnh+Y0= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C611D385840C ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=lnlyrQTzp+voTYnWHizn//0yg7HJ0g6x3iW4ENsrczZqjrtxhZ77C1iE0SlUeUDZexCwaZhlcN8tnabNEqe1jEbrZhkMBLaKn9j7JE9Nf/Y6bcmJDR4FS7SaOg1IriRPSkhXzWpPaVKjiz5lwycCbqq/ykU0z/ssab6O6Jt2lg0F9IvuYgN87HY6BgEb2znyvve6+iG7bnkx/KSBvwLBpy3QsmRaUIa0KAaojdhAqE4U5591DmNWpJ6ZYAjFg4xUmUeGftbnpoGfLx/hsv6djTA1ygWJnLP4cQ2WOj6QRiKG7dajg1PYN30ZFMFYBxmkTNtQhqsNcstq+rndrcxRWQ== 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=6MHSKZNfmsnYvIUX9yiOX+s/1qgGezWFiL0YrA05Jws=; b=ItvVNS2q/hrvC3hoeiLdvX5cy2aOPdFOSbugmoTM9TL4jKbS1+nCdHSr9is4TSCckx8o6tOoMfqmm5FYDwuha7By+GZp8jk/0URJtllVrn1MW0pgCevt2a50R3XJQDZb6oKmtPjR/aXVevkhOoewWclkJCS9ogl7+Dt6E2ILF07/LXO7HZBYMMBGdFtvUNYYfxM9e32Y/dvTfjSswpqb5WJ1lYJHXamcmI/mggQ5gipohGKnW1+CqZnWAR8xtgchRn3oYGxxiKQ86GXNRUyEef21xcoVLSRoiKw4IhO50C7YhxIGV4fbDUVMFfv6iuj1EUc2OMzNrjhot/NBGm2XOw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) 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=6MHSKZNfmsnYvIUX9yiOX+s/1qgGezWFiL0YrA05Jws=; b=rUR0BB+brSjf+oHmGmOCmFa05ESMaIsZF9GedL7F+OjP7yDQwb3oYRbh8ftGua4tKwSso5sjZF40YS33a0r+rek0KzGYweOSWsUy5++7Pb5XQEtPlIP12Y4//EiMQg7FGlFsBXLRLstpInM4t+YBMyz35t2/Xa8cUS4qcTtqhVQ= Received: from DU7P190CA0005.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:550::22) by AM8PR08MB5748.eurprd08.prod.outlook.com (2603:10a6:20b:1df::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:54:38 +0000 Received: from DB5PEPF00014B8A.eurprd02.prod.outlook.com (2603:10a6:10:550:cafe::24) by DU7P190CA0005.outlook.office365.com (2603:10a6:10:550::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.24 via Frontend Transport; Mon, 10 Mar 2025 17:54:37 +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=arm.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 DB5PEPF00014B8A.mail.protection.outlook.com (10.167.8.198) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:54:37 +0000 Received: ("Tessian outbound 7c48d84d1965:v585"); Mon, 10 Mar 2025 17:54:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fbeb077fc77bb033 X-TessianGatewayMetadata: ofyaZ0IPooVpxSx9wYAdmII2sbJ/TqAvch3pmUKON3OxUBQFQU/h5dkb2Bv9rI13nO4EwYs5i86bKy40B+WmMjJNK5YayT2ptGp8xH10dgl2fapXUvtR3vddektuzaBQqEkwvRTjD7L9zmxycfH0ltDvi5sciLlmMJjaqIzB9hc= X-CR-MTA-TID: 64aa7808 Received: from L218ad763fd75.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FFEB5954-87A3-4A71-85F6-A1B8871444A5.1; Mon, 10 Mar 2025 17:54:30 +0000 Received: from DU2PR03CU002.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L218ad763fd75.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 10 Mar 2025 17:54:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XP8tV0KSAYSuW9F/AcPjv4ydllWHT0x45cEqcL3H7Ena7SIM9ySHNW3X0E6Wn15VDsMrNvC5ny6SHiXfAapZ1FN1rVkCFqzcnepyineVqmPom+XqvopBx2k+1hMLnACw61mE5SQVGRRdBQB94UXgjKcNMciU1MSY0R3NYsI1THVvsB1rwt9FncykiynYa6qVDj27X9PIz40erYxTomOeR5fbaNfNGOw8bSLyALKbDHvBxxgLDTek3UKNDwlchCCvHgQVkPkBDiJXKlcpdwoQjPrN9mgLSSP5gzN5j+76QQWWgerWrHM4hyZR1NVhbISvAF+Js6+pHlvU5xcbQGpjaQ== 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=6MHSKZNfmsnYvIUX9yiOX+s/1qgGezWFiL0YrA05Jws=; b=c9fh9Ihn/i9WPMmUUeyWb3yNwnVBuFs1c+EEKknF58IzDYSe48v89El7aBt8TlwV9o7hkFrioIdoGI5kjpI+9DNCkT5KA6rXQgikp7PD0yPXhn8H9vqMCxYMpm0ZuulSSq2/2K3j2Cjv8y02kNYDIjY5QzZet3n1AOjYYTStg1PMWu9vN21FFpn4VRwO4l+vf5E2LcdauAo3uA+o/M+s70UBCGgQdx7l2VNJpmH0hHLYDtF++Nb3hc+mt/CCahoSUQag2SIKZETbc/aUV380zqJz24cFJcpjnaekmOxacVnUWCldDY08V2+pLvPDsI4HUU3BXOU24tzirxeG/shFwg== 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=6MHSKZNfmsnYvIUX9yiOX+s/1qgGezWFiL0YrA05Jws=; b=rUR0BB+brSjf+oHmGmOCmFa05ESMaIsZF9GedL7F+OjP7yDQwb3oYRbh8ftGua4tKwSso5sjZF40YS33a0r+rek0KzGYweOSWsUy5++7Pb5XQEtPlIP12Y4//EiMQg7FGlFsBXLRLstpInM4t+YBMyz35t2/Xa8cUS4qcTtqhVQ= Received: from PA7P264CA0334.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:39a::23) by DU4PR08MB11187.eurprd08.prod.outlook.com (2603:10a6:10:574::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Mon, 10 Mar 2025 17:54:25 +0000 Received: from AMS0EPF00000197.eurprd05.prod.outlook.com (2603:10a6:102:39a:cafe::3d) by PA7P264CA0334.outlook.office365.com (2603:10a6:102:39a::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.26 via Frontend Transport; Mon, 10 Mar 2025 17:54:25 +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 AMS0EPF00000197.mail.protection.outlook.com (10.167.16.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8534.20 via Frontend Transport; Mon, 10 Mar 2025 17:54:24 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Mar 2025 17:54:22 +0000 Received: from PW070M4K.arm.com (10.57.84.208) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 10 Mar 2025 17:54:22 +0000 From: Matthieu Longo To: CC: Alan Modra , Richard Earnshaw , Matthieu Longo Subject: [PATCH v0 15/15] ld tests: AArch64-specific merge coverage for AEABI-specific BAs Date: Mon, 10 Mar 2025 17:51:28 +0000 Message-ID: <20250310175131.1217374-16-matthieu.longo@arm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310175131.1217374-1-matthieu.longo@arm.com> References: <20250310175131.1217374-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF00000197:EE_|DU4PR08MB11187:EE_|DB5PEPF00014B8A:EE_|AM8PR08MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b548daf-6400-4ae8-2c54-08dd5ffca020 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info-Original: Rh4apg5SLpoFxyJjZZre5WXb6EHH8zSY0MJku6vRwxLwy1BE1ajt8MIUvvU6KXlJw8c7uI+KhrM9LsUJKSJjF9vLDYOd1cXB5MtwrLQ2h9UMUONSNCYys6iJakAdYardwAiqNJPWzxvFi2wtc96g3VSyeNrbxvKOcpEWyWOFCVcmjEMOS+Ayp7MrpEFDYSQB9/8qhiPT4fr7Zq1K2jE2Pn8sKbR9Ya7IvB+MgWjCh4btCoLFA8W/eqwvAofT1f7ow2qmtULDig2FRWaGkbTuAzqZpNSRgobgCwrOul+RpWO6mUqv4rwZode2WQey82+MLKkdbDAFTDEhqPwQ8LyYqEe6MWJ7bLvb1zpZxKdLMw48jDS9qC1E3UKdIG0e+BAJqUgfn7sckyBJX4P9dKflM2o1I9OTZ2XyC6tna/qp9dTvQy14GeU7oBdxv+Ab051JC+567WBA8Xbev5Gj+uDllYJ7mghkRaqVLWMP52iv/Cd+hVRE0MI155TA0fNSqjj/UZJqdkQaPvXgW0s4O34l+8tXJcYSSnV/Z+2Q6H0RMyYC/jGbDIPHzFQClTG8huacBwemmCmMVN1ZIFSDBJxmfViY2E3dimngOFVpMjZLOTuGv/kAJazw27lwMq9kUXx1C2VieK3x8SJOvGVYyfdVgAicNS5cv+7nRjQqrNshfiVR/z6ws8/Xg5rwP0IcrG/1ozuosugbYGqmESRX7WTUGLJ4+jP6TbmyRsey8bA+S3FYhUV6X/XlT1XZvTlJvncxeVjlbGuQAJPThE7jhtMZhBe38qp3HeQHDAe3zk/cgKmOpS4epHmZ2OiGKkrPC2V2itc7GQN4wT8aaqjKk/N950dTMlhYmNYiaSXfN5WCGg40WjIKUITQ8zQu2B47gKjwlBdTnvfGGfZlVdYRtAeuHATuOLcxXlEM6w7puy9VSSV0eSJWQgyKt0dLku0hpZ/HfOswNwvprxEWRJG2sm5ITQYYgMFnA6GJRPTkUG/ffqyYPSXV+fmRgUUbTh/RKh2PAhI3k8rVq0ghHrjetm9kmRvbdjx7Kz+GHbtNPQNLyTrKlRib29wrqXMjh/BqxrjQVRVSgJJoJQCh8/DvzMyR4hBgFdczynhVvmonWbPL7MgBQ9mfu4AOaAvFS0IROSOt1e/R6GeIdza+FvNPQUApbCy5V9HsFOqLVyxHAddHnKwj5vmY01avO15K7oUlQv2DTt9iPCGou0b2ZSJUxpBTYhpZJZo9y15emCk3L7oicfAm1TnXHqIEG0mstNb21cbv2zZSlo+8OV/V853yZaZmJvU20GiF1R6jCy7TkltMn1SZj/j6paoBUjcu+klhJ/BHYtPDsAiv3J/WZ2giMR+7jKO8cxQpDGkL4/urDD+9sWEbq+mP+ZEhX/ffgPNUZVe+4Tbm07gygc6bur/ibJAspzvD3JbKr4RyCWoW4aQQ0n/2gihBRlcDnVEPnwgVeZMK5Er5V1ydBVFzSCEJP2mTNyyspXbsXl6GWsU4U+676a0= 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)(82310400026)(376014)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR08MB11187 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:102:39a::23]; domain=PA7P264CA0334.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5PEPF00014B8A.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8d39dd99-fd63-4e6b-590f-08dd5ffc985c X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|14060799003|35042699022|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: j9maMfIZtzwCg4jLA1uTdndsaCffmhrgY5GpYxEeTe8p8z7gmnrQPjEnQjiVF05GlDR8aPRFPnpBbw0Gmdgrhwvj7CrhNjQP5QxfFo6+a55H5ru0rGG3ekspy5bKCCUeITezYs/ZmOIrRwFMU0XzhdHXShjU+Kx7Jz6gXz+9mKTDvIV8MPePT4USecHvKJE+1JUoQ4Th3MBUx3sBSiNjA7TX8Fmdhex15+js9Gj4eKAthzxW6av+c2oxQQrtZ/Q7N4D0tFuYtOQiTMvgCLnUcstx2gItc8BHrwZySTDTzAKcjnAElztn5eYbTePow61/2QdoYM875GrL//F9zVTM+socXRON2pwgKqy8nbjjzIKdrcqFkniJEYuFgc/jyKOcYCYq8/VCwG1h0NM76Qg95hCYOa5/2wAKXX68QShN2dA2x6oahBLYa7mvHPQhVI+dFBiQ6WSUBe4ckqFBgBeZJMhVB8qRrR4TZz3WjneH0dwz+JpTGB/BzZBPMIiyr3fSA6gE8CRBmv7aa+S1qMLh41+fLrSFD2Gx8HfybZ6IfPdMmhumxSTWqfDfI9ynzsr4jYBXobfVf02Ph838SXTGWzbqXIW74riPgsqd35NhQX5HS7gAyhWYJ0c6OfUipJOxnezgDBXFOeXv1RzwSnvOH3HTA4iTgwsbbBpDqaJwySOufZnI1GyIeCsxUwG8j9F5ejkG22o9bORKOkEa48y5o376q0C6IN4VQbaNXNhvislnLLMNTAlCzV5zY1P8zLChAxSeoNaUyEf1WZ9YwmqyWWgCKQr+bWbr7vif/O02CuEAVC2eajZj7v2+l3McHHliLO1BtCTCkicrUEyarRReV8GdfCaqddzpidwtVvMO6ZFpGBLv/iEkCNshsPU+2P0FWabGsBFGnJZ6AU1/oIUjfk+imKWMbcaY0FeBru6+HDgQSu96aYeuJtQIMoZOT+43q7cElDohfWwRjgsFk1XHojmEdrQFTnSYmX0u0fsiioB/XYkJilwCW/WnKTdUc2PLNzICggpWTVzLoIU++USqrbFlMq7h8DieHeR7ytO4IxEnutZvL/Hai3zrTKOBP7TF2Ho0gzXf13zAtUDWOD59uASBBGe0UVlM3E9yVUEi1Ozotbezjy685HqSopze/QXEjYSSCwMPDlKJtJBnFOUujRMDFOs6S3706/EkQyrHuaFm34l13PS9ilDajT8NhZiW4CNe++NksBXhMn8Gp44q6VrSaUXNHc9KUXLRq1tV9nAKZdmOuu+vrEZLY+07uFf48nVIAuEIrCYl/5HHowQyj8d8ur0gTqIhPmumYBfbNzfwPdiK7bCmtJkrlPMC5oz57gG2oGSfBoHt3vKaHh40PN9SXncK5GHdWXZBPnscQ4mBumkUeBdLBU60Mo58x5wSMXNMHxSR02VtI+cKAo59gInlRyuHkfsEzARtVKyIcexfVxy7zwjfcBrSgu1s0V3TydHiyCKdo7eYBsj7GvnFO9wjP0sYAyGnjPGsnBqsWgY= 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:64aa7808-outbound-1.mta.getcheckrecipient.com; CAT:NONE; SFS:(13230040)(1800799024)(14060799003)(35042699022)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2025 17:54:37.9182 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b548daf-6400-4ae8-2c54-08dd5ffca020 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: DB5PEPF00014B8A.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5748 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, PROLO_LEO1, SPF_HELO_PASS, SPF_NONE, TXREP, 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: 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 - coverage of required subsection 'aeabi_pauthabi'. - coverage for BTI, PAC, GCS used along GNU properties. - warn on unknown attributes, and prune them from output. --- .../build-attributes/ba-aarch64-1-bti-1.s | 9 +++ .../build-attributes/ba-aarch64-1-bti-2.s | 14 ++++ ...a-aarch64-1-bti-explicit-ok-objdump-dump.d | 53 ++++++++++++++ ...a-aarch64-1-bti-explicit-ok-readelf-dump.d | 24 +++++++ ...t-only-one-input-without-ba-or-gnu-props.d | 19 +++++ ...-gnu-props-only-implicit-ok-readelf-dump.d | 20 ++++++ ...-aarch64-1-bti-implicit-nok-objdump-dump.d | 45 ++++++++++++ ...-aarch64-1-bti-implicit-nok-readelf-dump.d | 16 +++++ ...a-aarch64-1-bti-implicit-ok-objdump-dump.d | 38 ++++++++++ ...a-aarch64-1-bti-implicit-ok-readelf-dump.d | 19 +++++ .../ba-aarch64-1-bti-via-gnu-props.s | 11 +++ ...u-props-and-bas-implicit-ok-readelf-dump.d | 22 ++++++ .../build-attributes/ba-aarch64-1-gcs-1.s | 9 +++ .../build-attributes/ba-aarch64-1-gcs-2.s | 14 ++++ ...a-aarch64-1-gcs-explicit-ok-readelf-dump.d | 24 +++++++ ...-gnu-props-only-implicit-ok-readelf-dump.d | 20 ++++++ ...-aarch64-1-gcs-implicit-nok-readelf-dump.d | 16 +++++ ...a-aarch64-1-gcs-implicit-ok-readelf-dump.d | 19 +++++ .../ba-aarch64-1-gcs-via-gnu-props.s | 11 +++ .../build-attributes/ba-aarch64-1-no-bti.s | 2 + .../build-attributes/ba-aarch64-1-no-gcs.s | 2 + .../build-attributes/ba-aarch64-1-pac-1.s | 9 +++ .../build-attributes/ba-aarch64-1-pac-2.s | 14 ++++ ...rch64-1-pac-ba-with-pac-plt-objdump-dump.d | 44 ++++++++++++ ...rch64-1-pac-ba-with-pac-plt-readelf-dump.d | 21 ++++++ ...64-1-pac-ba-without-pac-plt-objdump-dump.d | 38 ++++++++++ ...64-1-pac-ba-without-pac-plt-readelf-dump.d | 21 ++++++ ...h64-1-pac-plt-but-no-pac-ba-objdump-dump.d | 53 ++++++++++++++ ...h64-1-pac-plt-but-no-pac-ba-readelf-dump.d | 18 +++++ .../ba-aarch64-1-pac-via-gnu-props.s | 11 +++ .../ba-aarch64-1-required-subsection-1.s | 7 ++ .../ba-aarch64-1-required-subsection-2.s | 7 ++ ...aarch64-1-required-subsection-mismatch-1.s | 7 ++ ...aarch64-1-required-subsection-mismatch-2.s | 7 ++ .../ba-aarch64-1-required-subsection-nok-1.d | 7 ++ .../ba-aarch64-1-required-subsection-nok-2.d | 9 +++ .../ba-aarch64-1-required-subsection-ok.d | 25 +++++++ .../ba-aarch64-1-unknown-tag.d | 20 ++++++ .../ba-aarch64-1-unknown-tag.s | 3 + .../build-attributes/ba-aarch64-1-void.s | 5 ++ .../ld-aarch64/build-attributes/bti-plt.ld | 14 ++++ .../gnu-note-properties-maskable-merged.inc | 32 +++++++++ .../gnu-note-properties-maskable-split.inc | 72 +++++++++++++++++++ .../gnu-note-properties-selectable-merged.inc | 32 +++++++++ .../gnu-note-properties-selectable-split.inc | 72 +++++++++++++++++++ 45 files changed, 955 insertions(+) create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-objdump-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-only-one-input-without-ba-or-gnu-props.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-gnu-props-only-implicit-ok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-objdump-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-objdump-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-via-gnu-props.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-with-mix-gnu-props-and-bas-implicit-ok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-explicit-ok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-gnu-props-only-implicit-ok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-nok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-ok-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-via-gnu-props.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-bti.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-gcs.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-objdump-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-objdump-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-objdump-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-readelf-dump.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-via-gnu-props.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-1.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-2.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-1.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-2.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.d create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-void.s create mode 100644 ld/testsuite/ld-aarch64/build-attributes/bti-plt.ld create mode 100644 ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-merged.inc create mode 100644 ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-split.inc create mode 100644 ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-merged.inc create mode 100644 ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-split.inc diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-1.s new file mode 100644 index 00000000000..e90d6375005 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-1.s @@ -0,0 +1,9 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 + + .text + .globl _start + .type _start,@function +_start: + bl foo + bl bar \ No newline at end of file diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-2.s new file mode 100644 index 00000000000..1347a66739e --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-2.s @@ -0,0 +1,14 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 + + .text + .globl foo2 + .type foo2,@function +foo2: + bl foo_2 + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-objdump-dump.d new file mode 100644 index 00000000000..afe9eeaec34 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-objdump-dump.d @@ -0,0 +1,53 @@ +# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti generates PLT with BTI. +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-bti-via-gnu-props.s +# source: ba-aarch64-1-bti-2.s +# as: -defsym __property_bti__=1 +# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning +#warning: \A[^\n]*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti, but this input object file lacks the necessary property note\. +# objdump: -dr -j .plt + +[^:]*: *file format elf64-.*aarch64 + +Disassembly of section \.plt: + +[0-9a-f]+ <\.plt>: +.*: d503245f bti c +.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9400e11 ldr x17, \[x16, #24\] +.*: 91006210 add x16, x16, #0x18 +.*: d61f0220 br x17 +.*: d503201f nop +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401211 ldr x17, \[x16, #32\] +.*: 91008210 add x16, x16, #0x20 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401611 ldr x17, \[x16, #40\] +.*: 9100a210 add x16, x16, #0x28 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401a11 ldr x17, \[x16, #48\] +.*: 9100c210 add x16, x16, #0x30 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401e11 ldr x17, \[x16, #56\] +.*: 9100e210 add x16, x16, #0x38 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9402211 ldr x17, \[x16, #64\] +.*: 91010210 add x16, x16, #0x40 +.*: d61f0220 br x17 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-readelf-dump.d new file mode 100644 index 00000000000..6ed3963bbff --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-readelf-dump.d @@ -0,0 +1,24 @@ +# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti means that the output has Tag_Feature_BTI=0x1 +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-bti-via-gnu-props.s +# source: ba-aarch64-1-bti-2.s +# as: -defsym __property_bti__=1 +# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning +#warning: .*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti.* +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: BTI +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-only-one-input-without-ba-or-gnu-props.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-only-one-input-without-ba-or-gnu-props.d new file mode 100644 index 00000000000..016372bb3fc --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-only-one-input-without-ba-or-gnu-props.d @@ -0,0 +1,19 @@ +# name: EABI build attributes: a input object without build attributes or GNU properties, but -z force-bti means that the output has Tag_Feature_BTI=0x1 +# source: ba-aarch64-1-void.s +# as: +# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning +#warning: .*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti.* +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: BTI +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 31 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-gnu-props-only-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-gnu-props-only-implicit-ok-readelf-dump.d new file mode 100644 index 00000000000..4403aacad49 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-gnu-props-only-implicit-ok-readelf-dump.d @@ -0,0 +1,20 @@ +# name: EABI build attributes: all files with BTI GNU property means that output also has Tag_Feature_BTI=0x1 +# source: ba-aarch64-1-bti-via-gnu-props.s +# as: -defsym __property_bti__=1 +# ld: -shared -T bti-plt.ld +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: BTI +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-objdump-dump.d new file mode 100644 index 00000000000..366d6522b46 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-objdump-dump.d @@ -0,0 +1,45 @@ +# name: EABI build attributes: some files missing Tag_Feature_BTI does not trigger generation of PLT with BTI. +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-bti-2.s +# as: +# ld: -shared -T bti-plt.ld +# objdump: -dr -j .plt + +[^:]*: *file format elf64-.*aarch64 + +Disassembly of section \.plt: + +[0-9a-f]+ <\.plt>: +.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9400e11 ldr x17, \[x16, #24\] +.*: 91006210 add x16, x16, #0x18 +.*: d61f0220 br x17 +.*: d503201f nop +.*: d503201f nop +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401211 ldr x17, \[x16, #32\] +.*: 91008210 add x16, x16, #0x20 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401611 ldr x17, \[x16, #40\] +.*: 9100a210 add x16, x16, #0x28 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401a11 ldr x17, \[x16, #48\] +.*: 9100c210 add x16, x16, #0x30 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401e11 ldr x17, \[x16, #56\] +.*: 9100e210 add x16, x16, #0x38 +.*: d61f0220 br x17 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-readelf-dump.d new file mode 100644 index 00000000000..af3da69bbf0 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-readelf-dump.d @@ -0,0 +1,16 @@ +# name: EABI build attributes: some files missing Tag_Feature_BTI means that the output has Tag_Feature_BTI=0x0 +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-bti-2.s +# as: +# ld: -shared -T bti-plt.ld +# readelf: --arch-specific --notes + +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 31 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-objdump-dump.d new file mode 100644 index 00000000000..4b87340b2b6 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-objdump-dump.d @@ -0,0 +1,38 @@ +# name: EABI build attributes: all files with Tag_Feature_BTI=0x1 generates PLT with BTI. +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-bti-2.s +# as: +# ld: -shared -T bti-plt.ld +# objdump: -dr -j .plt + +[^:]*: *file format elf64-.*aarch64 + +Disassembly of section \.plt: + +[0-9a-f]+ <\.plt>: +.*: d503245f bti c +.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9400e11 ldr x17, \[x16, #24\] +.*: 91006210 add x16, x16, #0x18 +.*: d61f0220 br x17 +.*: d503201f nop +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401211 ldr x17, \[x16, #32\] +.*: 91008210 add x16, x16, #0x20 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401611 ldr x17, \[x16, #40\] +.*: 9100a210 add x16, x16, #0x28 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401a11 ldr x17, \[x16, #48\] +.*: 9100c210 add x16, x16, #0x30 +.*: d61f0220 br x17 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-readelf-dump.d new file mode 100644 index 00000000000..c4f0092c512 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-readelf-dump.d @@ -0,0 +1,19 @@ +# name: EABI build attributes: all files with Tag_Feature_BTI=0x1 means that output also has Tag_Feature_BTI=0x1 +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-bti-2.s +# as: +# ld: -shared -T bti-plt.ld +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: BTI +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 31 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-via-gnu-props.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-via-gnu-props.s new file mode 100644 index 00000000000..b327f6758a3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-via-gnu-props.s @@ -0,0 +1,11 @@ + .text + .globl foo3 + .type foo3,@function +foo3: + bl foo_3 + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-with-mix-gnu-props-and-bas-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-with-mix-gnu-props-and-bas-implicit-ok-readelf-dump.d new file mode 100644 index 00000000000..ea64077be3e --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-with-mix-gnu-props-and-bas-implicit-ok-readelf-dump.d @@ -0,0 +1,22 @@ +# name: EABI build attributes: EABI build attributes: some files with build attribute Tag_Feature_BTI=0x1 and others with equivalent GNU property means that output also has Tag_Feature_BTI=0x1 +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-bti-via-gnu-props.s +# source: ba-aarch64-1-bti-2.s +# as: -defsym __property_bti__=1 +# ld: -shared -T bti-plt.ld +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: BTI +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-1.s new file mode 100644 index 00000000000..f18cdfdb0fc --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-1.s @@ -0,0 +1,9 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_GCS, 1 + + .text + .globl _start + .type _start,@function +_start: + bl foo + bl bar \ No newline at end of file diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-2.s new file mode 100644 index 00000000000..06bb3898ac8 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-2.s @@ -0,0 +1,14 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_GCS, 1 + + .text + .globl foo2 + .type foo2,@function +foo2: + bl foo_2 + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-explicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-explicit-ok-readelf-dump.d new file mode 100644 index 00000000000..6f8e80693e2 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-explicit-ok-readelf-dump.d @@ -0,0 +1,24 @@ +# name: EABI build attributes: some files missing Tag_Feature_GCS, but -z gcs=always means that GCS is required. +# source: ba-aarch64-1-gcs-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-gcs-via-gnu-props.s +# source: ba-aarch64-1-gcs-2.s +# as: -defsym __property_gcs__=1 +# ld: -shared -z gcs=always -z gcs-report=warning +#warning: .*ba-aarch64-1-void\.o: warning: GCS is required by -z gcs.* +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 0 \(0x0\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 1 \(0x1\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-gnu-props-only-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-gnu-props-only-implicit-ok-readelf-dump.d new file mode 100644 index 00000000000..2469b6312d1 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-gnu-props-only-implicit-ok-readelf-dump.d @@ -0,0 +1,20 @@ +# name: EABI build attributes: all files with GCS GNU property means that output also has Tag_Feature_GCS=0x1 +# source: ba-aarch64-1-gcs-via-gnu-props.s +# as: -defsym __property_gcs__=1 +# ld: -shared +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 0 \(0x0\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 1 \(0x1\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-nok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-nok-readelf-dump.d new file mode 100644 index 00000000000..f1cf1caa3ea --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-nok-readelf-dump.d @@ -0,0 +1,16 @@ +# name: EABI build attributes: some files missing Tag_Feature_GCS means that the output has Tag_Feature_GCS=0x0 +# source: ba-aarch64-1-gcs-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-gcs-2.s +# as: +# ld: -shared -z gcs=implicit -z gcs-report=warning +# readelf: --arch-specific --notes + +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 31 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_GCS: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-ok-readelf-dump.d new file mode 100644 index 00000000000..eba1298e778 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-ok-readelf-dump.d @@ -0,0 +1,19 @@ +# name: EABI build attributes: all files with Tag_Feature_GCS=0x1 means that output also has Tag_Feature_GCS=0x1 +# source: ba-aarch64-1-gcs-1.s +# source: ba-aarch64-1-gcs-2.s +# as: +# ld: -shared +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 31 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_GCS: 1 \(0x1\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-via-gnu-props.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-via-gnu-props.s new file mode 100644 index 00000000000..b327f6758a3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-via-gnu-props.s @@ -0,0 +1,11 @@ + .text + .globl foo3 + .type foo3,@function +foo3: + bl foo_3 + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-bti.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-bti.s new file mode 100644 index 00000000000..1093ccfd240 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-bti.s @@ -0,0 +1,2 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 0 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-gcs.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-gcs.s new file mode 100644 index 00000000000..35b527fba1e --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-gcs.s @@ -0,0 +1,2 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_GCS, 0 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-1.s new file mode 100644 index 00000000000..773732f622c --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-1.s @@ -0,0 +1,9 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_PAC, 1 + + .text + .globl _start + .type _start,@function +_start: + bl foo + bl bar \ No newline at end of file diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-2.s new file mode 100644 index 00000000000..4a7f805f444 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-2.s @@ -0,0 +1,14 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_PAC, 1 + + .text + .globl foo2 + .type foo2,@function +foo2: + bl foo_2 + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-objdump-dump.d new file mode 100644 index 00000000000..739733ab38f --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-objdump-dump.d @@ -0,0 +1,44 @@ +# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 and '-z pac-plt' does generate PLT with PAC. +# source: ba-aarch64-1-pac-1.s +# source: ba-aarch64-1-pac-2.s +# as: -defsym __property_pac__=1 +# ld: -shared -T bti-plt.ld -z pac-plt +# objdump: -dr -j .plt + +[^:]*: *file format elf64-.*aarch64 + +Disassembly of section \.plt: + +[0-9a-f]+ <\.plt>: +.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9400e11 ldr x17, \[x16, #24\] +.*: 91006210 add x16, x16, #0x18 +.*: d61f0220 br x17 +.*: d503201f nop +.*: d503201f nop +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401211 ldr x17, \[x16, #32\] +.*: 91008210 add x16, x16, #0x20 +.*: d503219f autia1716 +.*: d61f0220 br x17 +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401611 ldr x17, \[x16, #40\] +.*: 9100a210 add x16, x16, #0x28 +.*: d503219f autia1716 +.*: d61f0220 br x17 +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401a11 ldr x17, \[x16, #48\] +.*: 9100c210 add x16, x16, #0x30 +.*: d503219f autia1716 +.*: d61f0220 br x17 +.*: d503201f nop diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-readelf-dump.d new file mode 100644 index 00000000000..4df3145ab2f --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-readelf-dump.d @@ -0,0 +1,21 @@ +# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 and '-z pac-plt' means that output has Tag_Feature_PAC=0x1 +# source: ba-aarch64-1-pac-1.s +# source: ba-aarch64-1-pac-2.s +# as: -defsym __property_pac__=1 +# ld: -shared -T bti-plt.ld -z pac-plt +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: PAC +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 0 \(0x0\) + Tag_Feature_PAC: 1 \(0x1\) + Tag_Feature_GCS: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-objdump-dump.d new file mode 100644 index 00000000000..6f3ccab56c0 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-objdump-dump.d @@ -0,0 +1,38 @@ +# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 but no '-z pac-plt' does not generate PLT with PAC. +# source: ba-aarch64-1-pac-1.s +# source: ba-aarch64-1-pac-2.s +# as: -defsym __property_pac__=1 +# ld: -shared -T bti-plt.ld +# objdump: -dr -j .plt + +[^:]*: *file format elf64-.*aarch64 + +Disassembly of section \.plt: + +[0-9a-f]+ <\.plt>: +.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9400e11 ldr x17, \[x16, #24\] +.*: 91006210 add x16, x16, #0x18 +.*: d61f0220 br x17 +.*: d503201f nop +.*: d503201f nop +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401211 ldr x17, \[x16, #32\] +.*: 91008210 add x16, x16, #0x20 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401611 ldr x17, \[x16, #40\] +.*: 9100a210 add x16, x16, #0x28 +.*: d61f0220 br x17 + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401a11 ldr x17, \[x16, #48\] +.*: 9100c210 add x16, x16, #0x30 +.*: d61f0220 br x17 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-readelf-dump.d new file mode 100644 index 00000000000..465ce5fd231 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-readelf-dump.d @@ -0,0 +1,21 @@ +# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 but no '-z pac-plt' means that output has Tag_Feature_PAC=0x1 +# source: ba-aarch64-1-pac-1.s +# source: ba-aarch64-1-pac-2.s +# as: -defsym __property_pac__=1 +# ld: -shared -T bti-plt.ld +# readelf: --arch-specific --notes + +Displaying notes found in: \.note\.gnu\.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: PAC +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 0 \(0x0\) + Tag_Feature_PAC: 1 \(0x1\) + Tag_Feature_GCS: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-objdump-dump.d new file mode 100644 index 00000000000..c8ecabfe1aa --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-objdump-dump.d @@ -0,0 +1,53 @@ +# name: EABI build attributes: '-z pac-plt' with some files without Tag_Feature_PAC=0x1 generates PLT with PAC. +# source: ba-aarch64-1-pac-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-pac-2.s +# as: -defsym __property_pac__=1 +# ld: -shared -T bti-plt.ld -z pac-plt +# objdump: -dr -j .plt + +[^:]*: *file format elf64-.*aarch64 + +Disassembly of section \.plt: + +[0-9a-f]+ <\.plt>: +.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9400e11 ldr x17, \[x16, #24\] +.*: 91006210 add x16, x16, #0x18 +.*: d61f0220 br x17 +.*: d503201f nop +.*: d503201f nop +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401211 ldr x17, \[x16, #32\] +.*: 91008210 add x16, x16, #0x20 +.*: d503219f autia1716 +.*: d61f0220 br x17 +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401611 ldr x17, \[x16, #40\] +.*: 9100a210 add x16, x16, #0x28 +.*: d503219f autia1716 +.*: d61f0220 br x17 +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401a11 ldr x17, \[x16, #48\] +.*: 9100c210 add x16, x16, #0x30 +.*: d503219f autia1716 +.*: d61f0220 br x17 +.*: d503201f nop + +[0-9a-f]+ : +.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_> +.*: f9401e11 ldr x17, \[x16, #56\] +.*: 9100e210 add x16, x16, #0x38 +.*: d503219f autia1716 +.*: d61f0220 br x17 +.*: d503201f nop diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-readelf-dump.d new file mode 100644 index 00000000000..9ba08a1718a --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-readelf-dump.d @@ -0,0 +1,18 @@ +# name: EABI build attributes: '-z pac-plt' with some files without Tag_Feature_PAC=0x1 does not set Tag_Feature_PAC=0x1. +# source: ba-aarch64-1-pac-1.s +# source: ba-aarch64-1-void.s +# source: ba-aarch64-1-pac-2.s +# as: -defsym __property_pac__=1 +# ld: -shared -T bti-plt.ld -z pac-plt +# readelf: --arch-specific --notes + +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 0 \(0x0\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 0 \(0x0\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-via-gnu-props.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-via-gnu-props.s new file mode 100644 index 00000000000..b327f6758a3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-via-gnu-props.s @@ -0,0 +1,11 @@ + .text + .globl foo3 + .type foo3,@function +foo3: + bl foo_3 + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-1.s new file mode 100644 index 00000000000..fbb7f9f8b8c --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-1.s @@ -0,0 +1,7 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 +.aeabi_attribute Tag_Feature_PAC, 1 + +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_attribute Tag_PAuth_Platform, 0xdeadbeef +.aeabi_attribute Tag_PAuth_Schema, 0x12345678 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-2.s new file mode 100644 index 00000000000..57fc7758944 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-2.s @@ -0,0 +1,7 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 +.aeabi_attribute Tag_Feature_PAC, 0 + +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_attribute Tag_PAuth_Platform, 0xdeadbeef +.aeabi_attribute Tag_PAuth_Schema, 0x12345678 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-1.s new file mode 100644 index 00000000000..433609520ad --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-1.s @@ -0,0 +1,7 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 +.aeabi_attribute Tag_Feature_PAC, 1 + +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_attribute Tag_PAuth_Platform, 0x00000001 +.aeabi_attribute Tag_PAuth_Schema, 0x12345678 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-2.s new file mode 100644 index 00000000000..dbbb30e0e54 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-2.s @@ -0,0 +1,7 @@ +.aeabi_subsection aeabi_feature_and_bits, required, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 +.aeabi_attribute Tag_Feature_PAC, 1 + +.aeabi_subsection aeabi_pauthabi, optional, ntbs +.aeabi_attribute Tag_PAuth_Platform, "hello" +.aeabi_attribute Tag_PAuth_Schema, "world" diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-1.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-1.d new file mode 100644 index 00000000000..b636c238f23 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-1.d @@ -0,0 +1,7 @@ +# name: EABI build attributes: combine non-matching aeabi_pauthabi subsections +# source: ba-aarch64-1-required-subsection-1.s +# source: ba-aarch64-1-required-subsection-mismatch-1.s +# source: ba-aarch64-1-required-subsection-2.s +# as: +# ld: -shared +#error: \A[^\n]*ba-aarch64-1-required-subsection-1\.o, [^:]*ba-aarch64-1-required-subsection-mismatch-1\.o: error: mismatching values 0xdeadbeef and 0x1 for required object attribute 'Tag_PAuth_Platform' in subsection 'aeabi_pauthabi' diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-2.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-2.d new file mode 100644 index 00000000000..ca475f839c2 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-2.d @@ -0,0 +1,9 @@ +# name: EABI build attributes: subsections have different properties from the expected ones +# source: ba-aarch64-1-required-subsection-1.s +# source: ba-aarch64-1-required-subsection-mismatch-2.s +# source: ba-aarch64-1-required-subsection-2.s +# as: +# ld: -shared +#error: \A[^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: optional property of subsection 'aeabi_feature_and_bits' was incorrectly set. Got 'required', expected 'optional'\.\n +#error: [^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: encoding property of subsection 'aeabi_pauthabi' was incorrectly set\. Got 'ntbs', expected 'uleb128'\.\n +#error: [^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: optional property of subsection 'aeabi_pauthabi' was incorrectly set\. Got 'optional', expected 'required'\. \ No newline at end of file diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok.d new file mode 100644 index 00000000000..044b1a2c5d4 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok.d @@ -0,0 +1,25 @@ +# name: EABI build attributes: combine matching aeabi_pauthabi subsections +# source: ba-aarch64-1-required-subsection-1.s +# source: ba-aarch64-1-required-subsection-2.s +# as: +# ld: -shared +# readelf: --arch-specific + +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 33 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) + Tag_Feature_PAC: 0 \(0x0\) + + - Name: aeabi_pauthabi + Scope: public + Length: 33 + Optional: False + Encoding: ULEB128 + Values: + Tag_PAuth_Platform: 3735928559 \(0xdeadbeef\) + Tag_PAuth_Schema: 305419896 \(0x12345678\) diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.d new file mode 100644 index 00000000000..00271dd6a2e --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.d @@ -0,0 +1,20 @@ +# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti means that the output has Tag_Feature_BTI=0x1 +# source: ba-aarch64-1-bti-1.s +# source: ba-aarch64-1-unknown-tag.s +# source: ba-aarch64-1-bti-via-gnu-props.s +# source: ba-aarch64-1-bti-2.s +# as: -defsym __property_bti__=1 +# ld: -shared -T bti-plt.ld +#warning: \A[^\n]*ba-aarch64-1-unknown-tag\.o: warning: cannot merge unknown tag Tag_unknown_4 \(=0x1\) in subsection 'aeabi_feature_and_bits'\. +# readelf: --arch-specific + +Subsections: + - Name: aeabi_feature_and_bits + Scope: public + Length: 35 + Optional: True + Encoding: ULEB128 + Values: + Tag_Feature_BTI: 1 \(0x1\) + Tag_Feature_PAC: 0 \(0x0\) + Tag_Feature_GCS: 0 \(0x0\) \ No newline at end of file diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.s new file mode 100644 index 00000000000..7d4f172390d --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.s @@ -0,0 +1,3 @@ +.aeabi_subsection aeabi_feature_and_bits, optional, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 +.aeabi_attribute 4, 1 diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-void.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-void.s new file mode 100644 index 00000000000..4e1896ca8f9 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-void.s @@ -0,0 +1,5 @@ + .text + .globl foo1 + .type foo1,@function +foo1: + bl foo_1 diff --git a/ld/testsuite/ld-aarch64/build-attributes/bti-plt.ld b/ld/testsuite/ld-aarch64/build-attributes/bti-plt.ld new file mode 100644 index 00000000000..8682623d69b --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/bti-plt.ld @@ -0,0 +1,14 @@ +OUTPUT_ARCH(aarch64) +ENTRY(_start) +SECTIONS +{ + . = 0x10000; + .rela.plt : { *(.rela.plt) *(.rela.iplt) } + . = 0x18000; + .plt : { *(.plt) *(.iplt) } + . = 0x20000; + .text : { *(.text) } + . = 0x28000; + .got : { *(.got) *(.got.plt) } + .ARM.attributes 0 : { *(.ARM.atttributes) } +} diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-merged.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-merged.inc new file mode 100644 index 00000000000..ea3dd7f0513 --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-merged.inc @@ -0,0 +1,32 @@ + .set NT_GNU_PROPERTY_TYPE_0, 5 + .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000 + .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0) + .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1) + .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2) + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0 +.ifndef __mask_property_bti__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI ) +.endif +.ifndef __mask_property_pac__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC ) +.endif +.ifndef __mask_property_gcs__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS ) +.endif +.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_VALUE +4: + .p2align 3 +5: +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-split.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-split.inc new file mode 100644 index 00000000000..fdbe9706fce --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-split.inc @@ -0,0 +1,72 @@ + .set NT_GNU_PROPERTY_TYPE_0, 5 + .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000 + .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0) + .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1) + .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2) + + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0 +.ifndef __mask_property_bti__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI ) +.endif +.ifndef __mask_property_pac__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC ) +.endif +.ifndef __mask_property_gcs__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS ) +.endif + +.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE + .section ".note.gnu.property", "a" + +.ifndef __mask_property_bti__ + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI +4: + .p2align 3 +5: +.endif + +.ifndef __mask_property_pac__ + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_PAC +4: + .p2align 3 +5: +.endif + +.ifndef __mask_property_gcs__ + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_GCS +4: + .p2align 3 +5: +.endif + +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-merged.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-merged.inc new file mode 100644 index 00000000000..783dde0c28c --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-merged.inc @@ -0,0 +1,32 @@ + .set NT_GNU_PROPERTY_TYPE_0, 5 + .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000 + .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0) + .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1) + .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2) + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0 +.ifdef __property_bti__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI ) +.endif +.ifdef __property_pac__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC ) +.endif +.ifdef __property_gcs__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS ) +.endif +.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_VALUE +4: + .p2align 3 +5: +.endif diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-split.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-split.inc new file mode 100644 index 00000000000..a171471990a --- /dev/null +++ b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-split.inc @@ -0,0 +1,72 @@ + .set NT_GNU_PROPERTY_TYPE_0, 5 + .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000 + .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0) + .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1) + .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2) + + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0 +.ifndef __mask_property_bti__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI ) +.endif +.ifndef __mask_property_pac__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC ) +.endif +.ifndef __mask_property_gcs__ + .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS ) +.endif + +.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE + .section ".note.gnu.property", "a" + +.ifdef __property_bti__ + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI +4: + .p2align 3 +5: +.endif + +.ifdef __property_pac__ + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_PAC +4: + .p2align 3 +5: +.endif + +.ifdef __property_gcs__ + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long GNU_PROPERTY_AARCH64_FEATURE_1_GCS +4: + .p2align 3 +5: +.endif + +.endif