From patchwork Wed Oct 23 10:35:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 99389 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 20FA93858420 for ; Wed, 23 Oct 2024 10:37:59 +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-db8eur05on20631.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::631]) by sourceware.org (Postfix) with ESMTPS id 7AED53858CD1 for ; Wed, 23 Oct 2024 10:36:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AED53858CD1 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 7AED53858CD1 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2614::631 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679805; cv=pass; b=WtAXrZwvfNEAdgctYfQbu8PLzPgCj6JH9HOAfkddAJRfHxM2/9uvof0LL8wBecBmLk0WbM/vVGNbze4YKhikEeTBd1Qc/JCB2dNDCgMp/+QGIfvqj5FcgCjMCSDPXfPk0oel2UdudTcTZwKYkqqz3IRv+cO+GxKQaTtrssDysOU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679805; c=relaxed/simple; bh=44uLh7cvmbgxhKnwh+UIpRjdJhBIMCm3ujRSO5ITLCk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Z+cuL/BReFhpMQ67Vn+QvPS952Hf37jQTR+H0GunCSE6el/SQGo0apYmT0TN8eupMOYE7JwMcldfupI8IVT8A+dNzmy+bzvd8njNbTSIEZSrIF17a2o09hCkLr979iNk4FXBjgElzh3tWmHucmKTLVdtceoYfF6ntU72/KandR8= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=w1Tc9uF12qiea5a0MRfPIDSEc4aSv81QZHAV/0G/fPYJKw930IOeMG5S50dIz9lQBpx/HSfUeh0s0KvyCEfzI6wXKUtQURzvu4OaA2jYAMtk1Wbj6VhVlFGTTZipgVYC49s87bK3zPAXHF1wVDvfBK0wYgO0H84AUdavFNxu5nH8gflUF17IuJ2nq10p+g0vfKeEWr3g/YOaxgtdh5mr6/ZwEJxy+94o32CtfbowVoj8ch25fB7s48PN9+QYBLFjCLD7Fe7o9zg8FYQQWco1eEHPhNtAJqPTu+5BCuOP3G05RreEzfgLtxMBKo6VWGgE3Cwy/yjAHq9C6jjfQJq73A== 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=1qqw0Ux1Me0WhMYb4Q9rzy4Xzlqsi7SjHm+zpnT19Vg=; b=bGAiWRuEJU9Py0rzftYdcOmpNtonoJQ6OaZLLnv/6jpxcYjLTbe9yFOjQb73Ip5YvE/CIl91nSJpxlw2286pdNGcrVCWZyIKGHK2pXA6HCWmEYBzooReTYXOditmujvdk21kbS3Q1IZO2HwiWe3/0FCu7zOv3k8vLhHi787T7JsWMFGfPxrzgK9UGqkPRSAfLKu5i+qUVpJmlY2sdWryjRdfNApxtbpiVg8h8uvr6z/4OgqRUMIBw4qcPv/0uHkGHWl74R8TbiymBsDBNBBnc6izyAF4VC2VySrwRQTtN27e2cSVA8aAH1VSZBHqpxS0Sn0ow4JzyDUO+OUbgnLyGw== 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=1qqw0Ux1Me0WhMYb4Q9rzy4Xzlqsi7SjHm+zpnT19Vg=; b=Ara47roVG69bi9Txg3RMBMLL3uJcyl9GsCd/gMR8yVBiypmPxrkB/vf0eczT4c9U5HXvoT0sx8Bz6mQT3Kb4eTziGF9yPHu+8qcVkyT6BsmuXludI+wb+iEG9vxpExZGCtApEUwu+tYLGqML84S0llfKqM5unXXhHf946inY5PE= Received: from DUZPR01CA0027.eurprd01.prod.exchangelabs.com (2603:10a6:10:46b::14) by PA6PR08MB10472.eurprd08.prod.outlook.com (2603:10a6:102:3d6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 10:36:32 +0000 Received: from DU2PEPF0001E9C0.eurprd03.prod.outlook.com (2603:10a6:10:46b:cafe::ee) by DUZPR01CA0027.outlook.office365.com (2603:10a6:10:46b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Wed, 23 Oct 2024 10:36:32 +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 DU2PEPF0001E9C0.mail.protection.outlook.com (10.167.8.69) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:32 +0000 Received: ("Tessian outbound de6fe3af73ff:v473"); Wed, 23 Oct 2024 10:36:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0cd5e5e52e847a66 X-TessianGatewayMetadata: p4emhExZ6PG/DqQuss+VgH1yYTQLFnZYJVuCnsPic9JMFzYB/CvpFla4LpPJDZSKiG26Tmn3QZii7qXB6tmSBsyurCwQ9VPYc/DFbc6+Vs1ci+AaRqL5ZY4LBOWvUSgLF8d2PNdsGcOfPQVfvifTaa2FglBO6TL+Gm03oS4royc= X-CR-MTA-TID: 64aa7808 Received: from L839503b2cd2d.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7227BFB1-47D8-41EB-AD8D-B5BAB9568983.1; Wed, 23 Oct 2024 10:36:25 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L839503b2cd2d.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 23 Oct 2024 10:36:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pv4mXzhLRUaYV8lzeoB7YnsHlUAcQ41bWjqeSM4be3bgQqNLIodrkte7t71XAF82ZDDvhCTcIaD4a/l9xE6yZoH0xByVzzdlE7LW+U++WwsqPbWwDbQ41om8lreE63pde1TIzzWFVpMuHFq+/cPx4eeB8aM71C+IoSK1Vze1ZMZbYUyPccy14diQDqHMz4gdyNPo0kQjdQIgVJ1FWWEeritANICTVXdlHtVB43VqgSA7x2CTwfrhBMjUttIVZLEiTh9GnYUYu2r/3fdDXEvTHZVltjrU2rgIn2RsuSpgZM1opHEVJo5/Qx9NBEgVygIZaPp3+AI3qhzBmroBLXlNnQ== 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=1qqw0Ux1Me0WhMYb4Q9rzy4Xzlqsi7SjHm+zpnT19Vg=; b=UcYI8XNdpQAri1yTDg9GqVJ2kAZ0bqn6x56dZKtXVhbPAZDR+wwg/Asr6LxIIIwPi8cBcZE9UJezgZOt4TUxyImGilHUOSFgBzKfO0UAZ1AonPVw+7m/Pe020g+uTBNsA0Ly9bmaM1zU3DG/+2oD69qQ13CsBfiM2j5eJ/4XRffgDhJBP3wLv3+NvrPmgPM962SdmHK/twvo9sy3U9QAxSJRgQKBNiYmZ3P15tVXqMeJL4ADOKP+SjJjIbfoMB1s8wq84TO7Zk3LfIri40ONEM/qtNhlzPiQYXyLZaUFDLDVEqbq84GnUDmQNxxeSxxMp46p2LEHw5MegrtQnZTnFA== 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=1qqw0Ux1Me0WhMYb4Q9rzy4Xzlqsi7SjHm+zpnT19Vg=; b=Ara47roVG69bi9Txg3RMBMLL3uJcyl9GsCd/gMR8yVBiypmPxrkB/vf0eczT4c9U5HXvoT0sx8Bz6mQT3Kb4eTziGF9yPHu+8qcVkyT6BsmuXludI+wb+iEG9vxpExZGCtApEUwu+tYLGqML84S0llfKqM5unXXhHf946inY5PE= Received: from DB3PR06CA0003.eurprd06.prod.outlook.com (2603:10a6:8:1::16) by DU0PR08MB10367.eurprd08.prod.outlook.com (2603:10a6:10:409::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 10:36:22 +0000 Received: from DU2PEPF0001E9BF.eurprd03.prod.outlook.com (2603:10a6:8:1:cafe::b7) by DB3PR06CA0003.outlook.office365.com (2603:10a6:8:1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Wed, 23 Oct 2024 10:36:22 +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 DU2PEPF0001E9BF.mail.protection.outlook.com (10.167.8.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:22 +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; Wed, 23 Oct 2024 10:36:13 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Wed, 23 Oct 2024 10:36:12 +0000 Received: from PW070M4K.arm.com (10.57.85.41) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 23 Oct 2024 10:36:12 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" , Matthieu Longo Subject: [PATCH v2 1/4] aarch64: add debug comments to feature properties in .note.gnu.property Date: Wed, 23 Oct 2024 11:35:57 +0100 Message-ID: <20241023103600.500910-2-matthieu.longo@arm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241023103600.500910-1-matthieu.longo@arm.com> References: <20241023103600.500910-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9BF:EE_|DU0PR08MB10367:EE_|DU2PEPF0001E9C0:EE_|PA6PR08MB10472:EE_ X-MS-Office365-Filtering-Correlation-Id: 921dc5ee-dfcb-46c2-dec5-08dcf34e8f99 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: sRs0BWNKsOc8h6DlDn9zNvRfIxsIP6EP7JfMmwr4KYyb+J6XK6GvEzUNJiOgCLmJyfuJf6ZhpHHMoaaRNUetCtPhAdnHmPbfWlkWlao/GgmuWy7fid3pP6nN01aTuO81DSZJAbHA+OE2yAHOm3AdVVHYdiRhsGXFy9gH5EwzyRAfrj+mLn8Jb6J0NUEVAg8EVKEwObebc79asO/RMzcenEW5u/MEadXd28QfVx7VTjNm/mfqDwfrgoLEbm6TTG3MeSjb+YzL5xarNmkHuktpKWx8r902gRR3oK9FtV7nwGLXyI3S4uKZ5SrCgZGw0OvIMlkPNMgf6xuCXgBThJkIZXIBWGX1tchPDEy0i/qeBajrgdl4QwsujTc4ZOxoBJahOKW0hb+hffpASqO4nrS6+k9INbZh+YT4zJsq1P1iObm1jvViHZ71e8xhJHNCsyFEQqb8mkkA2DX2wHkum0wHC4hgpZD3I+OpSKBPvPeYqTK+WMwDLWXzD1bDj8r3+gZvPkCacHcIbhHuMAJ0nDA9qnLM7yM6XG6r1Sfg19RfhlnzDKsrPlBaVd+Y0+QF7XGGV7W5swvnxQhwlPSEx/ipcIbcGm/YlRNOKHcXtdtbG/yXZhOnljv/ok8JcNpezbJnVOxFp0TCmQaA3PolxicxTWwHfX8NvTfn3ofYVOe5a1Z69Imoc7JtSKXz8inwjwDyoX8UeTNZ4mKg30Dl6KWEwaB6LUCfwOe+Flp+Bsh6OoCUvH+7eTEDd21jbCYHErcTGC3L8z1tqYxusl5xKupyXutbSGAJ11Xod5IBo+UzFXE8wC50WDkxC9doll5jFrb9MOwSmsxrnUe+E9t/4yiHfx4Q8AFgJ0SHAfT/X2uVKQyjSDzf2Ry1cI+X38MHJADxHAwyjMR7aEnnI1D6ySKWJ/t47IqmMydO+lymslH/CVG4fSsQpuQTlHCh/g8euT98JimBcwHhG52dGiMta9QDZgirptdriDey5VgS5DSdYmMjZ175FHyYHJRZ5HB5/eb4RbKm0ZkK4Fem6vFOkw1l86ZBg3fcuCWUCwnR2j3ezFtgDqdszsQMyUSE9vz/vPlOoChln48tOwLmGOtYIbCJfY0iLxo0XxrIr1LIndv/T/8PeQO606lNPABIByO/J0v+N5al08cloliYTyFsK+492nS1TyvyI56834aSp2FZNSsSbNCe3MIv86HAufIbY7YTSPkTmAE399KHMqI4xSAhhM1/NmEdqLPTsP/hWK7oIucVqA++rgfMJPS6ZX+1GNqmeYsXH7MlRjTkuRVMBGx8FCmx8hByn0zr8sYG1/OwH+1o/6WKnnDEoAWPqHGQm6T0IAQvDsvyrFSTGVAzqLg7D3MKhaYT5qrIGZCGv75AJdo= 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: DU0PR08MB10367 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:8:1::16]; domain=DB3PR06CA0003.eurprd06.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF0001E9C0.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ddd91202-ed9f-46e2-a0e2-08dcf34e89a7 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|35042699022|36860700013|376014; X-Microsoft-Antispam-Message-Info: UuzobPhCwObU0dlZMWZGq3bdxgiN5WtXHsL/8RzMUBxvt6WrTvFWBE1tmW5ShqugZUp6hqFBvzF3N2SOT/YrupfEp15UOODB3YICdERGBqyGjDN4yB4TKFpam9YPpwiiAPtpNiEl03/8OZYgOiJedtHWLMYy3lqD501RGPUZfXEmTQaZEnbGuFeVGGY3afP9MC6W1SH0i1qyQiMoBVVYWyElImRkzj7lZADcM+pai44wG/KIJd/lH+gb0N0mx3Ioy8hRAvUOx1SDHp8RCLMHl+iZW+uxZh6CrxvI1RDXyxldkJsATe+NBsDBMEk/HfZ//2CYRJVhIRhfKwI2xv7YSGfnfgRKqugsypuZ2+m5XhqgE5BsCVAJU1uIWTVXn1SrNPr4nYAsutZMsbZjZZ9X6xuO94QjHCk19bhCeE4XkrrgB9rYTaJoeol0cF+Giq0vv1Ql7CwCHp1VI4+aTZSYmwTtSm4OQKcqw8ndCgOIy/eTT5qXwNeZnmGTZ/XrlzV1I5uftbBKlk8lfDUNBZ1bztT8fxyU7EVIZR7HMm7kliiUAMnaxbAfavjqNIUSemk/BZJ9zny8NE9/6YRdT3pDRRalEcFp7Sjs7F0/p+fEwGbL0ycgtLa5THfANYO3gpoIW+q643HxdONCcoh/xS3bUWJawUo9bH/uUtCTI3qgmljOWkfSc/3vsWUp571fv5JRFqPJ6AuosDcaPz1GYxoHCpuwmRqKDKZ5dNH6/Q39ZktGysSasYHNJS/Vk1SXcrG3fWZ9tR2HJXFN/vkurklUh0Ru7gfA0pTsAaZ6OY4Eb99xkNuPVgcb/RxMS5jKwvV72VMG3AgPOGQUIqONt+ZbZfljLoeu5KfKBIrOANnZNcut/lGwwIfHqWMA/N9rNf1YZo9bmoYc+bu55+EXsp/Oo3SW6i0QHXluRAi0282BibjdZrFm5f7yi+HhW4fkIidx2Xdnfj68tfwj9iklucADG27/AWt37/j4zpniIQN9clV6fVGGEEBQ59sMGur32mrZrRHCnH+GiKfa071z+PLOFSPJTHbfnHF7cKVM920tabRy9AXZpwgYe4qnaMy01MiNB3krTkDag0YYHTYmcyUHxIMtaRA+99a2DxGWepipN+3O2PzU0KKgdQJX7vL/657fXtNVc2iT84WMh2xJ+AqqGEumIBd5CnTSYn19hUw1YeHiQp7r2Zftla6WZhDAGaCvsMijcNdu2uQrSdCKQxA2kGQw/4x1FOdt2vzyEZgICRIoqNB70IH0RbYnaCRymNPHrZd6WPK/rUa8CzPajnpO7yRwBktd/XYP+qZmaAaQ4AfxT7wjkj2DnVZSCphIse1wCKQJIuN3RmUifwUkRdE6haqXMy+88VNnQ4K8bKgxkXA= 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)(82310400026)(1800799024)(35042699022)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 10:36:32.1992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 921dc5ee-dfcb-46c2-dec5-08dcf34e8f99 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: DU2PEPF0001E9C0.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA6PR08MB10472 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, RCVD_IN_DNSWL_NONE, 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 BTI, GCS, or PAC. However, no debug comment are emitted in the generated assembly even if -dA is provided. It 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 BTI and PAC are enabled, it will emit: .word 0x3 // 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 | 35 ++++++++++++++++++++++-- gcc/testsuite/gcc.target/aarch64/bti-1.c | 13 +++++---- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 914f2902d25..0466d6d11eb 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -29259,10 +29259,41 @@ aarch64_file_end_indicate_exec_stack () 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); + fputs (integer_asm_op (4, true), asm_out_file); + fprint_whex (asm_out_file, GNU_PROPERTY_AARCH64_FEATURE_1_AND); + putc ('\n', asm_out_file); assemble_integer (GEN_INT (4), 4, 32, 1); - assemble_integer (GEN_INT (feature_1_and), 4, 32, 1); + fputs (integer_asm_op (4, true), asm_out_file); + fprint_whex (asm_out_file, feature_1_and); + if (flag_debug_asm) + { + struct flag_name + { + unsigned int mask; + const char *name; + }; + static const flag_name flags[] = { + { GNU_PROPERTY_AARCH64_FEATURE_1_BTI, "BTI" }, + { GNU_PROPERTY_AARCH64_FEATURE_1_PAC, "PAC" }, + { GNU_PROPERTY_AARCH64_FEATURE_1_GCS, "GCS" }, + }; + + const char *separator = ""; + std::string s_features; + for (auto &flag : flags) + if (feature_1_and & flag.mask) + { + s_features.append (separator).append (flag.name); + separator = ", "; + } + + asm_fprintf (asm_out_file, + "\t%s GNU_PROPERTY_AARCH64_FEATURE_1_AND (%s)\n", + ASM_COMMENT_START, s_features.c_str ()); + } + else + putc ('\n', asm_out_file); /* 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..53dc2d3cd8b 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. */ @@ -44,8 +44,8 @@ f_jump_table (int y, int n) return (y == 0)? y+1:4; } /* f_jump_table should have PACIASP and AUTIASP. */ -/* { dg-final { scan-assembler-times "hint\t25" 1 } } */ -/* { dg-final { scan-assembler-times "hint\t29" 1 } } */ +/* { dg-final { scan-assembler-times "hint\t25 // paciasp" 1 } } */ +/* { dg-final { scan-assembler-times "hint\t29 // autiasp" 1 } } */ int f_label_address () @@ -59,6 +59,7 @@ lab2: addr = &&lab1; return 2; } -/* { 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-times "hint\t34 // bti c" 1 } } */ +/* { dg-final { scan-assembler-times "hint\t36 // bti j" 12 } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" { target *-*-linux* } } } */ +/* { dg-final { scan-assembler "\.word\t0x7\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI, PAC, GCS\\)" { target *-*-linux* } } } */ \ No newline at end of file From patchwork Wed Oct 23 10:35:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 99387 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 1687C3858C50 for ; Wed, 23 Oct 2024 10:37:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2608::601]) by sourceware.org (Postfix) with ESMTPS id EB4993858C98 for ; Wed, 23 Oct 2024 10:36:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB4993858C98 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 EB4993858C98 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2608::601 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679809; cv=pass; b=gyFLYwW0JrqVzO0p7rlKv+xDdNUV1IbtUi2TolpnU/2f90lOWhy7AmupYI8F6kQYXUB/V+u1CI8AuWWNynIZ7la6gXzUuEK1L7AdCaOp4rRATxeH/lfU5heKRs0EeKln0x+VSW/BItIAfdW3RDe829zq9sTVPO6nILkbqCJdMV0= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679809; c=relaxed/simple; bh=lL2/xYCguCmJg5HFDTqCf3BH02I4z4OQLR83H9GsCJ0=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=UPwMG5KjRhZvWJsYww8b5NZCFCa6gzfaMjRunkAQA3YiB2yuhxa9WG+znZdZRI+ht/PHJnnG9uLmljsPhvJ2V6gLUF8+BSRjYa355BoCuJE5ogsmiCCopYPw08O1nD1OQOB74v7HPkkFqFIgtm2u1Sl6CMExViCuqM1PdQH63F8= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=eImWHCQp3CfrTraH0yqQdTLvlRdF3/NkgGl1eLgTH22BfM4+bS0TRjxgxhkHP/BxXZ4EFxrEprjEdq1MqInb/Re1MeKOP9E6HIqMgAbk3vlJ/s78ThZsC5ebiytJgn9/O3Zzsv0Cl1xcvPWjSUtWV0y2Oi5QQGiB9ivosPfsFVTHlnoEHwG4gzUG4jFwg2OZQV2TelfM+K0zByMB673dWAWyPb7FSdXpd/aYiO8uc/cLl284x8wwjK9IvkTt1RsQXxJblhveaTmJvrdDWhoA92n0QgAQNDPAm/vOuV75YmYA/tncN8Bg86RTaRDqTdpu5tT3V7/s6HxDf2GXCgE5TQ== 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=m1Sg2KQBxgS5o4C/a92LOzHCVHh2lXVALLjca8GABIU=; b=rUtGjGXQNmFLkFTb/obp6twGpC5igDXwAwvbrECYQeDbrrp8sSOpO+mgfEwxMOclLVbXEhtCvVbDst90KGdNIyrddGbuEosAueljWQDI7ylJ/aGJBgJSQwIJJz7IasDILFKDEmku+QaAmGObCwfzVSwnoG5QsN4XODHxWOIgKsVbq7oaNVvisCGJNfMvjsCQp0+1yyL/PqX7TxIRVpnkNp8XzAiRVuqyHlo7OhTFGcpE33sb2xTyCdi20dfqGb+uN7+9z6u/4brGplCz6KPINBATC9fHJJI60sooRTAsfATWjhyYQemqm8z3fVbJ5VeEJc/0DNAAtIStLzOdDeVTOw== 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=m1Sg2KQBxgS5o4C/a92LOzHCVHh2lXVALLjca8GABIU=; b=eH+g3aF34MUOo93/3BS3rLTVJ4dAyYXBUucE33rICsqgzoQELYTiyQQhBKRK35l9eQA6/ZB5ZUhcId43bC9EmNvrgNJkA3wcYbkNWuCS495py43hGT49yXC4PRvuwuZCVf+y8Uv+yZvnPqGq9jxhvL0TVAufv++ZqIJrEKQArVc= Received: from DB9PR06CA0006.eurprd06.prod.outlook.com (2603:10a6:10:1db::11) by PAWPR08MB8813.eurprd08.prod.outlook.com (2603:10a6:102:335::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 10:36:39 +0000 Received: from DB1PEPF000509F5.eurprd02.prod.outlook.com (2603:10a6:10:1db:cafe::2) by DB9PR06CA0006.outlook.office365.com (2603:10a6:10:1db::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Wed, 23 Oct 2024 10:36: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 DB1PEPF000509F5.mail.protection.outlook.com (10.167.242.151) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:38 +0000 Received: ("Tessian outbound da7ba6582322:v473"); Wed, 23 Oct 2024 10:36:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 665ce39727b0a011 X-TessianGatewayMetadata: MgbeSxpBer+B5ZtSQGSydOH3PvBLD3Tof3Lw6jZytiJUGPu2y1JhGKftX2u0Lz3XVVWVhS4TWtTZazvG7kmdRv++kTicNd2HVVtHnSMZOxBsLgTq7D3hOPZ1MqHpvQybF8N6sTWLc78LDE6s0wkheNRUUhUZkM6dnBPIREKSf6o= X-CR-MTA-TID: 64aa7808 Received: from L8e7a290765dc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E755EF14-EF0C-469E-9122-F8958628FEA1.1; Wed, 23 Oct 2024 10:36:30 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L8e7a290765dc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 23 Oct 2024 10:36:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ng5dS2FTGhh/fDEgS4LIjpk+DpAFcN4aYia3b63RtIu+O08+TrCTpwDfBXMMJYuZvljAb+HrclutJI3gogfRaWcMNdSXv1xpVQtGgjX2ZP2tewasGbZ4ahsW9y5lWlHyXC9oo+WqiPKEZyQjsO0rCvMqFniEdDdKgxO+fsNquYV6620snA9qJD586XCNAotH3ndosumy21ebSHeIZ2XCDryKqrCl0Tc8rirbb1GJpF1n+6IdwAMRq6RyLHoh12oE1RaVoaC7VGrtNC/h5e6kLLMnrXy7quSxDraH3VfFzoOg+g3gtUQa/EMuvQhPgq9uf//aNFuUrB1p8+IKVgbjaA== 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=m1Sg2KQBxgS5o4C/a92LOzHCVHh2lXVALLjca8GABIU=; b=KYxAn54Y4GTE6glOprF74MIH1XC32JnnM+2IXgCg+JceAqw7G1fycODm2Fl8iOM5ctPiRQqhv5C4tRGCAIIn5zfbDNetDZkNDVXe4fiUFOfb5cYbQWu4ODXUpsK4x6eHcuLq8o5m/LPwNXtMlM6PwLrDgCl4dCGiXHP8E9cC9bVtvCiNGDl2O/WwqaDnKTAHMVjEujLJQk37OId6SRabGHbKYyJZGLT9mdHaNS2RALN3HrhcenQoyRYnR99gywLKYv4om80sjA3SYZaw/DuNpXefKnOF6jtckvIl6kaODEPD65SxCBq8XEq1LQlWQHDqS95PEpG8tZ5I5J9U7hXgQg== 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=m1Sg2KQBxgS5o4C/a92LOzHCVHh2lXVALLjca8GABIU=; b=eH+g3aF34MUOo93/3BS3rLTVJ4dAyYXBUucE33rICsqgzoQELYTiyQQhBKRK35l9eQA6/ZB5ZUhcId43bC9EmNvrgNJkA3wcYbkNWuCS495py43hGT49yXC4PRvuwuZCVf+y8Uv+yZvnPqGq9jxhvL0TVAufv++ZqIJrEKQArVc= Received: from DB3PR06CA0021.eurprd06.prod.outlook.com (2603:10a6:8:1::34) by VI0PR08MB11041.eurprd08.prod.outlook.com (2603:10a6:800:256::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Wed, 23 Oct 2024 10:36:25 +0000 Received: from DU2PEPF0001E9BF.eurprd03.prod.outlook.com (2603:10a6:8:1:cafe::f1) by DB3PR06CA0021.outlook.office365.com (2603:10a6:8:1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Wed, 23 Oct 2024 10:36:24 +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 DU2PEPF0001E9BF.mail.protection.outlook.com (10.167.8.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:24 +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; Wed, 23 Oct 2024 10:36:23 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Wed, 23 Oct 2024 10:36:22 +0000 Received: from PW070M4K.arm.com (10.57.85.41) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 23 Oct 2024 10:36:22 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" , Matthieu Longo Subject: [PATCH v2 2/4] aarch64: add minimal support of AEABI build attributes for GCS. Date: Wed, 23 Oct 2024 11:35:58 +0100 Message-ID: <20241023103600.500910-3-matthieu.longo@arm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241023103600.500910-1-matthieu.longo@arm.com> References: <20241023103600.500910-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9BF:EE_|VI0PR08MB11041:EE_|DB1PEPF000509F5:EE_|PAWPR08MB8813:EE_ X-MS-Office365-Filtering-Correlation-Id: 32e9c96c-ae85-45ec-36c3-08dcf34e9343 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info-Original: =?utf-8?q?+gHEELBajRakvQhRjFHwGS?= =?utf-8?q?xOElQxRpX3jG1sccpZs5+GdX4MlGBVm6nbkS6Xccc9is0hle7zAL1x4mBnewxENMz?= =?utf-8?q?RUg0qfqVQlQa7JEV09UCwOx1WYsOf3mToFoGKSsO2TynYtTRYaj+5DMCSl1tKF6SX?= =?utf-8?q?Wws3f21jI53GrHphxHdlOEUphJ1jNSjEFFupsf1bhBaw6AeyVKG3KAxmF/OcMy/of?= =?utf-8?q?G4DJprdM1Ki/pOWCSKYe3R5PfZ13BsWIQP2wxP4eUk0EYoTad4Nso6rqY55mp8rwK?= =?utf-8?q?Hml/6PG676GKuAVPw/JsxwI5Lw5p+sWBIsbX/42Xq37MUXz5SOLzdlYsaloq8lWh7?= =?utf-8?q?pZ+x8HetncO1U0b3WK5H0M7NDBELbZjl6AA7bPPde87OkbY4hI3JY8FF/Zb7Ptr+j?= =?utf-8?q?X2lZNPA0ESBQmrs9arO57rwX3dY+wQlyUzqsA6t4L+flVTAsn2RzG95JxXtS9wO+7?= =?utf-8?q?kYxMDO2pwZ5KuzWNsDaBXmPZE1p2bIMIKe+FRhcu8vqk4qsRTy6CokKT7nDqtuYHq?= =?utf-8?q?7IkqDIArM/VVZH1nPloiqvCucdQaDRFFGDuV59LOwWAkLOCBGfA9HimBC8OlqytVL?= =?utf-8?q?AcwRpBO83CUl7XqSRVb5GNySGLD3BlaSwnNOnb04dt2WYCWR22pmrIQAMoKZ5wrYt?= =?utf-8?q?QGUvupVyjuLQHuYDEwUoJJduyAkzQ1uHVegOc3GCMVmbwC6ueY3u4Efqd/hjzgbbB?= =?utf-8?q?J4pqa47rqxdn1+umeIfomnYlOHjFc0wLMu9mFqoV0ACod7TbelAogiAaAleDZu3XV?= =?utf-8?q?bz08lYd8mGWnX5OEJa+5kf3fHzSsLrIb/nfwaDfX4LneBxSV5oc3XVHWGnl8IZxpA?= =?utf-8?q?coxDjsyZuBmFU15OeKHa6hpR/hWdykjR8S/TpmMN3WIbXPDhgOwkd36RodKZyKhXB?= =?utf-8?q?9ETz7rYdsvICpyVzSgGdbI7TVLxcGlmFZHWlc+H4PgwfhJDrwV/XLAoidwfDEE/AV?= =?utf-8?q?xmbaJufhQhefFb6FdmW29CODmP1tJA12k8GYHcsykvRwoNXxlhiBQDLZSE0BifuvW?= =?utf-8?q?DSqD9CK0CiF7uUX7lVRrkFTo24p6Qg90EaGqz8tZzNUBEZheEHAhb17QEP9W15UDC?= =?utf-8?q?z5N/FyiMwcAUEG4Pq7VAlH+TVW5/GFV+Q0kfS2TlXVYnqlFmOLv0mmqleA4TljUdA?= =?utf-8?q?KsNpK09724C9Cy5fvQTkCEHgpRRWI2mKgTJPXoG+y9izAqBSTCLiI3oTSgC4uSnDL?= =?utf-8?q?0xFWMwi1DTfMYjOswFeqt1cqrxvmiKXxAIiajQnwy2VDPvHiBWHUfQ3DAbXF0pPvK?= =?utf-8?q?9wW+8Cnwj/utvOtKSwUQMNNbJq71OwCK2DNMSFZcFSto26/BN5dY85zpcDoY7fL28?= =?utf-8?q?=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)(82310400026)(1800799024)(376014)(36860700013); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR08MB11041 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:8:1::34]; domain=DB3PR06CA0021.eurprd06.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509F5.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 16bf8e34-b799-4a08-7a99-08dcf34e8b46 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|35042699022|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?G8/MN8xY3dUjQBavoNFGEwHSLc9jUqH?= =?utf-8?q?5x+aGIsm1W9ZeyiPJN6dFGwkLb2czaQEvXkr3kOLq6EdTPVlUAopb4YvUPvGDuvf2?= =?utf-8?q?woEGvfTZ/xslmGvKNu5SPuy9KxlLXNtK61PzJTusDMQ///THh/c3TKdrE51042Msh?= =?utf-8?q?+vKvbEKOTWNdLBTCn5zFrLMLUlnt+JHEGsibtF5tYuS/TzVHrOCZU6W4ChUJzabh3?= =?utf-8?q?sS4NDLRZj08sS/dkO3DJkun9jBVrp6aKtXcfTpdFe1CmGw520dIVuFfbA3ZnAEMOj?= =?utf-8?q?D0+gYevCSAq7486aIKMXyzRzkz9+ksKkFYgNrl7tlbac1jwhBqDpjbTutfdhOmVTp?= =?utf-8?q?LYB2LIdZfH9JkHk41Aa5ieL7Xt2OcFtu1HBZnF7GTjXrGp5nBEyvCn4YymxOhdIdc?= =?utf-8?q?61LT1mN2IxllD67yx61QTh2X1y3EHq8RzrO5Uw4SA8eLEBE7c+HJ70K5CFbEsv0nx?= =?utf-8?q?CkPMw+2VC5Apvoi3wIJl6DFq58hG8436txZXs+5bqwVMTWmNVZXIv7pr8dlSuUwsp?= =?utf-8?q?Ljy2PAJC5GYoNZB/kXc+hAwWVPCyST+83/aDqaEvM+vDbK5mugmP1iQpelw1JuNTv?= =?utf-8?q?PjmkMRrncDKwNyq0yC6KNXuQ6D7/5/Jwg1fw2GpzSROw4yj30pp59LPm8mbLBKREc?= =?utf-8?q?kWm2VQ/0Ktf1udFr2de34VKxucmnZw/YEac9KZz1+6orBck/EIRY/jHmjAzTXl75E?= =?utf-8?q?5rE4Ba0UX5kM0cZysaaUhl/sN2lQKCu5bG6IfaDQhgDfKKV7opGWJq4qijkIbTrNn?= =?utf-8?q?2zh7XEJdQ3SbLilRQOVIcESE4I506e7XY1X+YReb543pn35MQOQick6nW+/+eQAue?= =?utf-8?q?gRGc2rrrb0l+HWB+ceSFOImWwEDR/fbDyox5tmpDbfTRiKS8Z/TjwQh7u/4vx4mjr?= =?utf-8?q?kcY0D5/8+atIlHhb1Dhq/C7ydqHJE7rb/bi5QtPgPO7bdze8kwhrUOVqVNutYZfFy?= =?utf-8?q?EvYLYmUiZumDigeSk+OZn3JQauVgUoV+6/bXDTaDLXuOy95kfpSY86lq6H4soYrLx?= =?utf-8?q?3twr2AhidIlZwxoVCD1ISYooPeqc5gT4WndyAP/2IHKCIX9mMlsOqyqjr5ldQQ5kF?= =?utf-8?q?hCw8EyZzFp8UY2TBcEcHLUJSFdXA6U9UV6phNMyLDdqUUtqE77kIkesyIwOybFrqa?= =?utf-8?q?VfPcYu0FjdGktiEIAVIu6ypseUW1CQxG8s98QZqNEsrVJ6lcFTKLOW45PHrCyp+Mt?= =?utf-8?q?p5kkyxOmX5wsOruMqXudQOpVA/aiG736Uw6rCFQFBc/1Gk+la0l4218raack55QJZ?= =?utf-8?q?Kc1x6B8EEENs5nkl2UaxZ1Tx71AWMO/us+mRIQ9OO+PJjdnp2XYvGXFM=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)(36860700013)(376014)(82310400026)(35042699022)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 10:36:38.3422 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32e9c96c-ae85-45ec-36c3-08dcf34e9343 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: DB1PEPF000509F5.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB8813 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 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 contain the relevant information. This patch needs to be applied on top of GCC's 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 (HAVE_AS_AEABI_BUILD_ATTRIBUTES): New definition. (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 a configure check for gcc. gcc/testsuite/ChangeLog: * lib/target-supports.exp: (check_effective_target_aarch64_gas_has_build_attributes): New. * 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/aarch64-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. Co-Authored-By: Matthieu Longo --- gcc/config.in | 6 +++ gcc/config/aarch64/aarch64.cc | 41 +++++++++++++++++++ gcc/configure | 38 +++++++++++++++++ gcc/configure.ac | 10 +++++ .../aarch64-build-attributes.exp | 35 ++++++++++++++++ .../build-attributes/build-attribute-gcs.c | 12 ++++++ .../build-attribute-standard.c | 12 ++++++ .../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 ++++++ gcc/testsuite/lib/target-supports.exp | 16 ++++++++ 12 files changed, 218 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/aarch64-build-attributes.exp 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/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..0d54141ce30 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -355,6 +355,12 @@ #endif +/* Define if your assembler supports AEABI build attributes. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_AEABI_BUILD_ATTRIBUTES +#endif + + /* Define if your assembler supports architecture modifiers. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_ARCHITECTURE_MODIFIERS diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 0466d6d11eb..90aba0fff88 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -109,6 +109,10 @@ and 1 MOVI/DUP (same size as a call). */ #define MAX_SET_SIZE(speed) (speed ? 256 : 96) +#ifndef HAVE_AS_AEABI_BUILD_ATTRIBUTES +#define HAVE_AS_AEABI_BUILD_ATTRIBUTES 0 +#endif + /* Flags that describe how a function shares certain architectural state with its callers. @@ -24783,6 +24787,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 @@ -24803,6 +24834,16 @@ aarch64_start_file (void) asm_fprintf (asm_out_file, "\t.arch %s\n", aarch64_last_printed_arch_string.c_str ()); + /* Check whether the current assembly supports gcs build attributes, if not + fallback to .note.gnu.property section. */ +#if (HAVE_AS_AEABI_BUILD_ATTRIBUTES) + if (aarch64_gcs_enabled ()) + { + aarch64_emit_aeabi_subsection (".aeabi-feature-and-bits", 1, 0); + aarch64_emit_aeabi_attribute ("Tag_Feature_GCS", 3, 1); + } +#endif + default_file_start (); } diff --git a/gcc/configure b/gcc/configure index 8ed47b4dadb..62d9ba4fdab 100755 --- a/gcc/configure +++ b/gcc/configure @@ -28035,6 +28035,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 AEABI build attributes. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for support of AEABI build attributes" >&5 +$as_echo_n "checking assembler for support of AEABI build attributes... " >&6; } +if ${gcc_cv_as_aarch64_aeabi_build_attributes+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_aarch64_aeabi_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_foo, 1 + .aeabi_subsection .aeabi-feature-and-bits, 1, ATTR_TYPE_uleb128 + .aeabi_attribute Tag_Feature_foo, 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_aeabi_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_aeabi_build_attributes" >&5 +$as_echo "$gcc_cv_as_aarch64_aeabi_build_attributes" >&6; } +if test $gcc_cv_as_aarch64_aeabi_build_attributes = yes; then + +$as_echo "#define HAVE_AS_AEABI_BUILD_ATTRIBUTES 1" >>confdefs.h + fi # Enable Branch Target Identification Mechanism and Return Address diff --git a/gcc/configure.ac b/gcc/configure.ac index 8a5fed516b3..f4b1343ca70 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4387,6 +4387,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 AEABI build attributes. + gcc_GAS_CHECK_FEATURE([support of AEABI build attributes], gcc_cv_as_aarch64_aeabi_build_attributes,, + [ + .set ATTR_TYPE_uleb128, 0 + .set ATTR_TYPE_asciz, 1 + .set Tag_Feature_foo, 1 + .aeabi_subsection .aeabi-feature-and-bits, 1, ATTR_TYPE_uleb128 + .aeabi_attribute Tag_Feature_foo, 1 + ],,[AC_DEFINE(HAVE_AS_AEABI_BUILD_ATTRIBUTES, 1, + [Define if your assembler supports AEABI 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/aarch64-build-attributes.exp b/gcc/testsuite/gcc.target/aarch64/build-attributes/aarch64-build-attributes.exp new file mode 100644 index 00000000000..d0caf81c0cf --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/aarch64-build-attributes.exp @@ -0,0 +1,35 @@ +# 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 + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ + "" "" + +# All done. +dg-finish 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..26938d84dab --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && { aarch64_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\t0x4\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..6a41b52d298 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { aarch64*-*-linux* && aarch64_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\t0x7\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/no-build-attribute-bti.c b/gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-bti.c new file mode 100644 index 00000000000..013c76e5a2a --- /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* && { ! aarch64_gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=bti -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t0x1\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..954bf3ac8c3 --- /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* && { ! aarch64_gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=gcs -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t0x4\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..10195ecdbd9 --- /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* && { ! aarch64_gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=pac-ret -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t0x2\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..52cad2863f2 --- /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* && { ! aarch64_gas_has_build_attributes } } } } */ +/* { dg-options "-mbranch-protection=standard -dA" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-not "\.aeabi_subsection" } } */ +/* { dg-final { scan-assembler-not "\.aeabi_attribute" } } */ +/* { dg-final { scan-assembler "\.section\t\.note\.gnu\.property" } } */ +/* { dg-final { scan-assembler "\.word\t0x7\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI, PAC, GCS\\)" } } */ \ No newline at end of file diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d113a08dff7..457aa71e860 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -12031,6 +12031,22 @@ proc check_effective_target_aarch64_tiny { } { } } +# Return 1 if Gas supports AEABI build attributes on AArch64 target +proc check_effective_target_aarch64_gas_has_build_attributes { } { + if { ![istarget aarch64*-*-*] } { + return 0 + } + + return [check_no_compiler_messages aarch64_gas_has_build_attributes object { + /* Assembly */ + .set ATTR_TYPE_uleb128, 0 + .set ATTR_TYPE_asciz, 1 + .set Tag_Feature_foo, 1 + .aeabi_subsection .aeabi-feature-and-bits, 1, ATTR_TYPE_uleb128 + .aeabi_attribute Tag_Feature_foo, 1 + }] +} + # Create functions to check that the AArch64 assembler supports the # various architecture extensions via the .arch_extension pseudo-op. From patchwork Wed Oct 23 10:35:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 99390 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 DCEC63858CDB for ; Wed, 23 Oct 2024 10:39:05 +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-db8eur05on20624.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::624]) by sourceware.org (Postfix) with ESMTPS id 9FBB93858C35 for ; Wed, 23 Oct 2024 10:37:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9FBB93858C35 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 9FBB93858C35 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2614::624 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679826; cv=pass; b=hYt3uQRqqeyYu989KGDm8WdSSFXHPRyNyn8jQrYBxpnPdDYHQAUy3xUpCe3LwNJC2DfhPQmBiy1+UM38GqpRJeNg3ig587OSfLYK9tJf+iowNCzBWRX6z8aQJghUrxz+LGygXevX7/N5fBVJw7qtPm3AuZ74XFaUZhIbd4Mapkc= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679826; c=relaxed/simple; bh=2heKqwioEZxRX0yKTpoKwvjKEvMgfcXx++IkLakab70=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=CV2HBdLhDvtOiOdu6nroz1lBdn4jby/O089UwJ7PLroYbGLOEKvIleTq8cr4pZtP5Cu+MNo95mL/ybjmW7UpF8R1vCa4gRG3aoVvimRQq4SzmAfarjanF2z9gN5ggCiyzcB12UJ1FoqEGXYr1hANZ2I6UAQe/j9AI6EVzz2mMWE= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=q/jrScQFi9R9i12c/+6Di5JRpvpf23E7G9MG9OYi3yGEHQSh5We3l7U0OFpg9vSACvHYhFxGen2IPS3km8D8zYLBekRUVZbpuM1A6N0YnBasknZ4BVrqJRaeBqO5WGhsxy9ARUY/DfeHshXoreYYy2dmllZxSxg3Ewe1AqCKEQCphvVZaaLjTUZPhIjuVu97EhwSkWoxxvqxOWKzHQKG/QfRQ2YFcdYTbhslgVem0U6MHq/pi1A+Mwj1jkhwyUxVoKi0ui8xvnZgf5inKLhHqVDJXw5Iv88YYeFPZLQQEAVSX1a4C10FNpBWtmc+vhxtDAqd70vefF3qEyfzxuR49g== 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=NNtUEY/tJTWyyIiNFdHlYR1HwV76rMguuZ4QmDwMpfA=; b=h4vmXd8NRCvFJbDV2GRImmy54LupeAymJq1JOPRfAL7P+QcAEksLEgjYNq/UDVYCx6lvFgoK9jh+THGLjQtgVUIlVpn3p++6JAg562b4TX0Dsad7m0tmXUG24WSJe1/TV06fHgd8RA8FFoygI8wQujrB26WkrSURAYampIxeAI0fMdekHTPXzsEulyl/eT0FM7TGZYfZpAVg198ecPw0mMf19lBS2X9AJsMk3blMJKXPNVMuLLg2ZKm2G1w8RqLBCwRwt4K6n9RZtYGDsooi4EPJBrQ4OqsW1wLQeaEFIcjwUgGGdGt2oIZxhwbBl+vp4iEdCvFZzvX2s2tBWf6/Ig== 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=NNtUEY/tJTWyyIiNFdHlYR1HwV76rMguuZ4QmDwMpfA=; b=iLUw2KwYzwetjH9+X9dm0xyaemsBI5sP8y06US1ORbq3b4RdDoHzF2JxLY8Rkp4KGCTytffuWCVZUWh1m5ChTKw/lcwH5VO8DbrWmVsGf5pRQem/RkfvD9Z06jKkhuMGkEHddD+9rLX+/vYAIA+Zd3S7iqZT9YCI4Qjm+13kyf8= Received: from AS4P251CA0009.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:5d2::20) by GVXPR08MB11211.eurprd08.prod.outlook.com (2603:10a6:150:1fa::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 10:36:53 +0000 Received: from AMS0EPF000001A6.eurprd05.prod.outlook.com (2603:10a6:20b:5d2:cafe::e1) by AS4P251CA0009.outlook.office365.com (2603:10a6:20b:5d2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 10:36:53 +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 AMS0EPF000001A6.mail.protection.outlook.com (10.167.16.233) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:51 +0000 Received: ("Tessian outbound 5e8afd4f8faf:v473"); Wed, 23 Oct 2024 10:36:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b43e9504d6b6d130 X-TessianGatewayMetadata: ZIl91K3oGDu9b2CC9PDYAyLDbM6BiZX7umJhTNECMB4WFa7SC9dwJqoG85vkje5LUdjgaN2bDr5ofLj4/2WsESgm8hDojMxIezN4/C/txfCs2EmMdryWWIBunJAyomI/Op6lTu65zS5BlqTeHBKKRjkOYW3x6nhxOS7eDtlN7L8= X-CR-MTA-TID: 64aa7808 Received: from Lba5b7c2169b2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EC39A1CF-1710-4726-9F89-94F817117534.1; Wed, 23 Oct 2024 10:36:40 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lba5b7c2169b2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 23 Oct 2024 10:36:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=niTXupYfKYwhpiwrRCtKElMR/jEBl97mY0/3c5ohlJCpM1ZSTf9PtquHR3mDtRcVjpaWI4uTUwnTPYuaTzHw29aEXk401C1xi8ypZpBsNfb0yl2dO83lPe5aXT7azT2otU0RNwen7bdjKNJtbMlYnWAWqwMscr1QdZngT0VQNQhwTmm5+ri+D9HztxjzSJRrlfpUCGxwWFMqwxqzSVtx6NOxqHflzUAOkg2NXvKmsg5AIXoR6jdcFk/GNyai60+kJs9bIIGprG7mydeH6q3dF6xrDleCQlMb3OPSumqlMrrISLN9WhaE2qpafypSvIzfhwK1TftTTNUS+u2q+bhMbg== 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=NNtUEY/tJTWyyIiNFdHlYR1HwV76rMguuZ4QmDwMpfA=; b=Tk3jIC0A/cbtoVyCSMeWF9hWd24QZB09bhYY4rBOSSA5URxAwxEYGdA5kaDMQQRKjzjTq24SkbP1r2uiPnfJSkSboxA5pTM8VKRecVuhneriwwXjHZSnZsibjOhzMWA7ssaXUpCyDevCYSS5i46BTHUm/BimIB58LCag13QYxgkdVgTrGbbi2+RglXT0SeSlUdJal91TeFE9ij5SttL2tTFOR+Ssrc6wUgsYCs8zZWU1CX0/oMUPqdR0BgJGt8FpPH4ghcCrrgytCkI/HQBQswyvO12Jr2JaigpBXD2f6J2nCRTWxOW6nYXakOfV3M5J19t7vq78jY156fIdMrggdA== 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=NNtUEY/tJTWyyIiNFdHlYR1HwV76rMguuZ4QmDwMpfA=; b=iLUw2KwYzwetjH9+X9dm0xyaemsBI5sP8y06US1ORbq3b4RdDoHzF2JxLY8Rkp4KGCTytffuWCVZUWh1m5ChTKw/lcwH5VO8DbrWmVsGf5pRQem/RkfvD9Z06jKkhuMGkEHddD+9rLX+/vYAIA+Zd3S7iqZT9YCI4Qjm+13kyf8= Received: from AS9PR06CA0723.eurprd06.prod.outlook.com (2603:10a6:20b:487::6) by VI1PR08MB10102.eurprd08.prod.outlook.com (2603:10a6:800:1cf::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 10:36:34 +0000 Received: from AMS1EPF00000047.eurprd04.prod.outlook.com (2603:10a6:20b:487:cafe::be) by AS9PR06CA0723.outlook.office365.com (2603:10a6:20b:487::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Wed, 23 Oct 2024 10:36:34 +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 AMS1EPF00000047.mail.protection.outlook.com (10.167.16.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:34 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 23 Oct 2024 10:36:32 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Wed, 23 Oct 2024 10:36:32 +0000 Received: from PW070M4K.arm.com (10.57.85.41) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 23 Oct 2024 10:36:31 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" , Matthieu Longo Subject: [PATCH v2 3/4] aarch64: improve assembly debug comments for AEABI build attributes Date: Wed, 23 Oct 2024 11:35:59 +0100 Message-ID: <20241023103600.500910-4-matthieu.longo@arm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241023103600.500910-1-matthieu.longo@arm.com> References: <20241023103600.500910-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS1EPF00000047:EE_|VI1PR08MB10102:EE_|AMS0EPF000001A6:EE_|GVXPR08MB11211:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b238301-c75c-4782-160b-08dcf34e9b6d 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: nLTrKjgasQf4WLYm1zTMGaSrDq3hc8CD0I6KrnLQVYwFrgA3zkZJE15rco3U4+zQvWwr5GAAjRfQRyMg1Cdc94zzwmZs9WOCl/2Cx9S5QC5fR6yevJtB6PRyR1g3vuuOKIOQYXYoQlWqPXBVh28WARAsa4KyykVUA9+vP38DS9FnVl4DdcmpT9okVd8Uo530GZ9wOrMYasEuUhsj9Zr/JoMlS5nHU0VTZ+ACq2lCkoLg5SZtxPYhwh+TEO9NTiO5VMxF2Rsm1c8NtnroDyeoiG6cb7XCf0g+sZXLbkZtfIeGQi5eFdOzZMLfZPn+20KLFRDns8uvxdHzBW8SaYLzAoy3+KAgqT338qg4s7iD9+Ko0S55dRBU7s4LgclTHFkdP055AEtBNuCNLecwyZTtnFNKbTI3G6LKZ7ePiYmL+BgGlWHiZ0FykXbkP1IcdLfGF1AedJG5QeJUdirk8VPjKdtqxEMYVp3VNkLGKZC1ONRjUGvon1vVqHDpBw3Y7rTOYuCb8f8Q/rlxHQPmuLWi0lIliHbNSQ8BJaqk8Hcc6UV69ZeTHR6oqC54wOOM2CtiEfwiZwIOzqmul3jO97ACq0WzeNA/JyTrYJVeU1Ft3Wremp1mbNK0Alr6uqcCVwN357iytrXjjVHvQNNQ/1AuNNpXWDzeOpbHSzKuuNFJkjvP5NZpj+ZbosRqdlZjCe/KS3jcNe8dJfEUq0PEhi9Bj5Mh3QHgyVCJllkpgfWRFefS+PIwkW8HvbHXlhzYH5A1jZqHELQd2t9iG4TpZzfQDmSWunM+5/vOUmtW7BcZcqQhmUpEZpNHYt83FGTxZExwLBl6Vl+mHZbm1pzc8LA5lfna1ZEzEZEyBLYY533FXfGAaPBGgbo8cHWQq9t+HHWbfvOcRxBh1U/vWA6ezAokift93mA2mFdXcU4RGtrCIQ+fzQDqUOudnUXo8OTLqPu7/0DZYHGhpReW4Lbba6wwp6QjK1iMDeJO9Aue5cKwPhS1f+0DSGyBpjs6xWLXbJJfSOGFONU7pj1gtWo0ETj9yi91wrkvAI567XFuyEfAw6xla0zhCoxol9xM+GtT4Al0DrE0p5XbJAxRW03pnLYd9/kSMMLO00NC3h/p/1QL90xF8BepUMJrF2VrmH+rZlJZkgqWcd8mUIj17NJ1S7FteLW4ZSgG4qUY2QM3mppw8p7cz2ByP47L/VuIRUpHj1d1dAN6yNJTO2EPTTE9/IyogvpOqyZjghoYvfXzUkIp4KkhYpgGIV0oniLLis9rj3Hiu59l0WbLFWEUuQMSQxEnBinWJiLHyZjajPeh72LES/uZRGywNpvO4dpRz/GFMN7soWjUtrRDMKPpCDLb4HtqvZUHZRSmfSXh6uu26c21CEY= 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: VI1PR08MB10102 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:487::6]; domain=AS9PR06CA0723.eurprd06.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A6.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 04a3226a-6fda-410e-e791-08dcf34e90bd X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: 8OqYOmUcLn0elgtVYy8diS66WHzFuMKaNU6rGwTCbeuHE2YBwnTjgmzqy0BmMJNd7TNSxI61OkLIiwSo7KiViCdgSS7eQIL/zMjNJToYpkVG8QrAi2FQPyUQ5VE/G0f1RCzpDfm6KMV2B5WT9/BG225lXRvFo+vGZSwiMbGKC7Zw8pq0erVY58jvuuOdYBp6yQwFUpMthEvumtbFLScFFonZkh5Tthf2/BEwQARf2hux57a/YW0K+hiwyj1KdZvdLkJKLZBByhmIdC+SxeU1Xsr1oQBVEtCFMH4hjelQdqZER22qZCya5ZrfBJAQwLJE4cJqsUP533TLhhnUrvPvxhS637znDEkW/4x0Lw7HxK1Yhgh4ezvXPF65NeJfeP4/7CzvwaRR/jjpbtgzihuwPgpu8H8LV5kyRS3G6jiTrK143dWL1U1r7CKhMbrQRI4Cr6J4sx3e9fKkhxB/w+j6Fz7/T+QN27hkGaSsCAwCMV3ThFJ4joy1poyqZHqNBPFxBZgniGBZIRG8PMImzQztifVjTciu9UBG920/XPkzvdbI8IuFPNdObrpEyzYDGPBo2/aIPsZgtIzPY+KqCxMpr4AlylXy3lQk+GcVdInaPPiQ5hJB5DuTbZ6kChnUp8vCnKTFGWlcj0hxcj42iQ32dGr0bF/b9oc0JOw5lT0Hi/c81P0sbiImCHf2ICESTSEXRcPQDOmBpNyR7hymAeQ3CDjc0sZpHLuvemNFb6X8LdhJHgIKD4TAAtYzfmq4VCSDxNwr/CfkT5cUVUxaVeimGrpCyO5mzKNFTbU1at34NAPz2s6hcWV2bTyHXcHQztlBgNi9eSQgfVAChJmaxfneAVpi8dHvHDAF2pkiaq16dIXVOpYApLXXv9pMumdcnAAVO1hUghIj8vdgmR2fTchkvknjr6RuNMQbFR3TBePSlknvZzoL1tqc+ei41Oy6Dcvf/bnzKQnW5u5iJQjhCidl65dnt9IH3KOGKOXHzZA+lCe8WPN2/qHuQ0+sX20NAwm+tRrdhDx7fhoRpS9z6mGBcnC4Xxva+T+ljSuBskV21f7iYF9U6oWjn7CZxHFmnabTA2eUpkx6D8ptyBk9t9kBJvgIH9444SmOgZh/IJ7eTAGMAR8DoeTk2yiMTx06h2dDLDApOK1X2UP3tN29DIQNwCwFOgiTWN6+Yy2cwhrNSrUmfva8epLvMoA8aL+AOTCl5Uxun4981YznBW0Oi9AmMqg6AH2/bX5rmIHSu5O6y7ZiRMHMmWEhk0QGj74tdTTmVBiLmndfUgBqEpVCftfHN3+qxSVS0e6qrCNmALIYKIx5px005gB1wsSDdOmK7MOfZU4fpFyQ9Jg7SrmVPBvk21CbXSpTxfFqIb0zhuJbdls= 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:ErrorRetry; CAT:NONE; SFS:(13230040)(35042699022)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 10:36:51.9759 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b238301-c75c-4782-160b-08dcf34e9b6d 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: AMS0EPF000001A6.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB11211 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, RCVD_IN_DNSWL_NONE, 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 AEABI 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 | 226 ++++++++++++++++++ gcc/config/aarch64/aarch64.cc | 48 +--- .../build-attributes/build-attribute-gcs.c | 4 +- .../build-attribute-standard.c | 4 +- 4 files changed, 243 insertions(+), 39 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..01f08ad073e --- /dev/null +++ b/gcc/config/aarch64/aarch64-dwarf-metadata.h @@ -0,0 +1,226 @@ +/* DWARF metadata for AArch64 architecture. + Copyright (C) 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 "system.h" +#include "vec.h" + +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) +{ + return (t == uleb128 ? "ULEB128" + : t == asciz ? "asciz" + : nullptr); +} + +constexpr const char * +to_c_str (BA_TagFeature_t feature) +{ + return (feature == Tag_Feature_BTI ? "Tag_Feature_BTI" + : feature == Tag_Feature_PAC ? "Tag_Feature_PAC" + : feature == Tag_Feature_GCS ? "Tag_Feature_GCS" + : nullptr); +} + +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) + : m_name (name), + m_optional (optional), + m_avtype (details::deduce_attr_av_type (T_val{})) + {} + + /* Append an attribute to the subsection. */ + void append (aeabi_attribute &&attr) + { + m_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", + m_name, static_cast (m_optional), + static_cast (m_avtype)); + if (flag_debug_asm) + asm_fprintf (out_file, "\t%s Optional: %s, AttrValType: %s", + ASM_COMMENT_START, + details::to_c_str (m_optional), + details::to_c_str (m_avtype)); + asm_fprintf (out_file, "\n"); + + for (auto const &attr : m_attributes) + details::write (out_file, attr); + } + + /* Indicate if the subsection is empty. */ + bool empty () const + { + return m_attributes.is_empty (); + } + + private: + const char *m_name; + bool m_optional; + attr_val_type m_avtype; + auto_vec, N> m_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 90aba0fff88..e5a94738f70 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -84,6 +84,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" @@ -24787,33 +24788,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 @@ -24834,17 +24808,21 @@ aarch64_start_file (void) asm_fprintf (asm_out_file, "\t.arch %s\n", aarch64_last_printed_arch_string.c_str ()); - /* Check whether the current assembly supports gcs build attributes, if not - fallback to .note.gnu.property section. */ + /* Check whether the current assembler supports AEABI build attributes, if + not fallback to .note.gnu.property section. */ #if (HAVE_AS_AEABI_BUILD_ATTRIBUTES) - if (aarch64_gcs_enabled ()) - { - aarch64_emit_aeabi_subsection (".aeabi-feature-and-bits", 1, 0); - aarch64_emit_aeabi_attribute ("Tag_Feature_GCS", 3, 1); - } + using namespace aarch64; + aeabi_subsection + aeabi_subsec (".aeabi-feature-and-bits", true); + + aeabi_subsec.append ( + make_aeabi_attribute (Tag_Feature_GCS, aarch64_gcs_enabled ())); + + 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 26938d84dab..bafd3261b22 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\t0x4\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 6a41b52d298..1ca7166ad29 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\t0x7\t\/\/ GNU_PROPERTY_AARCH64_FEATURE_1_AND \\(BTI, PAC, GCS\\)" } } */ \ No newline at end of file From patchwork Wed Oct 23 10:36:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 99388 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 6C5253858435 for ; Wed, 23 Oct 2024 10:37:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on20614.outbound.protection.outlook.com [IPv6:2a01:111:f403:2607::614]) by sourceware.org (Postfix) with ESMTPS id 0EC4A3858CDA for ; Wed, 23 Oct 2024 10:37:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EC4A3858CDA 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 0EC4A3858CDA Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2607::614 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679823; cv=pass; b=Vr82cbzCszJvNDKtK2yWiHW/AbK2KPJ1He1eVk9xYX/L1h2JSqpB7nz8wdIXsPdGndISiu1yfeNROkZ/Rodv4lobgiWqCPrtNNXcjMmTN+oXYCWJOX8+hvu9aDx/qfkJy83/YNH2pUoNJvVTXeg+jbSShmU4suwHbYR1LR8+7Mg= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1729679823; c=relaxed/simple; bh=CJxRnbLiPtJ91jhxzgD4H8XNddF8JiADqAoa5n3yhrQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=XIlffM3crt7OKAqZU/SAGxeXEfeMX7ckslWt9PFj7MonSfp6sQqCVhSSfG95wJGRLWMhb6+4FdS46K7tB+EUKyWiLDseWPuL9+Azh7vbVB/UeoknHG6uxO5Kh8m+GxI7wVkDeGk74Hs9++idz+g+DjNXS0FQVdAz+ePgyOhZzrQ= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=cVmvIWBkRJ0lEQDPgn/c2a//40S9dloN6tB/69tTgD+bMZVTT+uIv16z1cd3CkIBOkqUc9ToJOwQD34fUhwWe6NX6ZHlPanmFvg12Istf1DFrWgpApdutGs43FOppgOZCslS1xkUivbQC9/NdR0Zl33G2Q6kyyDyPlJ5194lywwzCwk19VV22AglzwGTloM34pgg6s34pVoh9K2gg0PMJdh0+CIqveWRzehlJvn7QgDH6TaTRiocPvXnYe2/dlEUIzYT9UroCfl4AagMMM+0r9pX3/2Zrgb9AEDPfkPl/OO7DYNy6S5bse491fuzTWRPy183TLFuTC16uC2W4Axlww== 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=VfWFSS83435IMOqF/ifxWkilx0cwetOtoKpNMzM1Vyg=; b=ZS9zu8aREdKAbnzIjZWsip5VHJHmeKVZEsVWmmQpMaq1sSmRorWd4It3+fEcV3tov3YmFLD+hx+dPz0rLcoGa4K62447rYP+34x59jDiHeZx17HrqaixacSBfaMeY4yx2a6BH/6Wj4lWj9iclyEesuIGiRmZnljsKMdcMJOUv5n6Zi0Zja+QMjh2Eml+74TM/j4I8X8QmgsNK1ffhHC8I/2BW8sotoe6+MLR+Ze69+ywQFF9Dn0Ur1516YaSezbbBXWTju5aysa6eJMdJF49iOBZNzwCC4gCtByecFH+cFoErh7Mk5i+3d/GnAjPOXUtOMWKNshf9Nr4MEv3tKuAxQ== 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=VfWFSS83435IMOqF/ifxWkilx0cwetOtoKpNMzM1Vyg=; b=jgMRj3q6cnAX2Ppcf7gOwxgtbCnpfk+hzRVQozb5x+XqggQLQz+eCrofsAOMm7z+SwwKRPYNLGaEboD50G2vArxE0VmqTl04xAu6WBuzYcwyBTmc052zbk4t264oXMFCjk4QTnMYsMIRRFS4w0uMqro0l/xxwlZlPu6TEquJO7E= Received: from AS8PR07CA0059.eurprd07.prod.outlook.com (2603:10a6:20b:459::28) by AS8PR08MB7918.eurprd08.prod.outlook.com (2603:10a6:20b:539::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 10:36:52 +0000 Received: from AMS0EPF000001A3.eurprd05.prod.outlook.com (2603:10a6:20b:459:cafe::57) by AS8PR07CA0059.outlook.office365.com (2603:10a6:20b:459::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.5 via Frontend Transport; Wed, 23 Oct 2024 10:36:52 +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 AMS0EPF000001A3.mail.protection.outlook.com (10.167.16.228) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:52 +0000 Received: ("Tessian outbound 60a4253641a2:v473"); Wed, 23 Oct 2024 10:36:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3c89a2ae7a7782e2 X-TessianGatewayMetadata: QOJii6w/0CgR4jRLKz7841OiDbafLIV/dS8K/3vRbzaziEphRZBnw/GdHUwzoZN23okymveupCTQnoCNNsfZVglm5xWm+ijMUNdzJbso8qhec77f0UYL3fSvE/r6jD4IjwWZW8/MFw+jFZD7oka9qkiucwfD8QzxLlZa3iLcaGs= X-CR-MTA-TID: 64aa7808 Received: from L116943a05434.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 223FC5AF-2D94-40B3-9242-AC4541B94DB5.1; Wed, 23 Oct 2024 10:36:45 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L116943a05434.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 23 Oct 2024 10:36:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UvCZr7ZIuaRAotvepGsqmsxoFH18NCANMV7pQxhnzWO6DZjhbXdynxBsccPEHCPxAy4sRHYX3e182gDmfkKUZjJZIV1UVV2nst2lX2jZjWq5Fm9SiRf+ktFhrUeBCPGHZ8j4lQC79eq0nrwmW8NOaVfQnIHQznFQJ2OZ+3Q/5KO3br3hGtWEtFZrT5WcEIcQNGrTLf9B0I7YOJ1cRMVnEfg2Zsp/QaSAFSDForUfBKMGqPm16FaaeSV5PLr26lVH0iAX6VpOgbXtNyIwZX8EAuaNIPlse5Rc6bWlGMSI0nJ/o5S0TfZGWVmm3bf3GzhhaY4jeYjgZwACQBaD40d9aw== 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=VfWFSS83435IMOqF/ifxWkilx0cwetOtoKpNMzM1Vyg=; b=VRaDH9tFgplRSNVD9Y5MJi3n3mfrUte1OLo17QhzNOXvzqnpl6vch00Uz7BAWrpYkPL7QW0PCht6KQnZvh2JJEGqVXhHzlJ2PB43em12XQp0IosrfxWjIzI/7oBLRD2b8EGZQmPTKLOPT+LuWZ9I+NdawFyMSxdn1mknAtx40ZpkIyb20jghsQV6Bs7NLMaREyW3Z97DTwqdtsZTbWxb9o4yF28CR8ZOPB/3/SPwB18SjYArwdBa8hZl/hIXFlPGam0l14ZzPkEKz+tgKwXmch+fw6R12ipGXsDoqUirTtRuBiIrtFQzpPC2w0ZU8Bs20LzqfOJXZwlHCgz4LK6WbA== 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=VfWFSS83435IMOqF/ifxWkilx0cwetOtoKpNMzM1Vyg=; b=jgMRj3q6cnAX2Ppcf7gOwxgtbCnpfk+hzRVQozb5x+XqggQLQz+eCrofsAOMm7z+SwwKRPYNLGaEboD50G2vArxE0VmqTl04xAu6WBuzYcwyBTmc052zbk4t264oXMFCjk4QTnMYsMIRRFS4w0uMqro0l/xxwlZlPu6TEquJO7E= Received: from AS4P190CA0035.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::11) by PR3PR08MB5867.eurprd08.prod.outlook.com (2603:10a6:102:87::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Wed, 23 Oct 2024 10:36:43 +0000 Received: from AMS1EPF0000004B.eurprd04.prod.outlook.com (2603:10a6:20b:5d1:cafe::3d) by AS4P190CA0035.outlook.office365.com (2603:10a6:20b:5d1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 10:36: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 AMS1EPF0000004B.mail.protection.outlook.com (10.167.16.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 10:36:43 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) 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; Wed, 23 Oct 2024 10:36:43 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Wed, 23 Oct 2024 10:36:42 +0000 Received: from PW070M4K.arm.com (10.57.85.41) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 23 Oct 2024 10:36:41 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Richard Sandiford , Srinath Parvathaneni , Kyrylo Tkachov , "Eric Gallager" , Matthieu Longo Subject: [PATCH v2 4/4] aarch64: encapsulate note.gnu.property emission into a class Date: Wed, 23 Oct 2024 11:36:00 +0100 Message-ID: <20241023103600.500910-5-matthieu.longo@arm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241023103600.500910-1-matthieu.longo@arm.com> References: <20241023103600.500910-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS1EPF0000004B:EE_|PR3PR08MB5867:EE_|AMS0EPF000001A3:EE_|AS8PR08MB7918:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f4aad2e-cc61-41f5-aea4-08dcf34e9b8d x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info-Original: k9BOpoPTq4IIJ7OVudPGjkye5PrCnY0b1TX4wIcXsVv0+f8en6vcqOmeEhJXPIVqVEVrSRKBGEOFyXUEfXHaqhSuGe9yeR0IQmwjR5Xen+D5ExkBdSBTqkZxNH9f0nKMR14R/uVK6qnJrRH7BDko5IcyW8rNLn8nPfvV3eGqOUDJEjX/ng2msJjcSt0ckWYUky0s0hpovgdqRArVew5yZ7uWZRfBqbE7KZBFn82sjGp56tlsrVuKPPhBIS+Tje63xebWQ09ycY7SVl/2lZI0Cb+EFgpnZCZgHCHFXl1UpYPAN/3KudQUGjjmszLNvzVQciEZ3zKm+BO6+VKxb7l7V33I1rnHSxQf1swXTHzmlxzWx8s+Kvvg7X2hwCJdz/L96ENIXkFzBBq5knvWMNb2MFQ4xAGkuUhMAMs0sQhl/4PEFFdoZ4k1uXuEaKrymw4L150MZgDhj1t/prekuBVcf7BmxCnDNq3iBpAel5gsEWLMqVBkwBXMG1Ov4nXw5clcL7iVULQFV2qX0miMTAHNt2DWkBXZ5sVApfxKapsj4bS6g3LuBl0gMDGxwsZM0dv4Ov/SiN1+FNz0oxhWraP6YMrwSYMgyVoJMhICceCCZrj9/PupR0dwDiVBs6I7XNM0nxcs/FXGg5pYQaUCC79udHpgjRL5s6aSD/NDeMAKmelNnPs1hscDRt0HLZvgDFCrxvPiqrcPRz1dxMRU27OmMcuorymLTY4XREBviXaGAm7+hfK+pFcSgGF4cad1QBNIki5lre2N7slpfJpoCZWz+ItXVqvxF5etStrUatSlpaEjQHu327Zp/04zT6eMOcLAv8SxdFszFwZm0bPeC1mWaEfk9lCJ0ZNvu4faxfuufoBxgoxDkRg8jRZ2q/sl9vDd6SMKd2u/boZZxa9V50xMuSwJvps0DGNG6vO7jERlYol//cmZ7awpeDPN8A9/n4wpmx9/udnrwVscs6Zk3islHt9bTk0cCVuZzGYaOxdSGUChl5m5kqICBrIhgygVQ2YfomFZ8ZKzEDKFQdkkHoPN5yDNrXdapOEqmwvV+wfjfNuviXAEA7t5+w/0GuIYtUudBO1MF0zVVaB/lkgW5PtL+jtCFZNmSsnzu99LfGZQqgJdRROlBIE4fpqZVlgcZ+IRv5YRH34eZ8jkyxLCKTRagu9qMaT/daehsUU2vMHAE1B8Fl+qd2rqnhqgYiDfoztJx0GOdVninmgecOqCBMuYiNvHs0dZym/rgSMRcNS0TDx3JjSm4z7/HuzaZ/fdY5Z+uZ7wqsP4IQRez7zL6naVAny4WIOoHs3gIPB9n2yFbYkCMIsEucuro71Genim4NhLiRZI+cxsBcG8+cEcPeXFLc5UYDEOi6R7lInf1dyzJevyCEpexHM+Dqhxd/gCOcLUES7VLqRm/7GL2A16crNTQQ== 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)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5867 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:5d1::11]; domain=AS4P190CA0035.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A3.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c3fd27e0-d0f3-4c5b-1355-08dcf34e966b X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: lIXq++2hWj4vYuO2yH5Fw11j3vokQ5jO8dU3/P1lk6Uq+5phJLYYVifsZVwO/lmJ/MKUnbprCLMZeju7DcXsmhd/2wma6XwvvrVyJOohG5g+r6GWB7ECidja2A6r78xj/eGwcumvUzAtbIEHZLsDLIop7M36S0HKP6UQkvg/0A3trCO+JVagX3+Yo/YEVVq+jra+O3ncruMn9Ic/j1lxmc0pQ122k755qp4KCT3A5jicMYSBS/1xYBomF8qrip3GWYgGjJpU/FvkmQyXePBoNW9s/qG/B+I2rOeZyXxJNrd+7GaRMYCwRiwGEBYJbzYsN3CO6OB0TixVd7tlCP929JGCJGOxtdwAYRXrLkkFyZMqs56KXRI+tNRu5WzzykeRpSHvtfr1fxIa7KxSv30R5VXCdqgGwR2DRPMsZV5twWLi1NxQDvtBvF0qih2tUTg62uBHIEX/iVLFGNxewsJrGgw1KjTCi2C6hVWfITARurwluNjkVsqTmbHQYiTYE0Bb1nIZrLVv+1QgpKbCkofKpNmQ0+xKF5Tth/3d3Jj3zUxYE1fbrJ0/Y6xDmI4T667YvOU2NmT9tm7neVvhC+jonLAZje12E4SrWuxNzAD2BXsNeXwfxb5SWicqz3B97Rq57IV3kCX0WZ/cLSP4C3OfsFXHbVGmh7L3orAuMsPIddEa1QeT/zAbWw0BeOIQDTROU5PrNiFLKcDYUwbSOP8MA1HanCBZx/g1e+CiO8WxhyPvHIKcHPxxN7G5M/vOT5QOxb9tyzSes6Te5QAYI+UC1ULC4mOsGGsnXK8PTLQhG/cTcYlRWGLo1+s8jEqwnJFHlarOssegoGLrVkFUmzQJYHn+AVdurhzhDOumDYrzOLPtBKFZ1eysyjD7tNYFdWTVOADsPrkwhwQDNt6CdtvtScHb6yTIamlIRNhw6xUtKk0QFuGqM4c0J4JacjrObkqnvAdnnSXMO96xNbkbf35Oc04Jmlgi2dbkR3bjYXiqhDEXdRclALOdtDzDlTT4gYcjATzio5KO5bf9KS7FmJe+2/eMjDoiZ+/OGsTk7IstAdtgstvv27jKKG1M/WzD4GuGkCQo2gkWXGy4M7dBCHlwlH+s6hyCqYMnzxm9j/uz8tUJFPE+xFnFU/xpWY81KdccEr2RVHIEIZA3KmXayHj5fnt/2kok2KV3lRxMNIMX+guhMy/98cF7dBen4OOFkpqzxtmJ8DtT5YQZZkS0XX9zkU9zTSgXGmp4srgH21nQm1EgI0KkswDQdfut5dTA2SXPhh9nmSS3dtZ5ISO2DOrJgO49lfyEE0bKbGk5H3coCrQ/62QXznbgmSe6B3Hb3SVRpbhv5s9rhwPXrMaVGfrL/jNDT76nTGbXRTxqKVoCVOf2BakzNNIIOvvzvAOf0G157ytzW7w60x/KMi6pW+6ApA== 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)(35042699022)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 10:36:52.1895 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f4aad2e-cc61-41f5-aea4-08dcf34e9b8d 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: AMS0EPF000001A3.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7918 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 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): Removed. (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 | 145 +++++++++++++++++++ gcc/config/aarch64/aarch64-dwarf-metadata.h | 19 +++ gcc/config/aarch64/aarch64.cc | 79 +--------- gcc/config/aarch64/t-aarch64 | 10 ++ 5 files changed, 181 insertions(+), 74 deletions(-) create mode 100644 gcc/config/aarch64/aarch64-dwarf-metadata.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index 71ac3badafd..8d26b8776e3 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..f272d290fed --- /dev/null +++ b/gcc/config/aarch64/aarch64-dwarf-metadata.cc @@ -0,0 +1,145 @@ +/* DWARF metadata for AArch64 architecture. + Copyright (C) 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 + . */ + +#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" + +/* 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 +gnu_property_features_to_string (unsigned feature_1_and) +{ + struct flag_name + { + unsigned int mask; + const char *name; + }; + + static const flag_name flags[] = { + {GNU_PROPERTY_AARCH64_FEATURE_1_BTI, "BTI"}, + {GNU_PROPERTY_AARCH64_FEATURE_1_PAC, "PAC"}, + {GNU_PROPERTY_AARCH64_FEATURE_1_GCS, "GCS"}, + }; + + const char *separator = ""; + std::string s_features; + for (auto &flag : flags) + if (feature_1_and & flag.mask) + { + s_features.append (separator).append (flag.name); + separator = ", "; + } + return s_features; +}; + +} // namespace anonymous + +section_note_gnu_property::section_note_gnu_property () + : m_feature_1_and (0) {} + +void +section_note_gnu_property::bti_enabled () +{ + m_feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; +} + +void +section_note_gnu_property::pac_enabled () +{ + m_feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_PAC; +} + +void +section_note_gnu_property::gcs_enabled () +{ + m_feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS; +} + +void +section_note_gnu_property::write () const +{ + if (m_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. */ + fputs (integer_asm_op (4, true), asm_out_file); + fprint_whex (asm_out_file, GNU_PROPERTY_AARCH64_FEATURE_1_AND); + putc ('\n', asm_out_file); + assemble_integer (GEN_INT (4), 4, 32, 1); + + fputs (integer_asm_op (4, true), asm_out_file); + fprint_whex (asm_out_file, m_feature_1_and); + if (flag_debug_asm) + { + auto const &s_features + = gnu_property_features_to_string (m_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 ()); + } + else + putc ('\n', asm_out_file); + + /* 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 01f08ad073e..564319981ce 100644 --- a/gcc/config/aarch64/aarch64-dwarf-metadata.h +++ b/gcc/config/aarch64/aarch64-dwarf-metadata.h @@ -221,6 +221,25 @@ class aeabi_subsection auto_vec, N> m_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 m_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 e5a94738f70..3883338db9f 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -29236,91 +29236,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)); - - /* 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. */ - fputs (integer_asm_op (4, true), asm_out_file); - fprint_whex (asm_out_file, GNU_PROPERTY_AARCH64_FEATURE_1_AND); - putc ('\n', asm_out_file); - assemble_integer (GEN_INT (4), 4, 32, 1); - - fputs (integer_asm_op (4, true), asm_out_file); - fprint_whex (asm_out_file, feature_1_and); - if (flag_debug_asm) - { - struct flag_name - { - unsigned int mask; - const char *name; - }; - static const flag_name flags[] = { - { GNU_PROPERTY_AARCH64_FEATURE_1_BTI, "BTI" }, - { GNU_PROPERTY_AARCH64_FEATURE_1_PAC, "PAC" }, - { GNU_PROPERTY_AARCH64_FEATURE_1_GCS, "GCS" }, - }; - - const char *separator = ""; - std::string s_features; - for (auto &flag : flags) - if (feature_1_and & flag.mask) - { - s_features.append (separator).append (flag.name); - separator = ", "; - } + gnu_properties.gcs_enabled (); - asm_fprintf (asm_out_file, - "\t%s GNU_PROPERTY_AARCH64_FEATURE_1_AND (%s)\n", - ASM_COMMENT_START, s_features.c_str ()); - } - else - putc ('\n', asm_out_file); - /* 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..c6b8ef9ccb8 100644 --- a/gcc/config/aarch64/t-aarch64 +++ b/gcc/config/aarch64/t-aarch64 @@ -139,6 +139,16 @@ 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) \ + $(RTL_H) \ + $(SYSTEM_H) \ + $(TARGET_H) \ + $(srcdir)/config/aarch64/aarch64-dwarf-metadata.h \ + output.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) \