[PATCH v4 0/4] sframe: Represent .cfi_undefined RA
Jens Remus
jremus@linux.ibm.com
Fri Jul 25 16:23:29 GMT 2025
Changes in V4 (see individual patch notes for further details):
- Represent RA undefined as SFrame FRE without any offsets instead of
SFrame FDE without any FREs and a RA undefined flag set. (Indu)
- New patches 2 and 4.
Stack tracer implementations using SFrame, such as Glibc backtrace(),
benefit from the ability to detect whether an outermost frame has been
reached, which indicates that the trace is complete. In DWARF CFI this
is indicated by an "undefined" register rule for the return address
register.
This would enable to implement s390 64-bit (s390x) support for
backtracing using SFrame in Glibc [1], which requires the stack tracer
implementation to reliably detect, that an outermost frame has been
reached.
Patch 1 is a leftover form V3 that adds support for SFrame FDEs without
and FREs. Its purpose is to preserve this patch as such for the future,
if we decide not to commit this change. For the time being it might
be preferable to have the linker fail if a SFrame FDE without any FREs
is encountered.
Patch 2 adds an API to libsframe to get the number of FRE offsets as
prerequisite for patch 3.
Patch 3 represents .cfi_undefined RA as SFrame FRE without any offsets.
Patch 4 adds, as an alternative to patch 2, an API to libsframe to get
the RA undefined indication.
I'll send a RFC V4 of my related Glibc patch series [1] next.
[1]: [RFC PATCH v3 0/2] s390x: Add support for SFrame stack backtracing,
https://inbox.sourceware.org/libc-alpha/20250723142347.2159793-1-jremus@linux.ibm.com/
Thanks and regards,
Jens
Jens Remus (4):
gas: ld: libsframe: Support for SFrame FDEs without any FREs
include: libsframe: Add API to get FRE offset count
gas: sframe: Represent .cfi_undefined RA as FRE without offsets
include: libsframe: Add API to get RA undefined
gas/gen-sframe.c | 70 ++++++++++++++++---
gas/gen-sframe.h | 3 +
.../cfi-sframe-aarch64-ra-undefined-1.d | 20 ++++++
.../cfi-sframe-aarch64-ra-undefined-1.s | 13 ++++
.../cfi-sframe-s390x-ra-undefined-1.d | 21 ++++++
.../cfi-sframe-s390x-ra-undefined-1.s | 11 +++
.../cfi-sframe-x86_64-ra-undefined-1.d | 22 ++++++
.../cfi-sframe-x86_64-ra-undefined-1.s | 11 +++
gas/testsuite/gas/cfi-sframe/cfi-sframe.exp | 3 +
include/sframe-api.h | 12 ++++
include/sframe.h | 1 +
libsframe/doc/sframe-spec.texi | 10 ++-
libsframe/libsframe.ver | 6 ++
libsframe/sframe-dump.c | 15 +++-
libsframe/sframe.c | 51 ++++++++++++--
15 files changed, 248 insertions(+), 21 deletions(-)
create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-ra-undefined-1.d
create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-ra-undefined-1.s
create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-ra-undefined-1.d
create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-ra-undefined-1.s
create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-ra-undefined-1.d
create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-ra-undefined-1.s
--
2.48.1
More information about the Binutils
mailing list