static unsigned char
sframe_v1_set_fre_info (unsigned int base_reg, unsigned int num_offsets,
- unsigned int offset_size)
+ unsigned int offset_size, bool mangled_ra_p)
{
unsigned char fre_info;
fre_info = SFRAME_V1_FRE_INFO (base_reg, num_offsets, offset_size);
+ fre_info = SFRAME_V1_FRE_INFO_UPDATE_MANGLED_RA_P (mangled_ra_p, fre_info);
return fre_info;
}
static unsigned char
sframe_set_fre_info (unsigned int base_reg, unsigned int num_offsets,
- unsigned int offset_size)
+ unsigned int offset_size, bool mangled_ra_p)
{
return sframe_ver_ops.set_fre_info (base_reg, num_offsets,
- offset_size);
+ offset_size, mangled_ra_p);
}
/* SFrame set func info. */
fre_num_offsets = get_fre_num_offsets (sframe_fre);
fre_offset_size = sframe_get_fre_offset_size (sframe_fre);
fre_info = sframe_set_fre_info (fre_base_reg, fre_num_offsets,
- fre_offset_size);
+ fre_offset_size, sframe_fre->mangled_ra_p);
out_one (fre_info);
idx = sframe_fre_offset_func_map_index (fre_offset_size);
for the supported arches. */
fre->cfa_base_reg = -1;
fre->merge_candidate = true;
+ /* Reset the mangled RA status bit to zero by default. We will initialize it in
+ sframe_row_entry_initialize () with the sticky bit if set. */
+ fre->mangled_ra_p = false;
return fre;
}
cur_fre->bp_offset = prev_fre->bp_offset;
cur_fre->ra_loc = prev_fre->ra_loc;
cur_fre->ra_offset = prev_fre->ra_offset;
+ /* Treat RA mangling as a sticky bit. It retains its value until another
+ .cfi_negate_ra_state is seen. */
+ cur_fre->mangled_ra_p = prev_fre->mangled_ra_p;
}
/* Translate DW_CFA_advance_loc into SFrame context.
return SFRAME_XLATE_OK;
}
+/* Translate DW_CFA_GNU_window_save into SFrame context.
+ Return SFRAME_XLATE_OK if success. */
+
+static int
+sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx,
+ struct cfi_insn_data *cfi_insn ATTRIBUTE_UNUSED)
+{
+ struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre;
+
+ gas_assert (cur_fre);
+ /* Toggle the mangled RA status bit. */
+ cur_fre->mangled_ra_p = !cur_fre->mangled_ra_p;
+ cur_fre->merge_candidate = false;
+
+ return SFRAME_XLATE_OK;
+}
+
/* Process CFI_INSN and update the translation context with the FRE
information.
case DW_CFA_restore:
err = sframe_xlate_do_restore (xlate_ctx, cfi_insn);
break;
+ /* DW_CFA_AARCH64_negate_ra_state is multiplexed with
+ DW_CFA_GNU_window_save. */
+ case DW_CFA_GNU_window_save:
+ err = sframe_xlate_do_gnu_window_save (xlate_ctx, cfi_insn);
+ break;
case DW_CFA_undefined:
case DW_CFA_same_value:
break;
- ...
Following skipped operations do, however, impact the asynchronicity:
- - CFI_escape,
- - DW_CFA_GNU_window_save,
- - DW_CFA_AARCH64_negate_ra_state (multiplexed with
- DW_CFA_GNU_window_save) */
+ - CFI_escape */
err = SFRAME_XLATE_ERR_NOTREPRESENTED;
// printf (_("SFrame Unsupported or unknown Dwarf CFI number: %#x\n"), op);
on it. */
bool merge_candidate;
+ /* Whether the return address is mangled with pauth code. */
+ bool mangled_ra_p;
+
/* Track CFA base (architectural) register ID. */
unsigned int cfa_base_reg;
/* Offset from the CFA base register for recovering CFA. */
{
unsigned char format_version; /* SFrame format version. */
/* set SFrame FRE info. */
- unsigned char (*set_fre_info) (unsigned int, unsigned int, unsigned int);
+ unsigned char (*set_fre_info) (unsigned int, unsigned int, unsigned int,
+ bool);
/* set SFrame Func info. */
unsigned char (*set_func_info) (unsigned int, unsigned int);
};