[PATCH v5 4/4] gas: sframe: Represent .cfi_undefined RA as FRE without offsets
Jens Remus
jremus@linux.ibm.com
Mon Sep 15 10:23:38 GMT 2025
On 7/30/2025 10:30 AM, Indu via Binutils wrote:
> On 2025-07-29 8:16 a.m., Jens Remus wrote:
>> In DWARF CFI an "undefined" register rule for the return address (RA)
>> register indicates that there is no return address and the stack trace
>> is complete.
>>
>> Represent DW_CFA_undefined as SFrame FRE without any offsets, so that a
>> stack tracer implementation can use this as indication that an outermost
>> frame has been reached and the stack trace is complete.
>>
>> This representation is backward compatible, as existing stack tracers
>> should already deal with the case, that an SFrame FRE a so far invalid
>> offset count of zero and stop the trace.
>> diff --git a/binutils/NEWS b/binutils/NEWS
>> index 5038851b4553..79ab32b0874a 100644
>> --- a/binutils/NEWS
>> +++ b/binutils/NEWS
>> @@ -1,5 +1,13 @@
>> -*- text -*-
>> +* The SFrame stack trace format got extended to represent an undefined return
>> + address as SFrame FRE without any offsets. The assembler uses this to
>> + translate .cfi_undefined RA into SFrame. libsframe provides a new API to
>> + test for RA undefined, which is used when dumping SFrame information
>> + (e.g. using objdump and readelf) to show such FREs as "RA undefined".
>> +
>
> How about in binutils/NEWS:
>
> * SFrame stack trace format now represents an undefined return address
> as an SFrame FRE without any offsets. libsframe provides ... as
> "RA undefined".
Sure. Thanks!
> And in gas/NEWS:
>
> * gas now emits an SFrame FRE with zero offsets to convey an undefined return address in the SFrame stack trace format.
Ok. Slightly reworded, as no gas/NEWS entry ever started with "gas":
Emit an SFrame FRE with zero offsets to convey an undefined return address
in the SFrame stack trace format.
>> +* libsframe provides dumps of RA undefined (SFrame FRE without any offsets).
>> +
>
> This sentence can be skipped IMO from binutils/NEWS.
Sure, that was awkward anyways.
>> * NaCl target support is removed.
>> Changes in 2.45:
>> diff --git a/gas/NEWS b/gas/NEWS
>> index a9858939f06e..e2693d05c45e 100644
>> --- a/gas/NEWS
>> +++ b/gas/NEWS
>> @@ -1,5 +1,8 @@
>> -*- text -*-
>> +* Represent .cfi_undefined RA in SFrame stack trace information as SFrame FRE
>> + without any offsets.
>> +
>> * NaCl target support is removed.
>> Changes in 2.45:
>> diff --git a/libsframe/sframe.c b/libsframe/sframe.c
>> @@ -760,7 +760,8 @@ sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx,
>> int8_t ra_offset = sframe_decoder_get_fixed_ra_offset (dctx);
>> /* If the RA offset was not being tracked, return the fixed RA offset
>> from the SFrame header. */
>> - if (ra_offset != SFRAME_CFA_FIXED_RA_INVALID)
>> + if (ra_offset != SFRAME_CFA_FIXED_RA_INVALID
>> + && !sframe_get_fre_ra_undefined_p (fre->fre_info))
>> {
>> if (errp)
>> *errp = 0;
>
> Same for sframe_fre_get_fp_offset as well.
Makes sense.
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com
IBM
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
More information about the Binutils
mailing list