From patchwork Fri Sep 27 14:47:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 98065 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 B128A385DDCE for ; Fri, 27 Sep 2024 14:49:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20619.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::619]) by sourceware.org (Postfix) with ESMTPS id 5233B385840F for ; Fri, 27 Sep 2024 14:48:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5233B385840F 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 5233B385840F Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2613::619 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448529; cv=pass; b=jOyyz5lW57oeYkJV2x3DI5WqrdIKEvNysjRmVDoI5+jEx1p0m26tW03TltaiRkmklSEecmY4kPTrMa0VhXTRgpsxIUrWxCxtbs8pYG5Rg4ArlE4ndmIrMhBzuwWNaCNO6fIK4v+vGbgqxER1G/txedFc9shV7AJhk2x7iRsmHC8= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448529; c=relaxed/simple; bh=Oqr1o6tXnG3t0QXTku+98LWmGIkVtU/YTVcOe431R4E=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Zui/zIq8WmSQ6NUN9D8K652dCKDffn/t1ajjb7Ngt16uvVAnySZvPrFE1e457RSA8VYCkvQQz2NeRxx9kVGsa0JqPtgXzOtOT6X0G06KJV7J6n31eBGt1xmPBJIpSkO9RbN8X7Xdrpc2sPYUtGPjiyTN+lIavHYikBiueO7EfWI= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=baqliauC1gWMC/VBmSufDiwXzX3jFIpj1e1IbNV5QAyMWkddWny45bGaVgHETxDydRgrz/2E1D5q8h7A0U5ebMnm7CEQ5ZSe0wvIaPMyZjgIhUsLQlUwb9c0UeGRAlIuUm82J3JfralnLynRtViCg7Ps9lUUwg+6rY6hAXIzJYBWdnhwX8n1C0Frb1IOjd3QjTVrt7+Yc4WvOLguh+0CXw7ImspF8XTSl6MrXeyfYxomyGa97eoq9daT4MpJOfyeyMf7KB8KStivUiflWHG/zoxdOyW9NXkTHdJJU2U39d/zmLvKQpLbqlMBfBEctDrSZ8AIaveZObQ3tISikcfLgA== 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=sdhWvzWXvD2myfzkMn/K1yb20pq3QkSz/U5ExMWW3Iw=; b=iaTw0WCsv/bFuEkUw4Um5WsE3JeuVpqxdK8+W2LWxxC+2x8Z5ms6Kr87TPv+Vj+cN/bGCeqMMiUz7Vt8dNZbf9KbqNb2qcSK6EVR6NEBuNDasvEiY7A0Ave6O9W8Fpy/h55H5tSJjVaFDTgUbPt+sLr+6pPa+sqaAfEjx0H8VweN+B/4DVQllJ+qQss7c8PoGWplGuqq20TeujDPQkK+SHkl05YKyrIzyEq1x6wFFUYZAHBoTsPaUMjPrsp9PM2/v+ZqBXSFyi1aJVT+dYmRIZWZqKeAmdRgPmiSLUkeV0LwyoQVyN7rxuL8W04GmZWn8251C8DW7pvo0BcpX+GRVA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sdhWvzWXvD2myfzkMn/K1yb20pq3QkSz/U5ExMWW3Iw=; b=FJodO09hNnDO2ptISJODUldEkUQyp7bV28SLWLXOUKMaSV9VIxCFIDsHNVZh/ZnIzAYwFYiKlL9YkGuU2hp4GNmHXJUnqw5+1loUBKJYKWEA84Qur4Bud5DjspYmiNxa9oplkU0/tTpcOyW8cE0OFNWICQnpo4O4x+/LCmteRb4= Received: from DB3PR06CA0020.eurprd06.prod.outlook.com (2603:10a6:8:1::33) by DU5PR08MB10612.eurprd08.prod.outlook.com (2603:10a6:10:51e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.9; Fri, 27 Sep 2024 14:48:34 +0000 Received: from DU6PEPF0000952A.eurprd02.prod.outlook.com (2603:10a6:8:1:cafe::57) by DB3PR06CA0020.outlook.office365.com (2603:10a6:8:1::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 14:48:34 +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 DU6PEPF0000952A.mail.protection.outlook.com (10.167.8.11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:48:33 +0000 Received: ("Tessian outbound ff7cc14e3a8a:v465"); Fri, 27 Sep 2024 14:48:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6ba62f1f88564edb X-TessianGatewayMetadata: XDByOuCpc0RMpj7dNdSQQ/GuMf7w2WDBZF4bO64wlaLdVXeHul9RtonY4NUzZRsBzXMo9ptzKDCWyvkLClvSMBQues+v3ZcYFVKpGasIqY8OkZwZRMBwwroetMfVPSfMhYizVBJ/rzHNRavOUARYvxurtaY2KyvYSCgFjD4g2HY= X-CR-MTA-TID: 64aa7808 Received: from Ld5e65c47dabc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 07AADD13-FF28-4380-B1A8-E8637A6BD39B.1; Fri, 27 Sep 2024 14:48:25 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Ld5e65c47dabc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 27 Sep 2024 14:48:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uh57aSEnv6xKK0fH7tlZ4RMNP78vFIR1B5tdBnOO2OtvZQap7ANK+PyefFh8sVYaFXwU8K55T9mq4NqLrP93yILsq9e9E6fE3bue+n79EDWVCzit0j9GIoZ4c0cW0gnq40Gv2iOOPp/rXFWMOQcdSIX7NeH0rgGx5pN5r/8cQ+gXLBA6pN/xZxZDeaEZjH3B+GMp5Nye59NopNFFl/X2iJIH2092O/IB0uhXQTOg1cwbmI34lR3nZEf992KjzN8rs2PsptG81OwlBdIh+uEmGL5sm9v0jnF2WGS5q/IEoUN+jUw7N7YC7yDvo/ZIiAqxiEBJbS4hkDuZGjfYDssVtw== 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=sdhWvzWXvD2myfzkMn/K1yb20pq3QkSz/U5ExMWW3Iw=; b=gy8FgrCep9Zh3zv7E8HbXhBDAowOXZlxoTXe+GfBEf9DEvoRViYka97ADkJdfAEfi2j9BehL2mP0hWqQ/TvrUPQXEIhj1XHOKUMnJe4fvswoUdb0RLzIL6cz8HAnrnomTXzMjrWkJUVzXUTSDQE11CLxfstdTPMWCJqBXBCMEpj1S7HxioHDfkmA1TdzhxPzaXZ9UXbCzhgf2BaesJlhl0pI3E0vpYmn01fMX50az/Aa3y1S/Mp7HkkROULsjr3hI9KXDiiVNXfJot8M/6dhv2Tc+K6eQKj+xXFluxd7OGtquvHF7dt7zbVxdZwzVCUtRvr4S4OYeNzHxW0WpPn5TQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sdhWvzWXvD2myfzkMn/K1yb20pq3QkSz/U5ExMWW3Iw=; b=FJodO09hNnDO2ptISJODUldEkUQyp7bV28SLWLXOUKMaSV9VIxCFIDsHNVZh/ZnIzAYwFYiKlL9YkGuU2hp4GNmHXJUnqw5+1loUBKJYKWEA84Qur4Bud5DjspYmiNxa9oplkU0/tTpcOyW8cE0OFNWICQnpo4O4x+/LCmteRb4= Received: from AS9PR06CA0645.eurprd06.prod.outlook.com (2603:10a6:20b:46f::17) by GV1PR08MB7826.eurprd08.prod.outlook.com (2603:10a6:150:5a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.8; Fri, 27 Sep 2024 14:48:18 +0000 Received: from AMS1EPF0000004D.eurprd04.prod.outlook.com (2603:10a6:20b:46f:cafe::9d) by AS9PR06CA0645.outlook.office365.com (2603:10a6:20b:46f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 14:48:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AMS1EPF0000004D.mail.protection.outlook.com (10.167.16.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:48:18 +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; Fri, 27 Sep 2024 14:48:12 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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; Fri, 27 Sep 2024 14:48:11 +0000 Received: from PW070M4K.cambridge.arm.com (10.57.79.200) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 27 Sep 2024 14:48:11 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" , Matthieu Longo Subject: [PATCH v1 1/4] aarch64: add debug comments to feature properties in .note.gnu.property Date: Fri, 27 Sep 2024 15:47:52 +0100 Message-ID: <20240927144755.632627-2-matthieu.longo@arm.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240927144755.632627-1-matthieu.longo@arm.com> References: <20240927144755.632627-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS1EPF0000004D:EE_|GV1PR08MB7826:EE_|DU6PEPF0000952A:EE_|DU5PR08MB10612:EE_ X-MS-Office365-Filtering-Correlation-Id: 47e6bcc4-cee7-442b-9b2e-08dcdf0375a8 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|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info-Original: Lxc5PxlbthzqHDSrIEJGrIkDHQ5+q2lpSLE2bNAKlEfp6vpJXShXZP7SOTo/+gupoIch3Ew+dAIZxB0zFMAkqP2MPRNhzLMfCNiOaUUpslWwfc1Sh3SJcO77UhpUP5B04D1rlcvvWYmPxgqbL7Z9fYXvMX7QrG4WzKJ2ugGIhPrGq2QSi1O3oUTO2A0l2GocbkAfwOu4tc0cXW7lh76mJP9WWdGk+L3OvVqPcKuAq03IsZ9LnKMle3ezdNj8xkkBvhomR8dus826hhSg18ORYIyIeGKrdj2mdWYqoh8zrFACAvUc134ZmKQUg6M39J6j26a19OCOkNyaU93qWMNbGLiniVlR3x6/BvJuEVpXKOi+DWuL+w1t09hryekJXdOYwnVnBu0pHIculrTQ/aGUxdzel03P21ty+x2y3bWBNakSfdIa2rHmYt5Be3OsWMviuIWPDtzihdAUJ15L3zC16FlBmO2d81Wf2zcMBhroobRcZKZTCYefWk/844H5oRFewPAZ7ahJaIMnKhPPAOCjMGTl8EvlCK1qyqKpYTIkazLV0z51X7Sp5Rvg4OC6msmR3x9NKou/iUWd8TlFy6H65cpeL7sGh/4nXBflwW699ObVON0EI6aBsla4omHzHQmgrtbn786m9/F7fRkDxuxfrFGzWwNZVg9TFb3XVSshtG8rUNsZbFs6J+9eLS+8ZBmC5SWBKFIWYQDxJAH56bCSp5AJWMXAb7+7k++pl8tkpjkSZdM0SUpQSgGKijJF7bWrIBYLbYbC3gFZnRtypclVqDGqZQ2aYzfrQ2JEJj64J8QBGeXEnyb2cxuY7LjGPkCpf8kvumlKlczY459y7hpJ1JtshHGq8Doj2akTBXFWo96BkiZ512ej8g3r/jGfj+SoE2jQDaibYfSuK8hsYkbpLdZs0QTfaq+jUBpNL/InnTqjlhhDhm02nEXmEz8slWwzyBUCJnPgkAMytIJcjdkPtr0q3b9SkO5pPr2p0qXitdLVWz3FFDHhfbKsQtG6qEcgouFT0oEXv5EwMtRxIrhmZWq1GfVxeMOhvRainl4oWOgdzm3SaTcxbj5tPVHT2rlJtAfR1iERYywIr/SPCE/NoRLnecqxPdBICNqCh50tqeodWF+WQzMdm4o0nK1rl54JOgV8xxWIbLEhZLXZLiCaOpDxq4F9u3ZXcVrSW1e/qu+Vi7iYpgb3h9EPC1m/SxrolDVis/ZioEIWq7iMhpiPwaKRFktG1hT1yr2OGyntdF9a3wgtIZ2ApL4iydREW4XhLfle+3XgqNNT5SXGBp3mwut20Xj79SUsvporwY6PQD/53C3O/zCobTrf9DILk1r9hHfSFhShLq6v54ArR7nD6irRXmI6i63Uwq9F9hvF/2PfZsWbsuKsJ8gGEFEP6GQNjGTnUhW/dEJwnpUTvRR3bg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB7826 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:46f::17]; domain=AS9PR06CA0645.eurprd06.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU6PEPF0000952A.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9b7296c4-d57e-4f95-e37f-08dcdf036ce6 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026|35042699022; X-Microsoft-Antispam-Message-Info: 0mvppkffSLTJaEbeaDCLi3CcS3sqeufKXMBGUQB/SNTf2XQvNIEJDUI2e8p9U8q8Z4/juYGIIrPgHxPO7rCWBC3YSPxEBuWcIAZ/1bSD8tvrddhHrg0cDMEooWt7XDHEFDw7ZpRT8mQVwxbd3akgFIHDOKW2sgdl4MYC7fdAKXzUSTx9N1Ahg4i1rxu8CEW7RVJ0YgaTAAcUkg10FW+OtaYGK9NG9dpDK4VVrBd+F2HBb07j+j8uSA79axFG9O8EL7iSvg/uUW3fk3aFG4jqszd1A/rc0NSMkm3Bwfox7Q5wkFnTd0hyR7H/1TebaV1ehUcBiwuJHHWo9aUoM4EyGQZPSY3QxNcXusIFxDdzuk4k9EATzv7f8DGWWSeai0VgYM8vJ6czn8p16aer+pKR37suVmadsSmxTroCvGMmk9RIoF9XK3ykn1KQIOtXfMCYB2nrAQjfYuyM2/ntNQ0ll3/WqusicGGhPFvNCWxS2MZAx/1L9oOr5fQzZOIfTAKGtDJZMK+ikF6IoioS/YdzHKEJ2wjbCvpvmHuYx+lQQTxb7PMInRFiDQ0Xbg4kIZTUGhi+EmVLPPmtKaQEZU/xUd7jj1unyDPoSqqYtAkTYa3JeAMbc3I9+t6Gps4SNPu7Z8UxeeEuMLBAUGJ/tV8IwxMy6BcKy2f1DCe9GvV3uQmr7FBFsdzepuD0RJerDAPv7NqxsWgx1FHzU57uZ2atmklzbyICJSAJpnMItkgJQjqsYsmR/iOuacikbe+dm3tonjo8wdXlfqFqzNOzyyCzHsyfeCmEJyNqWW2+21cTzou81PEb7VIzSj90nb/8UE3Bz27XAcsGR7ow1ucLuv4jiIlbaY2A6l10qufMKp5JvelOv9tWAMIAXeLh+So8LFs+HJpWmpOeHg/TqE1EE4gA86SHwbGo7JlPMV/QxO9uz6kKB07YXGkBZ/c14Pqpjl+ZIgdawcpvFlrZZdkr5R25OPXlqtAN0iMGF1fGB0tjaRWJazqYY8DUSQanANH9Qy10cBrKMkCQHNsi0UqgtjsP5eK3sl3yIn+HF9LVe5lStmdvwaY6Sq0Lflls3zy4viYsoWw1DzmRZ9IreHGvvVopWWLMz0nQHgdIPYrhnHOnNy9x/QEjBEIk1/BSUmmTGrmdXRsLvYo6J179mAuT2Oz0kBywaVnNjuUGZRC0f80/12i4ultoAbXsnQ9HlYTIDmDuW9dDc5dnQn01DdVoNH6tCGbm0YFfQDQOuOy00CWbInZbmrzIIqNQv3uenER7ISHc49hRnGVe1jVH1A/Nvg1z6SYpSGTXCq7lXV9TQjF27Z7LIELj5/7wofN4xXmSygYf5WgVdVT1qLXDDNepwujKgPgGmlL05hq5mTDd7JzvhyCSL69QZfbQaKZT0LFo8VWkCImGrp/w9lc5oIhhnefhrA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026)(35042699022); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 14:48:33.0554 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47e6bcc4-cee7-442b-9b2e-08dcdf0375a8 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: DU6PEPF0000952A.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU5PR08MB10612 X-Spam-Status: No, score=-11.9 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org GNU properties are emitted to provide some information about the features used in the generated code like PAC, BTI, or GCS. However, no debug comment are emitted in the generated assembly even if -dA is provided. This makes understanding the information stored in the .note.gnu.property section more difficult than needed. This patch adds assembly comments (if -dA is provided) next to the GNU properties. For instance, if PAC and BTI are enabled, it will emit: .word 3 // GNU_PROPERTY_AARCH64_FEATURE_1_AND (BTI, PAC) gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_file_end_indicate_exec_stack): Emit assembly comments. gcc/testsuite/ChangeLog: * gcc.target/aarch64/bti-1.c: Emit assembly comments, and update test assertion. --- gcc/config/aarch64/aarch64.cc | 41 +++++++++++++++++++++++- gcc/testsuite/gcc.target/aarch64/bti-1.c | 5 +-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 4b2e7a690c6..6d9075011ec 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -98,6 +98,8 @@ #include "ipa-fnsummary.h" #include "hash-map.h" +#include + /* This file should be included last. */ #include "target-def.h" @@ -29129,8 +29131,45 @@ aarch64_file_end_indicate_exec_stack () data = feature_1_and. */ assemble_integer (GEN_INT (GNU_PROPERTY_AARCH64_FEATURE_1_AND), 4, 32, 1); assemble_integer (GEN_INT (4), 4, 32, 1); - assemble_integer (GEN_INT (feature_1_and), 4, 32, 1); + if (!flag_debug_asm) + assemble_integer (GEN_INT (feature_1_and), 4, 32, 1); + else + { + asm_fprintf (asm_out_file, "\t.word\t%u", feature_1_and); + + auto join_s = [] (std::string s1, + const std::string &s2, + const std::string &separator = ", ") -> std::string + { + return std::move (s1) + .append (separator) + .append (s2); + }; + + auto features_to_string + = [&join_s] (unsigned feature_1_and) -> std::string + { + std::vector feature_bits; + if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) + feature_bits.push_back ("BTI"); + if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_PAC) + feature_bits.push_back ("PAC"); + if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_GCS) + feature_bits.push_back ("GCS"); + + if (feature_bits.empty ()) + return {}; + return std::accumulate(std::next(feature_bits.cbegin()), + feature_bits.cend(), + feature_bits[0], + join_s); + }; + auto const& s_features = features_to_string (feature_1_and); + asm_fprintf (asm_out_file, + "\t%s GNU_PROPERTY_AARCH64_FEATURE_1_AND (%s)\n", + ASM_COMMENT_START, s_features.c_str ()); + } /* Pad the size of the note to the required alignment. */ assemble_align (POINTER_SIZE); } diff --git a/gcc/testsuite/gcc.target/aarch64/bti-1.c b/gcc/testsuite/gcc.target/aarch64/bti-1.c index 5a556b08ed1..e48017abc35 100644 --- a/gcc/testsuite/gcc.target/aarch64/bti-1.c +++ b/gcc/testsuite/gcc.target/aarch64/bti-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* -Os to create jump table. */ -/* { dg-options "-Os" } */ +/* { dg-options "-Os -dA" } */ /* { dg-require-effective-target lp64 } */ /* If configured with --enable-standard-branch-protection, don't use command line option. */ @@ -61,4 +61,5 @@ lab2: } /* { dg-final { scan-assembler-times "hint\t34" 1 } } */ /* { dg-final { scan-assembler-times "hint\t36" 12 } } */ -/* { dg-final { scan-assembler ".note.gnu.property" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler "\.word\t7\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI, PAC, GCS\\)" { target *-*-linux* } } } */ \ No newline at end of file From patchwork Fri Sep 27 14:47:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 98066 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 C9F71385DC20 for ; Fri, 27 Sep 2024 14:49:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20616.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::616]) by sourceware.org (Postfix) with ESMTPS id 79785385DC1B for ; Fri, 27 Sep 2024 14:48:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79785385DC1B 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 79785385DC1B Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2613::616 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448536; cv=pass; b=dvYdydfTBeMyEHBoJe40uc8Swgw0L977eQFpeffc24NzG+T3vr/HJzKhMf+GL9snQG+vwdNkeqEUAao5hhhzG/419rSdPVQ+PS2OzyzKlwq+AtgZiVm0r7adpmxztyRHwCWoE07Q7devVUFvj+rfRAnuqkroqozZ8wAGMl3NcvY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448536; c=relaxed/simple; bh=HoQYwQ8AioGXG9XBMxjju0HWHtt8tq61X49aXIuTHvc=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=x4QhZWQLsR9E3nN1HwS7BgCQV/Lt5Ruox8G0czwRC/5uhoumtOnqK6C8P/RW0ETc09IGcIl9dkWiRub8HnoqmCRTO1S9bGS3jw8SKivQkGlgHdricfHhlRcwvTTMg3g2Dxb+KhfNUGxZw6bGPBLRwzsCYygNVbN3VcG9JGBI6+Q= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=cbTcgfIjegWDxtoFsO2kIrpZP7FTC2U9n4bLmyXyOO9JNRgmCNHRWAEXPtCsVhqc6gZA6CDn4CMOrjn+0lU3u7I+Q0EOpG9nvTRv4K3EkCgG8YFX/p1SUk8QEXkIwQk9YRuSmCVdSaDv+UAziy6ewulGYRedWs7484HmZpB0vLp+3iznHhyMnBfQ1Car6b5K2/AWzraXnfHLTWFAJwMIui1+LmwHoUd//aOa2B64m3zWc52SmC16LqnlwsvXUmYwiBnc6XyEQDgqbnCgBCo6t8Z40LmGsnkax78uDM66u9WoTxokuMzgHKKg0bJq7gDlLP8y10puOs6cDsrAUfdTkw== 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=62rxLiQlz3HAc/GQN3GDrpT7G2ixO5nlWNaSigkIrKI=; b=RqqJ6L36nbc4yzMAsTqTRs3RnVwvwMdMtpf2sc6Qjb1YtT6VZnKrzVfs+ENILNj1IQPGrzL3nnE80rv+fjhGlMFjbSKQdQDHX9ZBfKGDN0H3k2N2DWt82lOCk0cpbihXR2XMy3OVtw508N9/v+VbF6rMAoJ3yvNWhhJ9AAJdyLvIY222qJHWkNwepTZCqnGvgoBfBxLzBblObujIWWAmHVRGvSHGa0xQT0/ildVc+DrHJye7vGsMp4+WR24nxP72ZnLswf7fADa+tOGwYf9M1w+R0TBXfmJvh78rto2vrNIbkok0fSFlBy7eZhMJLbPlcl9+4x9m0D5VTUqKeDpCXQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=62rxLiQlz3HAc/GQN3GDrpT7G2ixO5nlWNaSigkIrKI=; b=FsmQJgbG4tp9QWtvlKXPRviZLlGYcaboLytLBD6anAmXfdwI0VknWMnUXIy0SRqJuDGYPZSV+Ahy0qCNvZTRN+OGGCt3GSW1QvnMzB78L1DYZJqa7Q2n7TOnJb7DoLRhgHBgER+HB+hFLJdyqgA9z8qo09J5XTK/H7ZUJQVkCfs= Received: from DUZPR01CA0250.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b5::6) by DB3PR08MB8964.eurprd08.prod.outlook.com (2603:10a6:10:431::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.8; Fri, 27 Sep 2024 14:48:39 +0000 Received: from DB1PEPF00039233.eurprd03.prod.outlook.com (2603:10a6:10:4b5:cafe::77) by DUZPR01CA0250.outlook.office365.com (2603:10a6:10:4b5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 14:48:39 +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 DB1PEPF00039233.mail.protection.outlook.com (10.167.8.106) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:48:39 +0000 Received: ("Tessian outbound e9f81699740c:v465"); Fri, 27 Sep 2024 14:48:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e919b5cc5521a81c X-TessianGatewayMetadata: TEHd2L01HAb2zqnoLGTe7q3iNwDuma6Z8pv3sSd7CfPk5BpDOyEHMJPF0IlUW2yZoJ5nJZVzxnRBwLA5lpRxrXVjACF9rTlqMKbr/X/e9hG70CrCbPVKYLAGAGQrHyLDXljx654iwf04nzadPuw9kW5BepJbpYSXdzS5CofBknY= X-CR-MTA-TID: 64aa7808 Received: from Lce1cb43be5c5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8F6F860C-301F-4831-92B4-D50819AADB28.1; Fri, 27 Sep 2024 14:48:32 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lce1cb43be5c5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 27 Sep 2024 14:48:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pMxe0jF3+Dkrr73Eue4FYmhVfGECRpBBFfdAwY8m5/5qbT7RuG7T37nyxHLoeZICAFwOIm4djBxUXqYHTRt6V3PIJ/bNgdplMevGkGGpi6qgj2H+X+7irj09nKchr1dhDlsG7EB+aPXH/riWbna3K5+ggUxuskCTiRnV7m6QayfvwQqDU9pN9qyobuetExhvyu7nbEyGMU/oIOLlKeffwtbhZHdDZdWOP6gg7vlhw3pfNfHb7LdAG0hRiSwFhh6UGuTixT0xpIQoKQ4dHvQIJm29O0Hvz5U20oKN00nbhr7AzAsrhoqJe9gCXkxah+jyRxyYJkddMuuOlPBffvf2Tg== 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=62rxLiQlz3HAc/GQN3GDrpT7G2ixO5nlWNaSigkIrKI=; b=bKdgsRZvnjhYMsjdRhOXxP7dQqHtrN0VnMKOIFSCi9qt8kWx5biIB0NUyUT3rJ4cUEmDPAvUi7w70A3fLI4sb6AxtAIv4ES+9NUVVZW72HkIgrPsgtFUh+TK3kFQ2m2D0WFbbBzY12/t8zNYUGb2rtWv2EDVCRum4z/hJA70iqjPoslym1BbDjrNDe1tDQR39sns5XldK2tidGW0k6QNIRcLMLWDabksOIf7zr3QVDNwA8P6SarkzDmW7XPs/bencc9d02iktpOBQwdzAtbztaEEW/5/XUa+EQxeZ2/kxOl+e8g1vmschi0+S0Lf3ynhLXHslS3u2nzQrI1GnecjtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=62rxLiQlz3HAc/GQN3GDrpT7G2ixO5nlWNaSigkIrKI=; b=FsmQJgbG4tp9QWtvlKXPRviZLlGYcaboLytLBD6anAmXfdwI0VknWMnUXIy0SRqJuDGYPZSV+Ahy0qCNvZTRN+OGGCt3GSW1QvnMzB78L1DYZJqa7Q2n7TOnJb7DoLRhgHBgER+HB+hFLJdyqgA9z8qo09J5XTK/H7ZUJQVkCfs= Received: from DUZPR01CA0033.eurprd01.prod.exchangelabs.com (2603:10a6:10:468::8) by DBBPR08MB10652.eurprd08.prod.outlook.com (2603:10a6:10:531::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.8; Fri, 27 Sep 2024 14:48:26 +0000 Received: from DU2PEPF00028D12.eurprd03.prod.outlook.com (2603:10a6:10:468:cafe::4b) by DUZPR01CA0033.outlook.office365.com (2603:10a6:10:468::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 14:48:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DU2PEPF00028D12.mail.protection.outlook.com (10.167.242.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:48:26 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 27 Sep 2024 14:48:22 +0000 Received: from PW070M4K.cambridge.arm.com (10.57.79.200) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 27 Sep 2024 14:48:22 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" Subject: [PATCH v1 2/4] aarch64: add minimal support for GCS build attributes Date: Fri, 27 Sep 2024 15:47:53 +0100 Message-ID: <20240927144755.632627-3-matthieu.longo@arm.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240927144755.632627-1-matthieu.longo@arm.com> References: <20240927144755.632627-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF00028D12:EE_|DBBPR08MB10652:EE_|DB1PEPF00039233:EE_|DB3PR08MB8964:EE_ X-MS-Office365-Filtering-Correlation-Id: 62a81f91-f655-43cd-f4c9-08dcdf03792b 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|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info-Original: =?utf-8?q?g5/hiKPaaaNKS19w3ucLYi?= =?utf-8?q?ld0175uhLdIkIRh05hI06g9pLOb7DONu6UBSHpUd8gEdcbu5jha8q5uyTqLpDBbXm?= =?utf-8?q?BeAjglBXP0Ryxrfh5I4h6kKKeAxE2wae1XyQZEyfPUq96hy3lrwODRhpZhAiB9hd6?= =?utf-8?q?J1Os0PRjfsn2R6is05lz5Hx934ODuE0LDiQhULLh31X3Pt9RYWmn5L9mj40w2QJOB?= =?utf-8?q?B4QC7iHVGw90f88wfEf78UL0bhADYckEWHBgUiIEn3JL6VbQGxJpKrN02sNi4Ss8k?= =?utf-8?q?ndizVLq/2Ber28U9nrqtyWGytob/K49qJnAn4q71nx9Js5fqnYFthsgy+wclIZPue?= =?utf-8?q?GGf3ecotQASikiRbyvGb1kmPUdZUSw5H/WJjyXbLpIDtHPc+AIaa+HbGtjrsCf1TW?= =?utf-8?q?EquJkKLqbkjvwFhtEgwdOGFFXJfp1SDSGcB3sMSp/raFa+bdvn1WMAou8wo0SdCbr?= =?utf-8?q?lQQWEsEDa5t2ZblwmVgvAGetk0Mt2rdl/3+MUoRpzuItbhDrfOSF8NufLUaSNmbJt?= =?utf-8?q?d5ESWhv1BzvHfL6fhdjcJ9sEMce6izayW4zPViy6tSFQOaF2phGMD3Fjw1p/PB25Z?= =?utf-8?q?Pe4wuMp1m8NzMaGDyckNB8qL9R+83OGvWl82etmPonKADrBA1txWLIGkLZoyGaImr?= =?utf-8?q?6moX8NMVtsEK3SNS3PLUFpuomhC0VMF58jopxUxySY+krFBKiUVcyEytqxfIiNJzE?= =?utf-8?q?ZFYZg2NCZy/VCnSoW0Nr5QkFdjhyKj2y5drn2Qyk5b4ufCkuW/PW3nIHu8YGyYyaM?= =?utf-8?q?BvTU9OjCErdZqNktY74t6c7x4RObeaTVDRykLDRzXVApNAXaMi2E6Yo6885A4XR88?= =?utf-8?q?wxVBrvv7CzjJjGWcgmcpm/YTXh8NcjHRnhp2KoJcvXTvhZfQTuAS5kUIMS3mlm4JO?= =?utf-8?q?qAQUsolsEp4nTrPlNC1FWCxPLScvYCbyirNLHZ4iIYHIsMTLj8bttvLcFxakUceZB?= =?utf-8?q?oBHAAvCvknDdwSANdvG0Yj5RaPBMoXRYBfkB9+j0G3QjxnvobqWjBlRW5XBOUhRhi?= =?utf-8?q?pfwMPN8ojda3otayoB4i1QdLJJEkOjpufJHsloiwVGc6hN58ejC28NkF4OF1lEwKA?= =?utf-8?q?pOUFURCyTGDh8KofyzSXTtbk+fWzbmz3PmEt488g47XBIy3748On+qJWzsdgIcqnA?= =?utf-8?q?KH4ZfaPTqPMoiOP+rawrdGd1aylBFJHy/s59XMiAR4DlioqCfJ13DtjhLIgonmE5z?= =?utf-8?q?aGdWG5woywEGJp9IUQYcmVDSzQTLrHIKtI+PJsC+IUmyi0FXFOfeXvf/ROOBgAprn?= =?utf-8?q?Lgc5vZKZvAIdvArU/5EvL6V9gjNXU9yAZuOjYPShr0Ur+Y4yQFYpQjvXrh6JvqTC1?= =?utf-8?q?8Md7sZqufm5vzFguTk4cX8NvHSLbPQPe5RwSm86BGhA=3D=3D?= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10652 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:10:468::8]; domain=DUZPR01CA0033.eurprd01.prod.exchangelabs.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF00039233.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 21cf9297-88fb-4a8c-80eb-08dcdf03717d X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|35042699022|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Qd4LNVuF4DALjQA1skTiUrTl0QODqZa?= =?utf-8?q?CPvS/yatKlmlhNoiT/rtVUpY9L0caLRRsWLLsLwU/8lC8iyDwsrm7hSrT/EhXzBkn?= =?utf-8?q?dhQU+kgyflYKTcXcm8t6e3N2rpYBt/k+koFNesek9TQjXVbd1IEdoK+0yyFXip7RN?= =?utf-8?q?+1xGt9ha3kipZ0FxbfCC7ffg+JeXSrXYSYz7SH1lh16rQzD/slCFsionNkcrC+OsR?= =?utf-8?q?3BnjZ7VJPSoQoUZ8fVAP3CAmfI65KaTJ5qClAVIiz2BiKj+j4SoPSozBlK/QWwdq7?= =?utf-8?q?wBIrTdCGUWmWHDNbsl3qUzBzKT4n+uB5+1XAV2DKfGJmFVpOBPuLEDXm6JgysjZPN?= =?utf-8?q?iHf92kwC4V7oSkMDoPLpp5Wsr5HPGHiyaRSCBa3NIhkJrQv2KomNiMyxcK/Cv/i22?= =?utf-8?q?HRlqlYpnY2lBeqq7SoR24wjY7fdgOzt3Qc3lLSPZ6hO1UbiGd/B9+GgmTpxQet90F?= =?utf-8?q?p1ijPidY9lniyK23y9ClQYFG4zxQkt4It0uOTZ1l/aYfAxZClW6LXEGEWRmsS7kfn?= =?utf-8?q?wCMZ/JUQDnbRXy8buBe+4xfkyH4em80SJ4pq0oyfa46/jLfiuSDIOW/KfafOsb8F3?= =?utf-8?q?cbJ5Xlihe/AZvDYgjROy+YYbZ6mdWUMZ2FoPZxE7NQafWTsBP7kqdahkV2ewEBJzy?= =?utf-8?q?Nt3VsNSBOklKxcfbRS5621Hp3/BuJx76FjlHHHKeb8PLczzF57rc18+nsHkUZxBDc?= =?utf-8?q?o9HahH1japBFbgekbhix3ln7/lYLteBdQ6FOBNMV06FUUjdmfd/CdKpT86YEjM8E2?= =?utf-8?q?i/7Tp1c5MP8bwiB6fomALQJxtWHHNWS8fiwamgPSM5XMyP1Ci1acOYY2T9v7Yp7RJ?= =?utf-8?q?mMkBDanFu7xdVFKylpjdZdbpti8P+VufRWVStkIGPFBSP2GlsULKdVJu6wiUxRoCS?= =?utf-8?q?ZHtyvJdEm2oKSSGUXwsfj1hWj7HQ7rg7c+kXRadJ0Mk7hTqim74s+QVE2+NsKZUtj?= =?utf-8?q?cWgZo//1dNAtE8OanIWZfIirRYzlGYRwIcshPHlIyRkaYnubhGhaOkvVPs5FqaiWP?= =?utf-8?q?PXysNYUME/sIJdQYqJx8XnMkecPVPZLEbAHgCY1lgLNV9msoi4xNhBnbvsd77oWzn?= =?utf-8?q?L60pVF6B9ax+rSrO++4aNjCT7IHPJTbl2IegbVaw8BgNv45RmG4a7bLyN8PVdwR2+?= =?utf-8?q?rI2jRnWW/bJW8xyB/c9nEaYp2zr4hUGSahixIuZu2nQqKqEJXK7/mr6xiiSqur6sO?= =?utf-8?q?CESjD31ivFyHIfXFQHZdA9g0v0oIidkQ70tgvhlLoRqfd14UEU9DnOYSch4FlrtGH?= =?utf-8?q?0vvnlyUN+/aFfWZJoafsVRb2j38vqGB1gGQ=3D=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:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(376014)(35042699022)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 14:48:39.0118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62a81f91-f655-43cd-f4c9-08dcdf03792b 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: DB1PEPF00039233.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB8964 X-Spam-Status: No, score=-11.9 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Srinath Parvathaneni GCS (Guarded Control Stack, an Armv9.4-a extension) requires some caution at runtime. The runtime linker needs to reason about the compatibility of a set of relocable object files that might not have been compiled with the same compiler. Up until now, GNU properties are stored in a ELF section (.note.gnu.property) and have been used for the previously mentioned runtime checks performed by the linker. However, GNU properties are limited in their expressibility, and a long-term commmitment was taken in the ABI for the Arm architecture [1] to provide build attributes. This patch adds a first support for AArch64 GCS build attributes. This support includes generating two new assembler directives: .aeabi_subsection and .aeabi_attribute. These directives are generated as per the syntax mentioned in spec "Build Attributes for the ArmĀ® 64-bit Architecture (AArch64)" available at [1]. gcc/configure.ac now includes a new check to test whether the assembler being used to build the toolchain supports these new directives. Two behaviors can be observed when -mbranch-protection=[gcs|standard] is passed: - If the assembler support them, the assembly directives are emitted along the .note.gnu.property section for backward compatibility. - If the assembler does not support them, only .note.gnu.property section will emit the relevant information. This patch needs to be applied on top of GCC gcs patch series [2]. Bootstrapped on aarch64-none-linux-gnu, and no regression found. [1]: https://github.com/ARM-software/abi-aa/pull/230 [2]: https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/vendors/ARM/heads/gcs gcc/ChangeLog: * config.in: Regenerated * config/aarch64/aarch64.cc (aarch64_emit_aeabi_attribute): New function declaration. (aarch64_emit_aeabi_subsection): Likewise. (aarch64_start_file): Emit gcs build attributes. (aarch64_file_end_indicate_exec_stack): Update gcs bit in note.gnu.property section. * configure: Regenerated. * configure.ac: Add gcc configure check. gcc/testsuite/ChangeLog: * gcc.target/aarch64/build-attributes/build-attribute-gcs.c: New test. * gcc.target/aarch64/build-attributes/build-attribute-standard.c: New test. * gcc.target/aarch64/build-attributes/build-attributes.exp: New DejaGNU file. * gcc.target/aarch64/build-attributes/no-build-attribute-bti.c: New test. * gcc.target/aarch64/build-attributes/no-build-attribute-gcs.c: New test. * gcc.target/aarch64/build-attributes/no-build-attribute-pac.c: New test. * gcc.target/aarch64/build-attributes/no-build-attribute-standard.c: New test. --- gcc/config.in | 6 +++ gcc/config/aarch64/aarch64.cc | 41 +++++++++++++++++ gcc/configure | 38 +++++++++++++++ gcc/configure.ac | 10 ++++ .../build-attributes/build-attribute-gcs.c | 12 +++++ .../build-attribute-standard.c | 12 +++++ .../build-attributes/build-attributes.exp | 46 +++++++++++++++++++ .../build-attributes/no-build-attribute-bti.c | 12 +++++ .../build-attributes/no-build-attribute-gcs.c | 12 +++++ .../build-attributes/no-build-attribute-pac.c | 12 +++++ .../no-build-attribute-standard.c | 12 +++++ 11 files changed, 213 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/build-attributes.exp create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-bti.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-gcs.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-pac.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-standard.c diff --git a/gcc/config.in b/gcc/config.in index 7fcabbe5061..1309ba2b133 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -379,6 +379,12 @@ #endif +/* Define if your assembler supports GCS build attributes. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_BUILD_ATTRIBUTES_GCS +#endif + + /* Define to the level of your assembler's compressed debug section support. */ #ifndef USED_FOR_TARGET diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 6d9075011ec..61e0248817f 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -24677,6 +24677,33 @@ aarch64_post_cfi_startproc (FILE *f, tree ignored ATTRIBUTE_UNUSED) asm_fprintf (f, "\t.cfi_b_key_frame\n"); } +/* This function is used to emit an AEABI attribute with tag and its associated + value. We emit the numerical value of the tag and the textual tags as + comment so that anyone reading the assembler output will know which tag is + being set. + example: .aeabi_attribute 3, 1 // Tag_Feature_GCS */ + +void +aarch64_emit_aeabi_attribute (const char *name, uint8_t num, uint8_t val) +{ + asm_fprintf (asm_out_file, "\t.aeabi_attribute %u, %u", num, val); + if (flag_debug_asm) + asm_fprintf (asm_out_file, "\t%s %s", ASM_COMMENT_START, name); + asm_fprintf (asm_out_file, "\n"); +} + +/* This function is used to emit an AEABI subsection with vendor name, + optional status and value type. + example: .aeabi_subsection .aeabi-feature-and-bits, 1, 0 */ + +void +aarch64_emit_aeabi_subsection (const char *name, uint8_t num, uint8_t val) +{ + asm_fprintf (asm_out_file, "\t.aeabi_subsection %s, %u, %u\n", + name, num, val); +} + + /* Implements TARGET_ASM_FILE_START. Output the assembly header. */ static void @@ -24697,6 +24724,20 @@ aarch64_start_file (void) asm_fprintf (asm_out_file, "\t.arch %s\n", aarch64_last_printed_arch_string.c_str ()); +/* Emit gcs build attributes only when building a native AArch64-hosted + compiler. */ +#if defined(__aarch64__) + /* Check the current assembly supports gcs build attributes, if not + fallback to .note.gnu.property section. */ + #ifdef HAVE_AS_BUILD_ATTRIBUTES_GCS + if (aarch64_gcs_enabled ()) + { + aarch64_emit_aeabi_subsection (".aeabi-feature-and-bits", 1, 0); + aarch64_emit_aeabi_attribute ("Tag_Feature_GCS", 3, 1); + } + #endif +#endif + default_file_start (); } diff --git a/gcc/configure b/gcc/configure index ec6124cb361..29b9ee149d8 100755 --- a/gcc/configure +++ b/gcc/configure @@ -28036,6 +28036,44 @@ if test $gcc_cv_as_aarch64_picreloc = yes; then $as_echo "#define HAVE_AS_SMALL_PIC_RELOCS 1" >>confdefs.h +fi + + # Check if we have binutils support for GCS build attributes. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for GCS build attributes support" >&5 +$as_echo_n "checking assembler for GCS build attributes support... " >&6; } +if ${gcc_cv_as_aarch64_gcs_build_attributes+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_aarch64_gcs_build_attributes=no + if test x$gcc_cv_as != x; then + $as_echo ' + .set ATTR_TYPE_uleb128, 0 + .set ATTR_TYPE_asciz, 1 + .set Tag_Feature_GCS, 3 + .aeabi_subsection .aeabi-feature-and-bits, 1, ATTR_TYPE_uleb128 + .aeabi_attribute Tag_Feature_GCS, 1 + ' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_aarch64_gcs_build_attributes=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_aarch64_gcs_build_attributes" >&5 +$as_echo "$gcc_cv_as_aarch64_gcs_build_attributes" >&6; } +if test $gcc_cv_as_aarch64_gcs_build_attributes = yes; then + +$as_echo "#define HAVE_AS_BUILD_ATTRIBUTES_GCS 1" >>confdefs.h + fi # Enable Branch Target Identification Mechanism and Return Address diff --git a/gcc/configure.ac b/gcc/configure.ac index d0b9865fc91..fdcbf856cc9 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4388,6 +4388,16 @@ case "$target" in ldr x0, [[x2, #:gotpage_lo15:globalsym]] ],,[AC_DEFINE(HAVE_AS_SMALL_PIC_RELOCS, 1, [Define if your assembler supports relocs needed by -fpic.])]) + # Check if we have binutils support for GCS build attributes. + gcc_GAS_CHECK_FEATURE([GCS build attributes support], gcc_cv_as_aarch64_gcs_build_attributes,, + [ + .set ATTR_TYPE_uleb128, 0 + .set ATTR_TYPE_asciz, 1 + .set Tag_Feature_GCS, 3 + .aeabi_subsection .aeabi-feature-and-bits, 1, ATTR_TYPE_uleb128 + .aeabi_attribute Tag_Feature_GCS, 1 + ],,[AC_DEFINE(HAVE_AS_BUILD_ATTRIBUTES_GCS, 1, + [Define if your assembler supports GCS build attributes.])]) # Enable Branch Target Identification Mechanism and Return Address # Signing by default. AC_ARG_ENABLE(standard-branch-protection, diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c new file mode 100644 index 00000000000..ce43a79c1d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && { gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=gcs -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ +/* { dg-final { scan-assembler "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t4\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(GCS\\)" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c new file mode 100644 index 00000000000..fd175f8137f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && gas_has_build_attributes } } } */ +/* { dg-options "-mbranch-protection=standard -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ +/* { dg-final { scan-assembler "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t7\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI, PAC, GCS\\)" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attributes.exp b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attributes.exp new file mode 100644 index 00000000000..ea47e209227 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attributes.exp @@ -0,0 +1,46 @@ +# Copyright (C) 2024 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 GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't an AArch64 target. +if ![istarget aarch64*-*-*] then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +proc check_effective_target_gas_has_build_attributes { } { + return [check_no_compiler_messages gas_has_build_attributes object { + /* Assembly */ + .set ATTR_TYPE_uleb128, 0 + .set ATTR_TYPE_asciz, 1 + .set Tag_Feature_GCS, 3 + .aeabi_subsection .aeabi-feature-and-bits, 1, ATTR_TYPE_uleb128 + .aeabi_attribute Tag_Feature_GCS, 1 + }] +} + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ + "" "" + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-bti.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-bti.c new file mode 100644 index 00000000000..a8712d949f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-bti.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && { ! gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=bti -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute 1, 1\t\/\/ Tag_Feature_BTI" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t1\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI\\)" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-gcs.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-gcs.c new file mode 100644 index 00000000000..cbf6491c75e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-gcs.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && { ! gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=gcs -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t4\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(GCS\\)" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-pac.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-pac.c new file mode 100644 index 00000000000..ef434541edb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-pac.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && { ! gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=pac-ret -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute 2, 1\t\/\/ Tag_Feature_PAC" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t2\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(PAC\\)" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-standard.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-standard.c new file mode 100644 index 00000000000..b97a8731fbf --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-standard.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && { ! gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=standard -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t7\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI, PAC, GCS\\)" } } */ \ No newline at end of file From patchwork Fri Sep 27 14:47:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 98068 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 07EED385DDDD for ; Fri, 27 Sep 2024 14:50:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::601]) by sourceware.org (Postfix) with ESMTPS id EFDF83858C3A for ; Fri, 27 Sep 2024 14:49:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFDF83858C3A 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 EFDF83858C3A Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2614::601 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448556; cv=pass; b=YwzVn3CEywh9kxQBBXf470O9E4TQLGznw6T7HMoVq3JNJkFui8tZXqluHa3FSYE+X/yUyz3q2U482su2fFeOik1QsdjZA278/Q/jwLB1FDt15qUjsXeIYwRVgICnYVTsYlOBsU+oG0LmLu7+IpDEZntDhMB3Pp/xLkHn0Y3tLrs= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448556; c=relaxed/simple; bh=L/tjLCdBWp1BOSG8u/M3QIFzdJEj5p370ehRf2Oa7ZM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=G1OoVkVqGG3qW1Ts+TfArEc4WNHB2hQYTs3a3IRaCzR94HwltHrQbH2oSAOpxobHjCpWDHPcAO2DzitHVhDTQQa9qXUI6/Q5s5Xui4YjH876qP34hziStgtu02eDrP+Esx2PRBQJAh9ePH/FeOX1NG9iTaaCloJxDVkkikBFmzc= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=IStKrO78YVT85w4MxZN6EpFgCnJOtAIXQBeOSpfzx/YKZ4vvmyNywyTP98Ot6Oyocb5jUYL/JXIcCMsH3sLXef9V05DXVZZksCKT9O61oxW7LlG8C3FfZA2TfuITe+v1LVubLm3BoH5fX81YGWSpVB0OCzTKHxSps/BnV+NqdndVnsnCpKSAzsinACawKHBfQtpPIkGGK7gPP94RU0sH18gXL/HSYzg0AAhhoXMlamC6xMGt2mY4q+Mdq5iAWda16cx3b/7jnqyzduYjFUNwMAzUpF9+VCS9yfGhdyu4WMjLoiaNUpxSPVtNAdM/cFAav+pCvJXQ4JPPG8TvOEYScg== 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=jTCqwL8wGM9fsSH97DlOZafMbZ9SIyBd+g+vYJCYXCA=; b=XKMVLXK81bogJb2Or3PIi1PfBgYKUQKEaYd+N/iHXq7DD7jcbix/p3V64dzXkmx1B8ucS8Z4AlcdTdPSPBGA2X6dTowD65Iq2Vw9tTQtFiuM7RB7xLTWVIgI1gyjqcuvzAyMcJlv3lhoySwFpeStzVx4KT2QceO4VmPpGP+kdzujsbzpMr5wcuTY21rBpgyoBm72oWWn4l0yGaDoroebXlyl2DLULRHSxjz4CvRvaaP+IkECADFIvncp9OmjeoXH8GVMXlQHu2+ycCpRPFiiC8A929GK8XEMuzILrTxQsFGHJWrLhAReYuRVWeaSmG58hv0plKqDvLFbfPDc6S1z2w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jTCqwL8wGM9fsSH97DlOZafMbZ9SIyBd+g+vYJCYXCA=; b=De7s/rN2QV34oh22QNb+VabQtkDljK2cWkqZ/4xbNdiLKl3crBwnV7E0DJKJEeAZmCQWUgCGPi749WUcz4s1rYf5PfA1BObCTSFlPb0E8Poi4giBgSVjltGMCKA8jjw03d7hvS1ESacgmv4fiFJV0arxwrW7V11IafGGxfW2v0g= Received: from AS9PR05CA0093.eurprd05.prod.outlook.com (2603:10a6:20b:498::18) by PAWPR08MB9892.eurprd08.prod.outlook.com (2603:10a6:102:342::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.13; Fri, 27 Sep 2024 14:48:56 +0000 Received: from AMS1EPF00000048.eurprd04.prod.outlook.com (2603:10a6:20b:498:cafe::a3) by AS9PR05CA0093.outlook.office365.com (2603:10a6:20b:498::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.31 via Frontend Transport; Fri, 27 Sep 2024 14:48:56 +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 AMS1EPF00000048.mail.protection.outlook.com (10.167.16.132) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:48:55 +0000 Received: ("Tessian outbound 3e266b55d80f:v465"); Fri, 27 Sep 2024 14:48:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6f83fd0faf10440f X-TessianGatewayMetadata: iLPVTvpzsB8Uzdltzg4ih0ZCjBJIprHRIwh2cQR1GkY1Z7QhSxb9qcpwikoNMia/+yU2YH3dlG5roQOEuByKk+c6KqC7mjDa2P+IZFlyJdr9UST0DKfx+aE7j3yLpEjPeBtL941fknO5RA7YFArNTUlYcaorneuAKwqAOqL0KZQ= X-CR-MTA-TID: 64aa7808 Received: from Lbed2975d9db5.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E4D2E725-5590-4EE4-A829-7E0CB9ADE864.1; Fri, 27 Sep 2024 14:48:48 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lbed2975d9db5.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 27 Sep 2024 14:48:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r3nrPX1Bv5Dq0m08WgV3G73IwdY7Ik1ai3GFPimIF0qKpATWC0p8qy0trHCX1ZdncefwU5EvnWlWTdPAPDcQvL4E1cCmCCpZGZgibLIdj3uA2eaCnJObg439XoHBBTthlXnfsFV94vFEO2ZtXxBs/cRqpJ5azhhRg2RJS8ISPvVJrwysOj1vU/SGsWVqFgWxxjbVR7Vv90GwdUSXZog38WGjLxMe9whdGXQKvKHBD77Lm6NNBSAdO3xuiWZz0b+7luBwurzvCgzOqCHmOSYI9SqRyBJ5jCgLQewF1L5K9gYYXE2870+1gZ9gfS9KNBuKyKv9TDbVmSQDYaBPF1Tk9A== 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=jTCqwL8wGM9fsSH97DlOZafMbZ9SIyBd+g+vYJCYXCA=; b=LYhb+YshjnNoQLsJl7FRweLPV2UVfFLGel/iqQ21Kh0MJyNBYrI5tVsS2Fs45hR+g9XuRFcimlk6EqwWQWbINn8BUCVMYhVuDhyMv0mAwpfG9aCRLeBFjOPzUPEE+JmPc/nqa7CCJMqJVjmoC62sOlfapPb/jhi8gCrilqyxNe9BlbM7KktT/AqZ0/t/d1P1hoQGC2YVjRTIwodqdBCtwKg615HxNL6KiRywDlLsfsX8gyl2oLDi3+VxMS3EUNS8TYh2OoV0t7j1i2737RFKEqQG8PZ2fiHijSLhgJIzFq7F9EkNA9PcWuEuKkSfixbTZWa2miUxpnNFNkFCX18jRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jTCqwL8wGM9fsSH97DlOZafMbZ9SIyBd+g+vYJCYXCA=; b=De7s/rN2QV34oh22QNb+VabQtkDljK2cWkqZ/4xbNdiLKl3crBwnV7E0DJKJEeAZmCQWUgCGPi749WUcz4s1rYf5PfA1BObCTSFlPb0E8Poi4giBgSVjltGMCKA8jjw03d7hvS1ESacgmv4fiFJV0arxwrW7V11IafGGxfW2v0g= Received: from DB6PR0301CA0071.eurprd03.prod.outlook.com (2603:10a6:6:30::18) by GV1PR08MB8427.eurprd08.prod.outlook.com (2603:10a6:150:80::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.13; Fri, 27 Sep 2024 14:48:43 +0000 Received: from DU2PEPF00028D11.eurprd03.prod.outlook.com (2603:10a6:6:30:cafe::db) by DB6PR0301CA0071.outlook.office365.com (2603:10a6:6:30::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20 via Frontend Transport; Fri, 27 Sep 2024 14:48:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DU2PEPF00028D11.mail.protection.outlook.com (10.167.242.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:48:42 +0000 Received: from AZ-NEU-EXJ01.Arm.com (10.240.25.132) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 27 Sep 2024 14:48:34 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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; Fri, 27 Sep 2024 14:48:33 +0000 Received: from PW070M4K.cambridge.arm.com (10.57.79.200) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 27 Sep 2024 14:48:32 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" , Matthieu Longo Subject: [PATCH v1 3/4] aarch64: improve assembly debug comments for build attributes Date: Fri, 27 Sep 2024 15:47:54 +0100 Message-ID: <20240927144755.632627-4-matthieu.longo@arm.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240927144755.632627-1-matthieu.longo@arm.com> References: <20240927144755.632627-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF00028D11:EE_|GV1PR08MB8427:EE_|AMS1EPF00000048:EE_|PAWPR08MB9892:EE_ X-MS-Office365-Filtering-Correlation-Id: 85454c64-1fd7-4151-b4f5-08dcdf038311 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|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info-Original: 0Ai+sIkV9xVblg3Fcvat+G9Urk4zrWv4VnD5STzZ2LQO+5pmDG4rY61ICtZYTePAEnbmOxJ1sYkHUmN1zD4/B9tMNI3RyTKJowfvpMsCJKTGlORQXw7l4ghJk8Cfh4H3QbZlCDbrqfvWbdPUkZcUAvjtfviZRgUSqY7NDOFn5rLvsBH2aESSKWcmmv5X1qQoLKfGHTkd+Jcga4xEm0SY7cPBDVgA0ogUXt5RInZ7pkdz6nYO7OOIqajBfkUJFLWMOXR73FrUu+ClvoGAFG8vZtEJ1BmNCmWtod6bRs7axjb1Io+UVLauzCqUM5FGTH07+jT6lHAsKIyFshDf9br89KwmjGBY2BJUUXrty2rVduukEJ3p3xtuBQPZzNDxgshAoqn9qlmqXIvLnYux6046W8HIqUvLhD/2P9NDAQ6deWDOMSHbxCcsr0CFKEKu6sUOnJ3kGzw6OWzbdvxPN+sw7sQsDjdBkS2TzwDUOnRuEVz7uNEn1TveKFG0L7etTX+QecLGfBGnA2e8FBe5z2+3e93RHOkympEcDiHriiBEqy38DrpR0BoPzoWiBw+mDQUnRriSq5kOPXBZ5RN0lZqzNvmUgga4mNrcdbWHJaV1KM9PUf759CiDaOYiWwbYn39g6uGahKroPa4Wifz/iATzEFPsSf9v4jV4zQS80y0/rjV+777yamLyFSQebOFoH3guiqcHGSQepMNmGQ6LZj0dnk+VA2lV6bXThJpxQv58F/tGfR2O26Rn6DgyUylim0kIVzD6vaH8asSeYhF24n5SwgYvp8L/+Ca0cJ3qfIMuJaznzOxU9CgvNKsj9f3Db1BekLycLnp++W+pQVEwu8xiDd/XbFymKB80YjAo289NjFKGAGAiXkpi7vTdMv0DPc1zv/moZxace+12MXWQul24P1AzrxG6xlOmAZciONVNKSVkSiQOe6oM+3V9NlKUdcmHok4PBdS7JsxLG0hZf4hXl/tdem3KuvWvz7/vhkGZzO/oLPgbBDSKrVGURHBCV11QT/Rf6dYd7bpa5HG4vLTKR8M7OtCOLTNlnhWz/0ZMoQDkaGhe9Vv9Fi644DXl/ojELwrERSgwobTyYfK46hHzS9tdEBrilSulF2BJKbnpKCg2Rnx+MWJjmN5Y+PfVnWGAFZkQ84b9CeeNg5lsOuWkTwpfbX3TpRJBAsS+3EN7oHJKbtJSZcvmm75LSyj/APY+KZHSAqaY+ygatuQQrSNC9bOI87SX1Gg0cPtrxFw3xJkoIFwG0roSW8grdkeuhKj1ce6ZFGKOAjVpDLLJ34l5nM70C79WtOYRtTFb+jtPdxVNpq4wgzsjIUrB2nbIMbJtuYJsSxiJGyhfCxz/lkPMDQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8427 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:6:30::18]; domain=DB6PR0301CA0071.eurprd03.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000048.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 28dc47bc-55a0-4af0-7b95-08dcdf037b18 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|82310400026|376014|35042699022; X-Microsoft-Antispam-Message-Info: T9pd2Yz8OamRqKavHj4v0VBvsrFYtchz4Zl1kQ+U0Xd5Gj6+gIeQf99FRt2axILqa4p47hBoYy7Db6+Sld8qfnjE3j/feYRP8CZPSrjjK9m0irarKVJ93d1Hpx/0pQkf8NVu5oZD8w7CG/eIPJ7yznQlKxUHK1t6BPNezKUi3naxVS2D52F2AT7Ldu6jIUkYqo0KGs7gXMrtMnbIK5xFg56Fj9j0a79DkPGZbKt0aQMkxR1bE2z+5OysNvkdzUhcH69OFK0ygwlNODi1j4Ut5M8zws9UN0aBJenjDWTUXii/CtHJAGFX3BDCLVh5LRNCASoU+GyBt3Ez6HIzlWRY2HCCFWadTUY+G3VUJhyOJAJu8KmgZX7DiB8V/vVHazlXjKCAm37Chf+ql0x1oR89N9S5xqH7UvOuKib9SKOuXbe5K5KKCk1kz2rfQvqMnLrhclsQq5G8uriOnzncYUddnZhyXCtW4rJhvNNkE4kXM2fqc4UPn6j1YW3KdetZa0NQ+PSfzy33kfDyIq1gISBXJZcTPmKDejI19tYkCUbg1Kx8hGFgT761xHQEPUuR6FNf62y+KE/gqH1GKqy3tKuzxSbBM1w79hmRIzYtq7IMONLTzz+/06+NS6qHyy0KdFXF83sIhw8x0ifmJSNBcwMdLI9r2FmXvKQ1h/u3wRJRCfDjPozonKBhqScGb2lcwQWXNWQJYFkqxONKQSKeB6QhQ1uYQLejf6jQbAUhcku70WzvteIz2ZW9QajOz/2Z3D8AF6ebkzxAwHw/OKQEODkrRi8t1aD2jpNSjIxkv/+WxKjcSQnbLx66TCa3Kexx73U08v5STxSdJjxiiH/eOFTl0oQhjTIo6q2k0HmQolHaPwuxAG1MqM+jqHg1PZORscnv5s9RvvdM/AOT7zmhdwICEDk6rGjKq1QEJgImIQBTk0qyXlcuAsvVeaKkh1Ttd3eBSIGXHCNd9atEsmE7CfCflCvXNbkbJLY7VvdLyOFpWXv0luvibXK8n9csiRHPEUd/b+FcfubacR9QnBu8Uf1TCQW+InOdNC+7m/eYMduEXSWP6C/8Mcl7jz4QMkMQbdunSmN8km5/ede+8HMFRZw3B/ik7dApvn1TI/PF+B4p9yE/ugo0Q/9z3+lxWNPVk5TW50ydt6fA4w96uj6lHq6Kz2DDBwy9hkNvesivpYtJ+qouJb6KnHAJlDWIoOdL4pLZTUUUyvRtR43pkGu6PdQZeLi9RcPnvll93O4zQOqNIKKPRDpUE8wqnpLR3qMbn3DdcLZGaGuQko3gss44zh/mYcqz5RLRSXZ+0JvLgaIr10G48mvVowN7FmNgi8e88Heg3rWNes/P4Y6kFie1DTVBmA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014)(35042699022); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 14:48:55.5858 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85454c64-1fd7-4151-b4f5-08dcdf038311 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: AMS1EPF00000048.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9892 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org The previous implementation to emit build attributes did not support string values (asciz) in aeabi_subsection, and was not emitting values associated to tags in the assembly comments. This new approach provides a more user-friendly interface relying on typing, and improves the emitted assembly comments: * aeabi_attribute: ** Adds the interpreted value next to the tag in the assembly comment. ** Supports asciz values. * aeabi_subsection: ** Adds debug information for its parameters. ** Auto-detects the attribute types when declaring the subsection. Additionally, it is also interesting to note that the code was moved to a separate file to improve modularity and "releave" the 1000-lines long aarch64.cc file from a few lines. Finally, it introduces a new namespace "aarch64::" for AArch64 backend which reduce the length of function names by not prepending 'aarch64_' to each of them. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_emit_aeabi_attribute): Delete. (aarch64_emit_aeabi_subsection): Delete. (aarch64_start_file): Use aeabi_subsection. * config/aarch64/aarch64-dwarf-metadata.h: New file. gcc/testsuite/ChangeLog: * gcc.target/aarch64/build-attributes/build-attribute-gcs.c: Improve test to match debugging comments in assembly. * gcc.target/aarch64/build-attributes/build-attribute-standard.c: Likewise. --- gcc/config/aarch64/aarch64-dwarf-metadata.h | 247 ++++++++++++++++++ gcc/config/aarch64/aarch64.cc | 43 +-- .../build-attributes/build-attribute-gcs.c | 4 +- .../build-attribute-standard.c | 4 +- 4 files changed, 261 insertions(+), 37 deletions(-) create mode 100644 gcc/config/aarch64/aarch64-dwarf-metadata.h diff --git a/gcc/config/aarch64/aarch64-dwarf-metadata.h b/gcc/config/aarch64/aarch64-dwarf-metadata.h new file mode 100644 index 00000000000..9638bc7702f --- /dev/null +++ b/gcc/config/aarch64/aarch64-dwarf-metadata.h @@ -0,0 +1,247 @@ +/* Machine description for AArch64 architecture. + Copyright (C) 2009-2024 Free Software Foundation, Inc. + Contributed by ARM Ltd. + + This file is part of GCC. + + GCC 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, or (at your option) + any later version. + + GCC 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 GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_AARCH64_DWARF_METADATA_H +#define GCC_AARCH64_DWARF_METADATA_H + +#include +#include + +#include + +namespace aarch64 { + +enum attr_val_type: uint8_t +{ + uleb128 = 0x0, + asciz = 0x1, +}; + +enum BA_TagFeature_t: uint8_t +{ + Tag_Feature_BTI = 1, + Tag_Feature_PAC = 2, + Tag_Feature_GCS = 3, +}; + +template +struct aeabi_attribute +{ + T_tag tag; + T_val value; +}; + +template +aeabi_attribute +make_aeabi_attribute (T_tag tag, T_val val) +{ + return aeabi_attribute{tag, val}; +} + +namespace details { + +constexpr const char* +to_c_str (bool b) +{ + return b ? "true" : "false"; +} + +constexpr const char* +to_c_str (const char *s) +{ + return s; +} + +constexpr const char* +to_c_str (attr_val_type t) +{ + const char *s = nullptr; + switch (t) { + case uleb128: + s = "ULEB128"; + break; + case asciz: + s = "asciz"; + break; + } + return s; +} + +constexpr const char* +to_c_str (BA_TagFeature_t feature) +{ + const char *s = nullptr; + switch (feature) { + case Tag_Feature_BTI: + s = "Tag_Feature_BTI"; + break; + case Tag_Feature_PAC: + s = "Tag_Feature_PAC"; + break; + case Tag_Feature_GCS: + s = "Tag_Feature_GCS"; + break; + } + return s; +} + +template < + typename T, + typename = typename std::enable_if::value, T>::type +> +constexpr const char* +aeabi_attr_str_fmt (T phantom __attribute__((unused))) +{ + return "\t.aeabi_attribute %u, %u"; +} + +constexpr const char* +aeabi_attr_str_fmt (const char *phantom __attribute__((unused))) +{ + return "\t.aeabi_attribute %u, \"%s\""; +} + +template < + typename T, + typename = typename std::enable_if::value, T>::type +> +constexpr uint8_t +aeabi_attr_val_for_fmt (T value) +{ + return static_cast(value); +} + +constexpr const char* +aeabi_attr_val_for_fmt (const char *s) +{ + return s; +} + +template +void write (FILE *out_file, aeabi_attribute const &attr) +{ + asm_fprintf (out_file, aeabi_attr_str_fmt(T_val{}), + attr.tag, aeabi_attr_val_for_fmt(attr.value)); + if (flag_debug_asm) + asm_fprintf (out_file, "\t%s %s: %s", ASM_COMMENT_START, + to_c_str(attr.tag), to_c_str(attr.value)); + asm_fprintf (out_file, "\n"); +} + +template < + typename T, + typename = typename std::enable_if::value, T>::type +> +constexpr attr_val_type +deduce_attr_av_type (T value __attribute__((unused))) +{ + return attr_val_type::uleb128; +} + +constexpr attr_val_type +deduce_attr_av_type (const char* value __attribute__((unused))) +{ + return attr_val_type::asciz; +} + +} // namespace details + +/* AEABI subsections can be public or private. A subsection is public if it is + prefixed with "aeabi", private otherwise. The header of an AEABI subsection + is composed of a name (usually a vendor name), a status whether it is + optional or not, and the expected type of its associated attributes (ULEB128 + or asciz). Note: The attributes in the same subsection have all the same + type. An attribute is composed of a tag identifier (ULEB128), and its value + (ULEB128 or asciz). + + Syntax: + .aeabi_subsection NameOfTheSubsection: string (=asciz), + Optional: boolean (=ULEB128), + AttributeValueType: enum{ULEB128, asciz} (=ULEB128) + [ + .aeabi_attribute TagIdentifier: ULEB128, + TagValue: Variant[ULEB128|asciz] + ]* + + Example: + .aeabi_subsection .aeabi-feature-and-bits, 1, 0 + // Optional: true, AttrValType: ULEB128 + .aeabi_attribute 3, 1 // Tag_Feature_GCS: true + + Note: The textual representations of the tag and its value are emitted as a + comment along their numerical representations to annotate the assembler + output when the developer flag '-dA' is provided. */ +template < + typename T_tag, /* The type of a tag. */ + typename T_val, /* The type of a value. */ + size_t N = 0 /* The number of expected attributes if we know it. */ +> +class aeabi_subsection +{ + public: + aeabi_subsection (const char *name, bool optional): + name_(name), + optional_(optional), + avtype_(details::deduce_attr_av_type (T_val{})) + {} + + /* Append an attribute to the subsection. */ + void + append (aeabi_attribute &&attr) + { + attributes_.quick_push (std::move(attr)); + } + + /* Write the data to the assembly file. */ + void + write (FILE *out_file) const + { + asm_fprintf (out_file, "\t.aeabi_subsection %s, %u, %u", + name_, static_cast(optional_), + static_cast(avtype_)); + if (flag_debug_asm) + asm_fprintf (out_file, "\t%s Optional: %s, AttrValType: %s", + ASM_COMMENT_START, + details::to_c_str(optional_), + details::to_c_str(avtype_)); + asm_fprintf (out_file, "\n"); + + for (auto const& attr: attributes_) + { + details::write (out_file, attr); + } + } + + /* Indicate if the subsection is empty. */ + bool empty() const + { + return attributes_.is_empty (); + } + + private: + const char *name_; + bool optional_; + attr_val_type avtype_; + auto_vec, N> attributes_; +}; + +} // namespace aarch64 + +#endif /* GCC_AARCH64_DWARF_METADATA_H */ \ No newline at end of file diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 61e0248817f..0cc8a5ee9ad 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -83,6 +83,7 @@ #include "rtlanal.h" #include "tree-dfa.h" #include "asan.h" +#include "aarch64-dwarf-metadata.h" #include "aarch64-feature-deps.h" #include "config/arm/aarch-common.h" #include "config/arm/aarch-common-protos.h" @@ -24677,33 +24678,6 @@ aarch64_post_cfi_startproc (FILE *f, tree ignored ATTRIBUTE_UNUSED) asm_fprintf (f, "\t.cfi_b_key_frame\n"); } -/* This function is used to emit an AEABI attribute with tag and its associated - value. We emit the numerical value of the tag and the textual tags as - comment so that anyone reading the assembler output will know which tag is - being set. - example: .aeabi_attribute 3, 1 // Tag_Feature_GCS */ - -void -aarch64_emit_aeabi_attribute (const char *name, uint8_t num, uint8_t val) -{ - asm_fprintf (asm_out_file, "\t.aeabi_attribute %u, %u", num, val); - if (flag_debug_asm) - asm_fprintf (asm_out_file, "\t%s %s", ASM_COMMENT_START, name); - asm_fprintf (asm_out_file, "\n"); -} - -/* This function is used to emit an AEABI subsection with vendor name, - optional status and value type. - example: .aeabi_subsection .aeabi-feature-and-bits, 1, 0 */ - -void -aarch64_emit_aeabi_subsection (const char *name, uint8_t num, uint8_t val) -{ - asm_fprintf (asm_out_file, "\t.aeabi_subsection %s, %u, %u\n", - name, num, val); -} - - /* Implements TARGET_ASM_FILE_START. Output the assembly header. */ static void @@ -24727,18 +24701,21 @@ aarch64_start_file (void) /* Emit gcs build attributes only when building a native AArch64-hosted compiler. */ #if defined(__aarch64__) + using namespace aarch64; + aeabi_subsection + aeabi_subsec (".aeabi-feature-and-bits", true); + /* Check the current assembly supports gcs build attributes, if not fallback to .note.gnu.property section. */ #ifdef HAVE_AS_BUILD_ATTRIBUTES_GCS - if (aarch64_gcs_enabled ()) - { - aarch64_emit_aeabi_subsection (".aeabi-feature-and-bits", 1, 0); - aarch64_emit_aeabi_attribute ("Tag_Feature_GCS", 3, 1); - } + aeabi_subsec.append ( + make_aeabi_attribute (Tag_Feature_GCS, aarch64_gcs_enabled ())); #endif + if (!aeabi_subsec.empty ()) + aeabi_subsec.write(asm_out_file); #endif - default_file_start (); + default_file_start (); } /* Emit load exclusive. */ diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c index ce43a79c1d0..7b241a2c889 100644 --- a/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c @@ -6,7 +6,7 @@ int main() return 0; } -/* { dg-final { scan-assembler "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ -/* { dg-final { scan-assembler "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS" } } */ +/* { dg-final { scan-assembler "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0\t\/\/ Optional: true, AttrValType: ULEB128" } } */ +/* { dg-final { scan-assembler "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS: true" } } */ /* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ /* { dg-final { scan-assembler "\.word\t4\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(GCS\\)" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c index fd175f8137f..5c3c8738040 100644 --- a/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c @@ -6,7 +6,7 @@ int main() return 0; } -/* { dg-final { scan-assembler "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0" } } */ -/* { dg-final { scan-assembler "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS" } } */ +/* { dg-final { scan-assembler "\.aeabi_subsection \.aeabi-feature-and-bits, 1, 0\t\/\/ Optional: true, AttrValType: ULEB128" } } */ +/* { dg-final { scan-assembler "\.aeabi_attribute 3, 1\t\/\/ Tag_Feature_GCS: true" } } */ /* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ /* { dg-final { scan-assembler "\.word\t7\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI, PAC, GCS\\)" } } */ \ No newline at end of file From patchwork Fri Sep 27 14:47:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 98067 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 2B860385DDC1 for ; Fri, 27 Sep 2024 14:49:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2062c.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::62c]) by sourceware.org (Postfix) with ESMTPS id C3F11385DDE5 for ; Fri, 27 Sep 2024 14:49:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3F11385DDE5 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 C3F11385DDE5 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::62c ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448556; cv=pass; b=GsNzUv6IKN04BnoIdGAJEkPEP8HIMxI9zP6gLr56r3PTu+N9UaQvBL9kV0yCqlQgy1TnSSS3+BvwZkHRTTUH7kFSf3XqmVR8/Vdv8v0UnHsdJxhOF9Wu7cJHcB0iiS+SySI13i/4BYGGHwLNc6JFRvCUSxz4nvlt43Xjl/GbLDY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1727448556; c=relaxed/simple; bh=teEe96osA4jcg0e91fQWZz/hHgE84hvYFMTm0J56OCA=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=KEbRF6SwUwdmrCzpuYUyqu23byfPyU/qapZotSiEFm4RW0D01VojZ3GSIYgzIFMlAEF+bGt7YqC0ZAHJawd21cgn3/FbGv9TAO20O4kPH626s0Je91dr4g1YYYgQeGwF/XUlI7iSUMuoeHEVkwma2Nau7SalqQSp4xSaQ7ntpBE= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=TqqZFBRb1Jgdk3W11VhekykjrVz6SdyLb4P/d24r8ZR4WZHin15o/32Gdbvt+i3IuNysm7O+rTMaZ3A6KWw61lR3doAi3mgBm16Cta9SdgF/cf+SWBemPF23aDAUNi5qhII+5HOmFpjcEFwRsOOWkgzyAkfuS9X/1wmKyc0CIwDzhegQh8I87jzL0Xjf/YpHrUOOsuNvMmegcESb5bJ2jo1eTWMJspEu44wr7Af4XP5TsxxzpPK9Ovten+nVtSiMto6xzMly3TVkGbt+1GhZTNChCG1LR1WQB0mVBdNqyT2JJi4wf4m8r22B2vx9sU5K9PyWZfWjGD4QLEGVq8i3vQ== 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=/HKvUsIQSLN5vbTIAw0/+eA63UtpV8C/9I9Ukqd/LEo=; b=jBLpgYo19vt2rw+fKogZQKVBJXpgh5bFvO+2fVYM4UqEbOt9TBu8i99UJYDOLs0OqVcxdOBviqRRKEM03EbOnuyHprhl8k93rs+vT+ER1hWb1XV7DhB1EFZN3Y3WO5cuzM7UBNJUQJ2o1gAvsIf5v8PNG2gLIwYXfqkYWoZ8SmjZg8hnpa5ECDtsTOOSg26IPAC40I7gjF39HdpXHnkD1R1GlnkEE57ZMrS2EW8KcX5E2pabcc+s/eTdIDeD60T90qOYvn3iE0NvU4SraFIXroV3GtLdc/i9tNivNsKabU6p2JHouHU2Rsv5sw8c0ys4Lqu49vG0Cc5hjqab0pFhLw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/HKvUsIQSLN5vbTIAw0/+eA63UtpV8C/9I9Ukqd/LEo=; b=AfdPovX2jPVmO/t0GkqWuZWWbbggT4ItJAZDQM7SIyBMVJzFB8R7jFb7qN8vMQgxkRXLoRwIWh2HFect9ZlMtmSvk8tS3t8jXCiBcKGSEME7V1XCN9mGM+quI3hdYEhClqBNUX786dK2TtnXQ5R1LIZ25Jweor/oATGPRboLKEg= Received: from AM0PR10CA0056.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::36) by DB8PR08MB5513.eurprd08.prod.outlook.com (2603:10a6:10:f8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.8; Fri, 27 Sep 2024 14:49:01 +0000 Received: from AMS1EPF00000049.eurprd04.prod.outlook.com (2603:10a6:20b:150:cafe::3a) by AM0PR10CA0056.outlook.office365.com (2603:10a6:20b:150::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 14:49:01 +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 AMS1EPF00000049.mail.protection.outlook.com (10.167.16.133) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:49:01 +0000 Received: ("Tessian outbound e9f81699740c:v465"); Fri, 27 Sep 2024 14:49:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e8ffa5ba5b76b1b1 X-TessianGatewayMetadata: RxQrDHloCn2dZ7+ovFKXuyjCcrgAHQrURxgYDRU047nnM3SaO9CZr5WhYasUWrDibm4tWQScwvJDht41tdfAsUWwjz66ibcol6pkwSxk4Urk/5PVClA37lmvv2qkVwkePWo0dgYVxbvm69d+sSwR/fjfW6ozBBiXPjsJkF98Zb8= X-CR-MTA-TID: 64aa7808 Received: from L3bc984c8d636.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D07DE3F4-5CD7-4AA8-B525-B63BEE65CBC5.1; Fri, 27 Sep 2024 14:48:50 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L3bc984c8d636.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 27 Sep 2024 14:48:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WYDEVNnWAkQncv3QNamQJz8wqGdbHC+BBYiqfjLfJIIaLmPbG5goUbjty7yKFI3+W9Oc2TQuotKd405ahjmRaYH8+bjx5TyRwA1dwb9LiKs0GA/C+MW/Brcb/5BcsHavjXqbZr52wCVKUVw2xyePjyhqMD8LrN7vxWDyLBGXKqBUA66g+gfbqGTLgO+ZE7/koB6JlvjcdmFohgbsfk/WDh2L1UFyWZAB0TIDnhXqFB5aCGPjJb+htdCrhSkuKc/KjP9JbYtWc6/DVQccRK72a9mXt2rB4G7J+PjTa6VdD52WQn9W9pAaYoiWf1qkfoYOfsqrRsIjsOT7A8g5hU6DWQ== 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=/HKvUsIQSLN5vbTIAw0/+eA63UtpV8C/9I9Ukqd/LEo=; b=xpq0K98sIWPgSZreGnPVX2oeYVrwDP3Kx3bnB/hL5AsWlhBeqVFXLeihIuwfeNsaZu4xRB2EIpsPu3XIDsj11sSGC0DH22Suao9Eq/SxXPC3TH558Sk8tFNeU3FWOx9oHXpffu+Z4e99C3SSxPuSMHtt7NtVglgd/4kwokUmYDEQREgpDudesCn18u/tuzql3tpgZSStd3hEmha+SH7ADaL+0C1sbC2jJVCNuo+7rpAqwPROODYcbuKD6XLAtBj2QTSHHDLzC0/0WoakRz2KlKuwv8YIzd+NCdot5S2zvWr4rLMbrPan95RLeVQVjrECPc3BI8WlAez4PMAQTwB/Tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/HKvUsIQSLN5vbTIAw0/+eA63UtpV8C/9I9Ukqd/LEo=; b=AfdPovX2jPVmO/t0GkqWuZWWbbggT4ItJAZDQM7SIyBMVJzFB8R7jFb7qN8vMQgxkRXLoRwIWh2HFect9ZlMtmSvk8tS3t8jXCiBcKGSEME7V1XCN9mGM+quI3hdYEhClqBNUX786dK2TtnXQ5R1LIZ25Jweor/oATGPRboLKEg= Received: from DB8PR06CA0028.eurprd06.prod.outlook.com (2603:10a6:10:100::41) by FRZPR08MB11138.eurprd08.prod.outlook.com (2603:10a6:d10:136::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.8; Fri, 27 Sep 2024 14:48:46 +0000 Received: from DB1PEPF000509F2.eurprd02.prod.outlook.com (2603:10a6:10:100:cafe::2e) by DB8PR06CA0028.outlook.office365.com (2603:10a6:10:100::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 14:48:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DB1PEPF000509F2.mail.protection.outlook.com (10.167.242.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 14:48:45 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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; Fri, 27 Sep 2024 14:48:44 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 27 Sep 2024 14:48:44 +0000 Received: from PW070M4K.cambridge.arm.com (10.57.79.200) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 27 Sep 2024 14:48:43 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" , Matthieu Longo Subject: [PATCH v1 4/4] aarch64: encapsulate note.gnu.property emission into a class Date: Fri, 27 Sep 2024 15:47:55 +0100 Message-ID: <20240927144755.632627-5-matthieu.longo@arm.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240927144755.632627-1-matthieu.longo@arm.com> References: <20240927144755.632627-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB1PEPF000509F2:EE_|FRZPR08MB11138:EE_|AMS1EPF00000049:EE_|DB8PR08MB5513:EE_ X-MS-Office365-Filtering-Correlation-Id: 858263e5-ed29-4afc-2678-08dcdf038671 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: McDT1j8RO66Ho9N663sDm0GWhXwb0GFRmihxeuGrYecR0O7sIfoU1XQTMiyzXqf3bm2MHF7AmnOpZB74RPJRjI03tgczP9UFaEi8RSt0g3aNZMl1nfXZz8+UWOfE8YZ3E+eCAnW/HeiOYAn1R1c3tbfai+no0p9++BoNwTqSJ+FDaklvkaDsJQAt538dw4HUCgsE7xKMzni3RLrqG0hyR+pfUIG7L+Dt9sBtQCHeVrKXZ4kgFSHh8JBH8feYqygPIKjC5uzQ4BIr3YodaOMATye7TOgxoWJS/Hd5aiHZyRenN36gQbSfwD5aGeowHe6eFAsBqwvuFsyLUCMjm85eCOuIAOaev9I0t4WOBMN1wKDA03l2WXlKharsg4e1vngqtHsy/mBOlsRgVo6Jq5aEGw7KuJgF4lU9uLNGmT2W7YGi2xYEzcRtvPnhuW2piXonD8f+rI1l1FYVuGARew8ej6iLDKxnt4IbgVurLoCHP9azR3k8QUgqXWAVpyGbIsW+WYKRPYDNGOAcWAYqWbzCg//29FqezUJsl/NkzM3ICp3cVIo1fX7IU6aLlpgVF852HcUwrJfBm6vKuI9zQKE2bP9IJCugrv5qD1wwNupL9UC3fFH0SflLZzqgdE2MxA/kyxHHX37FAH0JvdwWmbwqLo4vwu7bf0+Erw3C/TZmmAM3AFEfUp1PAgUofUvyi8JoujxndwbPPeu9jMtYpohrM+9BelLrhYv/2ASbC0/liGhLiPZzAKV18YaCK07lcjxFdjf4KQfhrY0iKsqwV/fAx8r4FYoF6+fs3TGoyWfv4VWC32PaZIGL15EguHdBBFj7a5QYQlE3TvPVPqomIiMTu6z75vxCBdckFY7LnCWRgV3+9XM2molIWJaah9btw/Lea4V7GocMjF4L5qISVlm0ZnDbWU1RtOufubMPKVFb0I9I6c3UyT6WZC9nmJtDE8Chx+issgYs1zyrro0iDPYQYuTXJDEAvCwNY9/7bF7hHRAE90OyDRrBvJUhp1W/BpOlsVWv7R0Wp25IrQBE7bDnGjbYO3BCO+qv5aM4J4C88ymJFrM/XVLyRVp37AjVRB7z5jBUqFV8cCnEa5lunsnXK3HBh0/VdFCR3KFN1EAoe+uIaqMPPIiE7sT84HhquaCAzkC2nZ5g0+ltE3CANnbftnHzve6p2sduTp9TOyKFkhLxU51Zc2TzyvY3CHfZNpK/UJaBqHjaMhj1aht5Bp58h8rjJvqoL5iqQBYJlLcTdMuRbvmjIwIFuFsxD+fTa3Q1/waLrlqPOIOEqca7ygNNYnmmMdJB5ZBHCz+ZzfL3tQ5R0YqfSIQ7B6Q9HAI56556OdMsEeGlmSEDULjGe4lh+YciWQDjlCzdiw+ZFCfEv6d73PnhzRvm30BM+1hc7nik X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRZPR08MB11138 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:10:100::41]; domain=DB8PR06CA0028.eurprd06.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000049.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 1d735c34-c553-4153-93c4-08dcdf037d39 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026|35042699022; X-Microsoft-Antispam-Message-Info: kaFbasTMknVuLNWUk9+Gpi4noCmuOSsTdScvq0yR8aVPOxXnY5gsJ6he1GUSOkdoeQ85IX4mStTpzjm24MptpYo+346hdWBhuzcJXnB/GP3tdvQ4xmFFnqwUe1A2qqa1IwzTNSk/dJkzttSgZ56NYOLuVzpu3hK9p3oz1ufNOkjmWYPtl1fzOwtbC6wZcyr2aZmzvtj+pXUdKUybw+FFN1qZ4K7NLanRSAFAYBN4osd5HQLxhwkK6maP4CHUD0w8yEcMLp0C8bd3hT8akl+9tCGNtWmzs6yPjerZaFpukJ5ycTaYA2u0UyWwirbbv0rOC5t1CuLE0edHLVJxGo4e+PrCHNaOJzUafSPJrk+ArMm6E7sXr62i0dYAv5g+FsLt6dx0p0ieipWZKNzWlNatforcca1QUnnAzaxgSOO4H9/rouRU+PtSX0uDOtzVCAZMu3oZ6SJ5fVm8qUM/lhiW+VC6iEwXEepggylT7yjVFau7H51cyodWGtw2uangrGX9Hx/ke8fumMROT+hu1W71K53vMTjzsw0izWP44xp0TYTznnI3RC94mpye6KdK/XP71BsgnKOEcg3a52MD3OvfIivLkZ9N0AFIw9MgBAjG/eA1QVNEAW76Fyv9YE3HBcVkFyDHVZnNeHIOcM8Ji1HzK4XELukth6ikdoJ7eNPUkZ0ql90cX18UgjHF861Jho/gmwRF3mq0kQ1MJpXfO9B+PJujyNmpSSwI7Ut5JumMj3i7//u08VlbpzDNfOzBfIXpNoxvdSMVZ10/j1BDSGDEldifW3eqEvlm1iN8reSK72F45lcAeI0xx4GplkOdgYSQjOTHUAnsPQVzQiNgV0Z6uJTf9FNIgE8XwU57Mmd8dY+dd83HgJhozIS5eL7Uklb345nQvdLRTDD9k732vkicSy3dBIzEXoCm9UhpguBw+lSMkN3zG3wtfn7NewY1YX0kX5plqOECqb8qMTX1dhPwwm4MFlJMTV7gpB5KYtoIciHXiPRl2iQ8mAYoSDlVfm+B1DVhrRHPSc53QHJW7DdSViEPKwV9peBLqsDYTVki1zCaytmU6NulWAo4JwxQKs3lL2eIV6C38lGkHfRxEwqEn5qFuGaZjxzJJZtYmHdK7fbZRUTwAqfa528yAiTNNmyOOUKdiusduVP/tltSrukcHMT5mrWHYgVRksG5iAwYrgbQpU2/dptuFllULCbdmecqZnSj+uWEDus3JYxsu3DTfa8PMb67x31lE3i69Mx4zv5jJUfTJ+v5+ZmfC35Ow6bJWce5u6yavQesc8N5UvTbX7Agz8/tS3MGqw8df+wD3edSjfQNcNXdqLQqfQOF7uXUPfauzPeArr0HYCzELOLWTM2UtSKMZiWV2+HvduxQgpO/sCjqRnefO3CEgW4M1PSA3V3QmizRF/6n5hvbszRxL/peM46l0mTJAMPyYDR+ER8EZM1XFEj5+nfuBZAEiysp X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026)(35042699022); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 14:49:01.2601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 858263e5-ed29-4afc-2678-08dcdf038671 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: AMS1EPF00000049.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5513 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org gcc/ChangeLog: * config.gcc: Add aarch64-dwarf-metadata.o to extra_objs. * config/aarch64/aarch64-dwarf-metadata.h (class section_note_gnu_property): Encapsulate GNU properties code into a class. * config/aarch64/aarch64.cc (GNU_PROPERTY_AARCH64_FEATURE_1_AND): Define. (GNU_PROPERTY_AARCH64_FEATURE_1_BTI): Likewise. (GNU_PROPERTY_AARCH64_FEATURE_1_PAC): Likewise. (GNU_PROPERTY_AARCH64_FEATURE_1_GCS): Likewise. (aarch64_file_end_indicate_exec_stack): Move GNU properties code to aarch64-dwarf-metadata.cc * config/aarch64/t-aarch64: Declare target aarch64-dwarf-metadata.o * config/aarch64/aarch64-dwarf-metadata.cc: New file. --- gcc/config.gcc | 2 +- gcc/config/aarch64/aarch64-dwarf-metadata.cc | 120 +++++++++++++++++++ gcc/config/aarch64/aarch64-dwarf-metadata.h | 19 +++ gcc/config/aarch64/aarch64.cc | 87 +------------- gcc/config/aarch64/t-aarch64 | 7 ++ 5 files changed, 153 insertions(+), 82 deletions(-) create mode 100644 gcc/config/aarch64/aarch64-dwarf-metadata.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index f09ce9f63a0..b448c2a91d1 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -351,7 +351,7 @@ aarch64*-*-*) c_target_objs="aarch64-c.o" cxx_target_objs="aarch64-c.o" d_target_objs="aarch64-d.o" - extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o aarch64-sve-builtins-sme.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch-bti-insert.o aarch64-cc-fusion.o aarch64-early-ra.o aarch64-ldp-fusion.o" + extra_objs="aarch64-builtins.o aarch-common.o aarch64-dwarf-metadata.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o aarch64-sve-builtins-sme.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch-bti-insert.o aarch64-cc-fusion.o aarch64-early-ra.o aarch64-ldp-fusion.o" target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.h \$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc" target_has_targetm_common=yes ;; diff --git a/gcc/config/aarch64/aarch64-dwarf-metadata.cc b/gcc/config/aarch64/aarch64-dwarf-metadata.cc new file mode 100644 index 00000000000..36659862b59 --- /dev/null +++ b/gcc/config/aarch64/aarch64-dwarf-metadata.cc @@ -0,0 +1,120 @@ +#define INCLUDE_STRING +#define INCLUDE_ALGORITHM +#define INCLUDE_MEMORY +#define INCLUDE_VECTOR +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "backend.h" +#include "target.h" +#include "rtl.h" +#include "output.h" + +#include "aarch64-dwarf-metadata.h" + +#include + +/* Defined for convenience. */ +#define POINTER_BYTES (POINTER_SIZE / BITS_PER_UNIT) + +namespace aarch64 { + +constexpr unsigned GNU_PROPERTY_AARCH64_FEATURE_1_AND = 0xc0000000; +constexpr unsigned GNU_PROPERTY_AARCH64_FEATURE_1_BTI = (1U << 0); +constexpr unsigned GNU_PROPERTY_AARCH64_FEATURE_1_PAC = (1U << 1); +constexpr unsigned GNU_PROPERTY_AARCH64_FEATURE_1_GCS = (1U << 2); + +namespace { + +std::string join_s (std::string s1, const std::string &s2) +{ + constexpr const char* separator = ", "; + return std::move (s1) + .append (separator) + .append (s2); +}; + +std::string gnu_property_features_to_string (unsigned feature_1_and) +{ + std::vector feature_bits; + + if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) + feature_bits.push_back ("BTI"); + if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_PAC) + feature_bits.push_back ("PAC"); + if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_GCS) + feature_bits.push_back ("GCS"); + + if (feature_bits.empty ()) + return {}; + + return std::accumulate(std::next(feature_bits.cbegin()), feature_bits.cend(), + feature_bits[0], join_s); +}; + +} // namespace anonymous + +section_note_gnu_property::section_note_gnu_property(): + feature_1_and(0) +{} + +void section_note_gnu_property::bti_enabled() +{ + feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; +} + +void section_note_gnu_property::pac_enabled() +{ + feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_PAC; +} + +void section_note_gnu_property::gcs_enabled() +{ + feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS; +} + +void section_note_gnu_property::write () const +{ + if (feature_1_and) + { + /* Generate .note.gnu.property section. */ + switch_to_section (get_section (".note.gnu.property", + SECTION_NOTYPE, NULL)); + + /* PT_NOTE header: namesz, descsz, type. + namesz = 4 ("GNU\0") + descsz = 16 (Size of the program property array) + [(12 + padding) * Number of array elements] + type = 5 (NT_GNU_PROPERTY_TYPE_0). */ + assemble_align (POINTER_SIZE); + assemble_integer (GEN_INT (4), 4, 32, 1); + assemble_integer (GEN_INT (ROUND_UP (12, POINTER_BYTES)), 4, 32, 1); + assemble_integer (GEN_INT (5), 4, 32, 1); + + /* PT_NOTE name. */ + assemble_string ("GNU", 4); + + /* PT_NOTE contents for NT_GNU_PROPERTY_TYPE_0: + type = GNU_PROPERTY_AARCH64_FEATURE_1_AND + datasz = 4 + data = feature_1_and. */ + assemble_integer (GEN_INT (GNU_PROPERTY_AARCH64_FEATURE_1_AND), 4, 32, 1); + assemble_integer (GEN_INT (4), 4, 32, 1); + + if (!flag_debug_asm) + assemble_integer (GEN_INT (feature_1_and), 4, 32, 1); + else + { + asm_fprintf (asm_out_file, "\t.word\t%u", feature_1_and); + auto const& s_features + = gnu_property_features_to_string (feature_1_and); + asm_fprintf (asm_out_file, + "\t%s GNU_PROPERTY_AARCH64_FEATURE_1_AND (%s)\n", + ASM_COMMENT_START, s_features.c_str ()); + } + /* Pad the size of the note to the required alignment. */ + assemble_align (POINTER_SIZE); + } +} + +} // namespace aarch64 \ No newline at end of file diff --git a/gcc/config/aarch64/aarch64-dwarf-metadata.h b/gcc/config/aarch64/aarch64-dwarf-metadata.h index 9638bc7702f..006baa502f5 100644 --- a/gcc/config/aarch64/aarch64-dwarf-metadata.h +++ b/gcc/config/aarch64/aarch64-dwarf-metadata.h @@ -242,6 +242,25 @@ class aeabi_subsection auto_vec, N> attributes_; }; +class section_note_gnu_property +{ + public: + section_note_gnu_property(); + + /* Add BTI flag to GNU properties. */ + void bti_enabled(); + /* Add GCS flag to GNU properties. */ + void gcs_enabled(); + /* Add PAC flag to GNU properties. */ + void pac_enabled(); + + /* Write the data to the assembly file. */ + void write () const; + + private: + unsigned feature_1_and; +}; + } // namespace aarch64 #endif /* GCC_AARCH64_DWARF_METADATA_H */ \ No newline at end of file diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 0cc8a5ee9ad..80af44d9a8f 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -99,8 +99,6 @@ #include "ipa-fnsummary.h" #include "hash-map.h" -#include - /* This file should be included last. */ #include "target-def.h" @@ -29105,97 +29103,24 @@ aarch64_can_tag_addresses () /* Implement TARGET_ASM_FILE_END for AArch64. This adds the AArch64 GNU NOTE section at the end if needed. */ -#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 -#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) -#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1) -#define GNU_PROPERTY_AARCH64_FEATURE_1_GCS (1U << 2) void aarch64_file_end_indicate_exec_stack () { file_end_indicate_exec_stack (); - unsigned feature_1_and = 0; + aarch64::section_note_gnu_property gnu_properties; + if (aarch_bti_enabled ()) - feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; + gnu_properties.bti_enabled (); if (aarch_ra_sign_scope != AARCH_FUNCTION_NONE) - feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_PAC; + gnu_properties.pac_enabled (); if (aarch64_gcs_enabled ()) - feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS; - - if (feature_1_and) - { - /* Generate .note.gnu.property section. */ - switch_to_section (get_section (".note.gnu.property", - SECTION_NOTYPE, NULL)); + gnu_properties.gcs_enabled (); - /* PT_NOTE header: namesz, descsz, type. - namesz = 4 ("GNU\0") - descsz = 16 (Size of the program property array) - [(12 + padding) * Number of array elements] - type = 5 (NT_GNU_PROPERTY_TYPE_0). */ - assemble_align (POINTER_SIZE); - assemble_integer (GEN_INT (4), 4, 32, 1); - assemble_integer (GEN_INT (ROUND_UP (12, POINTER_BYTES)), 4, 32, 1); - assemble_integer (GEN_INT (5), 4, 32, 1); - - /* PT_NOTE name. */ - assemble_string ("GNU", 4); - - /* PT_NOTE contents for NT_GNU_PROPERTY_TYPE_0: - type = GNU_PROPERTY_AARCH64_FEATURE_1_AND - datasz = 4 - data = feature_1_and. */ - assemble_integer (GEN_INT (GNU_PROPERTY_AARCH64_FEATURE_1_AND), 4, 32, 1); - assemble_integer (GEN_INT (4), 4, 32, 1); - - if (!flag_debug_asm) - assemble_integer (GEN_INT (feature_1_and), 4, 32, 1); - else - { - asm_fprintf (asm_out_file, "\t.word\t%u", feature_1_and); - - auto join_s = [] (std::string s1, - const std::string &s2, - const std::string &separator = ", ") -> std::string - { - return std::move (s1) - .append (separator) - .append (s2); - }; - - auto features_to_string - = [&join_s] (unsigned feature_1_and) -> std::string - { - std::vector feature_bits; - if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) - feature_bits.push_back ("BTI"); - if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_PAC) - feature_bits.push_back ("PAC"); - if (feature_1_and & GNU_PROPERTY_AARCH64_FEATURE_1_GCS) - feature_bits.push_back ("GCS"); - - if (feature_bits.empty ()) - return {}; - return std::accumulate(std::next(feature_bits.cbegin()), - feature_bits.cend(), - feature_bits[0], - join_s); - }; - auto const& s_features = features_to_string (feature_1_and); - asm_fprintf (asm_out_file, - "\t%s GNU_PROPERTY_AARCH64_FEATURE_1_AND (%s)\n", - ASM_COMMENT_START, s_features.c_str ()); - } - /* Pad the size of the note to the required alignment. */ - assemble_align (POINTER_SIZE); - } + gnu_properties.write (); } -#undef GNU_PROPERTY_AARCH64_FEATURE_1_GCS -#undef GNU_PROPERTY_AARCH64_FEATURE_1_PAC -#undef GNU_PROPERTY_AARCH64_FEATURE_1_BTI -#undef GNU_PROPERTY_AARCH64_FEATURE_1_AND /* Helper function for straight line speculation. Return what barrier should be emitted for straight line speculation diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 index c2a0715e9ab..194e3a4ac99 100644 --- a/gcc/config/aarch64/t-aarch64 +++ b/gcc/config/aarch64/t-aarch64 @@ -139,6 +139,13 @@ aarch-common.o: $(srcdir)/config/arm/aarch-common.cc $(CONFIG_H) $(SYSTEM_H) \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/arm/aarch-common.cc +aarch64-dwarf-metadata.o: $(srcdir)/config/aarch64/aarch64-dwarf-metadata.cc \ + $(CONFIG_H) \ + $(SYSTEM_H) \ + $(TARGET_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_SPPFLAGS) $(INCLUDES) \ + $(srcdir)/config/aarch64/aarch64-dwarf-metadata.cc + aarch64-c.o: $(srcdir)/config/aarch64/aarch64-c.cc $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) output.h $(C_COMMON_H) $(TARGET_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \