[RFC 21/28] [SFrame-V3] gas: sframe: add handling for .cfi_register for FP and RA

Indu Bhagat indu.bhagat@oracle.com
Wed Dec 17 08:07:22 GMT 2025
On 12/15/25 8:19 AM, Jens Remus wrote:
> On 12/9/2025 10:07 AM, Indu Bhagat wrote:
>> Use SFrame FDE of type SFRAME_FDE_TYPE_FLEX_TOPMOST_FRAME.
>>
>> When FP, RA were moved to a general-purpose register, the SFrame
>> generation previously warned and skipped the FDE (except on S390X). This
>> patch updates the translator to detect`.cfi_register` for RA (and FP) on
>> AMD64, tracks the destination register in the SFrame row entry, and
>> emits the register in the relevant FRE offsets in SFrame FDE type
>> SFRAME_FDE_TYPE_FLEX_TOPMOST_FRAME.
> I enabled this for s390x and updated the related cfi-sframe-s390x tests,
> which were previously failing as SFrame V2 could not represent this.
> Doing so revealed that the SFrame generation logic is flawed, as it
> cannot differentiate between FP/RA saved on stack or in register.
> 
> Attached is a quick and dirty POC, that is not polished, that works for
> me on s390x.
> 

Sorry I realized I forgot to follow up on this.

I too, at one point, made the same change, but then rolled back thinking 
the only thing we need to track is whether the entity is tracked or not 
(and using SFRAME_FRE_ELEM_LOC_STACK should suffice, like it did for 
s390x FP/RA tracking till now).  I did realise the need to clean this up 
a bit, but I thought I would take this up later, as it didnt seem like a 
correctness issue.

I will take a look at your branch and get back on this.

Thanks!




More information about the Binutils mailing list