From patchwork Thu Apr 28 09:42:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Corallo X-Patchwork-Id: 53298 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 421F03857C4A for ; Thu, 28 Apr 2022 09:43:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 421F03857C4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1651139014; bh=ITFQK0jzjZwueJjg3jf32ZWa0Q9GcqklJaKw/TILKqY=; 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=hnH39Wn6rGXOu5/2nlz4+k5qGGmyZzQw2RDmSu00lS5nUgSKMp1DXRSn9VpBXauXW dyMXdeAjONWYnPlI15/2gIy+cBVF6oI4tWLvRIZSwIIVl+MuYwlyvcQx2jNFsegnLn FzwunHL4StEju4m3BjlQ6PE5oWlnbzQ2Ho6feu+4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2082.outbound.protection.outlook.com [40.107.104.82]) by sourceware.org (Postfix) with ESMTPS id 798D53858C2C for ; Thu, 28 Apr 2022 09:43:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 798D53858C2C ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=dYfCcGhfeMFyIhppJbV8p0lBUAraIF6fxhbuKMTlql40RA82lOnqgI7/7R/28FsNvJpynRgeu+bZbS2PwZ6viPVyNWvDPR6NQF0/dQbMwYeN1mIsTfB2mDChT/ggHxH3brh9kaZuGMPqBxKLRdfE/S7Ttren34AOf6qwKfcy8yJ2JVm/9+z9FKRs1wnC0sPDBHaXr3z54wzRPNFXXdhdGi85HrpTpmPngh9/XNAEmzs+iyb1jYsH17bgRu1DI8TYCD/QUejcxrpc/km/mLiFh+i29viNKV6VmHJhguQ8MZrVviGMG/Ox3IhAFOzIopaQOrBGpg3rjSjaaL4lmmLbzQ== 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=ITFQK0jzjZwueJjg3jf32ZWa0Q9GcqklJaKw/TILKqY=; b=i0epMNB2AZWkjVaBxVpmUEW6m1ftDYWQ8eiEtIqrsWoR+xJiJFcsLePCnxy+A4vyA/Y39cKHFEXF/u82jJOAz7agvfvNeIBYbAfAyPFererHQob87zX+pyom5PcxDsHEyUWYjj717PMJvxp5W7EZXj/REgpdhgaQWIbtVDxhoi/7SRX1YLxTsL0bPuk1Y+jxmSYdZgPYDMZP9Kggsp1FvELcJZhHUmU4frDeZutFYmEkVQowMiYPU97j4q/BnphcO2sErzQge4u6cQyS6fndCCoDfehWL9iJTWYa94jKNwbRvXauwmvDaR8o1fPCTd7uprV2OEusXsVHy82Wz0lsbg== 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 DB8P191CA0004.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:130::14) by AM5PR0802MB2529.eurprd08.prod.outlook.com (2603:10a6:203:9e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.12; Thu, 28 Apr 2022 09:42:59 +0000 Received: from DB5EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:130:cafe::dd) by DB8P191CA0004.outlook.office365.com (2603:10a6:10:130::14) 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:42:59 +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 DB5EUR03FT041.mail.protection.outlook.com (10.152.21.4) 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:42:59 +0000 Received: ("Tessian outbound 62985e3c34b6:v118"); Thu, 28 Apr 2022 09:42:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fd1ae64fcc927bce X-CR-MTA-TID: 64aa7808 Received: from 7e14fc99a440.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 304824F6-B702-4E75-833E-211A57FCD0DB.1; Thu, 28 Apr 2022 09:42:52 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7e14fc99a440.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Apr 2022 09:42:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4nQ6gIpMjPi9aA4+tx0WdRntrY3zD6MOdaVRdQUdb3Fwkl7r3ojzkg99GTfGfWErs9JGpg3U0UH7JtETAc5D04pvVyV0hZ2sCH9O33OIKJP/MYLuyE7VMU6J46Gc5bh/lAkNxKuxe029oB+BcBiwFPqxEb54lCBanx/Vk4EKjLtYB29facbdaphvywQvwkcdwpjHOr0pEtylCGE0ms630jtV0yOjJcAPIKYHy224x2Qp8U+RChm+ATx+MiRLn7QeXnxhhNmL6/yCYMrYmMiONatsL9zk2DDlnhPyzUklbqwYVzGTj+74LXyfPSu2fBKsvSuYQHim9gVg8LHlzpnQA== 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=ITFQK0jzjZwueJjg3jf32ZWa0Q9GcqklJaKw/TILKqY=; b=bd2Gy4Azzpqzr6BX0a2o39X+fy/vP2Z3XKOV432Ho5G6RP0U1dfUmqQ4ecLcHP/Ggf7Iy1INbjbOsSf/UhfX2FixUKg28aC1+JdyxJYHgykTKie9+pFmYnn08UEvjYMUndfPmszxS1DSUf3gdvBkCpJvWggrA/bJGgDe22S0iJUXu0+YzRzMEj1WNCSNjhBitvt2dFzd4KMcMN0DtUz5d6vXy4nHimAXrlw8YSZj2zpzcqPL+eiuRkG4kToHr/deidvISRarzY0N2sbgaJEoa7XEPlb0j+ksYEgR8DN8lWRyXkK1DBMBeOlB62QEW8oCTkA2pG/868H+PreLpPNu7A== 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 AS9PR0301CA0024.eurprd03.prod.outlook.com (2603:10a6:20b:468::31) by PAXPR08MB7394.eurprd08.prod.outlook.com (2603:10a6:102:2bc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Thu, 28 Apr 2022 09:42:51 +0000 Received: from AM5EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:468:cafe::eb) by AS9PR0301CA0024.outlook.office365.com (2603:10a6:20b:468::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.14 via Frontend Transport; Thu, 28 Apr 2022 09:42:51 +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 AM5EUR03FT038.mail.protection.outlook.com (10.152.17.118) 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:42:50 +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:42:51 +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:42:50 +0000 To: Andrea Corallo via Gcc-patches Subject: [PATCH 5/12] arm: Implement target feature macros for PACBTI References: Date: Thu, 28 Apr 2022 11:42:48 +0200 In-Reply-To: (Andrea Corallo via Gcc-patches's message of "Thu, 28 Apr 2022 10:39:31 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 3dd60340-03c7-4576-e4e6-08da28fb7afd X-MS-TrafficTypeDiagnostic: PAXPR08MB7394:EE_|DB5EUR03FT041:EE_|AM5PR0802MB2529:EE_ X-Microsoft-Antispam-PRVS: 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: 6oMTkUQOp+4qiGZKco28B236xuXoK5ZsYpmAmhFLbJ2g4xtqHWMBnPEW7XBH2qhVnZW4d0rY6Si7ik5+duKZMlPrPzIB+ub1La5sdoz0a0xznU6JaQUx3+3bW0S0R0IRLQsYvgFb/uh0eBwJJE6aMWQI7xuj3EBWrDDa1gnUpSLYYspxafpuEwiSNQ58KPMz0V0yXTUz70peFHxXkmUMTeRPAtrSedXe8sO3myt6NQccly151sW5Lq8pAtwexVdHw87YzaaOWuG29Ovwz6YJ53XpBnhLQT2wClw3+EvV9edoMCkj83nUhjQ0CZvZ0Or0ORkNNExAXbZ1Mx95StZl+MGQjostSEEk1rHWyG8eB8vDNKQLTAIC+eXmP3C0c4J2u7Ma6p4a6ti2yu+VSEAWkhZXye2l/LfN2MuVA1jIzeNRYNtn6blrADogAfYp3qhPgfWISTypWBMt12ojNH2w6apnGBXl0Y05GT4uxcMVwOOhdPEC9R4ziJCEOlvH7TzyyQIKuVOAyRQ9Uj1Hu0hNOV+hiuWAXgkfQqD9bCP+IRpxeVbMKcomwWhPKmqlSI8yogP6kzWa4Qpr7uAu/RIyQ2qZrq5bwZz3RkONT9HNI6g6s+piYIeL6RfZEJ/J23jQap01j+0GkQ6E81KrM4N+qZxtxGaLu2zb1nWEYMBqaOK5DUskYN1GqHdK2oF/FAVyWpO1kcOVougpYum+T0UAG2oVxiQmI/LSY+6rgyNJyBCXOMjPLc/5Ul16/J5/wEw1OnNnIJsy2y6x5MyqXqAEOUA/oTmMfWLr2Q0GNCGeHvtA/5vZ9S9y3swKU9ZM2+KCRXSg4Ue50X4oM65HZI7Jo/ycG3CGKopClVvJ7lshfzh5yBkAkBJ1vcxAMf8PpJTb 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)(36840700001)(46966006)(40470700004)(8936002)(44832011)(508600001)(84970400001)(5660300002)(2616005)(336012)(426003)(36860700001)(83380400001)(356005)(47076005)(26005)(86362001)(40460700003)(186003)(235185007)(8676002)(2906002)(33964004)(70586007)(70206006)(54906003)(6916009)(81166007)(316002)(4326008)(82310400005)(36756003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7394 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 30ba71db-25b5-4ae0-33b0-08da28fb7617 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jlPOrFeRkRdRBwhd4IqohEPzFS67xheV2XI7oQrg8kLGDd0hwDt/HKczsOgVxlU43oohMjQypgRpHDmcJAunUFK0uuC5GE7bDhkfO9cAccczN9eR8xK4tUSOTdWMOEx6C6AJLs1S1VTfqJHFdbtR7cyY6QCmTXbn0b6cil4zfbOyHaVNQOQZZ7h9fh7iFGuWqOUueahchGAoYUF8jLFZbnan9XALyXabdEJvjzoGT030U65KEmaeOj3YWHYiI2q8ZJXPsFF2FW2fJRnmIv8kmxB06QWR7hC7PbN+NfGMQUvTClTvpz7h+WvbsrzSqo0qt23+nx3piWKxabdhMA9iFYg1qCc03mr2kKA3rCMohD/lDK/rtIjUfOEqOghZkSfhShjwjLq/U8N3uY8u8VUVg0t4SkIFmEU+QzY3yJl5LeUQtGDrcm03FnFpXXNB7byMrVGaK3Lh9ai1uyaEzEFJETEA6U7b7jqrPGhUyEAX28PVfN9dExhN7rd+5eHH2pdqVLnYw4GJE/d/9Kk37Bj5x9tL74Ol9XdXPmHcLoxfnMfDiM5hXmvgjnUfRChbW1A+iMMxne+G3YpONPw2BFRKdzhvfOU59b+3HqfWyWwxVXfXQ3Jf2ni+YE4CoSA4vbannXLTtSpcrU8/aWUXwHfAk+eeRNPjEZAXyoG+R1v7KUQRXbkttqdK4Pc4IFXnCmYx78Di9wTouydAuE83G8oRpZsEc+PlzkLjU4HUvXsvs5ByxfofO9h+DR8gH9FTJwu0tiXTuemeL8fK630WTFuIlic1VoFL5WSNp//YyRVbrfE= 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)(40470700004)(46966006)(36840700001)(5660300002)(235185007)(4326008)(84970400001)(8676002)(316002)(508600001)(81166007)(8936002)(82310400005)(36860700001)(6916009)(2906002)(70586007)(47076005)(44832011)(26005)(2616005)(70206006)(186003)(54906003)(426003)(36756003)(336012)(40460700003)(33964004)(83380400001)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2022 09:42:59.1708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dd60340-03c7-4576-e4e6-08da28fb7afd 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: DB5EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2529 X-Spam-Status: No, score=-2.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_NONE, SPF_PASS, TXREP, UNPARSEABLE_RELAY, UNWANTED_LANGUAGE_BODY 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-Patchwork-Original-From: Andrea Corallo via Gcc-patches From: Andrea Corallo Reply-To: Andrea Corallo Cc: Richard Earnshaw , nd Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch implements target feature macros when PACBTI is enabled through the -march option or -mbranch-protection. The target feature macros __ARM_FEATURE_PAC_DEFAULT and __ARM_FEATURE_BTI_DEFAULT are specified in ARM ACLE __ARM_FEATURE_PAUTH and __ARM_FEATURE_BTI are specified in the pull-request . Approved here . gcc/ChangeLog: * config/arm/arm-c.c (arm_cpu_builtins): Define __ARM_FEATURE_BTI_DEFAULT, __ARM_FEATURE_PAC_DEFAULT, __ARM_FEATURE_PAUTH and __ARM_FEATURE_BTI. 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. Co-Authored-By: Tejas Belagod diff --git a/gcc/config/arm/arm-c.cc b/gcc/config/arm/arm-c.cc index a8697b8c62f..190099b2c37 100644 --- a/gcc/config/arm/arm-c.cc +++ b/gcc/config/arm/arm-c.cc @@ -212,6 +212,24 @@ arm_cpu_builtins (struct cpp_reader* pfile) def_or_undef_macro (pfile, "__ARM_FEATURE_COMPLEX", TARGET_COMPLEX); def_or_undef_macro (pfile, "__ARM_32BIT_STATE", TARGET_32BIT); + def_or_undef_macro (pfile, "__ARM_FEATURE_PAUTH", TARGET_HAVE_PACBTI); + def_or_undef_macro (pfile, "__ARM_FEATURE_BTI", TARGET_HAVE_PACBTI); + def_or_undef_macro (pfile, "__ARM_FEATURE_BTI_DEFAULT", + aarch_enable_bti == 1); + + cpp_undef (pfile, "__ARM_FEATURE_PAC_DEFAULT"); + if (aarch_ra_sign_scope != AARCH_FUNCTION_NONE) + { + unsigned int pac = 1; + + gcc_assert (aarch_ra_sign_key == AARCH_KEY_A); + + if (aarch_ra_sign_scope == AARCH_FUNCTION_ALL) + pac |= 0x4; + + builtin_define_with_int_value ("__ARM_FEATURE_PAC_DEFAULT", pac); + } + cpp_undef (pfile, "__ARM_FEATURE_MVE"); if (TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT) { 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 new file mode 100644 index 00000000000..4394fd147d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-2.c @@ -0,0 +1,24 @@ + +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-additional-options " -mbranch-protection=bti+pac-ret+leaf" } */ + +#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 + +int +main() +{ + if (__ARM_FEATURE_BTI_DEFAULT != 1) + __builtin_abort (); + + if (__ARM_FEATURE_PAC_DEFAULT != 5) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-4.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-4.c new file mode 100644 index 00000000000..90f0c724b9e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-4.c @@ -0,0 +1,21 @@ + +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-additional-options " -mbranch-protection=pac-ret" } */ + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +int +main() +{ + if (__ARM_FEATURE_PAC_DEFAULT != 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-5.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-5.c new file mode 100644 index 00000000000..c865809b8b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-5.c @@ -0,0 +1,24 @@ + +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-additional-options " -mbranch-protection=bti+pac-ret" } */ + +#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 + +int +main() +{ + if (__ARM_FEATURE_BTI_DEFAULT != 1) + __builtin_abort (); + + if (__ARM_FEATURE_PAC_DEFAULT != 1) + __builtin_abort (); + + return 0; +}