aboutsummaryrefslogtreecommitdiff
path: root/gas/gen-sframe.c
diff options
context:
space:
mode:
authorJens Remus <jremus@linux.ibm.com>2024-07-04 10:34:12 +0200
committerJens Remus <jremus@linux.ibm.com>2024-07-04 10:34:12 +0200
commit68e549ee5497d90a7921b4c676789b55f91ba08b (patch)
treef057fa9f58541078a4f40ac69c9a31cfb73c0c12 /gas/gen-sframe.c
parentcd1fab1330da92e755ca6336a33f27441e693a8d (diff)
downloadbinutils-68e549ee5497d90a7921b4c676789b55f91ba08b.zip
binutils-68e549ee5497d90a7921b4c676789b55f91ba08b.tar.gz
binutils-68e549ee5497d90a7921b4c676789b55f91ba08b.tar.bz2
gas: Validate SFrame RA tracking and fixed RA offset
Verify all architectures participating in SFrame generation do define the mandatory SFrame return address (RA) tracking predicate function sframe_ra_tracking_p. Do so by explicitly not testing for the macro SFRAME_FRE_RA_TRACKING as otherwise required. Verify that architectures not using SFrame RA tracking specify a valid fixed RA offset. gas/ * gen-sframe.c (output_sframe_internal): Validate SFrame RA tracking and fixed RA offset. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Diffstat (limited to 'gas/gen-sframe.c')
-rw-r--r--gas/gen-sframe.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index f83a645..626dc33 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -667,12 +667,16 @@ output_sframe_internal (void)
-fno-omit-frame-pointer is used. */
out_one (fixed_fp_offset);
- /* Offset for the return address from CFA is fixed for some ABIs
- (e.g., AMD64), output a SFRAME_CFA_FIXED_RA_INVALID otherwise. */
-#ifdef sframe_ra_tracking_p
+ /* All ABIs participating in SFrame generation must define
+ sframe_ra_tracking_p.
+ When RA tracking (in FREs) is not needed (e.g., AMD64), SFrame assumes
+ the RA is going to be at a fixed offset from CFA. Check that the fixed RA
+ offset is appropriately defined in all cases. */
if (!sframe_ra_tracking_p ())
- fixed_ra_offset = sframe_cfa_ra_offset ();
-#endif
+ {
+ fixed_ra_offset = sframe_cfa_ra_offset ();
+ gas_assert (fixed_ra_offset != SFRAME_CFA_FIXED_RA_INVALID);
+ }
out_one (fixed_ra_offset);
/* None of the AMD64, or AARCH64 ABIs need the auxiliary header.