aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2022-12-16 22:02:07 -0800
committerIndu Bhagat <indu.bhagat@oracle.com>2022-12-16 22:02:07 -0800
commit5bec250b5a9257133f70098dced98dfe59c77401 (patch)
treebb8771b17bfde8ff639ad1453b15345f0ce627c0 /gas/testsuite
parent49948bce0e9e310ea1506e84755a1cf9fdba8840 (diff)
downloadgdb-5bec250b5a9257133f70098dced98dfe59c77401.zip
gdb-5bec250b5a9257133f70098dced98dfe59c77401.tar.gz
gdb-5bec250b5a9257133f70098dced98dfe59c77401.tar.bz2
gas: sframe: testsuite: add testcase for .cfi_negate_ra_state
Add a new test to check that .cfi_negate_ra_state on aarch64 is handled well (a non-empty SFrame section with valid SFrame FREs is generated). ChangeLog: * testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d: New test. * testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s: Likewise. * testsuite/gas/cfi-sframe/cfi-sframe.exp: Adjust the list accordingly.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d20
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s18
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe.exp1
3 files changed, 39 insertions, 0 deletions
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d
new file mode 100644
index 0000000..985f51f
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d
@@ -0,0 +1,20 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame cfi_negate_ra_state test
+#...
+Contents of the SFrame section .sframe:
+
+ Header :
+
+ Version: SFRAME_VERSION_1
+ Flags: NONE
+ Num FDEs: 1
+ Num FREs: 2
+
+ Function Index :
+ func idx \[0\]: pc = 0x0, size = 8 bytes
+ STARTPC + CFA + FP + RA +
+#...
+ 0+0004 +sp\+16 +u +u\[s\] +
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s
new file mode 100644
index 0000000..8106c93
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s
@@ -0,0 +1,18 @@
+## ARMv8.3 addded support a new security feature named Pointer Authentication. The
+## main idea behind this is to use the unused bits in the pointer values.
+## Each pointer is patched with a PAC before writing to memory, and is verified
+## before using it.
+## When the pointers are mangled, the unwinder needs to know so it can mask off
+## the PAC from the pointer value to recover the return address, and
+## conversely, skip doing so if the pointers are not mangled.
+##
+## .cfi_negate_ra_state CFI directive is used to convey this information.
+##
+## SFrame has support for this. This testcase ensures that the directive
+## is interpreted successfully.
+ .cfi_startproc
+ .long 0
+ .cfi_def_cfa_offset 16
+ .cfi_negate_ra_state
+ .long 0
+ .cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
index 8129e86..f001fad 100644
--- a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
@@ -96,4 +96,5 @@ if { [istarget "x86_64-*-*"] && [gas_sframe_check] } then {
# aarch64 specific tests
if { [istarget "aarch64*-*-*"] && [gas_sframe_check] } then {
run_dump_test "cfi-sframe-aarch64-1"
+ run_dump_test "cfi-sframe-aarch64-2"
}