[PATCH, V3] gas: sframe: command line option takes precedence

Jan Beulich jbeulich@suse.com
Fri Jul 25 07:41:40 GMT 2025


On 25.07.2025 08:45, Indu Bhagat via Binutils wrote:
> over gas directive to emit .sframe section.
> 
> Fix PR gas/33175 sframe: --gsframe=no does not disable when
> .cfi_sections directive with .sframe
> 
> --gsframe=no should also disable generation of SFrame section when
> explicit CFI directive:
>   .cfi_sections .sframe
> is specified in the input.  This means we need to track whether SFrame
> generation was explcitly disabled by the user.  Introduce a new enum to
> facilitate disambiguation between GEN_SFRAME_CONFIG_DISABLED and
> GEN_SFRAME_DISABLED.
> 
> While fixing the bug by adding the enum, keep the upcoming requirement
> in mind: we will also need to disambiguate between
> --enable-default-sframe and user-specified --gsframe/--gsframe=yes.  The
> intent is to not display SFrame related warnings or errors like:
> 
>   as_bad (_(".sframe not supported for target"));
> 
> for unsupported targets if --enable-default-sframe is in effect.
> 
> This implies we need to have a four state enum (
> GEN_SFRAME_DEFAULT_NONE, GEN_SFRAME_CONFIG_ENABLED,
> GEN_SFRAME_DISABLED, GEN_SFRAME_ENABLED)
> 
> gas/
> 	PR gas/33175
> 	* dw2gencfi.c (cfi_finish): Check state of flag_gen_sframe to
> 	determine whether any SFrame section is generated.
> 	* as.h (enum gen_sframe_option): New definition.
> 	* as.c (parse_args): Keep track of whether the flag is
> 	explicitly enabled or disabled
> gas/testsuite/
> 	PR gas/33175
> 	* gas/cfi-sframe/cfi-sframe-common-1.d: Remove redundant
> 	--gsframe.
> 	* gas/cfi-sframe/cfi-sframe.exp:  Add new test.
> 	* gas/cfi-sframe/cfi-sframe-common-1c.d: New test.  No SFrame
> 	section if explicit --gsframe=no.
> 	* gas/cfi-sframe/cfi-sframe-common-1c.s: New test.

This is okay, even if ...

> --- a/gas/dw2gencfi.c
> +++ b/gas/dw2gencfi.c
> @@ -2596,10 +2596,13 @@ cfi_finish (void)
>        flag_traditional_format = save_flag_traditional_format;
>      }
>  
> -  /* Generate SFrame section if the user specifies:
> -	- the command line option to gas, or
> -	- .sframe in the .cfi_sections directive.  */
> -  if (flag_gen_sframe || (all_cfi_sections & CFI_EMIT_sframe) != 0)
> +  /* Generate SFrame section if the user:
> +	- enables via the command line option, or
> +	- specifies .sframe in the .cfi_sections directive and does not disable
> +	  via the command line.  */
> +  if (flag_gen_sframe == GEN_SFRAME_ENABLED
> +      || ((all_cfi_sections & CFI_EMIT_sframe) != 0
> +	  && flag_gen_sframe != GEN_SFRAME_DISABLED))
>      {

... I'm yet to see how all four enumerators are going to be used.

Jan


More information about the Binutils mailing list