[PATCH v5 0/4] sframe: Represent .cfi_undefined RA

Jens Remus jremus@linux.ibm.com
Tue Jul 29 15:16:48 GMT 2025


Changes in V5 (see individual patch notes for further details):
- Drop patch that added new libsframe API to get FRE offset count.
- New patch 2 to not alter sframe_fre_get_cfa_offset error return value.
- Rename ra_undefined to ra_undefined_p. (Indu)
- Explicitly set FRE info word fields to zero if RA undefined.
- Have API to get RA offset return an error if RA undefined. (Indu)
- Add entry to gas/NEWS and binutils/NEWS. (Jose)

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.

Patch 2 adds support for SFrame FREs without any offsets as prerequisite
for patch 4.

Patch 3 adds an API to libsframe to test a FRE for RA undefined as
prerequisite for patch 4.

Patch 4 represents .cfi_undefined RA as SFrame FRE without any offsets.

RFC V4 of my related Glibc patch series is available on libc-alpha:
[RFC PATCH v4 0/3] s390x: Add support for SFrame stack backtracing,
https://inbox.sourceware.org/libc-alpha/20250725163227.2572964-1-jremus@linux.ibm.com/

Thanks and regards,
Jens

Jens Remus (4):
  gas: ld: libsframe: Support for SFrame FDEs without any FREs
  libsframe: Support for SFrame FREs without any offsets
  include: libsframe: Add API to get RA undefined
  gas: sframe: Represent .cfi_undefined RA as FRE without offsets

 binutils/NEWS                                 |  8 ++
 gas/NEWS                                      |  3 +
 gas/gen-sframe.c                              | 79 +++++++++++++++----
 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                          |  6 ++
 include/sframe.h                              |  1 +
 libsframe/doc/sframe-spec.texi                | 10 ++-
 libsframe/libsframe.ver                       |  5 ++
 libsframe/sframe-dump.c                       | 15 +++-
 libsframe/sframe.c                            | 37 ++++++++-
 17 files changed, 245 insertions(+), 23 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