https://gcc.gnu.org/g:2c160a731e7764e97a2b8014149aaee47a11fbba
commit 2c160a731e7764e97a2b8014149aaee47a11fbba Author: Szabolcs Nagy <szabolcs.n...@arm.com> Date: Fri Jun 30 16:31:23 2023 +0100 aarch64: Add branch-protection target pragma tests gcc/testsuite/ChangeLog: * gcc.target/aarch64/pragma_cpp_predefs_4.c: Add branch-protection tests. Diff: --- .../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