aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMatthieu Longo <matthieu.longo@arm.com>2024-11-14 16:15:14 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2024-11-14 16:15:14 +0000
commit6cc6f75374f7fd4fdded00c88239248593b7607a (patch)
tree7f39f164653bc25ad081817106fbba9d2d52430b /gcc
parente36249f8228d9b861550e81b117025462d876a0b (diff)
downloadgcc-6cc6f75374f7fd4fdded00c88239248593b7607a.zip
gcc-6cc6f75374f7fd4fdded00c88239248593b7607a.tar.gz
gcc-6cc6f75374f7fd4fdded00c88239248593b7607a.tar.bz2
aarch64: Fix tests incompatible with GCS
gcc/testsuite/ChangeLog: * g++.target/aarch64/return_address_sign_ab_exception.C: Update. * gcc.target/aarch64/eh_return.c: Update.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C19
-rw-r--r--gcc/testsuite/gcc.target/aarch64/eh_return.c13
2 files changed, 26 insertions, 6 deletions
diff --git a/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C b/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C
index ead11de..6c79ebf 100644
--- a/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C
+++ b/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C
@@ -1,16 +1,28 @@
/* { dg-do run } */
/* { dg-options "--save-temps" } */
/* { dg-require-effective-target arm_v8_3a_bkey_directive } */
+/* { dg-final { check-function-bodies "**" "" } } */
+/*
+** _Z5foo_av:
+** hint 25 // paciasp
+** ...
+*/
__attribute__((target("branch-protection=pac-ret+leaf")))
int foo_a () {
throw 22;
}
+/*
+** _Z5foo_bv:
+** hint 27 // pacibsp
+** ...
+*/
__attribute__((target("branch-protection=pac-ret+leaf+b-key")))
int foo_b () {
throw 22;
}
+/* { dg-final { scan-assembler-times ".cfi_b_key_frame" 1 } } */
int main (int argc, char** argv) {
try {
@@ -23,9 +35,4 @@ int main (int argc, char** argv) {
}
}
return 1;
-}
-
-/* { dg-final { scan-assembler-times "paciasp" 1 } } */
-/* { dg-final { scan-assembler-times "pacibsp" 1 } } */
-/* { dg-final { scan-assembler-times ".cfi_b_key_frame" 1 } } */
-
+} \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return.c b/gcc/testsuite/gcc.target/aarch64/eh_return.c
index 3217948..51b20f7 100644
--- a/gcc/testsuite/gcc.target/aarch64/eh_return.c
+++ b/gcc/testsuite/gcc.target/aarch64/eh_return.c
@@ -1,6 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O2 -fno-inline" } */
+/* With BTI enabled, this test would crash with SIGILL, Illegal instruction.
+ The 2nd argument of __builtin_eh_return is expected to be an EH handler
+ within a function, rather than a separate function.
+ The current implementation of __builtin_eh_return in AArch64 backend emits a
+ jump instead of branching with LR.
+ The prologue of the handler (i.e. continuation) starts with "bti c" (vs.
+ "bti jc") which is a landing pad type prohibiting jumps, hence the exception
+ at runtime.
+ The current behavior of __builtin_eh_return is considered correct.
+ Consequently, the default option -mbranch-protection=standard needs to be
+ overridden to remove BTI. */
+/* { dg-additional-options "-mbranch-protection=pac-ret+leaf+gcs" { target { default_branch_protection } } } */
+
#include <stdlib.h>
#include <stdio.h>