[V3 18/36] [SFrame-V3] gas: sframe: output new FDE type SFRAME_FDE_TYPE_FLEX
Jens Remus
jremus@linux.ibm.com
Tue Jan 13 12:28:35 GMT 2026
On 1/13/2026 12:12 PM, Indu Bhagat wrote:
> This patch updates the routines for emission of the new FDE type
> SFRAME_FDE_TYPE_FLEX in the SFrame output section. The support for
> generating these flex FDEs themselves is added in a subsequent commit.
>
> Update struct sframe_row_entry to track additional state for CFA,
> FP, and RA. Modify output_sframe_row_entry_offsets () to emit
> metadata/offset pairs for flexible FDEs or padding where applicable,
> ensuring the usual ordering (CFA, RA, FP). The padding data, a.k.a.
> SFRAME_FRE_RA_OFFSET_INVALID is emitted in flexible FDEs when RA is
> untracked but FP offsets follow. Trailing padding offsets should not
> occur. Add a new function get_udata_size_in_bytes () to account for
> sizing of unsigned register metadata.
> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> @@ -420,6 +454,38 @@ sframe_get_fre_offset_size (const struct sframe_row_entry *sframe_fre)
> if (ra_offset_size > max_offset_size)
> max_offset_size = ra_offset_size;
>
> + /* If flex FDE, account for reg data too. */
> + if (flex_p)
> + {
> + bool reg_p = (sframe_fre->cfa_base_reg != SFRAME_FRE_REG_INVALID);
> + unsigned int data
> + = SFRAME_V3_FLEX_FDE_REG_ENCODE (sframe_fre->cfa_base_reg,
> + sframe_fre->cfa_deref_p, reg_p);
> + unsigned int data_size = get_udata_size_in_bytes (data);
> + if (data_size > max_offset_size)
> + max_offset_size = data_size;
> +
> + if (sframe_fre->ra_loc != SFRAME_FRE_ELEM_LOC_NONE)
> + {
> + reg_p = (sframe_fre->ra_loc != SFRAME_FRE_ELEM_LOC_REG);
Mustn't that be as follows (like it is done for FP below)?
reg_p = (sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_REG);
> + data = SFRAME_V3_FLEX_FDE_REG_ENCODE (sframe_fre->ra_reg,
> + sframe_fre->ra_deref_p, reg_p);
> + data_size = get_udata_size_in_bytes (data);
> + if (data_size > max_offset_size)
> + max_offset_size = data_size;
> + }
> +
> + if (sframe_fre->fp_loc != SFRAME_FRE_ELEM_LOC_NONE)
> + {
> + reg_p = (sframe_fre->fp_loc == SFRAME_FRE_ELEM_LOC_REG);
> + data = SFRAME_V3_FLEX_FDE_REG_ENCODE (sframe_fre->fp_reg,
> + sframe_fre->fp_deref_p, reg_p);
> + data_size = get_udata_size_in_bytes (data);
> + if (data_size > max_offset_size)
> + max_offset_size = data_size;
> + }
> + }
> +
> gas_assert (max_offset_size);
>
> switch (max_offset_size)
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
More information about the Binutils
mailing list