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/elf-bfd.h | |
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/elf-bfd.h')
-rw-r--r-- | bfd/elf-bfd.h | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index af507b9..7ad171d 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1187,7 +1187,7 @@ struct elf_backend_data /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend linker for every symbol which is defined by a dynamic object and referenced by a regular object. This is called after all the - input files have been seen, but before the SIZE_DYNAMIC_SECTIONS + input files have been seen, but before the LATE_SIZE_SECTIONS function has been called. The hash table entry should be bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be defined in a section from a dynamic object. Dynamic object @@ -1199,24 +1199,23 @@ struct elf_backend_data bool (*elf_backend_adjust_dynamic_symbol) (struct bfd_link_info *info, struct elf_link_hash_entry *h); - /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker - after all the linker input files have been seen but before the - section sizes have been set. This is called after - ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ - bool (*elf_backend_always_size_sections) + /* The EARLY_SIZE_SECTIONS and LATE_SIZE_SECTIONS functions are + called by the backend linker after all linker input files have + been seen and sections have been assigned to output sections, but + before the section sizes have been set. Both of these functions + are called even when no dynamic object is seen by the linker. + Between them, they must set the sizes of the dynamic sections and + other backend specific sections, and may fill in their contents. + Most backends need only use LATE_SIZE_SECTIONS. + EARLY_SIZE_SECTIONS is called before --export-dynamic makes some + symbols dynamic and before ADJUST_DYNAMIC_SYMBOL processes + dynamic symbols, LATE_SIZE_SECTIONS afterwards. The generic ELF + linker can handle the .dynsym, .dynstr and .hash sections. + Besides those, these functions must handle the .interp section + and any other sections created by CREATE_DYNAMIC_SECTIONS. */ + bool (*elf_backend_early_size_sections) (bfd *output_bfd, struct bfd_link_info *info); - - /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend - linker after all the linker input files have been seen but before - the sections sizes have been set. This is called after - ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. - It is only called when linking against a dynamic object. It must - set the sizes of the dynamic sections, and may fill in their - contents as well. The generic ELF linker can handle the .dynsym, - .dynstr and .hash sections. This function must handle the - .interp section and any sections created by the - CREATE_DYNAMIC_SECTIONS entry point. */ - bool (*elf_backend_size_dynamic_sections) + bool (*elf_backend_late_size_sections) (bfd *output_bfd, struct bfd_link_info *info); /* The STRIP_ZERO_SIZED_DYNAMIC_SECTIONS function is called by the |