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

Jens Remus jremus@linux.ibm.com
Fri May 16 16:06:05 GMT 2025


On 15.05.2025 23:06, Indu Bhagat wrote:
> Fix PR gas/32952 - sframe: incorrect handling of .cfi_undefined in gas
> 
> In context of SFrame generation, it is incorrect to simply ignore all
> .cfi_undefined.  We may ignore only those .cfi_undefined which are for
> registers of no interest (similar to whats done for other CFI
> directives).

> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c

> +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.r == SFRAME_CFA_FP_REG
> +      || cfi_insn->u.r == SFRAME_CFA_RA_REG
> +      || cfi_insn->u.r == SFRAME_CFA_SP_REG)

I am undecided whether SFrame should ignore .cfi_undefined <SP> (see
reasoning in my reply to "[PATCH,V2 4/4] gas: sframe: handle
.cfi_same_value").  Due to the implicit CFA-rule a SFrame based stack
tracer should always be able to restore SP.

But in this particular context I tend to assume that .cfi_undefined <SP>
would indicate somthing fishy and SFrame should better skip emitting the
FDE.

> +    {
> +      as_warn (_("no SFrame FDE emitted; %s reg %u in .cfi_undefined"),
> +	       sframe_register_name (cfi_insn->u.r), cfi_insn->u.r);
> +      return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented.  */
> +    }
> +
> +  /* Safe to skip.  */
> +  return SFRAME_XLATE_OK;
> +}

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list