arm: delay setting of plt header and entry size
elf32_arm_create_dynamic_sections was used to set plt_header_size and
plt_entry_size. This necessitated a hack for using_thumb_only() as
the output file attributes used by that function are not set until
lang_check calls bfd_merge_private_bfd_data. Now the earliest use of
plt_header_size and plt_entry_size is in elf32_arm_late_size_sections,
called from bfd_elf_size_dynamic_sections. So this patch moves the
initialisation of these variables to elf32_arm_late_size_sections.
Initialising them there is after lang_check runs, and also guarantees
they are initialised for all later uses too.
The patch also moves initialisation of htab->stub_bfd earlier, and
calls to add_glue_sections_to_bfd and get_bfd_for_interworking from
ld/armelf.em to bfd/elf32-arm.c. I removed an abort in
elf32_arm_create_dynamic_sections too. It really doesn't improve
confidence that much to check that a function you have just called to
create dynamic sections has done its job.
PR 16017
bfd/
* elf32-arm.c (elf32_arm_plt_needs_thumb_stub_p): Formatting.
(elf32_arm_create_dynamic_sections): Remove abort. Move
initialisation of plt_header_size and plt_entry_size to..
(elf32_arm_late_size_sections): ..here.
(bfd_elf32_arm_add_glue_sections_to_bfd),
(bfd_elf32_arm_get_bfd_for_interworking): Make static.
(bfd_elf32_arm_set_target_params): Add stub_bfd param. Remove
output_bfd param. Make params const. Init globals->stub_bfd.
Set flags and EI_CLASS for stub_bfd. Call
add_glue_sections_to_bfd and get_bfd_for_interworking.
* elf32-arm.h (bfd_elf32_arm_add_glue_sections_to_bfd),
(bfd_elf32_arm_get_bfd_for_interworking): Delete declarations.
(bfd_elf32_arm_set_target_params): Update prototype.
ld/
* emultempl/armelf.em (arm_elf_create_output_section_statements):
Don't set stub bfd flags here, or call
add_glue_sections_to_bfd and get_bfd_for_interworking. Pass
stub bfd to set_target_params.
3 files changed