[PATCH v2 1/2] gas: sframe: Fix non-SP/FP CFA base register if flexible FDE
Jens Remus <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
.cfi_def_cfa_offset modifies the current CFA rule to use the provided offset but keep the current CFA base register. It therefore requires a CFA base register to be in effect. Relax the check to simply test for whether a CFA base register is in effect instead of restricting it to SP/FP. The latter is checked when the CFA base register is modified. This enables .cfi_def_cfa_offset with non-SP/FP CFA base register for targets that support SFrame flexible FDE. While at it simplify the logic to test for error cases first. gas/ * gen-sframe.c (sframe_xlate_do_def_cfa_offset): Allow non-SP/FP CFA base register if flexible FDE. Signed-off-by: Jens Remus <[email protected]> --- Notes (jremus): Changes in v2: - Do not test CFA base register for non-SP/FP if not flexible FDE. - Do not exclude s390x and x86-64 from cfi-sframe/common-empty-2 test. - Simplify logic to test for error cases first. - Reword commit message. gas/gen-sframe.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index 7b8c2f2f20e3..031421d8ab7c 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -1362,31 +1362,23 @@ sframe_xlate_do_def_cfa_offset (struct sframe_xlate_ctx *xlate_ctx, gas_assert (cur_fre); /* Define the current CFA rule to use the provided offset (but to keep - the old register). However, if the old register is not FP/SP, + the old register). However, if the old register is invalid, skip creating SFrame stack trace info for the function. */ - if (cur_cfa_reg == SFRAME_CFA_FP_REG || cur_cfa_reg == SFRAME_CFA_SP_REG) + if (cur_cfa_reg == SFRAME_FRE_REG_INVALID) { - if (sframe_fre_stack_offset_bound_p (cfi_insn->u.i, true)) - { - sframe_fre_set_cfa_offset (cur_fre, cfi_insn->u.i); - cur_fre->merge_candidate = false; - } - else - { - as_warn (_("no SFrame FDE emitted; " - ".cfi_def_cfa_offset with unsupported offset value")); - return SFRAME_XLATE_ERR_NOTREPRESENTED; - } + as_warn (_("no SFrame FDE emitted; " + ".cfi_def_cfa_offset without CFA base register in effect")); + return SFRAME_XLATE_ERR_NOTREPRESENTED; } - else + + if (!sframe_fre_stack_offset_bound_p (cfi_insn->u.i, true)) { - /* No CFA base register in effect. Non-SP/FP CFA base register should - not occur, as sframe_xlate_do_def_cfa[_register] would detect this. */ as_warn (_("no SFrame FDE emitted; " - ".cfi_def_cfa_offset without CFA base register in effect")); + ".cfi_def_cfa_offset with unsupported offset value")); return SFRAME_XLATE_ERR_NOTREPRESENTED; } + sframe_fre_set_cfa_offset (cur_fre, cfi_insn->u.i); return SFRAME_XLATE_OK; } -- 2.53.0