Detect .eh_frame_hdr earlier for SIZEOF_HEADERS
authorAlan Modra <amodra@gmail.com>
Fri, 4 Feb 2022 09:00:47 +0000 (19:30 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 5 Feb 2022 06:15:38 +0000 (16:45 +1030)
commit8df52eeeb06efcccd6b840689ad8e11ebb264e7f
treed44d46440c42aa85341f01f73302b853ae0fb19e
parent06c441cceffb1437a3af51bfad43dce5fd200d9e
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.
bfd/elf-bfd.h
bfd/elf-eh-frame.c
bfd/elf.c
bfd/elflink.c