]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: Validate SFrame RA tracking and fixed RA offset
authorJens Remus <jremus@linux.ibm.com>
Thu, 7 Mar 2024 16:01:46 +0000 (17:01 +0100)
committerJens Remus <jremus@linux.ibm.com>
Thu, 16 May 2024 11:32:22 +0000 (13:32 +0200)
If an architecture uses SFrame return-address (RA) tracking it must
specify the fixed RA offset as invalid. Otherwise, if an architecture
does not use RA tracking, it must specify a valid fixed RA offset.

gas/
* gen-sframe.c: Validate SFrame RA tracking and fixed
RA offset.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
gas/gen-sframe.c

index 9e5532bf07f88a52f3d3958c6321e2c0d455f207..bd03be478e13518dc737b3fdb75e537db9ba7bf8 100644 (file)
@@ -1536,6 +1536,18 @@ output_sframe (segT sframe_seg)
   /* Setup the version specific access functions.  */
   sframe_set_version (SFRAME_VERSION_2);
 
+#ifdef SFRAME_FRE_RA_TRACKING
+  if (sframe_ra_tracking_p ())
+    /* With RA tracking the fixed RA offset must be invalid.  */
+    gas_assert (sframe_cfa_ra_offset () == SFRAME_CFA_FIXED_RA_INVALID);
+  else
+    /* Without RA tracking the fixed RA offset may not be invalid.  */
+    gas_assert (sframe_cfa_ra_offset () != SFRAME_CFA_FIXED_RA_INVALID);
+#else
+  /* Without RA tracking the fixed RA offset may not be invalid.  */
+  gas_assert (sframe_cfa_ra_offset () != SFRAME_CFA_FIXED_RA_INVALID);
+#endif
+
   /* Process all fdes and create SFrame stack trace information.  */
   create_sframe_all ();