Detect .eh_frame_hdr earlier for SIZEOF_HEADERS

Current code detects the need for PT_GNU_EH_FRAME using a field set by
_bfd_elf_discard_section_eh_frame_hdr, which is called fairly late in
the linking process.  Use the elf hash table eh_info instead, which is
set up earlier by size_dynamic_sections.

	* elf-bfd.h (struct output_elf_obj_tdata): Delete eh_frame_hdr.
	(elf_eh_frame_hdr): Don't define.
	(_bfd_elf_discard_section_eh_frame_hdr): Update prototype.
	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Delete
	abfd parameter.  Don't set elf_eh_frame_hdr.
	* elf.c (elf_eh_frame_hdr): New function.
	(get_program_header_size): Adjust elf_eh_frame_hdr call.
	(_bfd_elf_map_sections_to_segments): Likewise.
This commit is contained in:
Alan Modra
2022-02-04 19:30:47 +10:30
parent 06c441ccef
commit 8df52eeeb0
4 changed files with 19 additions and 11 deletions

View File

@ -14888,7 +14888,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
if (info->eh_frame_hdr_type
&& !bfd_link_relocatable (info)
&& _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info))
&& _bfd_elf_discard_section_eh_frame_hdr (info))
changed = 1;
return changed;