[PATCH v3 0/3] sframe: Represent .cfi_undefined RA

Jens Remus jremus@linux.ibm.com
Wed Jul 23 13:17:55 GMT 2025


Changes in V3 (see individual patch notes for further details):
- New patches 1 and 2.
- Add SFrame FDE info word flag "RA undefined".

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 adds an API to libsframe to get the total number of FREs as
prerequisite for patch 2.

Patch 2 adds support for FDEs without any FREs to libsframe as
prerequisite for patch 3.

Patch 3 adds a SFrame FDE info word flag "RA undefined", represents
RA undefined as SFrame FDE without any FREs and RA undefined flag set,
and sets the FDE start FRE offset to zero for FDEs without any FREs.

I'll send a RFC V3 of my related Glibc patch series [1] next.

[1]: [RFC PATCH v2 0/2] s390x: Add support for SFrame stack backtracing,
     https://inbox.sourceware.org/libc-alpha/20250627133813.2198784-1-jremus@linux.ibm.com/

Thanks and regards,
Jens

Jens Remus (3):
  include: libsframe: Add API to get total number of FREs
  libsframe: Support for FDEs without any FREs
  gas: sframe: Represent .cfi_undefined RA

 gas/gen-sframe.c                              | 88 +++++++++++++------
 gas/gen-sframe.h                              | 11 ++-
 gas/sframe-opt.c                              |  3 +
 .../cfi-sframe-aarch64-ra-undefined-1.d       | 17 ++++
 .../cfi-sframe-aarch64-ra-undefined-1.s       | 13 +++
 .../cfi-sframe-s390x-ra-undefined-1.d         | 18 ++++
 .../cfi-sframe-s390x-ra-undefined-1.s         | 11 +++
 .../cfi-sframe-x86_64-ra-undefined-1.d        | 19 ++++
 .../cfi-sframe-x86_64-ra-undefined-1.s        | 11 +++
 gas/testsuite/gas/cfi-sframe/cfi-sframe.exp   |  3 +
 include/sframe-api.h                          |  5 ++
 include/sframe.h                              | 17 ++--
 libsframe/doc/sframe-spec.texi                | 17 +++-
 libsframe/libsframe.ver                       |  1 +
 libsframe/sframe-dump.c                       |  3 +
 libsframe/sframe.c                            | 23 ++++-
 16 files changed, 226 insertions(+), 34 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