[binutils-gdb] [SFrame-V3] ld: testsuite: x86: sframe: check link of signal frame and outermost frames

Indu Bhagat ibhagat@sourceware.org
Fri Jan 16 01:05:48 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c7c86abf8c22f8a98efb2103ac50f63833aef0e3

commit c7c86abf8c22f8a98efb2103ac50f63833aef0e3
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Thu Jan 15 16:43:41 2026 -0800

    [SFrame-V3] ld: testsuite: x86: sframe: check link of signal frame and outermost frames
    
    In this test, two "special" case FDEs are linked:
      - Signal frame where the SFrame stack trace data is not
        representable.
      - _start like outermost frame function.
    
    This is useful test for sframe_encoder's merge input sections
    functionality and its associated write code-paths (sframe_encoder_write)
    too.
    
    ld/testsuite/
            * ld-x86-64/sframe-link-1.d: New test.
            * ld-x86-64/sframe-signal.s: New input file.
            * ld-x86-64/sframe-start.s: Likewise.
            * ld-x86-64/x86-64.exp: Add new test.

Diff:
---
 ld/testsuite/ld-x86-64/sframe-link-1.d | 38 ++++++++++++++++++++++++++++++++++
 ld/testsuite/ld-x86-64/sframe-signal.s | 18 ++++++++++++++++
 ld/testsuite/ld-x86-64/sframe-start.s  | 15 ++++++++++++++
 ld/testsuite/ld-x86-64/x86-64.exp      |  1 +
 4 files changed, 72 insertions(+)

diff --git a/ld/testsuite/ld-x86-64/sframe-link-1.d b/ld/testsuite/ld-x86-64/sframe-link-1.d
new file mode 100644
index 00000000000..57881f875f8
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/sframe-link-1.d
@@ -0,0 +1,38 @@
+#as: --gsframe
+#source: sframe-start.s
+#source: sframe-signal.s
+#warning: \.cfi\_escape with op \(0xf\)
+#objdump: --sframe=.sframe
+#ld: -shared --no-rosegment -z separate-code
+#name: SFrame link special case FDEs - 1
+
+.*: +file format .*
+
+Contents of the SFrame section .sframe:
+  Header :
+
+    Version: SFRAME_VERSION_3
+    Flags: SFRAME_F_FDE_SORTED,
+           SFRAME_F_FDE_FUNC_START_PCREL
+    CFA fixed RA offset: \-8
+    Num FDEs: 4
+    Num FREs: 5
+
+  Function Index :
+
+    func idx \[0\]: pc = 0x1000, size = 16 bytes
+    STARTPC +CFA +FP +RA +
+    0+1000 +sp\+16 +u +f +
+    0+1006 +sp\+24 +u +f +
+
+    func idx \[1\]: pc = 0x1010, size = 16 bytes
+    STARTPC\[m\] +CFA +FP +RA +
+    0+0000 +sp\+8 +u +f +
+    0+000b +sp\+16 +u +f +
+
+    func idx \[2\]: pc = 0x1020, size = 8 bytes
+    STARTPC +CFA +FP +RA +
+    0+1020 +RA undefined
+
+    func idx \[3\]: pc = 0x1028, size = 2 bytes, attr = "S"
+    STARTPC +CFA +FP +RA +
diff --git a/ld/testsuite/ld-x86-64/sframe-signal.s b/ld/testsuite/ld-x86-64/sframe-signal.s
new file mode 100644
index 00000000000..554e072f006
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/sframe-signal.s
@@ -0,0 +1,18 @@
+# Input file with SFrame FDE for a signal trampoline
+# When linked with other "special" case FDEs like start frame,
+# this is a useful test for sframe_encoder's merge input sections
+# functionality and its associated write code-paths (sframe_encoder_write)
+	.text
+	.globl	rest_rt
+	.type	rest_rt, @function
+rest_rt:
+	.cfi_startproc
+	.cfi_signal_frame
+	# DW_CFA_def_cfa_expression, length, DW_OP_breg9, (sleb)offset, DW_OP_deref
+	.cfi_escape 0xf,0x3,0x79,0x78,0x6
+	nop
+	.cfi_offset rbp, -16
+	ret
+	.cfi_endproc
+	.size	rest_rt, .-rest_rt
+	.section	.note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/sframe-start.s b/ld/testsuite/ld-x86-64/sframe-start.s
new file mode 100644
index 00000000000..cf4348126a6
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/sframe-start.s
@@ -0,0 +1,15 @@
+# Input file mimicking the start of frame FDE
+# When linked with other "special" case FDEs like signal frame,
+# this is a useful test for sframe_encoder's merge input sections
+# functionality and its associated write code-paths (sframe_encoder_write)
+	.text
+	.globl	_start
+	.type	_start, @function
+_start:
+	.cfi_startproc
+	.cfi_undefined rip
+	xor	%rbp, %rbp
+	call	foo
+	.cfi_endproc
+	.size	_start, .-_start
+	.section	.note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index df2bb5ea1bd..aa5c90f8ca2 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -587,6 +587,7 @@ run_dump_test "tls-le-pic-3-x32"
 
 if { ![skip_sframe_tests] } {
     run_dump_test "sframe-simple-1"
+    run_dump_test "sframe-link-1"
     run_dump_test "sframe-command-line-1"
     run_dump_test "sframe-reloc-1"
     run_dump_test "sframe-plt-1"


More information about the Binutils-cvs mailing list