aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2023-12-10 22:08:03 -0800
committerIndu Bhagat <indu.bhagat@oracle.com>2024-01-02 17:16:01 -0800
commitedfce8dbb7dce2e8adb16b67fe75f49a58152aec (patch)
tree112e707356a9dac6ec7b22ba76d6aaa29bc1e073
parentb51bd471bfbf670cff43cc55c16e0a147a430aec (diff)
gas: testsuite: add an aarch64 testsuite for SCFIusers/ibhagat/try-scfi-v4
Similar to the x86_64 testcases, all .s files contain the corresponding CFI directives. This has been done to aid maintainence only: CFI annotations in .s files help convey the expected EH Frame / SFrame data in a format-oblivious way. All the tests are executed with --scfi command line option. Hence, the CFI annotations in the test .s files are skipped altogether by the GAS for processing. gas/testsuite/: * gas/scfi/aarch64/scfi-aarch64.exp: New file. * gas/scfi/aarch64/scfi-ldrp-1.d: New test. * gas/scfi/aarch64/scfi-ldrp-1.l: New test. * gas/scfi/aarch64/scfi-ldrp-1.s: New test. * gas/scfi/aarch64/scfi-ldrp-2.d: New test. * gas/scfi/aarch64/scfi-ldrp-2.l: New test. * gas/scfi/aarch64/scfi-ldrp-2.s: New test. * gas/scfi/aarch64/scfi-stp-1.d: New test. * gas/scfi/aarch64/scfi-stp-1.l: New test. * gas/scfi/aarch64/scfi-stp-1.s: New test. * gas/scfi/aarch64/scfi-strp-2.d: New test. * gas/scfi/aarch64/scfi-strp-2.l: New test. * gas/scfi/aarch64/scfi-strp-2.s: New test.
-rw-r--r--gas/testsuite/gas/scfi/README2
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp43
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d21
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l2
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s14
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d21
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l2
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s14
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d61
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l2
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s52
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d34
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l2
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s27
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d39
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l2
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s38
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d36
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l2
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s31
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.d6
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.l3
-rw-r--r--gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.s17
23 files changed, 470 insertions, 1 deletions
diff --git a/gas/testsuite/gas/scfi/README b/gas/testsuite/gas/scfi/README
index 75dcebb602d..09db94af0a2 100644
--- a/gas/testsuite/gas/scfi/README
+++ b/gas/testsuite/gas/scfi/README
@@ -1,6 +1,6 @@
Notes on the SCFI testsuite in GAS:
-* At this time, SCFI machinery is only supported for x86_64.
+* At this time, SCFI machinery is only supported for x86_64 and aarch64.
* When adding more tests, please keep CFI annotations updated in the .s files.
Recall that user-specified, synthesizable CFI annotations are ignored by the
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp b/gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp
new file mode 100644
index 00000000000..63a529edc64
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp
@@ -0,0 +1,43 @@
+# Copyright (C) 2022-2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+if { ![is_elf_format] } then {
+ return
+}
+
+# common tests
+if { ([istarget "aarch64-*-*"]) } then {
+
+ global ASFLAGS
+ set old_ASFLAGS "$ASFLAGS"
+
+ run_dump_test "scfi-ldrp-1"
+ run_list_test "scfi-ldrp-1" "--scfi --warn"
+ run_dump_test "scfi-ldrp-2"
+ run_list_test "scfi-ldrp-2" "--scfi --warn"
+
+ run_dump_test "scfi-strp-1"
+ run_list_test "scfi-strp-1" "--scfi --warn"
+ run_dump_test "scfi-strp-2"
+ run_list_test "scfi-strp-2" "--scfi --warn"
+
+ run_dump_test "scfi-cb-1"
+ run_list_test "scfi-cb-1" "--scfi --warn"
+ run_dump_test "scfi-cond-br-1"
+ run_list_test "scfi-cond-br-1" "--scfi --warn"
+ run_dump_test "scfi-uncond-br-1"
+ run_list_test "scfi-uncond-br-1" "--scfi --warn"
+}
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d
new file mode 100644
index 00000000000..52bb60b63ee
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d
@@ -0,0 +1,21 @@
+#as: --scfi -W
+#objdump: -Wf
+#name: Synthesize CFI for comp branch 1
+#...
+Contents of the .eh_frame section:
+
+
+0+0000 0+0010 0+0000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -8
+ Return address column: 30
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r31 \(sp\) ofs 0
+
+0+0014 0+0010 00000018 FDE cie=00000000 pc=0+0000..0+0010
+ DW_CFA_nop
+#...
+
+#pass
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l
new file mode 100644
index 00000000000..518dc148f21
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*5: Warning: --scfi=all ignores most user-specified CFI directives
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s
new file mode 100644
index 00000000000..53d63bcf59a
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s
@@ -0,0 +1,14 @@
+ .text
+ .global foo
+ .type foo, %function
+foo:
+ .cfi_startproc
+.L7:
+ add w4, w3, w1
+ cbnz w4, .L7
+ cbz w4, .L10
+.L10:
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d
new file mode 100644
index 00000000000..684de4c9417
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d
@@ -0,0 +1,21 @@
+#as: --scfi -W
+#objdump: -Wf
+#name: Synthesize CFI for conditional br 1
+#...
+Contents of the .eh_frame section:
+
+
+0+0000 0+0010 0+0000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -8
+ Return address column: 30
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r31 \(sp\) ofs 0
+
+0+0014 0+0010 00000018 FDE cie=00000000 pc=0+0000..0+0010
+ DW_CFA_nop
+#...
+
+#pass
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l
new file mode 100644
index 00000000000..b170125896d
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*6: Warning: --scfi=all ignores most user-specified CFI directives
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s
new file mode 100644
index 00000000000..925c709a5a9
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s
@@ -0,0 +1,14 @@
+ .text
+ .align 2
+ .global foo
+ .type foo, %function
+foo:
+ .cfi_startproc
+ bge .L10
+ ble .L10
+ bne .L10
+.L10:
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d
new file mode 100644
index 00000000000..38a3170343b
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d
@@ -0,0 +1,61 @@
+#as: --scfi -W
+#objdump: -Wf
+#name: Synthesize CFI for ldp ldr instructions
+#...
+Contents of the .eh_frame section:
+
+00000000 0+0010 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -8
+ Return address column: 30
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r31 \(sp\) ofs 0
+
+00000014 0+0048 00000018 FDE cie=00000000 pc=0+0000..0+0040
+ DW_CFA_advance_loc: 4 to 0+0004
+ DW_CFA_def_cfa_offset: 128
+ DW_CFA_offset: r29 \(x29\) at cfa-128
+ DW_CFA_offset: r30 \(x30\) at cfa-120
+ DW_CFA_advance_loc: 4 to 0+0008
+ DW_CFA_def_cfa_register: r29 \(x29\)
+ DW_CFA_advance_loc: 4 to 0+000c
+ DW_CFA_offset: r19 \(x19\) at cfa-112
+ DW_CFA_offset: r20 \(x20\) at cfa-104
+ DW_CFA_advance_loc: 4 to 0+0010
+ DW_CFA_offset: r21 \(x21\) at cfa-96
+ DW_CFA_offset: r22 \(x22\) at cfa-88
+ DW_CFA_advance_loc: 4 to 0+0014
+ DW_CFA_offset: r23 \(x23\) at cfa-80
+ DW_CFA_offset: r24 \(x24\) at cfa-72
+ DW_CFA_advance_loc: 4 to 0+0018
+ DW_CFA_offset: r25 \(x25\) at cfa-64
+ DW_CFA_offset: r26 \(x26\) at cfa-56
+ DW_CFA_advance_loc: 4 to 0+001c
+ DW_CFA_offset: r27 \(x27\) at cfa-48
+ DW_CFA_advance_loc: 8 to 0+0024
+ DW_CFA_def_cfa_register: r31 \(sp\)
+ DW_CFA_advance_loc: 4 to 0+0028
+ DW_CFA_restore: r19 \(x19\)
+ DW_CFA_restore: r20 \(x20\)
+ DW_CFA_advance_loc: 4 to 0+002c
+ DW_CFA_restore: r21 \(x21\)
+ DW_CFA_restore: r22 \(x22\)
+ DW_CFA_advance_loc: 4 to 0+0030
+ DW_CFA_restore: r23 \(x23\)
+ DW_CFA_restore: r24 \(x24\)
+ DW_CFA_advance_loc: 4 to 0+0034
+ DW_CFA_restore: r25 \(x25\)
+ DW_CFA_restore: r26 \(x26\)
+ DW_CFA_advance_loc: 4 to 0+0038
+ DW_CFA_restore: r27 \(x27\)
+ DW_CFA_advance_loc: 4 to 0+003c
+ DW_CFA_restore: r29 \(x29\)
+ DW_CFA_restore: r30 \(x30\)
+ DW_CFA_def_cfa_offset: 0
+ DW_CFA_nop
+#...
+
+
+#pass
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l
new file mode 100644
index 00000000000..083c09902f5
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*7: Warning: --scfi=all ignores most user-specified CFI directives
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s
new file mode 100644
index 00000000000..4dc0c60b569
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s
@@ -0,0 +1,52 @@
+# Testcase for various ldp / ldr instructions
+ .text
+ .align 2
+ .global foo
+ .type foo, %function
+foo:
+ .cfi_startproc
+ stp x29, x30, [sp, -128]!
+ .cfi_def_cfa_offset 128
+ .cfi_offset 29, -128
+ .cfi_offset 30, -120
+ mov x29, sp
+ .cfi_def_cfa_register 29
+ stp x19, x20, [sp, 16]
+ .cfi_offset 19, -112
+ .cfi_offset 20, -104
+ stp x21, x22, [sp, 32]
+ .cfi_offset 21, -96
+ .cfi_offset 22, -88
+ stp x23, x24, [sp, 48]
+ .cfi_offset 23, -80
+ .cfi_offset 24, -72
+ stp x25, x26, [sp, 64]
+ .cfi_offset 25, -64
+ .cfi_offset 26, -56
+ str x27, [sp, 80]
+ .cfi_offset 27, -48
+ mov w0, 0
+ mov sp, x29
+ .cfi_def_cfa_register 31
+ ldp x19, x20, [sp, 16]
+ .cfi_restore 19
+ .cfi_restore 20
+ ldp x21, x22, [sp, 32]
+ .cfi_restore 21
+ .cfi_restore 22
+ ldp x23, x24, [sp, 48]
+ .cfi_restore 23
+ .cfi_restore 24
+ ldp x25, x26, [sp, 64]
+ .cfi_restore 25
+ .cfi_restore 26
+ ldr x27, [sp, 80]
+ .cfi_restore 27
+ ldp x29, x30, [sp], 128
+ .cfi_restore 29
+ .cfi_restore 30
+ .cfi_def_cfa_offset 0
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d
new file mode 100644
index 00000000000..523e441d6ec
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d
@@ -0,0 +1,34 @@
+#as: --scfi -W
+#objdump: -Wf
+#name: Synthesize CFI for ldr insns 2
+#...
+Contents of the .eh_frame section:
+
+00000000 0+0010 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -8
+ Return address column: 30
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r31 \(sp\) ofs 0
+
+00000014 0+0028 00000018 FDE cie=00000000 pc=0+0000..0+0018
+ DW_CFA_advance_loc: 4 to 0+0004
+ DW_CFA_def_cfa_offset: 128
+ DW_CFA_offset: r29 \(x29\) at cfa-128
+ DW_CFA_offset: r30 \(x30\) at cfa-120
+ DW_CFA_advance_loc: 4 to 0+0008
+ DW_CFA_def_cfa_register: r29 \(x29\)
+ DW_CFA_advance_loc: 4 to 0+000c
+ DW_CFA_def_cfa_register: r31 \(sp\)
+ DW_CFA_advance_loc: 4 to 0+0010
+ DW_CFA_restore: r29 \(x29\)
+ DW_CFA_def_cfa_offset: 120
+ DW_CFA_advance_loc: 4 to 0+0014
+ DW_CFA_restore: r30 \(x30\)
+ DW_CFA_def_cfa_offset: 0
+ DW_CFA_nop
+#...
+
+#pass
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l
new file mode 100644
index 00000000000..083c09902f5
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*7: Warning: --scfi=all ignores most user-specified CFI directives
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s
new file mode 100644
index 00000000000..8b6152a5bf8
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s
@@ -0,0 +1,27 @@
+# Testcase for various ldp / ldr instructions
+ .text
+ .align 2
+ .global foo
+ .type foo, %function
+foo:
+ .cfi_startproc
+ stp x29, x30, [sp, -128]!
+ .cfi_def_cfa_offset 128
+ .cfi_offset 29, -128
+ .cfi_offset 30, -120
+ mov x29, sp
+ .cfi_def_cfa_register 29
+ mov sp, x29
+ .cfi_def_cfa_register 31
+# Post-indexed ldr
+ ldr x29, [sp], 8
+ .cfi_restore 29
+ .cfi_def_cfa_offset 120
+# Post-indexed ldr
+ ldr x30, [sp], 120
+ .cfi_restore 30
+ .cfi_def_cfa_offset 0
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d
new file mode 100644
index 00000000000..0ad6047b467
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d
@@ -0,0 +1,39 @@
+#as: --scfi -W
+#objdump: -Wf
+#name: Synthesize CFI for pushq insns
+#...
+Contents of the .eh_frame section:
+
+00000000 0+0010 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -8
+ Return address column: 30
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r31 \(sp\) ofs 0
+
+00000014 0+0030 00000018 FDE cie=00000000 pc=0+0000..0+002c
+ DW_CFA_advance_loc: 4 to 0+0004
+ DW_CFA_def_cfa_offset: 128
+ DW_CFA_offset: r29 \(x29\) at cfa-128
+ DW_CFA_offset: r30 \(x30\) at cfa-120
+ DW_CFA_advance_loc: 4 to 0+0008
+ DW_CFA_def_cfa_register: r29 \(x29\)
+ DW_CFA_advance_loc: 4 to 0+000c
+ DW_CFA_offset: r19 \(x19\) at cfa-112
+ DW_CFA_offset: r20 \(x20\) at cfa-104
+ DW_CFA_advance_loc: 4 to 0+0010
+ DW_CFA_offset: r21 \(x21\) at cfa-96
+ DW_CFA_offset: r22 \(x22\) at cfa-88
+ DW_CFA_advance_loc: 4 to 0+0014
+ DW_CFA_offset: r23 \(x23\) at cfa-80
+ DW_CFA_offset: r24 \(x24\) at cfa-72
+ DW_CFA_advance_loc: 4 to 0+0018
+ DW_CFA_offset: r25 \(x25\) at cfa-64
+ DW_CFA_offset: r26 \(x26\) at cfa-56
+ DW_CFA_advance_loc: 4 to 0+001c
+ DW_CFA_offset: r27 \(x27\) at cfa-48
+ DW_CFA_nop
+
+#pass
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l
new file mode 100644
index 00000000000..b170125896d
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*6: Warning: --scfi=all ignores most user-specified CFI directives
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s
new file mode 100644
index 00000000000..c1c5410bd2e
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s
@@ -0,0 +1,38 @@
+## Testcase with a variety of str/stp instructions
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ .cfi_startproc
+# Pre-indexed addressing is like offset addressing, except that
+# the base pointer is updated as a result of the instruction.
+ stp x29, x30, [sp, -128]!
+ .cfi_def_cfa_offset 128
+ .cfi_offset 29, -128
+ .cfi_offset 30, -120
+ mov x29, sp
+ .cfi_def_cfa_register 29
+# Offset addressing mode is when ann offset can be applied optionally to the
+# base address.
+ stp x19, x20, [sp, 16]
+ .cfi_offset 19, -112
+ .cfi_offset 20, -104
+ stp x21, x22, [sp, 32]
+ .cfi_offset 21, -96
+ .cfi_offset 22, -88
+ stp x23, x24, [sp, 48]
+ .cfi_offset 23, -80
+ .cfi_offset 24, -72
+ stp x25, x26, [sp, 64]
+ .cfi_offset 25, -64
+ .cfi_offset 26, -56
+ str x27, [sp, 80]
+ .cfi_offset 27, -48
+# Stores non callee-saved register on stack.
+ str w0, [x29, 124]
+ str wzr, [x29, 120]
+ str w0, [x29, 120]
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d
new file mode 100644
index 00000000000..926a4439ac0
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d
@@ -0,0 +1,36 @@
+#as: --scfi -W
+#objdump: -Wf
+#name: Synthesize CFI for str insns 2
+#...
+Contents of the .eh_frame section:
+
+00000000 0+0010 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -8
+ Return address column: 30
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r31 \(sp\) ofs 0
+
+00000014 0+0028 00000018 FDE cie=00000000 pc=0+0000..0+001c
+ DW_CFA_advance_loc: 4 to 0+0004
+ DW_CFA_def_cfa_offset: 128
+ DW_CFA_offset: r29 \(x29\) at cfa-128
+ DW_CFA_offset: r30 \(x30\) at cfa-120
+ DW_CFA_advance_loc: 4 to 0+0008
+ DW_CFA_def_cfa_register: r29 \(x29\)
+ DW_CFA_advance_loc: 4 to 0+000c
+ DW_CFA_offset: r27 \(x27\) at cfa-128
+ DW_CFA_advance_loc: 4 to 0+0010
+ DW_CFA_def_cfa_register: r31 \(sp\)
+ DW_CFA_advance_loc: 4 to 0+0014
+ DW_CFA_restore: r29 \(x29\)
+ DW_CFA_def_cfa_offset: 120
+ DW_CFA_advance_loc: 4 to 0+0018
+ DW_CFA_restore: r30 \(x30\)
+ DW_CFA_def_cfa_offset: 0
+ DW_CFA_nop
+#...
+
+#pass
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l
new file mode 100644
index 00000000000..083c09902f5
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*7: Warning: --scfi=all ignores most user-specified CFI directives
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s
new file mode 100644
index 00000000000..f195ff949d7
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s
@@ -0,0 +1,31 @@
+# Testcase for a variety of stp/str including a post-indexed store
+ .text
+ .align 2
+ .global foo
+ .type foo, %function
+foo:
+ .cfi_startproc
+ stp x29, x30, [sp, -128]!
+ .cfi_def_cfa_offset 128
+ .cfi_offset 29, -128
+ .cfi_offset 30, -120
+ mov x29, sp
+ .cfi_def_cfa_register 29
+# post-indexed store, a stack corrupting one which over-writes
+# x29! Only for testing purposes for now
+# This does not generate a .cfi_def_cfa_offset 208 because
+# CFA is REG_FP based
+ str x27, [sp], 80
+ .cfi_offset 27, -128
+ mov sp, x29
+ .cfi_def_cfa_register 31
+ ldr x29, [sp], 8
+ .cfi_restore 29
+ .cfi_def_cfa_offset 120
+ ldr x30, [sp], 120
+ .cfi_restore 30
+ .cfi_def_cfa_offset 0
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.d
new file mode 100644
index 00000000000..e6745903b03
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.d
@@ -0,0 +1,6 @@
+#as: --scfi -W
+#objdump: -Wf
+#name: Synthesize CFI for unconditional br 1
+#...
+
+#pass
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.l
new file mode 100644
index 00000000000..c582fc96d71
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.l
@@ -0,0 +1,3 @@
+.*Assembler messages:
+.*7: Warning: --scfi=all ignores most user-specified CFI directives
+.*17: Warning: Untraceable control flow for func 'foo'; Skipping SCFI
diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.s
new file mode 100644
index 00000000000..80e216e8327
--- /dev/null
+++ b/gas/testsuite/gas/scfi/aarch64/scfi-uncond-br-1.s
@@ -0,0 +1,17 @@
+# Testcase for a variety of unconditional branches
+ .text
+ .align 2
+ .global foo
+ .type foo, %function
+foo:
+ .cfi_startproc
+ bl dump_bt
+ b .L3
+# Because of these indirect branches, SCFI will bail out
+ br x17
+.L3:
+ blr x3
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo