]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[SFrame-V3] ld: add --discard-sframe command line option
authorIndu Bhagat <indu.bhagat@oracle.com>
Fri, 16 Jan 2026 00:43:35 +0000 (16:43 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Fri, 16 Jan 2026 01:02:27 +0000 (17:02 -0800)
commit832ca9ef67064aa3bdb198e3d591aaab9261bd6d
tree8f240c2550af6afb9e935a8c6dc7712cd3c54c56
parentdc49e2f2847aac56c97c01037e938dcb75dd0c3c
[SFrame-V3] ld: add --discard-sframe command line option

Add a new command line option --discard-sframe to the linker.
This option allows users to prevent the linker from generating an output
.sframe section.

The rationale for this option is: Consider the case when say, the distro
is shipped with SFrame sections in the installed binaries/libraries. A
user application using these installed libraries, but not enabling
.sframe for itself just yet, will see an output .sframe corresponding to
the pulled in libraries.  This is "partial" .sframe information for the
application.  Adding such an option to the linker, gives user a way to
turn off the .sframe section completely without relying on a linker
script.

Previously, the existing --no-ld-generated-unwind-info option
controlled whether (not just .eh_frame for PLT entries, but also) SFrame
for PLT entries. The new command line option,
--discard-sframe now decouples SFrame from other unwind
formats (like .eh_frame), allowing for more control over the output
binary's SFrame data.

The option is added for architectures that currently support SFrame:
AArch64, s390x, and x86_64.

bfd/
* elf-sframe.c (_bfd_elf_parse_sframe): Mark with SEC_EXCLUDE if
--discard-sframe is in effect.
* elf64-s390.c (elf_s390_create_dynamic_sections): Use
discard_sframe to guard .sframe section creation.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
include/
* bfdlink.h (struct bfd_link_info): Add discard_sframe bitfield.
ld/
* ldlex.h (enum option_values): Add OPTION_NO_LD_SFRAME_INFO.
* lexsup.c (elf_sframe_list_options): New function.
(ld_list_options): Add sframe_info argument. Update callers.
* ld.texi: Update documentation.
* emulparams/sframe-info.sh: New file.
* emultempl/aarch64elf.em: Add --discard-sframe option
listing and handling.
* emulparams/elf64_s390.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* Makefile.am: Update to handle sframe-info.sh and new list options.
* configure.ac: Handle SFRAME_INFO target variable.
* Makefile.in: Regenerate.
* configure: Regenerate.
ld/testsuite/
* ld-x86-64/x86-64.exp: New test.
* ld-x86-64/sframe-command-line-1.d: New test.
* ld-aarch64/aarch64-elf.exp: New test.
* ld-s390/s390.exp: New test.
* ld-x86-64/x86-64.exp: New test.
* ld-aarch64/sframe-command-line-1.d: New test.
* ld-s390/sframe-command-line-1.d: New test.
* ld-x86-64/sframe-command-line-1.d: New test.
21 files changed:
bfd/elf-sframe.c
bfd/elf64-s390.c
bfd/elfxx-x86.c
include/bfdlink.h
ld/Makefile.am
ld/Makefile.in
ld/configure
ld/configure.ac
ld/emulparams/elf64_s390.sh
ld/emulparams/elf_x86_64.sh
ld/emulparams/sframe-info.sh [new file with mode: 0644]
ld/emultempl/aarch64elf.em
ld/ld.texi
ld/ldlex.h
ld/lexsup.c
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/sframe-command-line-1.d [new file with mode: 0644]
ld/testsuite/ld-s390/s390.exp
ld/testsuite/ld-s390/sframe-command-line-1.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/sframe-command-line-1.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp