Message ID | gkr5ymtwnpk.fsf@arm.com |
---|---|
State | Superseded |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 D5AD53857434 for <patchwork@sourceware.org>; Thu, 28 Apr 2022 09:41:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5AD53857434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1651138879; bh=hMwfeKccLILXVIBASkKoJ16s1X0dYZ7bq/Q5R/xitJc=; 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=RfVg2bAgDXEiHuIIrkYmTXK+TkYbXc4u11x/qmCGHns/pyAnLtSqTArWGW+gwjhU2 gUIp7tKQDSFo6T8KPdlkHU2803l/uKzZxMOgAygRlz03oIyCVNp3G/+LyyXJV+jrRm VMY063/juZ47fGZ9hslsrF6CVZv/rxObOYIiBoRo= 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-am6eur05on2053.outbound.protection.outlook.com [40.107.22.53]) by sourceware.org (Postfix) with ESMTPS id 83E1C385735A for <gcc-patches@gcc.gnu.org>; Thu, 28 Apr 2022 09:40:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 83E1C385735A ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Zv1F/T4GbUfxQni2TptQMJ0Giim0XWEuhqhmN6bdch1QwVnFi/gQf+XID10f0Bz+Lc7Jf4cswxUNf1th8O1GmwOO+iebW5JCuCrc8nLiE4rnJauMUdUtMijGf9uq0ZBfIroQaCglC/oyKMeoiVlekLGsrmDRGXogLIRHQMp7zcipsVc2ltXTJ47DvhzxvMIx/Ks7vqDX+REM5HIvbWFQr4HOQi36NlG/gWAJvWCGrRlwL9RHJSS7raVcspEtztIzvr92wbhFXREuK4PrxdP9vQAtVl1I26iPeH2VzT9IRQTLcplE0mZ3lh9WJzaLIGOySjEsVJlKi04e0aY7OlMp0w== 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=hMwfeKccLILXVIBASkKoJ16s1X0dYZ7bq/Q5R/xitJc=; b=FKwDo7VpeFPKi6qv/DYnN3dVFjnTm4bk++q95E2TxcP4TxcR2s2Gn7JPhRBXMTHEIJQ0g/yyTvsHXvvxW1JSfCYUKJxUtA0vihoAqkLE6ACfu5yeAjwTAO4s0iQQGWqa/cH6Yq+mb7KePg3QCtG2EDR4+JVLdnxwiPRYHzL0kDi/45PmGakC6Up3IyEVJc9/FLBSOIW6SfvYqLh/3DokepoRuAKjl51kpxBhONVMXaIVCRH8+ic6FFNZh6WUUMiXxvwL+m4wDafoLa59N8iKXbNTm/CyJJNRykSQspCrhBFr2VJB+DCSpOi98TryWMgS5Yh7jgN1Fk1YcHPVFe6xlw== 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 AM7PR04CA0006.eurprd04.prod.outlook.com (2603:10a6:20b:110::16) by AM0PR08MB5362.eurprd08.prod.outlook.com (2603:10a6:208:180::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Thu, 28 Apr 2022 09:40:18 +0000 Received: from AM5EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::f3) by AM7PR04CA0006.outlook.office365.com (2603:10a6:20b:110::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.12 via Frontend Transport; Thu, 28 Apr 2022 09:40:18 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT008.mail.protection.outlook.com (10.152.16.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.12 via Frontend Transport; Thu, 28 Apr 2022 09:40:18 +0000 Received: ("Tessian outbound ab7864ef57f2:v118"); Thu, 28 Apr 2022 09:40:17 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0cec802405517324 X-CR-MTA-TID: 64aa7808 Received: from 445577856ed0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 63906D3E-43B9-4740-81C7-D81F99E74EA8.1; Thu, 28 Apr 2022 09:40:10 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 445577856ed0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Apr 2022 09:40:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mnCiY4Jq7MW6aqjxtBOQBOmbDJCTVqw70NNDTvx9d7XF4N86KYY8F4/qARhJhr9gSybB4UDV6lCevBaBiAhd7xTAcXecyyJJcykSzyDX73xSIQU4qL0Yyqm0BVItOahUrMCTYFCTeBCiRWW19QexR6WV2OILAKi+dwO+9NIAlYoK5ugEw55EGTF3BLEZVj2Pg8oSypTPMROUiYbPRqglETvJdk98QPIu9Gz5wUfxIf+3OibMdmGSp0l3LwYKxpIQI7fbHgP5xQSwHK3mmX37z94VIsKnjG7n755Si6yo0X5m6rxvXZ1S4eJcWx61xuy+KciLFKrzAZQgqPd7M7AA6w== 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=hMwfeKccLILXVIBASkKoJ16s1X0dYZ7bq/Q5R/xitJc=; b=Qf6z9zFnGcmPqAETLKQSiJFR9qxRwIdYiriRK0GKcJwjRZA1PdzPBdoQ9v7E2Prni48N+7ScK05jiFlm71y1G8lonrjZtCJ2OUtajVmI1y+dcOGF/Wliz+alI03uQz+/UL60jfSUPREvyH0wGFrBQTtDhhFOlF+KOU8Gg0nLyTMM5efs8YHIyrSTne51BvTRNwZxq7rfbw+EHhG4jqaxPSUiHdKwaAFfEhDUZ73ayaXPd4rU4Rmkhx6IVZb27etOIHVvpqDPf/fxHgx2fzOkKKsBxKJFjG4hEv1kgb6T5WImcqLm/aDpwr4l0LAowq2LguAs8/aleCaBdlFdf1K5PQ== 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 AS8PR07CA0060.eurprd07.prod.outlook.com (2603:10a6:20b:459::33) by DBBPR08MB6089.eurprd08.prod.outlook.com (2603:10a6:10:206::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Thu, 28 Apr 2022 09:40:09 +0000 Received: from AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:459:cafe::a5) by AS8PR07CA0060.outlook.office365.com (2603:10a6:20b:459::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.6 via Frontend Transport; Thu, 28 Apr 2022 09:40:09 +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; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT043.mail.protection.outlook.com (10.152.17.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5206.12 via Frontend Transport; Thu, 28 Apr 2022 09:40:09 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.2308.27; Thu, 28 Apr 2022 09:40:10 +0000 Received: from e124257 (10.34.101.64) 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.2308.27 via Frontend Transport; Thu, 28 Apr 2022 09:40:09 +0000 To: Andrea Corallo via Gcc-patches <gcc-patches@gcc.gnu.org> Subject: [PATCH 4/12] arm: Add testsuite library support for PACBTI target References: <gkrmtg5wqik.fsf@arm.com> Date: Thu, 28 Apr 2022 11:40:07 +0200 In-Reply-To: <gkrmtg5wqik.fsf@arm.com> (Andrea Corallo via Gcc-patches's message of "Thu, 28 Apr 2022 10:39:31 +0200") Message-ID: <gkr5ymtwnpk.fsf@arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: c8fb5175-1831-4caf-042e-08da28fb1b06 X-MS-TrafficTypeDiagnostic: DBBPR08MB6089:EE_|AM5EUR03FT008:EE_|AM0PR08MB5362:EE_ X-Microsoft-Antispam-PRVS: <AM0PR08MB536294D7D2D88FC8F6DD40F888FD9@AM0PR08MB5362.eurprd08.prod.outlook.com> 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: lRogoBHs5KN5VfHBTHh3mJ0hRLbG+l0rzVNEj2vN2pIcL/q6Gg18kvAUE+IwkgA8Y5TEfnP/UGKab4CwZ/MTLehK0m+xz42YPTaMhy2giHKL0jH1JNMCr1CxKAynaEIBFoRWkLrYt4ju1vpctNm1VJZI7ChX8UnXwKgpSGQzfZQLX+eJYP73ElEK285ZZwihe/Y+Ow5EnDQr6rL+SGS5T3gUsuWY9Fyt2YC34QAZWWjkIdBW7bbEWO9Yl5s/ekhwMAhyPmQlYhE5Q+r/x126GaFgfCm4dyWSeY/gFArtONeTxJVGJx5WnrMKxa+dFBwrvut7MnRg+Xm7UedH8sOXt8o7KDvoBb2xLLV5j9TNTMbI4cs0yvVjlj+jxJskyERd54v3fhTO6HFKPRW4yVKn8s6xRIh5gsRAWJdwT96enan8VUPiGi2O2RiwIwwqZKROQ42yIl0DH20+Obwr9iKNaku0RDuK0nmZv3Cd17eUhe0KgwNxRv1RGqBES4+i8bvrwOjs9Vr8DvdyTXTplz6X4/wXKv8YcFGbfeeDZhqs86Pt3Vd47leuhkzzEnqlsPpMSBXQwmXq+sMuXmeouI6woc2aFfxdjdzhbGjsiSw6XxBTMzbLjf/DaC8SKb9vQNKmN8c7JJymq1Xo90r0DoKeTR1/Y6EE+TJ8EhtSjIG2V+qhw5jyRnhSIKxW6oaItEnL1LaPGDO/I2fBvZWDKqkbzOj37WZCbIWvQ016A/t8H4RaSwxGcummvwaUOb4oTkZ3hkcaDf9gJ/qYtNppE5ZrFkcE4wXRGk5P+1Pb6MwtjHw= 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(83380400001)(36860700001)(316002)(2906002)(426003)(336012)(186003)(40460700003)(81166007)(2616005)(86362001)(47076005)(36756003)(82310400005)(356005)(33964004)(26005)(5660300002)(70586007)(70206006)(8936002)(4326008)(235185007)(44832011)(8676002)(6916009)(54906003)(508600001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6089 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b44329e6-f5e7-42b0-5856-08da28fb15b3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cvy+HsV8x+bFJkv9JZ3WnWJdrtLJHZdSFxnNfx3ePSDzvkkqXy6re9JDL7InH1K4WHGqOLY6feGdf6/tPkLMPbeWJrqNmUCDY+PloXbl4TECNvgFp1triWAOfe1GweYtvOquXyfNlgMK5GRSnYfSAPR40I9sgSiydTbFbxtpMth1nCZmvw+BqMhrwAyf9Kn7xQUzARAVnzLyLRofGtmkLo1bwc8iFPJJn4G1vmpGocAq+erDWMTPgvzLOy6NDRKvq2UBWCaekp2YbB/JOpvKbD5Sngx+xy8ehUFhPHch8sDgQEuFeQoZ+nxQfPTJED7Rc+uBLypPipCAKoICgCDrm3eK/gYVVDxsFBEr/8bT8jKQAIleBfddxYs6dLn70jdtOdejjeLyELwzwJDq0JR+yFi0C2Moq77YIm1W2lBYqNqfK9rtk9urPTB5738Ixc5qtQ4SXXcbwYTcjW1Mi2tgb/d2dyRuUYOIewm8A1xxtn3USRreK3mJdZUDe8hWYxp8VGvovULi3qGHr5W9zdSoYyAry/rfvcTZLYjCbVGPau2jsMR0CHGiZiMf1nupQsPOTFONvJE6AM1Sf/B6bjBL+A/XH4+MvVYwIsoTsD9sxnhMsFs3xBt9kX29DwBk0yz+FWLoG5ssgiV/YGxBXzhOYoHUm9zCJ0ai4M3TdugJzjOlEMj5ucWDj67JKeIvKJwH+SdGerzT+Ur7Vni2GOvN0yi06G/84Z/XQHIBOuYa5nDb7xZS4esbAet9W3kD7CQy5R1uFzzJ3N4n5AF9mXBiPw== 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:(13230001)(4636009)(36840700001)(40470700004)(46966006)(83380400001)(36860700001)(316002)(186003)(336012)(40460700003)(2906002)(81166007)(2616005)(426003)(86362001)(47076005)(36756003)(82310400005)(26005)(33964004)(70586007)(70206006)(8936002)(4326008)(235185007)(44832011)(8676002)(6916009)(54906003)(508600001)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2022 09:40:18.1028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8fb5175-1831-4caf-042e-08da28fb1b06 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: AM5EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5362 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Andrea Corallo via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Andrea Corallo <andrea.corallo@arm.com> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>, nd <nd@arm.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
arm: Enables return address verification and branch target identification on Cortex-M
|
|
Commit Message
Andrea Corallo
April 28, 2022, 9:40 a.m. UTC
Add targeting-checking entities for PACBTI in testsuite framework. Pre-approved with the requested changes here <https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586331.html>. gcc/testsuite/ChangeLog: * testsuite/lib/target-supports.exp: (check_effective_target_arm_pacbti_hw): New. * doc/sourcebuild.texi: Document arm_pacbti_hw. Co-Authored-By: Tejas Belagod <tbelagod@arm.com>
Comments
On 28/04/2022 10:40, Andrea Corallo via Gcc-patches wrote: > Add targeting-checking entities for PACBTI in testsuite > framework. > > Pre-approved with the requested changes here > <https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586331.html>. > > gcc/testsuite/ChangeLog: > > * testsuite/lib/target-supports.exp: > (check_effective_target_arm_pacbti_hw): New. > * doc/sourcebuild.texi: Document arm_pacbti_hw. > > Co-Authored-By: Tejas Belagod <tbelagod@arm.com> > +proc check_effective_target_arm_pacbti_hw {} { + return [check_runtime arm_pacbti_hw_available { + __attribute__ ((naked)) int + main (void) + { + asm ("pac r12, lr, sp"); So the armv8-m Arm ARM says that this instruction is in the NOP space and that it is undefined if we aren't armv8-m.main or higher. + asm ("mov r0, #0"); + asm ("autg r12, lr, sp"); This isn't in the nop space, but the Arm ARM says it is unpredictable if the extension isn't present. Unfortunately, that means this isn't a particularly reliable way of detecting that the PACBTI feature is present. However, I can't think off hand of more reliable way of testing this since reading the feature register ID_ISAR5 is not possible when in unprivileged mode. So I think we'll have to live with this. + asm ("bx lr"); + } + } ""] OK. R.
On 01/07/2022 14:03, Richard Earnshaw via Gcc-patches wrote: > > > On 28/04/2022 10:40, Andrea Corallo via Gcc-patches wrote: >> Add targeting-checking entities for PACBTI in testsuite >> framework. >> >> Pre-approved with the requested changes here >> <https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586331.html>. >> >> gcc/testsuite/ChangeLog: >> >> * testsuite/lib/target-supports.exp: >> (check_effective_target_arm_pacbti_hw): New. >> * doc/sourcebuild.texi: Document arm_pacbti_hw. >> >> Co-Authored-By: Tejas Belagod <tbelagod@arm.com> >> > +proc check_effective_target_arm_pacbti_hw {} { > + return [check_runtime arm_pacbti_hw_available { > + __attribute__ ((naked)) int > + main (void) > + { > + asm ("pac r12, lr, sp"); > > So the armv8-m Arm ARM says that this instruction is in the NOP space > and that it is undefined if we aren't armv8-m.main or higher. > > + asm ("mov r0, #0"); > + asm ("autg r12, lr, sp"); > > This isn't in the nop space, but the Arm ARM says it is unpredictable if > the extension isn't present. Unfortunately, that means this isn't a > particularly reliable way of detecting that the PACBTI feature is present. > > However, I can't think off hand of more reliable way of testing this > since reading the feature register ID_ISAR5 is not possible when in > unprivileged mode. > > So I think we'll have to live with this. > > + asm ("bx lr"); > + } > + } ""] > > OK. > Or perhaps not. The test does not try to add the right options to enable PAC/BTI if those aren't in the default selection for the current testsuite run. Perhaps we also need some additional tests to work out what architecture options to add (if any) to ensure the test will at least assemble. > R. R.
Richard Earnshaw <Richard.Earnshaw@foss.arm.com> writes: > On 01/07/2022 14:03, Richard Earnshaw via Gcc-patches wrote: >> On 28/04/2022 10:40, Andrea Corallo via Gcc-patches wrote: >>> Add targeting-checking entities for PACBTI in testsuite >>> framework. >>> >>> Pre-approved with the requested changes here >>> <https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586331.html>. >>> >>> gcc/testsuite/ChangeLog: >>> >>> * testsuite/lib/target-supports.exp: >>> (check_effective_target_arm_pacbti_hw): New. >>> * doc/sourcebuild.texi: Document arm_pacbti_hw. >>> >>> Co-Authored-By: Tejas Belagod <tbelagod@arm.com> >>> >> +proc check_effective_target_arm_pacbti_hw {} { >> + return [check_runtime arm_pacbti_hw_available { >> + __attribute__ ((naked)) int >> + main (void) >> + { >> + asm ("pac r12, lr, sp"); >> So the armv8-m Arm ARM says that this instruction is in the NOP >> space and that it is undefined if we aren't armv8-m.main or higher. >> + asm ("mov r0, #0"); >> + asm ("autg r12, lr, sp"); >> This isn't in the nop space, but the Arm ARM says it is >> unpredictable if the extension isn't present. Unfortunately, that >> means this isn't a particularly reliable way of detecting that the >> PACBTI feature is present. >> However, I can't think off hand of more reliable way of testing this >> since reading the feature register ID_ISAR5 is not possible when in >> unprivileged mode. >> So I think we'll have to live with this. >> + asm ("bx lr"); >> + } >> + } ""] >> OK. >> > > Or perhaps not. The test does not try to add the right options to > enable PAC/BTI if those aren't in the default selection for the > current testsuite run. > > Perhaps we also need some additional tests to work out what > architecture options to add (if any) to ensure the test will at least > assemble. Hi Richard, thanks for reviewing. Wouldn't be sufficient for that to have this test compiled with -march=armv8-m.main? BR Andrea
On 04/07/2022 15:47, Andrea Corallo wrote: > Richard Earnshaw <Richard.Earnshaw@foss.arm.com> writes: > >> On 01/07/2022 14:03, Richard Earnshaw via Gcc-patches wrote: >>> On 28/04/2022 10:40, Andrea Corallo via Gcc-patches wrote: >>>> Add targeting-checking entities for PACBTI in testsuite >>>> framework. >>>> >>>> Pre-approved with the requested changes here >>>> <https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586331.html > <https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586331.html>>. >>>> >>>> gcc/testsuite/ChangeLog: >>>> >>>> * testsuite/lib/target-supports.exp: >>>> (check_effective_target_arm_pacbti_hw): New. >>>> * doc/sourcebuild.texi: Document arm_pacbti_hw. >>>> >>>> Co-Authored-By: Tejas Belagod <tbelagod@arm.com> >>>> >>> +proc check_effective_target_arm_pacbti_hw {} { >>> + return [check_runtime arm_pacbti_hw_available { >>> + __attribute__ ((naked)) int >>> + main (void) >>> + { >>> + asm ("pac r12, lr, sp"); >>> So the armv8-m Arm ARM says that this instruction is in the NOP >>> space and that it is undefined if we aren't armv8-m.main or higher. >>> + asm ("mov r0, #0"); >>> + asm ("autg r12, lr, sp"); >>> This isn't in the nop space, but the Arm ARM says it is >>> unpredictable if the extension isn't present. Unfortunately, that >>> means this isn't a particularly reliable way of detecting that the >>> PACBTI feature is present. >>> However, I can't think off hand of more reliable way of testing this >>> since reading the feature register ID_ISAR5 is not possible when in >>> unprivileged mode. >>> So I think we'll have to live with this. >>> + asm ("bx lr"); >>> + } >>> + } ""] >>> OK. >>> >> >> Or perhaps not. The test does not try to add the right options to >> enable PAC/BTI if those aren't in the default selection for the >> current testsuite run. >> >> Perhaps we also need some additional tests to work out what >> architecture options to add (if any) to ensure the test will at least >> assemble. > > Hi Richard, > thanks for reviewing. > > Wouldn't be sufficient for that to have this test compiled with > -march=armv8-m.main? Take a look at how, for example, check_effective_target_arm_mve_hw (and add_options_for_v8_1_m_mve_fp) is implemented. R. > > BR > > Andrea
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 613ac29967b..e8cbd8e4aef 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2167,6 +2167,10 @@ ARM target supports options to generate instructions from ARMv8.1-M with the Custom Datapath Extension (CDE) and M-Profile Vector Extension (MVE). Some multilibs may be incompatible with these options. +@item arm_pacbti_hw +Test system supports executing Pointer Authentication and Branch Target +Identification instructions. + @item arm_prefer_ldrd_strd ARM target prefers @code{LDRD} and @code{STRD} instructions over @code{LDM} and @code{STM} instructions. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index ff8edbd3e17..df8ab037fb3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5090,6 +5090,22 @@ proc check_effective_target_arm_cmse_clear_ok {} { } "-mcmse"]; } +# Return 1 if the target supports executing PACBTI instructions, 0 +# otherwise. + +proc check_effective_target_arm_pacbti_hw {} { + return [check_runtime arm_pacbti_hw_available { + __attribute__ ((naked)) int + main (void) + { + asm ("pac r12, lr, sp"); + asm ("mov r0, #0"); + asm ("autg r12, lr, sp"); + asm ("bx lr"); + } + } ""] +} + # Return 1 if this compilation turns on string_ops_prefer_neon on. proc check_effective_target_arm_tune_string_ops_prefer_neon { } {