]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gas: sframe: command line option takes precedence
authorIndu Bhagat <indu.bhagat@oracle.com>
Fri, 25 Jul 2025 08:47:20 +0000 (01:47 -0700)
committerIndu Bhagat <indu.bhagat@oracle.com>
Fri, 25 Jul 2025 08:47:20 +0000 (01:47 -0700)
commit095319fe532cf586dcda63d0927a907c83c696b1
tree54f33dfd5f67aa67bfcf261780ad18a884d376cd
parenta9bab7ab6e84d3a949938593bd10f2a420c73844
gas: sframe: command line option takes precedence

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 explicitly disabled by the user.  Introduce a new enum to
facilitate disambiguation between GEN_SFRAME_DEFAULT_NONE 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.
gas/as.c
gas/as.h
gas/dw2gencfi.c
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.d [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.s [new file with mode: 0644]
gas/testsuite/gas/cfi-sframe/cfi-sframe.exp