gas: Fix non-SP/FP CFA base register with flexible FDE
Allows gas to generate SFrame V3 FDEs with non-SP/FP CFA base registers when flexible FDE is supported.
Jens Remus proposes a change to gas’s SFrame V3 support to correctly handle non-SP/FP CFA base registers. Currently, gas warns and skips FDE generation in this scenario. This patch allows FDE generation if the target supports flexible FDE, addressing a limitation in DWARF CFI representation.
- proposer
Submits a patch to allow gas to generate SFrame V3 FDEs even when a non-SP/FP register is used as the CFA base. The change modifies gas/gen-sframe.c to permit this when flexible FDE is supported, and adjusts the testsuite to skip tests on affected targets.
“If a target supports SFrame V3 flexible FDE, a non-SP/FP CFA base register can be represented. Do not warn and skip generating FDE, if .cfi_def_cfa_offset with a non-SP/FP register in effect, if target supports flexible FDE.”
In Details
This change in gas/gen-sframe.c updates the handling of .cfi_def_cfa_offset instructions. Previously, it restricted the CFA base register to SP/FP, warning and skipping FDE generation otherwise. With SFrame V3 and its flexible FDE feature, non-SP/FP registers can be used as the CFA base, necessitating this change to avoid generating invalid or incomplete debugging information.
- gas
- The GNU Assembler, part of the GNU Binutils project. It translates assembly language code into object files.
- SFrame
- A DWARF debugging information extension for stack frame unwinding, primarily used by the GNU toolchain.
- FDE
- A DWARF (Debugging With Attributed Record Formats) common debugging table entry that describes how to unwind the stack for a particular function.
- CFA
- Common Frame Address, a conceptual address that represents the 'top' of a stack frame. It's often described relative to a base register (like SP or FP) and an offset.
- .cfi_def_cfa_offset
- A DWARF Common Information Entry (CIE) directive that defines the CFA using an offset from the current stack pointer. It typically implies the SP is the base register.
- DWARF
- A debugging data format used by many compilers and debuggers to provide information about compiled programs.