[RFC PATCH 0/1] sframe: Represent FP without RA on stack (padding)

Jens Remus jremus@linux.ibm.com
Mon Apr 22 15:58:56 GMT 2024


This patch series adds support in SFrame to represent the frame pointer
(FP) without the return address (RA) being saved on the stack (and/or on
s390x in another register).

This is the first of two proposed alternatives:
1. This patch series uses a dummy padding offset (invalid offset from
   CFA value of zero) as RA offset to represent FP without RA on saved
   on the stack.
2. The alternative patch series changes the SFrame FRE count field into
   a bitmap, to convey which offsets follow the FRE.

Note that it currently applies on top of my v3 patch series series that
adds initial support to generate .sframe from CFI directives on s390x,
although it is independent of that.

The use of padding offsets has the benefit that it is a minor change
to the SFrame V2 format. The downside is that it adds some (but
apparently only minimal) bloat to the .sframe information. Also a value
of zero might not be an invalid offset from CFA on all architectures or
in all use cases (e.g. CFI in glibc longjmp() on some architectures
defines the jump buffer pointer register as CFA base for unwinders to
restore the jump target registers from (as if the return would be to the
jump target)).

A test build of glibc on s390x with this patch series applied shows the
following changes for libc.so:
The number of FDEs increases by 166 and the number of FREs increases by
861, while adding 337 dummy padding RA offsets. With a total of 28157
offsets the dummy padding offsets account for ~1.20 % of the offsets.

Thanks and regards,
Jens


Jens Remus (1):
  sframe: Represent FP without RA on stack

 gas/gen-sframe.c        | 50 +++++++++++++++++++----------------------
 include/sframe.h        |  9 ++++++--
 libsframe/sframe-dump.c |  4 ++++
 3 files changed, 34 insertions(+), 29 deletions(-)

-- 
2.40.1



More information about the Binutils mailing list