[binutils-gdb] Drop output bfd param from many elf linker functions
Alan Modra via Binutils-cvs <[email protected]> Sat, 6 Jun 2026 01:39:24 +0000 (GMT)
| Newsgroups | gmane.comp.gnu.binutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f9c26587f19ebfacc8c55caa72120833dad7ee45 commit f9c26587f19ebfacc8c55caa72120833dad7ee45 Author: Alan Modra <[email protected]> Date: Sat Jun 6 11:06:40 2026 +0930 Drop output bfd param from many elf linker functions Functions that are always passed a non-NULL bfd_link_info* and are not called by BFD_SEND using the output bfd, need not pass the output bfd as a parameter. It can be accessed via info->output_bfd. Removing the excess parameters result in a small code size reduction on x86_64-linux --enable-targets=all ld built with a static libbfd, from 9896133 to 9893805 bytes. Diff: --- bfd/elf-bfd.h | 65 +++++---- bfd/elf-m10200.c | 14 +- bfd/elf-m10300.c | 69 +++++---- bfd/elf-vxworks.c | 14 +- bfd/elf-vxworks.h | 8 +- bfd/elf.c | 8 +- bfd/elf32-arc.c | 55 +++----- bfd/elf32-arm.c | 173 +++++++++++------------ bfd/elf32-avr.c | 8 +- bfd/elf32-bfin.c | 146 ++++++++++--------- bfd/elf32-cr16.c | 34 +++-- bfd/elf32-cris.c | 109 +++++++------- bfd/elf32-crx.c | 23 +-- bfd/elf32-csky.c | 111 +++++++-------- bfd/elf32-d10v.c | 7 +- bfd/elf32-epiphany.c | 3 +- bfd/elf32-fr30.c | 6 +- bfd/elf32-frv.c | 121 ++++++++-------- bfd/elf32-ft32.c | 18 +-- bfd/elf32-h8300.c | 13 +- bfd/elf32-hppa.c | 68 ++++----- bfd/elf32-i386.c | 185 ++++++++++++------------ bfd/elf32-ip2k.c | 3 +- bfd/elf32-iq2000.c | 7 +- bfd/elf32-lm32.c | 103 +++++++------- bfd/elf32-m32c.c | 11 +- bfd/elf32-m32r.c | 101 +++++++------ bfd/elf32-m68hc1x.c | 3 +- bfd/elf32-m68hc1x.h | 2 +- bfd/elf32-m68k.c | 68 +++++---- bfd/elf32-mcore.c | 6 +- bfd/elf32-mep.c | 6 +- bfd/elf32-metag.c | 109 +++++++------- bfd/elf32-microblaze.c | 73 +++++----- bfd/elf32-moxie.c | 6 +- bfd/elf32-msp430.c | 6 +- bfd/elf32-mt.c | 10 +- bfd/elf32-nds32.c | 134 +++++++++--------- bfd/elf32-or1k.c | 65 +++++---- bfd/elf32-ppc.c | 160 ++++++++++----------- bfd/elf32-ppc.h | 2 +- bfd/elf32-pru.c | 6 +- bfd/elf32-rl78.c | 12 +- bfd/elf32-rx.c | 24 ++-- bfd/elf32-s390.c | 129 ++++++++--------- bfd/elf32-score.c | 135 +++++++++--------- bfd/elf32-score.h | 12 +- bfd/elf32-score7.c | 73 +++++----- bfd/elf32-sh.c | 217 ++++++++++++++-------------- bfd/elf32-spu.c | 15 +- bfd/elf32-tic6x.c | 91 ++++++------ bfd/elf32-tilepro.c | 98 ++++++------- bfd/elf32-v850.c | 8 +- bfd/elf32-vax.c | 64 ++++----- bfd/elf32-visium.c | 6 +- bfd/elf32-xstormy16.c | 12 +- bfd/elf32-xtensa.c | 64 ++++----- bfd/elf32-z80.c | 8 +- bfd/elf64-alpha.c | 95 ++++++------- bfd/elf64-bpf.c | 3 +- bfd/elf64-hppa.c | 63 ++++----- bfd/elf64-ia64-vms.c | 60 ++++---- bfd/elf64-mmix.c | 8 +- bfd/elf64-ppc.c | 83 ++++++----- bfd/elf64-s390.c | 146 ++++++++++--------- bfd/elf64-sparc.c | 3 +- bfd/elf64-x86-64.c | 255 ++++++++++++++++----------------- bfd/elflink.c | 253 ++++++++++++++++----------------- bfd/elfnn-aarch64.c | 111 +++++++-------- bfd/elfnn-ia64.c | 59 ++++---- bfd/elfnn-kvx.c | 74 +++++----- bfd/elfnn-loongarch.c | 143 ++++++++++--------- bfd/elfnn-riscv.c | 116 +++++++-------- bfd/elfxx-mips.c | 330 ++++++++++++++++++++++--------------------- bfd/elfxx-mips.h | 10 +- bfd/elfxx-sparc.c | 186 ++++++++++++------------ bfd/elfxx-sparc.h | 10 +- bfd/elfxx-target.h | 2 +- bfd/elfxx-tilegx.c | 106 +++++++------- bfd/elfxx-tilegx.h | 12 +- bfd/elfxx-x86.c | 72 +++++----- bfd/elfxx-x86.h | 6 +- ld/emultempl/aarch64elf.em | 2 +- ld/emultempl/armelf.em | 2 +- ld/emultempl/cskyelf.em | 2 +- ld/emultempl/elf.em | 2 +- ld/emultempl/hppaelf.em | 2 +- ld/emultempl/kvxelf.em | 2 +- ld/emultempl/loongarchelf.em | 2 +- ld/emultempl/metagelf.em | 2 +- ld/emultempl/ppc32elf.em | 2 +- ld/emultempl/ppc64elf.em | 2 +- ld/emultempl/riscvelf.em | 2 +- ld/emultempl/tic6xdsbt.em | 2 +- ld/emultempl/vms.em | 5 +- ld/ldelf.c | 17 ++- 96 files changed, 2653 insertions(+), 2706 deletions(-) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 12ac3f362c0..879dd62dbd6 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1179,7 +1179,7 @@ struct elf_backend_data /* When creating a shared library, determine whether to omit the dynamic symbol for the section. */ bool (*elf_backend_omit_section_dynsym) - (bfd *output_bfd, struct bfd_link_info *info, asection *osec); + (struct bfd_link_info *info, asection *osec); /* Return TRUE if relocations of targets are compatible to the extent that CHECK_RELOCS will properly process them. PR 4424. */ @@ -1251,9 +1251,9 @@ struct elf_backend_data 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); + (struct bfd_link_info *info); bool (*elf_backend_late_size_sections) - (bfd *output_bfd, struct bfd_link_info *info); + (struct bfd_link_info *info); /* The STRIP_ZERO_SIZED_DYNAMIC_SECTIONS function is called by the ELF backend linker to strip zero-sized dynamic sections after @@ -1264,7 +1264,7 @@ struct elf_backend_data /* Set TEXT_INDEX_SECTION and DATA_INDEX_SECTION, the output sections we keep to use as a base for relocs and symbols. */ void (*elf_backend_init_index_section) - (bfd *output_bfd, struct bfd_link_info *info); + (struct bfd_link_info *info); /* The RELOCATE_SECTION function is called by the ELF backend linker to handle the relocations for a section. @@ -1298,7 +1298,7 @@ struct elf_backend_data Returns FALSE on error, TRUE on success, 2 if successful and relocations should be written for this section. */ int (*elf_backend_relocate_section) - (bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd, + (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, asection **local_sections); @@ -1310,7 +1310,7 @@ struct elf_backend_data all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called on those symbols which are defined by a dynamic object. */ bool (*elf_backend_finish_dynamic_symbol) - (bfd *output_bfd, struct bfd_link_info *info, + (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym); /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend @@ -1318,7 +1318,7 @@ struct elf_backend_data output file. The FINISH_DYNAMIC_SYMBOL will have been called on all dynamic symbols. */ bool (*elf_backend_finish_dynamic_sections) - (bfd *output_bfd, struct bfd_link_info *info, bfd_byte *); + (struct bfd_link_info *info, bfd_byte *); /* A function to do any beginning processing needed for the ELF file before building the ELF headers and computing file positions. */ @@ -1386,7 +1386,7 @@ struct elf_backend_data section. It allows the backend to emit special local symbols not handled in the hash table. */ bool (*elf_backend_output_arch_local_syms) - (bfd *, struct bfd_link_info *, void *, + (struct bfd_link_info *, void *, int (*) (void *, const char *, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *)); @@ -1394,14 +1394,14 @@ struct elf_backend_data into the symtab section. It allows the backend to emit special global symbols not handled in the hash table. */ bool (*elf_backend_output_arch_syms) - (bfd *, struct bfd_link_info *, void *, + (struct bfd_link_info *, void *, int (*) (void *, const char *, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *)); /* Filter what symbols of the output file to include in the import library if one is created. */ unsigned int (*elf_backend_filter_implib_symbols) - (bfd *, struct bfd_link_info *, asymbol **, long); + (struct bfd_link_info *, asymbol **, long); /* Copy any information related to dynamic linking from a pre-existing symbol to a newly created symbol. Also called to copy flags and @@ -1641,9 +1641,10 @@ struct elf_backend_data /* The size of the GOT entry for the symbol pointed to by H if non-NULL, otherwise by the local symbol with index SYMNDX in IBFD. */ - bfd_vma (*got_elt_size) (bfd *, struct bfd_link_info *, + bfd_vma (*got_elt_size) (struct bfd_link_info *, struct elf_link_hash_entry *h, - bfd *ibfd, unsigned long symndx); + bfd *ibfd, + unsigned long symndx); /* The vendor name to use for a processor-standard attributes section. */ const char *obj_attrs_vendor; @@ -2459,7 +2460,7 @@ extern bool _bfd_elf_section_already_linked extern void bfd_elf_set_group_contents (bfd *, asection *, void *); extern unsigned int _bfd_elf_filter_global_symbols - (bfd *, struct bfd_link_info *, asymbol **, long) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, asymbol **, long) ATTRIBUTE_HIDDEN; extern asection *_bfd_elf_check_kept_section (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; #define _bfd_elf_link_just_syms _bfd_generic_link_just_syms @@ -2593,7 +2594,7 @@ extern void _bfd_elf_strtab_finalize (struct elf_strtab_hash *) ATTRIBUTE_HIDDEN; extern bool bfd_elf_parse_eh_frame_entries - (bfd *, struct bfd_link_info *); + (struct bfd_link_info *); extern bool _bfd_elf_parse_eh_frame_entry (struct bfd_link_info *, asection *, struct elf_reloc_cookie *) ATTRIBUTE_HIDDEN; @@ -2701,19 +2702,18 @@ extern bool _bfd_elf_validate_reloc (bfd *, arelent *) ATTRIBUTE_HIDDEN; extern bool bfd_elf_record_link_assignment - (bfd *, struct bfd_link_info *, const char *, bool, - bool); -extern bool bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, + (struct bfd_link_info *, const char *, bool, bool); +extern bool bfd_elf_stack_segment_size (struct bfd_link_info *, const char *, bfd_vma); extern bool bfd_elf_size_dynamic_sections - (bfd *, const char *, const char *, const char *, const char *, const char *, - const char * const *, struct bfd_link_info *, struct bfd_section **); + (struct bfd_link_info *, const char *, const char *, const char *, + const char *, const char *, const char * const *, struct bfd_section **); extern bool bfd_elf_size_dynsym_hash_dynstr - (bfd *, struct bfd_link_info *); + (struct bfd_link_info *); extern bool bfd_elf_get_bfd_needed_list (bfd *, struct bfd_link_needed_list **); extern struct bfd_link_needed_list *bfd_elf_get_needed_list - (bfd *, struct bfd_link_info *); + (struct bfd_link_info *); extern void bfd_elf_set_dt_needed_name (bfd *, const char *); extern const char *bfd_elf_get_dt_soname @@ -2723,20 +2723,20 @@ extern void bfd_elf_set_dyn_lib_class extern int bfd_elf_get_dyn_lib_class (bfd *); extern struct bfd_link_needed_list *bfd_elf_get_runpath_list - (bfd *, struct bfd_link_info *); + (struct bfd_link_info *); extern int bfd_elf_discard_info - (bfd *, struct bfd_link_info *); + (struct bfd_link_info *); extern unsigned int _bfd_elf_default_action_discarded (struct bfd_section *) ATTRIBUTE_HIDDEN; extern struct bfd_section *bfd_elf_tls_setup - (bfd *, struct bfd_link_info *); + (struct bfd_link_info *); extern bool bfd_elf_link_create_dynamic_sections (bfd *, struct bfd_link_info *); extern bool _bfd_elf_omit_section_dynsym_default - (bfd *, struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN; extern bool _bfd_elf_omit_section_dynsym_all - (bfd *, struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN; extern bool _bfd_elf_create_dynamic_sections (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern bool _bfd_elf_create_got_section @@ -2745,10 +2745,12 @@ extern asection *_bfd_elf_section_for_symbol (struct elf_reloc_cookie *, unsigned long) ATTRIBUTE_HIDDEN; extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym (bfd *, struct bfd_link_info *, asection *, const char *) ATTRIBUTE_HIDDEN; +extern void _bfd_elf_init_0_index_sections + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern void _bfd_elf_init_1_index_section - (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern void _bfd_elf_init_2_index_sections - (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern bool _bfd_elfcore_make_pseudosection (bfd *, char *, size_t, ufile_ptr) ATTRIBUTE_HIDDEN; @@ -2942,7 +2944,7 @@ extern asection *_bfd_elf_common_section (asection *) ATTRIBUTE_HIDDEN; extern bfd_vma _bfd_elf_default_got_elt_size - (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, bfd *, + (struct bfd_link_info *, struct elf_link_hash_entry *, bfd *, unsigned long) ATTRIBUTE_HIDDEN; extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn @@ -2989,9 +2991,6 @@ extern bool _bfd_elf_gc_mark extern bool _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *, elf_gc_mark_hook_fn) ATTRIBUTE_HIDDEN; -extern bool bfd_elf_gc_common_finalize_got_offsets - (bfd *, struct bfd_link_info *); - extern bool _bfd_elf_gc_common_final_link (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; @@ -3387,7 +3386,7 @@ extern bool _bfd_elf_maybe_set_textrel (struct elf_link_hash_entry *, void *) ATTRIBUTE_HIDDEN; extern bool _bfd_elf_add_dynamic_tags - (bfd *, struct bfd_link_info *, bool) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, bool) ATTRIBUTE_HIDDEN; extern bool _bfd_elf_mmap_section_contents (bfd *abfd, asection *section, bfd_byte **buf) ATTRIBUTE_HIDDEN; diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index b5b4bae99f4..e8b3b5178ca 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -336,8 +336,7 @@ mn10200_elf_final_link_relocate (reloc_howto_type *howto, /* Relocate an MN10200 ELF section. */ static int -mn10200_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +mn10200_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -376,7 +375,8 @@ mn10200_elf_relocate_section (bfd *output_bfd, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -396,7 +396,7 @@ mn10200_elf_relocate_section (bfd *output_bfd, if (bfd_link_relocatable (info)) continue; - r = mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd, + r = mn10200_elf_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel->r_offset, relocation, rel->r_addend, @@ -1349,9 +1349,9 @@ mn10200_elf_get_relocated_section_contents (bfd *output_bfd, *secpp = isec; } - if (! mn10200_elf_relocate_section (output_bfd, link_info, input_bfd, - input_section, data, internal_relocs, - isymbuf, sections)) + if (! mn10200_elf_relocate_section (link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) goto error_return; free (sections); diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 0740a26c219..04cf702a067 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1959,8 +1959,7 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto, /* Relocate an MN10300 ELF section. */ static int -mn10300_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +mn10300_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2039,7 +2038,8 @@ mn10300_elf_relocate_section (bfd *output_bfd, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -2080,7 +2080,8 @@ mn10300_elf_relocate_section (bfd *output_bfd, relocation = 0; else if (!bfd_link_relocatable (info) && unresolved_reloc - && _bfd_elf_section_offset (output_bfd, info, input_section, + && _bfd_elf_section_offset (info->output_bfd, info, + input_section, rel->r_offset) != (bfd_vma) -1) _bfd_error_handler @@ -2102,7 +2103,7 @@ mn10300_elf_relocate_section (bfd *output_bfd, if (bfd_link_relocatable (info)) continue; - r = mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd, + r = mn10300_elf_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel->r_offset, relocation, rel->r_addend, @@ -4485,7 +4486,7 @@ mn10300_elf_get_relocated_section_contents (bfd *output_bfd, *secpp = isec; } - if (! mn10300_elf_relocate_section (output_bfd, link_info, input_bfd, + if (! mn10300_elf_relocate_section (link_info, input_bfd, input_section, data, internal_relocs, isymbuf, sections)) goto error_return; @@ -5007,8 +5008,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info, /* Set the sizes of the dynamic sections. */ static bool -_bfd_mn10300_elf_late_size_sections (bfd * output_bfd, - struct bfd_link_info * info) +_bfd_mn10300_elf_late_size_sections (struct bfd_link_info *info) { struct elf32_mn10300_link_hash_table *htab = elf32_mn10300_hash_table (info); bfd * dynobj; @@ -5118,15 +5118,14 @@ _bfd_mn10300_elf_late_size_sections (bfd * output_bfd, s->alloced = 1; } - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); + return _bfd_elf_add_dynamic_tags (info, relocs); } /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ static bool -_bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, - struct bfd_link_info * info, +_bfd_mn10300_elf_finish_dynamic_symbol (struct bfd_link_info * info, struct elf_link_hash_entry * h, Elf_Internal_Sym * sym) { @@ -5171,14 +5170,14 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, { memcpy (splt->contents + h->plt.offset, elf_mn10300_plt_entry, elf_mn10300_sizeof_plt (info)); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (sgot->output_section->vma + sgot->output_offset + got_offset), (splt->contents + h->plt.offset + elf_mn10300_plt_symbol_offset (info))); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (1 - h->plt.offset - elf_mn10300_plt_plt0_offset (info)), (splt->contents + h->plt.offset + elf_mn10300_plt_plt0_offset (info))); @@ -5188,17 +5187,17 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, memcpy (splt->contents + h->plt.offset, elf_mn10300_pic_plt_entry, elf_mn10300_sizeof_plt (info)); - bfd_put_32 (output_bfd, got_offset, + bfd_put_32 (info->output_bfd, got_offset, (splt->contents + h->plt.offset + elf_mn10300_plt_symbol_offset (info))); } - bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), + bfd_put_32 (info->output_bfd, plt_index * sizeof (Elf32_External_Rela), (splt->contents + h->plt.offset + elf_mn10300_plt_reloc_offset (info))); /* Fill in the entry in the global offset table. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (splt->output_section->vma + splt->output_offset + h->plt.offset @@ -5211,7 +5210,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, + got_offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_JMP_SLOT); rel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &rel, + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, (bfd_byte *) ((Elf32_External_Rela *) srel->contents + plt_index)); @@ -5239,11 +5238,11 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, switch (elf_mn10300_hash_entry (h)->tls_type) { case GOT_TLS_GD: - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset + 4); + bfd_put_32 (info->output_bfd, 0, sgot->contents + h->got.offset); + bfd_put_32 (info->output_bfd, 0, sgot->contents + h->got.offset + 4); rel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_TLS_DTPMOD); rel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, & rel, + bfd_elf32_swap_reloca_out (info->output_bfd, & rel, (bfd_byte *) ((Elf32_External_Rela *) srel->contents + srel->reloc_count)); ++ srel->reloc_count; @@ -5256,8 +5255,9 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, /* We originally stored the addend in the GOT, but at this point, we want to move it to the reloc instead as that's where the dynamic linker wants it. */ - rel.r_addend = bfd_get_32 (output_bfd, sgot->contents + h->got.offset); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rel.r_addend = bfd_get_32 (info->output_bfd, + sgot->contents + h->got.offset); + bfd_put_32 (info->output_bfd, 0, sgot->contents + h->got.offset); if (h->dynindx == -1) rel.r_info = ELF32_R_INFO (0, R_MN10300_TLS_TPOFF); else @@ -5281,7 +5281,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, } else { - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + bfd_put_32 (info->output_bfd, 0, sgot->contents + h->got.offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_GLOB_DAT); rel.r_addend = 0; } @@ -5289,7 +5289,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, if (ELF32_R_TYPE (rel.r_info) != R_MN10300_NONE) { - bfd_elf32_swap_reloca_out (output_bfd, &rel, + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, (bfd_byte *) ((Elf32_External_Rela *) srel->contents + srel->reloc_count)); ++ srel->reloc_count; @@ -5314,7 +5314,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, + h->root.u.def.section->output_offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_COPY); rel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, & rel, + bfd_elf32_swap_reloca_out (info->output_bfd, & rel, (bfd_byte *) ((Elf32_External_Rela *) s->contents + s->reloc_count)); ++ s->reloc_count; @@ -5331,8 +5331,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd, /* Finish up the dynamic sections. */ static bool -_bfd_mn10300_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_mn10300_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd * dynobj; @@ -5376,13 +5375,13 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd *output_bfd, s = htab->root.srelplt; get_vma: dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: s = htab->root.srelplt; dyn.d_un.d_val = s->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; } } @@ -5399,10 +5398,10 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd *output_bfd, else { memcpy (splt->contents, elf_mn10300_plt0_entry, PLT0_ENTRY_SIZE); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sgot->output_section->vma + sgot->output_offset + 4, splt->contents + elf_mn10300_plt0_gotid_offset (info)); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sgot->output_section->vma + sgot->output_offset + 8, splt->contents + elf_mn10300_plt0_linker_offset (info)); } @@ -5425,13 +5424,13 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd *output_bfd, if (sgot->size > 0) { if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + bfd_put_32 (info->output_bfd, 0, sgot->contents); else - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn->output_section->vma + sdyn->output_offset, sgot->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + bfd_put_32 (info->output_bfd, 0, sgot->contents + 4); + bfd_put_32 (info->output_bfd, 0, sgot->contents + 8); } elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c index e77cd9cc305..8266030805d 100644 --- a/bfd/elf-vxworks.c +++ b/bfd/elf-vxworks.c @@ -240,16 +240,16 @@ elf_vxworks_final_write_processing (bfd *abfd) tls sections. */ bool -elf_vxworks_add_dynamic_entries (bfd *output_bfd, struct bfd_link_info *info) +elf_vxworks_add_dynamic_entries (struct bfd_link_info *info) { - if (bfd_get_section_by_name (output_bfd, ".tls_data")) + if (bfd_get_section_by_name (info->output_bfd, ".tls_data")) { if (!_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_START, 0) || !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_SIZE, 0) || !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_ALIGN, 0)) return false; } - if (bfd_get_section_by_name (output_bfd, ".tls_vars")) + if (bfd_get_section_by_name (info->output_bfd, ".tls_vars")) { if (!_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_VARS_START, 0) || !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_VARS_SIZE, 0)) @@ -302,14 +302,12 @@ elf_vxworks_finish_dynamic_entry (bfd *output_bfd, Elf_Internal_Dyn *dyn) /* Add dynamic tags. */ bool -_bfd_elf_maybe_vxworks_add_dynamic_tags (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_elf_maybe_vxworks_add_dynamic_tags (struct bfd_link_info *info, bool need_dynamic_reloc) { struct elf_link_hash_table *htab = elf_hash_table (info); - return (_bfd_elf_add_dynamic_tags (output_bfd, info, - need_dynamic_reloc) + return (_bfd_elf_add_dynamic_tags (info, need_dynamic_reloc) && (!htab->dynamic_sections_created || htab->target_os != is_vxworks - || elf_vxworks_add_dynamic_entries (output_bfd, info))); + || elf_vxworks_add_dynamic_entries (info))); } diff --git a/bfd/elf-vxworks.h b/bfd/elf-vxworks.h index bcf55bcfdf4..992e238f132 100644 --- a/bfd/elf-vxworks.h +++ b/bfd/elf-vxworks.h @@ -35,16 +35,16 @@ bool elf_vxworks_final_write_processing bool elf_vxworks_create_dynamic_sections (bfd *, struct bfd_link_info *, asection **) ATTRIBUTE_HIDDEN; bool elf_vxworks_add_dynamic_entries - (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; bool elf_vxworks_finish_dynamic_entry (bfd *, Elf_Internal_Dyn *) ATTRIBUTE_HIDDEN; bool _bfd_elf_maybe_vxworks_add_dynamic_tags - (bfd *, struct bfd_link_info *, bool) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, bool) ATTRIBUTE_HIDDEN; #else /* !OBJ_MAYBE_ELF_VXWORKS */ static inline bool _bfd_elf_maybe_vxworks_add_dynamic_tags ( - bfd *output_bfd, struct bfd_link_info *info, bool need_dynamic_reloc) -{ return _bfd_elf_add_dynamic_tags (output_bfd, info, need_dynamic_reloc); } + struct bfd_link_info *info, bool need_dynamic_reloc) +{ return _bfd_elf_add_dynamic_tags (info, need_dynamic_reloc); } #endif /* OBJ_MAYBE_ELF_VXWORKS */ diff --git a/bfd/elf.c b/bfd/elf.c index 1c88c379ea0..1e1f09c8bbc 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -4455,15 +4455,15 @@ sym_is_global (bfd *abfd, asymbol *sym) || bfd_is_com_section (bfd_asymbol_section (sym))); } -/* Filter global symbols of ABFD to include in the import library. All - SYMCOUNT symbols of ABFD can be examined from their pointers in +/* Filter global symbols of INFO->OUTPUT_BFD to include in the import + library. SYMCOUNT symbols can be examined from their pointers in SYMS. Pointers of symbols to keep should be stored contiguously at the beginning of that array. Returns the number of symbols to keep. */ unsigned int -_bfd_elf_filter_global_symbols (bfd *abfd, struct bfd_link_info *info, +_bfd_elf_filter_global_symbols (struct bfd_link_info *info, asymbol **syms, long symcount) { long src_count, dst_count = 0; @@ -4474,7 +4474,7 @@ _bfd_elf_filter_global_symbols (bfd *abfd, struct bfd_link_info *info, char *name = (char *) bfd_asymbol_name (sym); struct bfd_link_hash_entry *h; - if (!sym_is_global (abfd, sym)) + if (!sym_is_global (info->output_bfd, sym)) continue; h = bfd_link_hash_lookup (info->hash, name, false, false, false); diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index cf0bc662790..52037e06508 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -1432,8 +1432,7 @@ arc_do_relocation (bfd_byte * contents, Function : elf_arc_relocate_section Brief : Relocate an arc section, by handling all the relocations appearing in that section. - Args : output_bfd : The bfd being written to. - info : Link information. + Args : info : Link information. input_bfd : The input bfd. input_section : The section being relocated. contents : contents of the section being relocated. @@ -1443,8 +1442,7 @@ arc_do_relocation (bfd_byte * contents, corresponding to the st_shndx field of each local symbol. */ static int -elf_arc_relocate_section (bfd * output_bfd, - struct bfd_link_info * info, +elf_arc_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -1631,7 +1629,7 @@ elf_arc_relocate_section (bfd * output_bfd, { asection *msec; msec = sec; - rel->r_addend = _bfd_elf_rel_local_sym (output_bfd, sym, + rel->r_addend = _bfd_elf_rel_local_sym (info->output_bfd, sym, &msec, rel->r_addend); rel->r_addend -= (sec->output_section->vma + sec->output_offset @@ -1697,7 +1695,7 @@ elf_arc_relocate_section (bfd * output_bfd, BFD_ASSERT (ah->got_ents); bfd_vma got_offset = ah->got_ents->offset; - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->sgot->contents + got_offset); } if (is_reloc_for_PLT (howto) && h->plt.offset != (bfd_vma) -1) @@ -1773,7 +1771,7 @@ elf_arc_relocate_section (bfd * output_bfd, = relocate_fix_got_relocs_for_got_info (list, tls_type_for_reloc (howto), info, - output_bfd, + info->output_bfd, r_symndx, local_syms, local_sections, @@ -1784,8 +1782,8 @@ elf_arc_relocate_section (bfd * output_bfd, { create_got_dynrelocs_for_single_entry ( got_entry_for_type (list, - arc_got_entry_type_for_reloc (howto)), - output_bfd, info, NULL); + arc_got_entry_type_for_reloc (howto)), + info->output_bfd, info, NULL); } } @@ -1816,7 +1814,7 @@ elf_arc_relocate_section (bfd * output_bfd, BFD_ASSERT (sreloc != NULL); - outrel.r_offset = _bfd_elf_section_offset (output_bfd, + outrel.r_offset = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); @@ -1872,7 +1870,7 @@ elf_arc_relocate_section (bfd * output_bfd, loc += sreloc->reloc_count * sizeof (Elf32_External_Rela); sreloc->reloc_count += 1; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); if (!relocate) continue; @@ -2469,14 +2467,13 @@ elf_arc_adjust_dynamic_symbol (struct bfd_link_info *info, Returns : True/False as the return status. */ static bool -elf_arc_finish_dynamic_symbol (bfd * output_bfd, - struct bfd_link_info *info, +elf_arc_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym * sym) { if (h->plt.offset != (bfd_vma) -1) { - relocate_plt_for_symbol (output_bfd, info, h); + relocate_plt_for_symbol (info->output_bfd, info, h); if (!h->def_regular) { @@ -2494,7 +2491,7 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd, struct elf_arc_link_hash_entry *ah = (struct elf_arc_link_hash_entry *) h; create_got_dynrelocs_for_got_info (&ah->got_ents, - output_bfd, + info->output_bfd, info, h); @@ -2523,7 +2520,7 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd, BFD_ASSERT (h->dynindx != -1); rel.r_info = ELF32_R_INFO (h->dynindx, R_ARC_COPY); - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -2579,15 +2576,10 @@ arc_create_forced_local_got_entries_for_tls (struct bfd_hash_entry *bh, /* Function : elf_arc_finish_dynamic_sections Brief : Finish up the dynamic sections handling. - Args : output_bfd : - info : - h : - sym : Returns : True/False as the return status. */ static bool -elf_arc_finish_dynamic_sections (bfd * output_bfd, - struct bfd_link_info *info, +elf_arc_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_link_hash_table *htab = elf_hash_table (info); @@ -2673,12 +2665,12 @@ elf_arc_finish_dynamic_sections (bfd * output_bfd, } if (do_it) - bfd_elf32_swap_dyn_out (output_bfd, &internal_dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &internal_dyn, dyncon); } if (htab->splt->size > 0) { - relocate_plt_for_entry (output_bfd, info); + relocate_plt_for_entry (info->output_bfd, info); } /* TODO: Validate this. */ @@ -2700,19 +2692,19 @@ elf_arc_finish_dynamic_sections (bfd * output_bfd, asection *sec = h->root.u.def.section; if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, sec->contents); else - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn->output_section->vma + sdyn->output_offset, sec->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sec->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sec->contents + 8); + bfd_put_32 (info->output_bfd, 0, sec->contents + 4); + bfd_put_32 (info->output_bfd, 0, sec->contents + 8); } } struct obfd_info_group group; - group.output_bfd = output_bfd; + group.output_bfd = info->output_bfd; group.info = info; bfd_hash_traverse (&info->hash->table, arc_create_forced_local_got_entries_for_tls, &group); @@ -2729,8 +2721,7 @@ elf_arc_finish_dynamic_sections (bfd * output_bfd, /* Set the sizes of the dynamic sections. */ static bool -elf_arc_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_arc_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -2819,7 +2810,7 @@ elf_arc_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s->alloced = 1; } - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs_exist); + return _bfd_elf_add_dynamic_tags (info, relocs_exist); } diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 0447d60de7b..63b908462b1 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -13011,8 +13011,7 @@ arm_add_to_rel (bfd * abfd, /* Relocate an ARM ELF section. */ static int -elf32_arm_relocate_section (bfd * output_bfd, - struct bfd_link_info * info, +elf32_arm_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -13152,9 +13151,9 @@ elf32_arm_relocate_section (bfd * output_bfd, } msec = sec; - addend = - _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) - - relocation; + addend = (_bfd_elf_rel_local_sym (info->output_bfd, + sym, &msec, addend) + - relocation); addend += msec->output_section->vma + msec->output_offset; /* Cases here must match those in the preceding @@ -13187,7 +13186,8 @@ elf32_arm_relocate_section (bfd * output_bfd, } } else - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -13279,7 +13279,7 @@ elf32_arm_relocate_section (bfd * output_bfd, h ? ARM_GET_SYM_BRANCH_TYPE (h->target_internal) : ARM_GET_SYM_BRANCH_TYPE (sym->st_target_internal); - r = elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, + r = elf32_arm_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel, relocation, info, sec, name, sym_type, branch_type, h, @@ -13293,7 +13293,7 @@ elf32_arm_relocate_section (bfd * output_bfd, if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 && h->def_dynamic) - && _bfd_elf_section_offset (output_bfd, info, input_section, + && _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) != (bfd_vma) -1) { _bfd_error_handler @@ -16625,8 +16625,7 @@ bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *info, /* Set the sizes of the dynamic sections. */ static bool -elf32_arm_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info) +elf32_arm_late_size_sections (struct bfd_link_info *info) { bfd * dynobj; asection * s; @@ -16878,7 +16877,9 @@ elf32_arm_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, && (local_iplt == NULL || local_iplt->arm.noncall_refcount == 0)) elf32_arm_allocate_irelocs (info, srel, 1); - else if (bfd_link_pic (info) || output_bfd->flags & DYNAMIC || htab->fdpic_p) + else if (bfd_link_pic (info) + || (info->output_bfd->flags & DYNAMIC) != 0 + || htab->fdpic_p) { if ((bfd_link_pic (info) && !(*local_tls_type & GOT_TLS_GDESC))) elf32_arm_allocate_dynrelocs (info, srel, 1); @@ -17039,15 +17040,14 @@ elf32_arm_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, s->alloced = 1; } - return _bfd_elf_maybe_vxworks_add_dynamic_tags (output_bfd, info, - relocs); + return _bfd_elf_maybe_vxworks_add_dynamic_tags (info, relocs); } /* Size sections even though they're not dynamic. We use it to setup _TLS_MODULE_BASE_, if needed. */ static bool -elf32_arm_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf32_arm_early_size_sections (struct bfd_link_info *info) { asection *tls_sec; struct elf32_arm_link_hash_table *htab; @@ -17069,10 +17069,10 @@ elf32_arm_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) if (tlsbase) { struct bfd_link_hash_entry *bh = NULL; - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); if (!(_bfd_generic_link_add_one_symbol - (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL, + (info, info->output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL, tls_sec, 0, NULL, false, bed->collect, &bh))) return false; @@ -17086,8 +17086,7 @@ elf32_arm_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) } if (htab->fdpic_p && !bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, - "__stacksize", DEFAULT_STACK_SIZE)) + && !bfd_elf_stack_segment_size (info, "__stacksize", DEFAULT_STACK_SIZE)) return false; return true; @@ -17097,8 +17096,7 @@ elf32_arm_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) dynamic sections here. */ static bool -elf32_arm_finish_dynamic_symbol (bfd * output_bfd, - struct bfd_link_info * info, +elf32_arm_finish_dynamic_symbol (struct bfd_link_info * info, struct elf_link_hash_entry * h, Elf_Internal_Sym * sym) { @@ -17114,8 +17112,8 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, if (!eh->is_iplt) { BFD_ASSERT (h->dynindx != -1); - if (! elf32_arm_populate_plt_entry (output_bfd, info, &h->plt, &eh->plt, - h->dynindx, 0)) + if (! elf32_arm_populate_plt_entry (info->output_bfd, info, &h->plt, + &eh->plt, h->dynindx, 0)) return false; } @@ -17142,7 +17140,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, sym->st_info = ELF_ST_INFO (ELF_ST_BIND (sym->st_info), STT_FUNC); ARM_SET_SYM_BRANCH_TYPE (sym->st_target_internal, ST_BRANCH_TO_ARM); sym->st_shndx = (_bfd_elf_section_from_bfd_section - (output_bfd, htab->root.iplt->output_section)); + (info->output_bfd, htab->root.iplt->output_section)); sym->st_value = (h->plt.offset + htab->root.iplt->output_section->vma + htab->root.iplt->output_offset); @@ -17168,7 +17166,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, s = htab->root.sreldynrelro; else s = htab->root.srelbss; - elf32_arm_add_dynreloc (output_bfd, info, s, &rel); + elf32_arm_add_dynreloc (info->output_bfd, info, s, &rel); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. On VxWorks, @@ -17204,7 +17202,7 @@ arm_put_trampoline (struct elf32_arm_link_hash_table *htab, bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, +elf32_arm_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd * dynobj; @@ -17250,8 +17248,8 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, default: #ifdef OBJ_MAYBE_ELF_VXWORKS if (htab->root.target_os == is_vxworks - && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn)) - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + && elf_vxworks_finish_dynamic_entry (info->output_bfd, &dyn)) + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); #endif /* OBJ_MAYBE_ELF_VXWORKS */ break; @@ -17278,14 +17276,14 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, return false; } dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: s = htab->root.srelplt; BFD_ASSERT (s != NULL); dyn.d_un.d_val = s->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_RELSZ: @@ -17298,14 +17296,14 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, s = htab->root.splt; dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset + htab->root.tlsdesc_plt); - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_TLSDESC_GOT: s = htab->root.sgot; dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset + htab->root.tlsdesc_got); - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; /* Set the bottom bit of DT_INIT/FINI if the @@ -17329,7 +17327,7 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, == ST_BRANCH_TO_THUMB) { dyn.d_un.d_val |= 1; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } } break; @@ -17354,19 +17352,19 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, Elf_Internal_Rela rel; plt0_entry = elf32_arm_vxworks_exec_plt0_entry; - put_arm_insn (htab, output_bfd, plt0_entry[0], + put_arm_insn (htab, info->output_bfd, plt0_entry[0], splt->contents + 0); - put_arm_insn (htab, output_bfd, plt0_entry[1], + put_arm_insn (htab, info->output_bfd, plt0_entry[1], splt->contents + 4); - put_arm_insn (htab, output_bfd, plt0_entry[2], + put_arm_insn (htab, info->output_bfd, plt0_entry[2], splt->contents + 8); - bfd_put_32 (output_bfd, got_address, splt->contents + 12); + bfd_put_32 (info->output_bfd, got_address, splt->contents + 12); /* Generate a relocation for _GLOBAL_OFFSET_TABLE_. */ rel.r_offset = plt_address + 12; rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32); rel.r_addend = 0; - SWAP_RELOC_OUT (htab) (output_bfd, &rel, + SWAP_RELOC_OUT (htab) (info->output_bfd, &rel, htab->srelplt2->contents); } else if (using_thumb_only (htab)) @@ -17374,42 +17372,45 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, got_displacement = got_address - (plt_address + 12); plt0_entry = elf32_thumb2_plt0_entry; - put_arm_insn (htab, output_bfd, plt0_entry[0], + put_arm_insn (htab, info->output_bfd, plt0_entry[0], splt->contents + 0); - put_arm_insn (htab, output_bfd, plt0_entry[1], + put_arm_insn (htab, info->output_bfd, plt0_entry[1], splt->contents + 4); - put_arm_insn (htab, output_bfd, plt0_entry[2], + put_arm_insn (htab, info->output_bfd, plt0_entry[2], splt->contents + 8); - bfd_put_32 (output_bfd, got_displacement, splt->contents + 12); + bfd_put_32 (info->output_bfd, got_displacement, + splt->contents + 12); } else { got_displacement = got_address - (plt_address + 16); plt0_entry = elf32_arm_plt0_entry; - put_arm_insn (htab, output_bfd, plt0_entry[0], + put_arm_insn (htab, info->output_bfd, plt0_entry[0], splt->contents + 0); - put_arm_insn (htab, output_bfd, plt0_entry[1], + put_arm_insn (htab, info->output_bfd, plt0_entry[1], splt->contents + 4); - put_arm_insn (htab, output_bfd, plt0_entry[2], + put_arm_insn (htab, info->output_bfd, plt0_entry[2], splt->contents + 8); - put_arm_insn (htab, output_bfd, plt0_entry[3], + put_arm_insn (htab, info->output_bfd, plt0_entry[3], splt->contents + 12); #ifdef FOUR_WORD_PLT /* The displacement value goes in the otherwise-unused last word of the second entry. */ - bfd_put_32 (output_bfd, got_displacement, splt->contents + 28); + bfd_put_32 (info->output_bfd, got_displacement, + splt->contents + 28); #else - bfd_put_32 (output_bfd, got_displacement, splt->contents + 16); + bfd_put_32 (info->output_bfd, got_displacement, + splt->contents + 16); #endif } } /* UnixWare sets the entsize of .plt to 4, although that doesn't really seem like the right value. */ - if (splt->output_section->owner == output_bfd) + if (splt->output_section->owner == info->output_bfd) elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; if (htab->root.tlsdesc_plt) @@ -17421,16 +17422,16 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, bfd_vma plt_address = splt->output_section->vma + splt->output_offset; - arm_put_trampoline (htab, output_bfd, + arm_put_trampoline (htab, info->output_bfd, splt->contents + htab->root.tlsdesc_plt, dl_tlsdesc_lazy_trampoline, 6); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, gotplt_address + htab->root.tlsdesc_got - (plt_address + htab->root.tlsdesc_plt) - dl_tlsdesc_lazy_trampoline[6], splt->contents + htab->root.tlsdesc_plt + 24); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, got_address - (plt_address + htab->root.tlsdesc_plt) - dl_tlsdesc_lazy_trampoline[7], splt->contents + htab->root.tlsdesc_plt + 24 + 4); @@ -17438,11 +17439,11 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, if (htab->tls_trampoline) { - arm_put_trampoline (htab, output_bfd, + arm_put_trampoline (htab, info->output_bfd, splt->contents + htab->tls_trampoline, tls_trampoline, 3); #ifdef FOUR_WORD_PLT - bfd_put_32 (output_bfd, 0x00000000, + bfd_put_32 (info->output_bfd, 0x00000000, splt->contents + htab->tls_trampoline + 12); #endif } @@ -17464,14 +17465,14 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, { Elf_Internal_Rela rel; - SWAP_RELOC_IN (htab) (output_bfd, p, &rel); + SWAP_RELOC_IN (htab) (info->output_bfd, p, &rel); rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32); - SWAP_RELOC_OUT (htab) (output_bfd, &rel, p); + SWAP_RELOC_OUT (htab) (info->output_bfd, &rel, p); p += RELOC_SIZE (htab); - SWAP_RELOC_IN (htab) (output_bfd, p, &rel); + SWAP_RELOC_IN (htab) (info->output_bfd, p, &rel); rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_ARM_ABS32); - SWAP_RELOC_OUT (htab) (output_bfd, &rel, p); + SWAP_RELOC_OUT (htab) (info->output_bfd, &rel, p); p += RELOC_SIZE (htab); } } @@ -17483,13 +17484,13 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, if (sgot->size > 0) { if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + bfd_put_32 (info->output_bfd, 0, sgot->contents); else - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn->output_section->vma + sdyn->output_offset, sgot->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + bfd_put_32 (info->output_bfd, 0, sgot->contents + 4); + bfd_put_32 (info->output_bfd, 0, sgot->contents + 8); } elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; @@ -17504,7 +17505,7 @@ elf32_arm_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, + hgot->root.u.def.section->output_section->vma + hgot->root.u.def.section->output_offset; - arm_elf_add_rofixup (output_bfd, htab->srofixup, got_value); + arm_elf_add_rofixup (info->output_bfd, htab->srofixup, got_value); /* Make sure we allocated and generated the same number of fixups. */ BFD_ASSERT (htab->srofixup->reloc_count * 4 == htab->srofixup->size); @@ -17572,7 +17573,7 @@ elf32_arm_init_file_header (bfd *abfd, struct bfd_link_info *link_info) } static enum elf_reloc_type_class -elf32_arm_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, +elf32_arm_reloc_type_class (const struct bfd_link_info *info, const asection *rel_sec ATTRIBUTE_UNUSED, const Elf_Internal_Rela *rela) { @@ -18010,8 +18011,7 @@ arm_map_one_stub (struct bfd_hash_entry * gen_entry, $d. */ static bool -elf32_arm_output_arch_local_syms (bfd *output_bfd, - struct bfd_link_info *info, +elf32_arm_output_arch_local_syms (struct bfd_link_info *info, void *flaginfo, int (*func) (void *, const char *, Elf_Internal_Sym *, @@ -18062,7 +18062,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, && (osi.sec->flags & SEC_EXCLUDE) == 0) { osi.sec_shndx = _bfd_elf_section_from_bfd_section - (output_bfd, osi.sec->output_section); + (info->output_bfd, osi.sec->output_section); if (osi.sec_shndx != (int)SHN_BAD) elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, 0); } @@ -18076,7 +18076,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, ARM2THUMB_GLUE_SECTION_NAME); osi.sec_shndx = _bfd_elf_section_from_bfd_section - (output_bfd, osi.sec->output_section); + (info->output_bfd, osi.sec->output_section); if (bfd_link_pic (info) || htab->pic_veneer) size = ARM2THUMB_PIC_GLUE_SIZE; @@ -18099,7 +18099,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, THUMB2ARM_GLUE_SECTION_NAME); osi.sec_shndx = _bfd_elf_section_from_bfd_section - (output_bfd, osi.sec->output_section); + (info->output_bfd, osi.sec->output_section); size = THUMB2ARM_GLUE_SIZE; for (offset = 0; offset < htab->thumb_glue_size; offset += size) @@ -18116,7 +18116,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, ARM_BX_GLUE_SECTION_NAME); osi.sec_shndx = _bfd_elf_section_from_bfd_section - (output_bfd, osi.sec->output_section); + (info->output_bfd, osi.sec->output_section); elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0); } @@ -18137,7 +18137,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, osi.sec = stub_sec; osi.sec_shndx = _bfd_elf_section_from_bfd_section - (output_bfd, osi.sec->output_section); + (info->output_bfd, osi.sec->output_section); bfd_hash_traverse (&htab->stub_hash_table, arm_map_one_stub, &osi); } @@ -18148,7 +18148,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, { osi.sec = htab->root.splt; osi.sec_shndx = (_bfd_elf_section_from_bfd_section - (output_bfd, osi.sec->output_section)); + (info->output_bfd, osi.sec->output_section)); /* Output mapping symbols for the plt header. */ if (htab->root.target_os == is_vxworks) @@ -18243,16 +18243,15 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, return true; } -/* Filter normal symbols of CMSE entry functions of ABFD to include in - the import library. All SYMCOUNT symbols of ABFD can be examined - from their pointers in SYMS. Pointers of symbols to keep should be - stored continuously at the beginning of that array. +/* Filter normal symbols of CMSE entry functions to include in the + import library. SYMCOUNT symbols can be examined from their + pointers in SYMS. Pointers of symbols to keep should be stored + continuously at the beginning of that array. Returns the number of symbols to keep. */ static unsigned int -elf32_arm_filter_cmse_symbols (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +elf32_arm_filter_cmse_symbols (struct bfd_link_info *info, asymbol **syms, long symcount) { size_t maxnamelen; @@ -18311,16 +18310,15 @@ elf32_arm_filter_cmse_symbols (bfd *abfd ATTRIBUTE_UNUSED, return dst_count; } -/* Filter symbols of ABFD to include in the import library. All - SYMCOUNT symbols of ABFD can be examined from their pointers in - SYMS. Pointers of symbols to keep should be stored continuously at +/* Filter symbols of INFO->OUTPUT_BFD to include in the import library. + SYMCOUNT symbols can be examined from their pointers in SYMS. + Pointers of symbols to keep should be stored continuously at the beginning of that array. Returns the number of symbols to keep. */ static unsigned int -elf32_arm_filter_implib_symbols (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +elf32_arm_filter_implib_symbols (struct bfd_link_info *info, asymbol **syms, long symcount) { struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (info); @@ -18330,9 +18328,9 @@ elf32_arm_filter_implib_symbols (bfd *abfd ATTRIBUTE_UNUSED, library to be a relocatable object file. */ BFD_ASSERT (!(bfd_get_file_flags (info->out_implib_bfd) & EXEC_P)); if (globals->cmse_implib) - return elf32_arm_filter_cmse_symbols (abfd, info, syms, symcount); + return elf32_arm_filter_cmse_symbols (info, syms, symcount); else - return _bfd_elf_filter_global_symbols (abfd, info, syms, symcount); + return _bfd_elf_filter_global_symbols (info, syms, symcount); } /* Allocate target specific section data. */ @@ -20294,10 +20292,9 @@ elf32_arm_fdpic_link_hash_table_create (bfd *abfd) /* We need dynamic symbols for every section, since segments can relocate independently. */ static bool -elf32_arm_fdpic_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info - ATTRIBUTE_UNUSED, - asection *p ATTRIBUTE_UNUSED) +elf32_arm_fdpic_omit_section_dynsym (struct bfd_link_info *info + ATTRIBUTE_UNUSED, + asection *p ATTRIBUTE_UNUSED) { switch (elf_section_data (p)->this_hdr.sh_type) { diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index c4118522601..ebdd19b4510 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -1409,8 +1409,7 @@ avr_final_link_relocate (reloc_howto_type * howto, /* Relocate an AVR ELF section. */ static int -elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +elf32_avr_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -1454,7 +1453,8 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); @@ -3269,7 +3269,7 @@ elf32_avr_get_relocated_section_contents (bfd *output_bfd, *secpp = isec; } - if (! elf32_avr_relocate_section (output_bfd, link_info, input_bfd, + if (! elf32_avr_relocate_section (link_info, input_bfd, input_section, data, internal_relocs, isymbuf, sections)) goto error_return; diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 940fdc8c7a9..8be69ead976 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1360,8 +1360,7 @@ bfin_final_link_relocate (Elf_Internal_Rela *rel, reloc_howto_type *howto, } static int -bfin_relocate_section (bfd * output_bfd, - struct bfd_link_info *info, +bfin_relocate_section (struct bfd_link_info *info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -1425,7 +1424,8 @@ bfin_relocate_section (bfd * output_bfd, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -1506,7 +1506,7 @@ bfin_relocate_section (bfd * output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, sgot->contents + off); h->got.offset |= 1; } @@ -1527,7 +1527,8 @@ bfin_relocate_section (bfd * output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + sgot->contents + off); if (bfd_link_pic (info)) { @@ -1546,7 +1547,8 @@ bfin_relocate_section (bfd * output_bfd, loc = s->contents; loc += s->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); } local_got_offsets[r_symndx] |= 1; @@ -1573,7 +1575,7 @@ bfin_relocate_section (bfd * output_bfd, not process them. */ if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 && h->def_dynamic) - && _bfd_elf_section_offset (output_bfd, info, input_section, + && _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) != (bfd_vma) -1) r = bfd_reloc_undefined; @@ -2483,8 +2485,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry, accordingly. */ static int -bfinfdpic_relocate_section (bfd * output_bfd, - struct bfd_link_info *info, +bfinfdpic_relocate_section (struct bfd_link_info *info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -2504,16 +2505,17 @@ bfinfdpic_relocate_section (bfd * output_bfd, sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; - isec_segment = _bfinfdpic_osec_to_segment (output_bfd, + isec_segment = _bfinfdpic_osec_to_segment (info->output_bfd, input_section->output_section); - if (IS_FDPIC (output_bfd) && bfinfdpic_got_section (info)) - got_segment = _bfinfdpic_osec_to_segment (output_bfd, + if (IS_FDPIC (info->output_bfd) && bfinfdpic_got_section (info)) + got_segment = _bfinfdpic_osec_to_segment (info->output_bfd, bfinfdpic_got_section (info) ->output_section); else got_segment = -1; - if (IS_FDPIC (output_bfd) && elf_hash_table (info)->dynamic_sections_created) - plt_segment = _bfinfdpic_osec_to_segment (output_bfd, + if (IS_FDPIC (info->output_bfd) + && elf_hash_table (info)->dynamic_sections_created) + plt_segment = _bfinfdpic_osec_to_segment (info->output_bfd, bfinfdpic_plt_section (info) ->output_section); else @@ -2557,7 +2559,8 @@ bfinfdpic_relocate_section (bfd * output_bfd, { sym = local_syms + r_symndx; osec = sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); @@ -2597,7 +2600,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, case R_BFIN_PCREL24: case R_BFIN_PCREL24_JUMP_L: case R_BFIN_BYTE4_DATA: - if (! IS_FDPIC (output_bfd)) + if (! IS_FDPIC (info->output_bfd)) goto non_fdpic; /* Fall through. */ @@ -2632,8 +2635,8 @@ bfinfdpic_relocate_section (bfd * output_bfd, if (! picrel) return false; - if (!_bfinfdpic_emit_got_relocs_plt_entries (picrel, output_bfd, info, - osec, sym, + if (!_bfinfdpic_emit_got_relocs_plt_entries (picrel, info->output_bfd, + info, osec, sym, rel->r_addend)) { _bfd_error_handler @@ -2651,7 +2654,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, non_fdpic: picrel = NULL; if (h && ! BFINFDPIC_SYM_LOCAL (info, h) - && _bfd_elf_section_offset (output_bfd, info, input_section, + && _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) != (bfd_vma) -1) { info->callbacks->warning @@ -2667,7 +2670,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, case R_BFIN_PCREL24: case R_BFIN_PCREL24_JUMP_L: check_segment[0] = isec_segment; - if (! IS_FDPIC (output_bfd)) + if (! IS_FDPIC (info->output_bfd)) check_segment[1] = isec_segment; else if (picrel->plt) { @@ -2685,7 +2688,8 @@ bfinfdpic_relocate_section (bfd * output_bfd, check_segment[1] = check_segment[0]; else check_segment[1] = sec - ? _bfinfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _bfinfdpic_osec_to_segment (info->output_bfd, + sec->output_section) : (unsigned)-1; break; @@ -2711,7 +2715,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, + bfinfdpic_got_initial_offset (info); check_segment[0] = got_segment; check_segment[1] = sec - ? _bfinfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _bfinfdpic_osec_to_segment (info->output_bfd, sec->output_section) : (unsigned)-1; break; @@ -2787,7 +2791,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_bfinfdpic_osec_readonly_p (output_bfd, + if (_bfinfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -2798,12 +2802,13 @@ bfinfdpic_relocate_section (bfd * output_bfd, return false; } - offset = _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset); + offset = _bfd_elf_section_offset (info->output_bfd, + info, + input_section, + rel->r_offset); if (offset != (bfd_vma)-1) - _bfinfdpic_add_rofixup (output_bfd, + _bfinfdpic_add_rofixup (info->output_bfd, bfinfdpic_gotfixup_section (info), offset + input_section @@ -2817,7 +2822,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, { bfd_vma offset; - if (_bfinfdpic_osec_readonly_p (output_bfd, + if (_bfinfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -2827,11 +2832,12 @@ bfinfdpic_relocate_section (bfd * output_bfd, name, input_bfd, input_section, rel->r_offset); return false; } - offset = _bfd_elf_section_offset (output_bfd, info, - input_section, rel->r_offset); + offset = _bfd_elf_section_offset (info->output_bfd, info, + input_section, + rel->r_offset); if (offset != (bfd_vma)-1) - _bfinfdpic_add_dyn_reloc (output_bfd, + _bfinfdpic_add_dyn_reloc (info->output_bfd, bfinfdpic_gotrel_section (info), offset + input_section ->output_section->vma @@ -2852,7 +2858,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, break; case R_BFIN_BYTE4_DATA: - if (! IS_FDPIC (output_bfd)) + if (! IS_FDPIC (info->output_bfd)) { check_segment[0] = check_segment[1] = -1; break; @@ -2863,7 +2869,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, int dynindx; bfd_vma addend = rel->r_addend; bfd_vma offset; - offset = _bfd_elf_section_offset (output_bfd, info, + offset = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); /* If the symbol is dynamic but binds locally, use @@ -2908,7 +2914,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, && (bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_bfinfdpic_osec_readonly_p (output_bfd, + if (_bfinfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -2922,7 +2928,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, { if (offset != (bfd_vma)-1) { - _bfinfdpic_add_rofixup (output_bfd, + _bfinfdpic_add_rofixup (info->output_bfd, bfinfdpic_gotfixup_section (info), offset + input_section @@ -2932,7 +2938,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, if (r_type == R_BFIN_FUNCDESC_VALUE) _bfinfdpic_add_rofixup - (output_bfd, + (info->output_bfd, bfinfdpic_gotfixup_section (info), offset + input_section->output_section->vma + input_section->output_offset + 4, picrel); @@ -2945,7 +2951,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_bfinfdpic_osec_readonly_p (output_bfd, + if (_bfinfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -2957,7 +2963,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, } if (offset != (bfd_vma)-1) - _bfinfdpic_add_dyn_reloc (output_bfd, + _bfinfdpic_add_dyn_reloc (info->output_bfd, bfinfdpic_gotrel_section (info), offset + input_section->output_section->vma @@ -2979,7 +2985,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, GOT base offset. */ if (bfd_link_pde (info) && (!h || BFINFDPIC_SYM_LOCAL (info, h))) - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, bfinfdpic_got_section (info)->output_section->vma + bfinfdpic_got_section (info)->output_offset + bfinfdpic_got_initial_offset (info), @@ -2991,10 +2997,10 @@ bfinfdpic_relocate_section (bfd * output_bfd, PLT entries are located, and the low word contains the offset of the lazy PLT entry entry point into that section. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, h && ! BFINFDPIC_SYM_LOCAL (info, h) ? 0 - : _bfinfdpic_osec_to_segment (output_bfd, + : _bfinfdpic_osec_to_segment (info->output_bfd, sec ->output_section), contents + rel->r_offset + 4); @@ -3006,12 +3012,12 @@ bfinfdpic_relocate_section (bfd * output_bfd, default: check_segment[0] = isec_segment; check_segment[1] = sec - ? _bfinfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _bfinfdpic_osec_to_segment (info->output_bfd, sec->output_section) : (unsigned)-1; break; } - if (check_segment[0] != check_segment[1] && IS_FDPIC (output_bfd)) + if (check_segment[0] != check_segment[1] && IS_FDPIC (info->output_bfd)) { #if 1 /* If you take this out, remove the #error from fdpic-static-6.d in the ld testsuite. */ @@ -3041,7 +3047,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, name, input_bfd, input_section, rel->r_offset); if (!silence_segment_error && bfd_link_pic (info)) return false; - elf_elfheader (output_bfd)->e_flags |= EF_BFIN_PIC; + elf_elfheader (info->output_bfd)->e_flags |= EF_BFIN_PIC; } switch (r_type) @@ -3072,7 +3078,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, { case R_BFIN_PCREL24: case R_BFIN_PCREL24_JUMP_L: - if (! IS_FDPIC (output_bfd) || ! picrel->plt) + if (! IS_FDPIC (info->output_bfd) || ! picrel->plt) break; /* Fall through. */ @@ -3152,9 +3158,8 @@ bfinfdpic_relocate_section (bfd * output_bfd, /* We need dynamic symbols for every section, since segments can relocate independently. */ static bool -_bfinfdpic_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, - asection *p) +_bfinfdpic_link_omit_section_dynsym (struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *p) { switch (elf_section_data (p)->this_hdr.sh_type) { @@ -4026,8 +4031,7 @@ _bfinfdpic_size_got_plt (bfd *output_bfd, /* Set the sizes of the dynamic sections. */ static bool -elf32_bfinfdpic_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_bfinfdpic_late_size_sections (struct bfd_link_info *info) { struct elf_link_hash_table *htab; bfd *dynobj; @@ -4072,7 +4076,7 @@ elf32_bfinfdpic_late_size_sections (bfd *output_bfd, use it if we're doing relaxations. */ bfinfdpic_dynamic_got_plt_info (info) = bfd_alloc (dynobj, sizeof (gpinfo.g)); - if (!_bfinfdpic_size_got_plt (output_bfd, &gpinfo)) + if (!_bfinfdpic_size_got_plt (info->output_bfd, &gpinfo)) return false; s = bfd_get_linker_section (dynobj, ".dynbss"); @@ -4083,16 +4087,14 @@ elf32_bfinfdpic_late_size_sections (bfd *output_bfd, if (s && s->size == 0) s->flags |= SEC_EXCLUDE; - return _bfd_elf_add_dynamic_tags (output_bfd, info, true); + return _bfd_elf_add_dynamic_tags (info, true); } static bool -elf32_bfinfdpic_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_bfinfdpic_early_size_sections (struct bfd_link_info *info) { if (!bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, - "__stacksize", DEFAULT_STACK_SIZE)) + && !bfd_elf_stack_segment_size (info, "__stacksize", DEFAULT_STACK_SIZE)) return false; return true; @@ -4211,8 +4213,7 @@ bfinfdpic_elf_discard_info (bfd *ibfd, } static bool -elf32_bfinfdpic_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf32_bfinfdpic_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -4239,8 +4240,9 @@ elf32_bfinfdpic_finish_dynamic_sections (bfd *output_bfd, + hgot->root.u.def.section->output_section->vma + hgot->root.u.def.section->output_offset; - _bfinfdpic_add_rofixup (output_bfd, bfinfdpic_gotfixup_section (info), - got_value, 0); + _bfinfdpic_add_rofixup (info->output_bfd, + bfinfdpic_gotfixup_section (info), + got_value, 0); if (bfinfdpic_gotfixup_section (info)->size != (bfinfdpic_gotfixup_section (info)->reloc_count * 4)) @@ -4285,19 +4287,19 @@ elf32_bfinfdpic_finish_dynamic_sections (bfd *output_bfd, dyn.d_un.d_ptr = bfinfdpic_got_section (info)->output_section->vma + bfinfdpic_got_section (info)->output_offset + bfinfdpic_got_initial_offset (info); - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_JMPREL: dyn.d_un.d_ptr = bfinfdpic_pltrel_section (info) ->output_section->vma + bfinfdpic_pltrel_section (info)->output_offset; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: dyn.d_un.d_val = bfinfdpic_pltrel_section (info)->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; } } @@ -4342,8 +4344,7 @@ elf32_bfinfdpic_adjust_dynamic_symbol (struct bfd_link_info *info, static bool elf32_bfinfdpic_finish_dynamic_symbol -(bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +(struct bfd_link_info *info ATTRIBUTE_UNUSED, struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym ATTRIBUTE_UNUSED) { @@ -4855,8 +4856,7 @@ bfin_link_hash_table_create (bfd * abfd) /* Finish up the dynamic sections. */ static bool -bfin_finish_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +bfin_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -4890,8 +4890,7 @@ bfin_finish_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, dynamic sections here. */ static bool -bfin_finish_dynamic_symbol (bfd * output_bfd, - struct bfd_link_info *info, +bfin_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym * sym) { @@ -4924,7 +4923,7 @@ bfin_finish_dynamic_symbol (bfd * output_bfd, { _bfd_error_handler (_("*** check this relocation %s"), __func__); rela.r_info = ELF32_R_INFO (0, R_BFIN_PCREL24); - rela.r_addend = bfd_get_signed_32 (output_bfd, + rela.r_addend = bfd_get_signed_32 (info->output_bfd, (sgot->contents + (h->got. @@ -4932,7 +4931,7 @@ bfin_finish_dynamic_symbol (bfd * output_bfd, } else { - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, sgot->contents + (h->got.offset & ~(bfd_vma) 1)); rela.r_info = ELF32_R_INFO (h->dynindx, R_BFIN_GOT); rela.r_addend = 0; @@ -4940,7 +4939,7 @@ bfin_finish_dynamic_symbol (bfd * output_bfd, loc = srela->contents; loc += srela->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc); } if (h->needs_copy) @@ -5125,8 +5124,7 @@ bfin_discard_copies (struct elf_link_hash_entry *h, void * inf) } static bool -bfin_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +bfin_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index f405378761d..2aed75aacbe 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -1333,7 +1333,7 @@ elf32_cr16_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd, /* Relocate a CR16 ELF section. */ static int -elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +elf32_cr16_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, @@ -1370,7 +1370,8 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -1390,7 +1391,7 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (bfd_link_relocatable (info)) continue; - r = cr16_elf_final_link_relocate (howto, input_bfd, output_bfd, + r = cr16_elf_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel->r_offset, relocation, rel->r_addend, @@ -1539,7 +1540,7 @@ elf32_cr16_get_relocated_section_contents (bfd *output_bfd, *secpp = isec; } - if (! elf32_cr16_relocate_section (output_bfd, link_info, input_bfd, + if (! elf32_cr16_relocate_section (link_info, input_bfd, input_section, data, internal_relocs, isymbuf, sections)) goto error_return; @@ -2380,8 +2381,7 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info, /* Set the sizes of the dynamic sections. */ static bool -_bfd_cr16_elf_late_size_sections (bfd * output_bfd, - struct bfd_link_info * info) +_bfd_cr16_elf_late_size_sections (struct bfd_link_info *info) { bfd * dynobj; asection * s; @@ -2485,15 +2485,14 @@ _bfd_cr16_elf_late_size_sections (bfd * output_bfd, s->alloced = 1; } - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); + return _bfd_elf_add_dynamic_tags (info, relocs); } /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ static bool -_bfd_cr16_elf_finish_dynamic_symbol (bfd * output_bfd, - struct bfd_link_info * info, +_bfd_cr16_elf_finish_dynamic_symbol (struct bfd_link_info * info, struct elf_link_hash_entry * h, Elf_Internal_Sym * sym) { @@ -2533,12 +2532,12 @@ _bfd_cr16_elf_finish_dynamic_symbol (bfd * output_bfd, } else { - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + bfd_put_32 (info->output_bfd, 0, sgot->contents + h->got.offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_CR16_GOT_REGREL20); rel.r_addend = 0; } - bfd_elf32_swap_reloca_out (output_bfd, &rel, + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, (bfd_byte *) ((Elf32_External_Rela *) srel->contents + srel->reloc_count)); ++ srel->reloc_count; @@ -2562,7 +2561,7 @@ _bfd_cr16_elf_finish_dynamic_symbol (bfd * output_bfd, + h->root.u.def.section->output_offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_CR16_GOT_REGREL20); rel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &rel, + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, (bfd_byte *) ((Elf32_External_Rela *) s->contents + s->reloc_count)); ++ s->reloc_count; @@ -2579,8 +2578,7 @@ _bfd_cr16_elf_finish_dynamic_symbol (bfd * output_bfd, /* Finish up the dynamic sections. */ static bool -_bfd_cr16_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_cr16_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd * dynobj; @@ -2623,13 +2621,13 @@ _bfd_cr16_elf_finish_dynamic_sections (bfd *output_bfd, s = elf_hash_table (info)->srelplt; get_vma: dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: s = elf_hash_table (info)->srelplt; dyn.d_un.d_val = s->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; } } @@ -2640,9 +2638,9 @@ _bfd_cr16_elf_finish_dynamic_sections (bfd *output_bfd, if (sgot->size > 0) { if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + bfd_put_32 (info->output_bfd, 0, sgot->contents); else - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn->output_section->vma + sdyn->output_offset, sgot->contents); } diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index cc27a68ea2c..aefd3db10f5 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -968,8 +968,7 @@ static int additional_relocation_error_msg_count = 10; copied, for further comments. */ static int -cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +cris_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -1039,7 +1038,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); symname = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); @@ -1109,7 +1109,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, || r_type == R_CRIS_32_PCREL)) relocation = 0; else if (!bfd_link_relocatable (info) && unresolved_reloc - && (_bfd_elf_section_offset (output_bfd, info, + && (_bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) != (bfd_vma) -1)) @@ -1255,7 +1255,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, sgot->contents + off); h->got.offset |= 1; } @@ -1275,7 +1275,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + sgot->contents + off); if (bfd_link_pic (info)) { @@ -1292,7 +1293,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, outrel.r_addend = relocation; loc = srelgot->contents; loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); } local_got_offsets[r_symndx] |= 1; @@ -1471,8 +1473,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, relocate = false; outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, - rel->r_offset); + _bfd_elf_section_offset (info->output_bfd, info, + input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; else if (outrel.r_offset == (bfd_vma) -2 @@ -1546,7 +1548,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, loc = sreloc->contents; loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); /* This reloc will be computed at runtime, so there's no need to do anything now, except for R_CRIS_32 relocations @@ -1614,20 +1616,20 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, loc = srelgot->contents; loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 12); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 16); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents + 12); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents + 16); outrel.r_offset = (sgotplt->output_section->vma + sgotplt->output_offset + 12); outrel.r_info = ELF32_R_INFO (0, R_CRIS_DTPMOD); outrel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); } else { /* For an executable, the GOT entry contents is known. */ - bfd_put_32 (output_bfd, (bfd_vma) 1, sgotplt->contents + 12); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 16); + bfd_put_32 (info->output_bfd, 1, sgotplt->contents + 12); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents + 16); } /* Reverse the sign to mark that we've emitted the @@ -1709,8 +1711,9 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, else local_got_offsets[r_symndx] |= 2; - bfd_put_32 (output_bfd, 1, sgot->contents + off); - bfd_put_32 (output_bfd, relocation, sgot->contents + off + 4); + bfd_put_32 (info->output_bfd, 1, sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + sgot->contents + off + 4); } else off &= ~3; @@ -1750,8 +1753,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, /* Clear the target contents of the GOT (just as a gesture; it's already cleared on allocation): this relocation is not like the other dynrelocs. */ - bfd_put_32 (output_bfd, 0, sgot->contents + off); - bfd_put_32 (output_bfd, 0, sgot->contents + off + 4); + bfd_put_32 (info->output_bfd, 0, sgot->contents + off); + bfd_put_32 (info->output_bfd, 0, sgot->contents + off + 4); srelgot = htab->root.srelgot; BFD_ASSERT (srelgot != NULL); @@ -1779,7 +1782,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, /* NULL if we had an error. */ if (srelgot->contents != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); } else off &= ~3; @@ -1854,7 +1857,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, else local_got_offsets[r_symndx] |= 1; - bfd_put_32 (output_bfd, relocation, sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + sgot->contents + off); } else off &= ~3; @@ -1904,7 +1908,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, /* Just "define" the initial contents in some semi-logical way. */ - bfd_put_32 (output_bfd, relocation, sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + sgot->contents + off); outrel.r_offset = (sgot->output_section->vma + sgot->output_offset @@ -1914,7 +1919,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); /* NULL if we had an error. */ if (srelgot->contents != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); } else off &= ~3; @@ -2056,8 +2061,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, dynamic sections here. */ static bool -elf_cris_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf_cris_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -2080,7 +2084,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd, htab = elf_cris_hash_table (info); /* Adjust the various PLT entry offsets. */ - if (bfd_get_mach (output_bfd) == bfd_mach_cris_v32) + if (bfd_get_mach (info->output_bfd) == bfd_mach_cris_v32) { plt_off2 = 14; plt_off3 = 20; @@ -2148,14 +2152,14 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd, plt_entry_size); /* We need to enter the absolute address of the GOT entry here. */ - bfd_put_32 (output_bfd, got_base + got_offset, + bfd_put_32 (info->output_bfd, got_base + got_offset, splt->contents + h->plt.offset + plt_off1); } else { memcpy (splt->contents + h->plt.offset, plt_pic_entry, plt_entry_size); - bfd_put_32 (output_bfd, got_offset, + bfd_put_32 (info->output_bfd, got_offset, splt->contents + h->plt.offset + plt_off1); } @@ -2164,18 +2168,18 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd, if (has_gotplt) { /* Fill in the offset to the reloc table. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, rela_plt_index * sizeof (Elf32_External_Rela), splt->contents + h->plt.offset + plt_off2); /* Fill in the offset to the first PLT entry, where to "jump". */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, - (h->plt.offset + plt_off3 + plt_off3_value_bias), splt->contents + h->plt.offset + plt_off3); /* Fill in the entry in the global offset table with the address of the relocating stub. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (splt->output_section->vma + splt->output_offset + h->plt.offset @@ -2189,7 +2193,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_JUMP_SLOT); rela.r_addend = 0; loc = srela->contents + rela_plt_index * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc); } if (!h->def_regular) @@ -2252,18 +2256,18 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd, && h->def_regular)) { rela.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE); - rela.r_addend = bfd_get_signed_32 (output_bfd, where); + rela.r_addend = bfd_get_signed_32 (info->output_bfd, where); } else { - bfd_put_32 (output_bfd, (bfd_vma) 0, where); + bfd_put_32 (info->output_bfd, (bfd_vma) 0, where); rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_GLOB_DAT); rela.r_addend = 0; } loc = srela->contents; loc += srela->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc); } if (h->needs_copy) @@ -2289,7 +2293,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_COPY); rela.r_addend = 0; loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -2305,8 +2309,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd, computed. */ static bool -elf_cris_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf_cris_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -2343,7 +2346,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd, case DT_PLTGOT: dyn.d_un.d_ptr = sgot->output_section->vma + sgot->output_offset; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_JMPREL: @@ -2352,7 +2355,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd, s = elf_hash_table (info)->srelplt; dyn.d_un.d_ptr = s != NULL ? (s->output_section->vma + s->output_offset) : 0; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: @@ -2361,7 +2364,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd, dyn.d_un.d_val = 0; else dyn.d_un.d_val = s->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; } } @@ -2369,7 +2372,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd, /* Fill in the first entry in the procedure linkage table. */ if (splt->size > 0) { - if (bfd_get_mach (output_bfd) == bfd_mach_cris_v32) + if (bfd_get_mach (info->output_bfd) == bfd_mach_cris_v32) { if (bfd_link_pic (info)) memcpy (splt->contents, elf_cris_pic_plt0_entry_v32, @@ -2378,7 +2381,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd, { memcpy (splt->contents, elf_cris_plt0_entry_v32, PLT_ENTRY_SIZE_V32); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sgot->output_section->vma + sgot->output_offset + 4, splt->contents + 4); @@ -2396,11 +2399,11 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd, { memcpy (splt->contents, elf_cris_plt0_entry, PLT_ENTRY_SIZE); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sgot->output_section->vma + sgot->output_offset + 4, splt->contents + 6); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sgot->output_section->vma + sgot->output_offset + 8, splt->contents + 14); @@ -2416,13 +2419,13 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd, if (sgot->size > 0) { if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + bfd_put_32 (info->output_bfd, 0, sgot->contents); else - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn->output_section->vma + sdyn->output_offset, sgot->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + bfd_put_32 (info->output_bfd, 0, sgot->contents + 4); + bfd_put_32 (info->output_bfd, 0, sgot->contents + 8); } elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; @@ -3488,8 +3491,7 @@ cris_elf_check_relocs (bfd *abfd, /* Set the sizes of the dynamic sections. */ static bool -elf_cris_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_cris_late_size_sections (struct bfd_link_info *info) { struct elf_cris_link_hash_table * htab; bfd *dynobj; @@ -3631,7 +3633,7 @@ elf_cris_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s->alloced = 1; } - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); + return _bfd_elf_add_dynamic_tags (info, relocs); } /* This function is called via elf_cris_link_hash_traverse if we are @@ -3971,8 +3973,7 @@ elf_cris_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, machinery. */ static bfd_vma -elf_cris_got_elt_size (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +elf_cris_got_elt_size (struct bfd_link_info *info ATTRIBUTE_UNUSED, struct elf_link_hash_entry *hr, bfd *ibfd, unsigned long symndx) diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c index 55255c51dec..3e5184307a2 100644 --- a/bfd/elf32-crx.c +++ b/bfd/elf32-crx.c @@ -37,7 +37,7 @@ static bfd_reloc_status_type crx_elf_final_link_relocate bfd_byte *, bfd_vma, bfd_vma, bfd_vma, struct bfd_link_info *, asection *, int); static int elf32_crx_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + (struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); static bool elf32_crx_relax_section (bfd *, asection *, struct bfd_link_info *, bool *); @@ -800,9 +800,9 @@ elf32_crx_get_relocated_section_contents (bfd *output_bfd, *secpp = isec; } - if (! elf32_crx_relocate_section (output_bfd, link_info, input_bfd, - input_section, data, internal_relocs, - isymbuf, sections)) + if (!elf32_crx_relocate_section (link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) goto error_return; free (sections); @@ -828,7 +828,7 @@ elf32_crx_get_relocated_section_contents (bfd *output_bfd, /* Relocate a CRX ELF section. */ static int -elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +elf32_crx_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, @@ -865,7 +865,8 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -885,11 +886,11 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (bfd_link_relocatable (info)) continue; - r = crx_elf_final_link_relocate (howto, input_bfd, output_bfd, - input_section, - contents, rel->r_offset, - relocation, rel->r_addend, - info, sec, h == NULL); + r = crx_elf_final_link_relocate (howto, input_bfd, info->output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + info, sec, h == NULL); if (r != bfd_reloc_ok) { diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index a7c6f956923..877c6ee86d7 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -1891,8 +1891,7 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Set the sizes of the dynamic sections. */ static bool -csky_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +csky_elf_late_size_sections (struct bfd_link_info *info) { struct csky_elf_link_hash_table *htab; bfd *dynobj; @@ -2090,15 +2089,14 @@ csky_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.dynamic_sections_created) htab->elf.dt_pltgot_required = htab->elf.sgot->size != 0; - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); + return _bfd_elf_add_dynamic_tags (info, relocs); } /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ static bool -csky_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +csky_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *[...] [diff truncated at 100000 bytes]