binutils-gdb/include/elf
Indu Bhagat cf0e0a0ba9 bfd: linker: merge .sframe sections
The linker merges all the input .sframe sections.  When merging, the
linker verifies that all the input .sframe sections have the same
abi/arch.

The linker uses libsframe library to perform key actions on the
.sframe sections - decode, read, and create output data.  This
implies buildsystem changes to make and install libsframe before
libbfd.

The linker places the output .sframe section in a new segment of its
own: PT_GNU_SFRAME.  A new segment is not added, however, if the
generated .sframe section is empty.

When a section is discarded from the final link, the corresponding
entries in the .sframe section for those functions are also deleted.

The linker sorts the SFrame FDEs on start address by default and sets
the SFRAME_F_FDE_SORTED flag in the .sframe section.

This patch also adds support for generation of SFrame unwind
information for the .plt* sections on x86_64.  SFrame unwind info is
generated for IBT enabled PLT, lazy/non-lazy PLT.

The existing linker option --no-ld-generated-unwind-info has been
adapted to include the control of whether .sframe unwind information
will be generated for the linker generated sections like PLT.

Changes to the linker script have been made as necessary.

ChangeLog:

	* Makefile.def: Add install dependency on libsframe for libbfd.
	* Makefile.in: Regenerated.
	* bfd/Makefile.am: Add elf-sframe.c
	* bfd/Makefile.in: Regenerated.
	* bfd/bfd-in2.h (SEC_INFO_TYPE_SFRAME): Regenerated.
	* bfd/configure: Regenerate.
	* bfd/configure.ac: Add elf-sframe.lo.
	* bfd/elf-bfd.h (struct sframe_func_bfdinfo): New struct.
	(struct sframe_dec_info): Likewise.
	(struct sframe_enc_info): Likewise.
	(struct elf_link_hash_table): New member for encoded .sframe
	object.
	(struct output_elf_obj_tdata): New member.
	(elf_sframe): New access macro.
	(_bfd_elf_set_section_sframe): New declaration.
	* bfd/elf.c (get_segment_type): Handle new segment
	PT_GNU_SFRAME.
	(bfd_section_from_phdr): Likewise.
	(get_program_header_size): Likewise.
	(_bfd_elf_map_sections_to_segments): Likewise.
	* bfd/elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Add
	contents to the .sframe sections or .plt* entries.
	* bfd/elflink.c (elf_section_ignore_discarded_relocs): Handle
	SEC_INFO_TYPE_SFRAME.
	(_bfd_elf_default_action_discarded): Handle .sframe section.
	(elf_link_input_bfd): Merge .sframe section.
	(bfd_elf_final_link): Write the output .sframe section.
	(bfd_elf_discard_info): Handle discarding .sframe section.
	* bfd/elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Create
	.sframe section for .plt and .plt.sec.
	(_bfd_x86_elf_finish_dynamic_sections): Handle .sframe from
	.plt* sections.
	* bfd/elfxx-x86.h (PLT_SFRAME_FDE_START_OFFSET): New
	definition.
	(SFRAME_PLT0_MAX_NUM_FRES): Likewise.
	(SFRAME_PLTN_MAX_NUM_FRES): Likewise.
	(struct elf_x86_sframe_plt): New structure.
	(struct elf_x86_link_hash_table): New member.
	(struct elf_x86_init_table): New members for .sframe
	creation.
	* bfd/section.c: Add new definition SEC_INFO_TYPE_SFRAME.
	* binutils/readelf.c (get_segment_type): Handle new segment
	PT_GNU_SFRAME.
	* ld/ld.texi: Update documentation for
	--no-ld-generated-unwind-info.
	* ld/scripttempl/elf.sc: Support .sframe sections.
	* ld/Makefile.am (TESTSFRAMELIB): Use it.
	(check-DEJAGNU): Likewise.
	* ld/Makefile.in: Regenerated.
	* ld/configure.ac (TESTSFRAMELIB): Set to the .so or .a like TESTBFDLIB.
	* ld/configure: Regenerated.
	* bfd/elf-sframe.c: New file.

include/ChangeLog:

	* elf/common.h (PT_GNU_SFRAME): New definition.
	* elf/internal.h (struct elf_segment_map): Handle new segment
	type PT_GNU_SFRAME.

ld/testsuite/ChangeLog:

	* ld/testsuite/ld-bootstrap/bootstrap.exp: Add SFRAMELIB.
	* ld/testsuite/ld-aarch64/aarch64-elf.exp: Add new test
	  sframe-simple-1.
	* ld/testsuite/ld-aarch64/sframe-bar.s: New file.
	* ld/testsuite/ld-aarch64/sframe-foo.s: Likewise.
	* ld/testsuite/ld-aarch64/sframe-simple-1.d: Likewise.
	* ld/testsuite/ld-sframe/sframe-empty.d: New test.
	* ld/testsuite/ld-sframe/sframe-empty.s: New file.
	* ld/testsuite/ld-sframe/sframe.exp: New testsuite.
	* ld/testsuite/ld-x86-64/sframe-bar.s: New file.
	* ld/testsuite/ld-x86-64/sframe-foo.s: Likewise.
	* ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise.
	* ld/testsuite/ld-x86-64/sframe-plt-1.d: Likewise.
	* ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise.
	* ld/testsuite/ld-x86-64/x86-64.exp: Add new tests -
	  sframe-simple-1, sframe-plt-1.
	* ld/testsuite/lib/ld-lib.exp: Add new proc to check if
	  assembler supports SFrame section.
	* ld/testsuite/ld-sframe/discard.d: New file.
	* ld/testsuite/ld-sframe/discard.ld: Likewise.
	* ld/testsuite/ld-sframe/discard.s: Likewise.
2022-11-15 15:49:47 -08:00
..
aarch64.h [AArch64] Support AArch64 MTE memory tag dumps in core files 2022-07-19 15:24:27 +01:00
alpha.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
amdgpu.h binutils/readelf: handle AMDGPU relocation types 2022-03-16 09:01:54 -04:00
arc-cpu.def Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
arc-reloc.def HOWTO size encoding 2022-06-08 21:33:00 +09:30
arc.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
arm.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
avr.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
bfin.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
bpf.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ChangeLog-0415
ChangeLog-9103
common.h bfd: linker: merge .sframe sections 2022-11-15 15:49:47 -08:00
cr16.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
cris.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
crx.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
csky.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
d10v.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
d30v.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
dlx.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
dwarf.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
epiphany.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
external.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
fr30.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
frv.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ft32.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
h8.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
hppa.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
i370.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
i386.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
i860.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
i960.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ia64.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
internal.h bfd: linker: merge .sframe sections 2022-11-15 15:49:47 -08:00
ip2k.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
iq2000.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
lm32.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
loongarch.h LoongArch: Update ELF e_flags handling according to specification. 2022-09-30 14:00:47 +08:00
m32c.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
m32r.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
m68hc11.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
m68k.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
mcore.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
mep.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
metag.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
microblaze.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
mips.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
mmix.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
mn10200.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
mn10300.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
moxie.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
msp430.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
mt.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
nds32.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
nfp.h Remove use of bfd_uint64_t and similar 2022-05-27 22:08:59 +09:30
nios2.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
or1k.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
pj.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ppc64.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ppc.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
pru.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
reloc-macros.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
riscv.h RISC-V: Implement Ztso extension 2022-09-21 11:43:35 +08:00
rl78.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
rx.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
s12z.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
s390.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
score.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
sh.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
sparc.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
spu.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
tic6x-attrs.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
tic6x.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
tilegx.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
tilepro.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
v850.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
vax.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
visium.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
vxworks.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
wasm32.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
x86-64.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
xgate.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
xstormy16.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
xtensa.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
z80.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30