diff options
author | Alan Modra <amodra@gmail.com> | 2024-03-28 19:25:42 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-04-02 10:32:04 +1030 |
commit | af969b14aedcc0ae27dcefab4327ff2d153dec8b (patch) | |
tree | 0798575242610edd85068427a07f486ee5750660 /bfd/elf32-bfin.c | |
parent | f37f8c46c2e876a524301d6916a04cf7debb6483 (diff) | |
download | gdb-af969b14aedcc0ae27dcefab4327ff2d153dec8b.zip gdb-af969b14aedcc0ae27dcefab4327ff2d153dec8b.tar.gz gdb-af969b14aedcc0ae27dcefab4327ff2d153dec8b.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf32-bfin.c')
-rw-r--r-- | bfd/elf32-bfin.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 7840252..f0e650d 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -4027,8 +4027,8 @@ _bfinfdpic_size_got_plt (bfd *output_bfd, /* Set the sizes of the dynamic sections. */ static bool -elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_bfinfdpic_late_size_sections (bfd *output_bfd, + struct bfd_link_info *info) { struct elf_link_hash_table *htab; bfd *dynobj; @@ -4037,7 +4037,8 @@ elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd, htab = elf_hash_table (info); dynobj = htab->dynobj; - BFD_ASSERT (dynobj != NULL); + if (dynobj == NULL) + return true; if (htab->dynamic_sections_created) { @@ -4086,7 +4087,7 @@ elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd, } static bool -elf32_bfinfdpic_always_size_sections (bfd *output_bfd, +elf32_bfinfdpic_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) { if (!bfd_link_relocatable (info) @@ -5123,15 +5124,16 @@ bfin_discard_copies (struct elf_link_hash_entry *h, void * inf) } static bool -bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +bfin_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { bfd *dynobj; asection *s; bool relocs; dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); + if (dynobj == NULL) + return true; if (elf_hash_table (info)->dynamic_sections_created) { @@ -5423,8 +5425,7 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] = #define elf_backend_check_relocs bfin_check_relocs #define elf_backend_adjust_dynamic_symbol \ bfin_adjust_dynamic_symbol -#define elf_backend_size_dynamic_sections \ - bfin_size_dynamic_sections +#define elf_backend_late_size_sections bfin_late_size_sections #define elf_backend_relocate_section bfin_relocate_section #define elf_backend_finish_dynamic_symbol \ bfin_finish_dynamic_symbol @@ -5470,9 +5471,9 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] = #undef bfd_elf32_bfd_link_hash_table_create #define bfd_elf32_bfd_link_hash_table_create \ bfinfdpic_elf_link_hash_table_create -#undef elf_backend_always_size_sections -#define elf_backend_always_size_sections \ - elf32_bfinfdpic_always_size_sections +#undef elf_backend_early_size_sections +#define elf_backend_early_size_sections \ + elf32_bfinfdpic_early_size_sections #undef elf_backend_create_dynamic_sections #define elf_backend_create_dynamic_sections \ @@ -5480,9 +5481,9 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] = #undef elf_backend_adjust_dynamic_symbol #define elf_backend_adjust_dynamic_symbol \ elf32_bfinfdpic_adjust_dynamic_symbol -#undef elf_backend_size_dynamic_sections -#define elf_backend_size_dynamic_sections \ - elf32_bfinfdpic_size_dynamic_sections +#undef elf_backend_late_size_sections +#define elf_backend_late_size_sections \ + elf32_bfinfdpic_late_size_sections #undef elf_backend_finish_dynamic_symbol #define elf_backend_finish_dynamic_symbol \ elf32_bfinfdpic_finish_dynamic_symbol |