[binutils-gdb] gas: stub out sframe-opt.c functions when SFrame is not supported

Jan Beulich jbeulich@sourceware.org
Mon Dec 22 10:09:36 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c2db59a7a276a77eef1e70f545fb4344cc7696a0

commit c2db59a7a276a77eef1e70f545fb4344cc7696a0
Author: Jan Beulich <jbeulich@suse.com>
Date:   Mon Dec 22 11:06:59 2025 +0100

    gas: stub out sframe-opt.c functions when SFrame is not supported
    
    Much like everything in gen-sframe.c, these functions are supposed to
    never be reached when SFrame isn't supported by a target. Adding
    respective assertions reduces code size for such targets, while at the
    same time adding consistency checking for targets which optionally
    support the feature.

Diff:
---
 gas/sframe-opt.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gas/sframe-opt.c b/gas/sframe-opt.c
index 65520734828..6787ca562b1 100644
--- a/gas/sframe-opt.c
+++ b/gas/sframe-opt.c
@@ -21,6 +21,12 @@
 #include "as.h"
 #include "sframe.h"
 
+/* Much like everything in gen-sframe.c, the functions here aren't supposed
+   to ever be reached when SFrame isn't supported by a target.  */
+#ifndef support_sframe_p
+# define support_sframe_p() false
+#endif
+
 /* The function estimates the size of a rs_sframe variant frag based on
    the current values of the symbols.  It is called before the
    relaxation loop.  We set fr_subtype{0:2} to the expected length.  */
@@ -33,6 +39,8 @@ sframe_estimate_size_before_relax (fragS *frag)
   symbolS *widthS;
   int ret;
 
+  gas_assert (support_sframe_p ());
+
   /* We are dealing with two different kind of fragments here which need
      to be fixed up:
        - first, FRE start address in each FRE, and
@@ -75,6 +83,8 @@ sframe_relax_frag (fragS *frag)
 {
   int oldsize, newsize;
 
+  gas_assert (support_sframe_p ());
+
   oldsize = frag->fr_subtype & 7;
   if (oldsize == 7)
     oldsize = -1;
@@ -101,6 +111,8 @@ sframe_convert_frag (fragS *frag)
   symbolS *dataS;
   symbolS *fsizeS, *diffS;
 
+  gas_assert (support_sframe_p ());
+
   /* We are dealing with two different kind of fragments here which need
      to be fixed up:
        - first, FRE start address in each FRE, and


More information about the Binutils-cvs mailing list