[PATCH] libsframe: use proper FRE type when flipping SFrame V3 FREs

Jens Remus jremus@linux.ibm.com
Tue Jan 20 09:29:44 GMT 2026


On 1/20/2026 8:22 AM, Indu Bhagat wrote:
> On 1/19/26 7:46 AM, Jens Remus wrote:
>> flip_sframe_fdes_with_fres_v3 was erroneously using a fixed FRE type
>> of 0 (= SFRAME_FRE_TYPE_ADDR1) when endianness byte-flipping the FREs,
>> regardless of the actual FRE type (i.e. ADDR1, ADDR2, or ADDR4).  This
>> only affected cross builds, where the .sframe section data may needed
>> to be endianness byte-flipped (e.g. binutils cross-built for s390
>> 64-bit (s390x) on x86-64).
>>
>> As a consequence objdump/readelf with option --sframe could fail to dump
>> e.g. s390 64-bit (s390x) .sframe section data on x86-64 with the
>> following error message:
>>
>>    Error: SFrame decode failure: Buffer does not contain SFrame data.
>>
>> The linker ld-sframe test "PR ld/33401 (Step 1: Create relocatable
>> object and check R_*_NONE)" cross-build for s390 64-bit (s390x) on
>> x86-64 could fail with ld error message:
>>
>>    error in tmpdir/StatePlaying.o(.sframe); no .sframe will be created
>>
>> The linker ld-sframe test "PR ld/33401 (Step 1: Create relocatable
>> object and check R_*_NONE)" cros-build for s390 64-bit (s390x) on
>> x86-64 could fail with BDF assertion:
>>
>>    BFD (GNU Binutils) ... assertion fail .../bfd/elf-sframe.c:153
>>
>> Add a common cfi-sframe assembler test, that forces a FDE type of
>> SFRAME_FRE_TYPE_ADDR2.  When the test is run cross-build it may
>> exercise the SFrame FDE and FDE endianness byte flipping.
>>
> 
> LGTM.  Thanks!

Thanks!  Committed to mainline (and thus should be part of the soon to
be created binutils 2.46 release branch).

> 
>> libsframe/
>>     PR ld/33810
>>     * sframe.c (sframe_decode_fde_attr_v3): Decode and return FRE
>>     type from FDE attributes.
>>     (flip_sframe_fdes_with_fres_v3): Use proper FRE type from
>>     FDE attributes when flipping FREs.
>>
>> gas/testsuite/
>>     PR ld/33810
>>     * gas/cfi-sframe/cfi-sframe.exp (cfi-sframe-common-pr33810): Run
>>     new test.
>>     * gas/cfi-sframe/cfi-sframe-common-pr33810.d: New test.
>>     * gas/cfi-sframe/cfi-sframe-common-pr33810.s: Likewise.
>>
>> Bug: https://sourceware.org/pr33810
>> Fixes: 8ab6e4c72ab6 ("[SFrame-V3] include: gas: libsframe: split FDE into idx and attr")
>> Reported-by: Alan Modra <amodra@gmail.com>
>> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
>> ---
>>   .../cfi-sframe/cfi-sframe-common-pr33810.d    | 23 +++++++++++++++++++
>>   .../cfi-sframe/cfi-sframe-common-pr33810.s    |  7 ++++++
>>   gas/testsuite/gas/cfi-sframe/cfi-sframe.exp   |  2 ++
>>   libsframe/sframe.c                            | 13 +++++------
>>   4 files changed, 38 insertions(+), 7 deletions(-)
>>   create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-pr33810.d
>>   create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-pr33810.s
Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list