gas: Allow non-SP/FP CFA base register with flexible FDE
gas: Fixes .cfi_def_cfa_offset to correctly handle non-SP/FP CFA base registers for flexible FDEs.
gas now correctly handles the .cfi_def_cfa_offset directive when using a non-stack pointer (SP) or frame pointer (FP) as the Call Frame Analysis (CFA) base register. This change relaxes a previous restriction, enabling the use of .cfi_def_cfa_offset with flexible FDEs on targets that support this feature. The logic has also been simplified to prioritize error condition checks.
In Details
The gas sframe module's sframe_xlate_do_def_cfa_offset function is updated to allow .cfi_def_cfa_offset when cur_cfa_reg is not SP/FP, provided a flexible FDE is in use. Previously, it restricted this to SP/FP registers. This commit clarifies the condition to simply check if *a* CFA base register is in effect, and adds a new check for SFRAME_FRE_REG_INVALID. Error handling is also refactored to check error cases first.
- gas
- The GNU Assembler, which translates assembly language code into machine code.
- SFrame
- A debugging information format used by some toolchains to represent stack frame layout. It's processed by gas and consumed by debuggers.
- CFA
- Call Frame Analysis. A mechanism used in debugging information to describe how to locate local variables and arguments on the stack.
- FDE
- Frame Description Entry. A data structure within debugging information that describes how to unwind the stack for a particular function or code region.
- .cfi_def_cfa_offset
- An assembler directive that defines the Call Frame Analysis (CFA) rule, specifying an offset relative to a base register.
- SP
- Stack Pointer. A CPU register that points to the top of the current stack.
- FP
- Frame Pointer. A CPU register that typically points to the base of the current stack frame, used for accessing local variables and function arguments.