[PATCH v2] PowerPC: Initial SFrame support for 64-bit PowerPC ELF ABI

Indu Bhagat ibhagatgnu@gmail.com
Thu Apr 16 20:21:56 GMT 2026


On 3/25/26 8:04 AM, Abhay Kandpal wrote:
> Inspired by s390 commit d27d82f560a8 ("s390: Initial support to generate
> .sframe from CFI directives in assembler").
> 
> Support for SFrame on PowerPC 64 is only enabled for the 64-bit PowerPC
> ELF ABI.
> 
> The SFrame ABI/arch identifiers SFRAME_ABI_PPC64_ENDIAN_BIG and
> SFRAME_ABI_PPC64_ENDIAN_LITTLE are introduced for PowerPC 64 big/little
> endian and added to the SFrame format specification.
> 
> Port x86-64 commit d7f343eaad3f ("x86-64: Remove sframe relocs against
> discarded sections").
> 
> Based on s390 64-bit (s390x) commit 955570f0973d ("s390: Represent FP
> without RA saved in SFrame").
> 
> If an architecture uses both SFrame RA and FP tracking SFrame assumes
> that the RA offset is the 2nd offset and the FP offset is the 3rd offset
> following a SFrame FRE.  An architecture does not necessarily need to
> save both on the stack (or in register) at the same time or even at all.
> SFrame cannot represent FP without RA saved on stack (or in a register),
> since it cannot distinguish whether the 2nd offset is the RA or FP
> offset.
> 
> For PPC64 use an invalid SFrame RA offset from CFA value of zero as
> padding to represent the FP being saved when the RA is not saved.  This
> aligns with the existing invalid SFrame fixed RA offset from CFA value
> of zero.  In a stack tracer this then also naturally falls into place,
> as it can skip restoring the RA in the topmost frame, if both the fixed
> RA offset (from SFrame header) and the RA offset (from FDE) are zero,
> without any need to test architecture-specific flags.
> 

Hi Abhay,

Thanks for the patch.

Lets also summarise the discussion in our private thread (with you and 
Jens) here for posterity summarising:
   - Why is SFrame necessary for PowePC.

In general, the patch looks good to me on first look. I do want to test 
a few things, and take a second look.

For the perf report based testing, was the testing done on both ppc64le 
and ppc64 (BE) ?

Thanks,
Indu



More information about the Binutils mailing list