diff options
author | Jens Remus <jremus@linux.ibm.com> | 2025-02-04 15:13:24 +0100 |
---|---|---|
committer | Jens Remus <jremus@linux.ibm.com> | 2025-02-04 15:13:24 +0100 |
commit | 49da9e9d9e6dfdca620cd9d953b543598d7b61cf (patch) | |
tree | e749d2e42bf8b93e6560963b54e9a1383d1cffe0 | |
parent | 0e9555a011e8c5309efcc85b1a01a01496e2bbe3 (diff) | |
download | binutils-49da9e9d9e6dfdca620cd9d953b543598d7b61cf.zip binutils-49da9e9d9e6dfdca620cd9d953b543598d7b61cf.tar.gz binutils-49da9e9d9e6dfdca620cd9d953b543598d7b61cf.tar.bz2 |
gas: Skip SFrame FDE if .cfi_val_offset specifies non-default offset
Unwinding of the stack pointer (SP) is performed using the assumed
default rule ".cfi_val_offset <SP-reg>, 0", so that SP unwinds as:
SP = CFA
Warn if the CFI directive .cfi_val_offset is encountered for the
SP register with a different offset.
gas/
* gen-sframe.c (sframe_xlate_do_val_offset): Skip SFrame FDE
if non-default SP value offset.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
-rw-r--r-- | gas/gen-sframe.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index e7397e0..13478ef 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -1124,15 +1124,15 @@ sframe_xlate_do_val_offset (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED, struct cfi_insn_data *cfi_insn) { /* Previous value of register is CFA + offset. However, if the specified - register is not interesting (FP or RA reg), the current DW_CFA_val_offset - instruction can be safely skipped without sacrificing the asynchronicity of - stack trace information. */ + register is not interesting (SP, FP, or RA reg), the current + DW_CFA_val_offset instruction can be safely skipped without sacrificing + the asynchronicity of stack trace information. */ if (cfi_insn->u.ri.reg == SFRAME_CFA_FP_REG #ifdef SFRAME_FRE_RA_TRACKING || (sframe_ra_tracking_p () && cfi_insn->u.ri.reg == SFRAME_CFA_RA_REG) #endif - /* Ignore SP reg, as it can be recovered from the CFA tracking info. */ - ) + /* Ignore SP reg, if offset matches assumed default rule. */ + || (cfi_insn->u.ri.reg == SFRAME_CFA_SP_REG && cfi_insn->u.ri.offset != 0)) { as_warn (_("skipping SFrame FDE; %s register %u in .cfi_val_offset"), sframe_register_name (cfi_insn->u.ri.reg), cfi_insn->u.ri.reg); |