[V3 01/36] [SFrame-V3] readelf: testsuite: sframe: add new SFrame V2 test
Indu Bhagat
indu.bhagat@oracle.com
Tue Jan 13 11:12:05 GMT 2026
In subsequent commits, we will add support for SFrame V3. In the next
GNU Binutils release, GNU as and ld will only generate SFrame V3; SFrame
V2 will not be supported for generation nor linking.
For readelf/objdump, however, continue to support textual dump of SFrame
V2 sections. Add a binary file (with no debug data) with SFrame V2
section to keep the dumping tested.
Add ET_REL And ET_EXEC binary file based tests for x86_64 and s390x.
Check that both readelf and objdump works on the SFrame V2 sections.
binutils/testsuite/
* binutils-all/s390/README-sframe-tests: New test.
* binutils-all/s390/sframe.exp: New test.
* binutils-all/s390/test-v2-ET_EXEC.sframe.bz2: New test.
* binutils-all/s390/test-v2-ET_EXEC.sframe.dump: New test.
* binutils-all/s390/test-v2-ET_REL.sframe.bz2: New test.
* binutils-all/s390/test-v2-ET_REL.sframe.dump: New test.
* binutils-all/x86-64/README-sframe-tests: New test.
* binutils-all/x86-64/sframe.exp: New test.
* binutils-all/x86-64/test-v2-ET_EXEC.sframe.bz2: New test.
* binutils-all/x86-64/test-v2-ET_EXEC.sframe.dump: New test.
* binutils-all/x86-64/test-v2-ET_REL.sframe.bz2: New test.
* binutils-all/x86-64/test-v2-ET_REL.sframe.dump: New test.
---
[Changes in V1]
- Use regexp_diff for the testcases [Indu].
- Add binary data based (ET_REL and ET_EXEC) tests for s390x [Jan,
Jens].
- Add objdump to the testcase as well [Jan].
- Add a README-sframe-tests file containing the instructions to
recreate the binary data files [Jan].
[End of changes in V1]
[No Changes in V2]
[Changes in V3]
- Update Copyright yr 2026 in new files.
- Use assembler input for x86_64 tests [Jan].
- Use assembler input for s390x tests [Jan].
- Update READMEs accordingly.
[End of changes in V3]
---
.../binutils-all/s390/README-sframe-tests | 175 ++++++++++++++++++
.../testsuite/binutils-all/s390/sframe.exp | 63 +++++++
.../s390/test-v2-ET_EXEC.sframe.bz2 | Bin 0 -> 1498 bytes
.../s390/test-v2-ET_EXEC.sframe.dump | 51 +++++
.../s390/test-v2-ET_REL.sframe.bz2 | Bin 0 -> 851 bytes
.../s390/test-v2-ET_REL.sframe.dump | 42 +++++
.../binutils-all/x86-64/README-sframe-tests | 96 ++++++++++
.../testsuite/binutils-all/x86-64/sframe.exp | 63 +++++++
.../x86-64/test-v2-ET_EXEC.sframe.bz2 | Bin 0 -> 1424 bytes
.../x86-64/test-v2-ET_EXEC.sframe.dump | 45 +++++
.../x86-64/test-v2-ET_REL.sframe.bz2 | Bin 0 -> 777 bytes
.../x86-64/test-v2-ET_REL.sframe.dump | 33 ++++
12 files changed, 568 insertions(+)
create mode 100644 binutils/testsuite/binutils-all/s390/README-sframe-tests
create mode 100644 binutils/testsuite/binutils-all/s390/sframe.exp
create mode 100644 binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.bz2
create mode 100644 binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.dump
create mode 100644 binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.bz2
create mode 100644 binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.dump
create mode 100644 binutils/testsuite/binutils-all/x86-64/README-sframe-tests
create mode 100644 binutils/testsuite/binutils-all/x86-64/sframe.exp
create mode 100644 binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.bz2
create mode 100644 binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.dump
create mode 100644 binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.bz2
create mode 100644 binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.dump
diff --git a/binutils/testsuite/binutils-all/s390/README-sframe-tests b/binutils/testsuite/binutils-all/s390/README-sframe-tests
new file mode 100644
index 00000000000..f6d977662e3
--- /dev/null
+++ b/binutils/testsuite/binutils-all/s390/README-sframe-tests
@@ -0,0 +1,175 @@
+The tests in sframe.exp use binary data files:
+ - test-v2-ET_EXEC.sframe.bz2
+ - test-v2-ET_REL.sframe.bz2
+These files are generated using a as/ld supporting SFrame V2 sections (Binutils
+<= 2.45). The purpose of those tests is to make sure readelf/objdump support
+works for SFrame V2.
+
+The binary files are generated using the following steps.
+
+$ cat sort.s
+ .machinemode zarch
+ .machine "z900"
+.text
+ .align 8
+ .globl swapit
+ .type swapit, @function
+swapit:
+ .cfi_startproc
+ stmg %r11,%r15,88(%r15)
+ .cfi_offset 11, -72
+ .cfi_offset 12, -64
+ .cfi_offset 13, -56
+ .cfi_offset 14, -48
+ .cfi_offset 15, -40
+ aghi %r15,-176
+ .cfi_def_cfa_offset 336
+ lgr %r11,%r15
+ .cfi_def_cfa_register 11
+ stg %r2,168(%r11)
+ stg %r3,160(%r11)
+ lg %r1,160(%r11)
+ l %r2,0(%r1)
+ lg %r1,168(%r11)
+ st %r2,0(%r1)
+ nopr %r0
+ lmg %r11,%r15,264(%r11)
+ .cfi_restore 15
+ .cfi_restore 14
+ .cfi_restore 13
+ .cfi_restore 12
+ .cfi_restore 11
+ .cfi_def_cfa 15, 160
+ br %r14
+ .cfi_endproc
+ .size swapit, .-swapit
+
+ .align 8
+ .globl fake_sort
+ .type fake_sort, @function
+fake_sort:
+ .cfi_startproc
+ stmg %r11,%r15,88(%r15)
+ .cfi_offset 11, -72
+ .cfi_offset 12, -64
+ .cfi_offset 13, -56
+ .cfi_offset 14, -48
+ .cfi_offset 15, -40
+ aghi %r15,-176
+ .cfi_def_cfa_offset 336
+ lgr %r11,%r15
+ .cfi_def_cfa_register 11
+ stg %r2,168(%r11)
+ lgr %r1,%r3
+ st %r1,164(%r11)
+ l %r1,164(%r11)
+ ltr %r1,%r1
+ jle .L5
+ lgf %r1,164(%r11)
+ sllg %r1,%r1,2
+ aghi %r1,-4
+ ag %r1,168(%r11)
+ lgr %r3,%r1
+ lg %r2,168(%r11)
+ brasl %r14,swapit@PLT
+.L5:
+ nopr %r0
+ lg %r4,288(%r11)
+ lmg %r11,%r15,264(%r11)
+ .cfi_restore 15
+ .cfi_restore 14
+ .cfi_restore 13
+ .cfi_restore 12
+ .cfi_restore 11
+ .cfi_def_cfa 15, 160
+ br %r4
+ .cfi_endproc
+ .size fake_sort, .-fake_sort
+
+ .align 8
+ .globl sort_array
+ .type sort_array, @function
+sort_array:
+ .cfi_startproc
+ stmg %r11,%r15,88(%r15)
+ .cfi_offset 11, -72
+ .cfi_offset 12, -64
+ .cfi_offset 13, -56
+ .cfi_offset 14, -48
+ .cfi_offset 15, -40
+ aghi %r15,-672
+ .cfi_def_cfa_offset 832
+ lgr %r11,%r15
+ .cfi_def_cfa_register 11
+ lgr %r1,%r11
+ aghi %r1,160
+ lghi %r3,128
+ lgr %r2,%r1
+ brasl %r14,fake_sort@PLT
+ nopr %r0
+ lg %r4,784(%r11)
+ lmg %r11,%r15,760(%r11)
+ .cfi_restore 15
+ .cfi_restore 14
+ .cfi_restore 13
+ .cfi_restore 12
+ .cfi_restore 11
+ .cfi_def_cfa 15, 160
+ br %r4
+ .cfi_endproc
+ .size sort_array, .-sort_array
+
+ .section .rodata
+ .align 2
+.LC0:
+ .string "done"
+
+ .text
+ .align 8
+ .globl main
+ .type main, @function
+main:
+ .cfi_startproc
+ stmg %r11,%r15,88(%r15)
+ .cfi_offset 11, -72
+ .cfi_offset 12, -64
+ .cfi_offset 13, -56
+ .cfi_offset 14, -48
+ .cfi_offset 15, -40
+ aghi %r15,-160
+ .cfi_def_cfa_offset 320
+ lgr %r11,%r15
+ .cfi_def_cfa_register 11
+ brasl %r14,sort_array@PLT
+ larl %r2,.LC0
+ brasl %r14,printf@PLT
+ lhi %r1,0
+ lgfr %r1,%r1
+ lgr %r2,%r1
+ lg %r4,272(%r11)
+ lmg %r11,%r15,248(%r11)
+ .cfi_restore 15
+ .cfi_restore 14
+ .cfi_restore 13
+ .cfi_restore 12
+ .cfi_restore 11
+ .cfi_def_cfa 15, 160
+ br %r4
+ .cfi_endproc
+ .size main, .-main
+
+ .globl _start
+ .type _start, @function
+_start:
+ brasl %r14,_start
+ .size _start, .-_start
+
+$ as --gsframe -o sort.o sort.s
+$ ld -lc sort.o -o sort
+
+$ cp sort test-v2-ET_EXEC.sframe
+$ chmod -x test-v2-ET_EXEC.sframe
+$ bzip2 test-v2-ET_EXEC.sframe
+
+$ cp sort.o test-v2-ET_REL.sframe
+$ bzip2 test-v2-ET_REL.sframe
diff --git a/binutils/testsuite/binutils-all/s390/sframe.exp b/binutils/testsuite/binutils-all/s390/sframe.exp
new file mode 100644
index 00000000000..0522d683b1f
--- /dev/null
+++ b/binutils/testsuite/binutils-all/s390/sframe.exp
@@ -0,0 +1,63 @@
+# Expect script for s390 object tests for SFrame.
+# Copyright (C) 2026 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+if {![istarget "s390x-*-linux*"] || [is_remote host]} {
+ return
+}
+
+set tempfile tmpdir/sframe-testbin
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.sframe.bz2]]
+foreach t $test_list {
+ # We need to strip the ".bz2", but can leave the dirname.
+ set test $subdir/[file tail $t]
+ set testname [file rootname $test]
+ verbose $testname
+
+ # We will check against the expected output in file named ${dumpfile}.dump
+ set dumpfile [file rootname $t]
+
+ if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
+ untested "bzip2 -dc ($tempfile)"
+ continue
+ }
+
+ # Check readelf output of SFrame V2 sections.
+ set got [remote_exec host "$READELF --sframe $tempfile" "" "/dev/null" "${tempfile}.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "readelf SFrame V2 ($testname)"
+ continue
+ }
+
+ if { [regexp_diff "${tempfile}.out" "${dumpfile}.dump"] } then {
+ fail "readelf SFrame V2 ($testname)"
+ }
+ pass "readelf SFrame V2 ($testname)"
+
+ # Check objdump output of SFrame V2 sections as well.
+ set got [remote_exec host "$OBJDUMP --sframe $tempfile" "" "/dev/null" "${tempfile}.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "objdump SFrame V2 ($testname)"
+ continue
+ }
+
+ if { [regexp_diff "${tempfile}.out" "${dumpfile}.dump"] } then {
+ fail "objdump SFrame V2 ($testname)"
+ }
+ pass "objdump SFrame V2 ($testname)"
+}
diff --git a/binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.bz2 b/binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.bz2
new file mode 100644
index 00000000000..1f66b015e73
Binary files /dev/null and b/binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.bz2 differ
diff --git a/binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.dump b/binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.dump
new file mode 100644
index 00000000000..cd3a652b40e
--- /dev/null
+++ b/binutils/testsuite/binutils-all/s390/test-v2-ET_EXEC.sframe.dump
@@ -0,0 +1,51 @@
+#...
+Contents of the SFrame section .sframe:
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_SORTED,
+ SFRAME_F_FDE_FUNC_START_PCREL
+ Num FDEs: 6
+ Num FREs: 22
+
+ Function Index :
+
+ func idx \[0\]: pc = 0x10002b0, size = 32 bytes
+ STARTPC +CFA +FP +RA +
+ 00000000010002b0 +sp\+160 +u +u +
+
+ func idx \[1\]: pc = 0x10002d0, size = 32 bytes
+ STARTPC\[m\] +CFA +FP +RA +
+ 0000000000000000 +sp\+160 +u +u +
+
+ func idx \[2\]: pc = 0x10002f0, size = 56 bytes
+ STARTPC +CFA +FP +RA +
+ 00000000010002f0 +sp\+160 +u +u +
+ 00000000010002f6 +sp\+160 +c-72 +c-48 +
+ 00000000010002fa +sp\+336 +c-72 +c-48 +
+ 00000000010002fe +fp\+336 +c-72 +c-48 +
+ 0000000001000326 +sp\+160 +u +u +
+
+ func idx \[3\]: pc = 0x1000328, size = 92 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000001000328 +sp\+160 +u +u +
+ 000000000100032e +sp\+160 +c-72 +c-48 +
+ 0000000001000332 +sp\+336 +c-72 +c-48 +
+ 0000000001000336 +fp\+336 +c-72 +c-48 +
+ 0000000001000382 +sp\+160 +u +u +
+
+ func idx \[4\]: pc = 0x1000388, size = 52 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000001000388 +sp\+160 +u +u +
+ 000000000100038e +sp\+160 +c-72 +c-48 +
+ 0000000001000392 +sp\+832 +c-72 +c-48 +
+ 0000000001000396 +fp\+832 +c-72 +c-48 +
+ 00000000010003ba +sp\+160 +u +u +
+
+ func idx \[5\]: pc = 0x10003c0, size = 58 bytes
+ STARTPC +CFA +FP +RA +
+ 00000000010003c0 +sp\+160 +u +u +
+ 00000000010003c6 +sp\+160 +c-72 +c-48 +
+ 00000000010003ca +sp\+320 +c-72 +c-48 +
+ 00000000010003ce +fp\+320 +c-72 +c-48 +
+ 00000000010003f8 +sp\+160 +u +u +
diff --git a/binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.bz2 b/binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.bz2
new file mode 100644
index 00000000000..0adf558bdff
Binary files /dev/null and b/binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.bz2 differ
diff --git a/binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.dump b/binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.dump
new file mode 100644
index 00000000000..2cc17963385
--- /dev/null
+++ b/binutils/testsuite/binutils-all/s390/test-v2-ET_REL.sframe.dump
@@ -0,0 +1,42 @@
+#...
+Contents of the SFrame section .sframe:
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_FUNC_START_PCREL
+ Num FDEs: 4
+ Num FREs: 20
+
+ Function Index :
+
+ func idx \[0\]: pc = 0x0, size = 56 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000000000 +sp\+160 +u +u +
+ 0000000000000006 +sp\+160 +c-72 +c-48 +
+ 000000000000000a +sp\+336 +c-72 +c-48 +
+ 000000000000000e +fp\+336 +c-72 +c-48 +
+ 0000000000000036 +sp\+160 +u +u +
+
+ func idx \[1\]: pc = 0x38, size = 92 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000000038 +sp\+160 +u +u +
+ 000000000000003e +sp\+160 +c-72 +c-48 +
+ 0000000000000042 +sp\+336 +c-72 +c-48 +
+ 0000000000000046 +fp\+336 +c-72 +c-48 +
+ 0000000000000092 +sp\+160 +u +u +
+
+ func idx \[2\]: pc = 0x98, size = 52 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000000098 +sp\+160 +u +u +
+ 000000000000009e +sp\+160 +c-72 +c-48 +
+ 00000000000000a2 +sp\+832 +c-72 +c-48 +
+ 00000000000000a6 +fp\+832 +c-72 +c-48 +
+ 00000000000000ca +sp\+160 +u +u +
+
+ func idx \[3\]: pc = 0xd0, size = 58 bytes
+ STARTPC +CFA +FP +RA +
+ 00000000000000d0 +sp\+160 +u +u +
+ 00000000000000d6 +sp\+160 +c-72 +c-48 +
+ 00000000000000da +sp\+320 +c-72 +c-48 +
+ 00000000000000de +fp\+320 +c-72 +c-48 +
+ 0000000000000108 +sp\+160 +u +u +
diff --git a/binutils/testsuite/binutils-all/x86-64/README-sframe-tests b/binutils/testsuite/binutils-all/x86-64/README-sframe-tests
new file mode 100644
index 00000000000..b5b3f0cb7fa
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/README-sframe-tests
@@ -0,0 +1,96 @@
+The tests in sframe.exp use binary data files:
+ - test-v2-ET_EXEC.sframe.bz2
+ - test-v2-ET_REL.sframe.bz2
+These files are generated using a as/ld supporting SFrame V2 sections (Binutils
+<= 2.45). The purpose of those tests is to make sure readelf/objdump support
+works for SFrame V2.
+
+The binary files are generated using the following steps.
+
+$ cat sort.s
+ .text
+ .p2align 4
+ .globl swapit
+ .type swapit, @function
+swapit:
+ .cfi_startproc
+ movl (%rsi), %eax
+ .cfi_def_cfa_register 6
+ .cfi_offset 6, 16
+ movl %eax, (%rdi)
+ .cfi_def_cfa_register 7
+ ret
+ .cfi_endproc
+ .size swapit, .-swapit
+
+ .p2align 4
+ .globl fake_sort
+ .type fake_sort, @function
+fake_sort:
+ .cfi_startproc
+ testl %esi, %esi
+ jg .L5
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L5:
+ movslq %esi, %rsi
+ leaq -4(%rdi,%rsi,4), %rsi
+ jmp swapit
+ .cfi_endproc
+ .size fake_sort, .-fake_sort
+
+ .text
+ .p2align 4
+ .globl sort_array
+ .type sort_array, @function
+sort_array:
+ .cfi_startproc
+ subq $520, %rsp
+ .cfi_def_cfa_offset 528
+ movl $128, %esi
+ movq %rsp, %rdi
+ call fake_sort
+ addq $520, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+ .size sort_array, .-sort_array
+
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
+ .string "done"
+
+ .section .text.startup,"ax",@progbits
+ .p2align 4
+ .globl main
+ .type main, @function
+main:
+ .cfi_startproc
+ subq $8, %rsp
+ .cfi_def_cfa_offset 16
+ call sort_array
+ movl $.LC0, %edi
+ xorl %eax, %eax
+ call printf
+ xorl %eax, %eax
+ addq $8, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+
+ .globl _start
+ .type _start,@function
+_start:
+ call main
+ .size main, .-main
+
+$ as --gsframe -o sort.o sort.s
+$ ld -lc sort.o -o sort
+
+$ cp sort test-v2-ET_EXEC.sframe
+$ chmod -x test-v2-ET_EXEC.sframe
+$ bzip2 test-v2-ET_EXEC.sframe
+
+$ cp sort.o test-v2-ET_REL.sframe
+$ bzip2 test-v2-ET_REL.sframe
diff --git a/binutils/testsuite/binutils-all/x86-64/sframe.exp b/binutils/testsuite/binutils-all/x86-64/sframe.exp
new file mode 100644
index 00000000000..62642152016
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/sframe.exp
@@ -0,0 +1,63 @@
+# Expect script for x86-64 object tests for SFrame.
+# Copyright (C) 2026 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+if {![istarget "x86_64-*-linux*"] || [is_remote host]} {
+ return
+}
+
+set tempfile tmpdir/sframe-testbin
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.sframe.bz2]]
+foreach t $test_list {
+ # We need to strip the ".bz2", but can leave the dirname.
+ set test $subdir/[file tail $t]
+ set testname [file rootname $test]
+ verbose $testname
+
+ # We will check against the expected output in file named ${dumpfile}.dump
+ set dumpfile [file rootname $t]
+
+ if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
+ untested "bzip2 -dc ($tempfile)"
+ continue
+ }
+
+ # Check readelf output of SFrame V2 sections.
+ set got [remote_exec host "$READELF --sframe $tempfile" "" "/dev/null" "${tempfile}.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "readelf SFrame V2 ($testname)"
+ continue
+ }
+
+ if { [regexp_diff "${tempfile}.out" "${dumpfile}.dump"] } then {
+ fail "readelf SFrame V2 ($testname)"
+ }
+ pass "readelf SFrame V2 ($testname)"
+
+ # Check objdump output of SFrame V2 sections as well.
+ set got [remote_exec host "$OBJDUMP --sframe $tempfile" "" "/dev/null" "${tempfile}.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "objdump SFrame V2 ($testname)"
+ continue
+ }
+
+ if { [regexp_diff "${tempfile}.out" "${dumpfile}.dump"] } then {
+ fail "objdump SFrame V2 ($testname)"
+ }
+ pass "objdump SFrame V2 ($testname)"
+}
diff --git a/binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.bz2 b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.bz2
new file mode 100644
index 00000000000..e9686735516
Binary files /dev/null and b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.bz2 differ
diff --git a/binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.dump b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.dump
new file mode 100644
index 00000000000..b89271ea26f
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_EXEC.sframe.dump
@@ -0,0 +1,45 @@
+#...
+Contents of the SFrame section .sframe:
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_SORTED,
+ SFRAME_F_FDE_FUNC_START_PCREL
+ CFA fixed RA offset: -8
+ Num FDEs: 6
+ Num FREs: 14
+
+ Function Index :
+
+ func idx \[0\]: pc = 0x401000, size = 16 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000401000 +sp\+16 +u +f +
+ 0000000000401006 +sp\+24 +u +f +
+
+ func idx \[1\]: pc = 0x401010, size = 16 bytes
+ STARTPC\[m\] +CFA +FP +RA +
+ 0000000000000000 +sp\+8 +u +f +
+ 000000000000000b +sp\+16 +u +f +
+
+ func idx \[2\]: pc = 0x401020, size = 28 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000401020 +sp\+8 +u +f +
+ 0000000000401024 +sp\+16 +u +f +
+ 000000000040103b +sp\+8 +u +f +
+
+ func idx \[3\]: pc = 0x401050, size = 5 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000401050 +sp\+8 +u +f +
+ 0000000000401052 +fp\+8 +c\+16 +f +
+ 0000000000401054 +sp\+8 +c\+16 +f +
+
+ func idx \[4\]: pc = 0x401060, size = 18 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000401060 +sp\+8 +u +f +
+
+ func idx \[5\]: pc = 0x401080, size = 28 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000401080 +sp\+8 +u +f +
+ 0000000000401087 +sp\+528 +u +f +
+ 000000000040109b +sp\+8 +u +f +
+
diff --git a/binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.bz2 b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.bz2
new file mode 100644
index 00000000000..48e6036d896
Binary files /dev/null and b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.bz2 differ
diff --git a/binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.dump b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.dump
new file mode 100644
index 00000000000..463f6af203e
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/test-v2-ET_REL.sframe.dump
@@ -0,0 +1,33 @@
+#...
+Contents of the SFrame section .sframe:
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_FUNC_START_PCREL
+ CFA fixed RA offset: -8
+ Num FDEs: 4
+ Num FREs: 10
+
+ Function Index :
+
+ func idx \[0\]: pc = 0x0, size = 5 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000000000 +sp\+8 +u +f +
+ 0000000000000002 +fp\+8 +c\+16 +f +
+ 0000000000000004 +sp\+8 +c\+16 +f +
+
+ func idx \[1\]: pc = 0x10, size = 18 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000000010 +sp\+8 +u +f +
+
+ func idx \[2\]: pc = 0x30, size = 28 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000000030 +sp\+8 +u +f +
+ 0000000000000037 +sp\+528 +u +f +
+ 000000000000004b +sp\+8 +u +f +
+
+ func idx \[3\]: pc = 0x0, size = 28 bytes
+ STARTPC +CFA +FP +RA +
+ 0000000000000000 +sp\+8 +u +f +
+ 0000000000000004 +sp\+16 +u +f +
+ 000000000000001b +sp\+8 +u +f +
--
2.43.0
More information about the Binutils
mailing list