aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@arm.com>2022-06-30 15:23:56 +0100
committerLuis Machado <luis.machado@arm.com>2022-07-11 16:27:41 +0100
commitf58d9432cdf8a279ed584efdb9791f44bb4dcd9e (patch)
tree8ad5a5d114a3beca6cca3bfb6c5c6a891b72baa6 /gdb
parent4cbe4ca5da5cd7e1e6331ce11f024bf3c07b9744 (diff)
downloadgdb-f58d9432cdf8a279ed584efdb9791f44bb4dcd9e.zip
gdb-f58d9432cdf8a279ed584efdb9791f44bb4dcd9e.tar.gz
gdb-f58d9432cdf8a279ed584efdb9791f44bb4dcd9e.tar.bz2
Try a couple PAuth compilation flags for gdb.arch/aarch64-pauth.exp
The -msign-return-address switch has been dropped from GCC, but some older compiler may still support it. Make sure we try both -msign-return-address and -mbranch-protection before bailing out when running gdb.arch/aarch64-pauth.exp.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-pauth.exp19
1 files changed, 17 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.arch/aarch64-pauth.exp b/gdb/testsuite/gdb.arch/aarch64-pauth.exp
index 76ffd22..901eb82 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pauth.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-pauth.exp
@@ -25,9 +25,24 @@ if {![is_aarch64_target]} {
# Build program with address signing forced on.
standard_testfile
set compile_flags {debug}
-lappend compile_flags "additional_flags=-msign-return-address=all"
lappend compile_flags "additional_flags=-fno-inline"
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${compile_flags}] } {
+
+# Records whether the compilation was successful or not.
+set compilation_ok 0
+
+# We need to try a couple compilation flags here because -msign-return-address
+# was dropped at some point, but could still be supported.
+foreach pauth_flag "-mbranch-protection=pac-ret+leaf -msign-return-address=all" {
+ set flags $compile_flags
+ lappend flags "additional_flags=$pauth_flag"
+
+ if {!$compilation_ok && ![prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${flags}] } {
+ set compilation_ok 1
+ }
+}
+
+# If we couldn't compile, just bail out.
+if {!$compilation_ok} {
return -1
}