]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: sframe: reset fp_reg to SFRAME_FRE_REG_INVALID
authorIndu Bhagat <indu.bhagat@oracle.com>
Wed, 24 Dec 2025 09:06:28 +0000 (01:06 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Wed, 24 Dec 2025 09:06:28 +0000 (01:06 -0800)
It makes sense to keep all internal state related to registers
(cfa_base_reg, fp_reg) reset to SFRAME_FRE_REG_INVALID.

While at it, also make sure fp_reg state is copied over when intializing
an SFrame FRE.

gas/
* gen-sframe.c (sframe_row_entry_new): Reset to
SFRAME_FRE_REG_INVALID.
(sframe_row_entry_initialize): Copy over fp_reg too.
(sframe_xlate_do_offset): Adjust accordingly.

gas/gen-sframe.c

index 9c93f98a30c33cb6f564b16bf5dc01688cc8991b..0ac0f7e0a4bb4439343657d1c113d973fbb16205 100644 (file)
@@ -525,9 +525,10 @@ static struct sframe_row_entry*
 sframe_row_entry_new (void)
 {
   struct sframe_row_entry *fre = XCNEW (struct sframe_row_entry);
-  /* Reset cfa_base_reg to SFRAME_FRE_REG_INVALID.  A value of 0 may imply a
+  /* Reset all regs to SFRAME_FRE_REG_INVALID.  A value of 0 may imply a
      valid register for a supported arch.  */
   fre->cfa_base_reg = SFRAME_FRE_REG_INVALID;
+  fre->fp_reg = SFRAME_FRE_REG_INVALID;
   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
@@ -1012,6 +1013,7 @@ sframe_row_entry_initialize (struct sframe_row_entry *cur_fre,
   cur_fre->cfa_base_reg = prev_fre->cfa_base_reg;
   cur_fre->cfa_offset = prev_fre->cfa_offset;
   cur_fre->fp_loc = prev_fre->fp_loc;
+  cur_fre->fp_reg = prev_fre->fp_reg;
   cur_fre->fp_offset = prev_fre->fp_offset;
   cur_fre->ra_loc = prev_fre->ra_loc;
   cur_fre->ra_offset = prev_fre->ra_offset;
@@ -1233,7 +1235,7 @@ sframe_xlate_do_offset (struct sframe_xlate_ctx *xlate_ctx,
   /* Ignore SP reg, as it can be recovered from the CFA tracking info.  */
   if (cfi_insn->u.ri.reg == SFRAME_CFA_FP_REG)
     {
-      gas_assert (!cur_fre->fp_reg);
+      gas_assert (cur_fre->fp_reg == SFRAME_FRE_REG_INVALID);
       sframe_fre_set_fp_track (cur_fre, cfi_insn->u.ri.offset);
       cur_fre->merge_candidate = false;
     }