From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2044.outbound.protection.outlook.com [40.107.21.44]) by sourceware.org (Postfix) with ESMTPS id 0B1553858006 for ; Mon, 11 Oct 2021 13:58:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B1553858006 Received: from AS9PR0301CA0046.eurprd03.prod.outlook.com (2603:10a6:20b:469::6) by PR3PR08MB5580.eurprd08.prod.outlook.com (2603:10a6:102:8a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Mon, 11 Oct 2021 13:58:19 +0000 Received: from AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:469:cafe::7c) by AS9PR0301CA0046.outlook.office365.com (2603:10a6:20b:469::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Mon, 11 Oct 2021 13:58:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT011.mail.protection.outlook.com (10.152.16.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Mon, 11 Oct 2021 13:58:18 +0000 Received: ("Tessian outbound d5def7722ff7:v103"); Mon, 11 Oct 2021 13:58:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c2c82178e2da58ac X-CR-MTA-TID: 64aa7808 Received: from ff22033ab989.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 361080F4-1D63-475D-BEEA-6BD875093DA1.1; Mon, 11 Oct 2021 13:58:08 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ff22033ab989.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 11 Oct 2021 13:58:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZR2Z4zuAOlXsEvoJA5BVz3fHu0gMT+xI0TIGjvlaxNZjlqo50nMVewIc6ivkUSO53+TFrA3uyO9DC4SwZm0mdly4vbFA6Wh52oSj1er9e/qjiupEiWC034qRsvO9BUfyX5F3D2oSF1Jai2ycSlBnN3SLHrF7I3lRHeWAdqzpWQ2f9RLM4uR/jXYkODlABzGZrm9dZmevaOAzBdP12+w7fCABSVdaLP88/H+Cj6fixf+3jde+EreN9vdbkOIPmw4dcBXbBnu+EjWng5jOKF46tf+gFc7h85tHzUKlKXmAVviXvxQbHrw/cpDXpK0ZphDw5JWla+aj9m4eaOokMqgtRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fKpAu43slc6588S9qWjb8p6B1kUewt/2FXh0NLeMafY=; b=QPvp2nUyqXVSVd9BCwfhWqCO7vO/Eq0Am1xShQQQcjE3kQtzNtlPL4eP9KYhn8LJd0/8KzmqXQu4FEJdR4NTjjU2+Cq1JO3wiI72wv37BAkw/FUbEgY909A8JPj/lt0d0hyqLlX5wJgIahdQQ8HMWnjtwIoUt7ctkbv2qdslVuxDN8qXvZVDKpBhEwMcGpHbBLR9iYcU3DPtblfXMb0LXDG3UmM9S4GnDuh4tQcJq/hzCcGrsQkOBsW4XMMejUjVS42KVhIcGOUICQ7JmPUeVrzCepMclxzI9FmWCgB9L02cYz9oEEfDRqDSi2ghXuigiPDd0rXDthQgH6qKNTZxzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7115.eurprd08.prod.outlook.com (2603:10a6:10:2c8::5) by DU2PR08MB7239.eurprd08.prod.outlook.com (2603:10a6:10:2d2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Mon, 11 Oct 2021 13:58:04 +0000 Received: from DB9PR08MB7115.eurprd08.prod.outlook.com ([fe80::9540:e904:fb9:9c36]) by DB9PR08MB7115.eurprd08.prod.outlook.com ([fe80::9540:e904:fb9:9c36%5]) with mapi id 15.20.4587.026; Mon, 11 Oct 2021 13:58:03 +0000 Subject: Re: [Patch 4/7, Arm. GCC] Implement target feature macros for PACBTI. To: Tejas Belagod , "gcc-patches@gcc.gnu.org" References: From: Richard Earnshaw Message-ID: Date: Mon, 11 Oct 2021 14:58:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0228.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a6::17) To DB9PR08MB7115.eurprd08.prod.outlook.com (2603:10a6:10:2c8::5) MIME-Version: 1.0 Received: from e120077-lin.cambridge.arm.com (217.140.106.55) by LO4P123CA0228.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Mon, 11 Oct 2021 13:58:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9a88f02-86fc-4ff4-c397-08d98cbf2e21 X-MS-TrafficTypeDiagnostic: DU2PR08MB7239:|PR3PR08MB5580: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: zsI0WPQIoD+b/nNT/J3dDzmgtUvtwXn3fAb+HxAYKRGgZE5zd1SDWNcaRTPCQWHK0TwwBAhpjmCxz0DUqo3cMUNwFupyPX3B4DR0OJ/6aZeUeeXBmCRouviyhgEH7xpW0jptOoAVG0KOvJAT4MvGx8L1jUb7e4Y+qbZADClMCOk/LmQyerEZLiJiJiNrhFJMw94O/UwGOuA7Z4Lr0bozGZwKUxP2t2YAmoLVetdV9NLkmkNXizKJ+UIQzRU1GoCJSWwJXV+26frqS9tXMAihyWDwHiFvhOYJ9uqvio8LUA748kca7mP7MFQIH5JqEtTgrbni4Lw8JUjFV1+bSKF7HJPwrq3HxyWUWXm3k2UdlDGv7wfSFG+XR2h7K6Giy95aMMLayU4VOfzmLT0BYB6cusRaEP0eASnXmamxjFJqzjQ410yCOB5Or+RBArt4IR76acIvtVyg9LzFsK6xxFr7qCd8nbNqiGEGS+90p7FODl4Xb8EjHFJiim48kS/JN2bexOqQSpCwMgy3FE+3n69AUftO3JSaJViXi5glFlOcTzTwPdzlnExDQldDgfUbZBk/16xMPuPymZj9Jz5RGdYPgNzYzYsY5yLa4CBktVnu4uUYLjp7EnVcAjZVXVIULbbqXWVH3u3+zgyFKRoYV+ZfZQkk0GSzELyCgl8nw2GcZOnTxuwXbV2bZfA6HvkLFqPJox6tO/tiuAhweBiO1VaHqerUDvM2ZQs8dEVfUxWCfwhDjWyLOrc1/JfUB1uIPMW7I97DaAXX+9qF6/7P9X1byvfjWAy9cvMnDSp5naQHEkyvn6dbEKJoR0EzQHtW7+z4AOL81oQ/TQyorYpy7Yfb9vRtkvEbE3+Ax6Lq9S/eVnk1z9BhwrTxvugGzjGCRwR4PAzjEmYf2wUxx7PORxdp4g== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR08MB7115.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(31696002)(2906002)(38350700002)(38100700002)(86362001)(316002)(36756003)(53546011)(31686004)(7696005)(26005)(508600001)(6486002)(956004)(66556008)(5660300002)(8676002)(110136005)(2616005)(83380400001)(66946007)(66476007)(52116002)(186003)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB7239 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b7eb3668-ef9e-405d-1adf-08d98cbf24c1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rSFuwctBGXlKWBqdDnAvr/OLDamlHKGvpeRqS6U+jGlNpzhh15KL8GDHJT5UU9hp1luXTf5vpXSmNxQcZurB7Gy/f43lkApRXBuWd56S5glZAPilnpssj10cupNJET14MQO5ZrGgqcZEbAgfXtvRRc5WcJXpWpncvgOV3rsLLbRtDcaqn8lSEKa/iB3ESQTqoPhDZZSEFge0Ow672LPGCUdQQTb5S8UPerAubVfp4HCjIfmVYqGQiPcJrwklZM4aBA5nsEgn4eHic8NOpbyYWhXwzVlE5RRGCWa+ltsLK4+IlvX3M6pnCKZciKUCuqnawuleSMdVv9nfWAciDZBKZzmgGImpjxpJCKF/rc8A+RU0NR95l5i8W9J8XCSQh9gs5k38/mCgsGc4HWgYu5Thek84pf9pv0lPHYqF6vFu2EenhJ+KarSyGitIDwiGb6wFN3HuZhaS9KJSV3KfD92z79if8EPc1HftBWxmvyFLq52WYDwyu2bZMo5A4WOO+acGjmgXyfadAnZYs2ZnxFKVx/1BrQL2AVhHR/dqBP9gt5NXebRCk4+zVnvCda7xdO1m9ZOisMitgwr6k60kPXMPz2OoQxKvTQJHldfdmvOUtKBDeoaEDfZCBm+9B4LN2c6qXSlg8eHhqCbywoiFtMGPRkH6FSQ5dgRUJnXJYbA/3z09/8IatEOma0j6z5cbf9BGt5alwzqE540t7aQE59YKrE3rV2FyeMI3ddQ9EFIKkn+CsWW9MdegV5VESAEcTfAxe2Fnm1h/P9OggR//JTk/0TN3aOTA2iyffBXKKdHMMNpqUDtqxizWULteuh4QPW/sTbiRtWLoQplcWV7ZlSUwjb6S3NpNfnvyk1XPAn3SKdY= 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:(4636009)(46966006)(36840700001)(82310400003)(2616005)(956004)(81166007)(36860700001)(83380400001)(36756003)(336012)(2906002)(356005)(26005)(53546011)(7696005)(5660300002)(508600001)(186003)(31696002)(8676002)(8936002)(70586007)(86362001)(70206006)(47076005)(31686004)(316002)(6486002)(110136005)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2021 13:58:18.9662 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9a88f02-86fc-4ff4-c397-08d98cbf2e21 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: AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5580 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2021 13:58:22 -0000 On 08/10/2021 13:18, Tejas Belagod via Gcc-patches wrote: > Hi, > > This patch implements target feature macros when PACBTI is > enabled through the -march option or -mbranch-protection. > > Tested on arm-none-eabi. OK for trunk? > > 2021-10-04 Tejas Belagod > > gcc/ChangeLog: > > * config/arm/arm-c.c (arm_cpu_builtins): Define > __ARM_FEATURE_BTI_DEFAULT and __ARM_FEATURE_PAC_DEFAULT. > > gcc/testsuite/ChangeLog: > > * gcc.target/arm/acle/pacbti-m-predef-2.c: New test. > * gcc.target/arm/acle/pacbti-m-predef-4.c: New test. > * gcc.target/arm/acle/pacbti-m-predef-5.c: New test. > I presume the specification for this is ACLE - please say so rather than making me guess. + cpp_undef (pfile, "__ARM_FEATURE_BTI_DEFAULT"); + cpp_undef (pfile, "__ARM_FEATURE_PAC_DEFAULT"); + if (TARGET_HAVE_PACBTI) + { + builtin_define_with_int_value ("__ARM_FEATURE_BTI_DEFAULT", + arm_enable_pacbti & 0x1); My reading of the ACLE specification would suggest this shouldn't be defined if it would have a value of 0, but that's not what this code does. I think it would be better to move this outside the TARGET_HAVE_PACBTI and use the def_or_undef approach. + builtin_define_with_int_value ("__ARM_FEATURE_PAC_DEFAULT", + arm_enable_pacbti >> 1); This one is less clear, could the value ever be zero? I guess exactly one of a-key and b-key must be defined and each has a separate bit. + } + + Not more than one blank line at the end of a block. diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-2.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-2.c Given what I've said above, I think you need to also test that __ARM_FEATURE_BTI_DEFAULT is defined before testing the value (and emitting #error if it isn't). R.