]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
s390: Generate .eh_frame unwind information for .plt section
authorJens Remus <jremus@linux.ibm.com>
Mon, 27 Jan 2025 15:47:10 +0000 (16:47 +0100)
committerJens Remus <jremus@linux.ibm.com>
Mon, 27 Jan 2025 15:47:10 +0000 (16:47 +0100)
commit98d9fe6cb62ee17366fb4073cd04a85193f0ab6b
tree3a2f7fc0033d88e98920fc7a2dcc3948e1c6e98c
parent6dbc8a3ef46c1d7889d65d8bc787ef095fed04c6
s390: Generate .eh_frame unwind information for .plt section

Enable unwinding using .eh_frame information through PLT entries.  Based
on x86-64.

This enhances stack traces if the instruction pointer is in a PLT entry.
For instance perf call graphs, when using --call-graph=dwarf, and Glibc
backtraces, when using backtrace() e.g. from a signal handler.
Note that GDB could already unwind through PLT entries using its s390-
specific prologue unwinder.

Furthermore this lays the foundation to generate SFrame information for
the PLT section in the future.

bfd/
* elf64-s390.c: Include dwarf2.h.
(PLT_CIE_SIZE, PLT_FDE_SIZE,
PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET,
elf_s390x_eh_frame_plt): New .eh_frame template for .plt
section.
(elf_s390_link_hash_table): Add plt_eh_frame field.
(elf_s390_create_dynamic_sections): New s390-specific wrapper
around _bfd_elf_create_dynamic_sections.  Create .eh_frame
section for .plt section.
(elf_backend_create_dynamic_sections): Register s390-specific
elf_s390_create_dynamic_sections.
(elf_s390_late_size_sections): Fill in .eh_frame section for
.plt section.  Write .plt section size into .eh_frame FDE
covering .plt section.
(elf_s390_finish_dynamic_sections): Write .plt section start
into .eh_frame FDE covering .plt section.  Call
_bfd_elf_write_section_eh_frame on on htab->plt_eh_frame
section.

ld/
* NEWS: Add news entry.
* emulparams/elf64_s390.sh: Include plt_unwind.sh.

ld/testsuite/
* ld-s390/plt_64-1_eh.wf: New PLT .eh_frame generation test.
* ld-s390/s390.exp: Link some existing test cases with
--no-ld-generated-unwind-info so that they do not fail.  Run
new PLT .eh_frame generation test.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
bfd/elf64-s390.c
ld/NEWS
ld/emulparams/elf64_s390.sh
ld/testsuite/ld-s390/plt_64-1_eh.wf [new file with mode: 0644]
ld/testsuite/ld-s390/s390.exp