]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: sframe: testsuite: add testcase for .cfi_register RA
authorIndu Bhagat <indu.bhagat@oracle.com>
Fri, 14 Nov 2025 07:01:36 +0000 (23:01 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Tue, 9 Dec 2025 08:26:10 +0000 (00:26 -0800)
PS: Adding a testcase is not strictly necessary now.  Once the SFrame V3
patches are in, this testcase will need to be reverted.  SFrame V3
allows a new FDE type where .cfi_register RA may be represented.

gas/testsuite/
        * gas/cfi-sframe/cfi-sframe.exp: New test.
        * gas/cfi-sframe/cfi-sframe-x86_64-empty-5.d: New test.
        * gas/cfi-sframe/cfi-sframe-x86_64-empty-5.s: New test.

---
[Changes in V2]
  - Add a clear note in commit log that this patch is eventually
    reverted after SFrame V3 make it in.
  - I am inclining towards not putting this in.
[End of changes in V2]

gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-5.d [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-5.s [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe.exp

diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-5.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-5.d
new file mode 100644 (file)
index 0000000..ce1fd38
--- /dev/null
@@ -0,0 +1,17 @@
+#as: --gsframe
+#warning: RA register 16 in \.cfi\_register
+#objdump: --sframe=.sframe
+#name: DW_CFA_register with RA register
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_2
+    Flags: SFRAME_F_FDE_FUNC_START_PCREL
+#?    CFA fixed FP offset: \-?\d+
+#?    CFA fixed RA offset: \-?\d+
+    Num FDEs: 0
+    Num FREs: 0
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-5.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-5.s
new file mode 100644 (file)
index 0000000..9a7bc31
--- /dev/null
@@ -0,0 +1,11 @@
+# Testcase to ensure .cfi_register for RA is not treated as safe to skip.
+# Even for ABIs which do not track RA, an explicit manouver of RA like so
+# cannot be represented.  The expectation is that such a pattern is caught and
+# SFrame FDE is skipped. Such a sequence may be used in longjump implementation
+# on x86_64, for instance.
+       .cfi_startproc
+       .long 0
+       .cfi_def_cfa_offset 16
+       .cfi_register 16, 9
+       .long 0
+       .cfi_endproc
index 96d34bfc17a7288f60f681b7a96c8c2352fbd71f..b60e4f8d68f3ed249d7b6c241bc45b6171feac42 100644 (file)
@@ -66,6 +66,7 @@ if { [istarget "x86_64-*-*"] && [gas_sframe_check] } then {
        run_dump_test "cfi-sframe-x86_64-empty-2"
        run_dump_test "cfi-sframe-x86_64-empty-3"
        run_dump_test "cfi-sframe-x86_64-empty-4"
+       run_dump_test "cfi-sframe-x86_64-empty-5"
        run_dump_test "cfi-sframe-x86_64-empty-pr33277"
        run_dump_test "cfi-sframe-x86_64-ra-undefined-1"
        set ASFLAGS "$old_ASFLAGS"