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

Indu Bhagat indu.bhagat@oracle.com
Thu Dec 18 17:47:58 GMT 2025


On 12/15/25 2:58 AM, Jan Beulich wrote:
> 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.
> 
> --- a/gas/sframe-opt.c
> +++ b/gas/sframe-opt.c
> @@ -21,6 +21,10 @@
>   #include "as.h"
>   #include "sframe.h"
>   
> +#ifndef support_sframe_p
> +# define support_sframe_p() false
> +#endif
> +

Hi Jan,

What do you think about leaving a comment here (subset of the 
information in commit log or verbatim) with the above definition.  I'm 
thinking it may be confusing to see this macro defined to false in the 
file.  Especially if the code evolves and there is need to rejig any of 
support_sframe_p usage in other files.

Thanks for the patch.

>   /* 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 +37,8 @@ sframe_estimate_size_before_relax (fragS
>     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 +81,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 +109,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 mailing list