aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-lm32.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-03-28 19:25:42 +1030
committerAlan Modra <amodra@gmail.com>2024-04-02 10:32:04 +1030
commitaf969b14aedcc0ae27dcefab4327ff2d153dec8b (patch)
tree0798575242610edd85068427a07f486ee5750660 /bfd/elf32-lm32.c
parentf37f8c46c2e876a524301d6916a04cf7debb6483 (diff)
downloadgdb-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-lm32.c')
-rw-r--r--bfd/elf32-lm32.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index b0eaa06..e62e5fd 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -1904,8 +1904,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* Set the sizes of the dynamic sections. */
static bool
-lm32_elf_size_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
+lm32_elf_late_size_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
{
struct elf_lm32_link_hash_table *htab;
bfd *dynobj;
@@ -1918,7 +1918,8 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
return false;
dynobj = htab->root.dynobj;
- BFD_ASSERT (dynobj != NULL);
+ if (dynobj == NULL)
+ return true;
if (htab->root.dynamic_sections_created)
{
@@ -2307,7 +2308,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
}
static bool
-lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
+lm32_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info)
{
if (!bfd_link_relocatable (info))
{
@@ -2393,7 +2394,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
#define bfd_elf32_bfd_link_hash_table_create lm32_elf_link_hash_table_create
#define elf_backend_check_relocs lm32_elf_check_relocs
#define elf_backend_reloc_type_class lm32_elf_reloc_type_class
-#define elf_backend_size_dynamic_sections lm32_elf_size_dynamic_sections
+#define elf_backend_late_size_sections lm32_elf_late_size_sections
#define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all
#define elf_backend_create_dynamic_sections lm32_elf_create_dynamic_sections
#define elf_backend_finish_dynamic_sections lm32_elf_finish_dynamic_sections
@@ -2414,8 +2415,8 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
#undef elf32_bed
#define elf32_bed elf32_lm32fdpic_bed
-#undef elf_backend_always_size_sections
-#define elf_backend_always_size_sections lm32_elf_always_size_sections
+#undef elf_backend_early_size_sections
+#define elf_backend_early_size_sections lm32_elf_early_size_sections
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data lm32_elf_fdpic_copy_private_bfd_data