From patchwork Wed Jul 13 08:58:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Corallo X-Patchwork-Id: 56002 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 276353857B9A for ; Wed, 13 Jul 2022 08:59:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 276353857B9A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657702741; bh=w8ZtE2DEy1uqG5VLzMke33u9ZMvai/pSVTaiiD4Y1k4=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=lCnqnVl70DwV6ForL1CHe8hJvwQysfsWpm8UUPyJzSAIq1YYWTXTzhy+AgZctkaew A3fWtPrb63bkVznfi4TC9mM5GZZLIjcEiHiwimzcVprRICH1S/73gjBAq0SzOLKEY2 wUTFEV4qsPGNU9nvYjE86Xgn0iYFo96n110v61Xg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70043.outbound.protection.outlook.com [40.107.7.43]) by sourceware.org (Postfix) with ESMTPS id 9035638582BC for ; Wed, 13 Jul 2022 08:58:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9035638582BC ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=dJbLXmpqs51bLS7WBvF7VElDX5oD+71FdXJcNZEFrY2PxU68ZmWTgl6layBSbgf9JC5crWH+vWBDtFwPR7Rwgb0aNtJn5Hc3SOvDbvGQnIUYKrB3q+unKiklsQYU2qT77uArMpkkjX6IMeeerP8y+kqo6knu6Oa6NAH9ZDftrJ3eVkXCkGnUnGzyGHXIuy3W1BI+YmBRGwV/V/JlMq+aSCj6paYaYa82ht6tf3/hawg/SX7yPMt5kVF6Jej7PXgwA3nzTuFQmA6UTW2QdZXtfRFv4fkL8ZtcKI3F1fi6ygsgCrUj7xbv6TbFzgEWBcXTwt3REGsF7/xh8tlYrnbsUw== ARC-Message-Signature: i=2; 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=w8ZtE2DEy1uqG5VLzMke33u9ZMvai/pSVTaiiD4Y1k4=; b=PvWo464Ip8jYeCPTfYzL69/7aUyKhywKp28ghKaDGvAInn/gePVwSc0yILK3vaYd2zPcqDwdJaik7RwcVn8tzho+MrEmTLs0Vvqr/Pq+/Sjxooc7jiapyNV06mP+GMsh43ZEdhSaoQsfd5K6LzK7b91WkdvR/P1PCW/rkuhak9JFcTLnRLYJ6LqHBAIiRme90ijNOCGZJQu6W6BQ3YUMLrwaTew+VYrQWS/a7B0kTyLk5lvIOM8am79gbOwhhMbw23mevCYvL+BOtQFYoX5NvVBJluM9y9dUK8l53f2jdPK0YdxSM7/18XYPnzNR6LsbOxuJZFBav+LtOQXCR9NqhA== 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=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AS9PR06CA0255.eurprd06.prod.outlook.com (2603:10a6:20b:45f::26) by AM4PR08MB2660.eurprd08.prod.outlook.com (2603:10a6:205:c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.21; Wed, 13 Jul 2022 08:58:27 +0000 Received: from AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45f:cafe::1d) by AS9PR06CA0255.outlook.office365.com (2603:10a6:20b:45f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20 via Frontend Transport; Wed, 13 Jul 2022 08:58:27 +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=armh.onmicrosoft.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 AM5EUR03FT062.mail.protection.outlook.com (10.152.17.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Wed, 13 Jul 2022 08:58:26 +0000 Received: ("Tessian outbound 6f9e7ef31fa8:v122"); Wed, 13 Jul 2022 08:58:26 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 933e979fafb4366e X-CR-MTA-TID: 64aa7808 Received: from bc5bb22fff42.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A039A173-67D4-4135-B6C6-3DF58CB30F4D.1; Wed, 13 Jul 2022 08:58:19 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bc5bb22fff42.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Jul 2022 08:58:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HzahVAF/EFqAuH+B/JMDjIzUnjahyeHZdtmV+pbp83C/oG1NEJxylpvHlc2XTvo5xwr2GXVMJgRJe/sVb7eZYIWdo5kkvbkmSVRJGJ+yd6wVuY/n3XQGDoXk/aD4RCJj+igPS7mG26zn68MMHOZ+lpTjJH3uJTnR4YG1QZ1YNjZtD9THhAxy5lxhGu+FLSyvWuUpDcaLIpPrBLx57ozleaCzM8TgMR14kWDl1BNnUPRxIocQtIGHdmI+lrYRzMGZQvnzWWkuIblcivR+apyqc2QMVuuY9LXvSKHqA/jF1Upf5SVxj59rQy7UnI6KPoCeWl1moo0DEzUKhQhMoIrYNw== 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=w8ZtE2DEy1uqG5VLzMke33u9ZMvai/pSVTaiiD4Y1k4=; b=S5WT5Rc4ozveKdXRb2EMV/u5uKUqXyCTQMOI4h7kwcf77ElwPGhSRg4F5+riVu+wD4z0D8DRKNc3j7Cn1mX1pxwQTn9gNTndcIECepPm0viwWJBvDTTjpvFZH+s2F8/zy4+6tW/vUBcukV2wf9piurkyXkIVwfU9Zl/d5VR9yGJtuo3HBSowngu4A7vRvOZaakmPRmXaDSeFg6fBWkT01S3Yw2/7DfV0L1iOz+IuxkS2qOXdWmN1AqDnBGyT/IaA1gYEZsInI11UDAmuEyZDNI7BNwiD02ZO4hZwgtJXHvLJAG1SEkNs+n8LecDsbs5vhx3pyspKeYydpPVMY7YzGA== 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 Received: from DB6PR0301CA0087.eurprd03.prod.outlook.com (2603:10a6:6:30::34) by DB7PR08MB2955.eurprd08.prod.outlook.com (2603:10a6:5:17::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Wed, 13 Jul 2022 08:58:16 +0000 Received: from DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:30:cafe::1c) by DB6PR0301CA0087.outlook.office365.com (2603:10a6:6:30::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12 via Frontend Transport; Wed, 13 Jul 2022 08:58:16 +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 DBAEUR03FT063.mail.protection.outlook.com (100.127.142.255) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Wed, 13 Jul 2022 08:58:16 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Wed, 13 Jul 2022 08:58:16 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.9; Wed, 13 Jul 2022 08:58:15 +0000 Received: from e124257 (10.34.105.24) by mail.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.9 via Frontend Transport; Wed, 13 Jul 2022 08:58:15 +0000 To: Richard Earnshaw Subject: [PATCH 7/12 V2] arm: Emit build attributes for PACBTI target feature References: <7cbe01d8-96a6-7e33-ebe0-761e8a6b14c7@foss.arm.com> Date: Wed, 13 Jul 2022 10:58:15 +0200 In-Reply-To: <7cbe01d8-96a6-7e33-ebe0-761e8a6b14c7@foss.arm.com> (Richard Earnshaw's message of "Fri, 1 Jul 2022 15:49:15 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1.50 (gnu/linux) MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 59c660cd-fc6e-4102-4892-08da64add9ab X-MS-TrafficTypeDiagnostic: DB7PR08MB2955:EE_|AM5EUR03FT062:EE_|AM4PR08MB2660:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: O4FjlxdEfPtf2p6sOX41sYVM24AmCIPL4E2UcrODWXDKfLYE2ViGv8IE83MEO50B50SbI6oCSwknU5Kwvd+a3EpPIsPBiAyAbH1WELiV8RowTQ7iypnADOIhkGlGm7nK/urquOa4It4o+BE6m9ONhfw0kuPrzE+XdCKJ1pDDg5JZWUyjGuE8zzT27D0gPfptp7ajwzxIRAY2u2RWZwdITornlFkpE1sf/clvzeWsp6Ya8soDsQMJWJKQlEIChoUxBUZduvMQezeHyEVQQ4wUv/DEm5zZYZWB3Ra3mau8IWjjfruWi3fqgIcwQQHnsKqspYOOJ9AdNL1vf6+SE1pvNJoSep5BWXYDM3XeKreunsv1R4uoEk1vvB+A37XJ5yDCVc3r8+9jY4jgS1Jfc5BnWkkdlSn8HsufvTPBxm2Gb6VH49NX655h5ianF8SuDTyfUuuGkyxfhBTQMyXKwaNovinrWzoU6TBkRPiqDYXgGWbJptow5hRrbVlrPUeqsmuw1suD2+k0tae2Va/syHVz2eCNwfU8STxivSvskdFTKu1S0lxfjLPyI3ZlX9JCitil1VgYKRCFlsI0z+rLsRiQEi66nTH6FAyZqDfTNEjJYx53u32iLag7CXlfdBU5SMiRXBctv7yzViPpeeaEQAE89yhIb1eufmWNjEGvtzQZVcRDMZwTWWgFqOGTd3d8+zyKjviUCsKeWqSjpDQQvnoXL9zDQbxBOPYBeEKPG8KiwrPAyyFIoGMyJIEYIrYgd8omBks8uGcDSKXIuaKxLqEcxi4BoKRu3QRLsXyWEqCPEsnrTxB7s4UZPAtw2Jjh/2NVmvGO9qOUlCA5r33gJkATRUHokuVjqFytCEE2MsUbreJO5aknuinY5GJ5HteHMbDgGSzgyJ/xD2iDwBzrdwms/ymTHhO2BHJTtHrG3Tc6yX4= 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:(13230016)(4636009)(39860400002)(396003)(376002)(136003)(346002)(46966006)(40470700004)(36840700001)(2906002)(84970400001)(86362001)(41300700001)(82310400005)(47076005)(40460700003)(336012)(426003)(26005)(83380400001)(53546011)(33964004)(8936002)(40480700001)(81166007)(478600001)(36860700001)(2616005)(70586007)(70206006)(8676002)(4326008)(82740400003)(5660300002)(44832011)(235185007)(6862004)(356005)(36756003)(54906003)(186003)(316002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB2955 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c43ca6f3-714d-4aa8-270f-08da64add392 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P3is8o18ZGILgQSheE5ESkvqU2VmJdY6FylZKBZU2yCUuoKfmfO5oVhoe199P31JOYXih/QsOu/4VlYet/5t0lzjd+ctPKUea5vSLmzdj4ethcXvgqsVhdpAeMTTLlVEZ/9YXU3vs6Wyt3aVHnortuo0owIQfqLu9RB9A6YG0cSXdV9CnozE17db1ecAfggWiQ+/pHQeud1nvyhrfimuce9vyBOzrRH5IesKKMsCbj20vwGNDkyMQmmPj/Y91xvNWJznXzeHJs7iuwOXsTJdOrAY66CG5phSbPtNCx7w00yKDj3Anpyn9gs71kBlDBSJ30JbYiJelGHxn4EO6cd35086BxuchGDvxfMaIsH34BRgxU388pHqUensxtuqv8O76HrPttVtG1s3MJlLzKi4fIOmcbFJorz169vWD2dkKikDo8iy8q3LYtkxvbP3BO9AJyFo/edlvch5pwFelJNq+4TmlaS92arGZvVgDujAZofS2VOVhF67PNUJ9wFc6Z2BVQB2/sFY1xHnDtOP+c8VO/FQP/muxZLNS2a1QV/CBIGDqZtM+O5acwIN77eekR/XJOMY0YrLe+ICHSVvN/ANoO9bgcBliuKyxvbhEG3do4TnrLJ0vLnFjyNEl5gZXC2cyRP4hwLh+vGOC8pvQl8k7ubLUx2fxJCAwP1zth2LyW3Wlj9mbP7jIOQy59ejUB/JlNvMofA2NXcqrkVo3N1eNUX8qd2e3+gClpd+g/YxvT+geOuj1LcuEeakseTmQGs0Z/+F0TRVwGsLRg2jcRXqqwRYR1dRtHhv/TEsJpd5rQAePQcy4EChBT/covKlVSRT6tSlotyvhbGjPpLk/EZcnFKphMeY7iXqIWYsU33ruoEdK9CsXLNXCvmBYUDjN+T0mHrKyeJu8+6hvgbGeByfwg== 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:(13230016)(4636009)(376002)(136003)(39860400002)(346002)(396003)(36840700001)(40470700004)(46966006)(44832011)(82740400003)(33964004)(26005)(86362001)(40480700001)(36860700001)(41300700001)(40460700003)(54906003)(6862004)(235185007)(8936002)(5660300002)(2906002)(2616005)(70206006)(70586007)(4326008)(82310400005)(8676002)(316002)(36756003)(47076005)(426003)(478600001)(186003)(84970400001)(81166007)(336012)(83380400001)(53546011); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 08:58:26.9409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59c660cd-fc6e-4102-4892-08da64add9ab 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: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB2660 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrea Corallo via Gcc-patches From: Andrea Corallo Reply-To: Andrea Corallo Cc: Richard Earnshaw , nd , Andrea Corallo via Gcc-patches Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Richard Earnshaw writes: > On 28/04/2022 10:45, Andrea Corallo via Gcc-patches wrote: >> This patch emits assembler directives for PACBTI build attributes as >> defined by the >> ABI. >> >> gcc/ChangeLog: >> * config/arm/arm.c (arm_file_start): Emit EABI attributes for >> Tag_PAC_extension, Tag_BTI_extension, TAG_BTI_use, TAG_PACRET_use. > > This bit is OK. > >> gcc/testsuite/ChangeLog: >> * gcc.target/arm/acle/pacbti-m-predef-1.c: New test. >> * gcc.target/arm/acle/pacbti-m-predef-3: Likewise. >> * gcc.target/arm/acle/pacbti-m-predef-6.c: Likewise. >> * gcc.target/arm/acle/pacbti-m-predef-7.c: Likewise. > > These tests contain directives like: > > +/* { dg-additional-options " -mbranch-protection=pac-ret+bti > --save-temps" } */ > > But they don't check that the architecture permits this (it has to be > armv8-m.main or later). Hi Richard & all, please find attached the updated patch. BR Andrea From 7d66e00bf62c8624d03e0173be8b8631d7435c38 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:42:24 +0100 Subject: [PATCH] [PATCH 7/12] arm: Emit build attributes for PACBTI target feature This patch emits assembler directives for PACBTI build attributes as defined by the ABI. gcc/ChangeLog: * config/arm/arm.c (arm_file_start): Emit EABI attributes for Tag_PAC_extension, Tag_BTI_extension, TAG_BTI_use, TAG_PACRET_use. gcc/testsuite/ChangeLog: * gcc.target/arm/acle/pacbti-m-predef-1.c: New test. * gcc.target/arm/acle/pacbti-m-predef-3: Likewise. * gcc.target/arm/acle/pacbti-m-predef-6.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-7.c: Likewise. Co-Authored-By: Tejas Belagod --- gcc/config/arm/arm.cc | 18 ++++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-1.c | 16 ++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-3.c | 16 ++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-6.c | 15 +++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-7.c | 16 ++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 0068817b0f2..ceec14f84b6 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -28349,6 +28349,8 @@ static void arm_file_start (void) { int val; + bool pac = (aarch_ra_sign_scope != AARCH_FUNCTION_NONE); + bool bti = (aarch_enable_bti == 1); arm_print_asm_arch_directives (asm_out_file, TREE_TARGET_OPTION (target_option_default_node)); @@ -28419,6 +28421,22 @@ arm_file_start (void) arm_emit_eabi_attribute ("Tag_ABI_FP_16bit_format", 38, (int) arm_fp16_format); + if (TARGET_HAVE_PACBTI) + { + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 2); + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 2); + } + else if (pac || bti) + { + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 1); + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 1); + } + + if (bti) + arm_emit_eabi_attribute ("TAG_BTI_use", 74, 1); + if (pac) + arm_emit_eabi_attribute ("TAG_PACRET_use", 76, 1); + if (arm_lang_output_object_attributes_hook) arm_lang_output_object_attributes_hook(); } diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c new file mode 100644 index 00000000000..d3ef58fcf9d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.1-m.main -mbranch-protection=pac-ret+bti --save-temps" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 74, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 76, 1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c new file mode 100644 index 00000000000..c82c3a4b638 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.1-m.main -mbranch-protection=pac-ret+leaf --save-temps" } */ + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 74" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 76, 1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c new file mode 100644 index 00000000000..211c4753808 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.1-m.main -mbranch-protection=bti --save-temps" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be undefined." +#endif +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 74, 1" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 76" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c new file mode 100644 index 00000000000..48a40e64c11 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.1-m.main+pacbti --save-temps" } */ + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +#if defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be undefined." +#endif + +/* { dg-final { scan-assembler "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 2" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 2" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 74" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 76" } } */