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>
5 files changed