From patchwork Thu Apr 28 09:45:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Corallo X-Patchwork-Id: 53300 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 D62ED385735D for ; Thu, 28 Apr 2022 09:45:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D62ED385735D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1651139149; bh=XBS5Ujt7a48UlddQKedRFdjJlfuKLApPZwSp4vOzvlI=; 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=G3nWNR5ehSC8hRwfeuuGbdPXKiU0740Au+hFerkoWzJo/d56byyyB62qcozKbBzhG i5dtDatg4DiVjJkMgAta+STW29L1KJPDSIaUkLOlczFKZapcEBvXpCvJGyov1Nw4iA E73bXM5qoxAZWIIKTvOiG7JuC83FBrlxu4ZxW8RA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130075.outbound.protection.outlook.com [40.107.13.75]) by sourceware.org (Postfix) with ESMTPS id 711A13857346 for ; Thu, 28 Apr 2022 09:45:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 711A13857346 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ZWDzjVb6VOry8TFeqek6yVAdzMICowPsb9cLVDXLAll+rGFRbPFal7EWJS31NYsR2eEQFReoBIgVN1g+nUWmPvSf3hz4La04AW2xnVapEgra1DJjA5nqvrKeGbdw7jAjf4qY5dCdlb8d2MCAZA6F/mvIWTpBvVBWJfL5C1E9wx7j2Q4Vnz/gXKpBbL7yM2hk5ibqc+JMq+cGmrkzJAcszX3Xgi2luvMymdBY6eeHpjckTf42uAjWhXeFcNwn/kKsyAyojoR6i7T59J7Z6RSUVeHsI1gTjENC29JaW0jrjGlQDPEK2LI207+Bc1LUPZmmAu8BiwWdBAlSVEabogi/9A== 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=XBS5Ujt7a48UlddQKedRFdjJlfuKLApPZwSp4vOzvlI=; b=YTnkvQYHT2eVwYHEVB+uoHQbVJVvQNbqFGH8LhIlobjM01TyNXoiUIRf6zPjrRA384k00bN1j6O0iJw808F+lCoKNH0gTansW6fWJjG5DiXZzuYyh/4BdQiNh8bYH5seqmzfSD2MN9iKzYuIdN9WvI+ZKSRx+Fzd/0X2QamQXBfamp/NUh14cpEAl3dMSxzAMQ9tnPrY5M/IsOu1YWKFQZbsbUQ4V7IaNlHsN8blDHIDqRSFth8r23Z1XhReE3oAM/L+1ic1FaE1HKJMDVsl8/hqqHlPaoEAPS7a5WS8arV63/77I1o1FwbyWeGbVOXUv1p1+jzvk+mJVf9mZJOfKQ== 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 DB6P195CA0013.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::23) by VE1PR08MB5646.eurprd08.prod.outlook.com (2603:10a6:800:1a9::19) 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:45:14 +0000 Received: from DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:cb:cafe::c1) by DB6P195CA0013.outlook.office365.com (2603:10a6:4:cb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14 via Frontend Transport; Thu, 28 Apr 2022 09:45:14 +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 DB5EUR03FT031.mail.protection.outlook.com (10.152.20.142) 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:45:14 +0000 Received: ("Tessian outbound 9511859e950a:v118"); Thu, 28 Apr 2022 09:45:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e63b180b96718178 X-CR-MTA-TID: 64aa7808 Received: from 7594ff84fe8d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 58551580-AE63-4879-B937-7D01C15A7E7C.1; Thu, 28 Apr 2022 09:45:07 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7594ff84fe8d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Apr 2022 09:45:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jwqY2WEtF0IHe8SSeg0IWO5N4JhsQNnpwVsBJdg9NzgRmdgK4oVnK3SOQOZZc1l6ZblrjJBDZvokOByoxB+LoccBaLJrGmrGshcjUu1ikqr4PEcDlkUYNZY+X4depmzMfzsCLEhfGMfcvh13+ZP5YjU4CXTmKVzssdeBvbY7J5vg9HHBcOhMvS9qYBaNHUe9QJuFrUD7T3O7xc7Kw9YzQL8ul6+EGLW+eZTEy1ALTSHspFlFH4EV2EAY3lK2dRDZPFPsKKFbh4nvg/p0mueAx3SSZS5Rr45TyQPNzTU8G1cbou1U1/FJVRxFT9IVdxo/IKdGfqfW7xdU2ykbk1Zlqg== 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=XBS5Ujt7a48UlddQKedRFdjJlfuKLApPZwSp4vOzvlI=; b=h7To6zyAQu3gDT+1IOCyk/CLGg9UOOZXIIkUjD4CARLHXC/vAMuCJ9Id4PtImR49//L4oJVsWdZEwLJ7j7E7O6GxoNFDb9RklWTEcIVnu54b6X9K9qoCN6HQ9xH3soeYw+dya5cDLxjDR9h0HSIfqYM27LxVqTz8Y0Z7uE7v1NT+KeIaayha2P0eVl4ptJsjD+wdWw6EGTurDkkqBIk498HwgqkfkJ/z1pZcYXy8uDxj7Aq/LMKjr66wRBpPJTYy3lgAnR8z9RP653Xfp9WuM0qJix0ZklktNuxraPkM006QfbqDsg/gc6028Os04FpCFvrPwQuluqu4xo80tiGCWw== 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 AM6PR04CA0046.eurprd04.prod.outlook.com (2603:10a6:20b:f0::23) by DB9PR08MB6395.eurprd08.prod.outlook.com (2603:10a6:10:254::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.14; Thu, 28 Apr 2022 09:45:05 +0000 Received: from AM5EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:f0:cafe::e7) by AM6PR04CA0046.outlook.office365.com (2603:10a6:20b:f0::23) 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:45:05 +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 AM5EUR03FT045.mail.protection.outlook.com (10.152.17.105) 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:45:05 +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.2308.27; Thu, 28 Apr 2022 09:45:06 +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.2308.27; Thu, 28 Apr 2022 09:45:03 +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:45:05 +0000 To: Andrea Corallo via Gcc-patches Subject: [PATCH 7/12] arm: Emit build attributes for PACBTI target feature References: Date: Thu, 28 Apr 2022 11:45:02 +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: f9d8a684-be79-4938-fd6f-08da28fbcba8 X-MS-TrafficTypeDiagnostic: DB9PR08MB6395:EE_|DB5EUR03FT031:EE_|VE1PR08MB5646: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: bWSrXitHwa2KkyqGP7lKIBRROFn0ak74LwJLY7Faf9Cgxj2eNDjbhNOfeKhoaqFTgQLmKe4ICMkMk3jDt09JawjkGllnuOqbYEz/DGldMqWN6SXksRxdQEmIjun7nnUvbS4f9vSEWUKtZ+uTQPdyF/9A6qZ4YAWXpCLdpb5u2EZo1dobFeOPPzZ7tp5AbAT7yuy7kcy7bKeFR8Z8vwXc0TdT9rr9u5OjzgyZGubumm2dJhC7FO6k5JzplAnFuoF2sUr314rNgAeYhsz5VtRiTR0bREApnsGnfYvCea6UmdiDzqlsdnJligCvYh3KO37KyjKMMDfYr3jUytkNW7Dz5SSFKm7WogNkrOCUWZKXYmGDhPTlV12VflO4OqxhgCGLLeQKUlQNZnBK9kdaovzI9q8n80Skp+vcV1499oUrW52z1HyOB/nsBR03LZcr40+JToDYQn7shVHzXAINTwnUYjVjHoy2uAkz8ZE4aWCYZFXqUx/Pmwr6q3/vnlchtkCWPa4yPSOpSxj0kvkDMFXDA9aeg4CO6F0cnQXwkx3E8tH3PnZAfQDeBHRxZlA27hQ04a3zHI4PggJHIo0rOHEDI1VTcpVIUnGRffh3XGjgnfcU8SyFMHPlETPprFKBpye1jvphOOxkeC91XOG21BEHeiBLDNjRLOAuiZXeGHvpmGVGn7BBmOR3GrBXRGGBz5w8oatAPXoKvCTvkdmb6lAZ2ZlKegbu0HJe6Ah+Oz6urfMl9vzh8OvrkTipk9Gphu4Q7LPPGiZ5XAyezgThfoWkCAPqtZX13QO1qBiyrYpMQRa0sl865hRrh5JRdDhbGIjBcLw2IJR2H5Sn2Dmn4zZfEw== 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)(40470700004)(46966006)(36840700001)(83380400001)(33964004)(86362001)(81166007)(36860700001)(70206006)(70586007)(2616005)(186003)(47076005)(336012)(4326008)(426003)(8676002)(36756003)(5660300002)(316002)(508600001)(2906002)(40460700003)(8936002)(84970400001)(235185007)(82310400005)(54906003)(6916009)(26005)(44832011)(356005)(6666004)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6395 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6d7fbdfd-3bfe-4983-b1d7-08da28fbc63c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uNh9S6stEuT037dr+YKMrCYZLvwxtRXT4SQEfmb8pK8ngnILU2hkNrx/rhQOyRIhMqheyBReCU3gGefcgj/vjn4m0PGkFbJz0SKfbTEVQv2PMnee/anS0aRb0zVAmpTOkl9pvuwscjFVc+og02bSnLv6yiwGITzEFw+yYhWOCFDL8Ci+049n9PNhuzRrzPW+nD2BePGdwt4A5p6fUPko1FQrx8qNvHiF9gBq0KTKRjrw3CtFKdAVlLG7quIG/wR3VwgDUx35ZUt6bW8g4zfhfuplr6ogUMG1QhP4l8fm2MNG+JmNPalTumGDCPBw2wCMbz8Z/ojMiuiTjaM91Y2ClDwoIQN/WMN9xX2/UMjMpDeutV6016obGt5V1rsA4tvCToSZzVl2JwEo13x6OxANMVBgdrUvTldHMG5LjZRgOK/iKgr1DWWuuQmzGC7MIpoXybn0lKL8OwksIjdluhA1j2+jn//6vfnqfLrK2d6sWh8OBeiJ3FMoGN8Mo1b9r4STt8AOM4MAcsVs+8yiDmtc0xyXVOYCS+LSbBxCTcWLuNDu1KlE2Z/4QDfr/5W7Uk1ZKwqfFtpbNFnh8KaWZS13RLPeeqcAS7ck9m9gBIBLPCLK+nAP4byNJ7R8ykSYifk6UVpfyVVjhWicyGKjL98hiYI4VVxtSefTEAgP0qlFSy/WWRUzEsrAf/7Q9tNOIIZlL+R/boGGx5iEv8PQP441SwfUd/ZGlvRtPmplo30OAZgn2wGbrLyKTm3CBnWUt+cppai30xozrpwRlthGuvglwzJLOsZ2wCsTlS/eq1uP4js= 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)(46966006)(40470700004)(316002)(186003)(47076005)(44832011)(36860700001)(6666004)(508600001)(235185007)(426003)(36756003)(8936002)(86362001)(54906003)(6916009)(336012)(40460700003)(2616005)(82310400005)(84970400001)(83380400001)(81166007)(5660300002)(70586007)(2906002)(70206006)(4326008)(33964004)(8676002)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2022 09:45:14.4942 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9d8a684-be79-4938-fd6f-08da28fbcba8 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: DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5646 X-Spam-Status: No, score=-12.8 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 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 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..75d3e00ef64 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options " -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..bf6c3ba90c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options " -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..82af11ee407 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-additional-options " -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" } } */