[PATCH 2/2] gas: sframe: Add test for signal frame with unsupported CFI

Jens Remus <[email protected]> Wed, 29 Jul 2026 18:34:45 +0200
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
Usually if the generation of SFrame from CFI directives encounters
unsupported CFI the generation of SFrame FDE is skipped.  For signal
frames (.cfi_signal_frame) an "empty" FDE without any FREs is generated
instead.

gas/testsuite/
	* gas/cfi-sframe/cfi-sframe.exp (cfi-sframe-common-14): Run
	new common test.
	* gas/cfi-sframe/cfi-sframe-common-14.d: New common test for
	signal frame with unsupported CFI.
	gas/cfi-sframe/cfi-sframe-common-14.s: Likewise.

Signed-off-by: Jens Remus <[email protected]>
---

Notes (jremus):
    Note that this test triggers a segfault unless sframe_xlate_ctx_cleanup
    clears all struct sframe_xlate_ctx fields.  Nick has a fix for that.

 .../gas/cfi-sframe/cfi-sframe-common-14.d     | 20 +++++++++++++++++++
 .../gas/cfi-sframe/cfi-sframe-common-14.s     |  8 ++++++++
 gas/testsuite/gas/cfi-sframe/cfi-sframe.exp   |  1 +
 3 files changed, 29 insertions(+)
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.s

diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.d
new file mode 100644
index 000000000000..673dc684c099
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.d
@@ -0,0 +1,20 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: Signal Frame with unsupported CFI
+#warning: \.cfi_def_cfa_offset with unsupported offset value
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_3
+    Flags: SFRAME_F_FDE_FUNC_START_PCREL
+#?    CFA fixed FP offset: \-?\d+
+#?    CFA fixed RA offset: \-?\d+
+    Num FDEs: 1
+    Num FREs: 0
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 8 bytes, attr = \"S\"
+    STARTPC + CFA + FP + RA +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.s
new file mode 100644
index 000000000000..2c9b28ba8315
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-14.s
@@ -0,0 +1,8 @@
+	.cfi_startproc
+	.cfi_signal_frame
+	.cfi_def_cfa_register 1
+	.long 0
+	.cfi_def_cfa_register 2
+	.long 0
+	.cfi_def_cfa_offset 1099511627808
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
index ba6cbc13f72a..d7418726f274 100644
--- a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
@@ -50,6 +50,7 @@ if  { ([istarget "x86_64-*-*"] || [istarget "aarch64*-*-*"]
     run_dump_test "cfi-sframe-common-11"
     run_dump_test "cfi-sframe-common-12"
     run_dump_test "cfi-sframe-common-13"
+    run_dump_test "cfi-sframe-common-14"
 
     run_dump_test "common-empty-2"
     run_dump_test "common-empty-3"
-- 
2.53.0