From patchwork Fri Aug 12 15:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Corallo X-Patchwork-Id: 503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:38f:b0:2d5:3c95:9e21 with SMTP id 15csp946426pxh; Fri, 12 Aug 2022 08:32:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+ArTNEIvsbjcJhajAWZQf6KQagPiyjHJJyhakdo0kNZZBIVq2K5P4IFctONlFILv6WFcz X-Received: by 2002:a17:907:3f95:b0:733:1e1f:d75c with SMTP id hr21-20020a1709073f9500b007331e1fd75cmr3046399ejc.727.1660318321147; Fri, 12 Aug 2022 08:32:01 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v23-20020a1709061dd700b00722e7756f3dsi1937354ejh.462.2022.08.12.08.32.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 08:32:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hD7sMLaE; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64B06385828F for ; Fri, 12 Aug 2022 15:31:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64B06385828F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1660318319; bh=xziHA/uwH77taf8TsCrs1k+DwYqa8Rpwu4TQHpEQFH0=; 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=hD7sMLaE7SumDinClGDAJqbnISif8i1lHw83ANZ1HkPpC7GxaiA3zuJIwPOt+luDq z6vsQ/67qlzfFKe/roVa8BBN7x3zHvVZjwDMlghGlUF6vVqTnkswSGZvTr1n3aj1SX G7b8Z48e3TqmUEKQcr13KpRCly61sTmOCc7PGJSg= 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-eopbgr70074.outbound.protection.outlook.com [40.107.7.74]) by sourceware.org (Postfix) with ESMTPS id D904B3858427 for ; Fri, 12 Aug 2022 15:31:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D904B3858427 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=b5EeYEmNfVakFHZi6QbjQxzMUreqFMpGjSZ41fKoWubg6F6MeFjNfDGaZSBvKBScXc8+RbbJBOc8+OXof5rpWftMgOn0KSO3zXWmFvVLpNeOv/gfx7+O7q8GdgCvOC/TRrYAePq5Se0C24tqVETTWjc0qtYtCODxAZ439zKHxtiNDtnx+4ec881PTJ8QMWPomCsts4StM3MA7rWy2Pe9GrBs1eJx50x8T0ErJE4jcqRe4TC7qa5pXdVe5ZuFrQJaHxIL+ijzQDEG62AahSofKa2Tr3+BteGQdmH/58cya7g9tg7k4urNEoffnJ2oNwiSZk6iWYKfZsIKCE3i5+4Z5w== 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=xziHA/uwH77taf8TsCrs1k+DwYqa8Rpwu4TQHpEQFH0=; b=cZX17wc45MVzqBkQqdYvtW8ellKCONnacPrhkanVwsMO47uguEkIV2PS99MZm4CXtsWBE86LXAMKWcoc1tgteSr51MCX4Uyg1SlnJhjIBi9CpHdaFX69D+BKJWhPiCe1lwrJQWGzWMDLWQsuCbHhNfZIxYc+oi8rrE68yITgkNYkD5GcdI4pjx0FyjS+We/p3l9I+G4CCf03jtbod2e3UoXUCO3P/Y4IEO6+Me/q95acZmZzF1JMsjPAztJ99krhn2gCF/aWNXiNuwI2GtjJpPemfnLhRFce1fLbFvoOmlHpWz/nFAfMKf0XefnsrVQ+Dlr3fjXOi40IK8US0sEAHQ== 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 AM6P193CA0085.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::26) by GVXPR08MB7678.eurprd08.prod.outlook.com (2603:10a6:150:3e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.25; Fri, 12 Aug 2022 15:31:08 +0000 Received: from AM7EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:88:cafe::73) by AM6P193CA0085.outlook.office365.com (2603:10a6:209:88::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11 via Frontend Transport; Fri, 12 Aug 2022 15:31:08 +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 AM7EUR03FT041.mail.protection.outlook.com (100.127.140.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11 via Frontend Transport; Fri, 12 Aug 2022 15:31:08 +0000 Received: ("Tessian outbound fa99bf31ee7d:v123"); Fri, 12 Aug 2022 15:31:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1d23035e3b690094 X-CR-MTA-TID: 64aa7808 Received: from f685b892a2f6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5FD99732-63F6-4926-81CB-46E1180175C7.1; Fri, 12 Aug 2022 15:31:01 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f685b892a2f6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Aug 2022 15:31:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e87g7Apye8ldurQ998vpvWY+J12dGcmR+4ydfhbLWpF69yClaHYE9FnjyrB6a+S9Iwr971LNUhOJNIhixuAeD9AymZK3/mR0zgNxE4HmLjde+8or27F8p1QElM3ZPMk8dMB7YGXmeX9q9uwuBARZnwX04PMZFGoOb4h6y6W6lrRgV42r+hEqzAzOPTaxASZRHlYeVj5AMV7+0kOgN6rQ78AmxevqVMib940zROAyrj9H6xIs0TpGLKt+K/DU3zD4PRmLIDylKbXrW3e+qPgKVycrenltaVvXUdxh3Mg/THxdxQFfCAC1odkXBOA/nej+9UVyca24Xa6CzzyEJN0maA== 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=xziHA/uwH77taf8TsCrs1k+DwYqa8Rpwu4TQHpEQFH0=; b=bb6KFN7OpIWxgU12b7Y0ozjNEgoCCK9RCYCqZygZjcbdzGp3BBH9qr1X2jGXp5eAq9UavJ0LyrfNs4/eulAwR8EJ0j1G/xqp34tgUoTGfzMk35fErEd7ulbehlqdoV4AHXkVghEbnDn4y2JcSEeG393dG8eI6p3GuGiOe8U3iPPfVYlFGi1apX0yytjkSASWFtVXDgK1Q+DT9XQf7/SaIpt29etMTe9HexIohzIYmr67A2lTbu1nLHF20Ldl1vapFkdyhxfVM8WGpZlEk+f4SV95zzQTzl8ex27WeeY8i2kLB12QUYdTQx4GRAtWWGLtSDQyR5izuGpzt/CXl5WTEQ== 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 DB8PR06CA0040.eurprd06.prod.outlook.com (2603:10a6:10:120::14) by AM6PR08MB5032.eurprd08.prod.outlook.com (2603:10a6:20b:ea::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Fri, 12 Aug 2022 15:30:58 +0000 Received: from DBAEUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::9b) by DB8PR06CA0040.outlook.office365.com (2603:10a6:10:120::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11 via Frontend Transport; Fri, 12 Aug 2022 15:30:58 +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 DBAEUR03FT014.mail.protection.outlook.com (100.127.143.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5525.11 via Frontend Transport; Fri, 12 Aug 2022 15:30:58 +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, 12 Aug 2022 15:30:57 +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, 12 Aug 2022 15:30:57 +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, 12 Aug 2022 15:30:57 +0000 To: Andrea Corallo via Gcc-patches Subject: [PATCH 7/15] arm: Emit build attributes for PACBTI target feature References: Date: Fri, 12 Aug 2022 17:30:56 +0200 In-Reply-To: (Andrea Corallo via Gcc-patches's message of "Fri, 12 Aug 2022 16:26:49 +0200") 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: 09570720-cfcf-4df7-3131-08da7c77adc3 X-MS-TrafficTypeDiagnostic: AM6PR08MB5032:EE_|AM7EUR03FT041:EE_|GVXPR08MB7678: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: mdwZX4G2WGN6WqHyjoccJUJR3d1iOQTBKZUzD0HVhyseylrU3hMS+qCKvn6SKotPKlAq9mfFNKFzGssg/mgjn71BxdOnikOCkz5wutQkEfry23WHCggg3wUWUWusF8dfTdUobKWdF3VU+pc+i9HQNArSPIpRXcsRvN2fG+8cmpMEXXUIMS9Vs5GpEdFIsVxgfNpO1ZcErjftTDtWW0MH1bWRH7PEBnPpW+LuDYSw2YXFI2d6/P5JZCJUxWEri9YaHyIZi8p1cbBwlPWq3RTmjjLe8dlzYnAbXyIhYbsMOEaO9q/9tkK8ARmQ5AONe+PLekgRsVjfyiCUp/IE8jEDBub20OEatbfYAnn67XKfPK8so83hioYfFGy14lJbCC/mv8HXd5Cy3tic9WHLqT78wXxP4zasXortCEPd/wBqN35NKF7qTSuB/Qsaoic4uX9t1DIb4AHeJCPqmemMDi+9Dc9AfjrKT6/Q8UpC2ApVRsTAJ0l0kLdHJRQNpUmKVRMIG21DQMiSyGiWmnxgSzE61g/cdUgpRU0VnSlB+m06inXhy3gK0a9pgZiZp+awC9TM7Dvyh4ABEH9DVaMJO0CFk/BKUg4bJ/tHZa1H7+YeN5XsIyFDOEXbov09xBeMn/Fi4LXkuisbkz/asRuFXkZKXnpHUgrz3sECDovjmgYhzwJ+n6EVkoQY2iX/8WxEwI7XKAee0jj9s6W++D4yoC/9mMUpvSpSI1pUkuxiNMal/IV4ttWmE7IguRXzpuqNaf/aNgGvlakqIJkHjtGtHZL8S9sbtypVWlQkfZAkOVsN2xE= 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)(39860400002)(346002)(396003)(376002)(36840700001)(40470700004)(46966006)(40460700003)(36860700001)(41300700001)(47076005)(2616005)(83380400001)(426003)(82740400003)(44832011)(2906002)(82310400005)(478600001)(36756003)(86362001)(235185007)(5660300002)(84970400001)(70206006)(40480700001)(356005)(8936002)(336012)(54906003)(6916009)(316002)(186003)(70586007)(4326008)(8676002)(81166007)(33964004)(26005)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5032 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 109310a4-3697-4647-e45c-08da7c77a7b9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fNhOm7bBZj8IUcdCzK8RYOFSJ8kGld6CY2fQnPaoza7xOWR86Fh2j2k1VT1oqVPxZVcswriGwCmNzlHP/GPfZq1BhocM51uFIGocqkSe6tlDX21jbpaISn57RvHMYqgHhLcM8YOumJRANRnh7yifqpAfoHaMOe3DQFxzYB7Z0iiXIkuXq0V6nrvovc83J5c3mjDlAdWsvjbstfkEY9nfU4F9F5vKqNnbfGL0amY0Mggb0XH8E7lPF54TQWan0tGXxxWdBmp3HWzMUdh4k5iEjjBjoCzbyTqPgI8Qf0gug6Vg0sqOF/Up1lgVkerrlj3sydJjFsKSVxUqzUMMzxIwIfMopbBHKQWmKP9o5glL7mj+ZLebxZjBBNXR1bIfNxD03yB/TikJs8ynxnCBgeq/OPFXa8SslRBxlMlSRi7KzJRtkaFFj9Qj9IUQfXEOJ32JSpyuXbwmVLxJnon0ZtFBhoFvpEuObyP1f1v3kBvMS4EJxk22nkLI2+J+il0gPN8FqFFN0x/2Ne+00IFygOHR4tmC7yQCpfiEW5TYs6HRtQ+SVDzgSRoh4THRr5CTtkAACL8mLSB4bwZck96Ul6BWsbmotvX6wDP1ZYsPaXK0DJtudatNlQkWEUkGIKO8iUO4D0RHBaYYoTCzdDxKmeMKOX1smw1kbHEYTorE50EzL4V8EqZdpSW8XPkXAI3hzPkWfHhEA8YEy6i4XozQ9CAJjXxkjaB+vzbbyjj4XDDMGN4fBtRvhQNqLnO7XJSRDJl4 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)(396003)(39860400002)(376002)(136003)(346002)(40470700004)(36840700001)(46966006)(235185007)(5660300002)(44832011)(41300700001)(8936002)(36860700001)(84970400001)(40460700003)(6916009)(40480700001)(54906003)(316002)(81166007)(478600001)(86362001)(82310400005)(70206006)(70586007)(8676002)(82740400003)(4326008)(2906002)(336012)(47076005)(186003)(26005)(36756003)(83380400001)(2616005)(426003)(33964004); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 15:31:08.4080 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09570720-cfcf-4df7-3131-08da7c77adc3 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: AM7EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB7678 X-Spam-Status: No, score=-12.0 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 Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1740969943814408376?= X-GMAIL-MSGID: =?utf-8?q?1740969943814408376?= 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 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..122f7a762a7 --- /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-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret+bti -mfloat-abi=hard --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..b94f3447ad9 --- /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-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret+leaf -mfloat-abi=hard --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..ed52afc83c5 --- /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+fp -mbranch-protection=bti -mfloat-abi=hard --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..1b25907635e --- /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+fp --save-temps -mfloat-abi=hard" } */ + +#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" } } */