--- /dev/null
+# Expect script for x86-64 object tests for SFrame.
+# Copyright (C) 2025 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
+ }
+ 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
+ }
+
+ set got [binutils_run cmp "${tempfile}.out ${dumpfile}.dump"]
+ if ![string equal "" $got] then {
+ fail "readelf SFrame V2 ($testname)"
+ continue
+ }
+ pass "readelf SFrame V2 ($testname)"
+}
--- /dev/null
+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: 9
+ Num FREs: 22
+
+ Function Index :
+
+ func idx [0]: pc = 0x401020, size = 16 bytes
+ STARTPC CFA FP RA
+ 0000000000401020 sp+16 u f
+ 0000000000401026 sp+24 u f
+
+ func idx [1]: pc = 0x401030, size = 64 bytes
+ STARTPC[m] CFA FP RA
+ 0000000000000000 sp+8 u f
+ 000000000000000b sp+16 u f
+
+ func idx [2]: pc = 0x401070, size = 109 bytes
+ STARTPC CFA FP RA
+ 0000000000401070 sp+8 u f
+ 0000000000401074 sp+32 u f
+ 00000000004010dc sp+8 u f
+
+ func idx [3]: pc = 0x4011d0, size = 10 bytes
+ STARTPC CFA FP RA
+ 00000000004011d0 sp+8 u f
+
+ func idx [4]: pc = 0x4011e0, size = 1 bytes
+ STARTPC CFA FP RA
+ 00000000004011e0 sp+8 u f
+
+ func idx [5]: pc = 0x4011f0, size = 64 bytes
+ STARTPC CFA FP RA
+ 00000000004011f0 sp+8 u f
+ 00000000004011f1 sp+16 c-16 f
+ 00000000004011f2 sp+24 c-16 f
+ 00000000004011f9 sp+544 c-16 f
+ 000000000040122d sp+24 c-16 f
+ 000000000040122e sp+16 c-16 f
+ 000000000040122f sp+8 c-16 f
+
+ func idx [6]: pc = 0x401230, size = 48 bytes
+ STARTPC CFA FP RA
+ 0000000000401230 sp+8 u f
+ 0000000000401231 sp+16 c-16 f
+ 0000000000401234 fp+16 c-16 f
+ 000000000040125f sp+8 c-16 f
+
+ func idx [7]: pc = 0x401260, size = 9 bytes
+ STARTPC CFA FP RA
+ 0000000000401260 sp+8 u f
+
+ func idx [8]: pc = 0x401270, size = 74 bytes
+ STARTPC CFA FP RA
+ 0000000000401270 sp+8 u f
--- /dev/null
+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: 2
+ Num FREs: 8
+
+ Function Index :
+
+ func idx [0]: pc = 0x0, size = 1 bytes
+ STARTPC CFA FP RA
+ 0000000000000000 sp+8 u f
+
+ func idx [1]: pc = 0x10, size = 64 bytes
+ STARTPC CFA FP RA
+ 0000000000000010 sp+8 u f
+ 0000000000000011 sp+16 c-16 f
+ 0000000000000012 sp+24 c-16 f
+ 0000000000000019 sp+544 c-16 f
+ 000000000000004d sp+24 c-16 f
+ 000000000000004e sp+16 c-16 f
+ 000000000000004f sp+8 c-16 f