From patchwork Fri Jul 22 14:57:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Corallo X-Patchwork-Id: 56271 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 38A04383541D for ; Fri, 22 Jul 2022 14:58:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38A04383541D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658501909; bh=0p1pUZg6Eh61DORISKKUJjMbFZfF8HOLiMDx9uwyh8I=; 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=SgWV9nSO6/ZVzNf97tLmOxgFVlWZCB8U8W8xXou8KM2MVBjKYW88sWPwXKkmF+QUF wgrOd2vRLL8kcrC0TFzm/WLvZztZdVJyGjkmYdQ0jSPzFnJ188b2IYCzH38Cgv1hVi BBmXyfGuwczfWr1wLSSCdtaDKUPwlAvhutCUl+0k= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2087.outbound.protection.outlook.com [40.107.22.87]) by sourceware.org (Postfix) with ESMTPS id 238B33857C5D for ; Fri, 22 Jul 2022 14:57:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 238B33857C5D ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=iIOIkKjGnIyNRZpOcDJazJE4xNQQiZvMjaG2aH3Ydd/C1h20dwTvg0hf/YEojB9zpeg7j/OssUmNUxAQM5s+fRke2hrLztOanCh9s/WYgJx7QxytKDxFChmusi8C3OWlLlFGw9/6CgNSeAFPJmD+E55zbhJ0WeXSwhlxGOFviN2tr0Ak88aoxM7kz+q5Q889FHs5u+fQhzOTn49yNix4AXjEjKUc8LYk4Sk5hhcl83WWuqkqDkPLOsJE+glb7WFIak9x95/oXvmS0ZQS+KrIkfK9nqF111Q0wwImN4M5PsaFUI86TcakQfKqXUe0kqUn0C2nIAYh9B4X4pj5bG/zIg== 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=0p1pUZg6Eh61DORISKKUJjMbFZfF8HOLiMDx9uwyh8I=; b=VjGueQRXlX0x6VbzhAZNYzZu1mbza4r3i8VQ5s7m0EgRejwmssUbpTbrsYUsZdhSET71bJdP3WrAIRJy37HZ9ENTAt/C83HSuW8nqqFXQZ0K4lAUXpjEnbfublWjuwTRJtTYUbcJVz/3vSzmLAJow72UF6WZyf0nJ1OkMTmRTe5/enmY58Um8IH0zvjqYp/mpLDT4OwkW/ZmwQK2WRpCNRfVxPYf+bzYOVeY7EPT/Lz6Ry26K+VBsyq8KfvnlT66AFvnCHH2XiWtDY4VwOg5d1o99+/MDMsSCaSoF+VqOLEB4gJ4yPfWRSqhYJOaQBsLYoTHPuiU3GJaHolaZRj7Wg== 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 DB6PR07CA0113.eurprd07.prod.outlook.com (2603:10a6:6:2c::27) by PA4PR08MB7523.eurprd08.prod.outlook.com (2603:10a6:102:26c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 22 Jul 2022 14:57:53 +0000 Received: from DBAEUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2c:cafe::c0) by DB6PR07CA0113.outlook.office365.com (2603:10a6:6:2c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.1 via Frontend Transport; Fri, 22 Jul 2022 14:57: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=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 DBAEUR03FT017.mail.protection.outlook.com (100.127.142.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.17 via Frontend Transport; Fri, 22 Jul 2022 14:57:53 +0000 Received: ("Tessian outbound cc6a8ab50b6b:v123"); Fri, 22 Jul 2022 14:57:53 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d42a0ea8173b6bbd X-CR-MTA-TID: 64aa7808 Received: from 1d154d1e30a5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EADD2DDB-FDB9-4C1A-B917-B4EE34444506.1; Fri, 22 Jul 2022 14:57:45 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1d154d1e30a5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 22 Jul 2022 14:57:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jW3H8aI1lyU252Jj1Z6LEibD07aSlB06p15agZGQqB0RnNAchg1uVAFQJmuQY2esG/N1OW6AbFeyR2FQBG0KRuEn0aTzj3mF9n/VCBb/5tggG+4awhPXZSHO0IeKrKoRnCCn77Ayk/OFHIiyVXq7QeG/BKidaN5WFsCqjYKZAHdbytUy/6a4Hp5fYK/QfyBNCzHCwhEUEStWhbgcEpBjHtkUuPZ02D9aBB8PHF96Aq0vPnlbxDWuhWQY1J1b8Dmw5haj/hbE3VIi8IZGWYgbmtgvGR5yYkXID+ZHxNxCVfQrNAYMZKb2o/Z/QFVcOPSkaISv4EcKX4OygiB865GWqA== 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=0p1pUZg6Eh61DORISKKUJjMbFZfF8HOLiMDx9uwyh8I=; b=aX+Tyvt3SY/ezF+O8db1zFBtY3+0+eh+qixUrlglqd2YBFbgxgC4v1ED4QmHy7D2rzgRxTNr8e68Geyccb8m/if680c53T+DYJia3lu7eAmv0sAtvfIIpHBJFgMet+rxfKhQjvGTpCkTkBwhCWR5guGZSxpGfq31vKEXAOTgmeLqSmHVaJ0PGIO8ahvpvIxahxxuwE34/L33OmVKidfY0MjD6gtpSTptDU8ZgQNITQ2bNVaMrbCkBZMd/y8W1p8VvEqjPIdaAn/jS5/fAAqY0siKliel8wNSaJEUvALVUwyLzSgo6U59D8d2kkCD6P0kthezZLPxE4zjohT6eSsNOw== 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 FR3P281CA0055.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::18) by AS8PR08MB6424.eurprd08.prod.outlook.com (2603:10a6:20b:33e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.18; Fri, 22 Jul 2022 14:57:35 +0000 Received: from VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:4b:cafe::7f) by FR3P281CA0055.outlook.office365.com (2603:10a6:d10:4b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.13 via Frontend Transport; Fri, 22 Jul 2022 14:57:35 +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 VE1EUR03FT058.mail.protection.outlook.com (10.152.19.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5458.17 via Frontend Transport; Fri, 22 Jul 2022 14:57:35 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Fri, 22 Jul 2022 14:57:30 +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; Fri, 22 Jul 2022 14:57:30 +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; Fri, 22 Jul 2022 14:57:30 +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: Fri, 22 Jul 2022 16:57:29 +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: f6c37add-1f88-440d-f3d9-08da6bf28e2f X-MS-TrafficTypeDiagnostic: AS8PR08MB6424:EE_|DBAEUR03FT017:EE_|PA4PR08MB7523: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: 9T4Qj6nJtuxekLlZGbCTwHCuSzMKgM4/0Wt/gs4DbDzHk0oQ229YR/5chEZ/vmDGSKyoUUbSGCx1GVwXXC0GH0R+qrY4ImnF+biX7yL6acJVekEWGToOTYGPcdxAGQ9JYRaAT1AgG8hB/lQp6LsF7ANXfPeptP0NJv8JeDmB10YR0VLkGRVy0D1CjLXivihwHjOPK2iNI6ermmXXbj4pdMjb/8bRrxtQ9hWulvs5f4ARJ63XfytnMCsKEQSGMrd8zoUPhf53x2dZ3I9SQUgCF0eQYqF7/IpfpmDQF/N/fDKvzeJAVYDCcEGPoRLeIhPb1hhGp7D6R6hs91dV2gmFH3Zu8K6o1IaZWbFofMiSs+EyuQZdzpIuz7hZnTQnGFKFowMfrNHddqBt6tFYzZDN0spgy1c/sfFOXmBP+Ovu9MCGbpudY9Vh3UyFnO01087MuRdK4VM/Y/hfefrPG50XSgcDqU/8TIHXgej//yf2skWmS2GeXUMYM8UWRHz3is1Kwtry0vp9EmqeMG9wuvoBTLAOKrkox7NcAhfMfu3Fe2GLi2zvkfuKcyoyboF4efZARQ8IwxLRO21w2OSECoLAcj7xHQMy9/SBXTe54WxEJdi9vR/B4Nmn3nRIIG4TGXxeuM8QGgicxV3qSXH8dXRTtYlKj6OqIsOIhoMdAsQrPplbj2QA3pX7KQjKMCD4lluTwhakPz0YOJM+FkzEVzuifcp5rm+3ERvydHPNoQRCGbnrdQI+j47eTK8SEMaGBz9vYWRCLmvPmrt9dAcAQtOctC1rp26QmYVIwWYQK0aYFOjalTa97E1/G3NL0jmA/xRSr08JaV7P8h7PZObkrZxJPVwTYZtIVsohcsfgWHNu28RB/y72jENUMVwI1y1ud4iifDJc/XREN626FCzceRH46unERq4mpTW+MJAJteIlaj0= 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)(136003)(396003)(346002)(376002)(39860400002)(36840700001)(40470700004)(46966006)(36860700001)(186003)(70586007)(2616005)(426003)(47076005)(84970400001)(40460700003)(316002)(5660300002)(36756003)(70206006)(8936002)(83380400001)(44832011)(235185007)(336012)(4326008)(6862004)(82310400005)(54906003)(53546011)(8676002)(26005)(33964004)(478600001)(41300700001)(81166007)(86362001)(356005)(82740400003)(40480700001)(2906002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6424 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 79f1f98a-b191-4cf1-fb14-08da6bf28315 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nWpsEG3wQRVkMCYpRuUGTgYDiNlNMFlF8HPobrUQfyxP7ETQshaGjkYk+Azn42eL2vNUpN2UseI74dLk4K9PZRF8C0Pkv8ZIgkvXobqKi5io5dItj9e+WDBABbWyeYsrbe0wQO4Bt8TgrKXROSS3TO4QlSR6HGrPoNGA/nOKuWcyQHUB6xELBi6WsO6vplQaAaypQ6mMxZPVc40utNpvNBfuHEQ6ixaXvzE9u6M2eOtFXOXQkTSK0/4D81htGbwZ+vt5mRvygY3q6tbq2IrGSXyN54RcspLQ/2NnAI2Xux76GBKkP8syN7W6ZP9mJ0z2VxlcjiH83FYtr37nqZKBU7dMsh9grVG5YNe2LSvfV1EPnTE5cU0MPKkz95HP97TzabdZpLL8l2ILoL2byY8mXWUdT4KG4WR6VhahZCzzJNeMB4PFnE5XQY6SS65QuOgU7zjqXgizjD22CJwPWOZnFqWLS1Z1o/dt3BiO1fRSb+twP/UbYLLzdHdOZYcf1uplQfiLExFTDsYB4oL43wqoVxrmhmUq1pgpNrEgpUrq0O6fbYiI594tg4Eoo5n0UElQijyMiEcMavBpN9hbEHNR4tBslOenQcScDc1nMtqiQKDb+Ixu0dIB0Hh9hdThrG9tQGzA5a7MehK/K1WYLwiTE1xBSOBTMwmSiA4KzTVRjFxTP8nhQAz47tKnexFKG7xVaB5h4ycf2nguKHWWPe8k/2mh2zuQIVWevBvl3GY4tU2WmQ/jcXDqW3iixwtIxhdSLKtKv28ZGiEmzFuQanqQEGLdRmGNtZL69QN/sYF1yfEusabb25VGUP1HIGyUSdF1sIsR4uRzr/uVkvs5mQJI15UvNZDVLCaWRBE23FtVzxvBGRUW8hzw+Yv1OSLaZfve 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)(346002)(376002)(39860400002)(136003)(396003)(46966006)(36840700001)(40470700004)(86362001)(41300700001)(40460700003)(26005)(33964004)(53546011)(235185007)(478600001)(82310400005)(5660300002)(44832011)(336012)(2906002)(8936002)(2616005)(186003)(426003)(6862004)(83380400001)(82740400003)(81166007)(36860700001)(40480700001)(36756003)(70206006)(316002)(54906003)(4326008)(70586007)(84970400001)(8676002)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2022 14:57:53.8111 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6c37add-1f88-440d-f3d9-08da6bf28e2f 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: DBAEUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7523 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, 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, please find attached the respinned version of the patch. BR Andrea From b89ac2dc737593a290345cb96c5d9b048e731bf4 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 | 17 +++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-3.c | 17 +++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-6.c | 16 ++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-7.c | 17 +++++++++++++++++ 5 files changed, 85 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..225b44de80a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { 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..1eae39edfe2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { 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..b49c6c4cc6f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { 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..006e66520a2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { 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" } } */