]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[SFrame-V3] gas: x86: testsuite: add new testcases for SFRAME_FDE_TYPE_FLEX_TOPMOST_FRAME
authorIndu Bhagat <indu.bhagat@oracle.com>
Wed, 19 Nov 2025 17:28:02 +0000 (09:28 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Tue, 9 Dec 2025 08:26:14 +0000 (00:26 -0800)
gas/testsuite/
* gas/cfi-sframe/cfi-sframe-x86_64-4.d: New test.
* gas/cfi-sframe/cfi-sframe-x86_64-4.s: DRAP pattern.
* gas/cfi-sframe/cfi-sframe-x86_64-5.d: New test.
* gas/cfi-sframe/cfi-sframe-x86_64-5.s: Non SP/FP based CFA.
* 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-5.d [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-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-4.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-4.d
new file mode 100644 (file)
index 0000000..7b6f29e
--- /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
+    STARTPC +CFA +FP +RA +
+    0+0000 +sp\+8 +u +f +
+    0+0009 +r10\+0 +u +f +
+    0+0018 +r10\+0 +\(fp\+0\) +f +
+    0+001a +\(fp\-8\) +\(fp\+0\) +f +
+    0+0052 +r10\+0 +\(fp\+0\) +f +
+    0+005e +sp\+8 +\(fp\+0\) +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..56eb053
--- /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 10, 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 10, 0
+       vmovaps -48(%rbp), %ymm0
+       popq    %rax
+       popq    %rdx
+       leave
+       leaq    -8(%r10), %rsp
+       .cfi_def_cfa 7, 8
+       ret
+       .cfi_endproc
+       .size   _ITM_RM256, .-_ITM_RM256
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-5.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-5.d
new file mode 100644 (file)
index 0000000..b2222d7
--- /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
+    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 +sp\+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-5.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-5.s
new file mode 100644 (file)
index 0000000..82843c7
--- /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 0x3
+       .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 7
+       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 7
+       .cfi_restore 3
+       add     $0x30,%rsp
+       .cfi_adjust_cfa_offset -0x30
+       ret
+       .cfi_endproc
+       .size   foo, .-foo
index f86150574c90521c94835656cf43204e18d04342..489b3ff003f72f948715291b598b94f83b4f9305 100644 (file)
@@ -62,6 +62,8 @@ 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-5"
        run_dump_test "cfi-sframe-x86_64-pr33170"
        run_dump_test "cfi-sframe-x86_64-signal-1"
        run_dump_test "cfi-sframe-x86_64-empty-1"