[PATCH v3 3/3] gas: sframe: Represent .cfi_undefined RA

Jens Remus jremus@linux.ibm.com
Fri Jul 25 16:00:37 GMT 2025


Hello Indu,

thank you for the feedback!

On 25.07.2025 02:26, Indu Bhagat via Binutils wrote:
> On 7/23/25 6:17 AM, 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.
>>
>> Introduce a SFrame FDE info word flag "RA undefined".  Represent
>> DW_CFA_undefined as SFrame FDE without any FREs and FDE info word flag
>> "RA undefined" set, 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 FDE has a FRE count of
>> zero and stop the trace.  Furthermore the new FDE info word flag
>> "RA undefined" was previously unused and therefore not set.  Stack
>> tracers can therefore rely on FDE without FREs and RA undefined set
>> as indication for an outermost frame.

>>           Representing .cfi_undefined RA as SFrame FDE without any FREs is a
>>      simplification compared to DWARF CFI, as the latter can represent
>>      RA undefined for a range of PCs within a DWARF FDE.  An alternative
>>      would have been to represent .cfi_undefined RA as SFrame FRE without
>>      any offsets, which would have provided the same versatility.  Note
>>      that the current choice to represent this at a SFrame FDE level
>>      does not prevent to represent it at a SFrame FRE level in addition
>>      in the future.
> 
> Looks like SFrame FRE with 0 offsets has merits over SFrame FDE with 0 FREs
> after all.  They are not "equivalent" in terms of conveyance of information
> we thought previously.  We know better now that SFrame FDE with 0 FREs will
> need to be accompanied with an additional bit in the SFrame FDE func info.
> But SFrame FRE with 0 offsets seems more reasonable now because we at least
> save the precious bit in SFrame FDE func info.  Does it make more sense to
> you to go with SFrame FRE with 0 offsets rather ?
> 
> If we chose SFrame FRE with 0 offsets, we dont need to indicate any further
> in the FRE func info word either.

Sure, let me explore that approach.

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