]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gas: Don't skip SFrame FDE if .cfi_register specifies SP register
authorJens Remus <jremus@linux.ibm.com>
Thu, 14 Mar 2024 13:48:52 +0000 (14:48 +0100)
committerJens Remus <jremus@linux.ibm.com>
Thu, 16 May 2024 11:32:22 +0000 (13:32 +0200)
commitaf10cd9dbcb9a3c0fdb00979df4767dd9df3f5a3
tree7e1121b0b545dd4fcc6d38379328cae42431ac1f
parent5cfabd629e91a14a0129cd80132ad1b2dde3fd72
gas: Don't skip SFrame FDE if .cfi_register specifies SP register

The stack-pointer (SP) register contents on entry can be reconstructed
from the CFA base register tracking information from the current SFrame
FRE and initial FRE from the FDE:

1. Compute CFA from the current CFA base register (SP or FP) and CFA
   offset from the SFrame CFA base register tracking information from
   the SFrame FRE for the current instruction address:

     CFA = <current_base_reg> + <current_cfa_offset>

2. Compute SP from the current CFA and the CFA offset from the SFrame
   CFA tracking information from the initial SFrame FRE of the FDE:

     SP = CFA - <initial_cfa_offset>

While at it add a comment to the processing of .cfi_val_offset that the
SP can be reconstructed from the CFA base register tracking information.

gas/
* gen-sframe.c (sframe_xlate_do_register): Do not skip SFrame
FDE if .cfi_register specifies SP register.
(sframe_xlate_do_val_offset): Add comment that this is likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
gas/gen-sframe.c