binutils-gdb/include
Indu Bhagat 4651bea119 bfd: include: sframe: fix PR ld/32789
Currently, when SFrame sections are emitted after linking the input
SFrame sections, the SFrame FDEs are sorted on start PC.  Doing so for
relocatable links has no effect (SFrame FDEs remain in place), because
the start PC is unrelocated data.  For relocatable links, then, the
emitted SFrame FDEs in the output section remain in the same order as
that in the respective input BFD.

The assembler does not guarantee the emission of SFrame FDEs in the same
order as the placement of the associated .text* sections,
(SFRAME_F_FDE_SORTED is not set in the ET_REL objs generated by GAS).
This means setting SFRAME_F_FDE_SORTED by the linker was wrong when:
  - doing relocatable link, and
  - the input bfds contain multiple .text sections, say .text.hot,
    .text.init, .text.unlikely etc.

For relocatable links, skip sorting the SFrame FDEs.  Do not set
SFRAME_F_FDE_SORTED for relocatable links.

This is achieved by adding an explicit argument (bool sort_fde_p) to the
sframe_encoder_write API.  Move the API from 2.0 to the 2.1 node as this
is an ABI-incompatible change.  Skip bumping the "current" in
libsframe/libtool-version ATM, we will do so closer to release.

When writing of SFrame data for PLT entries, indicate sort_fde_p to
false: these sections are like the other SFrame sections for any other
ET_REL binary.

Add a test in ld/testsuite/ld-sframe/sframe.exp, these tests are run for
all ABIs supported for SFrame.  In this test, for object file generated
for pr32789-1a.c:
  - the emitted SFrame FDEs by GAS are in the order of the .text* in the
    input assembly (i.e., .text.init, .text, .text.exit)
  - the emitted .text* sections by GAS are placed in the following order
    .text, .text.init, .text.exit.
  - GAS does not set SFRAME_F_FDE_SORTED, as expected.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>

bfd/
	PR ld/32789
	* elf-sframe.c (_bfd_elf_write_section_sframe): Skip sorting the
	SFrame FDEs for relocatable links.
	* elf64-s390.c (_bfd_s390_elf_write_sframe_plt): Additional
	argument to sframe_encoder_write.
	* elfxx-x86.c (_bfd_x86_elf_write_sframe_plt): Likewise.
libsframe/
	* libsframe.ver: Move from 2.0 node to 2.1.
	* sframe.c (sframe_encoder_write_sframe): Conditionalize based
	on argument sort_fde_p.
	(sframe_encoder_write): New argument to indicate whether SFrame
	FDEs are to be sorted in output.
include/
	* sframe-api.h (sframe_encoder_write): New argument.
ld/testsuite/
	PR ld/32789
	* ld/testsuite/ld-sframe/sframe.exp: New test.
	* ld/testsuite/ld-sframe/pr32789-1.rd: New test.
	* ld/testsuite/ld-sframe/pr32789-1.sd: New test.
	* ld/testsuite/ld-sframe/pr32789-1a.c: New test.
	* ld/testsuite/ld-sframe/pr32789-1b.c: New test.
	* ld/testsuite/ld-x86-64/sframe-reloc-1.d: Remove
	SFRAME_F_FDE_SORTED.
2025-12-19 23:11:45 -08:00
..
aout include/aout/aout64.h: guard ARCH_SIZE with defined() 2025-09-26 12:22:57 +02:00
cgen Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
coff PR 33302, Symbols truncated on i386pep target 2025-08-25 08:28:38 +09:30
elf bfd/ELF: fold BFD_RELOC_<arch>_RELATIVE 2025-12-15 11:29:33 +01:00
gdb Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
mach-o Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
opcode LoongArch: Add disassembly support for ud ui5 2025-12-20 10:49:47 +08:00
sim Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
som Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
vms PR 33385, Extended Image Header 2025-09-08 22:17:46 +09:30
alloca-conf.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ansidecl.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
bfdlink.h bfd: replace _bfd_merge_sections() hook with simple boolean 2025-10-24 15:11:39 +02:00
binary-io.h include/binary-io.h: guard O_BINARY usage with defined check 2025-09-26 12:22:17 +02:00
ChangeLog Add markers for 2.45 branch 2025-07-13 08:35:45 +01:00
ChangeLog-0415 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
ChangeLog-2016 ChangeLog rotation 2017-01-02 13:55:05 +10:30
ChangeLog-2017 ChangeLog rotation 2018-01-03 17:49:42 +10:30
ChangeLog-2018 ChangeLog rotation 2019-01-01 21:25:40 +10:30
ChangeLog-2019 ChangeLog rotation 2020-01-01 18:12:08 +10:30
ChangeLog-2020 ChangeLog rotation 2021-01-01 10:31:02 +10:30
ChangeLog-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
collectorAPI.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
COPYING
COPYING3
ctf-api.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf.h libctf: dump CTF array dimensions in the right order 2025-09-25 05:42:35 +01:00
demangle.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
diagnostics.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
dis-asm.h opcodes: PR 33384 invalid disassembler option message 2025-10-04 09:39:02 +09:30
doubly-linked-list.h libiberty: sync with gcc 2025-07-10 14:26:10 +01:00
dwarf2.def Synchronize the dwarf2.h and dwarf2.def files with their gcc counterparts, bringing the definitions of DW_AT_language_name and DW_AT_language_version. Add code to binutils/dwarf.c to display these attributes. 2025-12-02 11:06:01 +00:00
dwarf2.h Synchronize the dwarf2.h and dwarf2.def files with their gcc counterparts, bringing the definitions of DW_AT_language_name and DW_AT_language_version. Add code to binutils/dwarf.c to display these attributes. 2025-12-02 11:06:01 +00:00
dyn-string.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
environ.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
fibheap.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
filenames.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
floatformat.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
gcc-c-fe.def Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
gcc-c-interface.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
gcc-cp-fe.def Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
gcc-cp-interface.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
gcc-interface.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
getopt.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
hashtab.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
hp-symtab.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
leb128.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
libcollector.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
libfcollector.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
libiberty.h libiberty: sync with gcc 2025-05-20 09:49:13 +02:00
longlong.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
lto-symtab.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
MAINTAINERS Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
md5.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
oasys.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
objalloc.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
obstack.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
os9k.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
partition.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
plugin-api.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
same-inode.h ld: Use stat to check if linker script appears multiple times 2025-08-14 08:00:04 -07:00
sframe-api.h bfd: include: sframe: fix PR ld/32789 2025-12-19 23:11:45 -08:00
sframe-internal.h gas: ld: sframe: add new internal header 2025-07-09 01:40:41 -07:00
sframe.h include: sframe: rename sframe_func_desc_entry to use an explicit v2 2025-10-19 21:03:27 -07:00
sha1.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
simple-object.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
sort.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
splay-tree.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
symcat.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
xregex.h merge from gcc 2011-07-25 17:11:48 +00:00
xregex2.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
xtensa-config.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
xtensa-dynconfig.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30