[PATCH 3/4] gas: sframe: handle .cfi_undefined

Jan Beulich jbeulich@suse.com
Tue May 13 13:06:32 GMT 2025


On 11.05.2025 09:35, Indu Bhagat wrote:
> --- a/gas/gen-sframe.c
> +++ b/gas/gen-sframe.c
> @@ -1507,6 +1507,32 @@ sframe_xlate_do_cfi_escape (const struct sframe_xlate_ctx *xlate_ctx,
>    return err;
>  }
>  
> +/* Translate DW_CFA_undefined into SFrame context.
> +
> +   DW_CFA_undefined op implies that from now on the previous value of register
> +   can’t be restored anymore.  In SFrame stack trace, we cannot represent such
> +   a semantic.  So, we skip generating an SFrame FDE for this, when a register
> +   of interest is used with DW_CFA_undefined.
> +
> +   Return SFRAME_XLATE_OK if success.  */
> +
> +static int
> +sframe_xlate_do_cfi_undefined (const struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED,
> +			       const struct cfi_insn_data *cfi_insn)
> +{
> +  if (cfi_insn->u.ri.reg == SFRAME_CFA_FP_REG
> +      || cfi_insn->u.ri.reg == SFRAME_CFA_RA_REG
> +      || cfi_insn->u.ri.reg == SFRAME_CFA_SP_REG)
> +    {
> +      as_warn (_("skipping SFrame FDE; %s reg %u in .cfi_undefined"),

As the comment says, what you skip is generating an FDE; you don't skip any
FDE itself afaict. I think this needs reflecting in the diagnostic, for it
to not be confusing.

Further, are all three registers relevant in all cases? IOW isn't some
relaxation (in principle) possible? If so, I think this would want noting,
just like you did mark other cases where further work would be necessary
(or at least possible).

Jan


More information about the Binutils mailing list