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

Jan Beulich jbeulich@suse.com
Fri Jul 18 08:25:38 GMT 2025


On 18.07.2025 09:21, Indu Bhagat via Binutils wrote:
> --- a/gas/as.h
> +++ b/gas/as.h
> @@ -355,8 +355,15 @@ COMMON int flag_execstack;
>  /* TRUE if .note.GNU-stack section with SEC_CODE should be created */
>  COMMON int flag_noexecstack;
>  
> -/* TRUE if .sframe section should be created.  */
> -COMMON int flag_gen_sframe;
> +enum gen_sframe_option
> +{
> +  GEN_SFRAME_NONE = 0,

Maybe better GEN_SFRAME_DEFAULT, seeing Sam's plan to allow controlling the
default from configure?

> --- 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))

With said plan, I'm not sure about this. What's the intended behavior if
the default is "disabled"? It feels like you need to resolve the default
anyway after having parsed the command line. At which point I'm not even
sure anymore that a tristate is needed here.

> --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
> +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
> @@ -1,4 +1,4 @@
> -#as: --gsframe
> +#as:
>  #objdump: --sframe=.sframe
>  #name: SFrame generation using CFI directive .cfi_sections
>  #...

Wasn't this option just recently added here, to prepare for default-off
configurations?

Jan


More information about the Binutils mailing list