aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-01-07 13:43:56 +1030
committerAlan Modra <amodra@gmail.com>2022-01-07 13:46:01 +1030
commit6540edd52cc061071e1ad02c381e85de41bded1f (patch)
tree6b1c56b90dd7bdec1509deb11f096be389ce8d38 /bfd/elflink.c
parentd794dc3eb453af6d21d7d5c751ad004ba30c2e8d (diff)
downloadfsf-binutils-gdb-6540edd52cc061071e1ad02c381e85de41bded1f.zip
fsf-binutils-gdb-6540edd52cc061071e1ad02c381e85de41bded1f.tar.gz
fsf-binutils-gdb-6540edd52cc061071e1ad02c381e85de41bded1f.tar.bz2
Move elf_backend_always_size_sections earlier
* elflink.c (bfd_elf_size_dynamic_sections): Move plt/got init earlier and call elf_backend_always_size_sections at the start of this function.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 553efa2..08c1617 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -6506,6 +6506,21 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
if (!is_elf_hash_table (info->hash))
return true;
+ /* Any syms created from now on start with -1 in
+ got.refcount/offset and plt.refcount/offset. */
+ elf_hash_table (info)->init_got_refcount
+ = elf_hash_table (info)->init_got_offset;
+ elf_hash_table (info)->init_plt_refcount
+ = elf_hash_table (info)->init_plt_offset;
+
+ bed = get_elf_backend_data (output_bfd);
+
+ /* The backend may have to create some sections regardless of whether
+ we're dynamic or not. */
+ if (bed->elf_backend_always_size_sections
+ && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
+ return false;
+
dynobj = elf_hash_table (info)->dynobj;
if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created)
@@ -6864,8 +6879,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
}
}
- bed = get_elf_backend_data (output_bfd);
-
if (info->gc_sections && bed->can_gc_sections)
{
struct elf_gc_sweep_symbol_info sweep_info;
@@ -6987,23 +7000,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
}
}
- /* Any syms created from now on start with -1 in
- got.refcount/offset and plt.refcount/offset. */
- elf_hash_table (info)->init_got_refcount
- = elf_hash_table (info)->init_got_offset;
- elf_hash_table (info)->init_plt_refcount
- = elf_hash_table (info)->init_plt_offset;
-
if (bfd_link_relocatable (info)
&& !_bfd_elf_size_group_sections (info))
return false;
- /* The backend may have to create some sections regardless of whether
- we're dynamic or not. */
- if (bed->elf_backend_always_size_sections
- && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
- return false;
-
/* Determine any GNU_STACK segment requirements, after the backend
has had a chance to set a default segment size. */
if (info->execstack)