public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jens Remus <jremus@linux.ibm.com>
To: binutils@sourceware.org, Indu Bhagat <indu.bhagat@oracle.com>
Cc: Jens Remus <jremus@linux.ibm.com>,
	Andreas Krebbel <krebbel@linux.ibm.com>
Subject: [RFC PATCH 0/1] sframe: Represent FP without RA on stack (padding)
Date: Mon, 22 Apr 2024 17:58:56 +0200	[thread overview]
Message-ID: <20240422155857.2497684-1-jremus@linux.ibm.com> (raw)

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


             reply	other threads:[~2024-04-22 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 15:58 Jens Remus [this message]
2024-04-22 15:58 ` [RFC PATCH 1/1] sframe: Represent FP without RA on stack Jens Remus
2024-04-22 23:58   ` Indu Bhagat
2024-04-23 15:44     ` Jens Remus
2024-04-25  6:59       ` Indu Bhagat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240422155857.2497684-1-jremus@linux.ibm.com \
    --to=jremus@linux.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=indu.bhagat@oracle.com \
    --cc=krebbel@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).