]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[SFrame-V3] gas: x86: testsuite: add new testcases for SFRAME_FDE_TYPE_FLEX
authorIndu Bhagat <indu.bhagat@oracle.com>
Fri, 16 Jan 2026 00:43:00 +0000 (16:43 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Fri, 16 Jan 2026 01:02:26 +0000 (17:02 -0800)
gas/testsuite/
* gas/cfi-sframe/cfi-sframe-x86_64-4.d: New test.
* gas/cfi-sframe/cfi-sframe-x86_64-4.s: Non SP/FP based CFA.
* gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.d: New test.
* gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.s: DRAP pattern
with both CFA expression and FP expression.
* gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.d: New test.
* gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.s: Test CFA
expression with sleb128.
* gas/cfi-sframe/cfi-sframe.exp: Add new tests.

gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-4.d [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-4.s [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.d [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.s [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.d [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.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-4.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-4.d
new file mode 100644 (file)
index 0000000..dfbca8b
--- /dev/null
@@ -0,0 +1,29 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: Non SP-FP based CFA in flex FDE type
+#...
+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: 8
+
+  Function Index :
+
+    func idx \[0\]: pc = 0x0, size = 199 bytes, attr = "F"
+    STARTPC +CFA +FP +RA +
+    0+0000 +sp\+8 +u +f +
+    0+0008 +sp\+40 +u +f +
+    0+0014 +r3\+40 +u +f +
+    0+0073 +sp\+40 +u +f +
+    0+007b +sp\-8 +u +f +
+    0+007e +r3\+40 +u +f +
+    0+00c2 +sp\+40 +u +f +
+    0+00c6 +sp\-8 +u +f +
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-4.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-4.s
new file mode 100644 (file)
index 0000000..f947874
--- /dev/null
@@ -0,0 +1,80 @@
+# Code from /usr/bin/qemu-hppa-static
+#
+# 00049214 0000000000000030 00000050 FDE cie=000491c8 pc=0000000000616870..0000000000616c5f
+#    LOC           CFA      rbx   ra
+# 0000000000616870 rsp+24   u     c-8
+# 0000000000616878 rsp+56   u     c-8
+# 000000000061687c rsp+56   c-56  c-8
+# 0000000000616884 rbx+56   c-56  c-8
+# 0000000000616b86 rsp+56   u     c-8
+# 0000000000616b8a rsp+8    u     c-8
+# 0000000000616b8d rbx+56   c-56  c-8
+# 0000000000616c5a rsp+56   u     c-8
+# 0000000000616c5e rsp+8    u     c-8
+       .p2align 4
+       .globl  foo
+       .type   foo, @function
+foo:
+       .cfi_startproc
+       endbr64
+       sub     $0x20,%rsp
+       .cfi_adjust_cfa_offset 0x20
+       mov     %rbx,(%rsp)
+       .cfi_offset 0x3, 56
+       mov     %rax,0x8(%rsp)
+       mov     %rsp,%rbx
+       .cfi_def_cfa_register rbx
+       .cfi_remember_state
+       and     $0xffffffffffffffe0,%rsp
+       sub     $0x380,%rsp
+       mov     %rsp,0x18(%rbx)
+       mov     %rdx,(%rsp)
+       mov     %r8,0x8(%rsp)
+       mov     %r9,0x10(%rsp)
+       mov     %rcx,0x18(%rsp)
+       mov     %rsi,0x20(%rsp)
+       mov     %rdi,0x28(%rsp)
+       mov     %rbp,0x30(%rsp)
+       lea     0x30(%rbx),%rax
+       mov     %rax,0x38(%rsp)
+       vmovdqa %xmm0,0x40(%rsp)
+
+       mov     0x10(%rbx),%rcx
+       test    %rcx,%rcx
+       jns     0x616b8d
+       mov     0x18(%rsp),%rcx
+       mov     0x20(%rsp),%rsi
+       mov     0x28(%rsp),%rdi
+       mov     %rbx,%rsp
+       .cfi_def_cfa_register rsp
+       mov     (%rsp),%rbx
+       add     $0x30,%rsp
+       .cfi_adjust_cfa_offset -0x30
+       jmp     *%r11
+       .cfi_restore_state
+       lea     0x38(%rbx),%rsi
+       add     $0x8,%rcx
+       and     $0xfffffffffffffff0,%rcx
+       sub     %rcx,%rsp
+       mov     %rsp,%rdi
+       rep movsb (%rsi),(%rdi)
+       mov     0x18(%rdi),%rcx
+       mov     0x20(%rdi),%rsi
+       mov     0x28(%rdi),%rdi
+       call   *%r11
+
+       inc     %si
+       jne     0x616c4b
+       vmovdqa 0x90(%rsp),%ymm1
+
+       fldt    0x40(%rsp)
+       fldt    0x30(%rsp)
+       mov     %rbx,%rsp
+       mov     (%rsp),%rbx
+       .cfi_def_cfa_register rsp
+       .cfi_restore rbx
+       add     $0x30,%rsp
+       .cfi_adjust_cfa_offset -0x30
+       ret
+       .cfi_endproc
+       .size   foo, .-foo
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.d
new file mode 100644 (file)
index 0000000..61b76aa
--- /dev/null
@@ -0,0 +1,26 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: DRAP pattern with r10-based CFA
+#...
+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: 6
+
+  Function Index :
+
+    func idx \[0\]: pc = 0x0, size = 95 bytes, attr = "F"
+    STARTPC +CFA +FP +RA +
+    0+0000 +sp\+8 +u +f +
+    0+0009 +r10\+0 +u +f +
+    0+0018 +r10\+0 +\(fp\+0\) +U +
+    0+001a +\(fp\-8\) +\(fp\+0\) +U +
+    0+0052 +r10\+0 +\(fp\+0\) +U +
+    0+005e +sp\+8 +\(fp\+0\) +U +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-1.s
new file mode 100644 (file)
index 0000000..0e7cbf6
--- /dev/null
@@ -0,0 +1,43 @@
+       .p2align 4
+       .globl  _ITM_RM256
+       .type   _ITM_RM256, @function
+_ITM_RM256:
+       .cfi_startproc
+       endbr64
+       leaq    8(%rsp), %r10
+       .cfi_def_cfa r10, 0
+       andq    $-32, %rsp
+       movq    %rdi, %rdx
+       pushq   -8(%r10)
+       pushq   %rbp
+       movq    %rsp, %rbp
+       # DW_CFA_expression, (uleb)reg, length, DW_OP_breg6, (sleb)offset
+       .cfi_escape 0x10,0x6,0x2,0x76,0
+       pushq   %r10
+       # DW_CFA_def_cfa_expression, length, DW_OP_breg6, (sleb)offset, DW_OP_deref
+       .cfi_escape 0xf,0x3,0x76,0x78,0x6
+       subq    $48, %rsp
+
+       movq    %fs:(80+1*8),%rdi
+       rorq    $17,%rdi
+       xorq    %fs:48,%rdi
+
+       movq    (%rdi), %rax
+       leaq    -48(%rbp), %rsi
+       pushq   $1
+       xorl    %r9d, %r9d
+       xorl    %r8d, %r8d
+       movl    $32, %ecx
+       call    *608(%rax)
+
+       movq    -8(%rbp), %r10
+       .cfi_def_cfa r10, 0
+       vmovaps -48(%rbp), %ymm0
+       popq    %rax
+       popq    %rdx
+       leave
+       leaq    -8(%r10), %rsp
+       .cfi_def_cfa rsp, 8
+       ret
+       .cfi_endproc
+       .size   _ITM_RM256, .-_ITM_RM256
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.d
new file mode 100644 (file)
index 0000000..1a5f628
--- /dev/null
@@ -0,0 +1,24 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: DRAP pattern with sleb128
+#...
+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: 4
+
+  Function Index :
+
+    func idx \[0\]: pc = 0x0, size = 15 bytes, attr = "F"
+    STARTPC +CFA +FP +RA +
+    0+0000 +sp\+8 +u +f +
+    0+0004 +sp\+40 +u +f +
+    0+0008 +\(fp-48\) +u +f +
+    0+000b +sp\+8 +u +f +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-esc-expr-2.s
new file mode 100644 (file)
index 0000000..180aa7f
--- /dev/null
@@ -0,0 +1,13 @@
+       .type   foo, @function
+foo:
+       .cfi_startproc
+       sub     $0x20,%rsp
+       .cfi_adjust_cfa_offset 0x20
+       .long 0
+       # DW_CFA_def_cfa_expression, length, DW_OP_breg6, (sleb)offset, DW_OP_deref
+       .cfi_escape 0xf,0x3,0x76,sleb128(-48),0x6
+       mov %rax, %rdi
+       .cfi_def_cfa rsp, 8
+       .long 0
+       .cfi_endproc
+       .size   foo, .-foo
index d42d2ecae1877b5e0d7438e680674ce3ee7bed21..04edb47ea1977b060c4a9be5c822dc2ec17b1d80 100644 (file)
@@ -61,6 +61,9 @@ if { [istarget "x86_64-*-*"] && [gas_sframe_check] } then {
        run_dump_test "cfi-sframe-x86_64-1"
        run_dump_test "cfi-sframe-x86_64-2"
        run_dump_test "cfi-sframe-x86_64-3"
+       run_dump_test "cfi-sframe-x86_64-4"
+       run_dump_test "cfi-sframe-x86_64-esc-expr-1"
+       run_dump_test "cfi-sframe-x86_64-esc-expr-2"
        run_dump_test "cfi-sframe-x86_64-pr33170"
        run_dump_test "cfi-sframe-x86_64-pr33756"
        run_dump_test "cfi-sframe-x86_64-signal-1"