From af969b14aedcc0ae27dcefab4327ff2d153dec8b Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 28 Mar 2024 19:25:42 +1030 Subject: PR 30569, always call elf_backend_size_dynamic_sections This largely mechanical patch is preparation for a followup patch. For quite some time I've thought that it would be useful to call elf_backend_size_dynamic_sections even when no dynamic objects are seen by the linker. That's what this patch does, with some renaming. There are no functional changes to the linker, just a move of the dynobj test in bfd_elf_size_dynamic_sections to target backend functions, replacing the asserts/aborts already there. No doubt some of the current always_size_sections functions could be moved to size_dynamic_sections but I haven't made that change. Because both hooks are now always called, I have renamed always_size_sections to early_size_sections and size_dynamic_sections to late_size_sections. I condisdered calling late_size_sections plain size_sections, since this is the usual target dynamic section sizing hook, but decided that searching the sources for "size_sections" would then hit early_size_sections and other functions. --- bfd/elf32-tic6x.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bfd/elf32-tic6x.c') diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index afd8e0d..5c00318 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -3160,7 +3160,7 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Set the sizes of the dynamic sections. */ static bool -elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) +elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) { struct elf32_tic6x_link_hash_table *htab; bfd *dynobj; @@ -3171,7 +3171,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) htab = elf32_tic6x_hash_table (info); dynobj = htab->elf.dynobj; if (dynobj == NULL) - abort (); + return true; if (htab->elf.dynamic_sections_created) { @@ -3358,7 +3358,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) and the input sections have been assigned to output sections. */ static bool -elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf32_tic6x_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) { if (elf32_tic6x_using_dsbt (output_bfd) && !bfd_link_relocatable (info) && !bfd_elf_stack_segment_size (output_bfd, info, @@ -4261,10 +4261,10 @@ elf32_tic6x_write_section (bfd *output_bfd, #define elf_backend_relocs_compatible _bfd_elf_relocs_compatible #define elf_backend_finish_dynamic_symbol \ elf32_tic6x_finish_dynamic_symbol -#define elf_backend_always_size_sections \ - elf32_tic6x_always_size_sections -#define elf_backend_size_dynamic_sections \ - elf32_tic6x_size_dynamic_sections +#define elf_backend_early_size_sections \ + elf32_tic6x_early_size_sections +#define elf_backend_late_size_sections \ + elf32_tic6x_late_size_sections #define elf_backend_finish_dynamic_sections \ elf32_tic6x_finish_dynamic_sections #define bfd_elf32_bfd_final_link \ -- cgit v1.1