[PATCH,V2 4/4] gas: sframe: handle .cfi_same_value
Jan Beulich
jbeulich@suse.com
Sun May 18 08:13:54 GMT 2025
On 16.05.2025 18:02, Jens Remus wrote:
> Hello Indu!
>
> On 15.05.2025 23:06, Indu Bhagat wrote:
>> Fix PR gas/32953 - sframe: incorrect handling of .cfi_same_value in gas
>>
>> As per documentation, .cfi_same_value indicates that the current value
>> of register is the same like in the previous frame, i.e. no restoration
>> needed.
>>
>> In some cases, SFrame has no means to encode this information. Warn and
>> skip generating the SFrame FDE in those cases.
>
>> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
>
>> + SFrame based stacktracers will implement CFA-based SP recovery for all ABIs:
>> + SP for previous frame is based on the applicable CFA-rule. There is no
>> + representation in SFrame to indicate "no restoration needed" for REG_SP. So
>> + skip generating the SFrame FDE if DW_CFA_same_value is seen for
>> + SFRAME_CFA_SP_REG.
>
> I think SFrame should treat .cfi_same_value <SP> the same way as
> .cfi_restore <SP>. That is ignore, as a SFrame based stack tracer will
> restore SP using the implicit CFA-rule anyway. At least SFrame should
> treat both in the same way (either ignore or skip emitting the FDE).
>
> This is different from .cfi_same_value <RA>, which resets any previous rule
> for RA, as for SP there is always the implicit rule.
>
> Another argument to ignore is that SFrame does also ignore
> .cfi_offset <SP>, <offset>, which would define a rule for SP that SFrame
> cannot represent. But given the implicit CFA-rule it can safely ignore it.
Can it? Isn't an explicit directive always overriding any implicit rules?
Jan
More information about the Binutils
mailing list