From patchwork Fri Nov 8 14:47:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Khrustalev X-Patchwork-Id: 2008493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XlMKB2pgzz1xy0 for ; Sat, 9 Nov 2024 01:49:18 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 876C7385841F for ; Fri, 8 Nov 2024 14:49:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 1682D3858405; Fri, 8 Nov 2024 14:48:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1682D3858405 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1682D3858405 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731077330; cv=none; b=HQC0AOkNpOIcyRV8DKqX1TZFERKy26u0l1QzI0iwNhUViM6byLqVwyZ67ZPW5GPmiJ3gLDBoBfGjDQRtNRPDYZs2Oa+n6cppOYDgz+BNuAzvVvVv0xhNyuQownQHNxZcwXZLo1l5cNfnMlT0hJusFVN/5p/LEntRK2MrphQckVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731077330; c=relaxed/simple; bh=Pu6dRTAbY4mzSa9qXnjO5CszA+dRCmV+a6a37/oHEHU=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=UU63TcS0EglKv9DK2VxOl6AATMCDgeX3ln8PA7Qdck6XW8Xd7aoqSl1hWM7T/niDXGtYyYjR2TymsyLWSYnqWFapE6ycx7aXizlmEWPTeKgKnNOqOl3bZJnP0JoRyFzQ9EcthBiKTPbD8PWmR5I69yrjYvgNOVPQviddRhVlSEA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B0420339; Fri, 8 Nov 2024 06:49:08 -0800 (PST) Received: from udebian.localdomain (unknown [10.57.26.225]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 707313F528; Fri, 8 Nov 2024 06:48:36 -0800 (PST) From: Yury Khrustalev To: gcc-patches@gcc.gnu.org Cc: nsz@gcc.gnu.org, richard.earnshaw@arm.com, matthieu.longo@arm.com, richard.ball@arm.com, richard.sandiford@arm.com, ktkachov@nvidia.com, john.brawn@arm.com Subject: [PATCH v3 02/23] aarch64: Add branch-protection target pragma tests Date: Fri, 8 Nov 2024 14:47:55 +0000 Message-Id: <20241108144816.2681175-3-yury.khrustalev@arm.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241108144816.2681175-1-yury.khrustalev@arm.com> References: <20241108144816.2681175-1-yury.khrustalev@arm.com> MIME-Version: 1.0 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Szabolcs Nagy gcc/testsuite/ChangeLog: * gcc.target/aarch64/pragma_cpp_predefs_4.c: Add branch-protection tests. --- .../gcc.target/aarch64/pragma_cpp_predefs_4.c | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c index 23ebe5e4f50..8e707630774 100644 --- a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c +++ b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c @@ -83,3 +83,53 @@ #ifndef __ARM_FEATURE_SME_F64F64 #error Foo #endif + +#pragma GCC target "branch-protection=standard" +#ifndef __ARM_FEATURE_BTI_DEFAULT +#error Foo +#endif +#if __ARM_FEATURE_PAC_DEFAULT != 1 +#error Foo +#endif + +#pragma GCC target ("branch-protection=none") +#ifdef __ARM_FEATURE_BTI_DEFAULT +#error Foo +#endif +#ifdef __ARM_FEATURE_PAC_DEFAULT +#error Foo +#endif + +#pragma GCC push_options +#pragma GCC target "branch-protection=bti+pac-ret" +#ifndef __ARM_FEATURE_BTI_DEFAULT +#error Foo +#endif +#pragma GCC pop_options +#ifdef __ARM_FEATURE_BTI_DEFAULT +#error Foo +#endif + +#pragma GCC target "branch-protection=bti" +#ifndef __ARM_FEATURE_BTI_DEFAULT +#error Foo +#endif +#ifdef __ARM_FEATURE_PAC_DEFAULT +#error Foo +#endif + +#pragma GCC target "branch-protection=pac-ret" +#ifdef __ARM_FEATURE_BTI_DEFAULT +#error Foo +#endif +#if __ARM_FEATURE_PAC_DEFAULT != 1 +#error Foo +#endif + +#pragma GCC target "branch-protection=pac-ret+leaf+b-key" +#ifdef __ARM_FEATURE_BTI_DEFAULT +#error Foo +#endif +#if __ARM_FEATURE_PAC_DEFAULT != 6 +#error Foo +#endif