From: Alan Modra Date: Sat, 6 Jun 2026 01:36:40 +0000 (+0930) Subject: Drop output bfd param from many elf linker functions X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f9c26587f19ebfacc8c55caa72120833dad7ee45;p=thirdparty%2Fbinutils-gdb.git 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 --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 *h, Elf_Internal_Sym *sym) { @@ -2132,30 +2130,30 @@ csky_elf_finish_dynamic_symbol (bfd *output_bfd, || ((h->forced_local || bfd_link_executable (info)) && h->def_regular)); BFD_ASSERT (plt != NULL && gotplt != NULL && relplt != NULL); - if (bfd_csky_abi (output_bfd) == CSKY_ABI_V2) + if (bfd_csky_abi (info->output_bfd) == CSKY_ABI_V2) plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; else plt_index = h->plt.offset / PLT_ENTRY_SIZE_P - 1; got_offset = (plt_index + 3) * 4; /* Fill in the entry in the procedure linkage table. */ - if (bfd_csky_abi (output_bfd) == CSKY_ABI_V2) + if (bfd_csky_abi (info->output_bfd) == CSKY_ABI_V2) { - csky_put_insn_32 (output_bfd, csky_elf_plt_entry_v2[0], + csky_put_insn_32 (info->output_bfd, csky_elf_plt_entry_v2[0], plt->contents + h->plt.offset); - csky_put_insn_32 (output_bfd, + csky_put_insn_32 (info->output_bfd, (csky_elf_plt_entry_v2[1] | plt_index), plt->contents + h->plt.offset + 4); - csky_put_insn_32 (output_bfd, csky_elf_plt_entry_v2[2], + csky_put_insn_32 (info->output_bfd, csky_elf_plt_entry_v2[2], plt->contents + h->plt.offset + 8); } else { int i; for (i = 0; i < 6; i++) - bfd_put_16 (output_bfd, csky_elf_plt_entry_v1[i], + bfd_put_16 (info->output_bfd, csky_elf_plt_entry_v1[i], plt->contents + h->plt.offset + i * 2); - bfd_put_32 (output_bfd, plt_index, + bfd_put_32 (info->output_bfd, plt_index, plt->contents + h->plt.offset + i * 2); } @@ -2171,7 +2169,7 @@ csky_elf_finish_dynamic_symbol (bfd *output_bfd, + plt_index * sizeof (Elf32_External_Rela)); if (loc != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); if (! h->def_regular) { /* Mark the symbol as undefined, rather than as defined in @@ -2222,7 +2220,7 @@ csky_elf_finish_dynamic_symbol (bfd *output_bfd, else { BFD_ASSERT ((h->got.offset & 1) == 0); - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + h->got.offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_CKCORE_GLOB_DAT); rel.r_addend = 0; @@ -2232,7 +2230,7 @@ csky_elf_finish_dynamic_symbol (bfd *output_bfd, loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf32_External_Rela); if (loc != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); } if (h->needs_copy) @@ -2257,7 +2255,7 @@ csky_elf_finish_dynamic_symbol (bfd *output_bfd, s = htab->elf.srelbss; BFD_ASSERT (s != NULL); 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. */ @@ -2271,8 +2269,7 @@ csky_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -csky_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +csky_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct csky_elf_link_hash_table *htab; @@ -2329,7 +2326,7 @@ csky_elf_finish_dynamic_sections (bfd *output_bfd, if (name != NULL) { - asection *s = bfd_get_section_by_name (output_bfd, name); + asection *s = bfd_get_section_by_name (info->output_bfd, name); if (s == NULL) dyn.d_un.d_val = 0; @@ -2338,7 +2335,7 @@ csky_elf_finish_dynamic_sections (bfd *output_bfd, 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); } } @@ -2351,12 +2348,12 @@ csky_elf_finish_dynamic_sections (bfd *output_bfd, { if (got_sec->size > 0) { - bfd_put_32 (output_bfd, - (sdyn == NULL ? (bfd_vma) 0 + bfd_put_32 (info->output_bfd, + (sdyn == NULL ? 0 : sdyn->output_section->vma + sdyn->output_offset), got_sec->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, got_sec->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, got_sec->contents + 8); + bfd_put_32 (info->output_bfd, 0, got_sec->contents + 4); + bfd_put_32 (info->output_bfd, 0, got_sec->contents + 8); } elf_section_data (got_sec->output_section)->this_hdr.sh_entsize = 4; } @@ -4272,8 +4269,7 @@ tpoff (struct bfd_link_info *info, bfd_vma address) /* Relocate a csky section. */ static int -csky_elf_relocate_section (bfd * output_bfd, - struct bfd_link_info * info, +csky_elf_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -4346,7 +4342,8 @@ csky_elf_relocate_section (bfd * output_bfd, /* Get symbol table entry. */ 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); addend = (bfd_vma)rel->r_addend; } else @@ -4453,7 +4450,7 @@ csky_elf_relocate_section (bfd * output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); h->got.offset |= 1; @@ -4490,7 +4487,7 @@ csky_elf_relocate_section (bfd * output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); local_got_offsets[r_symndx] |= 1; if (bfd_link_pic (info)) @@ -4514,7 +4511,7 @@ csky_elf_relocate_section (bfd * output_bfd, loc = srelgot->contents; loc += (srelgot->reloc_count++ * sizeof (Elf32_External_Rela)); if (loc != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); } relocation = htab->elf.sgot->output_offset + off; break; @@ -4546,21 +4543,24 @@ csky_elf_relocate_section (bfd * output_bfd, case R_CKCORE_DOFFSET_IMM18BY2: case R_CKCORE_DOFFSET_IMM18BY4: { - asection *sdata = bfd_get_section_by_name (output_bfd, ".data"); + asection *sdata = bfd_get_section_by_name (info->output_bfd, + ".data"); relocation -= sdata->output_section->vma; } break; case R_CKCORE_DOFFSET_LO16: { - asection *sdata = bfd_get_section_by_name (output_bfd, ".data"); + asection *sdata = bfd_get_section_by_name (info->output_bfd, + ".data"); relocation -= sdata->output_section->vma; } break; case R_CKCORE_TOFFSET_LO16: { - asection *stext = bfd_get_section_by_name (output_bfd, ".text"); + asection *stext = bfd_get_section_by_name (info->output_bfd, + ".text"); if (stext) relocation -= stext->output_section->vma; } @@ -4616,7 +4616,7 @@ csky_elf_relocate_section (bfd * output_bfd, relative_reloc = true; } } - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); if (relative_reloc) @@ -4637,14 +4637,15 @@ csky_elf_relocate_section (bfd * output_bfd, loc += (srelgot->reloc_count++ * sizeof (Elf32_External_Rela)); if (loc != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); } relocation = off + htab->elf.sgot->output_offset; } break; } /* The relocation is the got offset. */ - if (bfd_csky_abi (output_bfd) == CSKY_ABI_V2) + if (bfd_csky_abi (info->output_bfd) == CSKY_ABI_V2) relocation = (h->plt.offset / PLT_ENTRY_SIZE + 2) * 4; else relocation = (h->plt.offset / PLT_ENTRY_SIZE_P + 2) * 4; @@ -4716,7 +4717,7 @@ csky_elf_relocate_section (bfd * output_bfd, howto = &csky_elf_howto_table[R_CKCORE_PCREL_IMM26BY2]; read_content_substitute = CSKY_INSN_BSR32; } - else if (bfd_csky_arch (output_bfd) == CSKY_ARCH_810) + else if (bfd_csky_arch (info->output_bfd) == CSKY_ARCH_810) /* if bsr32 cannot reach, generate "lrw r25, label; jsr r25" instead of jsri label. */ @@ -4735,7 +4736,7 @@ csky_elf_relocate_section (bfd * output_bfd, break; } /* else if h == NULL... */ - else if (bfd_csky_arch (output_bfd) == CSKY_ARCH_810 + else if (bfd_csky_arch (info->output_bfd) == CSKY_ARCH_810 && (ELF32_R_TYPE (rel->r_info) == R_CKCORE_PCREL_JSR_IMM26BY2)) { @@ -4770,7 +4771,7 @@ csky_elf_relocate_section (bfd * output_bfd, relocate = false; outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, + _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; @@ -4805,7 +4806,7 @@ csky_elf_relocate_section (bfd * output_bfd, * sizeof (Elf32_External_Rela)); if (loc != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); /* If this reloc is against an external symbol, we do not want to diddle with the addend. Otherwise, we need to @@ -4856,7 +4857,7 @@ csky_elf_relocate_section (bfd * output_bfd, relocate = false; outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, + _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) @@ -4894,7 +4895,7 @@ csky_elf_relocate_section (bfd * output_bfd, * sizeof (Elf32_External_Rela)); if (loc != NULL) - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); /* If this reloc is against an external symbol, we do want to diddle with the addend. Otherwise, we need to @@ -4929,17 +4930,17 @@ csky_elf_relocate_section (bfd * output_bfd, = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); outrel.r_info = ELF32_R_INFO (0, R_CKCORE_TLS_DTPMOD32); - bfd_put_32 (output_bfd, outrel.r_addend, + bfd_put_32 (info->output_bfd, outrel.r_addend, htab->elf.sgot->contents + off); loc = htab->elf.srelgot->contents; loc += (htab->elf.srelgot->reloc_count++ * sizeof (Elf32_External_Rela)); if (loc) - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); } else - bfd_put_32 (output_bfd, 1, + bfd_put_32 (info->output_bfd, 1, htab->elf.sgot->contents + off); htab->tls_ldm_got.offset |= 1; } @@ -5031,15 +5032,15 @@ csky_elf_relocate_section (bfd * output_bfd, + cur_off); outrel.r_info = ELF32_R_INFO (indx, R_CKCORE_TLS_DTPMOD32); - bfd_put_32 (output_bfd, outrel.r_addend, + bfd_put_32 (info->output_bfd, outrel.r_addend, htab->elf.sgot->contents + cur_off); if (loc) - bfd_elf32_swap_reloca_out (output_bfd, + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); loc += sizeof (Elf32_External_Rela); htab->elf.srelgot->reloc_count++; if (indx == 0) - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - dtpoff_base (info), (htab->elf.sgot->contents + cur_off + 4)); @@ -5049,14 +5050,14 @@ csky_elf_relocate_section (bfd * output_bfd, outrel.r_info = ELF32_R_INFO (indx, R_CKCORE_TLS_DTPOFF32); outrel.r_offset += 4; - bfd_put_32 (output_bfd, outrel.r_addend, + bfd_put_32 (info->output_bfd, outrel.r_addend, (htab->elf.sgot->contents + cur_off + 4)); outrel.r_info = ELF32_R_INFO (indx, R_CKCORE_TLS_DTPOFF32); if (loc) - bfd_elf32_swap_reloca_out (output_bfd, + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); htab->elf.srelgot->reloc_count++; @@ -5071,9 +5072,9 @@ csky_elf_relocate_section (bfd * output_bfd, static link or an executable link with the symbol binding locally. Mark it as belonging to module 1, the executable. */ - bfd_put_32 (output_bfd, 1, + bfd_put_32 (info->output_bfd, 1, htab->elf.sgot->contents + cur_off); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - dtpoff_base (info), htab->elf.sgot->contents + cur_off + 4); @@ -5094,16 +5095,16 @@ csky_elf_relocate_section (bfd * output_bfd, outrel.r_info = ELF32_R_INFO (indx, R_CKCORE_TLS_TPOFF32); - bfd_put_32 (output_bfd, outrel.r_addend, + bfd_put_32 (info->output_bfd, outrel.r_addend, htab->elf.sgot->contents + cur_off); if (loc) - bfd_elf32_swap_reloca_out (output_bfd, + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); htab->elf.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); } else - bfd_put_32 (output_bfd, tpoff (info, relocation), + bfd_put_32 (info->output_bfd, tpoff (info, relocation), htab->elf.sgot->contents + cur_off); } if (h != NULL) diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 673743e0a0b..384162e23ff 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -387,8 +387,7 @@ insert_rel_addend (bfd *abfd, /* Relocate a D10V ELF section. */ static int -elf32_d10v_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf32_d10v_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -450,8 +449,8 @@ elf32_d10v_relocate_section (bfd *output_bfd, else { asection *msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, - addend); + addend = _bfd_elf_rel_local_sym (info->output_bfd, + sym, &msec, addend); addend -= relocation; addend += msec->output_section->vma + msec->output_offset; } diff --git a/bfd/elf32-epiphany.c b/bfd/elf32-epiphany.c index 5bb97ade084..c35b4551d2c 100644 --- a/bfd/elf32-epiphany.c +++ b/bfd/elf32-epiphany.c @@ -470,8 +470,7 @@ epiphany_final_link_relocate (reloc_howto_type * howto, accordingly. */ static int -epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +epiphany_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 75ec074d23b..0e158841082 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -487,8 +487,7 @@ fr30_final_link_relocate (reloc_howto_type *howto, accordingly. */ static int -fr30_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +fr30_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -534,7 +533,8 @@ fr30_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); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index d8a338bb98a..183a78f6049 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -2652,8 +2652,7 @@ frv_final_link_relocate (reloc_howto_type *howto, accordingly. */ static int -elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +elf32_frv_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2674,28 +2673,28 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; - isec_segment = _frvfdpic_osec_to_segment (output_bfd, + isec_segment = _frvfdpic_osec_to_segment (info->output_bfd, input_section->output_section); - if (IS_FDPIC (output_bfd) && frvfdpic_got_section (info)) - got_segment = _frvfdpic_osec_to_segment (output_bfd, + if (IS_FDPIC (info->output_bfd) && frvfdpic_got_section (info)) + got_segment = _frvfdpic_osec_to_segment (info->output_bfd, frvfdpic_got_section (info) ->output_section); else got_segment = -1; - if (IS_FDPIC (output_bfd) && frvfdpic_gotfixup_section (info)) - gprel_segment = _frvfdpic_osec_to_segment (output_bfd, + if (IS_FDPIC (info->output_bfd) && frvfdpic_gotfixup_section (info)) + gprel_segment = _frvfdpic_osec_to_segment (info->output_bfd, frvfdpic_gotfixup_section (info) ->output_section); else gprel_segment = -1; - if (IS_FDPIC (output_bfd) && frvfdpic_plt_section (info)) - plt_segment = _frvfdpic_osec_to_segment (output_bfd, + if (IS_FDPIC (info->output_bfd) && frvfdpic_plt_section (info)) + plt_segment = _frvfdpic_osec_to_segment (info->output_bfd, frvfdpic_plt_section (info) ->output_section); else plt_segment = -1; if (elf_hash_table (info)->tls_sec) - tls_segment = _frvfdpic_osec_to_segment (output_bfd, + tls_segment = _frvfdpic_osec_to_segment (info->output_bfd, elf_hash_table (info)->tls_sec); else tls_segment = -1; @@ -2731,7 +2730,8 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { 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); @@ -2773,7 +2773,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { case R_FRV_LABEL24: case R_FRV_32: - if (! IS_FDPIC (output_bfd)) + if (! IS_FDPIC (info->output_bfd)) goto non_fdpic; /* Fall through. */ @@ -2824,7 +2824,8 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (! picrel) return false; - if (!_frvfdpic_emit_got_relocs_plt_entries (picrel, output_bfd, info, + if (!_frvfdpic_emit_got_relocs_plt_entries (picrel, + info->output_bfd, info, osec, sym, rel->r_addend)) { @@ -2843,7 +2844,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, picrel = NULL; if (h && ! FRVFDPIC_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->einfo @@ -3454,7 +3455,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { case R_FRV_LABEL24: 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) { @@ -3472,7 +3473,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, check_segment[1] = check_segment[0]; else check_segment[1] = sec - ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (info->output_bfd, sec->output_section) : (unsigned)-1; break; @@ -3498,7 +3499,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, + frvfdpic_got_initial_offset (info); check_segment[0] = got_segment; check_segment[1] = sec - ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (info->output_bfd, sec->output_section) : (unsigned)-1; break; @@ -3575,7 +3576,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { bfd_vma offset; - if (_frvfdpic_osec_readonly_p (output_bfd, + if (_frvfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -3587,11 +3588,11 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, } offset = _bfd_elf_section_offset - (output_bfd, info, + (info->output_bfd, info, input_section, rel->r_offset); if (offset != (bfd_vma)-1) - _frvfdpic_add_rofixup (output_bfd, + _frvfdpic_add_rofixup (info->output_bfd, frvfdpic_gotfixup_section (info), offset + input_section @@ -3605,7 +3606,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { bfd_vma offset; - if (_frvfdpic_osec_readonly_p (output_bfd, + if (_frvfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -3617,11 +3618,11 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, } offset = _bfd_elf_section_offset - (output_bfd, info, + (info->output_bfd, info, input_section, rel->r_offset); if (offset != (bfd_vma)-1) - _frvfdpic_add_dyn_reloc (output_bfd, + _frvfdpic_add_dyn_reloc (info->output_bfd, frvfdpic_gotrel_section (info), offset + input_section ->output_section->vma @@ -3641,7 +3642,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, break; case R_FRV_32: - if (! IS_FDPIC (output_bfd)) + if (! IS_FDPIC (info->output_bfd)) { check_segment[0] = check_segment[1] = -1; break; @@ -3696,7 +3697,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, && (bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_frvfdpic_osec_readonly_p (output_bfd, + if (_frvfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -3708,12 +3709,12 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (!h || h->root.type != bfd_link_hash_undefweak) { bfd_vma offset = _bfd_elf_section_offset - (output_bfd, info, + (info->output_bfd, info, input_section, rel->r_offset); if (offset != (bfd_vma)-1) { - _frvfdpic_add_rofixup (output_bfd, + _frvfdpic_add_rofixup (info->output_bfd, frvfdpic_gotfixup_section (info), offset + input_section @@ -3722,7 +3723,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, picrel); if (r_type == R_FRV_FUNCDESC_VALUE) _frvfdpic_add_rofixup - (output_bfd, + (info->output_bfd, frvfdpic_gotfixup_section (info), offset + input_section->output_section->vma @@ -3738,7 +3739,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { bfd_vma offset; - if (_frvfdpic_osec_readonly_p (output_bfd, + if (_frvfdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -3750,11 +3751,11 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, } offset = _bfd_elf_section_offset - (output_bfd, info, + (info->output_bfd, info, input_section, rel->r_offset); if (offset != (bfd_vma)-1) - _frvfdpic_add_dyn_reloc (output_bfd, + _frvfdpic_add_dyn_reloc (info->output_bfd, frvfdpic_gotrel_section (info), offset + input_section ->output_section->vma @@ -3776,7 +3777,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, GOT base offset. */ if (bfd_link_pde (info) && (!h || FRVFDPIC_SYM_LOCAL (info, h))) - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, frvfdpic_got_section (info)->output_section->vma + frvfdpic_got_section (info)->output_offset + frvfdpic_got_initial_offset (info), @@ -3788,10 +3789,10 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, 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 && ! FRVFDPIC_SYM_LOCAL (info, h) ? 0 - : _frvfdpic_osec_to_segment (output_bfd, + : _frvfdpic_osec_to_segment (info->output_bfd, sec ->output_section), contents + rel->r_offset + 4); @@ -3807,7 +3808,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, case R_FRV_GPRELLO: check_segment[0] = gprel_segment; check_segment[1] = sec - ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (info->output_bfd, sec->output_section) : (unsigned)-1; break; @@ -3830,7 +3831,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, check_segment[1] = sec && ! bfd_is_abs_section (sec) && ! bfd_is_und_section (sec) - ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (info->output_bfd, sec->output_section) : tls_segment; break; @@ -3850,8 +3851,8 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, else if (sec->output_section) { relocation -= tls_biased_base (info); - check_segment[1] = - _frvfdpic_osec_to_segment (output_bfd, sec->output_section); + check_segment[1] = _frvfdpic_osec_to_segment (info->output_bfd, + sec->output_section); } else check_segment[1] = -1; @@ -3866,7 +3867,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, check_segment[1] = sec && ! bfd_is_abs_section (sec) && ! bfd_is_und_section (sec) - ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (info->output_bfd, sec->output_section) : tls_segment; break; @@ -3886,12 +3887,12 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, default: check_segment[0] = isec_segment; check_segment[1] = sec - ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_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 you take this out, remove the #error from fdpic-static-6.d in the ld testsuite. */ @@ -3920,7 +3921,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, } if (!silence_segment_error && bfd_link_pic (info)) return false; - elf_elfheader (output_bfd)->e_flags |= EF_FRV_PIC; + elf_elfheader (info->output_bfd)->e_flags |= EF_FRV_PIC; } switch (r_type) @@ -3956,7 +3957,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, switch (r_type) { case R_FRV_LABEL24: - if (! IS_FDPIC (output_bfd) || ! picrel->plt) + if (! IS_FDPIC (info->output_bfd) || ! picrel->plt) break; /* Fall through. */ @@ -4139,8 +4140,7 @@ elf32_frv_add_symbol_hook (bfd *abfd, /* We need dynamic symbols for every section, since segments can relocate independently. */ static bool -_frvfdpic_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info +_frvfdpic_link_omit_section_dynsym (struct bfd_link_info *info ATTRIBUTE_UNUSED, asection *p ATTRIBUTE_UNUSED) { @@ -5428,8 +5428,7 @@ _frvfdpic_size_got_plt (bfd *output_bfd, /* Set the sizes of the dynamic sections. */ static bool -elf32_frvfdpic_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_frvfdpic_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -5472,19 +5471,17 @@ elf32_frvfdpic_late_size_sections (bfd *output_bfd, dynobj = elf_hash_table (info)->dynobj; frvfdpic_dynamic_got_plt_info (info) = bfd_alloc (dynobj, sizeof (gpinfo.g)); - if (!_frvfdpic_size_got_plt (output_bfd, &gpinfo)) + if (!_frvfdpic_size_got_plt (info->output_bfd, &gpinfo)) return false; - return _bfd_elf_add_dynamic_tags (output_bfd, info, true); + return _bfd_elf_add_dynamic_tags (info, true); } static bool -elf32_frvfdpic_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_frvfdpic_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; @@ -5684,8 +5681,7 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, /* Fill in code and data in dynamic sections. */ static bool -elf32_frv_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +elf32_frv_finish_dynamic_sections (struct bfd_link_info *info ATTRIBUTE_UNUSED, bfd_byte *buf ATTRIBUTE_UNUSED) { /* Nothing to be done for non-FDPIC. */ @@ -5693,8 +5689,7 @@ elf32_frv_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, } static bool -elf32_frvfdpic_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf32_frvfdpic_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -5720,7 +5715,8 @@ elf32_frvfdpic_finish_dynamic_sections (bfd *output_bfd, + hgot->root.u.def.section->output_offset; struct bfd_link_hash_entry *hend; - _frvfdpic_add_rofixup (output_bfd, frvfdpic_gotfixup_section (info), + _frvfdpic_add_rofixup (info->output_bfd, + frvfdpic_gotfixup_section (info), got_value, 0); if (frvfdpic_gotfixup_section (info)->size @@ -5786,19 +5782,19 @@ elf32_frvfdpic_finish_dynamic_sections (bfd *output_bfd, dyn.d_un.d_ptr = frvfdpic_got_section (info)->output_section->vma + frvfdpic_got_section (info)->output_offset + frvfdpic_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 = frvfdpic_pltrel_section (info) ->output_section->vma + frvfdpic_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 = frvfdpic_pltrel_section (info)->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; } } @@ -5845,8 +5841,7 @@ elf32_frvfdpic_adjust_dynamic_symbol static bool elf32_frvfdpic_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) { diff --git a/bfd/elf32-ft32.c b/bfd/elf32-ft32.c index c95d2c8f3ef..f2892c266e4 100644 --- a/bfd/elf32-ft32.c +++ b/bfd/elf32-ft32.c @@ -342,14 +342,13 @@ ft32_info_to_howto_rela (bfd *abfd, accordingly. */ static int -ft32_elf_relocate_section (bfd *output_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) +ft32_elf_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, + asection **local_sections) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -383,7 +382,8 @@ ft32_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); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index c690298758d..2ebeada9f52 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -47,10 +47,6 @@ static bfd_reloc_status_type elf32_h8_final_link_relocate (unsigned long, bfd *, bfd *, asection *, bfd_byte *, bfd_vma, bfd_vma, bfd_vma, struct bfd_link_info *, asection *, int); -static int elf32_h8_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, - bfd_byte *, Elf_Internal_Rela *, - Elf_Internal_Sym *, asection **); static bfd_reloc_status_type special (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); @@ -426,7 +422,7 @@ elf32_h8_final_link_relocate (unsigned long r_type, bfd *input_bfd, /* Relocate an H8 ELF section. */ static int -elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +elf32_h8_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, @@ -466,7 +462,8 @@ elf32_h8_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 { @@ -486,7 +483,7 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (bfd_link_relocatable (info)) continue; - r = elf32_h8_final_link_relocate (r_type, input_bfd, output_bfd, + r = elf32_h8_final_link_relocate (r_type, input_bfd, info->output_bfd, input_section, contents, rel->r_offset, relocation, rel->r_addend, @@ -1681,7 +1678,7 @@ elf32_h8_get_relocated_section_contents (bfd *output_bfd, *secpp = isec; } - if (! elf32_h8_relocate_section (output_bfd, link_info, input_bfd, + if (! elf32_h8_relocate_section (link_info, input_bfd, input_section, data, internal_relocs, isymbuf, sections)) goto error_return; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 6b837fe8496..8fb33bc10b8 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -2041,8 +2041,7 @@ clobber_millicode_symbols (struct elf_link_hash_entry *eh, /* Set the sizes of the dynamic sections. */ static bool -elf32_hppa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf32_hppa_late_size_sections (struct bfd_link_info *info) { struct elf32_hppa_link_hash_table *htab; bfd *dynobj; @@ -2274,7 +2273,7 @@ elf32_hppa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, sec->alloced = 1; } - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); + return _bfd_elf_add_dynamic_tags (info, relocs); } /* External entry points for sizing and building linker stubs. */ @@ -3500,8 +3499,7 @@ final_link_relocate (asection *input_section, /* Relocate an HPPA ELF section. */ static int -elf32_hppa_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf32_hppa_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -3559,7 +3557,8 @@ elf32_hppa_relocate_section (bfd *output_bfd, /* This is a local symbol, h defaults to NULL. */ sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rela); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sym_sec, rela); } else { @@ -3685,10 +3684,10 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_addend = relocation; loc = sec->contents; loc += sec->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); } else - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->etab.sgot->contents + off); } @@ -3706,7 +3705,8 @@ elf32_hppa_relocate_section (bfd *output_bfd, /* If this is the first SEGREL relocation, then initialize the segment base values. */ if (htab->text_segment_base == (bfd_vma) -1) - bfd_map_over_sections (output_bfd, hppa_record_segment_addr, htab); + bfd_map_over_sections (info->output_bfd, + hppa_record_segment_addr, htab); break; case R_PARISC_PLABEL14R: @@ -3776,14 +3776,14 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_addend = relocation; 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); } else { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation, htab->etab.splt->contents + off); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, elf_gp (htab->etab.splt->output_section->owner), htab->etab.splt->contents + off + 4); } @@ -3842,7 +3842,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_addend = rela->r_addend; outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, + _bfd_elf_section_offset (info->output_bfd, info, input_section, rela->r_offset); skip = (outrel.r_offset == (bfd_vma) -1 || outrel.r_offset == (bfd_vma) -2); @@ -3907,7 +3907,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, 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); } break; @@ -3932,7 +3932,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, loc = htab->etab.srelgot->contents; loc += htab->etab.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); htab->tls_ldm_got.offset |= 1; } @@ -4019,10 +4019,11 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (indx, R_PARISC_TLS_DTPMOD32); outrel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); htab->etab.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->etab.sgot->contents + cur_off); } else @@ -4031,7 +4032,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, static link or an executable link with the symbol binding locally. Mark it as belonging to module 1, the executable. */ - bfd_put_32 (output_bfd, 1, + bfd_put_32 (info->output_bfd, 1, htab->etab.sgot->contents + cur_off); if (indx != 0) @@ -4039,14 +4040,16 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (indx, R_PARISC_TLS_DTPOFF32); outrel.r_offset += 4; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); htab->etab.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->etab.sgot->contents + cur_off + 4); } else - bfd_put_32 (output_bfd, relocation - dtpoff_base (info), + bfd_put_32 (info->output_bfd, + relocation - dtpoff_base (info), htab->etab.sgot->contents + cur_off + 4); cur_off += 8; } @@ -4067,12 +4070,13 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_addend = relocation - dtpoff_base (info); else outrel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); htab->etab.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); } else - bfd_put_32 (output_bfd, tpoff (info, relocation), + bfd_put_32 (info->output_bfd, tpoff (info, relocation), htab->etab.sgot->contents + cur_off); cur_off += 4; } @@ -4187,8 +4191,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, dynamic sections here. */ static bool -elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf32_hppa_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *eh, Elf_Internal_Sym *sym) { @@ -4286,7 +4289,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, if ((eh->got.offset & 1) != 0) abort (); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->etab.sgot->contents + (eh->got.offset & ~1)); rela.r_info = ELF32_R_INFO (eh->dynindx, R_PARISC_DIR32); rela.r_addend = 0; @@ -4295,7 +4298,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, loc = htab->etab.srelgot->contents; loc += (htab->etab.srelgot->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); } } @@ -4320,7 +4323,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, else sec = htab->etab.srelbss; loc = sec->contents + sec->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. */ @@ -4368,8 +4371,7 @@ elf32_hppa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, /* Finish up the dynamic sections. */ static bool -elf32_hppa_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf32_hppa_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -4414,7 +4416,7 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd, case DT_PLTGOT: /* Use PLTGOT to set the GOT register. */ - dyn.d_un.d_ptr = elf_gp (output_bfd); + dyn.d_un.d_ptr = elf_gp (info->output_bfd); break; case DT_JMPREL: @@ -4428,7 +4430,7 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd, break; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } } @@ -4436,7 +4438,7 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd, { /* Fill in the first entry in the global offset table. We use it to point to our dynamic section, if we have one. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0, sgot->contents); diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 9e27bed51c6..954803fcc3f 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2035,7 +2035,7 @@ elf_i386_scan_relocs (bfd *abfd, } static bool -elf_i386_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf_i386_early_size_sections (struct bfd_link_info *info) { bfd *abfd; @@ -2048,7 +2048,7 @@ elf_i386_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) elf_i386_scan_relocs)) return false; - return _bfd_x86_elf_early_size_sections (output_bfd, info); + return _bfd_x86_elf_early_size_sections (info); } /* Set the correct type for an x86 ELF section. We do this by the @@ -2107,8 +2107,7 @@ elf_i386_tpoff (struct bfd_link_info *info, bfd_vma address) /* Relocate an i386 ELF section. */ static int -elf_i386_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_i386_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2249,7 +2248,7 @@ elf_i386_relocate_section (bfd *output_bfd, else { asection *msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, + addend = _bfd_elf_rel_local_sym (info->output_bfd, sym, &msec, addend); addend -= relocation; addend += msec->output_section->vma + msec->output_offset; @@ -2427,7 +2426,7 @@ elf_i386_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, base_got->contents + off); h->got.offset |= 1; } @@ -2503,7 +2502,7 @@ elf_i386_relocate_section (bfd *output_bfd, do_ifunc_pointer: /* Need a dynamic relocation to get the real function adddress. */ - offset = _bfd_elf_section_offset (output_bfd, + offset = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); @@ -2529,7 +2528,7 @@ elf_i386_relocate_section (bfd *output_bfd, (info, input_section, h, sym, "R_386_IRELATIVE", &outrel); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (h->root.u.def.value + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset), @@ -2548,7 +2547,7 @@ elf_i386_relocate_section (bfd *output_bfd, sreloc = htab->elf.srelgot; else sreloc = htab->elf.irelplt; - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, @@ -2605,7 +2604,7 @@ elf_i386_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); h->got.offset |= 1; /* NB: Don't generate relative relocation here if @@ -2637,7 +2636,7 @@ elf_i386_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); local_got_offsets[r_symndx] |= 1; @@ -2667,7 +2666,7 @@ elf_i386_relocate_section (bfd *output_bfd, (info, input_section, h, sym, "R_386_RELATIVE", &outrel); - _bfd_elf_append_rel (output_bfd, s, &outrel); + _bfd_elf_append_rel (info->output_bfd, s, &outrel); } if (off >= (bfd_vma) -2) @@ -2857,8 +2856,8 @@ elf_i386_relocate_section (bfd *output_bfd, 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) @@ -2899,7 +2898,7 @@ elf_i386_relocate_section (bfd *output_bfd, goto check_relocation_error; } - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); } /* If this reloc is against an external symbol, we do @@ -2930,7 +2929,7 @@ elf_i386_relocate_section (bfd *output_bfd, sreloc = elf_section_data (input_section)->sreloc; if (sreloc == NULL) abort (); - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); } /* Fall through */ @@ -3002,7 +3001,8 @@ elf_i386_relocate_section (bfd *output_bfd, } memcpy (contents + roff - 8, "\x65\xa1\0\0\0\0\x81\xe8\0\0\0", 12); - bfd_put_32 (output_bfd, elf_i386_tpoff (info, relocation), + bfd_put_32 (info->output_bfd, + elf_i386_tpoff (info, relocation), contents + roff); /* Skip R_386_PC32, R_386_PLT32 and R_386_GOT32X. */ rel++; @@ -3028,9 +3028,10 @@ elf_i386_relocate_section (bfd *output_bfd, /* Now modify the instruction as appropriate. */ /* aoliva FIXME: remove the above and xor the byte below with 0x86. */ - bfd_put_8 (output_bfd, val ^ 0x86, + bfd_put_8 (info->output_bfd, val ^ 0x86, contents + roff - 1); - bfd_put_32 (output_bfd, -elf_i386_tpoff (info, relocation), + bfd_put_32 (info->output_bfd, + -elf_i386_tpoff (info, relocation), contents + roff); continue; } @@ -3045,8 +3046,8 @@ elf_i386_relocate_section (bfd *output_bfd, bfd_vma roff; roff = rel->r_offset; - bfd_put_8 (output_bfd, 0x66, contents + roff); - bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + bfd_put_8 (info->output_bfd, 0x66, contents + roff); + bfd_put_8 (info->output_bfd, 0x90, contents + roff + 1); continue; } else if (r_type == R_386_TLS_IE) @@ -3066,7 +3067,7 @@ elf_i386_relocate_section (bfd *output_bfd, if (val == 0xa1) { /* movl foo, %eax. */ - bfd_put_8 (output_bfd, 0xb8, + bfd_put_8 (info->output_bfd, 0xb8, contents + rel->r_offset - 1); } else @@ -3079,17 +3080,17 @@ elf_i386_relocate_section (bfd *output_bfd, { case 0x8b: /* movl */ - bfd_put_8 (output_bfd, 0xc7, + bfd_put_8 (info->output_bfd, 0xc7, contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, + bfd_put_8 (info->output_bfd, 0xc0 | ((val >> 3) & 7), contents + rel->r_offset - 1); break; case 0x03: /* addl */ - bfd_put_8 (output_bfd, 0x81, + bfd_put_8 (info->output_bfd, 0x81, contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, + bfd_put_8 (info->output_bfd, 0xc0 | ((val >> 3) & 7), contents + rel->r_offset - 1); break; @@ -3098,7 +3099,8 @@ elf_i386_relocate_section (bfd *output_bfd, break; } } - bfd_put_32 (output_bfd, -elf_i386_tpoff (info, relocation), + bfd_put_32 (info->output_bfd, + -elf_i386_tpoff (info, relocation), contents + rel->r_offset); continue; } @@ -3120,34 +3122,36 @@ elf_i386_relocate_section (bfd *output_bfd, if (type == 0x8b) { /* movl */ - bfd_put_8 (output_bfd, 0xc7, + bfd_put_8 (info->output_bfd, 0xc7, contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + bfd_put_8 (info->output_bfd, 0xc0 | ((val >> 3) & 7), contents + rel->r_offset - 1); } else if (type == 0x2b) { /* subl */ - bfd_put_8 (output_bfd, 0x81, + bfd_put_8 (info->output_bfd, 0x81, contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, 0xe8 | ((val >> 3) & 7), + bfd_put_8 (info->output_bfd, 0xe8 | ((val >> 3) & 7), contents + rel->r_offset - 1); } else if (type == 0x03) { /* addl */ - bfd_put_8 (output_bfd, 0x81, + bfd_put_8 (info->output_bfd, 0x81, contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + bfd_put_8 (info->output_bfd, 0xc0 | ((val >> 3) & 7), contents + rel->r_offset - 1); } else BFD_FAIL (); if (r_type == R_386_TLS_GOTIE) - bfd_put_32 (output_bfd, -elf_i386_tpoff (info, relocation), + bfd_put_32 (info->output_bfd, + -elf_i386_tpoff (info, relocation), contents + rel->r_offset); else - bfd_put_32 (output_bfd, elf_i386_tpoff (info, relocation), + bfd_put_32 (info->output_bfd, + elf_i386_tpoff (info, relocation), contents + rel->r_offset); continue; } @@ -3193,18 +3197,18 @@ elf_i386_relocate_section (bfd *output_bfd, + offplt + htab->sgotplt_jump_table_size); sreloc = htab->rel_tls_desc; - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - _bfd_x86_elf_dtpoff_base (info), htab->elf.sgotplt->contents + offplt + htab->sgotplt_jump_table_size + 4); } else { - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgotplt->contents + offplt + htab->sgotplt_jump_table_size + 4); } @@ -3225,49 +3229,49 @@ elf_i386_relocate_section (bfd *output_bfd, dr_type = R_386_TLS_TPOFF32; if (dr_type == R_386_TLS_TPOFF && indx == 0) - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - _bfd_x86_elf_dtpoff_base (info), htab->elf.sgot->contents + off); else if (dr_type == R_386_TLS_TPOFF32 && indx == 0) - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, _bfd_x86_elf_dtpoff_base (info) - relocation, htab->elf.sgot->contents + off); else if (dr_type != R_386_TLS_DESC) - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + off); outrel.r_info = ELF32_R_INFO (indx, dr_type); - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); if (GOT_TLS_GD_P (tls_type)) { if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - _bfd_x86_elf_dtpoff_base (info), htab->elf.sgot->contents + off + 4); } else { - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + off + 4); outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DTPOFF32); outrel.r_offset += 4; - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); } } else if (tls_type == GOT_TLS_IE_BOTH) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (indx == 0 ? relocation - _bfd_x86_elf_dtpoff_base (info) : 0), htab->elf.sgot->contents + off + 4); outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF); outrel.r_offset += 4; - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); } dr_done: @@ -3344,7 +3348,7 @@ elf_i386_relocate_section (bfd *output_bfd, addl $foo@gotntpoff(%reg), %eax. */ if (tls_type == GOT_TLS_IE_POS) contents[roff + 6] = 0x03; - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off - htab->elf.sgotplt->output_section->vma @@ -3381,12 +3385,12 @@ elf_i386_relocate_section (bfd *output_bfd, aoliva FIXME: should we decide to keep the leal, all we have to do is remove the statement below, and adjust the relaxation of R_386_TLS_DESC_CALL. */ - bfd_put_8 (output_bfd, 0x8b, contents + roff - 2); + bfd_put_8 (info->output_bfd, 0x8b, contents + roff - 2); if (tls_type == GOT_TLS_IE_BOTH) off += 4; - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off - htab->elf.sgotplt->output_section->vma @@ -3415,14 +3419,14 @@ elf_i386_relocate_section (bfd *output_bfd, if (tls_type != GOT_TLS_IE_NEG) { /* xchg %ax,%ax */ - bfd_put_8 (output_bfd, 0x66, contents + roff); - bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + bfd_put_8 (info->output_bfd, 0x66, contents + roff); + bfd_put_8 (info->output_bfd, 0x90, contents + roff + 1); } else { /* negl %eax */ - bfd_put_8 (output_bfd, 0xf7, contents + roff); - bfd_put_8 (output_bfd, 0xd8, contents + roff + 1); + bfd_put_8 (info->output_bfd, 0xf7, contents + roff); + bfd_put_8 (info->output_bfd, 0xd8, contents + roff + 1); } continue; @@ -3488,12 +3492,12 @@ elf_i386_relocate_section (bfd *output_bfd, outrel.r_offset = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + off); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + off + 4); outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32); - _bfd_elf_append_rel (output_bfd, htab->elf.srelgot, &outrel); + _bfd_elf_append_rel (info->output_bfd, htab->elf.srelgot, &outrel); htab->tls_ld_or_ldm_got.offset |= 1; } relocation = htab->elf.sgot->output_section->vma @@ -3533,7 +3537,7 @@ elf_i386_relocate_section (bfd *output_bfd, sreloc = elf_section_data (input_section)->sreloc; if (sreloc == NULL) abort (); - _bfd_elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (info->output_bfd, sreloc, &outrel); if (indx) continue; else if (r_type == R_386_TLS_LE_32) @@ -3557,7 +3561,7 @@ elf_i386_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 @@ -3632,8 +3636,7 @@ elf_i386_relocate_section (bfd *output_bfd, dynamic sections here. */ static bool -elf_i386_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf_i386_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3733,7 +3736,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, if (! bfd_link_pic (info)) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (gotplt->output_section->vma + gotplt->output_offset + got_offset), @@ -3765,7 +3768,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, + plt->output_offset + h->plt.offset + 2), rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); /* Create the R_386_32 relocation referencing the beginning of the PLT for this GOT entry. */ @@ -3773,13 +3776,13 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, + htab->elf.sgotplt->output_offset + got_offset); rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc + sizeof (Elf32_External_Rel)); } } else { - bfd_put_32 (output_bfd, got_offset, + bfd_put_32 (info->output_bfd, got_offset, resolved_plt->contents + plt_offset + htab->plt.plt_got_offset); } @@ -3790,7 +3793,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, if (!local_undefweak) { if (htab->plt.has_plt0) - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt->output_section->vma + plt->output_offset + h->plt.offset @@ -3810,7 +3813,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, /* If an STT_GNU_IFUNC symbol is locally defined, generate R_386_IRELATIVE instead of R_386_JUMP_SLOT. Store addend in the .got.plt section. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (h->root.u.def.value + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset), @@ -3831,17 +3834,17 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, } loc = relplt->contents + plt_index * sizeof (Elf32_External_Rel); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); /* Don't fill the second and third slots in PLT entry for static executables nor without PLT0. */ if (plt == htab->elf.splt && htab->plt.has_plt0) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, plt_index * sizeof (Elf32_External_Rel), plt->contents + h->plt.offset + htab->lazy_plt->plt_reloc_offset); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, - (h->plt.offset + htab->lazy_plt->plt_plt_offset + 4), (plt->contents + h->plt.offset @@ -3885,7 +3888,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, plt_offset = eh->plt_got.offset; memcpy (plt->contents + plt_offset, got_plt_entry, htab->non_lazy_plt->plt_entry_size); - bfd_put_32 (output_bfd, got_offset, + bfd_put_32 (info->output_bfd, got_offset, (plt->contents + plt_offset + htab->non_lazy_plt->plt_got_offset)); } @@ -3955,7 +3958,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, h->root.root.string, h->root.u.def.section->owner); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (h->root.u.def.value + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset), @@ -3992,7 +3995,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt; plt_offset = h->plt.offset; } - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt->output_section->vma + plt->output_offset + plt_offset), htab->elf.sgot->contents + h->got.offset); @@ -4015,7 +4018,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, { BFD_ASSERT((h->got.offset & 1) == 0); do_glob_dat: - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + h->got.offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT); } @@ -4027,7 +4030,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, _bfd_x86_elf_link_report_relative_reloc (info, relgot, h, sym, relative_reloc_name, &rel); - _bfd_elf_append_rel (output_bfd, relgot, &rel); + _bfd_elf_append_rel (info->output_bfd, relgot, &rel); } } @@ -4047,7 +4050,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, s = htab->elf.sreldynrelro; else s = htab->elf.srelbss; - _bfd_elf_append_rel (output_bfd, s, &rel); + _bfd_elf_append_rel (info->output_bfd, s, &rel); } return true; @@ -4064,8 +4067,7 @@ elf_i386_finish_local_dynamic_symbol (void **slot, void *inf) struct bfd_link_info *info = (struct bfd_link_info *) inf; - return elf_i386_finish_dynamic_symbol (info->output_bfd, info, - h, NULL); + return elf_i386_finish_dynamic_symbol (info, h, NULL); } /* Finish up undefined weak symbol handling in PIE. Fill its PLT entry @@ -4083,8 +4085,7 @@ elf_i386_pie_finish_undefweak_symbol (struct bfd_hash_entry *bh, || h->dynindx != -1) return true; - return elf_i386_finish_dynamic_symbol (info->output_bfd, - info, h, NULL); + return elf_i386_finish_dynamic_symbol (info, h, NULL); } /* Used to decide how to sort relocs in an optimal manner for the @@ -4137,13 +4138,12 @@ elf_i386_reloc_type_class (const struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -elf_i386_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf_i386_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf) { struct elf_x86_link_hash_table *htab; - htab = _bfd_x86_elf_finish_dynamic_sections (output_bfd, info, buf); + htab = _bfd_x86_elf_finish_dynamic_sections (info, buf); if (htab == NULL) return false; @@ -4176,13 +4176,13 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, htab->plt.plt_entry_size - htab->lazy_plt->plt0_entry_size); if (!bfd_link_pic (info)) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + 4), htab->elf.splt->contents + htab->lazy_plt->plt0_got1_offset); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + 8), @@ -4205,7 +4205,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, + htab->lazy_plt->plt0_got1_offset); rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, srelplt2->contents); /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 8. */ @@ -4214,7 +4214,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, + htab->lazy_plt->plt0_got2_offset); rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, srelplt2->contents + sizeof (Elf32_External_Rel)); /* Correct the .rel.plt.unloaded relocations. */ @@ -4226,16 +4226,16 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, for (; num_plts; num_plts--) { - bfd_elf32_swap_reloc_in (output_bfd, p, &rel); + bfd_elf32_swap_reloc_in (info->output_bfd, p, &rel); rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, p); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, p); p += sizeof (Elf32_External_Rel); - bfd_elf32_swap_reloc_in (output_bfd, p, &rel); + bfd_elf32_swap_reloc_in (info->output_bfd, p, &rel); rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, p); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, p); p += sizeof (Elf32_External_Rel); } } @@ -4259,8 +4259,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, static bool elf_i386_output_arch_local_syms - (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, + (struct bfd_link_info *info, void *flaginfo ATTRIBUTE_UNUSED, int (*func) (void *, const char *, Elf_Internal_Sym *, diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index 6d62157225f..d050d679b72 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1386,8 +1386,7 @@ ip2k_final_link_relocate (reloc_howto_type * howto, accordingly. */ static int -ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +ip2k_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index 56908098501..8daeca8c1bd 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -562,8 +562,7 @@ iq2000_elf_check_relocs (bfd *abfd, accordingly. */ static int -iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info, +iq2000_elf_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -616,8 +615,8 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, /* This relocation is relative to a section symbol that is going to be merged. Change it so that it is relative to the merged section symbol. */ - rel->r_addend = _bfd_elf_rel_local_sym (output_bfd, sym, &sec, - rel->r_addend); + rel->r_addend = _bfd_elf_rel_local_sym (info->output_bfd, + sym, &sec, rel->r_addend); relocation = (sec->output_section->vma + sec->output_offset diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index ffb0e104be9..7014a522522 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -715,8 +715,7 @@ _lm32fdpic_osec_readonly_p (bfd *output_bfd, asection *osec) /* Relocate a section */ static int -lm32_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +lm32_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -774,7 +773,8 @@ lm32_elf_relocate_section (bfd *output_bfd, /* It's a local symbol. */ 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); name = name == NULL ? bfd_section_name (sec) : name; @@ -820,7 +820,7 @@ lm32_elf_relocate_section (bfd *output_bfd, switch (howto->type) { case R_LM32_GPREL16: - if (!lm32_elf_assign_gp (output_bfd, &gp)) + if (!lm32_elf_assign_gp (info->output_bfd, &gp)) r = bfd_reloc_dangerous; else { @@ -876,12 +876,13 @@ lm32_elf_relocate_section (bfd *output_bfd, else { /* Write entry in GOT */ - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, sgot->contents + off); /* Create entry in .rofixup pointing to GOT entry. */ - if (IS_FDPIC (output_bfd) && h->root.type != bfd_link_hash_undefweak) + if (IS_FDPIC (info->output_bfd) + && h->root.type != bfd_link_hash_undefweak) { - _lm32fdpic_add_rofixup (output_bfd, + _lm32fdpic_add_rofixup (info->output_bfd, lm32fdpic_fixup32_section (info), sgot->output_section->vma @@ -914,11 +915,12 @@ lm32_elf_relocate_section (bfd *output_bfd, else { /* Write entry in GOT. */ - bfd_put_32 (output_bfd, relocation, sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + sgot->contents + off); /* Create entry in .rofixup pointing to GOT entry. */ - if (IS_FDPIC (output_bfd)) + if (IS_FDPIC (info->output_bfd)) { - _lm32fdpic_add_rofixup (output_bfd, + _lm32fdpic_add_rofixup (info->output_bfd, lm32fdpic_fixup32_section (info), sgot->output_section->vma @@ -943,7 +945,8 @@ lm32_elf_relocate_section (bfd *output_bfd, 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); ++srelgot->reloc_count; } @@ -988,7 +991,7 @@ lm32_elf_relocate_section (bfd *output_bfd, break; case R_LM32_32: - if (IS_FDPIC (output_bfd)) + if (IS_FDPIC (info->output_bfd)) { if ((!h) || (h && h->root.type != bfd_link_hash_undefweak)) { @@ -998,7 +1001,7 @@ lm32_elf_relocate_section (bfd *output_bfd, { /* Check address to be modified is writable. */ - if (_lm32fdpic_osec_readonly_p (output_bfd, + if (_lm32fdpic_osec_readonly_p (info->output_bfd, input_section ->output_section)) { @@ -1009,7 +1012,7 @@ lm32_elf_relocate_section (bfd *output_bfd, return false; } /* Create entry in .rofixup section. */ - _lm32fdpic_add_rofixup (output_bfd, + _lm32fdpic_add_rofixup (info->output_bfd, lm32fdpic_fixup32_section (info), input_section->output_section->vma + input_section->output_offset @@ -1256,8 +1259,7 @@ lm32_elf_check_relocs (bfd *abfd, /* Finish up the dynamic sections. */ static bool -lm32_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +lm32_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_lm32_link_hash_table *htab; @@ -1303,13 +1305,13 @@ lm32_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; } } @@ -1320,26 +1322,34 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd, { if (bfd_link_pic (info)) { - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD0, splt->contents); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD1, splt->contents + 4); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD2, splt->contents + 8); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD3, splt->contents + 12); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD4, splt->contents + 16); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD0, + splt->contents); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD1, + splt->contents + 4); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD2, + splt->contents + 8); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD3, + splt->contents + 12); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD4, + splt->contents + 16); } else { unsigned long addr; /* addr = .got + 4 */ addr = sgot->output_section->vma + sgot->output_offset + 4; - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD0 | ((addr >> 16) & 0xffff), splt->contents); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD1 | (addr & 0xffff), splt->contents + 4); - bfd_put_32 (output_bfd, PLT0_ENTRY_WORD2, splt->contents + 8); - bfd_put_32 (output_bfd, PLT0_ENTRY_WORD3, splt->contents + 12); - bfd_put_32 (output_bfd, PLT0_ENTRY_WORD4, splt->contents + 16); + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD2, + splt->contents + 8); + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD3, + splt->contents + 12); + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD4, + splt->contents + 16); } elf_section_data (splt->output_section)->this_hdr.sh_entsize = @@ -1351,13 +1361,13 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd, if (sgot && 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); /* FIXME: This can be null if create_dynamic_sections wasn't called. */ if (elf_section_data (sgot->output_section) != NULL) @@ -1373,7 +1383,7 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_hash_entry *hend; /* Last entry is pointer to GOT. */ - _lm32fdpic_add_rofixup (output_bfd, lm32fdpic_fixup32_section (info), got_value); + _lm32fdpic_add_rofixup (info->output_bfd, lm32fdpic_fixup32_section (info), got_value); /* Check we wrote enough entries. */ if (lm32fdpic_fixup32_section (info)->size @@ -1419,8 +1429,7 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd, dynamic sections here. */ static bool -lm32_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +lm32_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -1470,7 +1479,7 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd, } /* 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 @@ -1485,7 +1494,7 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = srela->contents; loc += 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) { @@ -1531,14 +1540,14 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd, else { BFD_ASSERT ((h->got.offset & 1) == 0); - 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); rela.r_info = ELF32_R_INFO (h->dynindx, R_LM32_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); ++srela->reloc_count; } @@ -1562,7 +1571,7 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = s->contents; loc += 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); ++s->reloc_count; } @@ -1905,8 +1914,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Set the sizes of the dynamic sections. */ static bool -lm32_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +lm32_elf_late_size_sections (struct bfd_link_info *info) { struct elf_lm32_link_hash_table *htab; bfd *dynobj; @@ -2060,11 +2068,11 @@ lm32_elf_late_size_sections (bfd *output_bfd, s->alloced = 1; } - if (!_bfd_elf_add_dynamic_tags (output_bfd, info, relocs)) + if (!_bfd_elf_add_dynamic_tags (info, relocs)) return false; /* Allocate .rofixup section. */ - if (IS_FDPIC (output_bfd)) + if (IS_FDPIC (info->output_bfd)) { struct weak_symbol_list *list_start = NULL, *list_end = NULL; int rgot_weak_count = 0; @@ -2308,15 +2316,14 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) } static bool -lm32_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +lm32_elf_early_size_sections (struct bfd_link_info *info) { if (!bfd_link_relocatable (info)) { - if (!bfd_elf_stack_segment_size (output_bfd, info, - "__stacksize", DEFAULT_STACK_SIZE)) + if (!bfd_elf_stack_segment_size (info, "__stacksize", DEFAULT_STACK_SIZE)) return false; - asection *sec = bfd_get_section_by_name (output_bfd, ".stack"); + asection *sec = bfd_get_section_by_name (info->output_bfd, ".stack"); if (sec) sec->size = info->stacksize >= 0 ? info->stacksize : 0; } diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index e1308eef58b..c8c95e89b94 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -31,7 +31,7 @@ static reloc_howto_type * m32c_reloc_type_lookup static bool m32c_info_to_howto_rela (bfd *, arelent *, Elf_Internal_Rela *); static int m32c_elf_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); + (struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); static bool m32c_elf_check_relocs (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); static bool m32c_elf_relax_delete_bytes (bfd *, asection *, bfd_vma, int); @@ -390,8 +390,7 @@ static bfd_reloc_status_type m32c_apply_reloc_24 (bfd *abfd ATTRIBUTE_UNUSED, static int m32c_elf_relocate_section - (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info, + (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -750,8 +749,7 @@ m32c_elf_check_relocs /* This must exist if dynobj is ever set. */ static bool -m32c_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +m32c_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj = elf_hash_table (info)->dynobj; @@ -775,8 +773,7 @@ m32c_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED, } static bool -m32c_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +m32c_elf_early_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *splt; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index abba55a7d16..80a1b1eaa7a 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -2015,8 +2015,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Set the sizes of the dynamic sections. */ static bool -m32r_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +m32r_elf_late_size_sections (struct bfd_link_info *info) { struct elf_link_hash_table *htab; bfd *dynobj; @@ -2174,7 +2173,7 @@ m32r_elf_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); } /* Relocate an M32R/D ELF section. @@ -2211,8 +2210,7 @@ m32r_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, accordingly. */ static int -m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +m32r_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2298,7 +2296,8 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (!use_rel) { - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); addend = rel->r_addend; } else @@ -2380,7 +2379,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, + sec->output_section->vma + sec->output_offset); else if (!bfd_link_relocatable (info) - && (_bfd_elf_section_offset (output_bfd, info, + && (_bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) != (bfd_vma) -1)) @@ -2577,7 +2576,7 @@ m32r_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; } @@ -2602,7 +2601,8 @@ m32r_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)) { @@ -2621,7 +2621,8 @@ m32r_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); ++srelgot->reloc_count; } @@ -2700,7 +2701,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, skip = false; relocate = false; - 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); @@ -2744,7 +2745,7 @@ m32r_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); ++sreloc->reloc_count; /* If this reloc is against an external symbol, we do @@ -2916,8 +2917,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, dynamic sections here. */ static bool -m32r_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +m32r_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -2964,50 +2964,50 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd, /* Fill in the entry in the procedure linkage table. */ if (! bfd_link_pic (info)) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (PLT_ENTRY_WORD0b + (((sgot->output_section->vma + sgot->output_offset + got_offset) >> 16) & 0xffff)), splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (PLT_ENTRY_WORD1b + ((sgot->output_section->vma + sgot->output_offset + got_offset) & 0xffff)), splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD2, splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (PLT_ENTRY_WORD3 + plt_index * sizeof (Elf32_External_Rela)), splt->contents + h->plt.offset + 12); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (PLT_ENTRY_WORD4 + (((unsigned int) ((- (h->plt.offset + 16)) >> 2)) & 0xffffff)), splt->contents + h->plt.offset + 16); } else { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD0 + got_offset, splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD1, + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD1, splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD2, splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (PLT_ENTRY_WORD3 + plt_index * sizeof (Elf32_External_Rela)), splt->contents + h->plt.offset + 12); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (PLT_ENTRY_WORD4 + (((unsigned int) ((- (h->plt.offset + 16)) >> 2)) & 0xffffff)), splt->contents + h->plt.offset + 16); } /* 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 @@ -3022,7 +3022,7 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = srela->contents; loc += 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) { @@ -3068,14 +3068,14 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd, else { BFD_ASSERT ((h->got.offset & 1) == 0); - 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); rela.r_info = ELF32_R_INFO (h->dynindx, R_M32R_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); ++srela->reloc_count; } @@ -3100,7 +3100,7 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = s->contents; loc += 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); ++s->reloc_count; } @@ -3115,8 +3115,7 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -m32r_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +m32r_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_link_hash_table *htab; @@ -3166,13 +3165,13 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd, s = htab->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->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; } } @@ -3183,26 +3182,34 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd, { if (bfd_link_pic (info)) { - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD0, splt->contents); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD1, splt->contents + 4); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD2, splt->contents + 8); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD3, splt->contents + 12); - bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD4, splt->contents + 16); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD0, + splt->contents); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD1, + splt->contents + 4); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD2, + splt->contents + 8); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD3, + splt->contents + 12); + bfd_put_32 (info->output_bfd, PLT0_PIC_ENTRY_WORD4, + splt->contents + 16); } else { unsigned long addr; /* addr = .got + 4 */ addr = sgot->output_section->vma + sgot->output_offset + 4; - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD0 | ((addr >> 16) & 0xffff), splt->contents); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD1 | (addr & 0xffff), splt->contents + 4); - bfd_put_32 (output_bfd, PLT0_ENTRY_WORD2, splt->contents + 8); - bfd_put_32 (output_bfd, PLT0_ENTRY_WORD3, splt->contents + 12); - bfd_put_32 (output_bfd, PLT0_ENTRY_WORD4, splt->contents + 16); + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD2, + splt->contents + 8); + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD3, + splt->contents + 12); + bfd_put_32 (info->output_bfd, PLT0_ENTRY_WORD4, + splt->contents + 16); } elf_section_data (splt->output_section)->this_hdr.sh_entsize = @@ -3214,13 +3221,13 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd, if (sgot && 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/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index d1adb328c19..2b7c4500851 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -923,8 +923,7 @@ reloc_warning (struct bfd_link_info *info, const char *name, bfd *input_bfd, /* Relocate a 68hc11/68hc12 ELF section. */ int -elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +elf32_m68hc11_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, diff --git a/bfd/elf32-m68hc1x.h b/bfd/elf32-m68hc1x.h index b7b0dfad7db..c4a1459f56b 100644 --- a/bfd/elf32-m68hc1x.h +++ b/bfd/elf32-m68hc1x.h @@ -167,7 +167,7 @@ bool elf32_m68hc11_check_relocs (bfd * abfd, struct bfd_link_info * info, asection * sec, const Elf_Internal_Rela * relocs) ATTRIBUTE_HIDDEN; int elf32_m68hc11_relocate_section - (bfd *output_bfd, struct bfd_link_info *info, + (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) ATTRIBUTE_HIDDEN; diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index e90ba086454..8ed7640ddf8 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -2932,14 +2932,14 @@ elf_m68k_get_plt_info (bfd *output_bfd) It's a convenient place to determine the PLT style. */ static bool -elf_m68k_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf_m68k_early_size_sections (struct bfd_link_info *info) { /* Bind input BFDs to GOTs and calculate sizes of .got and .rela.got sections. */ if (!elf_m68k_partition_multi_got (info)) return false; - elf_m68k_hash_table (info)->plt_info = elf_m68k_get_plt_info (output_bfd); + elf_m68k_hash_table (info)->plt_info = elf_m68k_get_plt_info (info->output_bfd); return true; } @@ -3105,8 +3105,7 @@ elf_m68k_adjust_dynamic_symbol (struct bfd_link_info *info, /* Set the sizes of the dynamic sections. */ static bool -elf_m68k_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_m68k_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -3219,7 +3218,7 @@ elf_m68k_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_link_hash_traverse if we are @@ -3422,8 +3421,7 @@ elf_m68k_init_got_entry_local_shared (struct bfd_link_info *info, /* Relocate an M68K ELF section. */ static int -elf_m68k_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_m68k_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -3485,7 +3483,8 @@ elf_m68k_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 { @@ -3647,7 +3646,7 @@ elf_m68k_relocate_section (bfd *output_bfd, is done in the finish_dynamic_symbol routine. */ elf_m68k_init_got_entry_static (info, - output_bfd, + info->output_bfd, r_type, sgot, off, @@ -3665,7 +3664,7 @@ elf_m68k_relocate_section (bfd *output_bfd, BFD_ASSERT (srela != NULL); elf_m68k_init_got_entry_local_shared (info, - output_bfd, + info->output_bfd, r_type, sgot, off, @@ -3677,7 +3676,7 @@ elf_m68k_relocate_section (bfd *output_bfd, else /* h == NULL && !bfd_link_pic (info) */ { elf_m68k_init_got_entry_static (info, - output_bfd, + info->output_bfd, r_type, sgot, off, @@ -3821,7 +3820,7 @@ elf_m68k_relocate_section (bfd *output_bfd, relocate = false; outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, + _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; @@ -3896,7 +3895,7 @@ elf_m68k_relocate_section (bfd *output_bfd, 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_68K_32 @@ -3923,7 +3922,7 @@ elf_m68k_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 @@ -4035,8 +4034,7 @@ elf_m68k_install_pc32 (asection *sec, bfd_vma offset, bfd_vma value) dynamic sections here. */ static bool -elf_m68k_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf_m68k_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -4086,7 +4084,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, + sgot->output_offset + got_offset)); - 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 + plt_info->symbol_resolve_entry + 2); @@ -4095,7 +4093,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, splt->output_section->vma); /* 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 @@ -4109,7 +4107,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_JMP_SLOT); rela.r_addend = 0; loc = srela->contents + 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) { @@ -4152,7 +4150,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, { bfd_vma relocation; - relocation = bfd_get_signed_32 (output_bfd, + relocation = bfd_get_signed_32 (info->output_bfd, (sgot->contents + got_entry_offset)); @@ -4166,7 +4164,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, case R_68K_TLS_GD32: /* The value for this relocation is actually put in the second GOT slot. */ - relocation = bfd_get_signed_32 (output_bfd, + relocation = bfd_get_signed_32 (info->output_bfd, (sgot->contents + got_entry_offset + 4)); relocation += dtpoff_base (info); @@ -4181,7 +4179,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, } elf_m68k_init_got_entry_local_shared (info, - output_bfd, + info->output_bfd, r_type, sgot, got_entry_offset, @@ -4199,7 +4197,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, n_slots = elf_m68k_reloc_got_n_slots (got_entry->key_.type); while (n_slots--) - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, (sgot->contents + got_entry_offset + 4 * n_slots)); } @@ -4213,21 +4211,21 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, { case R_68K_GOT32O: rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_GLOB_DAT); - elf_m68k_install_rela (output_bfd, srela, &rela); + elf_m68k_install_rela (info->output_bfd, srela, &rela); break; case R_68K_TLS_GD32: rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_TLS_DTPMOD32); - elf_m68k_install_rela (output_bfd, srela, &rela); + elf_m68k_install_rela (info->output_bfd, srela, &rela); rela.r_offset += 4; rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_TLS_DTPREL32); - elf_m68k_install_rela (output_bfd, srela, &rela); + elf_m68k_install_rela (info->output_bfd, srela, &rela); break; case R_68K_TLS_IE32: rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_TLS_TPREL32); - elf_m68k_install_rela (output_bfd, srela, &rela); + elf_m68k_install_rela (info->output_bfd, srela, &rela); break; default: @@ -4261,7 +4259,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_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); } return true; @@ -4270,7 +4268,7 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -elf_m68k_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, +elf_m68k_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -4312,13 +4310,13 @@ elf_m68k_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, 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; } } @@ -4350,13 +4348,13 @@ elf_m68k_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; diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index ddf29edaf6b..761ce7f17ce 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -390,8 +390,7 @@ mcore_elf_info_to_howto (bfd * abfd, accordingly. */ static int -mcore_elf_relocate_section (bfd * output_bfd, - struct bfd_link_info * info, +mcore_elf_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -464,7 +463,8 @@ mcore_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); addend = rel->r_addend; } else diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c index 18b1be58888..9c47a416fec 100644 --- a/bfd/elf32-mep.c +++ b/bfd/elf32-mep.c @@ -426,8 +426,7 @@ mep_info_to_howto_rela (bfd * abfd, static int mep_elf_relocate_section - (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info, + (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -469,7 +468,8 @@ mep_elf_relocate_section { 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); diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index ee0d19b08b9..da7c5f1756b 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -1414,8 +1414,7 @@ section, which means that the addend must be adjusted accordingly. */ static int -elf_metag_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_metag_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -1470,7 +1469,8 @@ elf_metag_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); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); @@ -1533,7 +1533,7 @@ elf_metag_relocate_section (bfd *output_bfd, skip = false; relocate = false; - 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); @@ -1577,7 +1577,7 @@ elf_metag_relocate_section (bfd *output_bfd, 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); ++sreloc->reloc_count; /* If this reloc is against an external symbol, we do @@ -1701,10 +1701,10 @@ elf_metag_relocate_section (bfd *output_bfd, outrel.r_addend = relocation; 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); } else - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->etab.sgot->contents + off); } @@ -1789,23 +1789,25 @@ elf_metag_relocate_section (bfd *output_bfd, + htab->etab.sgot->output_offset); outrel.r_info = ELF32_R_INFO (indx, R_METAG_TLS_DTPMOD); outrel.r_addend = 0; - bfd_put_32 (output_bfd, 0, htab->etab.sgot->contents + cur_off); + bfd_put_32 (info->output_bfd, 0, + htab->etab.sgot->contents + cur_off); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); htab->etab.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); if (indx == 0) - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->etab.sgot->contents + cur_off + 4); else { - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->etab.sgot->contents + cur_off + 4); outrel.r_info = ELF32_R_INFO (indx, R_METAG_TLS_DTPOFF); outrel.r_offset += 4; - bfd_elf32_swap_reloca_out (output_bfd, + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); htab->etab.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); @@ -1841,12 +1843,13 @@ elf_metag_relocate_section (bfd *output_bfd, else outrel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); htab->etab.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); } else - bfd_put_32 (output_bfd, tpoff (info, relocation), + bfd_put_32 (info->output_bfd, tpoff (info, relocation), htab->etab.sgot->contents + cur_off); cur_off += 4; @@ -1910,7 +1913,7 @@ elf_metag_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (0, R_METAG_TLS_DTPMOD); loc = htab->etab.srelgot->contents; loc += htab->etab.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); htab->tls_ldm_got.offset |= 1; } @@ -2679,8 +2682,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) /* Set the sizes of the dynamic sections. */ static bool -elf_metag_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_metag_late_size_sections (struct bfd_link_info *info) { struct elf_metag_link_hash_table *htab; bfd *dynobj; @@ -2865,15 +2867,14 @@ elf_metag_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, } } - 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 -elf_metag_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf_metag_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *eh, Elf_Internal_Sym *sym) { @@ -2924,20 +2925,20 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd, /* Fill in the entry in the procedure linkage table. */ if (! bfd_link_pic (info)) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt_entry[0] | (((got_entry >> 16) & 0xffff) << 3)), splt->contents + eh->plt.offset); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt_entry[1] | ((got_entry & 0xffff) << 3)), splt->contents + eh->plt.offset + 4); - bfd_put_32 (output_bfd, plt_entry[2], + bfd_put_32 (info->output_bfd, plt_entry[2], splt->contents + eh->plt.offset + 8); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt_entry[3] | (plt_index << 3)), splt->contents + eh->plt.offset + 12); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt_entry[4] | ((((unsigned int) ((- (eh->plt.offset + 16)) >> 2)) & 0x7ffff) << 5)), splt->contents + eh->plt.offset + 16); @@ -2947,25 +2948,25 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd, bfd_vma addr = got_entry - (splt->output_section->vma + splt->output_offset + eh->plt.offset); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, plt_pic_entry[0] | (((addr >> 16) & 0xffff) << 3), splt->contents + eh->plt.offset); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, plt_pic_entry[1] | ((addr & 0xffff) << 3), splt->contents + eh->plt.offset + 4); - bfd_put_32 (output_bfd, plt_pic_entry[2], + bfd_put_32 (info->output_bfd, plt_pic_entry[2], splt->contents + eh->plt.offset + 8); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt_pic_entry[3] | (plt_index << 3)), splt->contents + eh->plt.offset + 12); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt_pic_entry[4] + ((((unsigned int) ((- (eh->plt.offset + 16)) >> 2)) & 0x7ffff) << 5)), splt->contents + eh->plt.offset + 16); } /* 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 + eh->plt.offset @@ -2980,7 +2981,7 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd, rel.r_addend = 0; loc = htab->etab.srelplt->contents; loc += plt_index * sizeof(Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); if (!eh->def_regular) { @@ -3019,14 +3020,15 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd, { if ((eh->got.offset & 1) != 0) abort (); - bfd_put_32 (output_bfd, 0, htab->etab.sgot->contents + eh->got.offset); + bfd_put_32 (info->output_bfd, 0, + htab->etab.sgot->contents + eh->got.offset); rel.r_info = ELF32_R_INFO (eh->dynindx, R_METAG_GLOB_DAT); rel.r_addend = 0; } loc = htab->etab.srelgot->contents; loc += htab->etab.srelgot->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); } if (eh->needs_copy) @@ -3050,7 +3052,7 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd, else s = htab->etab.srelbss; loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); - 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. */ @@ -3103,8 +3105,7 @@ elf_metag_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, /* Finish up the dynamic sections. */ static bool -elf_metag_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf_metag_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -3141,19 +3142,19 @@ elf_metag_finish_dynamic_sections (bfd *output_bfd, case DT_PLTGOT: s = htab->etab.sgot; 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_JMPREL: s = htab->etab.srelplt; 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->etab.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; } @@ -3170,27 +3171,33 @@ elf_metag_finish_dynamic_sections (bfd *output_bfd, if (bfd_link_pic (info)) { addr -= splt->output_section->vma + splt->output_offset; - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, plt0_pic_entry[0] | (((addr >> 16) & 0xffff) << 3), splt->contents); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, plt0_pic_entry[1] | ((addr & 0xffff) << 3), splt->contents + 4); - bfd_put_32 (output_bfd, plt0_pic_entry[2], splt->contents + 8); - bfd_put_32 (output_bfd, plt0_pic_entry[3], splt->contents + 12); - bfd_put_32 (output_bfd, plt0_pic_entry[4], splt->contents + 16); + bfd_put_32 (info->output_bfd, plt0_pic_entry[2], + splt->contents + 8); + bfd_put_32 (info->output_bfd, plt0_pic_entry[3], + splt->contents + 12); + bfd_put_32 (info->output_bfd, plt0_pic_entry[4], + splt->contents + 16); } else { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, plt0_entry[0] | (((addr >> 16) & 0xffff) << 3), splt->contents); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, plt0_entry[1] | ((addr & 0xffff) << 3), splt->contents + 4); - bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8); - bfd_put_32 (output_bfd, plt0_entry[3], splt->contents + 12); - bfd_put_32 (output_bfd, plt0_entry[4], splt->contents + 16); + bfd_put_32 (info->output_bfd, plt0_entry[2], + splt->contents + 8); + bfd_put_32 (info->output_bfd, plt0_entry[3], + splt->contents + 12); + bfd_put_32 (info->output_bfd, plt0_entry[4], + splt->contents + 16); } elf_section_data (splt->output_section)->this_hdr.sh_entsize = @@ -3202,7 +3209,7 @@ elf_metag_finish_dynamic_sections (bfd *output_bfd, { /* Fill in the first entry in the global offset table. We use it to point to our dynamic section, if we have one. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0, htab->etab.sgot->contents); diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 2f8167c4d9c..52c2b247dc8 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -957,8 +957,7 @@ microblaze_elf_output_dynamic_relocation (bfd *output_bfd, accordingly. */ static int -microblaze_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +microblaze_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -970,7 +969,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, Elf_Internal_Shdr *symtab_hdr = &elf_symtab_hdr (input_bfd); struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); Elf_Internal_Rela *rel, *relend; - int endian = (bfd_little_endian (output_bfd)) ? 0 : 2; + int endian = (bfd_little_endian (info->output_bfd)) ? 0 : 2; /* Assume success. */ bool ret = true; asection *sreloc; @@ -1080,7 +1079,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, if (sec == 0) continue; sym_name = ""; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); /* r_addend may have changed if the reference section was a merge section. */ addend = rel->r_addend; @@ -1357,11 +1357,11 @@ microblaze_elf_relocate_section (bfd *output_bfd, if (IS_TLS_LD(tls_type)) { if (! bfd_link_pic (info)) - bfd_put_32 (output_bfd, 1, + bfd_put_32 (info->output_bfd, 1, htab->elf.sgot->contents + off); else microblaze_elf_output_dynamic_relocation - (output_bfd, + (info->output_bfd, htab->elf.srelgot, htab->elf.srelgot->reloc_count++, /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32, @@ -1370,11 +1370,11 @@ microblaze_elf_relocate_section (bfd *output_bfd, else if (IS_TLS_GD(tls_type)) { if (! need_relocs) - bfd_put_32 (output_bfd, 1, + bfd_put_32 (info->output_bfd, 1, htab->elf.sgot->contents + off); else microblaze_elf_output_dynamic_relocation - (output_bfd, + (info->output_bfd, htab->elf.srelgot, htab->elf.srelgot->reloc_count++, /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32, @@ -1392,7 +1392,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, { /* For LD, offset should be 0 */ *offp |= 1; - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + off2); } else if (IS_TLS_GD(tls_type)) @@ -1401,18 +1401,18 @@ microblaze_elf_relocate_section (bfd *output_bfd, static_value -= dtprel_base(info); if (need_relocs) microblaze_elf_output_dynamic_relocation - (output_bfd, + (info->output_bfd, htab->elf.srelgot, htab->elf.srelgot->reloc_count++, /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32, got_offset, indx ? 0 : static_value); else - bfd_put_32 (output_bfd, static_value, + bfd_put_32 (info->output_bfd, static_value, htab->elf.sgot->contents + off2); } else { - bfd_put_32 (output_bfd, static_value, + bfd_put_32 (info->output_bfd, static_value, htab->elf.sgot->contents + off2); /* Relocs for dyn symbols generated by @@ -1421,7 +1421,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, { *offp |= 1; microblaze_elf_output_dynamic_relocation - (output_bfd, + (info->output_bfd, htab->elf.srelgot, htab->elf.srelgot->reloc_count++, /* symindex= */ indx, R_MICROBLAZE_REL, @@ -1555,8 +1555,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, skip = 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) @@ -1596,7 +1596,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 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); break; } else @@ -2955,8 +2955,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat) /* Set the sizes of the dynamic sections. */ static bool -microblaze_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +microblaze_elf_late_size_sections (struct bfd_link_info *info) { struct elf32_mb_link_hash_table *htab; bfd *dynobj; @@ -3143,15 +3142,14 @@ microblaze_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* ??? Force DF_BIND_NOW? */ info->flags |= DF_BIND_NOW; - return _bfd_elf_add_dynamic_tags (output_bfd, info, true); + return _bfd_elf_add_dynamic_tags (info, true); } /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ static bool -microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +microblaze_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3189,21 +3187,21 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, got_addr += sgotplt->output_section->vma + sgotplt->output_offset; /* Fill in the entry in the procedure linkage table. */ - bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff), + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff), splt->contents + h->plt.offset); if (bfd_link_pic (info)) - bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1 + (got_addr & 0xffff), + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD_1 + (got_addr & 0xffff), splt->contents + h->plt.offset + 4); else - bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1_NOPIC + (got_addr & 0xffff), + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD_1_NOPIC + (got_addr & 0xffff), splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_2, + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD_2, splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_3, + bfd_put_32 (info->output_bfd, PLT_ENTRY_WORD_3, splt->contents + h->plt.offset + 12); /* Any additions to the .got section??? */ - /* bfd_put_32 (output_bfd, + /* bfd_put_32 (info->output_bfd, splt->output_section->vma + splt->output_offset + h->plt.offset + 4, sgotplt->contents + got_offset); */ @@ -3215,7 +3213,7 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = srela->contents; loc += 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) { @@ -3264,7 +3262,7 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, it is too late to change our minds now... */ value += sec->output_section->vma + sec->output_offset; - microblaze_elf_output_dynamic_relocation (output_bfd, + microblaze_elf_output_dynamic_relocation (info->output_bfd, srela, srela->reloc_count++, /* symindex= */ 0, R_MICROBLAZE_REL, offset, @@ -3272,14 +3270,14 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, } else { - microblaze_elf_output_dynamic_relocation (output_bfd, + microblaze_elf_output_dynamic_relocation (info->output_bfd, srela, srela->reloc_count++, h->dynindx, R_MICROBLAZE_GLOB_DAT, offset, 0); } - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, sgot->contents + (h->got.offset &~ (bfd_vma) 1)); } @@ -3303,7 +3301,7 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, else s = htab->elf.srelbss; 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 some specially defined symbols as absolute. */ @@ -3319,8 +3317,7 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -microblaze_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +microblaze_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -3380,7 +3377,7 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd, 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); } splt = htab->elf.splt; @@ -3391,7 +3388,7 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd, if (splt->size > 0) { memset (splt->contents, 0, PLT_ENTRY_SIZE); - bfd_put_32 (output_bfd, (bfd_vma) 0x80000000 /* nop. */, + bfd_put_32 (info->output_bfd, 0x80000000 /* nop. */, splt->contents + splt->size - 4); if (splt->output_section != bfd_abs_section_ptr) @@ -3405,9 +3402,9 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd, if (sgot && 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); elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c index cd2114b6944..18eb9c2124f 100644 --- a/bfd/elf32-moxie.c +++ b/bfd/elf32-moxie.c @@ -198,8 +198,7 @@ moxie_final_link_relocate (reloc_howto_type *howto, accordingly. */ static int -moxie_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +moxie_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -239,7 +238,8 @@ moxie_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); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index 065efc4fa83..add0a6826ae 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -1414,8 +1414,7 @@ msp430_final_link_relocate (reloc_howto_type * howto, /* Relocate an MSP430 ELF section. */ static int -elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info, +elf32_msp430_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -1460,7 +1459,8 @@ elf32_msp430_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); diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c index 6e81db3ea0b..0bd8f05bb2d 100644 --- a/bfd/elf32-mt.c +++ b/bfd/elf32-mt.c @@ -38,10 +38,6 @@ static bfd_reloc_status_type mt_final_link_relocate (reloc_howto_type *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma); -static int mt_elf_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); - /* Relocation tables. */ static reloc_howto_type mt_elf_howto_table [] = { @@ -299,8 +295,7 @@ mt_final_link_relocate static int mt_elf_relocate_section - (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info, + (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -342,7 +337,8 @@ mt_elf_relocate_section { 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); diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 1912f94caa3..937ada25f05 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -4359,8 +4359,7 @@ elf32_nds32_add_dynreloc (bfd *output_bfd, /* Set the sizes of the dynamic sections. */ static bool -nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +nds32_elf_late_size_sections (struct bfd_link_info *info) { struct elf_nds32_link_hash_table *htab; bfd *dynobj; @@ -4587,7 +4586,7 @@ nds32_elf_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); } static bfd_reloc_status_type @@ -5045,8 +5044,7 @@ fls (register unsigned int x) (elf_nds32_tdata (bfd)->local_tlsdesc_gotent) static int -nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info, +nds32_elf_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -5096,7 +5094,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, if ((!bfd_link_relocatable (info))) { is_SDA_BASE_set = 1; - r = nds32_elf_final_sda_base (output_bfd, info, &gp, true); + r = nds32_elf_final_sda_base (info->output_bfd, info, &gp, true); if (r != bfd_reloc_ok) return false; } @@ -5107,7 +5105,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, /* Use gp as fp to prevent truncated fit. Because in relaxation time the fp value is set as gp, and it has be reverted for instruction setting fp. */ - fpbase_addr = elf_gp (output_bfd); + fpbase_addr = elf_gp (info->output_bfd); /* Deal with (dynamic) relocations. */ for (rel = relocs; rel < relend; rel++) @@ -5167,7 +5165,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, else if (ELF32_R_TYPE (rel->r_info) == R_NDS32_RELAX_REGION_END && (rel->r_addend & R_NDS32_RELAX_REGION_OMIT_FP_FLAG)) { - fpbase_addr = elf_gp (output_bfd); + fpbase_addr = elf_gp (info->output_bfd); } /* Skip the relocations used for relaxation. */ @@ -5193,7 +5191,8 @@ nds32_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); addend = rel->r_addend; /* keep symbol location for static TLS_IE GOT entry */ @@ -5280,7 +5279,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, case R_NDS32_GOTOFF_LO19: BFD_ASSERT (sgot != NULL); - relocation -= elf_gp (output_bfd); + relocation -= elf_gp (info->output_bfd); break; case R_NDS32_9_PLTREL: @@ -5324,14 +5323,14 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, using -Bsymbolic. */ if (h) h->plt.offset = (bfd_vma) -1; /* Cancel PLT trampoline. */ - relocation -= elf_gp (output_bfd); + relocation -= elf_gp (info->output_bfd); break; } relocation = (splt->output_section->vma + splt->output_offset + h->plt.offset); - relocation -= elf_gp (output_bfd); + relocation -= elf_gp (info->output_bfd); break; case R_NDS32_PLTREL_HI20: @@ -5370,7 +5369,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, case R_NDS32_GOTPC20: /* .got(_GLOBAL_OFFSET_TABLE_) - pc relocation ld24 rx,#_GLOBAL_OFFSET_TABLE_ */ - relocation = elf_gp (output_bfd); + relocation = elf_gp (info->output_bfd); break; case R_NDS32_GOTPC_HI20: @@ -5383,7 +5382,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, bl .+4 seth rx,#shigh(_GLOBAL_OFFSET_TABLE_) add3 rx,rx,#low(_GLOBAL_OFFSET_TABLE_ +4) */ - relocation = elf_gp (output_bfd); + relocation = elf_gp (info->output_bfd); relocation -= (input_section->output_section->vma + input_section->output_offset + rel->r_offset); break; @@ -5430,12 +5429,13 @@ nds32_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); h->got.offset |= 1; } } relocation = sgot->output_section->vma + sgot->output_offset + off - - elf_gp (output_bfd); + - elf_gp (info->output_bfd); } else { @@ -5454,7 +5454,8 @@ nds32_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)) { @@ -5466,20 +5467,20 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); BFD_ASSERT (srelgot != NULL); - outrel.r_offset = (elf_gp (output_bfd) + outrel.r_offset = (elf_gp (info->output_bfd) + sgot->output_offset + off); outrel.r_info = ELF32_R_INFO (0, R_NDS32_RELATIVE); 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); ++srelgot->reloc_count; } local_got_offsets[r_symndx] |= 1; } relocation = sgot->output_section->vma + sgot->output_offset + off - - elf_gp (output_bfd); + - elf_gp (info->output_bfd); } break; @@ -5546,7 +5547,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, skip = false; relocate = false; - 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); @@ -5590,7 +5591,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, if (h->got.offset != (bfd_vma) -1 && (h->got.offset & 1) == 0) { - bfd_put_32 (output_bfd, outrel.r_addend, + bfd_put_32 (info->output_bfd, outrel.r_addend, sgot->contents + h->got.offset); } } @@ -5614,7 +5615,7 @@ nds32_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); ++sreloc->reloc_count; /* If this reloc is against an external symbol, we do @@ -5702,7 +5703,7 @@ nds32_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; } @@ -5724,7 +5725,8 @@ nds32_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)) { @@ -5736,21 +5738,21 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); BFD_ASSERT (srelgot != NULL); - outrel.r_offset = (elf_gp (output_bfd) + outrel.r_offset = (elf_gp (info->output_bfd) + sgot->output_offset + off); outrel.r_info = ELF32_R_INFO (0, R_NDS32_RELATIVE); 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); ++srelgot->reloc_count; } local_got_offsets[r_symndx] |= 1; } } relocation = sgot->output_section->vma + sgot->output_offset + off - - elf_gp (output_bfd); + - elf_gp (info->output_bfd); if (relocation & align) { @@ -5793,7 +5795,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, /* If the symbol is in the abs section, the out_bfd will be null. This happens when the relocation has a symbol@GOTOFF. */ - r = nds32_elf_final_sda_base (output_bfd, info, &gp, false); + r = nds32_elf_final_sda_base (info->output_bfd, info, &gp, false); if (r != bfd_reloc_ok) { _bfd_error_handler @@ -5921,7 +5923,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, if (eff_tls_type & GOT_TLS_DESC) { - relocation -= elf_gp (output_bfd); + relocation -= elf_gp (info->output_bfd); if ((R_NDS32_TLS_DESC_HI20 == r_type) && (!need_relocs)) { /* TLS model shall be converted. */ @@ -5930,7 +5932,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, } else if (eff_tls_type & GOT_TLS_IEGP) { - relocation -= elf_gp (output_bfd); + relocation -= elf_gp (info->output_bfd); } } else @@ -5943,7 +5945,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, else if (eff_tls_type & (GOT_TLS_IE | GOT_TLS_IEGP)) { if (eff_tls_type & GOT_TLS_IEGP) - relocation -= elf_gp(output_bfd); + relocation -= elf_gp(info->output_bfd); if (need_relocs) { @@ -5955,18 +5957,19 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, + sgot->output_offset + off); outrel.r_info = ELF32_R_INFO (indx, R_NDS32_TLS_TPOFF); - elf32_nds32_add_dynreloc (output_bfd, info, srelgot, - &outrel); + elf32_nds32_add_dynreloc (info->output_bfd, info, + srelgot, &outrel); } else { - bfd_put_32 (output_bfd, gottpoff (info, relocation_sym), + bfd_put_32 (info->output_bfd, + gottpoff (info, relocation_sym), sgot->contents + off); } } else if (eff_tls_type & GOT_TLS_DESC) { - relocation -= elf_gp (output_bfd); + relocation -= elf_gp (info->output_bfd); if (need_relocs) { if (indx == 0) @@ -5986,22 +5989,25 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, BFD_ASSERT (loc + sizeof (Elf32_External_Rela) <= srelplt->contents + srelplt->size); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); } else { 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); ++srelgot->reloc_count; } } else { /* feed me! */ - bfd_put_32 (output_bfd, 0xdeadbeef, + bfd_put_32 (info->output_bfd, 0xdeadbeef, sgot->contents + off); - bfd_put_32 (output_bfd, gottpoff (info, relocation_sym), + bfd_put_32 (info->output_bfd, + gottpoff (info, relocation_sym), sgot->contents + off + 4); patch_tls_desc_to_ie (contents, rel, input_bfd); BFD_ASSERT(0); @@ -6184,8 +6190,9 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, dynamic sections here. */ static bool -nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, - struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) +nds32_elf_finish_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { struct elf_link_hash_table *ehtab; struct elf_nds32_link_hash_entry *hent; @@ -6259,7 +6266,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, long offset; offset = sgot->output_section->vma + sgot->output_offset + got_offset - - elf_gp (output_bfd); + - elf_gp (info->output_bfd); insn = PLT_PIC_ENTRY_WORD0 + ((offset >> 12) & 0xfffff); bfd_putb32 (insn, splt->contents + h->plt.offset); @@ -6284,7 +6291,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, /* Fill in the entry in the global offset table, so it will fall through to the next instruction for the first time. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (splt->output_section->vma + splt->output_offset + h->plt.offset + local_plt_offset), sgot->contents + got_offset); @@ -6296,7 +6303,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, rela.r_addend = 0; loc = srela->contents; loc += 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) { @@ -6342,14 +6349,14 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, if ((h->got.offset & 1) == 0) { - bfd_put_32 (output_bfd, rela.r_addend, + bfd_put_32 (info->output_bfd, rela.r_addend, sgot->contents + h->got.offset); } } else { BFD_ASSERT ((h->got.offset & 1) == 0); - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); rela.r_info = ELF32_R_INFO (h->dynindx, R_NDS32_GLOB_DAT); rela.r_addend = 0; @@ -6357,7 +6364,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, loc = srelagot->contents; loc += srelagot->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); ++srelagot->reloc_count; BFD_ASSERT (loc < (srelagot->contents + srelagot->size)); } @@ -6383,7 +6390,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, rela.r_addend = 0; loc = s->contents; loc += 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); ++s->reloc_count; } @@ -6399,7 +6406,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, +nds32_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -6453,14 +6460,14 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, get_vma: BFD_ASSERT (s != NULL); 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 = ehtab->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_RELASZ: @@ -6478,21 +6485,21 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, s = ehtab->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; case DT_TLSDESC_PLT: 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; } } @@ -6507,7 +6514,7 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, long offset; offset = sgotplt->output_section->vma + sgotplt->output_offset + 4 - - elf_gp (output_bfd); + - elf_gp (info->output_bfd); insn = PLT0_PIC_ENTRY_WORD0 | ((offset >> 12) & 0xfffff); bfd_putb32 (insn, splt->contents); @@ -6564,8 +6571,8 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, + htab->root.tlsdesc_got; /* Get GP offset. */ - pltgot -= elf_gp (output_bfd) - 4; /* PLTGOT[1] */ - tlsdesc_got -= elf_gp (output_bfd); + pltgot -= elf_gp (info->output_bfd) - 4; /* PLTGOT[1] */ + tlsdesc_got -= elf_gp (info->output_bfd); /* Do relocation. */ dl_tlsdesc_lazy_trampoline[0] += ((1 << 20) - 1) & (tlsdesc_got >> 12); @@ -6584,13 +6591,13 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, if (sgotplt && sgotplt->size > 0) { if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents); else - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn->output_section->vma + sdyn->output_offset, sgotplt->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 8); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents + 4); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents + 8); elf_section_data (sgotplt->output_section)->this_hdr.sh_entsize = 4; } @@ -12560,8 +12567,7 @@ nds32_elf_section_flags (const Elf_Internal_Shdr *hdr) } static bool -nds32_elf_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +nds32_elf_output_arch_syms (struct bfd_link_info *info, void *finfo ATTRIBUTE_UNUSED, int (*func) (void *, const char *, Elf_Internal_Sym *, diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 56569435fb7..ab5b2f495f8 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -1291,8 +1291,7 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd, accordingly. */ static int -or1k_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +or1k_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -1388,7 +1387,8 @@ or1k_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); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); @@ -1474,7 +1474,7 @@ or1k_elf_relocate_section (bfd *output_bfd, else { /* Write entry in GOT. */ - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, sgot->contents + off); /* Mark GOT entry as having been written. */ h->got.offset |= 1; @@ -1499,7 +1499,8 @@ or1k_elf_relocate_section (bfd *output_bfd, else { /* Write entry in GOT. */ - bfd_put_32 (output_bfd, relocation, sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + sgot->contents + off); if (bfd_link_pic (info)) { asection *srelgot; @@ -1516,7 +1517,7 @@ or1k_elf_relocate_section (bfd *output_bfd, 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); ++srelgot->reloc_count; } local_got_offsets[r_symndx] |= 1; @@ -1644,8 +1645,8 @@ or1k_elf_relocate_section (bfd *output_bfd, skip = 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) @@ -1669,7 +1670,7 @@ or1k_elf_relocate_section (bfd *output_bfd, 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); break; } break; @@ -1794,15 +1795,16 @@ or1k_elf_relocate_section (bfd *output_bfd, loc += (srelgot->reloc_count++ * sizeof (Elf32_External_Rela)); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - bfd_put_32 (output_bfd, 0, sgot->contents + gotoff + i*4); + bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc); + bfd_put_32 (info->output_bfd, 0, + sgot->contents + gotoff + i*4); } } /* Static GD. */ else if ((tls_type & TLS_GD) != 0) { - bfd_put_32 (output_bfd, 1, sgot->contents + gotoff); - bfd_put_32 (output_bfd, tpoff (info, relocation, dynamic), + bfd_put_32 (info->output_bfd, 1, sgot->contents + gotoff); + bfd_put_32 (info->output_bfd, tpoff (info, relocation, dynamic), sgot->contents + gotoff + 4); } @@ -1829,12 +1831,12 @@ or1k_elf_relocate_section (bfd *output_bfd, loc = srelgot->contents; loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - bfd_put_32 (output_bfd, 0, sgot->contents + gotoff); + bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc); + bfd_put_32 (info->output_bfd, 0, sgot->contents + gotoff); } /* Static IE. */ else if ((tls_type & TLS_IE) != 0) - bfd_put_32 (output_bfd, tpoff (info, relocation, dynamic), + bfd_put_32 (info->output_bfd, tpoff (info, relocation, dynamic), sgot->contents + gotoff); /* The PG21 and LO13 relocs are pc-relative, while the @@ -2319,8 +2321,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj, /* Finish up the dynamic sections. */ static bool -or1k_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +or1k_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -2373,7 +2374,7 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd, dyn.d_un.d_val = s->size; break; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } @@ -2412,7 +2413,7 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd, plt[2] = OR1K_LWZ(12,12) | (lo + 4); } - or1k_write_plt_entry (output_bfd, splt->contents, OR1K_JR(15), + or1k_write_plt_entry (info->output_bfd, splt->contents, OR1K_JR(15), plt, plt_insn_count); elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; @@ -2424,9 +2425,9 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd, if (sgot && 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); elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; @@ -2442,8 +2443,7 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd, dynamic sections here. */ static bool -or1k_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +or1k_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -2552,14 +2552,14 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd, plt_insn_count = 5; } - or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset, + or1k_write_plt_entry (info->output_bfd, splt->contents + h->plt.offset, OR1K_JR(12), plt, plt_insn_count); /* Fill in the entry in the global offset table. We initialize it to point to the top of the plt. This is done to lazy lookup the actual symbol as the first plt entry will be setup by libc to call the runtime dynamic linker. */ - bfd_put_32 (output_bfd, plt_base_addr, sgot->contents + got_offset); + bfd_put_32 (info->output_bfd, plt_base_addr, sgot->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ rela.r_offset = got_addr; @@ -2567,7 +2567,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = srela->contents; loc += 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) { @@ -2609,14 +2609,14 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd, else { BFD_ASSERT ((h->got.offset & 1) == 0); - 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); rela.r_info = ELF32_R_INFO (h->dynindx, R_OR1K_GLOB_DAT); rela.r_addend = 0; } loc = srelgot->contents; loc += srelgot->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); ++srelgot->reloc_count; } @@ -2640,7 +2640,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd, else s = htab->root.srelbss; 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); ++s->reloc_count; } @@ -3045,8 +3045,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Set the sizes of the dynamic sections. */ static bool -or1k_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +or1k_elf_late_size_sections (struct bfd_link_info *info) { struct elf_or1k_link_hash_table *htab; bfd *dynobj; @@ -3212,7 +3211,7 @@ or1k_elf_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); } /* Copy the extra info we tack onto an elf_link_hash_entry. */ diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index d4a3cd0e460..e3b54336da5 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4291,7 +4291,7 @@ ppc_elf_inline_plt (struct bfd_link_info *info) generic ELF tls_setup function. */ asection * -ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) +ppc_elf_tls_setup (struct bfd_link_info *info) { struct ppc_elf_link_hash_table *htab; @@ -4356,7 +4356,7 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) elf_section_flags (htab->elf.splt->output_section) = SHF_ALLOC + SHF_WRITE; } - return bfd_elf_tls_setup (obfd, info); + return bfd_elf_tls_setup (info); } /* Return TRUE iff REL is a branch reloc with a global symbol matching @@ -5466,8 +5466,7 @@ static const unsigned char glink_eh_frame_cie[] = /* Set the sizes of the dynamic sections. */ static bool -ppc_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +ppc_elf_late_size_sections (struct bfd_link_info *info) { struct ppc_elf_link_hash_table *htab; asection *s; @@ -5884,8 +5883,7 @@ ppc_elf_late_size_sections (bfd *output_bfd, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (!_bfd_elf_maybe_vxworks_add_dynamic_tags (output_bfd, info, - relocs)) + if (!_bfd_elf_maybe_vxworks_add_dynamic_tags (info, relocs)) return false; if (htab->plt_type == PLT_NEW @@ -6965,8 +6963,7 @@ count_and_swap_reloc_out (bfd *obfd, Elf_Internal_Rela *rel, asection *s) accordingly. */ static int -ppc_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +ppc_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -7056,7 +7053,8 @@ ppc_elf_relocate_section (bfd *output_bfd, sec = local_sections[r_symndx]; sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec); - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -7823,9 +7821,8 @@ ppc_elf_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32); if (tls_ty == (TLS_TLS | TLS_GD)) { - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, - &outrel, - rsec)); + BFD_ASSERT (count_and_swap_reloc_out + (info->output_bfd, &outrel, rsec)); outrel.r_offset += 4; outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32); @@ -7852,7 +7849,7 @@ ppc_elf_relocate_section (bfd *output_bfd, outrel.r_addend -= htab->elf.tls_sec->vma; } } - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, + BFD_ASSERT (count_and_swap_reloc_out (info->output_bfd, &outrel, rsec)); } @@ -8097,7 +8094,7 @@ ppc_elf_relocate_section (bfd *output_bfd, are copied into the output file to be resolved at run time. */ skip = 0; - outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, + outrel.r_offset = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1 @@ -8214,7 +8211,7 @@ ppc_elf_relocate_section (bfd *output_bfd, if (sreloc == NULL) return false; - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, &outrel, + BFD_ASSERT (count_and_swap_reloc_out (info->output_bfd, &outrel, sreloc)); if (skip == -1) @@ -8795,7 +8792,7 @@ ppc_elf_relocate_section (bfd *output_bfd, r = bfd_reloc_outofrange; else { - ppc_elf_vle_split20 (output_bfd, contents + rel->r_offset, + ppc_elf_vle_split20 (info->output_bfd, contents + rel->r_offset, relocation); r = bfd_reloc_ok; } @@ -9023,7 +9020,7 @@ ppc_elf_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) { info->callbacks->einfo @@ -9331,8 +9328,8 @@ ppc_elf_relocate_section (bfd *output_bfd, while (slo < shi) { Elf32_External_Rela *srel = slo + (shi - slo) / 2; - bfd_elf32_swap_reloca_in (output_bfd, (bfd_byte *) srel, - &outrel); + bfd_elf32_swap_reloca_in (info->output_bfd, + (bfd_byte *) srel, &outrel); if (outrel.r_offset < soffset) slo = srel + 1; else if (outrel.r_offset > soffset + 3) @@ -9346,7 +9343,7 @@ ppc_elf_relocate_section (bfd *output_bfd, srel = srelend - 1; } outrel.r_offset += patch_off - offset; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, (bfd_byte *) srel); break; } @@ -9804,8 +9801,7 @@ ppc_finish_symbols (struct bfd_link_info *info) dynamic sections here. */ static bool -ppc_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +ppc_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -9885,7 +9881,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_offset = SYM_VAL (h); rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY); rela.r_addend = 0; - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, &rela, s)); + BFD_ASSERT (count_and_swap_reloc_out (info->output_bfd, &rela, s)); } #ifdef DEBUG @@ -9921,8 +9917,7 @@ ppc_elf_reloc_type_class (const struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -ppc_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +ppc_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf) { asection *sdyn; @@ -9995,13 +9990,13 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, default: #ifdef OBJ_MAYBE_ELF_VXWORKS if (htab->elf.target_os == is_vxworks - && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn)) + && elf_vxworks_finish_dynamic_entry (info->output_bfd, &dyn)) break; #endif /* OBJ_MAYBE_ELF_VXWORKS */ continue; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } } @@ -10021,7 +10016,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, _GLOBAL_OFFSET_TABLE_. */ BFD_ASSERT (htab->elf.hgot->root.u.def.value - 4 < htab->elf.hgot->root.u.def.section->size); - bfd_put_32 (output_bfd, 0x4e800021, p - 4); + bfd_put_32 (info->output_bfd, 0x4e800021, p - 4); } if (sdyn != NULL) @@ -10029,7 +10024,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, bfd_vma val = sdyn->output_section->vma + sdyn->output_offset; BFD_ASSERT (htab->elf.hgot->root.u.def.value < htab->elf.hgot->root.u.def.section->size); - bfd_put_32 (output_bfd, val, p); + bfd_put_32 (info->output_bfd, val, p); } } else @@ -10062,22 +10057,22 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, { bfd_vma got_value = SYM_VAL (htab->elf.hgot); - bfd_put_32 (output_bfd, plt_entry[0] | PPC_HA (got_value), + bfd_put_32 (info->output_bfd, plt_entry[0] | PPC_HA (got_value), splt->contents + 0); - bfd_put_32 (output_bfd, plt_entry[1] | PPC_LO (got_value), + bfd_put_32 (info->output_bfd, plt_entry[1] | PPC_LO (got_value), splt->contents + 4); } else { - bfd_put_32 (output_bfd, plt_entry[0], splt->contents + 0); - bfd_put_32 (output_bfd, plt_entry[1], splt->contents + 4); + bfd_put_32 (info->output_bfd, plt_entry[0], splt->contents + 0); + bfd_put_32 (info->output_bfd, plt_entry[1], splt->contents + 4); } - bfd_put_32 (output_bfd, plt_entry[2], splt->contents + 8); - bfd_put_32 (output_bfd, plt_entry[3], splt->contents + 12); - bfd_put_32 (output_bfd, plt_entry[4], splt->contents + 16); - bfd_put_32 (output_bfd, plt_entry[5], splt->contents + 20); - bfd_put_32 (output_bfd, plt_entry[6], splt->contents + 24); - bfd_put_32 (output_bfd, plt_entry[7], splt->contents + 28); + bfd_put_32 (info->output_bfd, plt_entry[2], splt->contents + 8); + bfd_put_32 (info->output_bfd, plt_entry[3], splt->contents + 12); + bfd_put_32 (info->output_bfd, plt_entry[4], splt->contents + 16); + bfd_put_32 (info->output_bfd, plt_entry[5], splt->contents + 20); + bfd_put_32 (info->output_bfd, plt_entry[6], splt->contents + 24); + bfd_put_32 (info->output_bfd, plt_entry[7], splt->contents + 28); if (! bfd_link_pic (info)) { @@ -10092,7 +10087,8 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + 2); rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_HA); rela.r_addend = 0; - BFD_ASSERT (swap_reloc_out (output_bfd, &rela, loc, htab->srelplt2)); + BFD_ASSERT (swap_reloc_out (info->output_bfd, &rela, loc, + htab->srelplt2)); loc += sizeof (Elf32_External_Rela); /* Output the @l relocation for the second instruction. */ @@ -10101,7 +10097,8 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + 6); rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_LO); rela.r_addend = 0; - BFD_ASSERT (swap_reloc_out (output_bfd, &rela, loc, htab->srelplt2)); + BFD_ASSERT (swap_reloc_out (info->output_bfd, &rela, loc, + htab->srelplt2)); loc += sizeof (Elf32_External_Rela); /* Fix up the remaining relocations. They may have the wrong @@ -10111,19 +10108,19 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, { Elf_Internal_Rela rel; - bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + bfd_elf32_swap_reloc_in (info->output_bfd, loc, &rel); rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_HA); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); loc += sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + bfd_elf32_swap_reloc_in (info->output_bfd, loc, &rel); rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_LO); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); loc += sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + bfd_elf32_swap_reloc_in (info->output_bfd, loc, &rel); rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_PPC_ADDR32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); loc += sizeof (Elf32_External_Rela); } } @@ -10203,12 +10200,12 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, endp += htab->glink->size - GLINK_PLTRESOLVE; while (p < endp - (htab->params->ppc476_workaround ? 0 : 8 * 4)) { - bfd_put_32 (output_bfd, B + endp - p, p); + bfd_put_32 (info->output_bfd, B + endp - p, p); p += 4; } while (p < endp) { - bfd_put_32 (output_bfd, NOP, p); + bfd_put_32 (info->output_bfd, NOP, p); p += 4; } @@ -10235,16 +10232,16 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, unsigned int insn; loc = htab->glink->contents + page_addr - 4 - glink_start; - insn = bfd_get_32 (output_bfd, loc); + insn = bfd_get_32 (info->output_bfd, loc); if (insn == BCTR) { /* By alignment, we know that there must be at least one other call stub before this one. */ - insn = bfd_get_32 (output_bfd, loc - 16); + insn = bfd_get_32 (info->output_bfd, loc - 16); if (insn == BCTR) - bfd_put_32 (output_bfd, B | (-16 & 0x3fffffc), loc); + bfd_put_32 (info->output_bfd, B | (-16 & 0x3fffffc), loc); else - bfd_put_32 (output_bfd, B | (-20 & 0x3fffffc), loc); + bfd_put_32 (info->output_bfd, B | (-20 & 0x3fffffc), loc); } } } @@ -10259,70 +10256,73 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + htab->glink->output_section->vma + htab->glink->output_offset); - bfd_put_32 (output_bfd, ADDIS_11_11 + PPC_HA (bcl - res0), p); + bfd_put_32 (info->output_bfd, ADDIS_11_11 + PPC_HA (bcl - res0), p); p += 4; - bfd_put_32 (output_bfd, MFLR_0, p); + bfd_put_32 (info->output_bfd, MFLR_0, p); p += 4; - bfd_put_32 (output_bfd, BCL_20_31, p); + bfd_put_32 (info->output_bfd, BCL_20_31, p); p += 4; - bfd_put_32 (output_bfd, ADDI_11_11 + PPC_LO (bcl - res0), p); + bfd_put_32 (info->output_bfd, ADDI_11_11 + PPC_LO (bcl - res0), p); p += 4; - bfd_put_32 (output_bfd, MFLR_12, p); + bfd_put_32 (info->output_bfd, MFLR_12, p); p += 4; - bfd_put_32 (output_bfd, MTLR_0, p); + bfd_put_32 (info->output_bfd, MTLR_0, p); p += 4; - bfd_put_32 (output_bfd, SUB_11_11_12, p); + bfd_put_32 (info->output_bfd, SUB_11_11_12, p); p += 4; - bfd_put_32 (output_bfd, ADDIS_12_12 + PPC_HA (got + 4 - bcl), p); + bfd_put_32 (info->output_bfd, ADDIS_12_12 + PPC_HA (got + 4 - bcl), p); p += 4; if (PPC_HA (got + 4 - bcl) == PPC_HA (got + 8 - bcl)) { - bfd_put_32 (output_bfd, LWZ_0_12 + PPC_LO (got + 4 - bcl), p); + bfd_put_32 (info->output_bfd, + LWZ_0_12 + PPC_LO (got + 4 - bcl), p); p += 4; - bfd_put_32 (output_bfd, LWZ_12_12 + PPC_LO (got + 8 - bcl), p); + bfd_put_32 (info->output_bfd, + LWZ_12_12 + PPC_LO (got + 8 - bcl), p); p += 4; } else { - bfd_put_32 (output_bfd, LWZU_0_12 + PPC_LO (got + 4 - bcl), p); + bfd_put_32 (info->output_bfd, + LWZU_0_12 + PPC_LO (got + 4 - bcl), p); p += 4; - bfd_put_32 (output_bfd, LWZ_12_12 + 4, p); + bfd_put_32 (info->output_bfd, LWZ_12_12 + 4, p); p += 4; } - bfd_put_32 (output_bfd, MTCTR_0, p); + bfd_put_32 (info->output_bfd, MTCTR_0, p); p += 4; - bfd_put_32 (output_bfd, ADD_0_11_11, p); + bfd_put_32 (info->output_bfd, ADD_0_11_11, p); } else { - bfd_put_32 (output_bfd, LIS_12 + PPC_HA (got + 4), p); + bfd_put_32 (info->output_bfd, LIS_12 + PPC_HA (got + 4), p); p += 4; - bfd_put_32 (output_bfd, ADDIS_11_11 + PPC_HA (-res0), p); + bfd_put_32 (info->output_bfd, ADDIS_11_11 + PPC_HA (-res0), p); p += 4; if (PPC_HA (got + 4) == PPC_HA (got + 8)) - bfd_put_32 (output_bfd, LWZ_0_12 + PPC_LO (got + 4), p); + bfd_put_32 (info->output_bfd, LWZ_0_12 + PPC_LO (got + 4), p); else - bfd_put_32 (output_bfd, LWZU_0_12 + PPC_LO (got + 4), p); + bfd_put_32 (info->output_bfd, LWZU_0_12 + PPC_LO (got + 4), p); p += 4; - bfd_put_32 (output_bfd, ADDI_11_11 + PPC_LO (-res0), p); + bfd_put_32 (info->output_bfd, ADDI_11_11 + PPC_LO (-res0), p); p += 4; - bfd_put_32 (output_bfd, MTCTR_0, p); + bfd_put_32 (info->output_bfd, MTCTR_0, p); p += 4; - bfd_put_32 (output_bfd, ADD_0_11_11, p); + bfd_put_32 (info->output_bfd, ADD_0_11_11, p); p += 4; if (PPC_HA (got + 4) == PPC_HA (got + 8)) - bfd_put_32 (output_bfd, LWZ_12_12 + PPC_LO (got + 8), p); + bfd_put_32 (info->output_bfd, LWZ_12_12 + PPC_LO (got + 8), p); else - bfd_put_32 (output_bfd, LWZ_12_12 + 4, p); + bfd_put_32 (info->output_bfd, LWZ_12_12 + 4, p); } p += 4; - bfd_put_32 (output_bfd, ADD_11_0_11, p); + bfd_put_32 (info->output_bfd, ADD_11_0_11, p); p += 4; - bfd_put_32 (output_bfd, BCTR, p); + bfd_put_32 (info->output_bfd, BCTR, p); p += 4; while (p < endp) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, htab->params->ppc476_workaround ? BA : NOP, p); p += 4; } @@ -10349,7 +10349,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, bfd_put_32 (htab->elf.dynobj, val, p); if (htab->glink_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME - && !_bfd_elf_write_linker_section_eh_frame (output_bfd, info, + && !_bfd_elf_write_linker_section_eh_frame (info->output_bfd, info, htab->glink_eh_frame, buf)) return false; diff --git a/bfd/elf32-ppc.h b/bfd/elf32-ppc.h index 55b74695efe..b175cfd502e 100644 --- a/bfd/elf32-ppc.h +++ b/bfd/elf32-ppc.h @@ -61,7 +61,7 @@ struct ppc_elf_params void ppc_elf_link_params (struct bfd_link_info *, struct ppc_elf_params *); int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *); bool ppc_elf_inline_plt (struct bfd_link_info *); -asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *); +asection *ppc_elf_tls_setup (struct bfd_link_info *); bool ppc_elf_tls_optimize (bfd *, struct bfd_link_info *); void ppc_elf_maybe_strip_sdata_syms (struct bfd_link_info *); extern bool ppc_elf_modify_segment_map (bfd *, struct bfd_link_info *) diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c index 626f7948975..6e699004d04 100644 --- a/bfd/elf32-pru.c +++ b/bfd/elf32-pru.c @@ -681,8 +681,7 @@ pru_elf32_ldi32_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol, /* Implement elf_backend_relocate_section. */ static int -pru_elf32_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +pru_elf32_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -736,7 +735,8 @@ pru_elf32_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 { diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index 2c83214a912..2b782c1463a 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -702,8 +702,7 @@ rl78_special_reloc (bfd * input_bfd, static int rl78_elf_relocate_section - (bfd * output_bfd, - struct bfd_link_info * info, + (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -751,7 +750,8 @@ rl78_elf_relocate_section { 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); @@ -1408,8 +1408,7 @@ rl78_elf_check_relocs /* This must exist if dynobj is ever set. */ static bool -rl78_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +rl78_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -1445,8 +1444,7 @@ rl78_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED, } static bool -rl78_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +rl78_elf_early_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *splt; diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index 3f26d7684f9..1421e443e51 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -494,8 +494,7 @@ static unsigned int rx_stack_top; static int rx_elf_relocate_section - (bfd * output_bfd, - struct bfd_link_info * info, + (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -513,7 +512,7 @@ rx_elf_relocate_section bfd_vma table_start_cache = 0; bfd_vma table_end_cache = 0; - if (elf_elfheader (output_bfd)->e_flags & E_FLAG_RX_PID) + if (elf_elfheader (info->output_bfd)->e_flags & E_FLAG_RX_PID) pid_mode = true; else pid_mode = false; @@ -550,7 +549,8 @@ rx_elf_relocate_section { 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); @@ -796,7 +796,7 @@ rx_elf_relocate_section case R_RX_DIR16S: UNSAFE_FOR_PID; RANGE (-32768, 65535); - if (BIGE (output_bfd) && !(input_section->flags & SEC_CODE)) + if (BIGE (info->output_bfd) && !(input_section->flags & SEC_CODE)) { OP (1) = relocation; OP (0) = relocation >> 8; @@ -886,7 +886,7 @@ rx_elf_relocate_section case R_RX_DIR24S: UNSAFE_FOR_PID; RANGE (-0x800000, 0x7fffff); - if (BIGE (output_bfd) && !(input_section->flags & SEC_CODE)) + if (BIGE (info->output_bfd) && !(input_section->flags & SEC_CODE)) { OP (2) = relocation; OP (1) = relocation >> 8; @@ -949,7 +949,7 @@ rx_elf_relocate_section break; case R_RX_DIR32: - if (BIGE (output_bfd) && !(input_section->flags & SEC_CODE)) + if (BIGE (info->output_bfd) && !(input_section->flags & SEC_CODE)) { OP (3) = relocation; OP (2) = relocation >> 8; @@ -966,7 +966,7 @@ rx_elf_relocate_section break; case R_RX_DIR32_REV: - if (BIGE (output_bfd)) + if (BIGE (info->output_bfd)) { OP (0) = relocation; OP (1) = relocation >> 8; @@ -986,9 +986,9 @@ rx_elf_relocate_section { bfd_vma val; WARN_REDHAT ("RX_RH_DIFF"); - val = bfd_get_32 (output_bfd, & OP (0)); + val = bfd_get_32 (info->output_bfd, & OP (0)); val -= relocation; - bfd_put_32 (output_bfd, val, & OP (0)); + bfd_put_32 (info->output_bfd, val, & OP (0)); } break; @@ -1149,7 +1149,7 @@ rx_elf_relocate_section UNSAFE_FOR_PID; RX_STACK_POP (relocation); RANGE (-0x800000, 0x7fffff); - if (BIGE (output_bfd) && !(input_section->flags & SEC_CODE)) + if (BIGE (info->output_bfd) && !(input_section->flags & SEC_CODE)) { OP (2) = relocation; OP (1) = relocation >> 8; @@ -1193,7 +1193,7 @@ rx_elf_relocate_section case R_RX_ABS16S: RX_STACK_POP (relocation); RANGE (-32768, 32767); - if (BIGE (output_bfd) && !(input_section->flags & SEC_CODE)) + if (BIGE (info->output_bfd) && !(input_section->flags & SEC_CODE)) { OP (1) = relocation; OP (0) = relocation >> 8; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 8fec2f7d43f..fb00971c7b6 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1773,8 +1773,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Set the sizes of the dynamic sections. */ static bool -elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_s390_late_size_sections (struct bfd_link_info *info) { struct elf_s390_link_hash_table *htab; bfd *dynobj; @@ -1960,7 +1959,7 @@ elf_s390_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); } /* Return the base VMA address which should be subtracted from real addresses @@ -2014,8 +2013,7 @@ invalid_tls_insn (bfd *input_bfd, /* Relocate a 390 ELF section. */ static int -elf_s390_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_s390_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2110,7 +2108,7 @@ elf_s390_relocate_section (bfd *output_bfd, case R_390_GOTENT: { /* Write the PLT slot address into the GOT slot. */ - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + local_got_offsets[r_symndx]); relocation = (local_got_offsets[r_symndx] + @@ -2130,7 +2128,8 @@ elf_s390_relocate_section (bfd *output_bfd, goto do_relocation; } 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 { @@ -2261,7 +2260,7 @@ elf_s390_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, base_got->contents + off); h->got.offset |= 1; } @@ -2285,7 +2284,7 @@ elf_s390_relocate_section (bfd *output_bfd, unsigned short new_insn = (0xc000 | (bfd_get_8 (input_bfd, contents + rel->r_offset - 1) & 0xf0)); - bfd_put_16 (output_bfd, new_insn, + bfd_put_16 (info->output_bfd, new_insn, contents + rel->r_offset - 2); r_type = R_390_PC32DBL; rel->r_info = ELF32_R_INFO (r_symndx, r_type); @@ -2314,7 +2313,7 @@ elf_s390_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); if (bfd_link_pic (info)) @@ -2334,7 +2333,7 @@ elf_s390_relocate_section (bfd *output_bfd, 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; @@ -2504,7 +2503,7 @@ elf_s390_relocate_section (bfd *output_bfd, /* Need a dynamic relocation to get the real function address. */ - 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); @@ -2532,7 +2531,7 @@ elf_s390_relocate_section (bfd *output_bfd, } sreloc = htab->elf.irelifunc; - _bfd_elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (info->output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, @@ -2578,8 +2577,8 @@ elf_s390_relocate_section (bfd *output_bfd, 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) @@ -2654,7 +2653,7 @@ elf_s390_relocate_section (bfd *output_bfd, 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); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, we @@ -2682,7 +2681,7 @@ elf_s390_relocate_section (bfd *output_bfd, abort (); loc = sreloc->contents; loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &outrel, loc); } /* Fall through. */ @@ -2708,7 +2707,8 @@ elf_s390_relocate_section (bfd *output_bfd, /* This relocation gets optimized away by the local exec access optimization. */ BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, -tpoff (info, relocation) + rel->r_addend, + bfd_put_32 (info->output_bfd, + -tpoff (info, relocation) + rel->r_addend, contents + rel->r_offset); continue; } @@ -2755,14 +2755,14 @@ elf_s390_relocate_section (bfd *output_bfd, loc = htab->elf.srelgot->contents; loc += htab->elf.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); if (r_type == R_390_TLS_GD32) { if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - dtpoff_base (info), htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); } @@ -2773,7 +2773,8 @@ elf_s390_relocate_section (bfd *output_bfd, outrel.r_addend = 0; htab->elf.srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, + &outrel, loc); } } @@ -2794,7 +2795,8 @@ elf_s390_relocate_section (bfd *output_bfd, } else { - bfd_put_32 (output_bfd, htab->elf.sgot->output_offset + off, + bfd_put_32 (info->output_bfd, + htab->elf.sgot->output_offset + off, contents + rel->r_offset); continue; } @@ -2825,7 +2827,7 @@ elf_s390_relocate_section (bfd *output_bfd, abort (); BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, -tpoff (info, relocation), + bfd_put_32 (info->output_bfd, -tpoff (info, relocation), htab->elf.sgot->contents + off); relocation = htab->elf.sgot->output_offset + off; if (r_type == R_390_TLS_IEENT) @@ -2857,14 +2859,14 @@ elf_s390_relocate_section (bfd *output_bfd, outrel.r_offset = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); outrel.r_info = ELF32_R_INFO (0, R_390_TLS_DTPMOD); outrel.r_addend = 0; loc = htab->elf.srelgot->contents; loc += htab->elf.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); htab->tls_ldm_got.offset |= 1; } relocation = htab->elf.sgot->output_offset + off; @@ -2898,12 +2900,13 @@ elf_s390_relocate_section (bfd *output_bfd, abort (); 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); } else { BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, -tpoff (info, relocation) + rel->r_addend, + bfd_put_32 (info->output_bfd, + -tpoff (info, relocation) + rel->r_addend, contents + rel->r_offset); } continue; @@ -2959,7 +2962,7 @@ elf_s390_relocate_section (bfd *output_bfd, return false; } insn = 0x18000700 | (insn & 0x00f00000) | ry; - bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, insn, contents + rel->r_offset); } } else if (r_type == R_390_TLS_GDCALL) @@ -2993,7 +2996,7 @@ elf_s390_relocate_section (bfd *output_bfd, /* GD->LE transition. brasl %r14,_tls_get_offset@plt -> brcl 0,. */ insn = 0xc0040000; - bfd_put_16 (output_bfd, 0x0000, + bfd_put_16 (info->output_bfd, 0x0000, contents + rel->r_offset + 4); } } @@ -3019,11 +3022,11 @@ elf_s390_relocate_section (bfd *output_bfd, brasl %r14,__tls_get_addr@plt -> l %r2,0(%r2,%r12) ; bcr 0,0 */ insn = 0x5822c000; - bfd_put_16 (output_bfd, 0x0700, + bfd_put_16 (info->output_bfd, 0x0700, contents + rel->r_offset + 4); } } - bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, insn, contents + rel->r_offset); } else if (r_type == R_390_TLS_LDCALL) { @@ -3057,10 +3060,10 @@ elf_s390_relocate_section (bfd *output_bfd, /* LD->LE transition. brasl %r14,__tls_get_offset@plt -> brcl 0,. */ insn = 0xc0040000; - bfd_put_16 (output_bfd, 0x0000, + bfd_put_16 (info->output_bfd, 0x0000, contents + rel->r_offset + 4); } - bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, insn, contents + rel->r_offset); } } continue; @@ -3075,7 +3078,7 @@ elf_s390_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 /* xgettext:c-format */ @@ -3298,8 +3301,7 @@ elf_s390_finish_ifunc_symbol (bfd *output_bfd, dynamic sections here. */ static bool -elf_s390_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf_s390_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3320,7 +3322,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, it up. */ if (s390_is_ifunc_symbol_p (h) && h->def_regular) { - elf_s390_finish_ifunc_symbol (output_bfd, info, h, + elf_s390_finish_ifunc_symbol (info->output_bfd, info, h, htab, h->plt.offset, eh->ifunc_resolver_address + eh->ifunc_resolver_section->output_offset + @@ -3360,11 +3362,11 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, PLT_ENTRY_SIZE); /* Adjust jump to the first plt entry. */ - bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16), + bfd_put_32 (info->output_bfd, relative_offset << 16, htab->elf.splt->contents + h->plt.offset + 20); /* Push the GOT offset field. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + got_offset), @@ -3381,11 +3383,11 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, /* Put in the GOT offset as displacement value. The 0xc000 value comes from the first word of the plt entry. Look at the elf_s390_plt_pic12_entry content. */ - bfd_put_16 (output_bfd, (bfd_vma)0xc000 | got_offset, + bfd_put_16 (info->output_bfd, 0xc000 | got_offset, htab->elf.splt->contents + h->plt.offset + 2); /* Adjust the jump to the first plt entry. */ - bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16), + bfd_put_32 (info->output_bfd, relative_offset << 16, htab->elf.splt->contents + h->plt.offset + 20); } else if (got_offset < 32768) @@ -3398,11 +3400,11 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, PLT_ENTRY_SIZE); /* Put in the GOT offset for the lhi instruction. */ - bfd_put_16 (output_bfd, (bfd_vma)got_offset, + bfd_put_16 (info->output_bfd, got_offset, htab->elf.splt->contents + h->plt.offset + 2); /* Adjust the jump to the first plt entry. */ - bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16), + bfd_put_32 (info->output_bfd, relative_offset << 16, htab->elf.splt->contents + h->plt.offset + 20); } else @@ -3412,20 +3414,20 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, PLT_ENTRY_SIZE); /* Adjust the jump to the first plt entry. */ - bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16), + bfd_put_32 (info->output_bfd, relative_offset << 16, htab->elf.splt->contents + h->plt.offset + 20); /* Push the GOT offset field. */ - bfd_put_32 (output_bfd, got_offset, + bfd_put_32 (info->output_bfd, got_offset, htab->elf.splt->contents + h->plt.offset + 24); } /* Insert offset into reloc. table here. */ - bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), + bfd_put_32 (info->output_bfd, plt_index * sizeof (Elf32_External_Rela), htab->elf.splt->contents + h->plt.offset + 28); /* Fill in the entry in the global offset table. Points to instruction after GOT offset. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.splt->output_section->vma + htab->elf.splt->output_offset + h->plt.offset @@ -3439,7 +3441,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELF32_R_INFO (h->dynindx, R_390_JMP_SLOT); rela.r_addend = 0; loc = htab->elf.srelplt->contents + 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) { @@ -3491,9 +3493,9 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, /* For non-shared objects explicit GOT slots must be filled with the PLT slot address for pointer equality reasons. */ - bfd_put_32 (output_bfd, (htab->elf.iplt->output_section->vma - + htab->elf.iplt->output_offset - + h->plt.offset), + bfd_put_32 (info->output_bfd, (htab->elf.iplt->output_section->vma + + htab->elf.iplt->output_offset + + h->plt.offset), htab->elf.sgot->contents + h->got.offset); return true; } @@ -3521,14 +3523,15 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, { BFD_ASSERT((h->got.offset & 1) == 0); do_glob_dat: - bfd_put_32 (output_bfd, (bfd_vma) 0, htab->elf.sgot->contents + h->got.offset); + bfd_put_32 (info->output_bfd, 0, + htab->elf.sgot->contents + h->got.offset); rela.r_info = ELF32_R_INFO (h->dynindx, R_390_GLOB_DAT); rela.r_addend = 0; } loc = htab->elf.srelgot->contents; loc += htab->elf.srelgot->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) @@ -3556,7 +3559,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, else s = htab->elf.srelbss; 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 some specially defined symbols as absolute. */ @@ -3609,8 +3612,7 @@ elf_s390_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, /* Finish up the dynamic sections. */ static bool -elf_s390_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf_s390_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_s390_link_hash_table *htab; @@ -3661,7 +3663,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, break; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } /* Fill in the special first entry in the procedure linkage table. */ @@ -3677,7 +3679,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, { memcpy (htab->elf.splt->contents, elf_s390_plt_first_entry, PLT_FIRST_ENTRY_SIZE); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset, htab->elf.splt->contents + 24); @@ -3693,14 +3695,14 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, /* Fill in the first three entries in the global offset table. */ if (htab->elf.sgotplt->size > 0) { - bfd_put_32 (output_bfd, - (sdyn == NULL ? (bfd_vma) 0 + bfd_put_32 (info->output_bfd, + (sdyn == NULL ? 0 : sdyn->output_section->vma + sdyn->output_offset), htab->elf.sgotplt->contents); /* One entry for shared object struct ptr. */ - bfd_put_32 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + 4); + bfd_put_32 (info->output_bfd, 0, htab->elf.sgotplt->contents + 4); /* One entry for _dl_runtime_resolve. */ - bfd_put_32 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + 8); + bfd_put_32 (info->output_bfd, 0, htab->elf.sgotplt->contents + 8); } elf_section_data (htab->elf.sgotplt->output_section) @@ -3730,7 +3732,8 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, return false; if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC) - elf_s390_finish_ifunc_symbol (output_bfd, info, NULL, htab, + elf_s390_finish_ifunc_symbol (info->output_bfd, info, NULL, + htab, local_plt[i].plt.offset, isym->st_value + sec->output_section->vma diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 1b3a1cc5dff..606458722bc 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -2407,8 +2407,7 @@ s3_bfd_score_info_to_howto (bfd *abfd, /* Relocate an score ELF section. */ static int -s3_bfd_score_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +s3_bfd_score_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2432,12 +2431,12 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, if (bfd_link_pic (info)) { asection * p; - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); - for (p = output_bfd->sections; p ; p = p->next) + for (p = info->output_bfd->sections; p ; p = p->next) if ((p->flags & SEC_EXCLUDE) == 0 && (p->flags & SEC_ALLOC) != 0 - && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p)) + && !bed->elf_backend_omit_section_dynsym (info, p)) ++ dynsecsymcount; } @@ -2499,7 +2498,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, offset = ((((value >> 16) & 0x3) << 15) | (value & 0x7fff)) >> 1; addend = (hi16_offset << 16) | (offset & 0xffff); msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend = _bfd_elf_rel_local_sym (info->output_bfd, + sym, &msec, addend); addend -= relocation; addend += msec->output_section->vma + msec->output_offset; uvalue = addend; @@ -2520,7 +2520,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, | (((value >> 16) & 0x7fff) << 10) | (((value >> 32) & 0x7f) << 25); msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend = _bfd_elf_rel_local_sym (info->output_bfd, + sym, &msec, addend); addend -= relocation; addend += msec->output_section->vma + msec->output_offset; addend &= 0xffffffff; @@ -2541,7 +2542,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, | (((value >> 32) & 0x7f) << 23); addend <<= howto->rightshift; msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend = _bfd_elf_rel_local_sym (info->output_bfd, + sym, &msec, addend); addend -= relocation; addend += msec->output_section->vma + msec->output_offset; addend &= 0xffffffff; @@ -2567,7 +2569,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, value = score_bfd_get_32 (input_bfd, contents + rel->r_offset); addend = (((value >> 16) & 0x3) << 14) | ((value & 0x7fff) >> 1); 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; value = (value & (~(howto->dst_mask))) | ((addend & 0x3fff) << 1) | (((addend >> 14) & 0x3) << 16); @@ -2589,7 +2592,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, addend |= mask; } 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; value = (value & ~howto->dst_mask) | (addend & howto->dst_mask); bfd_put_32 (input_bfd, value, contents + rel->r_offset); @@ -2608,7 +2612,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, addend |= mask; } 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; value = (value & ~howto->dst_mask) | (addend & howto->dst_mask); score_bfd_put_32 (input_bfd, value, contents + rel->r_offset); @@ -2679,7 +2684,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, in s3_bfd_score_elf_create_dynamic_sections. Otherwise, we should define the symbol with a value of 0. */ BFD_ASSERT (! bfd_link_pic (info)); - BFD_ASSERT (bfd_get_section_by_name (output_bfd, ".dynamic") == NULL); + BFD_ASSERT (bfd_get_section_by_name (info->output_bfd, + ".dynamic") == NULL); relocation = 0; } else if (!bfd_link_relocatable (info)) @@ -2719,7 +2725,7 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, } /* This is a final link. */ - r = score_elf_final_link_relocate (howto, input_bfd, output_bfd, + r = score_elf_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel, relocs, relocation, info, name, (h ? ELF_ST_TYPE ((unsigned int)h->root.root.type) : @@ -3176,8 +3182,7 @@ s3_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* This function is called after all the input files have been read, and the input sections have been assigned to output sections. */ static bool -s3_bfd_score_elf_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +s3_bfd_score_elf_early_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -3236,14 +3241,14 @@ s3_bfd_score_elf_early_size_sections (bfd *output_bfd, local_gotno = (loadable_size >> 16) + 5; g->local_gotno += local_gotno; - s->size += g->local_gotno * SCORE_ELF_GOT_SIZE (output_bfd); + s->size += g->local_gotno * SCORE_ELF_GOT_SIZE (info->output_bfd); g->global_gotno = i; - s->size += i * SCORE_ELF_GOT_SIZE (output_bfd); + s->size += i * SCORE_ELF_GOT_SIZE (info->output_bfd); score_elf_resolve_final_got_entries (g); - if (s->size > SCORE_ELF_GOT_MAX_SIZE (output_bfd)) + if (s->size > SCORE_ELF_GOT_MAX_SIZE (info->output_bfd)) { /* Fixme. Error message or Warning message should be issued here. */ } @@ -3253,7 +3258,7 @@ s3_bfd_score_elf_early_size_sections (bfd *output_bfd, /* Set the sizes of the dynamic sections. */ static bool -s3_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) +s3_bfd_score_elf_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -3317,7 +3322,7 @@ s3_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info there exists a relocation to a read only section or not. */ outname = bfd_section_name (s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 4); + target = bfd_get_section_by_name (info->output_bfd, outname + 4); if ((target != NULL && (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_ALLOC) != 0) || strcmp (outname, ".rel.dyn") == 0) @@ -3479,8 +3484,7 @@ s3_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ static bool -s3_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +s3_bfd_score_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3507,16 +3511,17 @@ s3_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, { _bfd_error_handler (_("%pB: cannot handle more than %d dynamic symbols"), - output_bfd, 0xffff); + info->output_bfd, 0xffff); bfd_set_error (bfd_error_bad_value); return false; } /* Fill the stub. */ - score_bfd_put_32 (output_bfd, STUB_LW, stub); - score_bfd_put_32 (output_bfd, STUB_MOVE, stub + 4); - score_bfd_put_32 (output_bfd, STUB_LI16 | (h->dynindx << 1), stub + 8); - score_bfd_put_32 (output_bfd, STUB_BRL, stub + 12); + score_bfd_put_32 (info->output_bfd, STUB_LW, stub); + score_bfd_put_32 (info->output_bfd, STUB_MOVE, stub + 4); + score_bfd_put_32 (info->output_bfd, STUB_LI16 | (h->dynindx << 1), + stub + 8); + score_bfd_put_32 (info->output_bfd, STUB_BRL, stub + 12); BFD_ASSERT (h->plt.offset <= s->size); memcpy (s->contents + h->plt.offset, stub, SCORE_FUNCTION_STUB_SIZE); @@ -3548,7 +3553,7 @@ s3_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, value = sym->st_value; offset = score_elf_global_got_index (dynobj, h); - score_bfd_put_32 (output_bfd, value, sgot->contents + offset); + score_bfd_put_32 (info->output_bfd, value, sgot->contents + offset); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -3566,7 +3571,7 @@ s3_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, { sym->st_shndx = SHN_ABS; sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = elf_gp (output_bfd); + sym->st_value = elf_gp (info->output_bfd); } return true; @@ -3574,8 +3579,7 @@ s3_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -s3_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +s3_bfd_score_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -3638,7 +3642,7 @@ s3_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_SCORE_BASE_ADDRESS: - s = output_bfd->sections; + s = info->output_bfd->sections; BFD_ASSERT (s != NULL); dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff; break; @@ -3651,7 +3655,7 @@ s3_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, /* The index into the dynamic symbol table which is the entry of the first external symbol that is not referenced within the same object. */ - dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1; + dyn.d_un.d_val = bfd_count_sections (info->output_bfd) + 1; break; case DT_SCORE_GOTSYM: @@ -3667,7 +3671,7 @@ s3_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, case DT_SCORE_SYMTABNO: name = ".dynsym"; - elemsize = SCORE_ELF_SYM_SIZE (output_bfd); + elemsize = SCORE_ELF_SYM_SIZE (info->output_bfd); s = bfd_get_linker_section (dynobj, name); dyn.d_un.d_val = s->size / elemsize; break; @@ -3691,21 +3695,22 @@ s3_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, This isn't the case of IRIX rld. */ if (sgot != NULL && sgot->size > 0) { - score_bfd_put_32 (output_bfd, 0, sgot->contents); - score_bfd_put_32 (output_bfd, 0x80000000, sgot->contents + SCORE_ELF_GOT_SIZE (output_bfd)); + score_bfd_put_32 (info->output_bfd, 0, sgot->contents); + score_bfd_put_32 (info->output_bfd, 0x80000000, + sgot->contents + SCORE_ELF_GOT_SIZE (info->output_bfd)); } if (sgot != NULL) elf_section_data (sgot->output_section)->this_hdr.sh_entsize - = SCORE_ELF_GOT_SIZE (output_bfd); + = SCORE_ELF_GOT_SIZE (info->output_bfd); /* We need to sort the entries of the dynamic relocation section. */ s = score_elf_rel_dyn_section (dynobj, false); - if (s != NULL && s->size > (bfd_vma)2 * SCORE_ELF_REL_SIZE (output_bfd)) + if (s != NULL && s->size > (bfd_vma)2 * SCORE_ELF_REL_SIZE (info->output_bfd)) { - reldyn_sorting_bfd = output_bfd; + reldyn_sorting_bfd = info->output_bfd; qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1, sizeof (Elf32_External_Rel), score_elf_sort_dynamic_relocs); } @@ -4098,8 +4103,7 @@ _bfd_score_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, } static int -_bfd_score_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_score_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -4107,14 +4111,14 @@ _bfd_score_elf_relocate_section (bfd *output_bfd, Elf_Internal_Sym *local_syms, asection **local_sections) { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) - return s3_bfd_score_elf_relocate_section (output_bfd, - info, input_bfd, input_section, contents, relocs, - local_syms, local_sections); + if (bfd_get_mach (info->output_bfd) == bfd_mach_score3) + return s3_bfd_score_elf_relocate_section (info, input_bfd, input_section, + contents, relocs, + local_syms, local_sections); else - return s7_bfd_score_elf_relocate_section (output_bfd, - info, input_bfd, input_section, contents, relocs, - local_syms, local_sections); + return s7_bfd_score_elf_relocate_section (info, input_bfd, input_section, + contents, relocs, + local_syms, local_sections); } static bool @@ -4201,22 +4205,21 @@ _bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info, } static bool -_bfd_score_elf_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +_bfd_score_elf_early_size_sections (struct bfd_link_info *info) { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) - return s3_bfd_score_elf_early_size_sections (output_bfd, info); + if (bfd_get_mach (info->output_bfd) == bfd_mach_score3) + return s3_bfd_score_elf_early_size_sections (info); else - return s7_bfd_score_elf_early_size_sections (output_bfd, info); + return s7_bfd_score_elf_early_size_sections (info); } static bool -_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) +_bfd_score_elf_late_size_sections (struct bfd_link_info *info) { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) - return s3_bfd_score_elf_late_size_sections (output_bfd, info); + if (bfd_get_mach (info->output_bfd) == bfd_mach_score3) + return s3_bfd_score_elf_late_size_sections (info); else - return s7_bfd_score_elf_late_size_sections (output_bfd, info); + return s7_bfd_score_elf_late_size_sections (info); } static bool @@ -4229,26 +4232,24 @@ _bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) } static bool -_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_score_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) - return s3_bfd_score_elf_finish_dynamic_symbol (output_bfd, info, h, sym); + if (bfd_get_mach (info->output_bfd) == bfd_mach_score3) + return s3_bfd_score_elf_finish_dynamic_symbol (info, h, sym); else - return s7_bfd_score_elf_finish_dynamic_symbol (output_bfd, info, h, sym); + return s7_bfd_score_elf_finish_dynamic_symbol (info, h, sym); } static bool -_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_score_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf) { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) - return s3_bfd_score_elf_finish_dynamic_sections (output_bfd, info, buf); + if (bfd_get_mach (info->output_bfd) == bfd_mach_score3) + return s3_bfd_score_elf_finish_dynamic_sections (info, buf); else - return s7_bfd_score_elf_finish_dynamic_sections (output_bfd, info, buf); + return s7_bfd_score_elf_finish_dynamic_sections (info, buf); } static bool diff --git a/bfd/elf32-score.h b/bfd/elf32-score.h index 506446b690a..910454af41b 100644 --- a/bfd/elf32-score.h +++ b/bfd/elf32-score.h @@ -35,8 +35,7 @@ s7_bfd_score_info_to_howto (bfd *, arelent *, Elf_Internal_Rela *) ATTRIBUTE_HIDDEN; extern int -s7_bfd_score_elf_relocate_section (bfd *, - struct bfd_link_info *, +s7_bfd_score_elf_relocate_section (struct bfd_link_info *, bfd *, asection *, bfd_byte *, @@ -81,11 +80,11 @@ s7_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *, ATTRIBUTE_HIDDEN; extern bool -s7_bfd_score_elf_early_size_sections (bfd *, struct bfd_link_info *) +s7_bfd_score_elf_early_size_sections (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern bool -s7_bfd_score_elf_late_size_sections (bfd *, struct bfd_link_info *) +s7_bfd_score_elf_late_size_sections (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern bool @@ -93,13 +92,12 @@ s7_bfd_score_elf_create_dynamic_sections (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern bool -s7_bfd_score_elf_finish_dynamic_symbol (bfd *, - struct bfd_link_info *, +s7_bfd_score_elf_finish_dynamic_symbol (struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *) ATTRIBUTE_HIDDEN; extern bool -s7_bfd_score_elf_finish_dynamic_sections (bfd *, struct bfd_link_info *, +s7_bfd_score_elf_finish_dynamic_sections (struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; extern bool diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index 6bccccc6f67..81c079ff631 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -2249,8 +2249,7 @@ s7_bfd_score_info_to_howto (bfd *abfd, /* Relocate an score ELF section. */ int -s7_bfd_score_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +s7_bfd_score_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2274,12 +2273,12 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, if (bfd_link_pic (info)) { asection * p; - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); - for (p = output_bfd->sections; p ; p = p->next) + for (p = info->output_bfd->sections; p ; p = p->next) if ((p->flags & SEC_EXCLUDE) == 0 && (p->flags & SEC_ALLOC) != 0 - && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p)) + && !bed->elf_backend_omit_section_dynsym (info, p)) ++ dynsecsymcount; } @@ -2346,7 +2345,8 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, offset = ((((value >> 16) & 0x3) << 15) | (value & 0x7fff)) >> 1; addend = (hi16_offset << 16) | (offset & 0xffff); msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend = _bfd_elf_rel_local_sym (info->output_bfd, + sym, &msec, addend); addend -= relocation; addend += msec->output_section->vma + msec->output_offset; uvalue = addend; @@ -2363,7 +2363,8 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, value = bfd_get_32 (input_bfd, contents + rel->r_offset); addend = (((value >> 16) & 0x3) << 14) | ((value & 0x7fff) >> 1); 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; value = (value & (~(howto->dst_mask))) | ((addend & 0x3fff) << 1) | (((addend >> 14) & 0x3) << 16); @@ -2383,7 +2384,8 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, addend |= mask; } 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; value = (value & ~howto->dst_mask) | (addend & howto->dst_mask); bfd_put_32 (input_bfd, value, contents + rel->r_offset); @@ -2455,7 +2457,8 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, in s7_bfd_score_elf_create_dynamic_sections. Otherwise, we should define the symbol with a value of 0. */ BFD_ASSERT (! bfd_link_pic (info)); - BFD_ASSERT (bfd_get_section_by_name (output_bfd, ".dynamic") == NULL); + BFD_ASSERT (bfd_get_section_by_name (info->output_bfd, + ".dynamic") == NULL); relocation = 0; } else if (!bfd_link_relocatable (info)) @@ -2530,7 +2533,7 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, } /* This is a final link. */ - r = score_elf_final_link_relocate (howto, input_bfd, output_bfd, + r = score_elf_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel, relocs, relocation, info, name, (h ? ELF_ST_TYPE ((unsigned int) h->root.root.type) : @@ -2985,8 +2988,7 @@ s7_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info, and the input sections have been assigned to output sections. */ bool -s7_bfd_score_elf_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +s7_bfd_score_elf_early_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -3045,14 +3047,14 @@ s7_bfd_score_elf_early_size_sections (bfd *output_bfd, local_gotno = (loadable_size >> 16) + 5; g->local_gotno += local_gotno; - s->size += g->local_gotno * SCORE_ELF_GOT_SIZE (output_bfd); + s->size += g->local_gotno * SCORE_ELF_GOT_SIZE (info->output_bfd); g->global_gotno = i; - s->size += i * SCORE_ELF_GOT_SIZE (output_bfd); + s->size += i * SCORE_ELF_GOT_SIZE (info->output_bfd); score_elf_resolve_final_got_entries (g); - if (s->size > SCORE_ELF_GOT_MAX_SIZE (output_bfd)) + if (s->size > SCORE_ELF_GOT_MAX_SIZE (info->output_bfd)) { /* Fixme. Error message or Warning message should be issued here. */ } @@ -3063,7 +3065,7 @@ s7_bfd_score_elf_early_size_sections (bfd *output_bfd, /* Set the sizes of the dynamic sections. */ bool -s7_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) +s7_bfd_score_elf_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -3127,7 +3129,7 @@ s7_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info there exists a relocation to a read only section or not. */ outname = bfd_section_name (s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 4); + target = bfd_get_section_by_name (info->output_bfd, outname + 4); if ((target != NULL && (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_ALLOC) != 0) || strcmp (outname, ".rel.dyn") == 0) @@ -3290,8 +3292,7 @@ s7_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) dynamic sections here. */ bool -s7_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +s7_bfd_score_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3318,16 +3319,16 @@ s7_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, { _bfd_error_handler (_("%pB: cannot handle more than %d dynamic symbols"), - output_bfd, 0xffff); + info->output_bfd, 0xffff); bfd_set_error (bfd_error_bad_value); return false; } /* Fill the stub. */ - bfd_put_32 (output_bfd, STUB_LW, stub); - bfd_put_32 (output_bfd, STUB_MOVE, stub + 4); - bfd_put_32 (output_bfd, STUB_LI16 | (h->dynindx << 1), stub + 8); - bfd_put_32 (output_bfd, STUB_BRL, stub + 12); + bfd_put_32 (info->output_bfd, STUB_LW, stub); + bfd_put_32 (info->output_bfd, STUB_MOVE, stub + 4); + bfd_put_32 (info->output_bfd, STUB_LI16 | (h->dynindx << 1), stub + 8); + bfd_put_32 (info->output_bfd, STUB_BRL, stub + 12); BFD_ASSERT (h->plt.offset <= s->size); memcpy (s->contents + h->plt.offset, stub, SCORE_FUNCTION_STUB_SIZE); @@ -3359,7 +3360,7 @@ s7_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, value = sym->st_value; offset = score_elf_global_got_index (dynobj, h); - bfd_put_32 (output_bfd, value, sgot->contents + offset); + bfd_put_32 (info->output_bfd, value, sgot->contents + offset); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -3377,7 +3378,7 @@ s7_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, { sym->st_shndx = SHN_ABS; sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = elf_gp (output_bfd); + sym->st_value = elf_gp (info->output_bfd); } return true; @@ -3386,8 +3387,7 @@ s7_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ bool -s7_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +s7_bfd_score_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -3450,7 +3450,7 @@ s7_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_SCORE_BASE_ADDRESS: - s = output_bfd->sections; + s = info->output_bfd->sections; BFD_ASSERT (s != NULL); dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff; break; @@ -3463,7 +3463,7 @@ s7_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, /* The index into the dynamic symbol table which is the entry of the first external symbol that is not referenced within the same object. */ - dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1; + dyn.d_un.d_val = bfd_count_sections (info->output_bfd) + 1; break; case DT_SCORE_GOTSYM: @@ -3479,7 +3479,7 @@ s7_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, case DT_SCORE_SYMTABNO: name = ".dynsym"; - elemsize = SCORE_ELF_SYM_SIZE (output_bfd); + elemsize = SCORE_ELF_SYM_SIZE (info->output_bfd); s = bfd_get_linker_section (dynobj, name); dyn.d_un.d_val = s->size / elemsize; break; @@ -3503,21 +3503,22 @@ s7_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, This isn't the case of IRIX rld. */ if (sgot != NULL && sgot->size > 0) { - bfd_put_32 (output_bfd, 0, sgot->contents); - bfd_put_32 (output_bfd, 0x80000000, sgot->contents + SCORE_ELF_GOT_SIZE (output_bfd)); + bfd_put_32 (info->output_bfd, 0, sgot->contents); + bfd_put_32 (info->output_bfd, 0x80000000, + sgot->contents + SCORE_ELF_GOT_SIZE (info->output_bfd)); } if (sgot != NULL) elf_section_data (sgot->output_section)->this_hdr.sh_entsize - = SCORE_ELF_GOT_SIZE (output_bfd); + = SCORE_ELF_GOT_SIZE (info->output_bfd); /* We need to sort the entries of the dynamic relocation section. */ s = score_elf_rel_dyn_section (dynobj, false); - if (s != NULL && s->size > (bfd_vma)2 * SCORE_ELF_REL_SIZE (output_bfd)) + if (s != NULL && s->size > (bfd_vma)2 * SCORE_ELF_REL_SIZE (info->output_bfd)) { - reldyn_sorting_bfd = output_bfd; + reldyn_sorting_bfd = info->output_bfd; qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1, sizeof (Elf32_External_Rel), score_elf_sort_dynamic_relocs); } diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index ebb36b7228e..8446d13c973 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2259,8 +2259,7 @@ sh_elf_link_hash_table_create (bfd *abfd) } static bool -sh_elf_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, asection *p) +sh_elf_omit_section_dynsym (struct bfd_link_info *info, asection *p) { struct elf_sh_link_hash_table *htab = sh_elf_hash_table (info); @@ -2927,14 +2926,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) It's a convenient place to determine the PLT style. */ static bool -sh_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +sh_elf_early_size_sections (struct bfd_link_info *info) { - sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, + sh_elf_hash_table (info)->plt_info = get_plt_info (info->output_bfd, bfd_link_pic (info)); if (sh_elf_hash_table (info)->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; } @@ -2942,8 +2940,7 @@ sh_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) /* Set the sizes of the dynamic sections. */ static bool -sh_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +sh_elf_late_size_sections (struct bfd_link_info *info) { struct elf_sh_link_hash_table *htab; bfd *dynobj; @@ -3199,8 +3196,7 @@ sh_elf_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); } /* Add a dynamic relocation to the SRELOC section. */ @@ -3380,7 +3376,7 @@ install_movi20_field (bfd *output_bfd, unsigned long relocation, /* Relocate an SH ELF section. */ static int -sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +sh_elf_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, @@ -3419,15 +3415,15 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, sym_hashes = elf_sym_hashes (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd); - isec_segment = sh_elf_osec_to_segment (output_bfd, + isec_segment = sh_elf_osec_to_segment (info->output_bfd, input_section->output_section); if (fdpic_p && sgot) - got_segment = sh_elf_osec_to_segment (output_bfd, + got_segment = sh_elf_osec_to_segment (info->output_bfd, sgot->output_section); else got_segment = -1; if (fdpic_p && splt) - plt_segment = sh_elf_osec_to_segment (output_bfd, + plt_segment = sh_elf_osec_to_segment (info->output_bfd, splt->output_section); else plt_segment = -1; @@ -3487,7 +3483,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, return false; } - howto = get_howto_table (output_bfd) + r_type; + howto = get_howto_table (info->output_bfd) + r_type; /* For relocs that aren't partial_inplace, we get the addend from the relocation. */ @@ -3555,7 +3551,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } else if (! howto->partial_inplace) { - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); addend = rel->r_addend; } else if ((sec->flags & SEC_MERGE) @@ -3577,7 +3574,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, addend = bfd_get_32 (input_bfd, contents + rel->r_offset); msec = sec; addend = - _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) + _bfd_elf_rel_local_sym (info->output_bfd, sym, &msec, addend) - relocation; addend += msec->output_section->vma + msec->output_offset; bfd_put_32 (input_bfd, addend, contents + rel->r_offset); @@ -3666,7 +3663,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + sec->output_section->vma + sec->output_offset); else if (!bfd_link_relocatable (info) - && (_bfd_elf_section_offset (output_bfd, info, + && (_bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) != (bfd_vma) -1)) @@ -3710,7 +3707,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, the target symbol, but there are some exceptions below. */ check_segment[0] = isec_segment; if (sec != NULL) - check_segment[1] = sh_elf_osec_to_segment (output_bfd, + check_segment[1] = sh_elf_osec_to_segment (info->output_bfd, sec->output_section); else check_segment[1] = -1; @@ -3872,7 +3869,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, relocate = false; outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, + _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; @@ -3935,7 +3932,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, 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); check_segment[0] = check_segment[1] = -1; @@ -3954,7 +3951,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (htab); - if (sh_elf_osec_readonly_p (output_bfd, + if (sh_elf_osec_readonly_p (info->output_bfd, input_section->output_section)) { _bfd_error_handler @@ -3968,10 +3965,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, return false; } - offset = _bfd_elf_section_offset (output_bfd, info, + offset = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if (offset != (bfd_vma)-1) - sh_elf_add_rofixup (output_bfd, htab->srofixup, + sh_elf_add_rofixup (info->output_bfd, htab->srofixup, input_section->output_section->vma + input_section->output_offset + rel->r_offset); @@ -4057,7 +4054,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, sgot->contents + off); h->got.offset |= 1; @@ -4067,7 +4064,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && sh_elf_hash_entry (h)->got_type == GOT_NORMAL && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak)) - sh_elf_add_rofixup (output_bfd, htab->srofixup, + sh_elf_add_rofixup (info->output_bfd, htab->srofixup, sgot->output_section->vma + sgot->output_offset + off); @@ -4090,7 +4087,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, 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)) { @@ -4115,12 +4113,12 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } 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); } else if (fdpic_p && (sh_elf_local_got_type (input_bfd) [r_symndx] == GOT_NORMAL)) - sh_elf_add_rofixup (output_bfd, htab->srofixup, + sh_elf_add_rofixup (info->output_bfd, htab->srofixup, sgot->output_section->vma + sgot->output_offset + off); @@ -4137,7 +4135,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (r_type == R_SH_GOT20) { - r = install_movi20_field (output_bfd, relocation + addend, + r = install_movi20_field (info->output_bfd, relocation + addend, input_bfd, input_section, contents, rel->r_offset); break; @@ -4165,7 +4163,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (r_type == R_SH_GOTOFF20) { - r = install_movi20_field (output_bfd, relocation + addend, + r = install_movi20_field (info->output_bfd, relocation + addend, input_bfd, input_section, contents, rel->r_offset); break; @@ -4319,7 +4317,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (offset != MINUS_ONE); if ((offset & 1) == 0) { - if (!sh_elf_initialize_funcdesc (output_bfd, info, h, + if (!sh_elf_initialize_funcdesc (info->output_bfd, + info, h, offset, NULL, 0)) return false; sh_elf_hash_entry (h)->funcdesc.offset |= 1; @@ -4334,7 +4333,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (offset != MINUS_ONE); if ((offset & 1) == 0) { - if (!sh_elf_initialize_funcdesc (output_bfd, info, NULL, + if (!sh_elf_initialize_funcdesc (info->output_bfd, + info, NULL, offset, sec, sym->st_value)) return false; @@ -4349,7 +4349,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { bfd_vma offset; - if (sh_elf_osec_readonly_p (output_bfd, + if (sh_elf_osec_readonly_p (info->output_bfd, reloc_section->output_section)) { _bfd_error_handler @@ -4363,11 +4363,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, return false; } - offset = _bfd_elf_section_offset (output_bfd, info, + offset = _bfd_elf_section_offset (info->output_bfd, info, reloc_section, reloc_offset); if (offset != (bfd_vma)-1) - sh_elf_add_rofixup (output_bfd, htab->srofixup, + sh_elf_add_rofixup (info->output_bfd, htab->srofixup, offset + reloc_section->output_section->vma + reloc_section->output_offset); @@ -4377,7 +4377,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { bfd_vma offset; - if (sh_elf_osec_readonly_p (output_bfd, + if (sh_elf_osec_readonly_p (info->output_bfd, reloc_section->output_section)) { info->callbacks->warning @@ -4387,11 +4387,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, return false; } - offset = _bfd_elf_section_offset (output_bfd, info, + offset = _bfd_elf_section_offset (info->output_bfd, info, reloc_section, reloc_offset); if (offset != (bfd_vma)-1) - sh_elf_add_dyn_reloc (output_bfd, srelgot, + sh_elf_add_dyn_reloc (info->output_bfd, srelgot, offset + reloc_section->output_section->vma + reloc_section->output_offset, @@ -4414,7 +4414,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, funcdesc_leave_zero: if (r_type != R_SH_FUNCDESC) { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, reloc_section->contents + reloc_offset); if (h != NULL) h->got.offset |= 1; @@ -4430,7 +4430,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } if (r_type == R_SH_GOTFUNCDESC20) { - r = install_movi20_field (output_bfd, relocation + addend, + r = install_movi20_field (info->output_bfd, relocation + addend, input_bfd, input_section, contents, rel->r_offset); break; @@ -4475,7 +4475,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (offset != MINUS_ONE); if ((offset & 1) == 0) { - if (!sh_elf_initialize_funcdesc (output_bfd, info, h, + if (!sh_elf_initialize_funcdesc (info->output_bfd, + info, h, offset, NULL, 0)) return false; sh_elf_hash_entry (h)->funcdesc.offset |= 1; @@ -4490,7 +4491,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (offset != MINUS_ONE); if ((offset & 1) == 0) { - if (!sh_elf_initialize_funcdesc (output_bfd, info, NULL, + if (!sh_elf_initialize_funcdesc (info->output_bfd, + info, NULL, offset, sec, sym->st_value)) return false; @@ -4509,7 +4511,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (r_type == R_SH_GOTOFFFUNCDESC20) { - r = install_movi20_field (output_bfd, relocation + addend, + r = install_movi20_field (info->output_bfd, relocation + addend, input_bfd, input_section, contents, rel->r_offset); break; @@ -4633,11 +4635,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, (_("%pB(%pA+%#" PRIx64 "): unexpected instruction %#04X (expected 0x34cc)"), input_bfd, input_section, (uint64_t) offset, (int) insn); - bfd_put_16 (output_bfd, 0x0012, contents + offset + 2); - bfd_put_16 (output_bfd, 0x304c, contents + offset + 4); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 6); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 8); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 10); + bfd_put_16 (info->output_bfd, 0x0012, contents + offset + 2); + bfd_put_16 (info->output_bfd, 0x304c, contents + offset + 4); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 6); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 8); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 10); } else { @@ -4703,11 +4705,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, input_bfd, input_section, (uint64_t) (offset + 4), (int) insn); insn = 0xd000 | (insn & 0x0f00) | target; - bfd_put_16 (output_bfd, insn, contents + offset + 0); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 4); + bfd_put_16 (info->output_bfd, insn, contents + offset + 0); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 4); } - bfd_put_32 (output_bfd, tpoff (info, relocation), + bfd_put_32 (info->output_bfd, tpoff (info, relocation), contents + rel->r_offset); continue; } @@ -4730,9 +4732,9 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && ! htab->root.dynamic_sections_created) { off &= ~1; - bfd_put_32 (output_bfd, tpoff (info, relocation), + bfd_put_32 (info->output_bfd, tpoff (info, relocation), sgot->contents + off); - bfd_put_32 (output_bfd, sh_elf_got_offset (htab) + off, + bfd_put_32 (info->output_bfd, sh_elf_got_offset (htab) + off, contents + rel->r_offset); continue; } @@ -4762,13 +4764,13 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_info = ELF32_R_INFO (indx, dr_type); 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); if (r_type == R_SH_TLS_GD_32) { if (indx == 0) { - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - dtpoff_base (info), sgot->contents + off + 4); } @@ -4780,7 +4782,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_addend = 0; srelgot->reloc_count++; loc += sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &outrel, loc); } } @@ -4832,7 +4834,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT ((insn & 0xff00) == 0xd400); /* Replace mov.l 1f,R4 with mov.l 1f,r0. */ - bfd_put_16 (output_bfd, insn & 0xf0ff, contents + offset); + bfd_put_16 (info->output_bfd, insn & 0xf0ff, contents + offset); insn = bfd_get_16 (input_bfd, contents + offset + 2); BFD_ASSERT ((insn & 0xff00) == 0xc700); @@ -4845,13 +4847,13 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, insn = bfd_get_16 (input_bfd, contents + offset + 10); BFD_ASSERT (insn == 0x34cc); - bfd_put_16 (output_bfd, 0x0412, contents + offset + 2); - bfd_put_16 (output_bfd, 0x00ce, contents + offset + 4); - bfd_put_16 (output_bfd, 0x304c, contents + offset + 6); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 8); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 10); + bfd_put_16 (info->output_bfd, 0x0412, contents + offset + 2); + bfd_put_16 (info->output_bfd, 0x00ce, contents + offset + 4); + bfd_put_16 (info->output_bfd, 0x304c, contents + offset + 6); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 8); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 10); - bfd_put_32 (output_bfd, sh_elf_got_offset (htab) + off, + bfd_put_32 (info->output_bfd, sh_elf_got_offset (htab) + off, contents + rel->r_offset); continue; @@ -4909,12 +4911,12 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, insn = bfd_get_16 (input_bfd, contents + offset + 10); BFD_ASSERT (insn == 0x34cc); - bfd_put_16 (output_bfd, 0x0012, contents + offset + 0); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 2); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 4); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 6); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 8); - bfd_put_16 (output_bfd, 0x0009, contents + offset + 10); + bfd_put_16 (info->output_bfd, 0x0012, contents + offset + 0); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 2); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 4); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 6); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 8); + bfd_put_16 (info->output_bfd, 0x0009, contents + offset + 10); continue; } @@ -4936,7 +4938,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_info = ELF32_R_INFO (0, R_SH_TLS_DTPMOD32); 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); htab->tls_ldm_got.offset |= 1; } @@ -4990,7 +4992,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, 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); continue; } } @@ -5017,7 +5019,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, input_bfd, input_section, rel->r_offset, symname); } - elf_elfheader (output_bfd)->e_flags |= EF_SH_PIC; + elf_elfheader (info->output_bfd)->e_flags |= EF_SH_PIC; } if (r != bfd_reloc_ok) @@ -5140,7 +5142,7 @@ sh_elf_get_relocated_section_contents (bfd *output_bfd, *secpp = isec; } - if (! sh_elf_relocate_section (output_bfd, link_info, input_bfd, + if (! sh_elf_relocate_section (link_info, input_bfd, input_section, data, internal_relocs, isymbuf, sections)) goto error_return; @@ -5934,7 +5936,7 @@ sh_elf_object_p (bfd *abfd) dynamic sections here. */ static bool -sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, +sh_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -6001,14 +6003,14 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, if (plt_info->symbol_fields.got20) { bfd_reloc_status_type r; - r = install_movi20_field (output_bfd, got_offset, + r = install_movi20_field (info->output_bfd, got_offset, splt->owner, splt, splt->contents, h->plt.offset + plt_info->symbol_fields.got_entry); BFD_ASSERT (r == bfd_reloc_ok); } else - install_plt_field (output_bfd, false, got_offset, + install_plt_field (info->output_bfd, false, got_offset, (splt->contents + h->plt.offset + plt_info->symbol_fields.got_entry)); @@ -6017,7 +6019,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, { BFD_ASSERT (!plt_info->symbol_fields.got20); - install_plt_field (output_bfd, false, + install_plt_field (info->output_bfd, false, (sgotplt->output_section->vma + sgotplt->output_offset + got_offset), @@ -6049,14 +6051,14 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, * plt_info->symbol_entry_size); /* Install the 'bra' with this offset. */ - bfd_put_16 (output_bfd, + bfd_put_16 (info->output_bfd, 0xa000 | (0x0fff & ((distance - 4) / 2)), (splt->contents + h->plt.offset + plt_info->symbol_fields.plt)); } else - install_plt_field (output_bfd, true, + install_plt_field (info->output_bfd, true, splt->output_section->vma + splt->output_offset, (splt->contents + h->plt.offset @@ -6072,22 +6074,23 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, got_offset = plt_index * 8; if (plt_info->symbol_fields.reloc_offset != MINUS_ONE) - install_plt_field (output_bfd, false, + install_plt_field (info->output_bfd, false, plt_index * sizeof (Elf32_External_Rela), (splt->contents + h->plt.offset + plt_info->symbol_fields.reloc_offset)); /* 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 + plt_info->symbol_resolve_offset), sgotplt->contents + got_offset); if (htab->fdpic_p) - bfd_put_32 (output_bfd, - sh_elf_osec_to_segment (output_bfd, splt->output_section), + bfd_put_32 (info->output_bfd, + sh_elf_osec_to_segment (info->output_bfd, + splt->output_section), sgotplt->contents + got_offset + 4); /* Fill in the entry in the .rela.plt section. */ @@ -6103,7 +6106,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, rel.r_addend = GOT_BIAS; #endif loc = srelplt->contents + plt_index * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); if (htab->root.target_os == is_vxworks && !bfd_link_pic (info)) { @@ -6120,7 +6123,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, + plt_info->symbol_fields.got_entry); rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32); rel.r_addend = got_offset; - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); loc += sizeof (Elf32_External_Rela); /* Create a .rela.plt.unloaded R_SH_DIR32 relocation for @@ -6130,7 +6133,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, + got_offset); rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_SH_DIR32); rel.r_addend = 0; - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); } if (!h->def_regular) @@ -6192,14 +6195,14 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, } 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_SH_GLOB_DAT); rel.r_addend = 0; } loc = srelgot->contents; loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); } if (h->needs_copy) @@ -6223,7 +6226,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_COPY); rel.r_addend = 0; loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); - 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. On VxWorks, @@ -6239,7 +6242,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, +sh_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_sh_link_hash_table *htab; @@ -6274,8 +6277,8 @@ sh_elf_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; @@ -6284,19 +6287,19 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, s = htab->root.hgot->root.u.def.section; dyn.d_un.d_ptr = htab->root.hgot->root.u.def.value + 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_JMPREL: s = htab->root.srelplt; 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; } } @@ -6312,7 +6315,7 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, htab->plt_info->plt0_entry_size); for (i = 0; i < ARRAY_SIZE (htab->plt_info->plt0_got_fields); i++) if (htab->plt_info->plt0_got_fields[i] != MINUS_ONE) - install_plt_field (output_bfd, false, + install_plt_field (info->output_bfd, false, (sgotplt->output_section->vma + sgotplt->output_offset + (i * 4)), @@ -6333,7 +6336,7 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, + htab->plt_info->plt0_got_fields[2]); rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32); rel.r_addend = 8; - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); loc += sizeof (Elf32_External_Rela); /* Fix up the remaining .rela.plt.unloaded relocations. @@ -6343,17 +6346,17 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, while (loc < htab->srelplt2->contents + htab->srelplt2->size) { /* The PLT entry's pointer to the .got.plt slot. */ - bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + bfd_elf32_swap_reloc_in (info->output_bfd, loc, &rel); rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); loc += sizeof (Elf32_External_Rela); /* The .got.plt slot's pointer to .plt. */ - bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + bfd_elf32_swap_reloc_in (info->output_bfd, loc, &rel); rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_SH_DIR32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloc_out (info->output_bfd, &rel, loc); loc += sizeof (Elf32_External_Rela); } } @@ -6368,13 +6371,13 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, if (sgotplt && sgotplt->size > 0 && !htab->fdpic_p) { if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents); else - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sdyn->output_section->vma + sdyn->output_offset, sgotplt->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 8); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents + 4); + bfd_put_32 (info->output_bfd, 0, sgotplt->contents + 8); } if (sgotplt && sgotplt->size > 0) @@ -6388,7 +6391,7 @@ sh_elf_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; - sh_elf_add_rofixup (output_bfd, htab->srofixup, got_value); + sh_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); diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index 9a9d3a0401c..e0e74b781ff 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -4823,8 +4823,7 @@ spu_elf_emit_fixup (bfd * output_bfd, struct bfd_link_info *info, /* Apply RELOCS to CONTENTS of INPUT_SECTION from INPUT_BFD. */ static int -spu_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +spu_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -4847,7 +4846,7 @@ spu_elf_relocate_section (bfd *output_bfd, stubs = (htab->stub_sec != NULL && maybe_needs_stubs (input_section)); iovl = overlay_index (input_section); - ea = bfd_get_section_by_name (output_bfd, "._ea"); + ea = bfd_get_section_by_name (info->output_bfd, "._ea"); symtab_hdr = &elf_symtab_hdr (input_bfd); sym_hashes = (struct elf_link_hash_entry **) (elf_sym_hashes (input_bfd)); @@ -4880,7 +4879,8 @@ spu_elf_relocate_section (bfd *output_bfd, sym = local_syms + r_symndx; sec = local_sections[r_symndx]; sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec); - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -5016,7 +5016,7 @@ spu_elf_relocate_section (bfd *output_bfd, bfd_vma offset; offset = rel->r_offset + input_section->output_section->vma + input_section->output_offset; - spu_elf_emit_fixup (output_bfd, info, offset); + spu_elf_emit_fixup (info->output_bfd, info, offset); } if (unresolved_reloc) @@ -5043,7 +5043,7 @@ spu_elf_relocate_section (bfd *output_bfd, unresolved_reloc = true; if (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 @@ -5134,8 +5134,7 @@ spu_elf_relocate_section (bfd *output_bfd, } static bool -spu_elf_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +spu_elf_finish_dynamic_sections (struct bfd_link_info *info ATTRIBUTE_UNUSED, bfd_byte *buf ATTRIBUTE_UNUSED) { return true; diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index d5f1259d1f4..a74e8235f32 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -1705,8 +1705,7 @@ elf32_tic6x_make_got_dynreloc (bfd *output_bfd, dynamic sections here. */ static bool -elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd, - struct bfd_link_info *info, +elf32_tic6x_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym * sym) { @@ -1723,7 +1722,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd, asection *plt, *gotplt, *relplt; elf_backend_data *bed; - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); BFD_ASSERT (htab->elf.splt != NULL); plt = htab->elf.splt; @@ -1763,26 +1762,27 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd, /* Fill in the entry in the procedure linkage table. */ /* ldw .d2t2 *+B14($GOT(f)), b2 */ - bfd_put_32 (output_bfd, got_dp_offset << 8 | 0x0100006e, + bfd_put_32 (info->output_bfd, got_dp_offset << 8 | 0x0100006e, plt->contents + h->plt.offset); /* mvk .s2 low(rela_offset), b0 */ - bfd_put_32 (output_bfd, (rela_offset & 0xffff) << 7 | 0x0000002a, + bfd_put_32 (info->output_bfd, (rela_offset & 0xffff) << 7 | 0x0000002a, plt->contents + h->plt.offset + 4); /* mvkh .s2 high(rela_offset), b0 */ - bfd_put_32 (output_bfd, ((rela_offset >> 16) & 0xffff) << 7 | 0x0000006a, + bfd_put_32 (info->output_bfd, + ((rela_offset >> 16) & 0xffff) << 7 | 0x0000006a, plt->contents + h->plt.offset + 8); /* nop 2 */ - bfd_put_32 (output_bfd, 0x00002000, + bfd_put_32 (info->output_bfd, 0x00002000, plt->contents + h->plt.offset + 12); /* b .s2 b2 */ - bfd_put_32 (output_bfd, 0x00080362, + bfd_put_32 (info->output_bfd, 0x00080362, plt->contents + h->plt.offset + 16); /* nop 5 */ - bfd_put_32 (output_bfd, 0x00008000, + bfd_put_32 (info->output_bfd, 0x00008000, plt->contents + h->plt.offset + 20); /* Fill in the entry in the global offset table. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (plt->output_section->vma + plt->output_offset), gotplt->contents + got_section_offset); @@ -1793,7 +1793,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd, rela.r_info = ELF32_R_INFO (h->dynindx, R_C6000_JUMP_SLOT); rela.r_addend = 0; loc = relplt->contents + rela_offset; - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc); if (!h->def_regular) { @@ -1826,13 +1826,13 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd, || h->dynindx == -1 || h->forced_local) && h->def_regular) { asection *s = h->root.u.def.section; - elf32_tic6x_make_got_dynreloc (output_bfd, htab, s, + elf32_tic6x_make_got_dynreloc (info->output_bfd, htab, s, h->got.offset & ~(bfd_vma) 1); } else { Elf_Internal_Rela outrel; - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, sgot->contents + (h->got.offset & ~(bfd_vma) 1)); outrel.r_offset = (sgot->output_section->vma + sgot->output_offset @@ -1840,7 +1840,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd, outrel.r_info = ELF32_R_INFO (h->dynindx, R_C6000_ABS32); outrel.r_addend = 0; - elf32_tic6x_install_rela (output_bfd, srela, &outrel); + elf32_tic6x_install_rela (info->output_bfd, srela, &outrel); } } @@ -1868,7 +1868,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd, else s = htab->elf.srelbss; - elf32_tic6x_install_rela (output_bfd, s, &rel); + elf32_tic6x_install_rela (info->output_bfd, s, &rel); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -2116,8 +2116,7 @@ elf32_tic6x_rel_relocation_p (bfd *abfd, asection *sec, /* We need dynamic symbols for every section, since segments can relocate independently. */ static bool -elf32_tic6x_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +elf32_tic6x_link_omit_section_dynsym (struct bfd_link_info *info ATTRIBUTE_UNUSED, asection *p) { switch (elf_section_data (p)->this_hdr.sh_type) @@ -2137,8 +2136,7 @@ elf32_tic6x_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, } static int -elf32_tic6x_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf32_tic6x_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2203,7 +2201,8 @@ elf32_tic6x_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 { @@ -2316,7 +2315,8 @@ elf32_tic6x_relocate_section (bfd *output_bfd, /* When generating a shared object or relocatable executable, these relocations are copied into the output file to be resolved at run time. */ - if ((bfd_link_pic (info) || elf32_tic6x_using_dsbt (output_bfd)) + if ((bfd_link_pic (info) + || elf32_tic6x_using_dsbt (info->output_bfd)) && (input_section->flags & SEC_ALLOC) && (h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT @@ -2335,8 +2335,8 @@ elf32_tic6x_relocate_section (bfd *output_bfd, 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) @@ -2381,7 +2381,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (indx, r_type); } - elf32_tic6x_install_rela (output_bfd, sreloc, &outrel); + elf32_tic6x_install_rela (info->output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, we need to include the symbol @@ -2468,7 +2468,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); h->got.offset |= 1; @@ -2477,8 +2477,8 @@ elf32_tic6x_relocate_section (bfd *output_bfd, h) && !(ELF_ST_VISIBILITY (h->other) && h->root.type == bfd_link_hash_undefweak)) - elf32_tic6x_make_got_dynreloc (output_bfd, htab, sec, - off); + elf32_tic6x_make_got_dynreloc (info->output_bfd, + htab, sec, off); } } else @@ -2498,11 +2498,13 @@ elf32_tic6x_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, htab->elf.sgot->contents + off); - if (bfd_link_pic (info) || elf32_tic6x_using_dsbt (output_bfd)) - elf32_tic6x_make_got_dynreloc (output_bfd, htab, sec, off); + if (bfd_link_pic (info) + || elf32_tic6x_using_dsbt (info->output_bfd)) + elf32_tic6x_make_got_dynreloc (info->output_bfd, + htab, sec, off); local_got_offsets[r_symndx] |= 1; } @@ -3150,7 +3152,7 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Set the sizes of the dynamic sections. */ static bool -elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf32_tic6x_late_size_sections (struct bfd_link_info *info) { struct elf32_tic6x_link_hash_table *htab; bfd *dynobj; @@ -3230,7 +3232,8 @@ elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) *local_got = s->size; s->size += 4; - if (bfd_link_pic (info) || elf32_tic6x_using_dsbt (output_bfd)) + if (bfd_link_pic (info) + || elf32_tic6x_using_dsbt (info->output_bfd)) { srel->size += sizeof (Elf32_External_Rela); } @@ -3331,7 +3334,7 @@ elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (!_bfd_elf_add_dynamic_tags (output_bfd, info, relocs)) + if (!_bfd_elf_add_dynamic_tags (info, relocs)) return false; if (!add_dynamic_entry (DT_C6000_DSBT_BASE, 0) @@ -3350,19 +3353,17 @@ elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) and the input sections have been assigned to output sections. */ static bool -elf32_tic6x_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf32_tic6x_early_size_sections (struct bfd_link_info *info) { - if (elf32_tic6x_using_dsbt (output_bfd) && !bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, - "__stacksize", DEFAULT_STACK_SIZE)) + if (elf32_tic6x_using_dsbt (info->output_bfd) && !bfd_link_relocatable (info) + && !bfd_elf_stack_segment_size (info, "__stacksize", DEFAULT_STACK_SIZE)) return false; return true; } static bool -elf32_tic6x_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +elf32_tic6x_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf32_tic6x_link_hash_table *htab; @@ -3415,7 +3416,7 @@ elf32_tic6x_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, dyn.d_un.d_val = s->size; break; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } /* Fill in the first entry in the procedure linkage table. */ @@ -3427,19 +3428,19 @@ elf32_tic6x_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - htab->dsbt->output_offset) / 4; /* ldw .D2T2 *+b14[$GOT(0)],b2 */ - bfd_put_32 (output_bfd, got_offs << 8 | 0x0100006e, + bfd_put_32 (info->output_bfd, got_offs << 8 | 0x0100006e, htab->elf.splt->contents); /* ldw .D2T2 *+b14[$GOT(4)],b1 */ - bfd_put_32 (output_bfd, (got_offs + 1) << 8 | 0x0080006e, + bfd_put_32 (info->output_bfd, (got_offs + 1) << 8 | 0x0080006e, htab->elf.splt->contents + 4); /* nop 3 */ - bfd_put_32 (output_bfd, 0x00004000, + bfd_put_32 (info->output_bfd, 0x00004000, htab->elf.splt->contents + 8); /* b .s2 b2 */ - bfd_put_32 (output_bfd, 0x00080362, + bfd_put_32 (info->output_bfd, 0x00080362, htab->elf.splt->contents + 12); /* nop 5 */ - bfd_put_32 (output_bfd, 0x00008000, + bfd_put_32 (info->output_bfd, 0x00008000, htab->elf.splt->contents + 16); elf_section_data (htab->elf.splt->output_section) diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index d5a13066a2d..df47e3857ef 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -2162,9 +2162,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) omitted when creating a shared library. */ static bool -tilepro_elf_omit_section_dynsym (bfd *output_bfd, - struct bfd_link_info *info, - asection *p) +tilepro_elf_omit_section_dynsym (struct bfd_link_info *info, + asection *p) { /* We keep the .got section symbol so that explicit relocations against the _GLOBAL_OFFSET_TABLE_ symbol emitted in PIC mode @@ -2172,7 +2171,7 @@ tilepro_elf_omit_section_dynsym (bfd *output_bfd, if (strcmp (p->name, ".got") == 0) return false; - return _bfd_elf_omit_section_dynsym_default (output_bfd, info, p); + return _bfd_elf_omit_section_dynsym_default (info, p); } /* Set the sizes of the dynamic sections. */ @@ -2180,8 +2179,7 @@ tilepro_elf_omit_section_dynsym (bfd *output_bfd, #define ELF32_DYNAMIC_INTERPRETER "/lib/ld.so.1" static bool -tilepro_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +tilepro_elf_late_size_sections (struct bfd_link_info *info) { struct elf_link_hash_table *htab; bfd *dynobj; @@ -2309,7 +2307,7 @@ tilepro_elf_late_size_sections (bfd *output_bfd, || htab->splt->size == 0) && (htab->sgot == NULL || (htab->sgot->size - == get_elf_backend_data (output_bfd)->got_header_size))) + == get_elf_backend_data (info->output_bfd)->got_header_size))) htab->sgotplt->size = 0; } @@ -2372,7 +2370,7 @@ tilepro_elf_late_size_sections (bfd *output_bfd, s->alloced = 1; } - return _bfd_elf_add_dynamic_tags (output_bfd, info, true); + return _bfd_elf_add_dynamic_tags (info, true); } /* Return the base VMA address which should be subtracted from real addresses @@ -2512,7 +2510,7 @@ static const bfd_byte insn_tls_gd_add_Y0Y1[] = { accordingly. */ static int -tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +tilepro_elf_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, @@ -2582,7 +2580,8 @@ tilepro_elf_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 { @@ -2783,8 +2782,8 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, - htab->sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + htab->sgot->contents + off); h->got.offset |= 1; } } @@ -2821,11 +2820,11 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_info = ELF32_R_INFO (0, R_TILEPRO_RELATIVE); outrel.r_addend = relocation; relocation = 0; - tilepro_elf_append_rela_32 (output_bfd, s, &outrel); + tilepro_elf_append_rela_32 (info->output_bfd, s, &outrel); } - bfd_put_32 (output_bfd, relocation, - htab->sgot->contents + off); + bfd_put_32 (info->output_bfd, relocation, + htab->sgot->contents + off); local_got_offsets[r_symndx] |= 1; } } @@ -2932,8 +2931,8 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, skip = 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) @@ -3029,7 +3028,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } } - tilepro_elf_append_rela_32 (output_bfd, sreloc, &outrel); + tilepro_elf_append_rela_32 (info->output_bfd, sreloc, &outrel); /* This reloc will be computed at runtime, so there's no need to do anything now. */ @@ -3054,8 +3053,8 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (sreloc != NULL); skip = 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) @@ -3071,7 +3070,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + rel->r_addend; } - tilepro_elf_append_rela_32 (output_bfd, sreloc, &outrel); + tilepro_elf_append_rela_32 (info->output_bfd, sreloc, &outrel); continue; } relocation = tpoff (info, relocation); @@ -3182,17 +3181,18 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, case R_TILEPRO_IMM16_X0_TLS_IE_HA: case R_TILEPRO_IMM16_X1_TLS_IE_HA: if (need_relocs) { - bfd_put_32 (output_bfd, 0, htab->sgot->contents + off); + bfd_put_32 (info->output_bfd, 0, + htab->sgot->contents + off); outrel.r_offset = (htab->sgot->output_section->vma + htab->sgot->output_offset + off); outrel.r_addend = 0; if (indx == 0) outrel.r_addend = relocation - dtpoff_base (info); outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_TPOFF32); - tilepro_elf_append_rela_32 (output_bfd, htab->srelgot, - &outrel); + tilepro_elf_append_rela_32 (info->output_bfd, + htab->srelgot, &outrel); } else { - bfd_put_32 (output_bfd, tpoff (info, relocation), + bfd_put_32 (info->output_bfd, tpoff (info, relocation), htab->sgot->contents + off); } break; @@ -3210,26 +3210,28 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + htab->sgot->output_offset + off); outrel.r_addend = 0; outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_DTPMOD32); - bfd_put_32 (output_bfd, 0, htab->sgot->contents + off); - tilepro_elf_append_rela_32 (output_bfd, htab->srelgot, + bfd_put_32 (info->output_bfd, 0, + htab->sgot->contents + off); + tilepro_elf_append_rela_32 (info->output_bfd, + htab->srelgot, &outrel); if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, relocation - dtpoff_base (info), (htab->sgot->contents + off + TILEPRO_BYTES_PER_WORD)); } else { - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, (htab->sgot->contents + off + TILEPRO_BYTES_PER_WORD)); outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_DTPOFF32); outrel.r_offset += TILEPRO_BYTES_PER_WORD; - tilepro_elf_append_rela_32 (output_bfd, + tilepro_elf_append_rela_32 (info->output_bfd, htab->srelgot, &outrel); } } @@ -3240,9 +3242,10 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, static link or an executable link with the symbol binding locally. Mark it as belonging to module 1, the executable. */ - bfd_put_32 (output_bfd, 1, + bfd_put_32 (info->output_bfd, 1, htab->sgot->contents + off ); - bfd_put_32 (output_bfd, relocation - dtpoff_base (info), + bfd_put_32 (info->output_bfd, + relocation - dtpoff_base (info), htab->sgot->contents + off + TILEPRO_BYTES_PER_WORD); } @@ -3268,7 +3271,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, 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 /* xgettext:c-format */ @@ -3398,8 +3401,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, dynamic sections here. */ static bool -tilepro_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +tilepro_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3436,7 +3438,8 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd, /* Fill in the entry in the global offset table, which initially points to the beginning of the plt. */ - bfd_put_32 (output_bfd, splt->output_section->vma + splt->output_offset, + bfd_put_32 (info->output_bfd, + splt->output_section->vma + splt->output_offset, sgotplt->contents + r_offset); /* Fill in the entry in the .rela.plt section. */ @@ -3447,7 +3450,7 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELF32_R_INFO (h->dynindx, R_TILEPRO_JMP_SLOT); loc = srela->contents + rela_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) { @@ -3502,9 +3505,9 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; } - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, sgot->contents + (h->got.offset & ~(bfd_vma) 1)); - tilepro_elf_append_rela_32 (output_bfd, srela, &rela); + tilepro_elf_append_rela_32 (info->output_bfd, srela, &rela); } if (h->needs_copy) @@ -3524,7 +3527,7 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd, s = htab->sreldynrelro; else s = htab->srelbss; - tilepro_elf_append_rela_32 (output_bfd, s, &rela); + tilepro_elf_append_rela_32 (info->output_bfd, s, &rela); } /* Mark some specially defined symbols as absolute. */ @@ -3538,7 +3541,7 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -tilepro_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, +tilepro_finish_dyn (struct bfd_link_info *info, bfd *dynobj, asection *sdyn, asection *splt ATTRIBUTE_UNUSED) { @@ -3574,14 +3577,13 @@ tilepro_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, continue; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } return true; } static bool -tilepro_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +tilepro_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -3602,7 +3604,7 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd, splt = htab->splt; BFD_ASSERT (splt != NULL && sdyn != NULL); - ret = tilepro_finish_dyn (output_bfd, info, dynobj, sdyn, splt); + ret = tilepro_finish_dyn (info, dynobj, sdyn, splt); if (!ret) return ret; @@ -3633,9 +3635,9 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd, { /* Write the first two entries in .got.plt, needed for the dynamic linker. */ - bfd_put_32 (output_bfd, (bfd_vma) -1, + bfd_put_32 (info->output_bfd, -1, htab->sgotplt->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, + bfd_put_32 (info->output_bfd, 0, htab->sgotplt->contents + GOT_ENTRY_SIZE); } @@ -3652,7 +3654,7 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd, bfd_vma val = (sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0); - bfd_put_32 (output_bfd, val, htab->sgot->contents); + bfd_put_32 (info->output_bfd, val, htab->sgot->contents); } elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index e625f9d3f68..6bee3af2e61 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -2171,8 +2171,7 @@ v850_elf_final_link_relocate (reloc_howto_type *howto, /* Relocate an V850 ELF section. */ static int -v850_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +v850_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2227,7 +2226,8 @@ v850_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 { @@ -2260,7 +2260,7 @@ v850_elf_relocate_section (bfd *output_bfd, continue; /* FIXME: We should use the addend, but the COFF relocations don't. */ - r = v850_elf_final_link_relocate (howto, input_bfd, output_bfd, + r = v850_elf_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel->r_offset, relocation, rel->r_addend, diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index e6329bcef7e..5d103caab93 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -36,15 +36,6 @@ static bool elf_vax_check_relocs (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); static bool elf_vax_adjust_dynamic_symbol (struct bfd_link_info *, struct elf_link_hash_entry *); -static int elf_vax_relocate_section (bfd *, struct bfd_link_info *, - bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, - Elf_Internal_Sym *, asection **); -static bool elf_vax_finish_dynamic_symbol (bfd *, struct bfd_link_info *, - struct elf_link_hash_entry *, - Elf_Internal_Sym *); -static bool elf_vax_finish_dynamic_sections (bfd *, struct bfd_link_info *, - bfd_byte *); static bfd_vma elf_vax_plt_sym_val (bfd_vma, const asection *, const arelent *); @@ -983,8 +974,7 @@ elf_vax_discard_got_entries (struct elf_link_hash_entry *h, /* Discard unused dynamic data if this is a static link. */ static bool -elf_vax_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_vax_early_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -1022,7 +1012,7 @@ elf_vax_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Set the sizes of the dynamic sections. */ static bool -elf_vax_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf_vax_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -1125,7 +1115,7 @@ elf_vax_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) 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_vax_link_hash_traverse if we are @@ -1200,8 +1190,7 @@ elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, void * infoptr) /* Relocate an VAX ELF section. */ static int -elf_vax_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_vax_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -1256,7 +1245,8 @@ elf_vax_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 { @@ -1330,7 +1320,7 @@ elf_vax_relocate_section (bfd *output_bfd, off = h->got.offset; BFD_ASSERT (off < sgot->size); - bfd_put_32 (output_bfd, rel->r_addend, sgot->contents + off); + bfd_put_32 (info->output_bfd, rel->r_addend, sgot->contents + off); relocation = sgot->output_offset + off; /* The GOT relocation uses the addend. */ @@ -1430,8 +1420,8 @@ elf_vax_relocate_section (bfd *output_bfd, 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; if (outrel.r_offset == (bfd_vma) -2) @@ -1522,7 +1512,7 @@ elf_vax_relocate_section (bfd *output_bfd, } 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_VAX_32 @@ -1592,7 +1582,7 @@ elf_vax_relocate_section (bfd *output_bfd, dynamic sections here. */ static bool -elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, +elf_vax_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -1639,15 +1629,15 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, PLT_ENTRY_SIZE); /* The offset is relative to the first extension word. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, -(h->plt.offset + 8), splt->contents + h->plt.offset + 4); - 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 + 8); /* 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) + addend, @@ -1660,7 +1650,7 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_JMP_SLOT); rela.r_addend = addend; loc = srela->contents + 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) { @@ -1687,12 +1677,12 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, + sgot->output_offset + h->got.offset); rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_GLOB_DAT); - rela.r_addend = bfd_get_signed_32 (output_bfd, + rela.r_addend = bfd_get_signed_32 (info->output_bfd, sgot->contents + h->got.offset); 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) @@ -1715,7 +1705,7 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_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. */ @@ -1729,7 +1719,7 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, +elf_vax_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -1771,13 +1761,13 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, 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; } } @@ -1786,12 +1776,12 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, if (splt->size > 0) { memcpy (splt->contents, elf_vax_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->output_section->vma + 6)), splt->contents + 2); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (sgot->output_section->vma + sgot->output_offset + 8 - (splt->output_section->vma + 12)), @@ -1805,13 +1795,13 @@ elf_vax_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); } if (elf_section_data (sgot->output_section) != NULL) diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c index f6c988dae70..fe5f4d5eafb 100644 --- a/bfd/elf32-visium.c +++ b/bfd/elf32-visium.c @@ -549,8 +549,7 @@ visium_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Relocate a VISIUM ELF section. */ static int -visium_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, bfd *input_bfd, +visium_elf_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, @@ -595,7 +594,8 @@ visium_elf_relocate_section (bfd *output_bfd, /* This is a local symbol. */ 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); diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 004db71968b..60ab5e6875a 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -706,8 +706,7 @@ xstormy16_elf_relax_section (bfd *dynobj, } static bool -xstormy16_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +xstormy16_elf_early_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *splt; @@ -761,8 +760,7 @@ xstormy16_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, accordingly. */ static int -xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info * info, +xstormy16_elf_relocate_section (struct bfd_link_info * info, bfd * input_bfd, asection * input_section, bfd_byte * contents, @@ -810,7 +808,8 @@ xstormy16_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); } else { @@ -957,8 +956,7 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, /* This must exist if dynobj is ever set. */ static bool -xstormy16_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +xstormy16_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj = elf_hash_table (info)->dynobj; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 08ea42e3c2d..b1733345fc8 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -1554,8 +1554,7 @@ elf_xtensa_allocate_local_got_size (struct bfd_link_info *info) /* Set the sizes of the dynamic sections. */ static bool -elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_xtensa_late_size_sections (struct bfd_link_info *info) { struct elf_xtensa_link_hash_table *htab; bfd *dynobj, *abfd; @@ -1751,8 +1750,8 @@ elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, loc = (srelgot->contents + srelgot->reloc_count * sizeof (Elf32_External_Rela)); - bfd_elf32_swap_reloca_out (output_bfd, &irela, loc); - bfd_elf32_swap_reloca_out (output_bfd, &irela, + bfd_elf32_swap_reloca_out (info->output_bfd, &irela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &irela, loc + sizeof (Elf32_External_Rela)); srelgot->reloc_count += 2; } @@ -1765,8 +1764,7 @@ elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (!_bfd_elf_add_dynamic_tags (output_bfd, info, - relplt || relgot)) + if (!_bfd_elf_add_dynamic_tags (info, relplt || relgot)) return false; if (!add_dynamic_entry (DT_XTENSA_GOT_LOC_OFF, 0) @@ -1779,7 +1777,7 @@ elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, } static bool -elf_xtensa_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf_xtensa_early_size_sections (struct bfd_link_info *info) { struct elf_xtensa_link_hash_table *htab; asection *tls_sec; @@ -1794,11 +1792,11 @@ elf_xtensa_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) { struct elf_link_hash_entry *tlsbase = &htab->tlsbase->elf; struct bfd_link_hash_entry *bh = &tlsbase->root; - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); tlsbase->type = STT_TLS; 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; @@ -2491,8 +2489,7 @@ replace_tls_insn (Elf_Internal_Rela *rel, both relocatable and final links. */ static int -elf_xtensa_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_xtensa_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2595,7 +2592,8 @@ elf_xtensa_relocate_section (bfd *output_bfd, sym = local_syms + r_symndx; sym_type = ELF32_ST_TYPE (sym->st_info); 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 { @@ -2795,7 +2793,7 @@ elf_xtensa_relocate_section (bfd *output_bfd, BFD_ASSERT (srel != NULL); outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, + _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if ((outrel.r_offset | 1) == (bfd_vma) -1) @@ -2838,7 +2836,7 @@ elf_xtensa_relocate_section (bfd *output_bfd, contents of the literal entry to the address of the PLT entry. */ relocation = - elf_xtensa_create_plt_entry (info, output_bfd, + elf_xtensa_create_plt_entry (info, info->output_bfd, srel->reloc_count); } unresolved_reloc = false; @@ -2857,7 +2855,7 @@ elf_xtensa_relocate_section (bfd *output_bfd, loc = (srel->contents + srel->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); BFD_ASSERT (sizeof (Elf32_External_Rela) * srel->reloc_count <= srel->size); } @@ -2955,7 +2953,7 @@ elf_xtensa_relocate_section (bfd *output_bfd, BFD_ASSERT (srel); loc = (srel->contents + srel->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); BFD_ASSERT (sizeof (Elf32_External_Rela) * srel->reloc_count <= srel->size); } @@ -3014,7 +3012,7 @@ elf_xtensa_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 @@ -3068,8 +3066,7 @@ elf_xtensa_relocate_section (bfd *output_bfd, the PLT and GOT entries are all set up by relocate_section. */ static bool -elf_xtensa_finish_dynamic_symbol (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +elf_xtensa_finish_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3213,8 +3210,7 @@ elf_xtensa_combine_prop_entries (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -elf_xtensa_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf_xtensa_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_xtensa_link_hash_table *htab; @@ -3241,9 +3237,9 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd, { BFD_ASSERT (sgot->size == 4); if (sdyn == NULL) - bfd_put_32 (output_bfd, 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); } @@ -3266,7 +3262,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd, for (rtld_reloc = 0; rtld_reloc < srelgot->reloc_count; rtld_reloc++) { loc = srelgot->contents + rtld_reloc * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_in (output_bfd, loc, &irela); + bfd_elf32_swap_reloca_in (info->output_bfd, loc, &irela); if (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD) break; } @@ -3287,24 +3283,24 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd, each chunk of the .got.plt section. */ loc = srelgot->contents + rtld_reloc * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_in (output_bfd, loc, &irela); + bfd_elf32_swap_reloca_in (info->output_bfd, loc, &irela); BFD_ASSERT (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD); irela.r_offset = (sgotplt->output_section->vma + sgotplt->output_offset); irela.r_addend = 1; /* tell rtld to set value to resolver function */ - bfd_elf32_swap_reloca_out (output_bfd, &irela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &irela, loc); rtld_reloc += 1; BFD_ASSERT (rtld_reloc <= srelgot->reloc_count); /* Next literal immediately follows the first. */ loc += sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_in (output_bfd, loc, &irela); + bfd_elf32_swap_reloca_in (info->output_bfd, loc, &irela); BFD_ASSERT (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD); irela.r_offset = (sgotplt->output_section->vma + sgotplt->output_offset + 4); /* Tell rtld to set value to object's link map. */ irela.r_addend = 2; - bfd_elf32_swap_reloca_out (output_bfd, &irela, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &irela, loc); rtld_reloc += 1; BFD_ASSERT (rtld_reloc <= srelgot->reloc_count); @@ -3315,10 +3311,10 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd, chunk_entries = plt_entries - (chunk * PLT_ENTRIES_PER_CHUNK); BFD_ASSERT ((unsigned) (chunk + 1) * 8 <= spltlittbl->size); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, sgotplt->output_section->vma + sgotplt->output_offset, spltlittbl->contents + (chunk * 8) + 0); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, 8 + (chunk_entries * 4), spltlittbl->contents + (chunk * 8) + 4); } @@ -3327,7 +3323,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd, happen before the code below which combines adjacent literal table entries, and the .xt.lit.plt contents have to be forced to the output here. */ - if (! bfd_set_section_contents (output_bfd, + if (! bfd_set_section_contents (info->output_bfd, spltlittbl->output_section, spltlittbl->contents, spltlittbl->output_offset, @@ -3347,13 +3343,13 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd, /* Combine adjacent literal table entries. */ BFD_ASSERT (! bfd_link_relocatable (info)); - sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit"); + sxtlit = bfd_get_section_by_name (info->output_bfd, ".xt.lit"); sgotloc = htab->sgotloc; BFD_ASSERT (sgotloc); if (sxtlit) { num_xtlit_entries = - elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc); + elf_xtensa_combine_prop_entries (info->output_bfd, sxtlit, sgotloc); if (num_xtlit_entries < 0) return false; } @@ -3395,7 +3391,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd, break; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon); } return true; diff --git a/bfd/elf32-z80.c b/bfd/elf32-z80.c index 1dc2e192adc..4393a6130d1 100644 --- a/bfd/elf32-z80.c +++ b/bfd/elf32-z80.c @@ -384,8 +384,7 @@ z80_elf_final_link_relocate (unsigned long r_type, } static int -z80_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +z80_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -421,7 +420,8 @@ z80_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 { @@ -449,7 +449,7 @@ z80_elf_relocate_section (bfd *output_bfd, continue; - z80_elf_final_link_relocate (r_type, input_bfd, output_bfd, + z80_elf_final_link_relocate (r_type, input_bfd, info->output_bfd, input_section, contents, rel->r_offset, relocation, rel->r_addend, diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 8cc70610c59..10175882d88 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -2560,8 +2560,7 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info) } static bool -elf64_alpha_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf64_alpha_early_size_sections (struct bfd_link_info *info) { bfd *i; struct alpha_elf_link_hash_table * htab; @@ -2788,8 +2787,7 @@ elf64_alpha_size_rela_got_section (struct bfd_link_info *info) /* Set the sizes of the dynamic sections. */ static bool -elf64_alpha_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf64_alpha_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -2898,8 +2896,7 @@ elf64_alpha_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (!_bfd_elf_add_dynamic_tags (output_bfd, info, - relocs || relplt)) + if (!_bfd_elf_add_dynamic_tags (info, relocs || relplt)) return false; if (relplt @@ -4029,8 +4026,7 @@ elf64_alpha_emit_dynrel (bfd *abfd, struct bfd_link_info *info, symbol winds up in the output section. */ static int -elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +elf64_alpha_relocate_section_r (struct bfd_link_info *info ATTRIBUTE_UNUSED, bfd *input_bfd, asection *input_section, bfd_byte *contents ATTRIBUTE_UNUSED, Elf_Internal_Rela *relocs, @@ -4111,7 +4107,7 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, /* Relocate an Alpha ELF section. */ static int -elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +elf64_alpha_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, @@ -4130,7 +4126,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* Handle relocatable links with a smaller loop. */ if (bfd_link_relocatable (info)) - return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, + return elf64_alpha_relocate_section_r (info, input_bfd, input_section, contents, relocs, local_syms, local_sections); @@ -4216,7 +4212,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, sym = local_syms + r_symndx; sec = local_sections[r_symndx]; msec = sec; - value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); + value = _bfd_elf_rela_local_sym (info->output_bfd, sym, &msec, rel); /* If this is a tp-relative relocation against sym STN_UNDEF (0), this is hackery from relax_section. Force the value to @@ -4252,7 +4248,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, continue; msec = sec; ent->addend = - _bfd_merged_section_offset (output_bfd, &msec, + _bfd_merged_section_offset (info->output_bfd, &msec, sym->st_value + ent->addend); ent->addend -= sym->st_value; ent->addend += msec->output_section->vma @@ -4333,7 +4329,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { gotent->reloc_done = 1; - bfd_put_64 (output_bfd, value, + bfd_put_64 (info->output_bfd, value, sgot->contents + gotent->got_offset); /* If the symbol has been forced local, output a @@ -4342,7 +4338,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (bfd_link_pic (info) && !dynamic_symbol_p && !undef_weak_ref) - elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot, + elf64_alpha_emit_dynrel (info->output_bfd, info, sgot, srelgot, gotent->got_offset, 0, R_ALPHA_RELATIVE, value); } @@ -4509,7 +4505,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && (input_section->flags & SEC_ALLOC) && !undef_weak_ref && !(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))) @@ -4531,7 +4527,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, goto default_reloc; if (input_section->flags & SEC_ALLOC) - elf64_alpha_emit_dynrel (output_bfd, info, input_section, + elf64_alpha_emit_dynrel (info->output_bfd, info, input_section, srel, rel->r_offset, dynindx, dyntype, dynaddend); } @@ -4564,7 +4560,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, NULL to be encoded as 0 in any format, so this works here. */ if (r_symndx == STN_UNDEF || (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)) howto = (elf64_alpha_howto_table @@ -4583,7 +4579,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, gotent->reloc_done = 1; /* Note that the module index for the main program is 1. */ - bfd_put_64 (output_bfd, + bfd_put_64 (info->output_bfd, !bfd_link_pic (info) && !dynamic_symbol_p, sgot->contents + gotent->got_offset); @@ -4591,7 +4587,8 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, DTPMOD64 reloc, otherwise it will be handled in finish_dynamic_symbol. */ if (bfd_link_pic (info) && !dynamic_symbol_p) - elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot, + elf64_alpha_emit_dynrel (info->output_bfd, info, + sgot, srelgot, gotent->got_offset, 0, R_ALPHA_DTPMOD64, 0); @@ -4602,7 +4599,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); value -= dtp_base; } - bfd_put_64 (output_bfd, value, + bfd_put_64 (info->output_bfd, value, sgot->contents + gotent->got_offset + 8); } @@ -4687,14 +4684,15 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, value -= tp_base; else { - elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot, + elf64_alpha_emit_dynrel (info->output_bfd, info, + sgot, srelgot, gotent->got_offset, 0, R_ALPHA_TPREL64, value - dtp_base); value = 0; } } - bfd_put_64 (output_bfd, value, + bfd_put_64 (info->output_bfd, value, sgot->contents + gotent->got_offset); } @@ -4759,7 +4757,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, dynamic sections here. */ static bool -elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, +elf64_alpha_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -4809,7 +4807,7 @@ elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, { disp = (PLT_HEADER_SIZE - 4) - (gotent->plt_offset + 4); insn = INSN_AD (INSN_BR, 31, disp); - bfd_put_32 (output_bfd, insn, + bfd_put_32 (info->output_bfd, insn, splt->contents + gotent->plt_offset); plt_index = ((gotent->plt_offset - NEW_PLT_HEADER_SIZE) @@ -4819,11 +4817,11 @@ elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, { disp = -(gotent->plt_offset + 4); insn = INSN_AD (INSN_BR, 28, disp); - bfd_put_32 (output_bfd, insn, + bfd_put_32 (info->output_bfd, insn, splt->contents + gotent->plt_offset); - bfd_put_32 (output_bfd, INSN_UNOP, + bfd_put_32 (info->output_bfd, INSN_UNOP, splt->contents + gotent->plt_offset + 4); - bfd_put_32 (output_bfd, INSN_UNOP, + bfd_put_32 (info->output_bfd, INSN_UNOP, splt->contents + gotent->plt_offset + 8); plt_index = ((gotent->plt_offset - OLD_PLT_HEADER_SIZE) @@ -4836,10 +4834,10 @@ elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, outrel.r_addend = 0; loc = srel->contents + plt_index * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &outrel, loc); /* Fill in the entry in the .got. */ - bfd_put_64 (output_bfd, plt_addr, + bfd_put_64 (info->output_bfd, plt_addr, sgot->contents + gotent->got_offset); } } @@ -4884,12 +4882,12 @@ elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, abort (); } - elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel, + elf64_alpha_emit_dynrel (info->output_bfd, info, sgot, srel, gotent->got_offset, h->dynindx, r_type, gotent->addend); if (gotent->reloc_type == R_ALPHA_TLSGD) - elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel, + elf64_alpha_emit_dynrel (info->output_bfd, info, sgot, srel, gotent->got_offset + 8, h->dynindx, R_ALPHA_DTPREL64, gotent->addend); } @@ -4907,8 +4905,7 @@ elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -elf64_alpha_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf64_alpha_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -4961,7 +4958,7 @@ elf64_alpha_finish_dynamic_sections (bfd *output_bfd, break; } - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); } /* Initialize the plt header. */ @@ -4975,49 +4972,49 @@ elf64_alpha_finish_dynamic_sections (bfd *output_bfd, ofs = gotplt_vma - (plt_vma + PLT_HEADER_SIZE); insn = INSN_ABC (INSN_SUBQ, 27, 28, 25); - bfd_put_32 (output_bfd, insn, splt->contents); + bfd_put_32 (info->output_bfd, insn, splt->contents); insn = INSN_ABO (INSN_LDAH, 28, 28, (ofs + 0x8000) >> 16); - bfd_put_32 (output_bfd, insn, splt->contents + 4); + bfd_put_32 (info->output_bfd, insn, splt->contents + 4); insn = INSN_ABC (INSN_S4SUBQ, 25, 25, 25); - bfd_put_32 (output_bfd, insn, splt->contents + 8); + bfd_put_32 (info->output_bfd, insn, splt->contents + 8); insn = INSN_ABO (INSN_LDA, 28, 28, ofs); - bfd_put_32 (output_bfd, insn, splt->contents + 12); + bfd_put_32 (info->output_bfd, insn, splt->contents + 12); insn = INSN_ABO (INSN_LDQ, 27, 28, 0); - bfd_put_32 (output_bfd, insn, splt->contents + 16); + bfd_put_32 (info->output_bfd, insn, splt->contents + 16); insn = INSN_ABC (INSN_ADDQ, 25, 25, 25); - bfd_put_32 (output_bfd, insn, splt->contents + 20); + bfd_put_32 (info->output_bfd, insn, splt->contents + 20); insn = INSN_ABO (INSN_LDQ, 28, 28, 8); - bfd_put_32 (output_bfd, insn, splt->contents + 24); + bfd_put_32 (info->output_bfd, insn, splt->contents + 24); insn = INSN_AB (INSN_JMP, 31, 27); - bfd_put_32 (output_bfd, insn, splt->contents + 28); + bfd_put_32 (info->output_bfd, insn, splt->contents + 28); insn = INSN_AD (INSN_BR, 28, -PLT_HEADER_SIZE); - bfd_put_32 (output_bfd, insn, splt->contents + 32); + bfd_put_32 (info->output_bfd, insn, splt->contents + 32); } else { insn = INSN_AD (INSN_BR, 27, 0); /* br $27, .+4 */ - bfd_put_32 (output_bfd, insn, splt->contents); + bfd_put_32 (info->output_bfd, insn, splt->contents); insn = INSN_ABO (INSN_LDQ, 27, 27, 12); - bfd_put_32 (output_bfd, insn, splt->contents + 4); + bfd_put_32 (info->output_bfd, insn, splt->contents + 4); insn = INSN_UNOP; - bfd_put_32 (output_bfd, insn, splt->contents + 8); + bfd_put_32 (info->output_bfd, insn, splt->contents + 8); insn = INSN_AB (INSN_JMP, 27, 27); - bfd_put_32 (output_bfd, insn, splt->contents + 12); + bfd_put_32 (info->output_bfd, insn, splt->contents + 12); /* The next two words will be filled in by ld.so. */ - bfd_put_64 (output_bfd, 0, splt->contents + 16); - bfd_put_64 (output_bfd, 0, splt->contents + 24); + bfd_put_64 (info->output_bfd, 0, splt->contents + 16); + bfd_put_64 (info->output_bfd, 0, splt->contents + 24); } elf_section_data (splt->output_section)->this_hdr.sh_entsize = 0; diff --git a/bfd/elf64-bpf.c b/bfd/elf64-bpf.c index 89ab8ab80c8..1e6ed7c01b1 100644 --- a/bfd/elf64-bpf.c +++ b/bfd/elf64-bpf.c @@ -172,8 +172,7 @@ bpf_info_to_howto (bfd *abfd, arelent *bfd_reloc, #define sec_addr(sec) ((sec)->output_section->vma + (sec)->output_offset) static int -bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +bpf_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index f4b24b294f3..7ce9a3bdf2e 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -187,13 +187,6 @@ static int elf64_hppa_link_output_symbol_hook (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *); -static bool elf64_hppa_finish_dynamic_symbol - (bfd *, struct bfd_link_info *, - struct elf_link_hash_entry *, Elf_Internal_Sym *); - -static bool elf64_hppa_finish_dynamic_sections - (bfd *, struct bfd_link_info *, bfd_byte *); - static bool elf64_hppa_check_relocs (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); @@ -1615,7 +1608,7 @@ elf64_hppa_mark_milli_and_exported_functions (struct elf_link_hash_entry *eh, the contents of our special sections. */ static bool -elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf64_hppa_late_size_sections (struct bfd_link_info *info) { struct elf64_hppa_link_hash_table *hppa_info; struct elf64_hppa_allocate_data data; @@ -2021,7 +2014,7 @@ elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) /* Force DT_FLAGS to always be set. Required by HPUX 11.00 patch PHSS_26559. PR 30743: But do not set them for non-HPUX targets. */ - if (output_bfd->xvec == & hppa_elf64_vec) + if (info->output_bfd->xvec == &hppa_elf64_vec) { if (!add_dynamic_entry (DT_FLAGS, (info)->flags)) return false; @@ -2037,7 +2030,7 @@ elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) } #undef add_dynamic_entry - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); + return _bfd_elf_add_dynamic_tags (info, relocs); } /* Called after we have output the symbol into the dynamic symbol @@ -2084,8 +2077,7 @@ elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED, dynamic sections here. */ static bool -elf64_hppa_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf64_hppa_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *eh, Elf_Internal_Sym *sym) { @@ -2121,7 +2113,7 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd, sym->st_value = (hh->opd_offset + sopd->output_offset + sopd->output_section->vma); - sym->st_shndx = _bfd_elf_section_from_bfd_section (output_bfd, + sym->st_shndx = _bfd_elf_section_from_bfd_section (info->output_bfd, sopd->output_section); } @@ -2209,7 +2201,7 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd, value = hh->plt_offset - hppa_info->gp_offset; insn = bfd_get_32 (stub->owner, stub->contents + hh->stub_offset); - if (output_bfd->arch_info->mach >= 25) + if (info->output_bfd->arch_info->mach >= 25) { /* Wide mode allows 16 bit offsets. */ max_offset = 32768; @@ -2238,7 +2230,7 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd, /* Fix up the second ldd instruction. */ value += 8; insn = bfd_get_32 (stub->owner, stub->contents + hh->stub_offset + 8); - if (output_bfd->arch_info->mach >= 25) + if (info->output_bfd->arch_info->mach >= 25) { insn &= ~ 0xfff1; insn |= re_assemble_16 ((int) value); @@ -2608,8 +2600,7 @@ elf64_hppa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, /* Finish up the dynamic sections. */ static bool -elf64_hppa_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf64_hppa_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -2668,33 +2659,33 @@ elf64_hppa_finish_dynamic_sections (bfd *output_bfd, In HPUX 11.11, HP ld now allocates the region at the end of the .bss section. This avoids adding 16 bytes to the start of .data. This may affect relocation offsets. */ - if (output_bfd->xvec == & hppa_elf64_vec + if (info->output_bfd->xvec == & hppa_elf64_vec && ! bfd_link_pic (info)) { - s = bfd_get_section_by_name (output_bfd, ".bss"); + s = bfd_get_section_by_name (info->output_bfd, ".bss"); if (!s) break; dyn.d_un.d_ptr = s->vma + s->size - 16; - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); } break; case DT_PLTGOT: /* HP's use PLTGOT to set the GOT register. */ - dyn.d_un.d_ptr = _bfd_get_gp_value (output_bfd); - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + dyn.d_un.d_ptr = _bfd_get_gp_value (info->output_bfd); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_JMPREL: s = hppa_info->root.srelplt; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: s = hppa_info->root.srelplt; dyn.d_un.d_val = s->size; - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_RELA: @@ -2704,7 +2695,7 @@ elf64_hppa_finish_dynamic_sections (bfd *output_bfd, if (! s || ! s->size) s = hppa_info->opd_rel_sec; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; case DT_RELASZ: @@ -2719,7 +2710,7 @@ elf64_hppa_finish_dynamic_sections (bfd *output_bfd, it, so we'll emulate them. */ s = hppa_info->root.srelplt; dyn.d_un.d_val += s->size; - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); break; } @@ -4305,14 +4296,13 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel, /* Relocate an HPPA ELF section. */ static int -elf64_hppa_relocate_section (bfd *output_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) +elf64_hppa_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, + asection **local_sections) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *rel; @@ -4358,7 +4348,8 @@ elf64_hppa_relocate_section (bfd *output_bfd, /* This is a local symbol, hh defaults to NULL. */ sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sym_sec, rel); } else { @@ -4436,7 +4427,7 @@ elf64_hppa_relocate_section (bfd *output_bfd, if (bfd_link_relocatable (info)) continue; - r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, + r = elf_hppa_final_link_relocate (rel, input_bfd, info->output_bfd, input_section, contents, relocation, info, sym, sym_sec, eh); diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index c35cb7cedc5..6785ea08a38 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -2591,8 +2591,7 @@ elf64_ia64_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, } static bool -elf64_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf64_ia64_late_size_sections (struct bfd_link_info *info) { struct elf64_ia64_allocate_data data; struct elf64_ia64_link_hash_table *ia64_info; @@ -2829,7 +2828,7 @@ elf64_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (!(abfd->flags & DYNAMIC)) continue; - BFD_ASSERT (abfd->xvec == output_bfd->xvec); + BFD_ASSERT (abfd->xvec == info->output_bfd->xvec); if (!_bfd_elf_add_dynamic_entry (info, DT_IA_64_VMS_NEEDED_IDENT, elf_ia64_vms_ident (abfd))) @@ -2906,10 +2905,10 @@ elf64_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, bed->s->swap_dyn_out (hash_table->dynobj, &dyn, dynsec->contents + strdyn_off + bed->s->sizeof_dyn); - elf_ia64_vms_tdata (output_bfd)->needed_count = shl_num; + elf_ia64_vms_tdata (info->output_bfd)->needed_count = shl_num; /* Note section. */ - if (!create_ia64_vms_notes (output_bfd, info, time_hi, time_lo)) + if (!create_ia64_vms_notes (info->output_bfd, info, time_hi, time_lo)) return false; } @@ -3369,8 +3368,7 @@ elf64_ia64_final_link (bfd *abfd, struct bfd_link_info *info) } static int -elf64_ia64_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf64_ia64_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -3402,7 +3400,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, ->this_hdr.sh_flags |= flags; } - gp_val = _bfd_get_gp_value (output_bfd); + gp_val = _bfd_get_gp_value (info->output_bfd); rel = relocs; relend = relocs + input_section->reloc_count; @@ -3451,7 +3449,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx]; msec = sym_sec; - value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); + value = _bfd_elf_rela_local_sym (info->output_bfd, sym, &msec, rel); if (!bfd_link_relocatable (info) && (sym_sec->flags & SEC_MERGE) != 0 && ELF_ST_TYPE (sym->st_info) == STT_SECTION @@ -3471,7 +3469,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, { msec = sym_sec; dynent->addend = - _bfd_merged_section_offset (output_bfd, &msec, + _bfd_merged_section_offset (info->output_bfd, &msec, sym->st_value + dynent->addend); dynent->addend -= sym->st_value; @@ -3596,7 +3594,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, break; } elf64_ia64_install_fixup - (output_bfd, ia64_info, h, + (info->output_bfd, ia64_info, h, dyn_r_type, input_section, rel->r_offset, addend); r = bfd_reloc_ok; break; @@ -3647,7 +3645,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, case R_IA64_PLTOFF64MSB: case R_IA64_PLTOFF64LSB: dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false); - value = set_pltoff_entry (output_bfd, info, dyn_i, value, false); + value = set_pltoff_entry (info->output_bfd, info, dyn_i, value, false); value -= gp_val; r = ia64_elf_install_value (hit_addr, value, r_type); break; @@ -3661,7 +3659,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, if (dyn_i->want_fptr) { if (!undef_weak_ref) - value = set_fptr_entry (output_bfd, info, dyn_i, value); + value = set_fptr_entry (info->output_bfd, info, dyn_i, value); } if (!dyn_i->want_fptr || bfd_link_pie (info)) { @@ -3692,7 +3690,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, /* VMS: FIXFD. */ elf64_ia64_install_fixup - (output_bfd, ia64_info, h, R_IA64_VMS_FIXFD, + (info->output_bfd, ia64_info, h, R_IA64_VMS_FIXFD, input_section, rel->r_offset, 0); r = bfd_reloc_ok; break; @@ -3712,12 +3710,12 @@ elf64_ia64_relocate_section (bfd *output_bfd, { BFD_ASSERT (h == NULL || !h->def_dynamic); if (!undef_weak_ref) - value = set_fptr_entry (output_bfd, info, dyn_i, value); + value = set_fptr_entry (info->output_bfd, info, dyn_i, value); } else value = 0; - value = set_got_entry (output_bfd, info, dyn_i, + value = set_got_entry (info->output_bfd, info, dyn_i, rel->r_addend, value, R_IA64_FPTR64LSB); value -= gp_val; r = ia64_elf_install_value (hit_addr, value, r_type); @@ -3814,7 +3812,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, { /* Find the segment that contains the output_section. */ Elf_Internal_Phdr *p = _bfd_elf_find_segment_containing_section - (output_bfd, sym_sec->output_section); + (info->output_bfd, sym_sec->output_section); if (p == NULL) { @@ -3995,8 +3993,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, } static bool -elf64_ia64_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf64_ia64_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -4014,11 +4011,12 @@ elf64_ia64_finish_dynamic_symbol (bfd *output_bfd, asection *plt_sec; bfd_vma plt_addr, pltoff_addr, gp_val; - gp_val = _bfd_get_gp_value (output_bfd); + gp_val = _bfd_get_gp_value (info->output_bfd); plt_sec = ia64_info->root.splt; plt_addr = 0; /* Not used as overriden by FIXUPs. */ - pltoff_addr = set_pltoff_entry (output_bfd, info, dyn_i, plt_addr, true); + pltoff_addr = set_pltoff_entry (info->output_bfd, info, dyn_i, + plt_addr, true); /* Initialize the FULL PLT entry, if needed. */ if (dyn_i->want_plt2) @@ -4038,7 +4036,7 @@ elf64_ia64_finish_dynamic_symbol (bfd *output_bfd, /* VMS: FIXFD. */ elf64_ia64_install_fixup - (output_bfd, ia64_info, h, R_IA64_VMS_FIXFD, ia64_info->pltoff_sec, + (info->output_bfd, ia64_info, h, R_IA64_VMS_FIXFD, ia64_info->pltoff_sec, pltoff_addr - (ia64_info->pltoff_sec->output_section->vma + ia64_info->pltoff_sec->output_offset), 0); } @@ -4053,8 +4051,7 @@ elf64_ia64_finish_dynamic_symbol (bfd *output_bfd, } static bool -elf64_ia64_finish_dynamic_sections (bfd *abfd, - struct bfd_link_info *info, +elf64_ia64_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf64_ia64_link_hash_table *ia64_info; @@ -4084,7 +4081,7 @@ elf64_ia64_finish_dynamic_sections (bfd *abfd, dyncon = (Elf64_External_Dyn *) sdyn->contents; dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); - gp_val = _bfd_get_gp_value (abfd); + gp_val = _bfd_get_gp_value (info->output_bfd); phdr = _bfd_elf_find_segment_containing_section (info->output_bfd, ia64_info->pltoff_sec->output_section); BFD_ASSERT (phdr != NULL); @@ -4092,17 +4089,20 @@ elf64_ia64_finish_dynamic_sections (bfd *abfd, gp_seg = phdr - base_phdr; gp_off = gp_val - phdr->p_vaddr; - unwind_sec = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind); + unwind_sec = bfd_get_section_by_name (info->output_bfd, + ELF_STRING_ia64_unwind); if (unwind_sec != NULL) { asection *code_sec; - phdr = _bfd_elf_find_segment_containing_section (abfd, unwind_sec); + phdr = _bfd_elf_find_segment_containing_section (info->output_bfd, + unwind_sec); BFD_ASSERT (phdr != NULL); unwind_seg = phdr - base_phdr; - code_sec = bfd_get_section_by_name (abfd, "$CODE$"); - phdr = _bfd_elf_find_segment_containing_section (abfd, code_sec); + code_sec = bfd_get_section_by_name (info->output_bfd, "$CODE$"); + phdr = _bfd_elf_find_segment_containing_section (info->output_bfd, + code_sec); BFD_ASSERT (phdr != NULL); code_seg = phdr - base_phdr; } @@ -4157,7 +4157,7 @@ elf64_ia64_finish_dynamic_sections (bfd *abfd, continue; } - bfd_elf64_swap_dyn_out (abfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); } } diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index b874fae40af..4036dcb7c3d 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -1347,8 +1347,7 @@ mmix_elf_reloc (bfd *abfd, for guidance if you're thinking of copying this. */ static int -mmix_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +mmix_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -1404,7 +1403,8 @@ mmix_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); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, @@ -1477,7 +1477,7 @@ mmix_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, /* Put a JMP insn at the stub; it goes with the R_MMIX_JMP reloc. */ - bfd_put_32 (output_bfd, JMP_INSN_BYTE << 24, + bfd_put_32 (info->output_bfd, JMP_INSN_BYTE << 24, contents + size + mmix_elf_section_data (input_section) diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 7e41085ed91..5fca8f7bcb2 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -6580,7 +6580,7 @@ static const struct sfpr_def_parms save_res_funcs[] = their corresponding function descriptor symbol entries. */ static bool -ppc64_elf_edit (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) +ppc64_elf_edit (struct bfd_link_info *info) { struct ppc_link_hash_table *htab; @@ -10235,8 +10235,7 @@ size_global_entry_stubs (struct elf_link_hash_entry *h, void *inf) /* Set the sizes of the dynamic sections. */ static bool -ppc64_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +ppc64_elf_late_size_sections (struct bfd_link_info *info) { struct ppc_link_hash_table *htab; bfd *dynobj; @@ -10615,7 +10614,7 @@ ppc64_elf_late_size_sections (bfd *output_bfd, return false; } - if (NO_OPD_RELOCS && abiversion (output_bfd) <= 1) + if (NO_OPD_RELOCS && abiversion (info->output_bfd) <= 1) { if (!add_dynamic_entry (DT_PPC64_OPD, 0) || !add_dynamic_entry (DT_PPC64_OPDSZ, 0)) @@ -15511,8 +15510,7 @@ ppc64_glibc_dynamic_reloc (enum elf_ppc64_reloc_type r_type) accordingly. */ static int -ppc64_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +ppc64_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -15556,7 +15554,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, } local_got_ents = elf_local_got_ents (input_bfd); - TOCstart = elf_gp (output_bfd); + TOCstart = elf_gp (info->output_bfd); symtab_hdr = &elf_symtab_hdr (input_bfd); sym_hashes = elf_sym_hashes (input_bfd); is_opd = ppc64_elf_section_data (input_section)->sec_type == sec_opd; @@ -15624,7 +15622,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, sec = local_sections[r_symndx]; sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec); sym_type = ELF64_ST_TYPE (sym->st_info); - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); opd = get_opd_info (sec); if (opd != NULL && opd->adjust != NULL) { @@ -15657,7 +15656,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, sym_name = h_elf->root.root.string; sym_type = h_elf->type; if (sec != NULL - && sec->owner == output_bfd + && sec->owner == info->output_bfd && strcmp (sec->name, ".opd") == 0) { /* This is a symbol defined in a linker script. All @@ -16159,16 +16158,16 @@ ppc64_elf_relocate_section (bfd *output_bfd, offset = rel->r_offset; if (is_plt_seq_reloc (r_type1)) { - bfd_put_32 (output_bfd, NOP, contents + offset); + bfd_put_32 (info->output_bfd, NOP, contents + offset); if (r_type1 == R_PPC64_PLT_PCREL34 || r_type1 == R_PPC64_PLT_PCREL34_NOTOC) - bfd_put_32 (output_bfd, NOP, contents + offset + 4); + bfd_put_32 (info->output_bfd, NOP, contents + offset + 4); rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); break; } if (r_type1 == R_PPC64_PLTCALL) - bfd_put_32 (output_bfd, NOP, contents + offset + 4); + bfd_put_32 (info->output_bfd, NOP, contents + offset + 4); if ((tls_mask & TLS_GDIE) != 0) { @@ -16223,16 +16222,16 @@ ppc64_elf_relocate_section (bfd *output_bfd, offset = rel->r_offset; if (is_plt_seq_reloc (r_type1)) { - bfd_put_32 (output_bfd, NOP, contents + offset); + bfd_put_32 (info->output_bfd, NOP, contents + offset); if (r_type1 == R_PPC64_PLT_PCREL34 || r_type1 == R_PPC64_PLT_PCREL34_NOTOC) - bfd_put_32 (output_bfd, NOP, contents + offset + 4); + bfd_put_32 (info->output_bfd, NOP, contents + offset + 4); rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); break; } if (r_type1 == R_PPC64_PLTCALL) - bfd_put_32 (output_bfd, NOP, contents + offset + 4); + bfd_put_32 (info->output_bfd, NOP, contents + offset + 4); if (r_type1 == R_PPC64_REL24_NOTOC || r_type1 == R_PPC64_REL24_P9NOTOC @@ -16272,7 +16271,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, r_type = R_PPC64_TPREL64; else { - bfd_put_64 (output_bfd, 1, contents + rel->r_offset); + bfd_put_64 (info->output_bfd, 1, contents + rel->r_offset); r_type = R_PPC64_NONE; } rel->r_info = ELF64_R_INFO (r_symndx, r_type); @@ -16283,7 +16282,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if ((tls_mask & TLS_LD) == 0 && offset_in_range (input_section, rel->r_offset, 8)) { - bfd_put_64 (output_bfd, 1, contents + rel->r_offset); + bfd_put_64 (info->output_bfd, 1, contents + rel->r_offset); r_type = R_PPC64_NONE; rel->r_info = ELF64_R_INFO (r_symndx, r_type); } @@ -17047,7 +17046,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64); if (tls_type == (TLS_TLS | TLS_GD)) { - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, + BFD_ASSERT (count_and_swap_reloc_out (info->output_bfd, &outrel, relgot)); outrel.r_offset += 8; @@ -17072,8 +17071,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, /* Write the .got section contents for the sake of prelink. */ loc = got->contents + off; - bfd_put_64 (output_bfd, outrel.r_addend + relocation, - loc); + bfd_put_64 (info->output_bfd, + outrel.r_addend + relocation, loc); } if (indx == 0 && tls_type != (TLS_TLS | TLS_LD)) @@ -17089,7 +17088,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, } if (!(info->enable_dt_relr && ELF64_R_TYPE (outrel.r_info) == R_PPC64_RELATIVE)) - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, + BFD_ASSERT (count_and_swap_reloc_out (info->output_bfd, &outrel, relgot)); } @@ -17114,12 +17113,12 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (tls_type & (TLS_GD | TLS_LD)) { - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, got->contents + off + 8); relocation = 1; } } - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, got->contents + off); } } @@ -17192,7 +17191,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, || r_type == R_PPC64_PLT16_LO || r_type == R_PPC64_PLT16_LO_DS) { - got = (elf_gp (output_bfd) + got = (elf_gp (info->output_bfd) + htab->sec_info[input_section->id].toc_off); relocation -= got; } @@ -17417,7 +17416,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, skip = false; relocate = false; - out_off = _bfd_elf_section_offset (output_bfd, info, + out_off = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); if (out_off == (bfd_vma) -1) skip = true; @@ -17575,8 +17574,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (sreloc == NULL) abort (); - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, &outrel, - sreloc)); + BFD_ASSERT (count_and_swap_reloc_out (info->output_bfd, + &outrel, sreloc)); } if (!warned_dynamic @@ -17926,7 +17925,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 && h->elf.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) { info->callbacks->einfo @@ -18156,8 +18155,7 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info, dynamic sections here. */ static bool -ppc64_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +ppc64_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -18210,7 +18208,7 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd, srel = htab->elf.sreldynrelro; else srel = htab->elf.srelbss; - BFD_ASSERT (count_and_swap_reloc_out (output_bfd, &rela, srel)); + BFD_ASSERT (count_and_swap_reloc_out (info->output_bfd, &rela, srel)); } return true; @@ -18247,8 +18245,7 @@ ppc64_elf_reloc_type_class (const struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -ppc64_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +ppc64_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf) { struct ppc_link_hash_table *htab; @@ -18294,7 +18291,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_PPC64_OPD: - s = bfd_get_section_by_name (output_bfd, ".opd"); + s = bfd_get_section_by_name (info->output_bfd, ".opd"); if (s == NULL) continue; dyn.d_un.d_ptr = s->vma; @@ -18309,7 +18306,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_PPC64_OPDSZ: - s = bfd_get_section_by_name (output_bfd, ".opd"); + s = bfd_get_section_by_name (info->output_bfd, ".opd"); if (s == NULL) continue; dyn.d_un.d_val = s->size; @@ -18337,7 +18334,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, continue; } - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); } } @@ -18346,8 +18343,8 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, { /* Fill in the first entry in the global offset table. We use it to hold the link-time TOCbase. */ - bfd_put_64 (output_bfd, - elf_gp (output_bfd) + TOC_BASE_OFF, + bfd_put_64 (info->output_bfd, + elf_gp (info->output_bfd) + TOC_BASE_OFF, htab->elf.sgot->contents); /* Set .got entry size. */ @@ -18367,7 +18364,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, brlt ourselves if emitrelocations. */ if (htab->brlt != NULL && htab->brlt->reloc_count != 0 - && !_bfd_elf_link_output_relocs (output_bfd, + && !_bfd_elf_link_output_relocs (info->output_bfd, htab->brlt, elf_section_data (htab->brlt)->rela.hdr, elf_section_data (htab->brlt)->relocs, @@ -18376,7 +18373,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, if (htab->glink != NULL && htab->glink->reloc_count != 0 - && !_bfd_elf_link_output_relocs (output_bfd, + && !_bfd_elf_link_output_relocs (info->output_bfd, htab->glink, elf_section_data (htab->glink)->rela.hdr, elf_section_data (htab->glink)->relocs, @@ -18387,7 +18384,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, if (htab->glink_eh_frame != NULL && htab->glink_eh_frame->size != 0 && htab->glink_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME - && !_bfd_elf_write_linker_section_eh_frame (output_bfd, info, + && !_bfd_elf_write_linker_section_eh_frame (info->output_bfd, info, htab->glink_eh_frame, buf)) return false; @@ -18405,7 +18402,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, if (s != NULL && s->size != 0 && s->output_section != bfd_abs_section_ptr - && !bfd_set_section_contents (output_bfd, s->output_section, + && !bfd_set_section_contents (info->output_bfd, s->output_section, s->contents, s->output_offset, s->size)) return false; @@ -18413,7 +18410,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, if (s != NULL && s->size != 0 && s->output_section != bfd_abs_section_ptr - && !bfd_set_section_contents (output_bfd, s->output_section, + && !bfd_set_section_contents (info->output_bfd, s->output_section, s->contents, s->output_offset, s->size)) return false; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index e9a7041d415..cbffbc99a78 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1975,8 +1975,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, /* Set the sizes of the dynamic sections. */ static bool -elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elf_s390_late_size_sections (struct bfd_link_info *info) { struct elf_s390_link_hash_table *htab; bfd *dynobj; @@ -2247,7 +2246,7 @@ elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, _bfd_s390_elf_write_sframe_plt (info); } - return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); + return _bfd_elf_add_dynamic_tags (info, relocs); } /* Return the base VMA address which should be subtracted from real addresses @@ -2301,8 +2300,7 @@ invalid_tls_insn (bfd *input_bfd, /* Relocate a 390 ELF section. */ static int -elf_s390_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_s390_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2403,7 +2401,7 @@ elf_s390_relocate_section (bfd *output_bfd, case R_390_GOTENT: { /* Write the PLT slot address into the GOT slot. */ - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, htab->elf.sgot->contents + local_got_offsets[r_symndx]); relocation = (local_got_offsets[r_symndx] + @@ -2423,7 +2421,8 @@ elf_s390_relocate_section (bfd *output_bfd, goto do_relocation; } 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 { @@ -2565,7 +2564,7 @@ elf_s390_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, htab->elf.sgot->contents + off); h->got.offset |= 1; } @@ -2600,7 +2599,7 @@ elf_s390_relocate_section (bfd *output_bfd, unsigned short new_insn = (0xc000 | (bfd_get_8 (input_bfd, contents + rel->r_offset - 1) & 0xf0)); - bfd_put_16 (output_bfd, new_insn, + bfd_put_16 (info->output_bfd, new_insn, contents + rel->r_offset - 2); r_type = R_390_PC32DBL; rel->r_info = ELF64_R_INFO (r_symndx, r_type); @@ -2629,7 +2628,7 @@ elf_s390_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, htab->elf.sgot->contents + off); if (bfd_link_pic (info)) @@ -2649,7 +2648,7 @@ elf_s390_relocate_section (bfd *output_bfd, outrel.r_addend = relocation; loc = s->contents; loc += s->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &outrel, loc); } local_got_offsets[r_symndx] |= 1; @@ -2743,8 +2742,8 @@ elf_s390_relocate_section (bfd *output_bfd, if (op == 0xc000) { /* larl rX, -> lay rX,0(0) */ - bfd_put_16 (output_bfd, 0xe300 | reg, insn_start); - bfd_put_32 (output_bfd, 0x71, insn_start + 2); + bfd_put_16 (info->output_bfd, 0xe300 | reg, insn_start); + bfd_put_32 (info->output_bfd, 0x71, insn_start + 2); rel->r_info = ELF64_R_INFO (0, R_390_NONE); rel->r_addend = 0; continue; @@ -2753,8 +2752,8 @@ elf_s390_relocate_section (bfd *output_bfd, else if (op == 0xc005) { /* brasl rX, -> jg .+2 (6-byte trap) */ - bfd_put_16 (output_bfd, 0xc0f4, insn_start); - bfd_put_32 (output_bfd, 0x1, insn_start + 2); + bfd_put_16 (info->output_bfd, 0xc0f4, insn_start); + bfd_put_32 (info->output_bfd, 0x1, insn_start + 2); rel->r_info = ELF64_R_INFO (0, R_390_NONE); rel->r_addend = 0; continue; @@ -2860,8 +2859,8 @@ elf_s390_relocate_section (bfd *output_bfd, if (op == 0xc000) { /* larl rX, -> lay rX,0(0) */ - bfd_put_16 (output_bfd, 0xe300 | reg, insn_start); - bfd_put_32 (output_bfd, 0x71, insn_start + 2); + bfd_put_16 (info->output_bfd, 0xe300 | reg, insn_start); + bfd_put_32 (info->output_bfd, 0x71, insn_start + 2); rel->r_info = ELF64_R_INFO (0, R_390_NONE); rel->r_addend = 0; continue; @@ -2870,8 +2869,8 @@ elf_s390_relocate_section (bfd *output_bfd, else if (op == 0xc602) { /* Emit a 6-byte NOP: jgnop . */ - bfd_put_16 (output_bfd, 0xc004, insn_start); - bfd_put_32 (output_bfd, 0x0, insn_start + 2); + bfd_put_16 (info->output_bfd, 0xc004, insn_start); + bfd_put_32 (info->output_bfd, 0x0, insn_start + 2); rel->r_info = ELF64_R_INFO (0, R_390_NONE); rel->r_addend = 0; continue; @@ -2889,8 +2888,8 @@ elf_s390_relocate_section (bfd *output_bfd, || (op & 0xff00) == 0xc600) { /* Emit a 6-byte trap: jg .+2 */ - bfd_put_16 (output_bfd, 0xc0f4, insn_start); - bfd_put_32 (output_bfd, 0x1, insn_start + 2); + bfd_put_16 (info->output_bfd, 0xc0f4, insn_start); + bfd_put_32 (info->output_bfd, 0x1, insn_start + 2); rel->r_info = ELF64_R_INFO (0, R_390_NONE); rel->r_addend = 0; continue; @@ -2929,7 +2928,7 @@ elf_s390_relocate_section (bfd *output_bfd, /* Need a dynamic relocation to get the real function address. */ - 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); @@ -2957,7 +2956,7 @@ elf_s390_relocate_section (bfd *output_bfd, } sreloc = htab->elf.irelifunc; - _bfd_elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (info->output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, @@ -3003,8 +3002,8 @@ elf_s390_relocate_section (bfd *output_bfd, 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) @@ -3081,7 +3080,7 @@ elf_s390_relocate_section (bfd *output_bfd, loc = sreloc->contents; loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &outrel, loc); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, we @@ -3110,7 +3109,7 @@ elf_s390_relocate_section (bfd *output_bfd, abort (); loc = sreloc->contents; loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloc_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloc_out (info->output_bfd, &outrel, loc); } /* Fall through. */ @@ -3134,7 +3133,8 @@ elf_s390_relocate_section (bfd *output_bfd, /* This relocation gets optimized away by the local exec access optimization. */ BFD_ASSERT (! unresolved_reloc); - bfd_put_64 (output_bfd, -tpoff (info, relocation) + rel->r_addend, + bfd_put_64 (info->output_bfd, + -tpoff (info, relocation) + rel->r_addend, contents + rel->r_offset); continue; } @@ -3181,14 +3181,14 @@ elf_s390_relocate_section (bfd *output_bfd, loc = htab->elf.srelgot->contents; loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &outrel, loc); if (r_type == R_390_TLS_GD64) { if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - bfd_put_64 (output_bfd, + bfd_put_64 (info->output_bfd, relocation - dtpoff_base (info), htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); } @@ -3199,7 +3199,7 @@ elf_s390_relocate_section (bfd *output_bfd, outrel.r_addend = 0; htab->elf.srelgot->reloc_count++; loc += sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &outrel, loc); } } @@ -3220,7 +3220,7 @@ elf_s390_relocate_section (bfd *output_bfd, } else { - bfd_put_64 (output_bfd, htab->elf.sgot->output_offset + off, + bfd_put_64 (info->output_bfd, htab->elf.sgot->output_offset + off, contents + rel->r_offset); continue; } @@ -3249,7 +3249,7 @@ elf_s390_relocate_section (bfd *output_bfd, abort (); BFD_ASSERT (! unresolved_reloc); - bfd_put_64 (output_bfd, -tpoff (info, relocation), + bfd_put_64 (info->output_bfd, -tpoff (info, relocation), htab->elf.sgot->contents + off); relocation = htab->elf.sgot->output_offset + off; if (r_type == R_390_TLS_IEENT) @@ -3281,14 +3281,14 @@ elf_s390_relocate_section (bfd *output_bfd, outrel.r_offset = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); - bfd_put_64 (output_bfd, 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); outrel.r_info = ELF64_R_INFO (0, R_390_TLS_DTPMOD); outrel.r_addend = 0; loc = htab->elf.srelgot->contents; loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &outrel, loc); htab->tls_ldm_got.offset |= 1; } relocation = htab->elf.sgot->output_offset + off; @@ -3322,12 +3322,13 @@ elf_s390_relocate_section (bfd *output_bfd, abort (); loc = sreloc->contents; loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &outrel, loc); } else { BFD_ASSERT (! unresolved_reloc); - bfd_put_64 (output_bfd, -tpoff (info, relocation) + rel->r_addend, + bfd_put_64 (info->output_bfd, + -tpoff (info, relocation) + rel->r_addend, contents + rel->r_offset); } continue; @@ -3390,8 +3391,10 @@ elf_s390_relocate_section (bfd *output_bfd, } insn0 = 0xeb000000 | (insn0 & 0x00f00000) | ry; insn1 = 0x000d; - bfd_put_32 (output_bfd, insn0, contents + rel->r_offset); - bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4); + bfd_put_32 (info->output_bfd, + insn0, contents + rel->r_offset); + bfd_put_16 (info->output_bfd, + insn1, contents + rel->r_offset + 4); } } else if (r_type == R_390_TLS_GDCALL) @@ -3419,8 +3422,10 @@ elf_s390_relocate_section (bfd *output_bfd, insn0 = 0xe322c000; insn1 = 0x0004; } - bfd_put_32 (output_bfd, insn0, contents + rel->r_offset); - bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4); + bfd_put_32 (info->output_bfd, + insn0, contents + rel->r_offset); + bfd_put_16 (info->output_bfd, + insn1, contents + rel->r_offset + 4); } else if (r_type == R_390_TLS_LDCALL) { @@ -3439,8 +3444,10 @@ elf_s390_relocate_section (bfd *output_bfd, brasl %r14,__tls_get_addr@plt -> brcl 0,. */ insn0 = 0xc0040000; insn1 = 0x0000; - bfd_put_32 (output_bfd, insn0, contents + rel->r_offset); - bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4); + bfd_put_32 (info->output_bfd, + insn0, contents + rel->r_offset); + bfd_put_16 (info->output_bfd, + insn1, contents + rel->r_offset + 4); } } continue; @@ -3455,7 +3462,7 @@ elf_s390_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 /* xgettext:c-format */ @@ -3637,8 +3644,7 @@ elf_s390_finish_ifunc_symbol (bfd *output_bfd, dynamic sections here. */ static bool -elf_s390_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf_s390_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3658,7 +3664,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, it up. */ if (s390_is_ifunc_symbol_p (h) && h->def_regular) { - elf_s390_finish_ifunc_symbol (output_bfd, info, h, + elf_s390_finish_ifunc_symbol (info->output_bfd, info, h, htab, h->plt.offset, eh->ifunc_resolver_address + eh->ifunc_resolver_section->output_offset + @@ -3695,7 +3701,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, /* The first instruction in the PLT entry is a LARL loading the address of the GOT slot. We write the 4 byte immediate operand of the LARL instruction here. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + gotplt_offset - (htab->elf.splt->output_section->vma + @@ -3703,16 +3709,16 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, h->plt.offset))/2, htab->elf.splt->contents + h->plt.offset + 2); /* Fixup the relative branch to PLT 0 */ - bfd_put_32 (output_bfd, - (PLT_FIRST_ENTRY_SIZE + + bfd_put_32 (info->output_bfd, - (PLT_FIRST_ENTRY_SIZE + (PLT_ENTRY_SIZE * plt_index) + 22)/2, htab->elf.splt->contents + h->plt.offset + 24); /* Fixup offset into .rela.plt section. */ - bfd_put_32 (output_bfd, plt_index * sizeof (Elf64_External_Rela), + bfd_put_32 (info->output_bfd, plt_index * sizeof (Elf64_External_Rela), htab->elf.splt->contents + h->plt.offset + 28); /* Fill in the entry in the global offset table. Points to instruction after GOT offset. */ - bfd_put_64 (output_bfd, + bfd_put_64 (info->output_bfd, (htab->elf.splt->output_section->vma + htab->elf.splt->output_offset + h->plt.offset @@ -3727,7 +3733,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = htab->elf.srelplt->contents + plt_index * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &rela, loc); if (!h->def_regular) { @@ -3781,9 +3787,9 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, /* For non-shared objects explicit GOT slots must be filled with the PLT slot address for pointer equality reasons. */ - bfd_put_64 (output_bfd, (htab->elf.iplt->output_section->vma - + htab->elf.iplt->output_offset - + h->plt.offset), + bfd_put_64 (info->output_bfd, (htab->elf.iplt->output_section->vma + + htab->elf.iplt->output_offset + + h->plt.offset), htab->elf.sgot->contents + h->got.offset); return true; } @@ -3811,14 +3817,15 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, { BFD_ASSERT((h->got.offset & 1) == 0); do_glob_dat: - bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgot->contents + h->got.offset); + bfd_put_64 (info->output_bfd, 0, + htab->elf.sgot->contents + h->got.offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_390_GLOB_DAT); rela.r_addend = 0; } loc = htab->elf.srelgot->contents; loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &rela, loc); } if (h->needs_copy) @@ -3846,7 +3853,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, else s = htab->elf.srelbss; loc = s->contents + s->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); + bfd_elf64_swap_reloca_out (info->output_bfd, &rela, loc); } /* Mark some specially defined symbols as absolute. */ @@ -3899,8 +3906,7 @@ elf_s390_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, /* Finish up the dynamic sections. */ static bool -elf_s390_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf_s390_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf) { struct elf_s390_link_hash_table *htab; @@ -3967,7 +3973,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, break; } - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon); } /* Fill in the special first entry in the procedure linkage table. */ @@ -3979,7 +3985,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, /* The second instruction in the first PLT entry is a LARL loading the GOT pointer. Fill in the LARL immediate address. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (s390_got_pointer (info) - htab->elf.splt->output_section->vma - htab->elf.splt->output_offset - 6)/2, @@ -3995,15 +4001,15 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, /* Fill in the first three entries in the global offset table. */ if (htab->elf.hgot->root.u.def.section->size > 0) { - bfd_put_64 (output_bfd, - (sdyn == NULL ? (bfd_vma) 0 + bfd_put_64 (info->output_bfd, + (sdyn == NULL ? 0 : sdyn->output_section->vma + sdyn->output_offset), htab->elf.hgot->root.u.def.section->contents); /* One entry for shared object struct ptr. */ - bfd_put_64 (output_bfd, (bfd_vma) 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.hgot->root.u.def.section->contents + 8); /* One entry for _dl_runtime_resolve. */ - bfd_put_64 (output_bfd, (bfd_vma) 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.hgot->root.u.def.section->contents + 16); } if (htab->elf.sgot != NULL && htab->elf.sgot->size > 0) @@ -4035,8 +4041,8 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, return false; if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC) - elf_s390_finish_ifunc_symbol (output_bfd, info, NULL, htab, - local_plt[i].plt.offset, + elf_s390_finish_ifunc_symbol (info->output_bfd, info, NULL, + htab, local_plt[i].plt.offset, isym->st_value + sec->output_section->vma + sec->output_offset); @@ -4069,7 +4075,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, } if (htab->plt_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME - && !_bfd_elf_write_linker_section_eh_frame (output_bfd, info, + && !_bfd_elf_write_linker_section_eh_frame (info->output_bfd, info, htab->plt_eh_frame, buf)) return NULL; } @@ -4095,7 +4101,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd, } if (htab->plt_sframe->sec_info_type == SEC_INFO_TYPE_SFRAME) { - if (! _bfd_elf_merge_section_sframe (output_bfd, info, + if (! _bfd_elf_merge_section_sframe (info->output_bfd, info, htab->plt_sframe, htab->plt_sframe->contents)) return false; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 1aea5aa8114..0e28bc2e076 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -597,8 +597,7 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, which we cannot easily keep in the symbol hash table. */ static bool -elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +elf64_sparc_output_arch_syms (struct bfd_link_info *info, void * flaginfo, int (*func) (void *, const char *, Elf_Internal_Sym *, diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index b3f008bd51d..575995d4957 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3125,20 +3125,18 @@ need_got: } static bool -elf_x86_64_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elf_x86_64_early_size_sections (struct bfd_link_info *info) { bfd *abfd; /* Scan relocations after rel_from_abs has been set on __ehdr_start. */ - for (abfd = info->input_bfds; - abfd != (bfd *) NULL; - abfd = abfd->link.next) + for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && !_bfd_elf_link_iterate_on_relocs (abfd, info, elf_x86_64_scan_relocs)) return false; - return _bfd_x86_elf_early_size_sections (output_bfd, info); + return _bfd_x86_elf_early_size_sections (info); } /* Return the relocation value for @tpoff relocation @@ -3163,8 +3161,7 @@ elf_x86_64_tpoff (struct bfd_link_info *info, bfd_vma address) /* Relocate an x86_64 ELF section. */ static int -elf_x86_64_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elf_x86_64_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -3260,8 +3257,8 @@ elf_x86_64_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); st_size = sym->st_size; /* Relocate against local STT_GNU_IFUNC symbol. */ @@ -3319,7 +3316,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, continue; } - if (rel->r_addend == 0 && !ABI_64_P (output_bfd)) + if (rel->r_addend == 0 && !ABI_64_P (info->output_bfd)) { if (r_type == R_X86_64_64) { @@ -3420,7 +3417,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, base_got->contents + off); /* Note that this is harmless for the GOTPLT64 case, as -1 | 1 still is -1. */ @@ -3490,7 +3487,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, goto do_relocation; case R_X86_64_32: - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) goto do_relocation; /* FALLTHROUGH */ case R_X86_64_64: @@ -3522,7 +3519,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, /* Need a dynamic relocation to get the real function address. */ - 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); @@ -3566,7 +3563,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, sreloc = htab->elf.srelgot; else sreloc = htab->elf.irelplt; - _bfd_elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (info->output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, @@ -3642,7 +3639,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, base_got->contents + off); /* Note that this is harmless for the GOTPLT64 case, as -1 | 1 still is -1. */ @@ -3677,7 +3674,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_64 (output_bfd, relocation, + bfd_put_64 (info->output_bfd, relocation, base_got->contents + off); local_got_offsets[r_symndx] |= 1; @@ -3721,7 +3718,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, (info, input_section, h, sym, "R_X86_64_RELATIVE", &outrel); - _bfd_elf_append_rela (output_bfd, s, &outrel); + _bfd_elf_append_rela (info->output_bfd, s, &outrel); } if (off >= (bfd_vma) -2) @@ -4016,8 +4013,8 @@ elf_x86_64_relocate_section (bfd *output_bfd, 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) @@ -4057,7 +4054,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, } } else if (r_type == R_X86_64_64 - && !ABI_64_P (output_bfd)) + && !ABI_64_P (info->output_bfd)) { relocate = true; outrel.r_info = htab->r_info (0, @@ -4138,7 +4135,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, (info, input_section, h, sym, relative_reloc_name, &outrel); - _bfd_elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (info->output_bfd, sreloc, &outrel); } /* If this reloc is against an external symbol, we do @@ -4218,7 +4215,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, leaq foo@tpoff(%rax), %rax nopw 0x0(%rax,%rax,1) */ int largepic = 0; - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) { if (roff + 5 >= input_section->size) goto corrupt_input; @@ -4261,7 +4258,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, if (roff + 8 + largepic >= input_section->size) goto corrupt_input; - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff + 8 + largepic); /* Skip R_X86_64_PC32, R_X86_64_PLT32, @@ -4288,13 +4285,13 @@ elf_x86_64_relocate_section (bfd *output_bfd, goto corrupt_input; type = bfd_get_8 (input_bfd, contents + roff - 3); val = bfd_get_8 (input_bfd, contents + roff - 1); - bfd_put_8 (output_bfd, + bfd_put_8 (info->output_bfd, (type & 0x48) | ((type >> 2) & 1), contents + roff - 3); - bfd_put_8 (output_bfd, 0xc7, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + bfd_put_8 (info->output_bfd, 0xc7, contents + roff - 2); + bfd_put_8 (info->output_bfd, 0xc0 | ((val >> 3) & 7), contents + roff - 1); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff); continue; @@ -4318,14 +4315,14 @@ elf_x86_64_relocate_section (bfd *output_bfd, val = bfd_get_8 (input_bfd, contents + roff - 1); /* Move the R bits to the B bits in REX2 payload byte. */ - bfd_put_8 (output_bfd, + bfd_put_8 (info->output_bfd, ((rex2 & ~rex2_mask) | (rex2 & rex2_mask) >> 2), contents + roff - 3); - bfd_put_8 (output_bfd, 0xc7, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + bfd_put_8 (info->output_bfd, 0xc7, contents + roff - 2); + bfd_put_8 (info->output_bfd, 0xc0 | ((val >> 3) & 7), contents + roff - 1); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff); continue; @@ -4352,17 +4349,17 @@ elf_x86_64_relocate_section (bfd *output_bfd, if (roff + 2 >= input_section->size) goto corrupt_input; - bfd_put_8 (output_bfd, 0x0f, contents + roff); - bfd_put_8 (output_bfd, 0x1f, contents + roff + 1); - bfd_put_8 (output_bfd, 0x00, contents + roff + 2); + bfd_put_8 (info->output_bfd, 0x0f, contents + roff); + bfd_put_8 (info->output_bfd, 0x1f, contents + roff + 1); + bfd_put_8 (info->output_bfd, 0x00, contents + roff + 2); } else { if (roff + 1 >= input_section->size) goto corrupt_input; - bfd_put_8 (output_bfd, 0x66, contents + roff); - bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + bfd_put_8 (info->output_bfd, 0x66, contents + roff); + bfd_put_8 (info->output_bfd, 0x90, contents + roff + 1); } continue; } @@ -4404,19 +4401,19 @@ elf_x86_64_relocate_section (bfd *output_bfd, { if (roff < 3) goto corrupt_input; - bfd_put_8 (output_bfd, 0x49, + bfd_put_8 (info->output_bfd, 0x49, contents + roff - 3); } - else if (!ABI_64_P (output_bfd) && val == 0x44) + else if (!ABI_64_P (info->output_bfd) && val == 0x44) { if (roff < 3) goto corrupt_input; - bfd_put_8 (output_bfd, 0x41, + bfd_put_8 (info->output_bfd, 0x41, contents + roff - 3); } - bfd_put_8 (output_bfd, 0xc7, + bfd_put_8 (info->output_bfd, 0xc7, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | reg, + bfd_put_8 (info->output_bfd, 0xc0 | reg, contents + roff - 1); } else if (reg == 4) @@ -4427,19 +4424,19 @@ elf_x86_64_relocate_section (bfd *output_bfd, { if (roff < 3) goto corrupt_input; - bfd_put_8 (output_bfd, 0x49, + bfd_put_8 (info->output_bfd, 0x49, contents + roff - 3); } - else if (!ABI_64_P (output_bfd) && val == 0x44) + else if (!ABI_64_P (info->output_bfd) && val == 0x44) { if (roff < 3) goto corrupt_input; - bfd_put_8 (output_bfd, 0x41, + bfd_put_8 (info->output_bfd, 0x41, contents + roff - 3); } - bfd_put_8 (output_bfd, 0x81, + bfd_put_8 (info->output_bfd, 0x81, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | reg, + bfd_put_8 (info->output_bfd, 0xc0 | reg, contents + roff - 1); } else @@ -4449,22 +4446,22 @@ elf_x86_64_relocate_section (bfd *output_bfd, { if (roff < 3) goto corrupt_input; - bfd_put_8 (output_bfd, 0x4d, + bfd_put_8 (info->output_bfd, 0x4d, contents + roff - 3); } - else if (!ABI_64_P (output_bfd) && val == 0x44) + else if (!ABI_64_P (info->output_bfd) && val == 0x44) { if (roff < 3) goto corrupt_input; - bfd_put_8 (output_bfd, 0x45, + bfd_put_8 (info->output_bfd, 0x45, contents + roff - 3); } - bfd_put_8 (output_bfd, 0x8d, + bfd_put_8 (info->output_bfd, 0x8d, contents + roff - 2); - bfd_put_8 (output_bfd, 0x80 | reg | (reg << 3), + bfd_put_8 (info->output_bfd, 0x80 | reg | (reg << 3), contents + roff - 1); } - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff); continue; @@ -4499,7 +4496,8 @@ elf_x86_64_relocate_section (bfd *output_bfd, /* For MOVRS emit meaningless CS prefixes. */ if (bfd_get_8 (input_bfd, contents + roff - 4) == 0x0f) { - bfd_put_8 (output_bfd, 0x2e, contents + roff - 4); + bfd_put_8 (info->output_bfd, 0x2e, + contents + roff - 4); rex2 = 0x2e; rex2_mask = 0; } @@ -4507,15 +4505,15 @@ elf_x86_64_relocate_section (bfd *output_bfd, } else type = 0x81; - bfd_put_8 (output_bfd, + bfd_put_8 (info->output_bfd, ((rex2 & ~rex2_mask) | (rex2 & rex2_mask) >> 2), contents + roff - 3); - bfd_put_8 (output_bfd, type, + bfd_put_8 (info->output_bfd, type, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | reg, + bfd_put_8 (info->output_bfd, 0xc0 | reg, contents + roff - 1); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff); continue; @@ -4540,13 +4538,13 @@ elf_x86_64_relocate_section (bfd *output_bfd, /* Replace 0f38 by meaningless CS prefixes, shifting the REX prefix forward. */ - bfd_put_8 (output_bfd, 0x2e, contents + roff - 5); - bfd_put_8 (output_bfd, 0x2e, contents + roff - 4); - bfd_put_8 (output_bfd, rex, contents + roff - 3); - bfd_put_8 (output_bfd, 0xc7, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | reg, contents + roff - 1); + bfd_put_8 (info->output_bfd, 0x2e, contents + roff - 5); + bfd_put_8 (info->output_bfd, 0x2e, contents + roff - 4); + bfd_put_8 (info->output_bfd, rex, contents + roff - 3); + bfd_put_8 (info->output_bfd, 0xc7, contents + roff - 2); + bfd_put_8 (info->output_bfd, 0xc0 | reg, contents + roff - 1); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff); continue; @@ -4590,23 +4588,24 @@ elf_x86_64_relocate_section (bfd *output_bfd, rex2 |= REX_W; - bfd_put_8 (output_bfd, 0x2e, contents + roff - 6); - bfd_put_8 (output_bfd, 0x2e, contents + roff - 5); - bfd_put_8 (output_bfd, 0xd5, contents + roff - 4); - bfd_put_8 (output_bfd, rex2, contents + roff - 3); - bfd_put_8 (output_bfd, 0xc7, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | reg, contents + roff - 1); - bfd_put_32 (output_bfd, + bfd_put_8 (info->output_bfd, 0x2e, contents + roff - 6); + bfd_put_8 (info->output_bfd, 0x2e, contents + roff - 5); + bfd_put_8 (info->output_bfd, 0xd5, contents + roff - 4); + bfd_put_8 (info->output_bfd, rex2, contents + roff - 3); + bfd_put_8 (info->output_bfd, 0xc7, contents + roff - 2); + bfd_put_8 (info->output_bfd, 0xc0 | reg, + contents + roff - 1); + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff); continue; } byte1 = evex_move_r_to_b (byte1, false); - bfd_put_8 (output_bfd, byte1, contents + roff - 5); - bfd_put_8 (output_bfd, 0x81, contents + roff - 2); - bfd_put_8 (output_bfd, 0xc0 | reg, contents + roff - 1); - bfd_put_32 (output_bfd, + bfd_put_8 (info->output_bfd, byte1, contents + roff - 5); + bfd_put_8 (info->output_bfd, 0x81, contents + roff - 2); + bfd_put_8 (info->output_bfd, 0xc0 | reg, contents + roff - 1); + bfd_put_32 (info->output_bfd, elf_x86_64_tpoff (info, relocation), contents + roff); continue; @@ -4659,7 +4658,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, outrel.r_addend = relocation - _bfd_x86_elf_dtpoff_base (info); else outrel.r_addend = 0; - _bfd_elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (info->output_bfd, sreloc, &outrel); } sreloc = htab->elf.srelgot; @@ -4674,32 +4673,32 @@ elf_x86_64_relocate_section (bfd *output_bfd, else dr_type = R_X86_64_TPOFF64; - bfd_put_64 (output_bfd, 0, htab->elf.sgot->contents + off); + bfd_put_64 (info->output_bfd, 0, htab->elf.sgot->contents + off); outrel.r_addend = 0; if ((dr_type == R_X86_64_TPOFF64 || dr_type == R_X86_64_TLSDESC) && indx == 0) outrel.r_addend = relocation - _bfd_x86_elf_dtpoff_base (info); outrel.r_info = htab->r_info (indx, dr_type); - _bfd_elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (info->output_bfd, sreloc, &outrel); if (GOT_TLS_GD_P (tls_type)) { if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - bfd_put_64 (output_bfd, + bfd_put_64 (info->output_bfd, relocation - _bfd_x86_elf_dtpoff_base (info), htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); } else { - bfd_put_64 (output_bfd, 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); outrel.r_info = htab->r_info (indx, R_X86_64_DTPOFF64); outrel.r_offset += GOT_ENTRY_SIZE; - _bfd_elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (info->output_bfd, sreloc, &outrel); } } @@ -4766,7 +4765,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, addq foo@gottpoff(%rax), %rax nopw 0x0(%rax,%rax,1) */ int largepic = 0; - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) { if (contents[roff + 5] == 0xb8) { @@ -4805,7 +4804,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, - input_section->output_section->vma - input_section->output_offset - 12); - bfd_put_32 (output_bfd, relocation, + bfd_put_32 (info->output_bfd, relocation, contents + roff + 8 + largepic); /* Skip R_X86_64_PLT32/R_X86_64_PLTOFF64. */ rel++; @@ -4833,9 +4832,9 @@ elf_x86_64_relocate_section (bfd *output_bfd, 0x8b. */ if (roff < 2) goto corrupt_input; - bfd_put_8 (output_bfd, 0x8b, contents + roff - 2); + bfd_put_8 (info->output_bfd, 0x8b, contents + roff - 2); - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off - rel->r_offset @@ -4866,14 +4865,14 @@ elf_x86_64_relocate_section (bfd *output_bfd, } if (prefix) { - bfd_put_8 (output_bfd, 0x0f, contents + roff); - bfd_put_8 (output_bfd, 0x1f, contents + roff + 1); - bfd_put_8 (output_bfd, 0x00, contents + roff + 2); + bfd_put_8 (info->output_bfd, 0x0f, contents + roff); + bfd_put_8 (info->output_bfd, 0x1f, contents + roff + 1); + bfd_put_8 (info->output_bfd, 0x00, contents + roff + 2); } else { - bfd_put_8 (output_bfd, 0x66, contents + roff); - bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + bfd_put_8 (info->output_bfd, 0x66, contents + roff); + bfd_put_8 (info->output_bfd, 0x90, contents + roff + 1); } continue; } @@ -4918,7 +4917,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, movq %fs:0, %eax */ BFD_ASSERT (r_type == R_X86_64_TPOFF32); - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) { if ((rel->r_offset + 5) >= input_section->size) goto corrupt_input; @@ -4996,13 +4995,14 @@ elf_x86_64_relocate_section (bfd *output_bfd, outrel.r_offset = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); - bfd_put_64 (output_bfd, 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgot->contents + off); - bfd_put_64 (output_bfd, 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); outrel.r_info = htab->r_info (0, R_X86_64_DTPMOD64); outrel.r_addend = 0; - _bfd_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + _bfd_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); htab->tls_ld_or_ldm_got.offset |= 1; } relocation = htab->elf.sgot->output_section->vma @@ -5039,7 +5039,7 @@ elf_x86_64_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) { switch (r_type) @@ -5140,8 +5140,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, dynamic sections here. */ static bool -elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elf_x86_64_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -5248,9 +5247,9 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, if ((plt_got_pcrel_offset + 0x80000000) > 0xffffffff) /* xgettext:c-format */ info->callbacks->fatal (_("%pB: PC-relative offset overflow in PLT entry for `%s'\n"), - output_bfd, h->root.root.string); + info->output_bfd, h->root.root.string); - bfd_put_32 (output_bfd, plt_got_pcrel_offset, + bfd_put_32 (info->output_bfd, plt_got_pcrel_offset, (resolved_plt->contents + plt_offset + htab->plt.plt_got_offset)); @@ -5261,10 +5260,10 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, if (!local_undefweak) { if (htab->plt.has_plt0) - bfd_put_64 (output_bfd, (plt->output_section->vma - + plt->output_offset - + h->plt.offset - + htab->lazy_plt->plt_lazy_offset), + bfd_put_64 (info->output_bfd, (plt->output_section->vma + + plt->output_offset + + h->plt.offset + + htab->lazy_plt->plt_lazy_offset), gotplt->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ @@ -5314,7 +5313,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, = h->plt.offset + htab->lazy_plt->plt_plt_insn_end; /* Put relocation index. */ - bfd_put_32 (output_bfd, plt_index, + bfd_put_32 (info->output_bfd, plt_index, (plt->contents + h->plt.offset + htab->lazy_plt->plt_reloc_offset)); @@ -5324,15 +5323,15 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, if (plt0_offset > 0x80000000) /* xgettext:c-format */ info->callbacks->fatal (_("%pB: branch displacement overflow in PLT entry for `%s'\n"), - output_bfd, h->root.root.string); - bfd_put_32 (output_bfd, - plt0_offset, + info->output_bfd, h->root.root.string); + bfd_put_32 (info->output_bfd, - plt0_offset, (plt->contents + h->plt.offset + htab->lazy_plt->plt_plt_offset)); } - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); loc = relplt->contents + plt_index * bed->s->sizeof_rela; - bed->s->swap_reloca_out (output_bfd, &rela, loc); + bed->s->swap_reloca_out (info->output_bfd, &rela, loc); } } else if (eh->plt_got.offset != (bfd_vma) -1) @@ -5377,9 +5376,9 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, || (!got_after_plt && got_pcrel_offset > 0)) /* xgettext:c-format */ info->callbacks->fatal (_("%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"), - output_bfd, h->root.root.string); + info->output_bfd, h->root.root.string); - bfd_put_32 (output_bfd, got_pcrel_offset, + bfd_put_32 (info->output_bfd, got_pcrel_offset, (plt->contents + plt_offset + htab->non_lazy_plt->plt_got_offset)); } @@ -5487,9 +5486,9 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt; plt_offset = h->plt.offset; } - bfd_put_64 (output_bfd, (plt->output_section->vma - + plt->output_offset - + plt_offset), + bfd_put_64 (info->output_bfd, (plt->output_section->vma + + plt->output_offset + + plt_offset), htab->elf.sgot->contents + h->got.offset); return true; } @@ -5515,7 +5514,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, { BFD_ASSERT((h->got.offset & 1) == 0); do_glob_dat: - bfd_put_64 (output_bfd, (bfd_vma) 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgot->contents + h->got.offset); rela.r_info = htab->r_info (h->dynindx, R_X86_64_GLOB_DAT); rela.r_addend = 0; @@ -5528,7 +5527,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, if (relgot == NULL || relgot->size == 0) { info->callbacks->fatal (_("%pB: Unable to generate dynamic relocs because a suitable section does not exist\n"), - output_bfd); + info->output_bfd); return false; } @@ -5537,7 +5536,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, _bfd_x86_elf_link_report_relative_reloc (info, relgot, h, sym, relative_reloc_name, &rela); - _bfd_elf_append_rela (output_bfd, relgot, &rela); + _bfd_elf_append_rela (info->output_bfd, relgot, &rela); } } @@ -5558,7 +5557,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, s = htab->elf.sreldynrelro; else s = htab->elf.srelbss; - _bfd_elf_append_rela (output_bfd, s, &rela); + _bfd_elf_append_rela (info->output_bfd, s, &rela); } return true; @@ -5575,8 +5574,7 @@ elf_x86_64_finish_local_dynamic_symbol (void **slot, void *inf) struct bfd_link_info *info = (struct bfd_link_info *) inf; - return elf_x86_64_finish_dynamic_symbol (info->output_bfd, - info, h, NULL); + return elf_x86_64_finish_dynamic_symbol (info, h, NULL); } /* Finish up undefined weak symbol handling in PIE. Fill its PLT entry @@ -5594,8 +5592,7 @@ elf_x86_64_pie_finish_undefweak_symbol (struct bfd_hash_entry *bh, || h->dynindx != -1) return true; - return elf_x86_64_finish_dynamic_symbol (info->output_bfd, - info, h, NULL); + return elf_x86_64_finish_dynamic_symbol (info, h, NULL); } /* Used to decide how to sort relocs in an optimal manner for the @@ -5650,13 +5647,12 @@ elf_x86_64_reloc_type_class (const struct bfd_link_info *info, /* Finish up the dynamic sections. */ static bool -elf_x86_64_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elf_x86_64_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf) { struct elf_x86_link_hash_table *htab; - htab = _bfd_x86_elf_finish_dynamic_sections (output_bfd, info, buf); + htab = _bfd_x86_elf_finish_dynamic_sections (info, buf); if (htab == NULL) return false; @@ -5685,7 +5681,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, htab->lazy_plt->plt0_entry_size); /* Add offset for pushq GOT+8(%rip), since the instruction uses 6 bytes subtract this value. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + 8 @@ -5697,7 +5693,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, /* Add offset for the PC-relative instruction accessing GOT+16, subtracting the offset to the end of that instruction. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + 16 @@ -5710,7 +5706,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, if (htab->elf.tlsdesc_plt) { - bfd_put_64 (output_bfd, (bfd_vma) 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgot->contents + htab->elf.tlsdesc_got); memcpy (htab->elf.splt->contents + htab->elf.tlsdesc_plt, @@ -5720,7 +5716,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, /* Add offset for pushq GOT+8(%rip), since ENDBR64 uses 4 bytes and the instruction uses 6 bytes, subtract these values. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + 8 @@ -5734,7 +5730,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, /* Add offset for indirect branch via GOT+TDG, where TDG stands for htab->tlsdesc_got, subtracting the offset to the end of that instruction. */ - bfd_put_32 (output_bfd, + bfd_put_32 (info->output_bfd, (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + htab->elf.tlsdesc_got @@ -5764,8 +5760,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, static bool elf_x86_64_output_arch_local_syms - (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, + (struct bfd_link_info *info, void *flaginfo ATTRIBUTE_UNUSED, int (*func) (void *, const char *, Elf_Internal_Sym *, diff --git a/bfd/elflink.c b/bfd/elflink.c index e35a105ac4c..502c8068847 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -705,8 +705,7 @@ bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info, this in case some dynamic object refers to this symbol. */ bool -bfd_elf_record_link_assignment (bfd *output_bfd, - struct bfd_link_info *info, +bfd_elf_record_link_assignment (struct bfd_link_info *info, const char *name, bool provide, bool hidden) @@ -767,7 +766,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd, case bfd_link_hash_indirect: /* We had a versioned symbol in a dynamic library. We make the the versioned symbol point to this one. */ - obed = get_elf_backend_data (output_bfd); + obed = get_elf_backend_data (info->output_bfd); hv = h; while (hv->root.type == bfd_link_hash_indirect || hv->root.type == bfd_link_hash_warning) @@ -807,7 +806,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd, if (hidden) { - obed = get_elf_backend_data (output_bfd); + obed = get_elf_backend_data (info->output_bfd); if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL) h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; obed->elf_backend_hide_symbol (info, h, true); @@ -991,8 +990,7 @@ elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h, /* Return true if the dynamic symbol for a given section should be omitted when creating a shared library. */ bool -_bfd_elf_omit_section_dynsym_default (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +_bfd_elf_omit_section_dynsym_default (struct bfd_link_info *info, asection *p) { struct elf_link_hash_table *htab; @@ -1021,10 +1019,8 @@ _bfd_elf_omit_section_dynsym_default (bfd *output_bfd ATTRIBUTE_UNUSED, } bool -_bfd_elf_omit_section_dynsym_all - (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, - asection *p ATTRIBUTE_UNUSED) +_bfd_elf_omit_section_dynsym_all (struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *p ATTRIBUTE_UNUSED) { return true; } @@ -1039,8 +1035,7 @@ _bfd_elf_omit_section_dynsym_all that are stripped.) */ static unsigned long -_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_elf_link_renumber_dynsyms (struct bfd_link_info *info, unsigned long *section_sym_count) { unsigned long dynsymcount = 0; @@ -1049,13 +1044,13 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, if (bfd_link_pic (info) || elf_hash_table (info)->is_relocatable_executable) { - elf_backend_data *obed = get_elf_backend_data (output_bfd); + elf_backend_data *obed = get_elf_backend_data (info->output_bfd); asection *p; - for (p = output_bfd->sections; p ; p = p->next) + for (p = info->output_bfd->sections; p ; p = p->next) if ((p->flags & SEC_EXCLUDE) == 0 && (p->flags & SEC_ALLOC) != 0 && elf_hash_table (info)->dynamic_relocs - && !obed->elf_backend_omit_section_dynsym (output_bfd, info, p)) + && !obed->elf_backend_omit_section_dynsym (info, p)) { ++dynsymcount; if (do_sec) @@ -3640,12 +3635,12 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, aligned. Returns the first TLS output section. */ struct bfd_section * -bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) +bfd_elf_tls_setup (struct bfd_link_info *info) { struct bfd_section *sec, *tls; unsigned int align = 0; - for (sec = obfd->sections; sec != NULL; sec = sec->next) + for (sec = info->output_bfd->sections; sec != NULL; sec = sec->next) if ((sec->flags & SEC_THREAD_LOCAL) != 0) break; tls = sec; @@ -6848,8 +6843,7 @@ bfd_elf_size_group_sections (struct bfd_link_info *info) undefined it is initialized. */ bool -bfd_elf_stack_segment_size (bfd *output_bfd, - struct bfd_link_info *info, +bfd_elf_stack_segment_size (struct bfd_link_info *info, const char *legacy_symbol, bfd_vma default_size) { @@ -6869,11 +6863,11 @@ bfd_elf_stack_segment_size (bfd *output_bfd, if (info->stacksize) /* xgettext:c-format */ _bfd_error_handler (_("%pB: stack size specified and %s set"), - output_bfd, legacy_symbol); + info->output_bfd, legacy_symbol); else if (h->root.u.def.section != bfd_abs_section_ptr) /* xgettext:c-format */ _bfd_error_handler (_("%pB: %s not absolute"), - output_bfd, legacy_symbol); + info->output_bfd, legacy_symbol); else info->stacksize = h->root.u.def.value; } @@ -6890,10 +6884,11 @@ bfd_elf_stack_segment_size (bfd *output_bfd, struct bfd_link_hash_entry *bh = NULL; if (!(_bfd_generic_link_add_one_symbol - (info, output_bfd, legacy_symbol, + (info, info->output_bfd, legacy_symbol, BSF_GLOBAL, bfd_abs_section_ptr, info->stacksize >= 0 ? info->stacksize : 0, - NULL, false, get_elf_backend_data (output_bfd)->collect, &bh))) + NULL, false, get_elf_backend_data (info->output_bfd)->collect, + &bh))) return false; h = (struct elf_link_hash_entry *) bh; @@ -6942,14 +6937,13 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data) addresses of the various sections. */ bool -bfd_elf_size_dynamic_sections (bfd *output_bfd, +bfd_elf_size_dynamic_sections (struct bfd_link_info *info, const char *soname, const char *rpath, const char *filter_shlib, const char *audit, const char *depaudit, const char * const *auxiliary_filters, - struct bfd_link_info *info, asection **sinterpptr) { bfd *dynobj; @@ -6967,12 +6961,12 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, elf_hash_table (info)->init_plt_refcount = elf_hash_table (info)->init_plt_offset; - obed = get_elf_backend_data (output_bfd); + obed = get_elf_backend_data (info->output_bfd); /* The backend may have to create some sections regardless of whether we're dynamic or not. */ if (obed->elf_backend_early_size_sections - && !obed->elf_backend_early_size_sections (output_bfd, info)) + && !obed->elf_backend_early_size_sections (info)) return false; dynobj = elf_hash_table (info)->dynobj; @@ -7023,7 +7017,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, char *newname, *p, leading_char; struct elf_link_hash_entry *newh; - leading_char = bfd_get_symbol_leading_char (output_bfd); + leading_char = bfd_get_symbol_leading_char (info->output_bfd); name = d->pattern; namelen = strlen (name) + (leading_char != '\0'); verstr = t->name; @@ -7153,7 +7147,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, } s->size = size; - s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size); + s->contents = bfd_alloc (info->output_bfd, s->size); if (s->contents == NULL && s->size != 0) return false; s->alloced = 1; @@ -7190,7 +7184,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, { size_t indx; - name = lbasename (bfd_get_filename (output_bfd)); + name = lbasename (bfd_get_filename (info->output_bfd)); def.vd_hash = bfd_elf_hash (name); indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, name, false); @@ -7200,7 +7194,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, } defaux.vda_next = 0; - _bfd_elf_swap_verdef_out (output_bfd, &def, + _bfd_elf_swap_verdef_out (info->output_bfd, &def, (Elf_External_Verdef *) p); p += sizeof (Elf_External_Verdef); if (info->create_default_symver) @@ -7231,11 +7225,11 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, + sizeof (Elf_External_Verdaux)); else def.vd_next = 0; - _bfd_elf_swap_verdef_out (output_bfd, &def, + _bfd_elf_swap_verdef_out (info->output_bfd, &def, (Elf_External_Verdef *) p); p += sizeof (Elf_External_Verdef); } - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, + _bfd_elf_swap_verdaux_out (info->output_bfd, &defaux, (Elf_External_Verdaux *) p); p += sizeof (Elf_External_Verdaux); @@ -7289,7 +7283,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, def.vd_next = (sizeof (Elf_External_Verdef) + (cdeps + 1) * sizeof (Elf_External_Verdaux)); - _bfd_elf_swap_verdef_out (output_bfd, &def, + _bfd_elf_swap_verdef_out (info->output_bfd, &def, (Elf_External_Verdef *) p); p += sizeof (Elf_External_Verdef); @@ -7301,7 +7295,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, defaux.vda_next = sizeof (Elf_External_Verdaux); t->name_indx = defaux.vda_name; - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, + _bfd_elf_swap_verdaux_out (info->output_bfd, &defaux, (Elf_External_Verdaux *) p); p += sizeof (Elf_External_Verdaux); @@ -7324,13 +7318,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, else defaux.vda_next = sizeof (Elf_External_Verdaux); - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, + _bfd_elf_swap_verdaux_out (info->output_bfd, &defaux, (Elf_External_Verdaux *) p); p += sizeof (Elf_External_Verdaux); } } - elf_tdata (output_bfd)->cverdefs = cdefs; + elf_tdata (info->output_bfd)->cverdefs = cdefs; } } @@ -7357,7 +7351,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, BFD_ASSERT (s != NULL); sinfo.info = info; - sinfo.vers = elf_tdata (output_bfd)->cverdefs; + sinfo.vers = elf_tdata (info->output_bfd)->cverdefs; if (sinfo.vers == 0) sinfo.vers = 1; sinfo.failed = false; @@ -7372,7 +7366,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, if (sinfo.failed) return false; - if (elf_tdata (output_bfd)->verref == NULL) + if (elf_tdata (info->output_bfd)->verref == NULL) s->flags |= SEC_EXCLUDE; else { @@ -7384,7 +7378,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, /* Build the version dependency section. */ size = 0; crefs = 0; - for (vn = elf_tdata (output_bfd)->verref; + for (vn = elf_tdata (info->output_bfd)->verref; vn != NULL; vn = vn->vn_nextref) { @@ -7397,13 +7391,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, } s->size = size; - s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size); + s->contents = bfd_alloc (info->output_bfd, s->size); if (s->contents == NULL) return false; s->alloced = 1; p = s->contents; - for (vn = elf_tdata (output_bfd)->verref; + for (vn = elf_tdata (info->output_bfd)->verref; vn != NULL; vn = vn->vn_nextref) { @@ -7433,7 +7427,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, vn->vn_next = (sizeof (Elf_External_Verneed) + caux * sizeof (Elf_External_Vernaux)); - _bfd_elf_swap_verneed_out (output_bfd, vn, + _bfd_elf_swap_verneed_out (info->output_bfd, vn, (Elf_External_Verneed *) p); p += sizeof (Elf_External_Verneed); @@ -7450,13 +7444,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, else a->vna_next = sizeof (Elf_External_Vernaux); - _bfd_elf_swap_vernaux_out (output_bfd, a, + _bfd_elf_swap_vernaux_out (info->output_bfd, a, (Elf_External_Vernaux *) p); p += sizeof (Elf_External_Vernaux); } } - elf_tdata (output_bfd)->cverrefs = crefs; + elf_tdata (info->output_bfd)->cverrefs = crefs; } } @@ -7485,10 +7479,10 @@ error: creating an executable stack because of -z execstack command line option" warning: enabling an executable stack because of -z execstack command line option")); } - elf_stack_flags (output_bfd) = PF_R | PF_W | PF_X; + elf_stack_flags (info->output_bfd) = PF_R | PF_W | PF_X; } else if (info->noexecstack) - elf_stack_flags (output_bfd) = PF_R | PF_W; + elf_stack_flags (info->output_bfd) = PF_R | PF_W; else { bfd *inputobj; @@ -7571,7 +7565,7 @@ NOTE: This behaviour is deprecated and will be removed in a future version of th } } } - elf_stack_flags (output_bfd) = PF_R | PF_W | exec; + elf_stack_flags (info->output_bfd) = PF_R | PF_W | exec; } if (notesec && exec && bfd_link_relocatable (info) @@ -7702,7 +7696,7 @@ NOTE: This behaviour is deprecated and will be removed in a future version of th return false; } - s = bfd_get_section_by_name (output_bfd, ".preinit_array"); + s = bfd_get_section_by_name (info->output_bfd, ".preinit_array"); if (s != NULL && s->linker_has_input) { /* DT_PREINIT_ARRAY is not allowed in shared library. */ @@ -7733,14 +7727,14 @@ NOTE: This behaviour is deprecated and will be removed in a future version of th || !_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0)) return false; } - s = bfd_get_section_by_name (output_bfd, ".init_array"); + s = bfd_get_section_by_name (info->output_bfd, ".init_array"); if (s != NULL && s->linker_has_input) { if (!_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAY, 0) || !_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAYSZ, 0)) return false; } - s = bfd_get_section_by_name (output_bfd, ".fini_array"); + s = bfd_get_section_by_name (info->output_bfd, ".fini_array"); if (s != NULL && s->linker_has_input) { if (!_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0) @@ -7781,14 +7775,14 @@ NOTE: This behaviour is deprecated and will be removed in a future version of th /* The backend must work out the sizes of all the other dynamic sections. */ if (obed->elf_backend_late_size_sections != NULL - && !obed->elf_backend_late_size_sections (output_bfd, info)) + && !obed->elf_backend_late_size_sections (info)) return false; if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created) { - if (elf_tdata (output_bfd)->cverdefs) + if (elf_tdata (info->output_bfd)->cverdefs) { - unsigned int crefs = elf_tdata (output_bfd)->cverdefs; + unsigned int crefs = elf_tdata (info->output_bfd)->cverdefs; if (!_bfd_elf_add_dynamic_entry (info, DT_VERDEF, 0) || !_bfd_elf_add_dynamic_entry (info, DT_VERDEFNUM, crefs)) @@ -7816,18 +7810,18 @@ NOTE: This behaviour is deprecated and will be removed in a future version of th return false; } - if (elf_tdata (output_bfd)->cverrefs) + if (elf_tdata (info->output_bfd)->cverrefs) { - unsigned int crefs = elf_tdata (output_bfd)->cverrefs; + unsigned int crefs = elf_tdata (info->output_bfd)->cverrefs; if (!_bfd_elf_add_dynamic_entry (info, DT_VERNEED, 0) || !_bfd_elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs)) return false; } - if ((elf_tdata (output_bfd)->cverrefs == 0 - && elf_tdata (output_bfd)->cverdefs == 0) - || _bfd_elf_link_renumber_dynsyms (output_bfd, info, NULL) <= 1) + if ((elf_tdata (info->output_bfd)->cverrefs == 0 + && elf_tdata (info->output_bfd)->cverdefs == 0) + || _bfd_elf_link_renumber_dynsyms (info, NULL) <= 1) { asection *s; @@ -7841,14 +7835,14 @@ NOTE: This behaviour is deprecated and will be removed in a future version of th /* Find the first non-excluded output section. We'll use its section symbol for some emitted relocs. */ void -_bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info) +_bfd_elf_init_1_index_section (struct bfd_link_info *info) { asection *s; asection *found = NULL; - for (s = output_bfd->sections; s != NULL; s = s->next) + for (s = info->output_bfd->sections; s != NULL; s = s->next) if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC - && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s)) + && !_bfd_elf_omit_section_dynsym_default (info, s)) { found = s; if ((s->flags & SEC_THREAD_LOCAL) == 0) @@ -7860,17 +7854,17 @@ _bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info) /* Find two non-excluded output sections, one for code, one for data. We'll use their section symbols for some emitted relocs. */ void -_bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info) +_bfd_elf_init_2_index_sections (struct bfd_link_info *info) { asection *s; asection *found = NULL; /* Data first, since setting text_index_section changes _bfd_elf_omit_section_dynsym_default. */ - for (s = output_bfd->sections; s != NULL; s = s->next) + for (s = info->output_bfd->sections; s != NULL; s = s->next) if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC && !(s->flags & SEC_READONLY) - && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s)) + && !_bfd_elf_omit_section_dynsym_default (info, s)) { found = s; if ((s->flags & SEC_THREAD_LOCAL) == 0) @@ -7878,10 +7872,10 @@ _bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info) } elf_hash_table (info)->data_index_section = found; - for (s = output_bfd->sections; s != NULL; s = s->next) + for (s = info->output_bfd->sections; s != NULL; s = s->next) if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC && (s->flags & SEC_READONLY) - && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s)) + && !_bfd_elf_omit_section_dynsym_default (info, s)) { found = s; break; @@ -7889,11 +7883,16 @@ _bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info) elf_hash_table (info)->text_index_section = found; } +void +_bfd_elf_init_0_index_sections (struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ +} + #define GNU_HASH_SECTION_NAME(bed) \ (bed)->record_xhash_symbol != NULL ? ".MIPS.xhash" : ".gnu.hash" bool -bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) +bfd_elf_size_dynsym_hash_dynstr (struct bfd_link_info *info) { elf_backend_data *obed; unsigned long section_sym_count; @@ -7902,8 +7901,8 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) if (!is_elf_hash_table (info->hash)) return true; - obed = get_elf_backend_data (output_bfd); - obed->elf_backend_init_index_section (output_bfd, info); + obed = get_elf_backend_data (info->output_bfd); + obed->elf_backend_init_index_section (info); /* Assign dynsym indices. In a shared library we generate a section symbol for each output section, which come first. Next come all @@ -7918,8 +7917,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) if (elf_hash_table (info)->dynamic_sections_created || obed->always_renumber_dynsyms) - dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info, - §ion_sym_count); + dynsymcount = _bfd_elf_link_renumber_dynsyms (info, §ion_sym_count); if (elf_hash_table (info)->dynamic_sections_created) { @@ -7935,7 +7933,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) if ((s->flags & SEC_EXCLUDE) == 0) { s->size = dynsymcount * sizeof (Elf_External_Versym); - s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size); + s->contents = (unsigned char *) bfd_zalloc (info->output_bfd, s->size); if (s->contents == NULL) return false; s->alloced = 1; @@ -7954,7 +7952,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) BFD_ASSERT (s != NULL); s->size = dynsymcount * obed->s->sizeof_sym; - s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size); + s->contents = bfd_alloc (info->output_bfd, s->size); if (s->contents == NULL) return false; s->alloced = 1; @@ -8010,13 +8008,14 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) BFD_ASSERT (s != NULL); hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize; s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size); - s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size); + s->contents = bfd_zalloc (info->output_bfd, s->size); if (s->contents == NULL) return false; s->alloced = 1; - bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents); - bfd_put (8 * hash_entry_size, output_bfd, dynsymcount, + bfd_put (8 * hash_entry_size, info->output_bfd, bucketcount, + s->contents); + bfd_put (8 * hash_entry_size, info->output_bfd, dynsymcount, s->contents + hash_entry_size); } @@ -8040,7 +8039,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) cinfo.hashval = cinfo.hashcodes + dynsymcount; cinfo.min_dynindx = -1; - cinfo.output_bfd = output_bfd; + cinfo.output_bfd = info->output_bfd; cinfo.bed = obed; /* Put all hash values in HASHCODES. */ @@ -8070,23 +8069,23 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) BFD_ASSERT (cinfo.min_dynindx == -1); free (cinfo.hashcodes); s->size = 5 * 4 + obed->s->arch_size / 8; - contents = (unsigned char *) bfd_zalloc (output_bfd, s->size); + contents = bfd_zalloc (info->output_bfd, s->size); if (contents == NULL) return false; s->contents = contents; s->alloced = 1; /* 1 empty bucket. */ - bfd_put_32 (output_bfd, 1, contents); + bfd_put_32 (info->output_bfd, 1, contents); /* SYMIDX above the special symbol 0. */ - bfd_put_32 (output_bfd, 1, contents + 4); + bfd_put_32 (info->output_bfd, 1, contents + 4); /* Just one word for bitmask. */ - bfd_put_32 (output_bfd, 1, contents + 8); + bfd_put_32 (info->output_bfd, 1, contents + 8); /* Only hash fn bloom filter. */ - bfd_put_32 (output_bfd, 0, contents + 12); + bfd_put_32 (info->output_bfd, 0, contents + 12); /* No hashes are valid - empty bitmask. */ - bfd_put (obed->s->arch_size, output_bfd, 0, contents + 16); + bfd_put (obed->s->arch_size, info->output_bfd, 0, contents + 16); /* No hashes in the only bucket. */ - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, contents + 16 + obed->s->arch_size / 8); } else @@ -8149,7 +8148,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) s->size += cinfo.maskbits / 8; if (obed->record_xhash_symbol != NULL) s->size += cinfo.nsyms * 4; - contents = (unsigned char *) bfd_zalloc (output_bfd, s->size); + contents = bfd_zalloc (info->output_bfd, s->size); if (contents == NULL) { free (cinfo.bitmask); @@ -8159,18 +8158,18 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) s->contents = contents; s->alloced = 1; - bfd_put_32 (output_bfd, bucketcount, contents); - bfd_put_32 (output_bfd, cinfo.symindx, contents + 4); - bfd_put_32 (output_bfd, maskwords, contents + 8); - bfd_put_32 (output_bfd, cinfo.shift2, contents + 12); + bfd_put_32 (info->output_bfd, bucketcount, contents); + bfd_put_32 (info->output_bfd, cinfo.symindx, contents + 4); + bfd_put_32 (info->output_bfd, maskwords, contents + 8); + bfd_put_32 (info->output_bfd, cinfo.shift2, contents + 12); contents += 16 + cinfo.maskbits / 8; for (i = 0; i < bucketcount; ++i) { if (cinfo.counts[i] == 0) - bfd_put_32 (output_bfd, 0, contents); + bfd_put_32 (info->output_bfd, 0, contents); else - bfd_put_32 (output_bfd, cinfo.indx[i], contents); + bfd_put_32 (info->output_bfd, cinfo.indx[i], contents); contents += 4; } @@ -8200,8 +8199,8 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) contents = s->contents + 16; for (i = 0; i < maskwords; ++i) { - bfd_put (obed->s->arch_size, output_bfd, cinfo.bitmask[i], - contents); + bfd_put (obed->s->arch_size, info->output_bfd, + cinfo.bitmask[i], contents); contents += obed->s->arch_size / 8; } @@ -8213,7 +8212,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) s = bfd_get_linker_section (dynobj, ".dynstr"); BFD_ASSERT (s != NULL); - elf_finalize_dynstr (output_bfd, info); + elf_finalize_dynstr (info->output_bfd, info); s->size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr); @@ -8513,8 +8512,7 @@ bfd_elf_set_dyn_lib_class (bfd *abfd, enum dynamic_lib_link_class lib_class) the linker ELF emulation code. */ struct bfd_link_needed_list * -bfd_elf_get_needed_list (bfd *obfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +bfd_elf_get_needed_list (struct bfd_link_info *info) { if (! is_elf_hash_table (info->hash)) return NULL; @@ -8525,8 +8523,7 @@ bfd_elf_get_needed_list (bfd *obfd ATTRIBUTE_UNUSED, hook for the linker ELF emulation code. */ struct bfd_link_needed_list * -bfd_elf_get_runpath_list (bfd *obfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +bfd_elf_get_runpath_list (struct bfd_link_info *info) { if (! is_elf_hash_table (info->hash)) return NULL; @@ -11045,8 +11042,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data) && elf_hash_table (flinfo->info)->dynamic_sections_created)) && bed->elf_backend_finish_dynamic_symbol != NULL) { - if (!bed->elf_backend_finish_dynamic_symbol (flinfo->output_bfd, - flinfo->info, h, &sym)) + if (!bed->elf_backend_finish_dynamic_symbol (flinfo->info, h, &sym)) { eoinfo->failed = true; return false; @@ -11404,7 +11400,7 @@ static bool elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) { int (*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 **); bfd *output_bfd; Elf_Internal_Shdr *symtab_hdr; @@ -11964,11 +11960,11 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) corresponding to the output section, which will require the addend to be adjusted. */ - ret = (*relocate_section) (output_bfd, flinfo->info, - input_bfd, o, contents, - internal_relocs, - isymbuf, - flinfo->sections); + ret = relocate_section (flinfo->info, + input_bfd, o, contents, + internal_relocs, + isymbuf, + flinfo->sections); if (!ret) return false; @@ -12573,10 +12569,9 @@ elf_output_implib (bfd *obfd, struct bfd_link_info *info) /* Filter symbols to appear in the import library. */ if (obed->elf_backend_filter_implib_symbols) - symcount = obed->elf_backend_filter_implib_symbols (obfd, info, sympp, - symcount); + symcount = obed->elf_backend_filter_implib_symbols (info, sympp, symcount); else - symcount = _bfd_elf_filter_global_symbols (obfd, info, sympp, symcount); + symcount = _bfd_elf_filter_global_symbols (info, sympp, symcount); if (symcount == 0) { bfd_set_error (bfd_error_no_symbols); @@ -13320,7 +13315,7 @@ _bfd_elf_final_link (bfd *obfd, struct bfd_link_info *info) table, do it now. */ if (obed->elf_backend_output_arch_local_syms) { - if (!obed->elf_backend_output_arch_local_syms (obfd, info, &flinfo, + if (!obed->elf_backend_output_arch_local_syms (info, &flinfo, elf_link_output_symstrtab)) goto error_return; } @@ -13448,7 +13443,7 @@ _bfd_elf_final_link (bfd *obfd, struct bfd_link_info *info) if (obed->elf_backend_output_arch_syms && (info->strip != strip_all || emit_relocs)) { - if (!obed->elf_backend_output_arch_syms (obfd, info, &flinfo, + if (!obed->elf_backend_output_arch_syms (info, &flinfo, elf_link_output_symstrtab)) goto error_return; } @@ -13788,8 +13783,7 @@ _bfd_elf_final_link (bfd *obfd, struct bfd_link_info *info) /* If we have created any dynamic sections, then output them. */ if (dynobj != NULL) { - if (!obed->elf_backend_finish_dynamic_sections (obfd, info, - flinfo.contents)) + if (!obed->elf_backend_finish_dynamic_sections (info, flinfo.contents)) goto error_return; /* Check for DT_TEXTREL (late, in case the backend removes it). */ @@ -14651,8 +14645,7 @@ _bfd_elf_gc_keep (struct bfd_link_info *info) } bool -bfd_elf_parse_eh_frame_entries (bfd *obfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +bfd_elf_parse_eh_frame_entries (struct bfd_link_info *info) { bfd *ibfd = info->input_bfds; @@ -15068,7 +15061,7 @@ elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg) if (h->got.refcount > 0) { h->got.offset = gofarg->gotoff; - gofarg->gotoff += obed->got_elt_size (obfd, gofarg->info, h, NULL, 0); + gofarg->gotoff += obed->got_elt_size (gofarg->info, h, NULL, 0); } else h->got.offset = (bfd_vma) -1; @@ -15079,7 +15072,7 @@ elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg) /* And an accompanying bit to work out final got entry offsets once we're done. Should be called from final_link. */ -bool +static bool bfd_elf_gc_common_finalize_got_offsets (bfd *obfd, struct bfd_link_info *info) { @@ -15125,7 +15118,7 @@ bfd_elf_gc_common_finalize_got_offsets (bfd *obfd, if (local_got[j] > 0) { local_got[j] = gotoff; - gotoff += obed->got_elt_size (obfd, info, NULL, i, j); + gotoff += obed->got_elt_size (info, NULL, i, j); } else local_got[j] = (bfd_vma) -1; @@ -15217,7 +15210,7 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie) sorted order, which is true for all known assemblers. */ int -bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) +bfd_elf_discard_info (struct bfd_link_info *info) { struct elf_reloc_cookie cookie; asection *o; @@ -15228,7 +15221,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) || !is_elf_hash_table (info->hash)) return 0; - o = bfd_get_section_by_name (output_bfd, ".stab"); + o = bfd_get_section_by_name (info->output_bfd, ".stab"); if (o != NULL) { asection *i; @@ -15258,7 +15251,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) o = NULL; if (info->eh_frame_hdr_type != COMPACT_EH_HDR) - o = bfd_get_section_by_name (output_bfd, ".eh_frame"); + o = bfd_get_section_by_name (info->output_bfd, ".eh_frame"); if (o != NULL) { asection *i; @@ -15294,7 +15287,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) } eh_alignment = ((1 << o->alignment_power) - * bfd_octets_per_byte (output_bfd, o)); + * bfd_octets_per_byte (info->output_bfd, o)); /* Skip over zero terminator, and prevent empty sections from adding alignment padding at the end. */ for (i = o->map_tail.s; i != NULL; i = i->map_tail.s) @@ -15328,7 +15321,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) _bfd_elf_adjust_eh_frame_global_symbol, NULL); } - o = bfd_get_section_by_name (output_bfd, ".sframe"); + o = bfd_get_section_by_name (info->output_bfd, ".sframe"); if (o != NULL) { asection *i; @@ -15359,7 +15352,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) } /* Update the reference to the output .sframe section. Used to determine later if PT_GNU_SFRAME segment is to be generated. */ - if (!_bfd_elf_set_section_sframe (output_bfd, info)) + if (!_bfd_elf_set_section_sframe (info->output_bfd, info)) return -1; } @@ -15565,13 +15558,12 @@ _bfd_elf_common_section (asection *sec ATTRIBUTE_UNUSED) } bfd_vma -_bfd_elf_default_got_elt_size (bfd *obfd, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +_bfd_elf_default_got_elt_size (struct bfd_link_info *info, struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, bfd *ibfd ATTRIBUTE_UNUSED, unsigned long symndx ATTRIBUTE_UNUSED) { - elf_backend_data *obed = get_elf_backend_data (obfd); + elf_backend_data *obed = get_elf_backend_data (info->output_bfd); return obed->s->arch_size / 8; } @@ -15793,8 +15785,7 @@ _bfd_elf_maybe_set_textrel (struct elf_link_hash_entry *h, void *inf) /* Add dynamic tags. */ bool -_bfd_elf_add_dynamic_tags (bfd *output_bfd, struct bfd_link_info *info, - bool need_dynamic_reloc) +_bfd_elf_add_dynamic_tags (struct bfd_link_info *info, bool need_dynamic_reloc) { struct elf_link_hash_table *htab = elf_hash_table (info); @@ -15808,7 +15799,7 @@ _bfd_elf_add_dynamic_tags (bfd *output_bfd, struct bfd_link_info *info, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - elf_backend_data *obed = get_elf_backend_data (output_bfd); + elf_backend_data *obed = get_elf_backend_data (info->output_bfd); if (bfd_link_executable (info)) { diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 6c004dbceb7..96da6d790d9 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -7033,8 +7033,7 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals, /* Relocate an AArch64 ELF section. */ static int -elfNN_aarch64_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_aarch64_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -7112,7 +7111,8 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, (input_bfd, symtab_hdr->sh_link, sym->st_name), input_bfd, input_section, rel->r_offset, true); - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); /* Relocate against local STT_GNU_IFUNC symbol. */ if (!bfd_link_relocatable (info) @@ -7208,7 +7208,8 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, save_addend = false; if (r == bfd_reloc_continue) - r = elfNN_aarch64_final_link_relocate (howto, input_bfd, output_bfd, + r = elfNN_aarch64_final_link_relocate (howto, input_bfd, + info->output_bfd, input_section, contents, rel, relocation, info, sec, h, &unresolved_reloc, @@ -7254,7 +7255,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, loc = globals->root.srelgot->contents; loc += globals->root.srelgot->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); bfd_reloc_code_real_type real_type = elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type); @@ -7266,13 +7267,13 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, /* For local dynamic, don't generate DTPREL in any case. Initialize the DTPREL slot into zero, so we get module base address when invoke runtime TLS resolver. */ - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, globals->root.sgot->contents + off + GOT_ENTRY_SIZE); } else if (indx == 0) { - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, relocation - dtpoff_base (info), globals->root.sgot->contents + off + GOT_ENTRY_SIZE); @@ -7293,17 +7294,17 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, loc = globals->root.srelgot->contents; loc += globals->root.srelgot->reloc_count++ * RELOC_SIZE (globals); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); + bfd_put_NN (info->output_bfd, (bfd_vma) 0, globals->root.sgot->contents + off + GOT_ENTRY_SIZE); } } else { - bfd_put_NN (output_bfd, (bfd_vma) 1, + bfd_put_NN (info->output_bfd, 1, globals->root.sgot->contents + off); - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, relocation - dtpoff_base (info), globals->root.sgot->contents + off + GOT_ENTRY_SIZE); @@ -7354,13 +7355,13 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, loc += globals->root.srelgot->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); - bfd_put_NN (output_bfd, rela.r_addend, + bfd_put_NN (info->output_bfd, rela.r_addend, globals->root.sgot->contents + off); } else - bfd_put_NN (output_bfd, relocation - tpoff_base (info), + bfd_put_NN (info->output_bfd, relocation - tpoff_base (info), globals->root.sgot->contents + off); symbol_got_offset_mark (input_bfd, h, r_symndx); @@ -7413,12 +7414,12 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, loc += globals->root.srelplt->reloc_count++ * RELOC_SIZE (globals); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_put_NN (info->output_bfd, (bfd_vma) 0, globals->root.sgotplt->contents + off + globals->sgotplt_jump_table_size); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_put_NN (info->output_bfd, (bfd_vma) 0, globals->root.sgotplt->contents + off + globals->sgotplt_jump_table_size + GOT_ENTRY_SIZE); @@ -7437,7 +7438,7 @@ elfNN_aarch64_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 @@ -8707,8 +8708,7 @@ aarch64_map_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) /* Output mapping symbols for linker generated sections. */ static bool -elfNN_aarch64_output_arch_local_syms (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_aarch64_output_arch_local_syms (struct bfd_link_info *info, void *finfo, int (*func) (void *, const char *, Elf_Internal_Sym *, @@ -8745,7 +8745,7 @@ elfNN_aarch64_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); /* The first instruction in a stub is always a branch. */ if (!elfNN_aarch64_output_map_sym (&osi, AARCH64_MAP_INSN, 0)) @@ -8761,7 +8761,7 @@ elfNN_aarch64_output_arch_local_syms (bfd *output_bfd, return true; osi.sec_shndx = _bfd_elf_section_from_bfd_section - (output_bfd, htab->root.splt->output_section); + (info->output_bfd, htab->root.splt->output_section); osi.sec = htab->root.splt; elfNN_aarch64_output_map_sym (&osi, AARCH64_MAP_INSN, 0); @@ -9550,8 +9550,7 @@ elfNN_aarch64_finish_relative_relocs (struct bfd_link_info *info) though ! */ static bool -elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elfNN_aarch64_late_size_sections (struct bfd_link_info *info) { struct elf_aarch64_link_hash_table *htab; bfd *dynobj; @@ -9839,7 +9838,7 @@ elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (!_bfd_elf_add_dynamic_tags (output_bfd, info, relocs)) + if (!_bfd_elf_add_dynamic_tags (info, relocs)) return false; if (htab->root.splt->size != 0) @@ -9849,7 +9848,7 @@ elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return false; aarch64_plt_type plt_type - = elf_aarch64_tdata (output_bfd)->sw_protections.plt_type; + = elf_aarch64_tdata (info->output_bfd)->sw_protections.plt_type; if (plt_type == PLT_BTI_PAC && (!add_dynamic_entry (DT_AARCH64_BTI_PLT, 0) || !add_dynamic_entry (DT_AARCH64_PAC_PLT, 0))) @@ -9864,13 +9863,13 @@ elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return false; } - if (is_aarch64_elf (output_bfd) + if (is_aarch64_elf (info->output_bfd) && htab->memtag_opts.memtag_mode != AARCH64_MEMTAG_MODE_NONE && !add_dynamic_entry (DT_AARCH64_MEMTAG_MODE, htab->memtag_opts.memtag_mode == AARCH64_MEMTAG_MODE_ASYNC)) return false; - if (is_aarch64_elf (output_bfd) + if (is_aarch64_elf (info->output_bfd) && htab->memtag_opts.memtag_stack == 1 && !add_dynamic_entry (DT_AARCH64_MEMTAG_STACK, htab->memtag_opts.memtag_stack == 1)) @@ -10013,8 +10012,7 @@ elfNN_aarch64_create_small_pltn_entry (struct elf_link_hash_entry *h, _TLS_MODULE_BASE_, if needed. */ static bool -elfNN_aarch64_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +elfNN_aarch64_early_size_sections (struct bfd_link_info *info) { asection *tls_sec; @@ -10033,10 +10031,10 @@ elfNN_aarch64_early_size_sections (bfd *output_bfd, if (tlsbase) { struct bfd_link_hash_entry *h = 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, &h))) return false; @@ -10055,8 +10053,7 @@ elfNN_aarch64_early_size_sections (bfd *output_bfd, dynamic sections here. */ static bool -elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_aarch64_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -10096,7 +10093,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, || relplt == NULL) abort (); - elfNN_aarch64_create_small_pltn_entry (h, htab, output_bfd, info); + elfNN_aarch64_create_small_pltn_entry (h, htab, info->output_bfd, info); if (!h->def_regular) { /* Mark the symbol as undefined, rather than as defined in @@ -10152,9 +10149,9 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, contains the real function address if we need pointer equality. We load the GOT entry with the PLT entry. */ plt = htab->root.splt ? htab->root.splt : htab->root.iplt; - bfd_put_NN (output_bfd, (plt->output_section->vma - + plt->output_offset - + h->plt.offset), + bfd_put_NN (info->output_bfd, (plt->output_section->vma + + plt->output_offset + + h->plt.offset), htab->root.sgot->contents + (h->got.offset & ~(bfd_vma) 1)); return true; @@ -10177,7 +10174,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, { do_glob_dat: BFD_ASSERT ((h->got.offset & 1) == 0); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->root.sgot->contents + h->got.offset); rela.r_info = ELFNN_R_INFO (h->dynindx, AARCH64_R (GLOB_DAT)); rela.r_addend = 0; @@ -10185,7 +10182,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, loc = htab->root.srelgot->contents; loc += htab->root.srelgot->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); } skip_got_reloc: @@ -10212,7 +10209,7 @@ skip_got_reloc: else s = htab->root.srelbss; loc = s->contents + s->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. SYM may @@ -10236,8 +10233,7 @@ elfNN_aarch64_finish_local_dynamic_symbol (void **slot, void *inf) struct bfd_link_info *info = (struct bfd_link_info *) inf; - return elfNN_aarch64_finish_dynamic_symbol (info->output_bfd, - info, h, NULL); + return elfNN_aarch64_finish_dynamic_symbol (info, h, NULL); } static void @@ -10300,8 +10296,7 @@ elfNN_aarch64_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED, } static bool -elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_aarch64_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_aarch64_link_hash_table *htab; @@ -10362,7 +10357,7 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, break; } - bfd_elfNN_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elfNN_swap_dyn_out (info->output_bfd, &dyn, dyncon); } } @@ -10370,19 +10365,19 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, /* Fill in the special first entry in the procedure linkage table. */ if (htab->root.splt && htab->root.splt->size > 0) { - elfNN_aarch64_init_small_plt0_entry (output_bfd, htab); + elfNN_aarch64_init_small_plt0_entry (info->output_bfd, htab); if (htab->root.tlsdesc_plt && !(info->flags & DF_BIND_NOW)) { BFD_ASSERT (htab->root.tlsdesc_got != (bfd_vma)-1); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->root.sgot->contents + htab->root.tlsdesc_got); const bfd_byte *entry = elfNN_aarch64_tlsdesc_small_plt_entry; htab->tlsdesc_plt_entry_size = PLT_TLSDESC_ENTRY_SIZE; aarch64_plt_type plt_type - = elf_aarch64_tdata (output_bfd)->sw_protections.plt_type; + = elf_aarch64_tdata (info->output_bfd)->sw_protections.plt_type; if (plt_type & PLT_BTI) entry = elfNN_aarch64_tlsdesc_small_plt_bti_entry; @@ -10420,27 +10415,27 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, } /* adrp x2, DT_TLSDESC_GOT */ - elf_aarch64_update_plt_entry (output_bfd, + elf_aarch64_update_plt_entry (info->output_bfd, BFD_RELOC_AARCH64_ADR_HI21_PCREL, plt_entry + 4, (PG (dt_tlsdesc_got) - PG (adrp1_addr))); /* adrp x3, 0 */ - elf_aarch64_update_plt_entry (output_bfd, + elf_aarch64_update_plt_entry (info->output_bfd, BFD_RELOC_AARCH64_ADR_HI21_PCREL, plt_entry + 8, (PG (pltgot_addr) - PG (adrp2_addr))); /* ldr x2, [x2, #0] */ - elf_aarch64_update_plt_entry (output_bfd, + elf_aarch64_update_plt_entry (info->output_bfd, BFD_RELOC_AARCH64_LDSTNN_LO12, plt_entry + 12, PG_OFFSET (dt_tlsdesc_got)); /* add x3, x3, 0 */ - elf_aarch64_update_plt_entry (output_bfd, + elf_aarch64_update_plt_entry (info->output_bfd, BFD_RELOC_AARCH64_ADD_LO12, plt_entry + 16, PG_OFFSET (pltgot_addr)); @@ -10460,14 +10455,12 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, /* Fill in the first three entries in the global offset table. */ if (htab->root.sgotplt->size > 0) { - bfd_put_NN (output_bfd, (bfd_vma) 0, htab->root.sgotplt->contents); + bfd_put_NN (info->output_bfd, 0, htab->root.sgotplt->contents); /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ - bfd_put_NN (output_bfd, - (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->root.sgotplt->contents + GOT_ENTRY_SIZE); - bfd_put_NN (output_bfd, - (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->root.sgotplt->contents + GOT_ENTRY_SIZE * 2); } @@ -10477,7 +10470,7 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, { bfd_vma addr = sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0; - bfd_put_NN (output_bfd, addr, htab->root.sgot->contents); + bfd_put_NN (info->output_bfd, addr, htab->root.sgot->contents); } } diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 7fbb070f5c1..401327a7c68 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -2984,8 +2984,7 @@ elfNN_ia64_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, } static bool -elfNN_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elfNN_ia64_late_size_sections (struct bfd_link_info *info) { struct elfNN_ia64_allocate_data data; struct elfNN_ia64_link_hash_table *ia64_info; @@ -3196,7 +3195,7 @@ elfNN_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (!_bfd_elf_add_dynamic_tags (output_bfd, info, true)) + if (!_bfd_elf_add_dynamic_tags (info, true)) return false; if (!add_dynamic_entry (DT_IA_64_PLT_RESERVE, 0)) @@ -3760,8 +3759,7 @@ elfNN_ia64_final_link (bfd *abfd, struct bfd_link_info *info) } static int -elfNN_ia64_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_ia64_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -3794,7 +3792,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, ->this_hdr.sh_flags |= flags; } - gp_val = _bfd_get_gp_value (output_bfd); + gp_val = _bfd_get_gp_value (info->output_bfd); srel = get_reloc_section (input_bfd, ia64_info, input_section, false); rel = relocs; @@ -3845,7 +3843,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx]; msec = sym_sec; - value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); + value = _bfd_elf_rela_local_sym (info->output_bfd, sym, &msec, rel); if (!bfd_link_relocatable (info) && (sym_sec->flags & SEC_MERGE) != 0 && ELF_ST_TYPE (sym->st_info) == STT_SECTION @@ -3865,7 +3863,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, { msec = sym_sec; dynent->addend = - _bfd_merged_section_offset (output_bfd, &msec, + _bfd_merged_section_offset (info->output_bfd, &msec, sym->st_value + dynent->addend); dynent->addend -= sym->st_value; @@ -3995,7 +3993,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd, addend = value; } - elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section, + elfNN_ia64_install_dyn_reloc (info->output_bfd, info, + input_section, srel, rel->r_offset, dyn_r_type, dynindx, addend); } @@ -4045,7 +4044,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, case R_IA64_PLTOFF64MSB: case R_IA64_PLTOFF64LSB: dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false); - value = set_pltoff_entry (output_bfd, info, dyn_i, value, false); + value = set_pltoff_entry (info->output_bfd, info, dyn_i, value, false); value -= gp_val; r = ia64_elf_install_value (hit_addr, value, r_type); break; @@ -4059,7 +4058,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, if (dyn_i->want_fptr) { if (!undef_weak_ref) - value = set_fptr_entry (output_bfd, info, dyn_i, value); + value = set_fptr_entry (info->output_bfd, info, dyn_i, value); } if (!dyn_i->want_fptr || bfd_link_pie (info)) { @@ -4107,7 +4106,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd, value = 0; } - elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section, + elfNN_ia64_install_dyn_reloc (info->output_bfd, info, + input_section, srel, rel->r_offset, dyn_r_type, dynindx, addend); } @@ -4129,7 +4129,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, { BFD_ASSERT (h == NULL || h->dynindx == -1); if (!undef_weak_ref) - value = set_fptr_entry (output_bfd, info, dyn_i, value); + value = set_fptr_entry (info->output_bfd, info, dyn_i, value); dynindx = -1; } else @@ -4151,7 +4151,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, value = 0; } - value = set_got_entry (output_bfd, info, dyn_i, dynindx, + value = set_got_entry (info->output_bfd, info, dyn_i, dynindx, rel->r_addend, value, R_IA64_FPTRNNLSB); value -= gp_val; r = ia64_elf_install_value (hit_addr, value, r_type); @@ -4167,7 +4167,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd, { BFD_ASSERT (srel != NULL); - elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section, + elfNN_ia64_install_dyn_reloc (info->output_bfd, info, + input_section, srel, rel->r_offset, r_type, h->dynindx, rel->r_addend); } @@ -4252,7 +4253,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, { /* Find the segment that contains the output_section. */ Elf_Internal_Phdr *p = _bfd_elf_find_segment_containing_section - (output_bfd, input_section->output_section); + (info->output_bfd, input_section->output_section); if (p == NULL) { @@ -4301,17 +4302,18 @@ elfNN_ia64_relocate_section (bfd *output_bfd, else dyn_r_type = R_IA64_REL64LSB; - elfNN_ia64_install_dyn_reloc (output_bfd, info, + elfNN_ia64_install_dyn_reloc (info->output_bfd, info, input_section, srel, rel->r_offset, dyn_r_type, 0, value); - elfNN_ia64_install_dyn_reloc (output_bfd, info, + elfNN_ia64_install_dyn_reloc (info->output_bfd, info, input_section, srel, rel->r_offset + 8, dyn_r_type, 0, gp_val); } else - elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section, + elfNN_ia64_install_dyn_reloc (info->output_bfd, info, + input_section, srel, rel->r_offset, r_type, h->dynindx, rel->r_addend); } @@ -4507,8 +4509,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, } static bool -elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_ia64_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -4527,7 +4528,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd, asection *plt_sec; bfd_vma plt_addr, pltoff_addr, gp_val, plt_index; - gp_val = _bfd_get_gp_value (output_bfd); + gp_val = _bfd_get_gp_value (info->output_bfd); /* Initialize the minimal PLT entry. */ @@ -4542,7 +4543,8 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd, plt_addr = (plt_sec->output_section->vma + plt_sec->output_offset + dyn_i->plt_offset); - pltoff_addr = set_pltoff_entry (output_bfd, info, dyn_i, plt_addr, true); + pltoff_addr = set_pltoff_entry (info->output_bfd, info, dyn_i, + plt_addr, true); /* Initialize the FULL PLT entry, if needed. */ if (dyn_i->want_plt2) @@ -4562,7 +4564,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd, /* Create the dynamic relocation. */ outrel.r_offset = pltoff_addr; - if (bfd_little_endian (output_bfd)) + if (bfd_little_endian (info->output_bfd)) outrel.r_info = ELFNN_R_INFO (h->dynindx, R_IA64_IPLTLSB); else outrel.r_info = ELFNN_R_INFO (h->dynindx, R_IA64_IPLTMSB); @@ -4583,7 +4585,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd, loc = ia64_info->rel_pltoff_sec->contents; loc += ((ia64_info->rel_pltoff_sec->reloc_count + plt_index) * sizeof (ElfNN_External_Rela)); - bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &outrel, loc); } /* Mark some specially defined symbols as absolute. */ @@ -4596,8 +4598,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd, } static bool -elfNN_ia64_finish_dynamic_sections (bfd *abfd, - struct bfd_link_info *info, +elfNN_ia64_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elfNN_ia64_link_hash_table *ia64_info; @@ -4621,7 +4622,7 @@ elfNN_ia64_finish_dynamic_sections (bfd *abfd, dyncon = (ElfNN_External_Dyn *) sdyn->contents; dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->size); - gp_val = _bfd_get_gp_value (abfd); + gp_val = _bfd_get_gp_value (info->output_bfd); for (; dyncon < dynconend; dyncon++) { @@ -4654,7 +4655,7 @@ elfNN_ia64_finish_dynamic_sections (bfd *abfd, break; } - bfd_elfNN_swap_dyn_out (abfd, &dyn, dyncon); + bfd_elfNN_swap_dyn_out (info->output_bfd, &dyn, dyncon); } /* Initialize the PLT0 entry. */ diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c index e40bd3e8a6e..f664251e76e 100644 --- a/bfd/elfnn-kvx.c +++ b/bfd/elfnn-kvx.c @@ -2444,8 +2444,7 @@ elfNN_kvx_final_link_relocate (reloc_howto_type *howto, /* Relocate a KVX ELF section. */ static int -elfNN_kvx_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_kvx_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2525,7 +2524,8 @@ elfNN_kvx_relocate_section (bfd *output_bfd, (input_bfd, symtab_hdr->sh_link, sym->st_name), input_bfd, input_section, rel->r_offset, true); - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym (info->output_bfd, + sym, &sec, rel); } else { @@ -2589,7 +2589,7 @@ elfNN_kvx_relocate_section (bfd *output_bfd, save_addend = false; if (r == bfd_reloc_continue) - r = elfNN_kvx_final_link_relocate (howto, input_bfd, output_bfd, + r = elfNN_kvx_final_link_relocate (howto, input_bfd, info->output_bfd, input_section, contents, rel, relocation, info, sec, h, &unresolved_reloc, @@ -2640,7 +2640,7 @@ elfNN_kvx_relocate_section (bfd *output_bfd, loc = globals->root.srelgot->contents; loc += globals->root.srelgot->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); bfd_reloc_code_real_type real_type = elfNN_kvx_bfd_reloc_from_type (input_bfd, r_type); @@ -2654,13 +2654,13 @@ elfNN_kvx_relocate_section (bfd *output_bfd, /* For local dynamic, don't generate DTPOFF in any case. Initialize the DTPOFF slot into zero, so we get module base address when invoke runtime TLS resolver. */ - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, globals->root.sgot->contents + off + GOT_ENTRY_SIZE); } else if (indx == 0) { - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, relocation - dtpoff_base (info), globals->root.sgot->contents + off + GOT_ENTRY_SIZE); @@ -2681,17 +2681,17 @@ elfNN_kvx_relocate_section (bfd *output_bfd, loc = globals->root.srelgot->contents; loc += globals->root.srelgot->reloc_count++ * RELOC_SIZE (globals); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); + bfd_put_NN (info->output_bfd, 0, globals->root.sgot->contents + off + GOT_ENTRY_SIZE); } } else { - bfd_put_NN (output_bfd, (bfd_vma) 1, + bfd_put_NN (info->output_bfd, (bfd_vma) 1, globals->root.sgot->contents + off); - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, relocation - dtpoff_base (info), globals->root.sgot->contents + off + GOT_ENTRY_SIZE); @@ -2743,13 +2743,13 @@ elfNN_kvx_relocate_section (bfd *output_bfd, loc += globals->root.srelgot->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); - bfd_put_NN (output_bfd, rela.r_addend, + bfd_put_NN (info->output_bfd, rela.r_addend, globals->root.sgot->contents + off); } else - bfd_put_NN (output_bfd, relocation - tpoff_base (info), + bfd_put_NN (info->output_bfd, relocation - tpoff_base (info), globals->root.sgot->contents + off); symbol_got_offset_mark (input_bfd, h, r_symndx); @@ -2766,7 +2766,7 @@ elfNN_kvx_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) @@ -3633,8 +3633,7 @@ kvx_map_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) /* Output mapping symbols for linker generated sections. */ static bool -elfNN_kvx_output_arch_local_syms (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_kvx_output_arch_local_syms (struct bfd_link_info *info, void *finfo, int (*func) (void *, const char *, Elf_Internal_Sym *, @@ -3665,7 +3664,7 @@ elfNN_kvx_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, kvx_map_one_stub, &osi); @@ -3677,7 +3676,7 @@ elfNN_kvx_output_arch_local_syms (bfd *output_bfd, return true; osi.sec_shndx = _bfd_elf_section_from_bfd_section - (output_bfd, htab->root.splt->output_section); + (info->output_bfd, htab->root.splt->output_section); osi.sec = htab->root.splt; return true; @@ -4028,8 +4027,7 @@ kvx_readonly_dynrelocs (struct elf_link_hash_entry * h, void * inf) /* This is the most important function of all . Innocuosly named though ! */ static bool -elfNN_kvx_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +elfNN_kvx_late_size_sections (struct bfd_link_info *info) { struct elf_kvx_link_hash_table *htab; bfd *dynobj; @@ -4356,7 +4354,7 @@ elfNN_kvx_create_small_pltn_entry (struct elf_link_hash_entry *h, _TLS_MODULE_BASE_, if needed. */ static bool -elfNN_kvx_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) +elfNN_kvx_early_size_sections (struct bfd_link_info *info) { asection *tls_sec; @@ -4375,10 +4373,10 @@ elfNN_kvx_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) if (tlsbase) { struct bfd_link_hash_entry *h = 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, &h))) return false; @@ -4396,8 +4394,7 @@ elfNN_kvx_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ static bool -elfNN_kvx_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_kvx_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -4429,7 +4426,7 @@ elfNN_kvx_finish_dynamic_symbol (bfd *output_bfd, || relplt == NULL) abort (); - elfNN_kvx_create_small_pltn_entry (h, htab, output_bfd); + elfNN_kvx_create_small_pltn_entry (h, htab, info->output_bfd); if (!h->def_regular) { /* Mark the symbol as undefined, rather than as defined in @@ -4491,7 +4488,7 @@ elfNN_kvx_finish_dynamic_symbol (bfd *output_bfd, else { BFD_ASSERT ((h->got.offset & 1) == 0); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->root.sgot->contents + h->got.offset); rela.r_info = ELFNN_R_INFO (h->dynindx, R_KVX_GLOB_DAT); rela.r_addend = 0; @@ -4499,7 +4496,7 @@ elfNN_kvx_finish_dynamic_symbol (bfd *output_bfd, loc = htab->root.srelgot->contents; loc += htab->root.srelgot->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); } if (h->needs_copy) @@ -4522,7 +4519,7 @@ elfNN_kvx_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; loc = htab->srelbss->contents; loc += htab->srelbss->reloc_count++ * RELOC_SIZE (htab); - bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_elfNN_swap_reloca_out (info->output_bfd, &rela, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. SYM may @@ -4546,8 +4543,7 @@ elfNN_kvx_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED, } static bool -elfNN_kvx_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +elfNN_kvx_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { struct elf_kvx_link_hash_table *htab; @@ -4610,7 +4606,7 @@ elfNN_kvx_finish_dynamic_sections (bfd *output_bfd, break; } - bfd_elfNN_swap_dyn_out (output_bfd, &dyn, dyncon); + bfd_elfNN_swap_dyn_out (info->output_bfd, &dyn, dyncon); } } @@ -4618,7 +4614,7 @@ elfNN_kvx_finish_dynamic_sections (bfd *output_bfd, /* Fill in the special first entry in the procedure linkage table. */ if (htab->root.splt && htab->root.splt->size > 0) { - elfNN_kvx_init_small_plt0_entry (output_bfd, htab); + elfNN_kvx_init_small_plt0_entry (info->output_bfd, htab); elf_section_data (htab->root.splt->output_section)-> this_hdr.sh_entsize = htab->plt_entry_size; @@ -4636,14 +4632,12 @@ elfNN_kvx_finish_dynamic_sections (bfd *output_bfd, /* Fill in the first three entries in the global offset table. */ if (htab->root.sgotplt->size > 0) { - bfd_put_NN (output_bfd, (bfd_vma) 0, htab->root.sgotplt->contents); + bfd_put_NN (info->output_bfd, 0, htab->root.sgotplt->contents); /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ - bfd_put_NN (output_bfd, - (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->root.sgotplt->contents + GOT_ENTRY_SIZE); - bfd_put_NN (output_bfd, - (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->root.sgotplt->contents + GOT_ENTRY_SIZE * 2); } @@ -4653,7 +4647,7 @@ elfNN_kvx_finish_dynamic_sections (bfd *output_bfd, { bfd_vma addr = sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0; - bfd_put_NN (output_bfd, addr, htab->root.sgot->contents); + bfd_put_NN (info->output_bfd, addr, htab->root.sgot->contents); } } diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index 8f8ec3b0789..9d9c68664bb 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -2543,8 +2543,7 @@ loongarch_elf_finish_relative_relocs (struct bfd_link_info *info) } static bool -loongarch_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +loongarch_elf_late_size_sections (struct bfd_link_info *info) { struct loongarch_elf_link_hash_table *htab; bfd *dynobj; @@ -2566,9 +2565,9 @@ loongarch_elf_late_size_sections (bfd *output_bfd, s = htab->elf.interp; BFD_ASSERT (s != NULL); - if (elf_elfheader (output_bfd)->e_ident[EI_CLASS] == ELFCLASS32) + if (elf_elfheader (info->output_bfd)->e_ident[EI_CLASS] == ELFCLASS32) interpreter = "/lib32/ld.so.1"; - else if (elf_elfheader (output_bfd)->e_ident[EI_CLASS] == ELFCLASS64) + else if (elf_elfheader (info->output_bfd)->e_ident[EI_CLASS] == ELFCLASS64) interpreter = "/lib64/ld.so.1"; else interpreter = "/lib/ld.so.1"; @@ -3495,7 +3494,7 @@ loongarch_resolve_pcrel_lo_relocs (loongarch_pcrel_relocs *p) } static int -loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +loongarch_elf_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, @@ -3555,7 +3554,8 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, unresolved_reloc = false; 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); /* Relocate against local STT_GNU_IFUNC symbol. */ if (!bfd_link_relocatable (info) @@ -3690,7 +3690,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ - outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, + outrel.r_offset = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); @@ -3766,8 +3766,8 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, relocation, input_bfd, contents); else - loongarch_elf_append_rela (output_bfd, sreloc, - &outrel); + loongarch_elf_append_rela (info->output_bfd, + sreloc, &outrel); } } @@ -3826,7 +3826,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { Elf_Internal_Rela outrel; - outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, + outrel.r_offset = _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset); unresolved_reloc = (!((bfd_vma) -2 <= outrel.r_offset) @@ -3835,7 +3835,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_offset += sec_addr (input_section); outrel.r_addend = rel->r_addend; if (unresolved_reloc) - loongarch_elf_append_rela (output_bfd, sreloc, &outrel); + loongarch_elf_append_rela (info->output_bfd, sreloc, &outrel); break; } @@ -4131,9 +4131,9 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_offset = sec_addr (got) + off; outrel.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); outrel.r_addend = relocation; /* Link-time addr. */ - loongarch_elf_append_rela (output_bfd, s, &outrel); + loongarch_elf_append_rela (info->output_bfd, s, &outrel); } - bfd_put_NN (output_bfd, relocation, got->contents + off); + bfd_put_NN (info->output_bfd, relocation, got->contents + off); h->got.offset |= 1; } } @@ -4183,10 +4183,10 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_offset = sec_addr (got) + off; outrel.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); outrel.r_addend = relocation; /* Link-time addr. */ - loongarch_elf_append_rela (output_bfd, s, &outrel); + loongarch_elf_append_rela (info->output_bfd, s, &outrel); } - bfd_put_NN (output_bfd, relocation, got->contents + off); + bfd_put_NN (info->output_bfd, relocation, got->contents + off); local_got_offsets[r_symndx] |= 1; } } @@ -4238,34 +4238,38 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rela.r_offset = sec_addr (got) + got_off; rela.r_addend = 0; rela.r_info = ELFNN_R_INFO (indx, R_LARCH_TLS_DTPMODNN); - bfd_put_NN (output_bfd, 0, got->contents + got_off); - loongarch_elf_append_rela (output_bfd, srel, &rela); + bfd_put_NN (info->output_bfd, 0, + got->contents + got_off); + loongarch_elf_append_rela (info->output_bfd, + srel, &rela); if (indx == 0) { /* Local symbol, tp offset has been known. */ BFD_ASSERT (! unresolved_reloc); - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, tlsoff (info, relocation), (got->contents + got_off + GOT_ENTRY_SIZE)); } else { /* Dynamic resolved block offset. */ - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, got->contents + got_off + GOT_ENTRY_SIZE); rela.r_info = ELFNN_R_INFO (indx, R_LARCH_TLS_DTPRELNN); rela.r_offset += GOT_ENTRY_SIZE; - loongarch_elf_append_rela (output_bfd, srel, &rela); + loongarch_elf_append_rela (info->output_bfd, + srel, &rela); } } else { /* In a static link or an executable link with the symbol binding locally. Mark it as belonging to module 1. */ - bfd_put_NN (output_bfd, 1, got->contents + got_off); - bfd_put_NN (output_bfd, tlsoff (info, relocation), + bfd_put_NN (info->output_bfd, 1, + got->contents + got_off); + bfd_put_NN (info->output_bfd, tlsoff (info, relocation), got->contents + got_off + GOT_ENTRY_SIZE); } } @@ -4273,7 +4277,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { if (need_reloc) { - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, got->contents + got_off + ie_off); rela.r_offset = sec_addr (got) + got_off + ie_off; rela.r_addend = 0; @@ -4281,13 +4285,14 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (indx == 0) rela.r_addend = tlsoff (info, relocation); rela.r_info = ELFNN_R_INFO (indx, R_LARCH_TLS_TPRELNN); - loongarch_elf_append_rela (output_bfd, srel, &rela); + loongarch_elf_append_rela (info->output_bfd, + srel, &rela); } else { /* In a static link or an executable link with the symbol binding locally, compute offset directly. */ - bfd_put_NN (output_bfd, tlsoff (info, relocation), + bfd_put_NN (info->output_bfd, tlsoff (info, relocation), got->contents + got_off + ie_off); } } @@ -4589,11 +4594,11 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rela.r_offset = sec_addr (got) + got_off; rela.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); rela.r_addend = relocation; - loongarch_elf_append_rela (output_bfd, + loongarch_elf_append_rela (info->output_bfd, htab->elf.srelgot, &rela); } h->got.offset |= 1; - bfd_put_NN (output_bfd, relocation, + bfd_put_NN (info->output_bfd, relocation, got->contents + got_off); } } @@ -4612,12 +4617,13 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rela.r_offset = sec_addr (got) + got_off; rela.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); rela.r_addend = relocation; - loongarch_elf_append_rela (output_bfd, + loongarch_elf_append_rela (info->output_bfd, htab->elf.srelgot, &rela); } local_got_offsets[r_symndx] |= 1; } - bfd_put_NN (output_bfd, relocation, got->contents + got_off); + bfd_put_NN (info->output_bfd, relocation, + got->contents + got_off); } relocation = got_off + sec_addr (got); @@ -4773,34 +4779,36 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rela.r_offset = sec_addr (got) + got_off; rela.r_addend = 0; rela.r_info = ELFNN_R_INFO (indx,R_LARCH_TLS_DTPMODNN); - bfd_put_NN (output_bfd, 0, got->contents + got_off); - loongarch_elf_append_rela (output_bfd, relgot, &rela); + bfd_put_NN (info->output_bfd, 0, got->contents + got_off); + loongarch_elf_append_rela (info->output_bfd, + relgot, &rela); if (indx == 0) { /* Local symbol, tp offset has been known. */ BFD_ASSERT (! unresolved_reloc); - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, tlsoff (info, relocation), (got->contents + got_off + GOT_ENTRY_SIZE)); } else { /* Dynamic resolved block offset. */ - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, got->contents + got_off + GOT_ENTRY_SIZE); rela.r_info = ELFNN_R_INFO (indx, R_LARCH_TLS_DTPRELNN); rela.r_offset += GOT_ENTRY_SIZE; - loongarch_elf_append_rela (output_bfd, relgot, &rela); + loongarch_elf_append_rela (info->output_bfd, + relgot, &rela); } } else { /* In a static link or an executable link with the symbol binding locally. Mark it as belonging to module 1. */ - bfd_put_NN (output_bfd, 1, got->contents + got_off); - bfd_put_NN (output_bfd, tlsoff (info, relocation), + bfd_put_NN (info->output_bfd, 1, got->contents + got_off); + bfd_put_NN (info->output_bfd, tlsoff (info, relocation), got->contents + got_off + GOT_ENTRY_SIZE); } } @@ -4815,15 +4823,15 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rela.r_addend = tlsoff (info, relocation); rela.r_info = ELFNN_R_INFO (indx, R_LARCH_TLS_DESCNN); - loongarch_elf_append_rela (output_bfd, relgot, &rela); - bfd_put_NN (output_bfd, 0, + loongarch_elf_append_rela (info->output_bfd, relgot, &rela); + bfd_put_NN (info->output_bfd, 0, got->contents + got_off + desc_off); } if (tls_type & GOT_TLS_IE) { if (need_reloc) { - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, got->contents + got_off + ie_off); rela.r_offset = sec_addr (got) + got_off + ie_off; rela.r_addend = 0; @@ -4831,13 +4839,14 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (indx == 0) rela.r_addend = tlsoff (info, relocation); rela.r_info = ELFNN_R_INFO (indx, R_LARCH_TLS_TPRELNN); - loongarch_elf_append_rela (output_bfd, relgot, &rela); + loongarch_elf_append_rela (info->output_bfd, + relgot, &rela); } else { /* In a static link or an executable link with the symbol bindinglocally, compute offset directly. */ - bfd_put_NN (output_bfd, tlsoff (info, relocation), + bfd_put_NN (info->output_bfd, tlsoff (info, relocation), got->contents + got_off + ie_off); } } @@ -4953,7 +4962,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (!unresolved_reloc) break; - if (_bfd_elf_section_offset (output_bfd, info, input_section, + if (_bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) == MINUS_ONE) /* WHY? May because it's invalid so skip checking. But why dynamic reloc a invalid section? */ @@ -6453,13 +6462,12 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, dynamic sections here. */ static bool -loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +loongarch_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { struct loongarch_elf_link_hash_table *htab = loongarch_elf_hash_table (info); - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); if (h->plt.offset != MINUS_ONE) { @@ -6508,11 +6516,11 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, return false; for (i = 0; i < PLT_ENTRY_INSNS; i++) - bfd_put_32 (output_bfd, plt_entry[i], loc + 4 * i); + bfd_put_32 (info->output_bfd, plt_entry[i], loc + 4 * i); /* Fill in the initial value of the got.plt entry. */ loc = gotplt->contents + (got_address - sec_addr (gotplt)); - bfd_put_NN (output_bfd, sec_addr (plt), loc); + bfd_put_NN (info->output_bfd, sec_addr (plt), loc); rela.r_offset = got_address; @@ -6526,7 +6534,7 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset); - loongarch_elf_append_rela (output_bfd, relplt, &rela); + loongarch_elf_append_rela (info->output_bfd, relplt, &rela); } else { @@ -6534,7 +6542,7 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_JUMP_SLOT); rela.r_addend = 0; loc = relplt->contents + plt_idx * sizeof (ElfNN_External_Rela); - bed->s->swap_reloca_out (output_bfd, &rela, loc); + bed->s->swap_reloca_out (info->output_bfd, &rela, loc); } if (!h->def_regular) @@ -6587,21 +6595,21 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = ELFNN_R_INFO (0, R_LARCH_IRELATIVE); rela.r_addend = h->root.u.def.value + sec->output_section->vma + sec->output_offset; - bfd_put_NN (output_bfd, 0, sgot->contents + off); + bfd_put_NN (info->output_bfd, 0, sgot->contents + off); } else { BFD_ASSERT (h->dynindx != -1); rela.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_NN); rela.r_addend = 0; - bfd_put_NN (output_bfd, (bfd_vma) 0, sgot->contents + off); + bfd_put_NN (info->output_bfd, 0, sgot->contents + off); } } else if(bfd_link_pic (info)) { rela.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_NN); rela.r_addend = 0; - bfd_put_NN (output_bfd, rela.r_addend, sgot->contents + off); + bfd_put_NN (info->output_bfd, rela.r_addend, sgot->contents + off); } else { @@ -6614,7 +6622,7 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, contains the real function address if we need pointer equality. We load the GOT entry with the PLT entry. */ plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt; - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, (plt->output_section->vma + plt->output_offset + h->plt.offset), @@ -6632,7 +6640,7 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, to write the addend (link-time addr) into the GOT then. */ if (info->enable_dt_relr) { - bfd_put_NN (output_bfd, linkaddr, sgot->contents + off); + bfd_put_NN (info->output_bfd, linkaddr, sgot->contents + off); goto skip_got_reloc; } rela.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); @@ -6645,7 +6653,7 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; } - loongarch_elf_append_rela (output_bfd, srela, &rela); + loongarch_elf_append_rela (info->output_bfd, srela, &rela); } skip_got_reloc: @@ -6659,11 +6667,10 @@ skip_got_reloc: /* Finish up the dynamic sections. */ static bool -loongarch_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, bfd *dynobj, - asection *sdyn) +loongarch_finish_dyn (struct bfd_link_info *info, bfd *dynobj, asection *sdyn) { struct loongarch_elf_link_hash_table *htab = loongarch_elf_hash_table (info); - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); size_t dynsize = bed->s->sizeof_dyn, skipped_size = 0; bfd_byte *dyncon, *dynconend; @@ -6702,7 +6709,7 @@ loongarch_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, bfd *dynobj, if (skipped) skipped_size += dynsize; else - bed->s->swap_dyn_out (output_bfd, &dyn, dyncon - skipped_size); + bed->s->swap_dyn_out (info->output_bfd, &dyn, dyncon - skipped_size); } /* Wipe out any trailing entries if we shifted down a dynamic tag. */ memset (dyncon - skipped_size, 0, skipped_size); @@ -6718,7 +6725,7 @@ elfNN_loongarch_finish_local_dynamic_symbol (void **slot, void *inf) struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) *slot; struct bfd_link_info *info = (struct bfd_link_info *) inf; - return loongarch_elf_finish_dynamic_symbol (info->output_bfd, info, h, NULL); + return loongarch_elf_finish_dynamic_symbol (info, h, NULL); } /* Value of struct elf_backend_data->elf_backend_output_arch_local_syms, @@ -6728,8 +6735,7 @@ elfNN_loongarch_finish_local_dynamic_symbol (void **slot, void *inf) static bool elf_loongarch_output_arch_local_syms - (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, + (struct bfd_link_info *info, void *flaginfo ATTRIBUTE_UNUSED, int (*func) (void *, const char *, Elf_Internal_Sym *, @@ -6749,8 +6755,7 @@ elf_loongarch_output_arch_local_syms } static bool -loongarch_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +loongarch_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -6766,7 +6771,7 @@ loongarch_elf_finish_dynamic_sections (bfd *output_bfd, { BFD_ASSERT (htab->elf.splt && sdyn); - if (!loongarch_finish_dyn (output_bfd, info, dynobj, sdyn)) + if (!loongarch_finish_dyn (info, dynobj, sdyn)) return false; } @@ -6782,7 +6787,7 @@ loongarch_elf_finish_dynamic_sections (bfd *output_bfd, return false; for (i = 0; i < PLT_HEADER_INSNS; i++) - bfd_put_32 (output_bfd, plt_header[i], plt->contents + 4 * i); + bfd_put_32 (info->output_bfd, plt_header[i], plt->contents + 4 * i); elf_section_data (plt->output_section)->this_hdr.sh_entsize = PLT_ENTRY_SIZE; @@ -6803,9 +6808,9 @@ loongarch_elf_finish_dynamic_sections (bfd *output_bfd, { /* Write the first two entries in .got.plt, needed for the dynamic linker. */ - bfd_put_NN (output_bfd, MINUS_ONE, htab->elf.sgotplt->contents); + bfd_put_NN (info->output_bfd, MINUS_ONE, htab->elf.sgotplt->contents); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_put_NN (info->output_bfd, 0, htab->elf.sgotplt->contents + GOT_ENTRY_SIZE); } @@ -6821,7 +6826,7 @@ loongarch_elf_finish_dynamic_sections (bfd *output_bfd, /* Set the first entry in the global offset table to the address of the dynamic section. */ bfd_vma val = sdyn ? sec_addr (sdyn) : 0; - bfd_put_NN (output_bfd, val, htab->elf.sgot->contents); + bfd_put_NN (info->output_bfd, val, htab->elf.sgot->contents); } elf_section_data (output_section)->this_hdr.sh_entsize = GOT_ENTRY_SIZE; diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 2aa0e12ff20..1c1c3ea36c5 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -1688,7 +1688,7 @@ allocate_local_ifunc_dynrelocs (void **slot, void *inf) } static bool -riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) +riscv_elf_late_size_sections (struct bfd_link_info *info) { struct riscv_elf_link_hash_table *htab; bfd *dynobj; @@ -1832,7 +1832,7 @@ riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) || htab->elf.splt->size == 0) && (htab->elf.sgot == NULL || (htab->elf.sgot->size - == get_elf_backend_data (output_bfd)->got_header_size))) + == get_elf_backend_data (info->output_bfd)->got_header_size))) htab->elf.sgotplt->size = 0; } @@ -1901,7 +1901,7 @@ riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) /* Add dynamic entries. */ if (elf_hash_table (info)->dynamic_sections_created) { - if (!_bfd_elf_add_dynamic_tags (output_bfd, info, true)) + if (!_bfd_elf_add_dynamic_tags (info, true)) return false; if (htab->variant_cc @@ -2415,8 +2415,7 @@ riscv_resolve_pcrel_lo_relocs (riscv_pcrel_relocs *p) accordingly. */ static int -riscv_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +riscv_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2472,7 +2471,8 @@ riscv_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); /* Relocate against local STT_GNU_IFUNC symbol. */ if (!bfd_link_relocatable (info) @@ -2585,7 +2585,7 @@ riscv_elf_relocate_section (bfd *output_bfd, /* Need a dynamic relocation to get the real function address. */ - 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); @@ -2622,11 +2622,11 @@ riscv_elf_relocate_section (bfd *output_bfd, 2. .rela.got section in dynamic executable. 3. .rela.iplt section in static executable. */ if (bfd_link_pic (info)) - riscv_elf_append_rela (output_bfd, htab->elf.irelifunc, - &outrel); + riscv_elf_append_rela (info->output_bfd, + htab->elf.irelifunc, &outrel); else if (htab->elf.splt != NULL) - riscv_elf_append_rela (output_bfd, htab->elf.srelgot, - &outrel); + riscv_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); else { /* Do not use riscv_elf_append_rela to add dynamic @@ -2634,11 +2634,11 @@ riscv_elf_relocate_section (bfd *output_bfd, overwrite problems. This is same as what we did in the riscv_elf_finish_dynamic_symbol. */ elf_backend_data *bed - = get_elf_backend_data (output_bfd); + = get_elf_backend_data (info->output_bfd); bfd_vma iplt_idx = htab->last_iplt_index--; bfd_byte *loc = htab->elf.irelplt->contents + iplt_idx * sizeof (ElfNN_External_Rela); - bed->s->swap_reloca_out (output_bfd, &outrel, loc); + bed->s->swap_reloca_out (info->output_bfd, &outrel, loc); } /* If this reloc is against an external symbol, we @@ -2696,7 +2696,7 @@ riscv_elf_relocate_section (bfd *output_bfd, off &= ~1; else { - bfd_put_NN (output_bfd, relocation, + bfd_put_NN (info->output_bfd, relocation, base_got->contents + off); /* Note that this is harmless for the case, as -1 | 1 still is -1. */ @@ -2883,7 +2883,7 @@ riscv_elf_relocate_section (bfd *output_bfd, && !bfd_is_abs_section(h->root.u.def.section)) relative_got = true; - bfd_put_NN (output_bfd, relocation, + bfd_put_NN (info->output_bfd, relocation, htab->elf.sgot->contents + off); h->got.offset |= 1; } @@ -2908,7 +2908,7 @@ riscv_elf_relocate_section (bfd *output_bfd, if (bfd_link_pic (info)) relative_got = true; - bfd_put_NN (output_bfd, relocation, + bfd_put_NN (info->output_bfd, relocation, htab->elf.sgot->contents + off); local_got_offsets[r_symndx] |= 1; } @@ -2926,7 +2926,7 @@ riscv_elf_relocate_section (bfd *output_bfd, outrel.r_offset = sec_addr (htab->elf.sgot) + off; outrel.r_info = ELFNN_R_INFO (0, R_RISCV_RELATIVE); outrel.r_addend = relocation; - riscv_elf_append_rela (output_bfd, s, &outrel); + riscv_elf_append_rela (info->output_bfd, s, &outrel); } if (rel->r_addend != 0) @@ -3165,8 +3165,8 @@ riscv_elf_relocate_section (bfd *output_bfd, time. */ 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); bool skip = false; bool relocate = false; if (outrel.r_offset == (bfd_vma) -1) @@ -3203,7 +3203,7 @@ riscv_elf_relocate_section (bfd *output_bfd, } sreloc = elf_section_data (input_section)->sreloc; - riscv_elf_append_rela (output_bfd, sreloc, &outrel); + riscv_elf_append_rela (info->output_bfd, sreloc, &outrel); if (!relocate) continue; } @@ -3265,25 +3265,27 @@ riscv_elf_relocate_section (bfd *output_bfd, outrel.r_offset = sec_addr (htab->elf.sgot) + off; outrel.r_addend = 0; outrel.r_info = ELFNN_R_INFO (indx, R_RISCV_TLS_DTPMODNN); - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, htab->elf.sgot->contents + off); - riscv_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + riscv_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, dtpoff (info, relocation), (htab->elf.sgot->contents + off + RISCV_ELF_WORD_BYTES)); } else { - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, (htab->elf.sgot->contents + off + RISCV_ELF_WORD_BYTES)); outrel.r_info = ELFNN_R_INFO (indx, R_RISCV_TLS_DTPRELNN); outrel.r_offset += RISCV_ELF_WORD_BYTES; - riscv_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + riscv_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); } } else @@ -3293,9 +3295,9 @@ riscv_elf_relocate_section (bfd *output_bfd, static link or an executable link with the symbol binding locally. Mark it as belonging to module 1, the executable. */ - bfd_put_NN (output_bfd, 1, + bfd_put_NN (info->output_bfd, 1, htab->elf.sgot->contents + off); - bfd_put_NN (output_bfd, + bfd_put_NN (info->output_bfd, dtpoff (info, relocation), (htab->elf.sgot->contents + off + RISCV_ELF_WORD_BYTES)); @@ -3306,7 +3308,7 @@ riscv_elf_relocate_section (bfd *output_bfd, { if (need_relocs) { - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, htab->elf.sgot->contents + off + ie_off); outrel.r_offset = sec_addr (htab->elf.sgot) + off + ie_off; @@ -3314,11 +3316,12 @@ riscv_elf_relocate_section (bfd *output_bfd, if (indx == 0) outrel.r_addend = tpoff (info, relocation); outrel.r_info = ELFNN_R_INFO (indx, R_RISCV_TLS_TPRELNN); - riscv_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + riscv_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); } else { - bfd_put_NN (output_bfd, tpoff (info, relocation), + bfd_put_NN (info->output_bfd, tpoff (info, relocation), htab->elf.sgot->contents + off + ie_off); } } @@ -3327,7 +3330,7 @@ riscv_elf_relocate_section (bfd *output_bfd, { /* TLSDESC is always handled by the dynamic linker and always need * a relocation. */ - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, htab->elf.sgot->contents + off + desc_off); outrel.r_offset = sec_addr (htab->elf.sgot) + off + desc_off; @@ -3335,7 +3338,8 @@ riscv_elf_relocate_section (bfd *output_bfd, if (indx == 0) outrel.r_addend = tlsdescoff (info, relocation); outrel.r_info = ELFNN_R_INFO (indx, R_RISCV_TLSDESC); - riscv_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + riscv_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); } } @@ -3362,7 +3366,7 @@ riscv_elf_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) { msg = bfd_asprintf (_("%%X%%P: unresolvable %s relocation against " @@ -3441,13 +3445,12 @@ riscv_elf_relocate_section (bfd *output_bfd, dynamic sections here. */ static bool -riscv_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +riscv_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { struct riscv_elf_link_hash_table *htab = riscv_elf_hash_table (info); - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); if (h->plt.offset != (bfd_vma) -1) { @@ -3502,14 +3505,14 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, /* Fill in the PLT entry itself. */ - if (! htab->make_plt_entry (output_bfd, gotplt, got_offset, + if (! htab->make_plt_entry (info->output_bfd, gotplt, got_offset, plt, h->plt.offset)) return false; /* Fill in the initial value of the .got.plt entry. */ loc = gotplt->contents + (got_address - sec_addr (gotplt)); - bfd_put_NN (output_bfd, sec_addr (plt), loc); + bfd_put_NN (info->output_bfd, sec_addr (plt), loc); rela.r_offset = got_address; @@ -3539,7 +3542,7 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, } loc = relplt->contents + plt_idx * sizeof (ElfNN_External_Rela); - bed->s->swap_reloca_out (output_bfd, &rela, loc); + bed->s->swap_reloca_out (info->output_bfd, &rela, loc); if (!h->def_regular) { @@ -3624,9 +3627,9 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, contains the real function address if we need pointer equality. We load the GOT entry with the PLT entry. */ plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt; - bfd_put_NN (output_bfd, (plt->output_section->vma - + plt->output_offset - + h->plt.offset), + bfd_put_NN (info->output_bfd, (plt->output_section->vma + + plt->output_offset + + h->plt.offset), htab->elf.sgot->contents + (h->got.offset & ~(bfd_vma) 1)); return true; @@ -3654,12 +3657,12 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, BFD_ASSERT (h->dynindx != -1); rela.r_info = ELFNN_R_INFO (h->dynindx, R_RISCV_NN); rela.r_addend = 0; - bfd_put_NN (output_bfd, 0, + bfd_put_NN (info->output_bfd, 0, sgot->contents + (h->got.offset & ~(bfd_vma) 1)); } if (use_elf_append_rela) - riscv_elf_append_rela (output_bfd, srela, &rela); + riscv_elf_append_rela (info->output_bfd, srela, &rela); else { /* Use riscv_elf_append_rela to add the dynamic relocs into @@ -3673,7 +3676,7 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, bfd_vma iplt_idx = htab->last_iplt_index--; bfd_byte *loc = srela->contents + iplt_idx * sizeof (ElfNN_External_Rela); - bed->s->swap_reloca_out (output_bfd, &rela, loc); + bed->s->swap_reloca_out (info->output_bfd, &rela, loc); } } @@ -3692,7 +3695,7 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, s = htab->elf.sreldynrelro; else s = htab->elf.srelbss; - riscv_elf_append_rela (output_bfd, s, &rela); + riscv_elf_append_rela (info->output_bfd, s, &rela); } /* Mark some specially defined symbols as absolute. */ @@ -3712,17 +3715,17 @@ riscv_elf_finish_local_dynamic_symbol (void **slot, void *inf) struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) *slot; struct bfd_link_info *info = (struct bfd_link_info *) inf; - return riscv_elf_finish_dynamic_symbol (info->output_bfd, info, h, NULL); + return riscv_elf_finish_dynamic_symbol (info, h, NULL); } /* Finish up the dynamic sections. */ static bool -riscv_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, +riscv_finish_dyn (struct bfd_link_info *info, bfd *dynobj, asection *sdyn) { struct riscv_elf_link_hash_table *htab = riscv_elf_hash_table (info); - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); size_t dynsize = bed->s->sizeof_dyn; bfd_byte *dyncon, *dynconend; @@ -3752,14 +3755,13 @@ riscv_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, continue; } - bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (info->output_bfd, &dyn, dyncon); } return true; } static bool -riscv_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +riscv_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -3780,7 +3782,7 @@ riscv_elf_finish_dynamic_sections (bfd *output_bfd, splt = htab->elf.splt; BFD_ASSERT (splt != NULL && sdyn != NULL); - ret = riscv_finish_dyn (output_bfd, info, dynobj, sdyn); + ret = riscv_finish_dyn (info, dynobj, sdyn); if (!ret) return ret; @@ -3788,7 +3790,7 @@ riscv_elf_finish_dynamic_sections (bfd *output_bfd, /* Fill in the head and tail entries in the procedure linkage table. */ if (splt->size > 0) { - ret = htab->make_plt_header (output_bfd, htab); + ret = htab->make_plt_header (info->output_bfd, htab); if (!ret) return ret; @@ -3810,8 +3812,8 @@ riscv_elf_finish_dynamic_sections (bfd *output_bfd, /* Write the first two entries in .got.plt, needed for the dynamic linker. */ - bfd_put_NN (output_bfd, (bfd_vma) -1, htab->elf.sgotplt->contents); - bfd_put_NN (output_bfd, (bfd_vma) 0, + bfd_put_NN (info->output_bfd, -1, htab->elf.sgotplt->contents); + bfd_put_NN (info->output_bfd, 0, htab->elf.sgotplt->contents + GOT_ENTRY_SIZE); elf_section_data (output_section)->this_hdr.sh_entsize = GOT_ENTRY_SIZE; @@ -3826,7 +3828,7 @@ riscv_elf_finish_dynamic_sections (bfd *output_bfd, /* Set the first entry in the global offset table to the address of the dynamic section. */ bfd_vma val = sdyn ? sec_addr (sdyn) : 0; - bfd_put_NN (output_bfd, val, htab->elf.sgot->contents); + bfd_put_NN (info->output_bfd, val, htab->elf.sgot->contents); elf_section_data (output_section)->this_hdr.sh_entsize = GOT_ENTRY_SIZE; } diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 83fdf96a8a5..7dc72afa697 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -4000,7 +4000,7 @@ count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info) if ((p->flags & SEC_EXCLUDE) == 0 && (p->flags & SEC_ALLOC) != 0 && elf_hash_table (info)->dynamic_relocs - && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p)) + && !bed->elf_backend_omit_section_dynsym (info, p)) ++count; } return count; @@ -10041,8 +10041,7 @@ mips_elf_set_plt_sym_value (struct mips_elf_link_hash_entry *h, void *data) and check for any mips16 stub sections that we can discard. */ bool -_bfd_mips_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +_bfd_mips_elf_late_size_sections (struct bfd_link_info *info) { bfd *dynobj; asection *s, *sreldyn; @@ -10054,7 +10053,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, BFD_ASSERT (htab != NULL); /* The .reginfo section has a fixed size. */ - s = bfd_get_section_by_name (output_bfd, ".reginfo"); + s = bfd_get_section_by_name (info->output_bfd, ".reginfo"); if (s != NULL) { bfd_set_section_size (s, sizeof (Elf32_External_RegInfo)); @@ -10062,7 +10061,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, } /* The .MIPS.abiflags section has a fixed size. */ - s = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); + s = bfd_get_section_by_name (info->output_bfd, ".MIPS.abiflags"); if (s != NULL) { bfd_set_section_size (s, sizeof (Elf_External_ABIFlags_v0)); @@ -10070,7 +10069,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, } hti.info = info; - hti.output_bfd = output_bfd; + hti.output_bfd = info->output_bfd; hti.error = false; mips_elf_link_hash_traverse (htab, mips_elf_check_symbols, &hti); if (hti.error) @@ -10088,9 +10087,9 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, s = htab->root.interp; BFD_ASSERT (s != NULL); s->size - = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1; + = strlen (ELF_DYNAMIC_INTERPRETER (info->output_bfd)) + 1; s->contents - = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd); + = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (info->output_bfd); s->alloced = 1; } @@ -10108,7 +10107,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, haven't already in _bfd_elf_create_dynamic_sections. */ if (htab->root.splt && htab->plt_mips_offset + htab->plt_comp_offset != 0) { - bool micromips_p = (MICROMIPS_P (output_bfd) + bool micromips_p = (MICROMIPS_P (info->output_bfd) && !htab->plt_mips_offset); unsigned int other = micromips_p ? STO_MICROMIPS : 0; bfd_vma isa_bit = micromips_p; @@ -10123,9 +10122,9 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, size = 4 * ARRAY_SIZE (mips_vxworks_shared_plt0_entry); else if (htab->root.target_os == is_vxworks) size = 4 * ARRAY_SIZE (mips_vxworks_exec_plt0_entry); - else if (ABI_64_P (output_bfd)) + else if (ABI_64_P (info->output_bfd)) size = 4 * ARRAY_SIZE (mips_n64_exec_plt0_entry); - else if (ABI_N32_P (output_bfd)) + else if (ABI_N32_P (info->output_bfd)) size = 4 * ARRAY_SIZE (mips_n32_exec_plt0_entry); else if (!micromips_p) size = 4 * ARRAY_SIZE (mips_o32_exec_plt0_entry); @@ -10163,9 +10162,9 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, /* Allocate space for global sym dynamic relocs. */ elf_link_hash_traverse (&htab->root, allocate_dynrelocs, info); - mips_elf_estimate_stub_size (output_bfd, info); + mips_elf_estimate_stub_size (info->output_bfd, info); - if (!mips_elf_lay_out_got (output_bfd, info)) + if (!mips_elf_lay_out_got (info->output_bfd, info)) return false; mips_elf_lay_out_lazy_stubs (info); @@ -10199,7 +10198,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, there exists a relocation to a read only section or not. */ outname = bfd_section_name (s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 4); + target = bfd_get_section_by_name (info->output_bfd, outname + 4); if ((target != NULL && (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_ALLOC) != 0) @@ -10226,9 +10225,9 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, { /* We add a room for __rld_map. It will be filled in by the rtld to contain a pointer to the _r_debug structure. */ - s->size += MIPS_ELF_RLD_MAP_SIZE (output_bfd); + s->size += MIPS_ELF_RLD_MAP_SIZE (info->output_bfd); } - else if (SGI_COMPAT (output_bfd) + else if (SGI_COMPAT (info->output_bfd) && startswith (name, ".compact_rel")) s->size += htab->compact_rel_size; else if (s == htab->root.splt) @@ -10236,7 +10235,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, /* If the last PLT entry has a branch delay slot, allocate room for an extra nop to fill the delay slot. This is for CPUs without load interlocking. */ - if (! LOAD_INTERLOCKS_P (output_bfd) + if (! LOAD_INTERLOCKS_P (info->output_bfd) && htab->root.target_os != is_vxworks && s->size > 0) s->size += 4; @@ -10293,12 +10292,12 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, /* The DT_DEBUG entry may be filled in by the dynamic linker and used by the debugger. */ if (bfd_link_executable (info) - && !SGI_COMPAT (output_bfd) + && !SGI_COMPAT (info->output_bfd) && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) return false; if (reltext - && (SGI_COMPAT (output_bfd) + && (SGI_COMPAT (info->output_bfd) || htab->root.target_os == is_vxworks)) info->flags |= DF_TEXTREL; @@ -10380,7 +10379,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, if (IRIX_COMPAT (dynobj) == ict_irix6 && (bfd_get_section_by_name - (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj))) + (info->output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj))) && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0)) return false; } @@ -10400,7 +10399,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd, } #ifdef OBJ_MAYBE_ELF_VXWORKS if (htab->root.target_os == is_vxworks - && !elf_vxworks_add_dynamic_entries (output_bfd, info)) + && !elf_vxworks_add_dynamic_entries (info)) return false; #endif /* OBJ_MAYBE_ELF_VXWORKS */ } @@ -10501,7 +10500,7 @@ mips_reloc_against_discarded_section (bfd *output_bfd, /* Relocate a MIPS ELF section. */ int -_bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +_bfd_mips_elf_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, @@ -10522,7 +10521,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* TRUE if the relocation is a RELA relocation, rather than a REL relocation. */ bool rela_relocation_p = true; - unsigned int r_type = ELF_R_TYPE (output_bfd, rel->r_info); + unsigned int r_type = ELF_R_TYPE (info->output_bfd, rel->r_info); const char *msg; unsigned long r_symndx; asection *sec; @@ -10562,7 +10561,8 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) { - mips_reloc_against_discarded_section (output_bfd, info, input_bfd, + mips_reloc_against_discarded_section (info->output_bfd, info, + input_bfd, input_section, &rel, &relend, rel_reloc, howto, contents); continue; @@ -10631,13 +10631,13 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } else addend = rel->r_addend; - mips_elf_adjust_addend (output_bfd, info, input_bfd, + mips_elf_adjust_addend (info->output_bfd, info, input_bfd, local_syms, local_sections, rel); } if (bfd_link_relocatable (info)) { - if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd) + if (r_type == R_MIPS_64 && ! NEWABI_P (info->output_bfd) && bfd_big_endian (input_bfd)) rel->r_offset -= 4; @@ -10660,7 +10660,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, source of the addend in the final link. */ addend &= howto->src_mask; - if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd)) + if (r_type == R_MIPS_64 && ! NEWABI_P (info->output_bfd)) /* See the comment above about using R_MIPS_64 in the 32-bit ABI. Here, we need to update the addend. It would be possible to get away with just using the R_MIPS_32 reloc @@ -10722,7 +10722,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, use_saved_addend_p = false; /* Figure out what value we are supposed to relocate. */ - switch (mips_elf_calculate_relocation (output_bfd, input_bfd, + switch (mips_elf_calculate_relocation (info->output_bfd, input_bfd, input_section, contents, info, rel, addend, howto, local_syms, local_sections, @@ -10814,7 +10814,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, continue; } - if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd)) + if (r_type == R_MIPS_64 && ! NEWABI_P (info->output_bfd)) /* See the comment above about using R_MIPS_64 in the 32-bit ABI. Until now, we've been using the HOWTO for R_MIPS_32; that calculated the right value. Now, however, we @@ -10983,8 +10983,7 @@ mips_elf_create_la25_stub (void **slot, void *data) adjust it appropriately now. */ static void -mips_elf_irix6_finish_dynamic_symbol (bfd *abfd ATTRIBUTE_UNUSED, - const char *name, Elf_Internal_Sym *sym) +mips_elf_irix6_finish_dynamic_symbol (const char *name, Elf_Internal_Sym *sym) { /* The linker script takes care of providing names and values for these, but we must place them into the right sections. */ @@ -11033,8 +11032,7 @@ mips_elf_irix6_finish_dynamic_symbol (bfd *abfd ATTRIBUTE_UNUSED, dynamic sections here. */ bool -_bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_mips_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -11087,14 +11085,14 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, /* The PLT sequence is not safe for N64 if .got.plt entry's address cannot be loaded in two instructions. */ - if (ABI_64_P (output_bfd) + if (ABI_64_P (info->output_bfd) && ((got_address + 0x80008000) & ~(bfd_vma) 0xffffffff) != 0) { _bfd_error_handler /* xgettext:c-format */ (_("%pB: `%pA' entry VMA of %#" PRIx64 " outside the 32-bit range " "supported; consider using `-Ttext-segment=...'"), - output_bfd, + info->output_bfd, htab->root.sgotplt->output_section, (int64_t) got_address); bfd_set_error (bfd_error_no_error); @@ -11104,10 +11102,10 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, /* Initially point the .got.plt entry at the PLT header. */ loc = (htab->root.sgotplt->contents + got_index * MIPS_ELF_GOT_SIZE (dynobj)); - if (ABI_64_P (output_bfd)) - bfd_put_64 (output_bfd, header_address, loc); + if (ABI_64_P (info->output_bfd)) + bfd_put_64 (info->output_bfd, header_address, loc); else - bfd_put_32 (output_bfd, header_address, loc); + bfd_put_32 (info->output_bfd, header_address, loc); /* Now handle the PLT itself. First the standard entry (the order does not matter, we just have to pick one). */ @@ -11124,29 +11122,30 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, loc = htab->root.splt->contents + plt_offset; /* Pick the load opcode. */ - load = MIPS_ELF_LOAD_WORD (output_bfd); + load = MIPS_ELF_LOAD_WORD (info->output_bfd); /* Fill in the PLT entry itself. */ - if (MIPSR6_P (output_bfd)) + if (MIPSR6_P (info->output_bfd)) plt_entry = htab->compact_branches ? mipsr6_exec_plt_entry_compact : mipsr6_exec_plt_entry; else plt_entry = mips_exec_plt_entry; - bfd_put_32 (output_bfd, plt_entry[0] | got_address_high, loc); - bfd_put_32 (output_bfd, plt_entry[1] | got_address_low | load, + bfd_put_32 (info->output_bfd, plt_entry[0] | got_address_high, loc); + bfd_put_32 (info->output_bfd, plt_entry[1] | got_address_low | load, loc + 4); - if (! LOAD_INTERLOCKS_P (output_bfd) - || (MIPSR6_P (output_bfd) && htab->compact_branches)) + if (! LOAD_INTERLOCKS_P (info->output_bfd) + || (MIPSR6_P (info->output_bfd) && htab->compact_branches)) { - bfd_put_32 (output_bfd, plt_entry[2] | got_address_low, loc + 8); - bfd_put_32 (output_bfd, plt_entry[3], loc + 12); + bfd_put_32 (info->output_bfd, plt_entry[2] | got_address_low, + loc + 8); + bfd_put_32 (info->output_bfd, plt_entry[3], loc + 12); } else { - bfd_put_32 (output_bfd, plt_entry[3], loc + 8); - bfd_put_32 (output_bfd, plt_entry[2] | got_address_low, + bfd_put_32 (info->output_bfd, plt_entry[3], loc + 8); + bfd_put_32 (info->output_bfd, plt_entry[2] | got_address_low, loc + 12); } } @@ -11165,30 +11164,30 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, loc = htab->root.splt->contents + plt_offset; /* Fill in the PLT entry itself. */ - if (!MICROMIPS_P (output_bfd)) + if (!MICROMIPS_P (info->output_bfd)) { const bfd_vma *plt_entry = mips16_o32_exec_plt_entry; - bfd_put_16 (output_bfd, plt_entry[0], loc); - bfd_put_16 (output_bfd, plt_entry[1], loc + 2); - bfd_put_16 (output_bfd, plt_entry[2], loc + 4); - bfd_put_16 (output_bfd, plt_entry[3], loc + 6); - bfd_put_16 (output_bfd, plt_entry[4], loc + 8); - bfd_put_16 (output_bfd, plt_entry[5], loc + 10); - bfd_put_32 (output_bfd, got_address, loc + 12); + bfd_put_16 (info->output_bfd, plt_entry[0], loc); + bfd_put_16 (info->output_bfd, plt_entry[1], loc + 2); + bfd_put_16 (info->output_bfd, plt_entry[2], loc + 4); + bfd_put_16 (info->output_bfd, plt_entry[3], loc + 6); + bfd_put_16 (info->output_bfd, plt_entry[4], loc + 8); + bfd_put_16 (info->output_bfd, plt_entry[5], loc + 10); + bfd_put_32 (info->output_bfd, got_address, loc + 12); } else if (htab->insn32) { const bfd_vma *plt_entry = micromips_insn32_o32_exec_plt_entry; - bfd_put_16 (output_bfd, plt_entry[0], loc); - bfd_put_16 (output_bfd, got_address_high, loc + 2); - bfd_put_16 (output_bfd, plt_entry[2], loc + 4); - bfd_put_16 (output_bfd, got_address_low, loc + 6); - bfd_put_16 (output_bfd, plt_entry[4], loc + 8); - bfd_put_16 (output_bfd, plt_entry[5], loc + 10); - bfd_put_16 (output_bfd, plt_entry[6], loc + 12); - bfd_put_16 (output_bfd, got_address_low, loc + 14); + bfd_put_16 (info->output_bfd, plt_entry[0], loc); + bfd_put_16 (info->output_bfd, got_address_high, loc + 2); + bfd_put_16 (info->output_bfd, plt_entry[2], loc + 4); + bfd_put_16 (info->output_bfd, got_address_low, loc + 6); + bfd_put_16 (info->output_bfd, plt_entry[4], loc + 8); + bfd_put_16 (info->output_bfd, plt_entry[5], loc + 10); + bfd_put_16 (info->output_bfd, plt_entry[6], loc + 12); + bfd_put_16 (info->output_bfd, got_address_low, loc + 14); } else { @@ -11209,25 +11208,26 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, /* xgettext:c-format */ (_("%pB: `%pA' offset of %" PRId64 " from `%pA' " "beyond the range of ADDIUPC"), - output_bfd, + info->output_bfd, htab->root.sgotplt->output_section, (int64_t) gotpc_offset, htab->root.splt->output_section); bfd_set_error (bfd_error_no_error); return false; } - bfd_put_16 (output_bfd, + bfd_put_16 (info->output_bfd, plt_entry[0] | ((gotpc_offset >> 18) & 0x7f), loc); - bfd_put_16 (output_bfd, (gotpc_offset >> 2) & 0xffff, loc + 2); - bfd_put_16 (output_bfd, plt_entry[2], loc + 4); - bfd_put_16 (output_bfd, plt_entry[3], loc + 6); - bfd_put_16 (output_bfd, plt_entry[4], loc + 8); - bfd_put_16 (output_bfd, plt_entry[5], loc + 10); + bfd_put_16 (info->output_bfd, (gotpc_offset >> 2) & 0xffff, + loc + 2); + bfd_put_16 (info->output_bfd, plt_entry[2], loc + 4); + bfd_put_16 (info->output_bfd, plt_entry[3], loc + 6); + bfd_put_16 (info->output_bfd, plt_entry[4], loc + 8); + bfd_put_16 (info->output_bfd, plt_entry[5], loc + 10); } } /* Emit an R_MIPS_JUMP_SLOT relocation against the .got.plt entry. */ - mips_elf_output_dynamic_relocation (output_bfd, htab->root.srelplt, + mips_elf_output_dynamic_relocation (info->output_bfd, htab->root.srelplt, got_index - 2, h->dynindx, R_MIPS_JUMP_SLOT, got_address); @@ -11248,7 +11248,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, if (h->plt.plist != NULL && h->plt.plist->stub_offset != MINUS_ONE) { /* We've decided to create a lazy-binding stub. */ - bool micromips_p = MICROMIPS_P (output_bfd); + bool micromips_p = MICROMIPS_P (info->output_bfd); unsigned int other = micromips_p ? STO_MICROMIPS : 0; bfd_vma stub_size = htab->function_stub_size; bfd_byte stub[MIPS_FUNCTION_STUB_BIG_SIZE]; @@ -11275,7 +11275,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, { _bfd_error_handler (_("%pB: cannot handle more than %d dynamic symbols"), - output_bfd, 0x7fffffff); + info->output_bfd, 0x7fffffff); bfd_set_error (bfd_error_bad_value); return false; } @@ -11284,92 +11284,95 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, if (micromips_p) { idx = 0; - bfd_put_micromips_32 (output_bfd, STUB_LW_MICROMIPS (output_bfd), + bfd_put_micromips_32 (info->output_bfd, + STUB_LW_MICROMIPS (info->output_bfd), stub + idx); idx += 4; if (htab->insn32) { - bfd_put_micromips_32 (output_bfd, + bfd_put_micromips_32 (info->output_bfd, STUB_MOVE32_MICROMIPS, stub + idx); idx += 4; } else { - bfd_put_16 (output_bfd, STUB_MOVE_MICROMIPS, stub + idx); + bfd_put_16 (info->output_bfd, STUB_MOVE_MICROMIPS, stub + idx); idx += 2; } if (stub_size == stub_big_size) { long dynindx_hi = (h->dynindx >> 16) & 0x7fff; - bfd_put_micromips_32 (output_bfd, + bfd_put_micromips_32 (info->output_bfd, STUB_LUI_MICROMIPS (dynindx_hi), stub + idx); idx += 4; } if (htab->insn32) { - bfd_put_micromips_32 (output_bfd, STUB_JALR32_MICROMIPS, + bfd_put_micromips_32 (info->output_bfd, STUB_JALR32_MICROMIPS, stub + idx); idx += 4; } else { - bfd_put_16 (output_bfd, STUB_JALR_MICROMIPS, stub + idx); + bfd_put_16 (info->output_bfd, STUB_JALR_MICROMIPS, stub + idx); idx += 2; } /* If a large stub is not required and sign extension is not a problem, then use legacy code in the stub. */ if (stub_size == stub_big_size) - bfd_put_micromips_32 (output_bfd, + bfd_put_micromips_32 (info->output_bfd, STUB_ORI_MICROMIPS (h->dynindx & 0xffff), stub + idx); else if (h->dynindx & ~0x7fff) - bfd_put_micromips_32 (output_bfd, + bfd_put_micromips_32 (info->output_bfd, STUB_LI16U_MICROMIPS (h->dynindx & 0xffff), stub + idx); else - bfd_put_micromips_32 (output_bfd, - STUB_LI16S_MICROMIPS (output_bfd, + bfd_put_micromips_32 (info->output_bfd, + STUB_LI16S_MICROMIPS (info->output_bfd, h->dynindx), stub + idx); } else { idx = 0; - bfd_put_32 (output_bfd, STUB_LW (output_bfd), stub + idx); + bfd_put_32 (info->output_bfd, STUB_LW (info->output_bfd), stub + idx); idx += 4; - bfd_put_32 (output_bfd, STUB_MOVE, stub + idx); + bfd_put_32 (info->output_bfd, STUB_MOVE, stub + idx); idx += 4; if (stub_size == stub_big_size) { - bfd_put_32 (output_bfd, STUB_LUI ((h->dynindx >> 16) & 0x7fff), + bfd_put_32 (info->output_bfd, + STUB_LUI ((h->dynindx >> 16) & 0x7fff), stub + idx); idx += 4; } - if (!(MIPSR6_P (output_bfd) && htab->compact_branches)) + if (!(MIPSR6_P (info->output_bfd) && htab->compact_branches)) { - bfd_put_32 (output_bfd, STUB_JALR, stub + idx); + bfd_put_32 (info->output_bfd, STUB_JALR, stub + idx); idx += 4; } /* If a large stub is not required and sign extension is not a problem, then use legacy code in the stub. */ if (stub_size == stub_big_size) - bfd_put_32 (output_bfd, STUB_ORI (h->dynindx & 0xffff), + bfd_put_32 (info->output_bfd, STUB_ORI (h->dynindx & 0xffff), stub + idx); else if (h->dynindx & ~0x7fff) - bfd_put_32 (output_bfd, STUB_LI16U (h->dynindx & 0xffff), + bfd_put_32 (info->output_bfd, STUB_LI16U (h->dynindx & 0xffff), stub + idx); else - bfd_put_32 (output_bfd, STUB_LI16S (output_bfd, h->dynindx), + bfd_put_32 (info->output_bfd, + STUB_LI16S (info->output_bfd, h->dynindx), stub + idx); idx += 4; - if (MIPSR6_P (output_bfd) && htab->compact_branches) - bfd_put_32 (output_bfd, STUB_JALRC, stub + idx); + if (MIPSR6_P (info->output_bfd) && htab->compact_branches) + bfd_put_32 (info->output_bfd, STUB_JALRC, stub + idx); } BFD_ASSERT (h->plt.plist->stub_offset <= htab->sstubs->size); @@ -11417,8 +11420,8 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, bfd_vma value; value = sym->st_value; - offset = mips_elf_primary_global_got_index (output_bfd, info, h); - MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset); + offset = mips_elf_primary_global_got_index (info->output_bfd, info, h); + MIPS_ELF_PUT_WORD (info->output_bfd, value, sgot->contents + offset); } if (hmips->global_got_area != GGA_NONE && g->next) @@ -11429,7 +11432,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, gg = g; - e.abfd = output_bfd; + e.abfd = info->output_bfd; e.symndx = -1; e.d.h = hmips; e.tls_type = GOT_TLS_NONE; @@ -11456,21 +11459,22 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, Elf_Internal_Rela rel[3]; memset (rel, 0, sizeof (rel)); - if (ABI_64_P (output_bfd)) - rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_64); + if (ABI_64_P (info->output_bfd)) + rel[0].r_info = ELF_R_INFO (info->output_bfd, 0, R_MIPS_64); else - rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_32); + rel[0].r_info = ELF_R_INFO (info->output_bfd, 0, R_MIPS_32); rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset; entry = 0; if (! (mips_elf_create_dynamic_relocation - (output_bfd, info, rel, + (info->output_bfd, info, rel, e.d.h, NULL, sym->st_value, &entry, sgot))) return false; } else entry = sym->st_value; - MIPS_ELF_PUT_WORD (output_bfd, entry, sgot->contents + offset); + MIPS_ELF_PUT_WORD (info->output_bfd, entry, + sgot->contents + offset); } } } @@ -11487,7 +11491,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); sym->st_value = 1; } - else if (SGI_COMPAT (output_bfd)) + else if (SGI_COMPAT (info->output_bfd)) { if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0 || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0) @@ -11526,13 +11530,13 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, symval = (h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset + h->root.u.def.value); - mips_elf_output_dynamic_relocation (output_bfd, s, s->reloc_count++, + mips_elf_output_dynamic_relocation (info->output_bfd, s, s->reloc_count++, h->dynindx, R_MIPS_COPY, symval); } /* Handle the IRIX6-specific symbols. */ - if (IRIX_COMPAT (output_bfd) == ict_irix6) - mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym); + if (IRIX_COMPAT (info->output_bfd) == ict_irix6) + mips_elf_irix6_finish_dynamic_symbol (name, sym); /* Keep dynamic compressed symbols odd. This allows the dynamic linker to treat compressed symbols like any other. */ @@ -11553,8 +11557,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, /* Likewise, for VxWorks. */ bool -_bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_mips_vxworks_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -11594,7 +11597,7 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, /* Calculate the address of the .got.plt entry. */ got_address = (htab->root.sgotplt->output_section->vma + htab->root.sgotplt->output_offset - + gotplt_index * MIPS_ELF_GOT_SIZE (output_bfd)); + + gotplt_index * MIPS_ELF_GOT_SIZE (info->output_bfd)); /* Calculate the offset of the .got.plt entry from _GLOBAL_OFFSET_TABLE_. */ @@ -11605,9 +11608,9 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, branch_offset = -(plt_offset / 4 + 1) & 0xffff; /* Fill in the initial value of the .got.plt entry. */ - bfd_put_32 (output_bfd, plt_address, + bfd_put_32 (info->output_bfd, plt_address, (htab->root.sgotplt->contents - + gotplt_index * MIPS_ELF_GOT_SIZE (output_bfd))); + + gotplt_index * MIPS_ELF_GOT_SIZE (info->output_bfd))); /* Find out where the .plt entry should go. */ loc = htab->root.splt->contents + plt_offset; @@ -11615,8 +11618,8 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, if (bfd_link_pic (info)) { plt_entry = mips_vxworks_shared_plt_entry; - bfd_put_32 (output_bfd, plt_entry[0] | branch_offset, loc); - bfd_put_32 (output_bfd, plt_entry[1] | gotplt_index, loc + 4); + bfd_put_32 (info->output_bfd, plt_entry[0] | branch_offset, loc); + bfd_put_32 (info->output_bfd, plt_entry[1] | gotplt_index, loc + 4); } else { @@ -11626,14 +11629,16 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, got_address_high = ((got_address + 0x8000) >> 16) & 0xffff; got_address_low = got_address & 0xffff; - bfd_put_32 (output_bfd, plt_entry[0] | branch_offset, loc); - bfd_put_32 (output_bfd, plt_entry[1] | gotplt_index, loc + 4); - bfd_put_32 (output_bfd, plt_entry[2] | got_address_high, loc + 8); - bfd_put_32 (output_bfd, plt_entry[3] | got_address_low, loc + 12); - bfd_put_32 (output_bfd, plt_entry[4], loc + 16); - bfd_put_32 (output_bfd, plt_entry[5], loc + 20); - bfd_put_32 (output_bfd, plt_entry[6], loc + 24); - bfd_put_32 (output_bfd, plt_entry[7], loc + 28); + bfd_put_32 (info->output_bfd, plt_entry[0] | branch_offset, loc); + bfd_put_32 (info->output_bfd, plt_entry[1] | gotplt_index, loc + 4); + bfd_put_32 (info->output_bfd, plt_entry[2] | got_address_high, + loc + 8); + bfd_put_32 (info->output_bfd, plt_entry[3] | got_address_low, + loc + 12); + bfd_put_32 (info->output_bfd, plt_entry[4], loc + 16); + bfd_put_32 (info->output_bfd, plt_entry[5], loc + 20); + bfd_put_32 (info->output_bfd, plt_entry[6], loc + 24); + bfd_put_32 (info->output_bfd, plt_entry[7], loc + 28); loc = (htab->srelplt2->contents + (gotplt_index * 3 + 2) * sizeof (Elf32_External_Rela)); @@ -11642,20 +11647,20 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, rel.r_offset = got_address; rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_MIPS_32); rel.r_addend = plt_offset; - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); /* Emit a relocation for the lui of %hi(<.got.plt slot>). */ loc += sizeof (Elf32_External_Rela); rel.r_offset = plt_address + 8; rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_HI16); rel.r_addend = got_offset; - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); /* Emit a relocation for the addiu of %lo(<.got.plt slot>). */ loc += sizeof (Elf32_External_Rela); rel.r_offset += 4; rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_LO16); - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); } /* Emit an R_MIPS_JUMP_SLOT relocation against the .got.plt entry. */ @@ -11664,7 +11669,7 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, rel.r_offset = got_address; rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_JUMP_SLOT); rel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); if (!h->def_regular) sym->st_shndx = SHN_UNDEF; @@ -11685,8 +11690,9 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, asection *s; /* Install the symbol value in the GOT. */ - offset = mips_elf_primary_global_got_index (output_bfd, info, h); - MIPS_ELF_PUT_WORD (output_bfd, sym->st_value, sgot->contents + offset); + offset = mips_elf_primary_global_got_index (info->output_bfd, info, h); + MIPS_ELF_PUT_WORD (info->output_bfd, sym->st_value, + sgot->contents + offset); /* Add a dynamic relocation for it. */ s = mips_elf_rel_dyn_section (info, false); @@ -11718,7 +11724,7 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, else srel = htab->root.srelbss; loc = srel->contents + srel->reloc_count * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + bfd_elf32_swap_reloca_out (info->output_bfd, &rel, loc); ++srel->reloc_count; } @@ -11940,8 +11946,7 @@ mips_vxworks_finish_shared_plt (bfd *output_bfd, struct bfd_link_info *info) /* Finish up the dynamic sections. */ bool -_bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_mips_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -11968,7 +11973,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, BFD_ASSERT (sdyn != NULL); BFD_ASSERT (gg != NULL); - g = mips_elf_bfd_got (output_bfd, false); + g = mips_elf_bfd_got (info->output_bfd, false); BFD_ASSERT (g != NULL); for (b = sdyn->contents; @@ -12041,7 +12046,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_MIPS_BASE_ADDRESS: - s = output_bfd->sections; + s = info->output_bfd->sections; BFD_ASSERT (s != NULL); dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff; break; @@ -12054,7 +12059,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, /* The index into the dynamic symbol table which is the entry of the first external symbol that is not referenced within the same object. */ - dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1; + dyn.d_un.d_val = bfd_count_sections (info->output_bfd) + 1; break; case DT_MIPS_GOTSYM: @@ -12070,7 +12075,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, case DT_MIPS_SYMTABNO: name = ".dynsym"; - elemsize = MIPS_ELF_SYM_SIZE (output_bfd); + elemsize = MIPS_ELF_SYM_SIZE (info->output_bfd); s = bfd_get_linker_section (dynobj, name); if (s != NULL) @@ -12127,7 +12132,8 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, case DT_MIPS_OPTIONS: s = (bfd_get_section_by_name - (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd))); + (info->output_bfd, + MIPS_ELF_OPTIONS_SECTION_NAME (info->output_bfd))); dyn.d_un.d_ptr = s->vma; break; @@ -12179,7 +12185,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, swap_out_p = false; #ifdef OBJ_MAYBE_ELF_VXWORKS if (htab->root.target_os == is_vxworks - && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn)) + && elf_vxworks_finish_dynamic_entry (info->output_bfd, &dyn)) swap_out_p = true; #endif /* OBJ_MAYBE_ELF_VXWORKS */ break; @@ -12211,27 +12217,28 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, loader and contains the shared library identifier. The third is also initialized by the loader and points to the lazy resolution stub. */ - MIPS_ELF_PUT_WORD (output_bfd, + MIPS_ELF_PUT_WORD (info->output_bfd, sdyn->output_offset + sdyn->output_section->vma, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, 0, - sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); - MIPS_ELF_PUT_WORD (output_bfd, 0, + MIPS_ELF_PUT_WORD (info->output_bfd, 0, + sgot->contents + MIPS_ELF_GOT_SIZE (info->output_bfd)); + MIPS_ELF_PUT_WORD (info->output_bfd, 0, sgot->contents - + 2 * MIPS_ELF_GOT_SIZE (output_bfd)); + + 2 * MIPS_ELF_GOT_SIZE (info->output_bfd)); } else { /* The first entry of the global offset table will be filled at runtime. The second entry will be used by some runtime loaders. This isn't the case of IRIX rld. */ - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, MIPS_ELF_GNU_GOT1_MASK (output_bfd), - sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); + MIPS_ELF_PUT_WORD (info->output_bfd, 0, sgot->contents); + MIPS_ELF_PUT_WORD (info->output_bfd, + MIPS_ELF_GNU_GOT1_MASK (info->output_bfd), + sgot->contents + MIPS_ELF_GOT_SIZE (info->output_bfd)); } elf_section_data (sgot->output_section)->this_hdr.sh_entsize - = MIPS_ELF_GOT_SIZE (output_bfd); + = MIPS_ELF_GOT_SIZE (info->output_bfd); } /* Generate dynamic relocations for the non-primary gots. */ @@ -12241,18 +12248,19 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, bfd_vma addend = 0; memset (rel, 0, sizeof (rel)); - rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_REL32); + rel[0].r_info = ELF_R_INFO (info->output_bfd, 0, R_MIPS_REL32); for (g = gg->next; g->next != gg; g = g->next) { bfd_vma got_index = g->next->local_gotno + g->next->global_gotno + g->next->tls_gotno; - MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents - + got_index++ * MIPS_ELF_GOT_SIZE (output_bfd)); - MIPS_ELF_PUT_WORD (output_bfd, MIPS_ELF_GNU_GOT1_MASK (output_bfd), + MIPS_ELF_PUT_WORD (info->output_bfd, 0, sgot->contents + + got_index++ * MIPS_ELF_GOT_SIZE (info->output_bfd)); + MIPS_ELF_PUT_WORD (info->output_bfd, + MIPS_ELF_GNU_GOT1_MASK (info->output_bfd), sgot->contents - + got_index++ * MIPS_ELF_GOT_SIZE (output_bfd)); + + got_index++ * MIPS_ELF_GOT_SIZE (info->output_bfd)); if (! bfd_link_pic (info)) continue; @@ -12264,9 +12272,9 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, continue; rel[0].r_offset = rel[1].r_offset = rel[2].r_offset - = got_index * MIPS_ELF_GOT_SIZE (output_bfd); + = got_index * MIPS_ELF_GOT_SIZE (info->output_bfd); if (!(mips_elf_create_dynamic_relocation - (output_bfd, info, rel, NULL, + (info->output_bfd, info, rel, NULL, bfd_abs_section_ptr, 0, &addend, sgot))) return false; @@ -12308,7 +12316,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, are trailing null entries. */ s = mips_elf_rel_dyn_section (info, false); dyn.d_un.d_val = (s->reloc_count - * (ABI_64_P (output_bfd) + * (ABI_64_P (info->output_bfd) ? sizeof (Elf64_Mips_External_Rel) : sizeof (Elf32_External_Rel))); /* Adjust the section size too. Tools like the prelinker @@ -12333,7 +12341,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, asection *s; Elf32_compact_rel cpt; - if (SGI_COMPAT (output_bfd)) + if (SGI_COMPAT (info->output_bfd)) { /* Write .compact_rel section out. */ s = bfd_get_linker_section (dynobj, ".compact_rel"); @@ -12346,7 +12354,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, + sizeof (Elf32_External_compact_rel)); cpt.reserved0 = 0; cpt.reserved1 = 0; - bfd_elf32_swap_compact_rel_out (output_bfd, &cpt, + bfd_elf32_swap_compact_rel_out (info->output_bfd, &cpt, ((Elf32_External_compact_rel *) s->contents)); @@ -12372,11 +12380,11 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, { s = mips_elf_rel_dyn_section (info, false); if (s != NULL - && s->size > (bfd_vma)2 * MIPS_ELF_REL_SIZE (output_bfd)) + && s->size > (bfd_vma)2 * MIPS_ELF_REL_SIZE (info->output_bfd)) { - reldyn_sorting_bfd = output_bfd; + reldyn_sorting_bfd = info->output_bfd; - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) qsort ((Elf64_External_Rel *) s->contents + 1, s->reloc_count - 1, sizeof (Elf64_Mips_External_Rel), sort_dynamic_relocs_64); @@ -12393,14 +12401,14 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, if (htab->root.target_os == is_vxworks) { if (bfd_link_pic (info)) - mips_vxworks_finish_shared_plt (output_bfd, info); + mips_vxworks_finish_shared_plt (info->output_bfd, info); else - mips_vxworks_finish_exec_plt (output_bfd, info); + mips_vxworks_finish_exec_plt (info->output_bfd, info); } else { BFD_ASSERT (!bfd_link_pic (info)); - if (!mips_finish_exec_plt (output_bfd, info)) + if (!mips_finish_exec_plt (info->output_bfd, info)) return false; } } diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index e39e0b15478..b624d0df112 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -69,18 +69,18 @@ extern bool _bfd_mips_elf_check_relocs extern bool _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *, struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN; extern bool _bfd_mips_elf_late_size_sections - (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern int _bfd_mips_elf_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 **) ATTRIBUTE_HIDDEN; extern bool _bfd_mips_elf_finish_dynamic_symbol - (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + (struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *) ATTRIBUTE_HIDDEN; extern bool _bfd_mips_vxworks_finish_dynamic_symbol - (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + (struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *) ATTRIBUTE_HIDDEN; extern bool _bfd_mips_elf_finish_dynamic_sections - (bfd *, struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; extern bool _bfd_mips_elf_sort_relocs_p (asection *) ATTRIBUTE_HIDDEN; extern void _bfd_mips_final_write_processing diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 138e639591a..14d8fb9986f 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -2372,8 +2372,7 @@ allocate_local_dynrelocs (void **slot, void *inf) omitted when creating a shared library. */ bool -_bfd_sparc_elf_omit_section_dynsym (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_sparc_elf_omit_section_dynsym (struct bfd_link_info *info, asection *p) { /* We keep the .got section symbol so that explicit relocations @@ -2382,14 +2381,13 @@ _bfd_sparc_elf_omit_section_dynsym (bfd *output_bfd, if (strcmp (p->name, ".got") == 0) return false; - return _bfd_elf_omit_section_dynsym_default (output_bfd, info, p); + return _bfd_elf_omit_section_dynsym_default (info, p); } /* Set the sizes of the dynamic sections. */ bool -_bfd_sparc_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +_bfd_sparc_elf_late_size_sections (struct bfd_link_info *info) { struct _bfd_sparc_elf_link_hash_table *htab; bfd *dynobj; @@ -2512,7 +2510,7 @@ _bfd_sparc_elf_late_size_sections (bfd *output_bfd, /* Allocate .plt and .got entries, and space for local symbols. */ htab_traverse (htab->loc_hash_table, allocate_local_dynrelocs, info); - if (! ABI_64_P (output_bfd) + if (! ABI_64_P (info->output_bfd) && htab->elf.target_os != is_vxworks && elf_hash_table (info)->dynamic_sections_created) { @@ -2600,11 +2598,10 @@ _bfd_sparc_elf_late_size_sections (bfd *output_bfd, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (!_bfd_elf_maybe_vxworks_add_dynamic_tags (output_bfd, info, - true)) + if (!_bfd_elf_maybe_vxworks_add_dynamic_tags (info, true)) return false; - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) { int reg; struct _bfd_sparc_elf_app_reg * app_regs; @@ -2645,7 +2642,7 @@ _bfd_sparc_elf_late_size_sections (bfd *output_bfd, entry->isym.st_shndx = app_regs [reg].shndx; entry->isym.st_target_internal = 0; entry->next = NULL; - entry->input_bfd = output_bfd; + entry->input_bfd = info->output_bfd; entry->input_indx = -1; if (eht->dynlocal == NULL) @@ -2770,8 +2767,7 @@ gdop_relative_offset_ok (struct bfd_link_info *info, /* Relocate a SPARC ELF section. */ int -_bfd_sparc_elf_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_sparc_elf_relocate_section (struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2810,7 +2806,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, ".tls_vars")); rel = relocs; - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) num_relocs = NUM_SHDR_ENTRIES (_bfd_elf_single_rel_hdr (input_section)); else num_relocs = input_section->reloc_count; @@ -2852,7 +2848,8 @@ _bfd_sparc_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); if (!bfd_link_relocatable (info) && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC) @@ -2972,7 +2969,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, Elf_Internal_Rela outrel; 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 (offset == (bfd_vma) -1 @@ -2999,7 +2996,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, outrel.r_addend = rel->r_addend; } - sparc_elf_append_rela (output_bfd, sreloc, &outrel); + sparc_elf_append_rela (info->output_bfd, sreloc, &outrel); continue; } @@ -3057,7 +3054,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, /* {ld,ldx} [%rs1 + %rs2], %rd --> add %rs1, %rs2, %rd */ relocation = 0x80000000 | (insn & 0x3e07c01f); - bfd_put_32 (output_bfd, relocation, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, relocation, + contents + rel->r_offset); /* If the symbol is global but not dynamic, an .rela.* slot has been allocated for it in the GOT so output R_SPARC_NONE here, @@ -3077,7 +3075,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, BFD_ASSERT (s != NULL); memset (&outrel, 0, sizeof outrel); - sparc_elf_append_rela (output_bfd, s, &outrel); + sparc_elf_append_rela (info->output_bfd, s, &outrel); h->got.offset |= 1; } } @@ -3140,7 +3138,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, && bfd_link_pic (info)) relative_reloc = true; else - SPARC_ELF_PUT_WORD (htab, output_bfd, relocation, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, relocation, htab->elf.sgot->contents + off); h->got.offset |= 1; } @@ -3167,7 +3165,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, if (bfd_link_pic (info)) relative_reloc = true; else - SPARC_ELF_PUT_WORD (htab, output_bfd, relocation, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, relocation, htab->elf.sgot->contents + off); local_got_offsets[r_symndx] |= 1; } @@ -3186,13 +3184,13 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, 0, R_SPARC_RELATIVE); outrel.r_addend = relocation; - sparc_elf_append_rela (output_bfd, s, &outrel); + sparc_elf_append_rela (info->output_bfd, s, &outrel); /* Versions of glibc ld.so at least up to 2.26 wrongly add the section contents to the value calculated for a RELATIVE reloc. Zero the contents to work around this bug. */ relocation = 0; - SPARC_ELF_PUT_WORD (htab, output_bfd, relocation, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, relocation, htab->elf.sgot->contents + off); } @@ -3218,7 +3216,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, /* Relocation is to the entry for this symbol in the procedure linkage table. */ - if (! ABI_64_P (output_bfd)) + if (! ABI_64_P (info->output_bfd)) { /* The Solaris native assembler will generate a WPLT30 reloc for a local symbol if you assemble a call from one @@ -3334,8 +3332,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, skip = 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) @@ -3401,8 +3399,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, } else { - if ( (!ABI_64_P (output_bfd) && r_type == R_SPARC_32) - || (ABI_64_P (output_bfd) && r_type == R_SPARC_64)) + if ( (!ABI_64_P (info->output_bfd) && r_type == R_SPARC_32) + || (ABI_64_P (info->output_bfd) && r_type == R_SPARC_64)) { outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, 0, R_SPARC_RELATIVE); @@ -3460,7 +3458,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, } } - sparc_elf_append_rela (output_bfd, sreloc, &outrel); + sparc_elf_append_rela (info->output_bfd, sreloc, &outrel); /* This reloc will be computed at runtime, so there's no need to do anything now. */ @@ -3503,9 +3501,10 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, { /* Change add into xor. */ relocation = tpoff (info, relocation); - bfd_put_32 (output_bfd, (bfd_get_32 (input_bfd, - contents + rel->r_offset) - | 0x80182000), contents + rel->r_offset); + bfd_put_32 (info->output_bfd, + bfd_get_32 (input_bfd, + contents + rel->r_offset) | 0x80182000, + contents + rel->r_offset); break; } @@ -3535,7 +3534,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, if (htab->elf.srelgot == NULL) abort (); - SPARC_ELF_PUT_WORD (htab, output_bfd, 0, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, 0, htab->elf.sgot->contents + off); outrel.r_offset = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); @@ -3550,7 +3549,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, else outrel.r_addend = 0; outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, dr_type); - sparc_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + sparc_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); if (r_type == R_SPARC_TLS_GD_HI22 || r_type == R_SPARC_TLS_GD_LO10) @@ -3558,26 +3558,26 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - SPARC_ELF_PUT_WORD (htab, output_bfd, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, relocation - dtpoff_base (info), (htab->elf.sgot->contents + off + SPARC_ELF_WORD_BYTES (htab))); } else { - SPARC_ELF_PUT_WORD (htab, output_bfd, 0, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, 0, (htab->elf.sgot->contents + off + SPARC_ELF_WORD_BYTES (htab))); outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, SPARC_ELF_DTPOFF_RELOC (htab)); outrel.r_offset += SPARC_ELF_WORD_BYTES (htab); - sparc_elf_append_rela (output_bfd, htab->elf.srelgot, + sparc_elf_append_rela (info->output_bfd, htab->elf.srelgot, &outrel); } } else if (dr_type == SPARC_ELF_DTPMOD_RELOC (htab)) { - SPARC_ELF_PUT_WORD (htab, output_bfd, 0, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, 0, (htab->elf.sgot->contents + off + SPARC_ELF_WORD_BYTES (htab))); } @@ -3596,7 +3596,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, /* LD -> LE */ if (bfd_link_executable (info)) { - bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, SPARC_NOP, contents + rel->r_offset); continue; } off = htab->tls_ldm_got.offset; @@ -3626,8 +3626,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, { Elf_Internal_Rela outrel; bfd_vma 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 (offset == (bfd_vma) -1 || offset == (bfd_vma) -2) memset (&outrel, 0, sizeof outrel); else @@ -3641,7 +3641,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, } BFD_ASSERT (sreloc != NULL); - sparc_elf_append_rela (output_bfd, sreloc, &outrel); + sparc_elf_append_rela (info->output_bfd, sreloc, &outrel); continue; } relocation = tpoff (info, relocation); @@ -3652,7 +3652,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, if (bfd_link_executable (info)) { /* mov %g0, %o0 */ - bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, 0x90100000, + contents + rel->r_offset); continue; } /* Fall through */ @@ -3674,7 +3675,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, /* GD -> LE */ if (bfd_link_executable (info) && (h == NULL || h->dynindx == -1)) { - bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, SPARC_NOP, + contents + rel->r_offset); continue; } @@ -3696,9 +3698,11 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, add is 0x80000000 | (rd << 25) | (rs1 << 14) | rs2, ld is 0xc0000000 | (rd << 25) | (rs1 << 14) | rs2, ldx is 0xc0580000 | (rd << 25) | (rs1 << 14) | rs2. */ - bfd_put_32 (output_bfd, insn | (ABI_64_P (output_bfd) ? 0xc0580000 : 0xc0000000), + bfd_put_32 (info->output_bfd, + insn | (ABI_64_P (info->output_bfd) + ? 0xc0580000 : 0xc0000000), contents + rel->r_offset); - bfd_put_32 (output_bfd, 0x9001c008, + bfd_put_32 (info->output_bfd, 0x9001c008, contents + rel->r_offset + 4); rel++; continue; @@ -3709,9 +3713,9 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, __tls_get_addr into place. So we have to transpose the delay slot with the add we patch in. */ insn = bfd_get_32 (input_bfd, contents + rel->r_offset + 4); - bfd_put_32 (output_bfd, insn, + bfd_put_32 (info->output_bfd, insn, contents + rel->r_offset); - bfd_put_32 (output_bfd, 0x9001c008, + bfd_put_32 (info->output_bfd, 0x9001c008, contents + rel->r_offset + 4); rel2 = rel; @@ -3754,15 +3758,17 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, if (bfd_link_executable (info) && (h == NULL || h->dynindx == -1)) relocation = (insn & ~0x7c000) | 0x1c000; else - relocation = insn | (ABI_64_P (output_bfd) ? 0xc0580000 : 0xc0000000); - bfd_put_32 (output_bfd, relocation, contents + rel->r_offset); + relocation = insn | (ABI_64_P (info->output_bfd) + ? 0xc0580000 : 0xc0000000); + bfd_put_32 (info->output_bfd, relocation, + contents + rel->r_offset); } continue; case R_SPARC_TLS_LDM_ADD: /* LD -> LE */ if (bfd_link_executable (info)) - bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, SPARC_NOP, contents + rel->r_offset); continue; case R_SPARC_TLS_LDO_ADD: @@ -3772,7 +3778,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, /* Change rs1 into %g7. */ bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); insn = (insn & ~0x7c000) | 0x1c000; - bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, insn, contents + rel->r_offset); } continue; @@ -3789,7 +3795,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, relocation = SPARC_NOP; else relocation = 0x80100000 | (insn & 0x3e00001f); - bfd_put_32 (output_bfd, relocation, contents + rel->r_offset); + bfd_put_32 (info->output_bfd, relocation, + contents + rel->r_offset); } continue; @@ -3812,7 +3819,7 @@ _bfd_sparc_elf_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 /* xgettext:c-format */ @@ -3829,7 +3836,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, { bfd_vma x; - if (! ABI_64_P (output_bfd)) + if (! ABI_64_P (info->output_bfd)) abort (); relocation += rel->r_addend; @@ -4011,8 +4018,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, /* Check whether it fits into simm19. */ if (((reloc & 0x3c0000) == 0 || (reloc & 0x3c0000) == 0x3c0000) - && (ABI_64_P (output_bfd) - || elf_elfheader (output_bfd)->e_flags & EF_SPARC_32PLUS)) + && (ABI_64_P (info->output_bfd) + || elf_elfheader (info->output_bfd)->e_flags & EF_SPARC_32PLUS)) x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */ else x = INSN_BA | (reloc & 0x3fffff); /* ba */ @@ -4081,7 +4088,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, && (((input_section->flags & SEC_DEBUGGING) != 0 && strcmp (bfd_section_name (input_section), ".stab") == 0) - || _bfd_elf_section_offset (output_bfd, info, + || _bfd_elf_section_offset (info->output_bfd, info, input_section, rel->r_offset) == (bfd_vma)-1)) @@ -4219,8 +4226,7 @@ sparc_vxworks_build_plt_entry (bfd *output_bfd, struct bfd_link_info *info, dynamic sections here. */ bool -_bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_sparc_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -4231,7 +4237,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, htab = _bfd_sparc_elf_hash_table (info); BFD_ASSERT (htab != NULL); - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); eh = (struct _bfd_sparc_elf_link_hash_entry *) h; @@ -4276,7 +4282,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, The first three entries are reserved. */ got_offset = (rela_index + 3) * 4; - sparc_vxworks_build_plt_entry (output_bfd, info, h->plt.offset, + sparc_vxworks_build_plt_entry (info->output_bfd, info, h->plt.offset, rela_index, got_offset); @@ -4294,7 +4300,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, bool ifunc = false; /* Fill in the entry in the procedure linkage table. */ - rela_index = SPARC_ELF_BUILD_PLT_ENTRY (htab, output_bfd, splt, + rela_index = SPARC_ELF_BUILD_PLT_ENTRY (htab, info->output_bfd, splt, h->plt.offset, splt->size, &r_offset); @@ -4315,7 +4321,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_offset = r_offset + (splt->output_section->vma + splt->output_offset); - if (ABI_64_P (output_bfd) + if (ABI_64_P (info->output_bfd) && h->plt.offset >= (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)) { if (ifunc) @@ -4361,7 +4367,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, loc = srela->contents; loc += rela_index * bed->s->sizeof_rela; - bed->s->swap_reloca_out (output_bfd, &rela, loc); + bed->s->swap_reloca_out (info->output_bfd, &rela, loc); if (!resolved_to_zero && !h->def_regular) { @@ -4413,7 +4419,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, /* We load the GOT entry with the PLT entry. */ plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt; - SPARC_ELF_PUT_WORD (htab, output_bfd, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, (plt->output_section->vma + plt->output_offset + h->plt.offset), htab->elf.sgot->contents @@ -4441,9 +4447,9 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; } - SPARC_ELF_PUT_WORD (htab, output_bfd, 0, + SPARC_ELF_PUT_WORD (htab, info->output_bfd, 0, sgot->contents + (h->got.offset & ~(bfd_vma) 1)); - sparc_elf_append_rela (output_bfd, srela, &rela); + sparc_elf_append_rela (info->output_bfd, srela, &rela); } if (h->needs_copy) @@ -4463,7 +4469,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, s = htab->elf.sreldynrelro; else s = htab->elf.srelbss; - sparc_elf_append_rela (output_bfd, s, &rela); + sparc_elf_append_rela (info->output_bfd, s, &rela); } /* Mark some specially defined symbols as absolute. On VxWorks, @@ -4481,7 +4487,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, +sparc_finish_dyn (struct bfd_link_info *info, bfd *dynobj, asection *sdyn, asection *splt ATTRIBUTE_UNUSED) { @@ -4494,10 +4500,10 @@ sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, htab = _bfd_sparc_elf_hash_table (info); BFD_ASSERT (htab != NULL); - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); dynsize = bed->s->sizeof_dyn; dynconend = sdyn->contents + sdyn->size; - abi_64_p = ABI_64_P (output_bfd); + abi_64_p = ABI_64_P (info->output_bfd); for (dyncon = sdyn->contents; dyncon < dynconend; dyncon += dynsize) { Elf_Internal_Dyn dyn; @@ -4513,25 +4519,25 @@ sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, { dyn.d_un.d_val = (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset); - bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (info->output_bfd, &dyn, dyncon); } } #ifdef OBJ_MAYBE_ELF_VXWORKS else if (htab->elf.target_os == is_vxworks - && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn)) - bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); + && elf_vxworks_finish_dynamic_entry (info->output_bfd, &dyn)) + bed->s->swap_dyn_out (info->output_bfd, &dyn, dyncon); #endif /* OBJ_MAYBE_ELF_VXWORKS */ else if (abi_64_p && dyn.d_tag == DT_SPARC_REGISTER) { if (stt_regidx == -1) { stt_regidx = - _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1); + _bfd_elf_link_lookup_local_dynindx (info, info->output_bfd, -1); if (stt_regidx == -1) return false; } dyn.d_un.d_val = stt_regidx++; - bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (info->output_bfd, &dyn, dyncon); } else { @@ -4564,7 +4570,7 @@ sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, else dyn.d_un.d_val = s->size; } - bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (info->output_bfd, &dyn, dyncon); } } return true; @@ -4676,8 +4682,7 @@ finish_local_dynamic_symbol (void **slot, void *inf) struct bfd_link_info *info = (struct bfd_link_info *) inf; - return _bfd_sparc_elf_finish_dynamic_symbol (info->output_bfd, info, - h, NULL); + return _bfd_sparc_elf_finish_dynamic_symbol (info, h, NULL); } /* Finish up undefined weak symbol handling in PIE. Fill its PLT entry @@ -4695,13 +4700,11 @@ pie_finish_undefweak_symbol (struct bfd_hash_entry *bh, || h->dynindx != -1) return true; - return _bfd_sparc_elf_finish_dynamic_symbol (info->output_bfd, info, - h, NULL); + return _bfd_sparc_elf_finish_dynamic_symbol (info, h, NULL); } bool -_bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_sparc_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -4716,7 +4719,7 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, entries at the end of the dynlocal list, so they came at the end of the local symbols in the symtab. Except that they aren't STB_LOCAL, so we need to back up symtab->sh_info. */ - if (ABI_64_P (output_bfd) + if (ABI_64_P (info->output_bfd) && elf_hash_table (info)->dynlocal) { asection *dynsymsec = bfd_get_linker_section (dynobj, ".dynsym"); @@ -4739,7 +4742,7 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, splt = htab->elf.splt; BFD_ASSERT (splt != NULL && sdyn != NULL); - if (!sparc_finish_dyn (output_bfd, info, dynobj, sdyn, splt)) + if (!sparc_finish_dyn (info, dynobj, sdyn, splt)) return false; /* Initialize the contents of the .plt section. */ @@ -4748,15 +4751,15 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, if (htab->elf.target_os == is_vxworks) { if (bfd_link_pic (info)) - sparc_vxworks_finish_shared_plt (output_bfd, info); + sparc_vxworks_finish_shared_plt (info->output_bfd, info); else - sparc_vxworks_finish_exec_plt (output_bfd, info); + sparc_vxworks_finish_exec_plt (info->output_bfd, info); } else { memset (splt->contents, 0, htab->plt_header_size); - if (!ABI_64_P (output_bfd)) - bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP, + if (!ABI_64_P (info->output_bfd)) + bfd_put_32 (info->output_bfd, SPARC_NOP, splt->contents + splt->size - 4); } } @@ -4764,7 +4767,7 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, if (elf_section_data (splt->output_section) != NULL) elf_section_data (splt->output_section)->this_hdr.sh_entsize = ((htab->elf.target_os == is_vxworks - || !ABI_64_P (output_bfd)) + || !ABI_64_P (info->output_bfd)) ? 0 : htab->plt_entry_size); } @@ -4776,7 +4779,8 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, sdyn->output_section->vma + sdyn->output_offset : 0); - SPARC_ELF_PUT_WORD (htab, output_bfd, val, htab->elf.sgot->contents); + SPARC_ELF_PUT_WORD (htab, info->output_bfd, val, + htab->elf.sgot->contents); } if (htab->elf.sgot) diff --git a/bfd/elfxx-sparc.h b/bfd/elfxx-sparc.h index 75d24a6647f..61f735e7e4a 100644 --- a/bfd/elfxx-sparc.h +++ b/bfd/elfxx-sparc.h @@ -112,22 +112,22 @@ extern asection *_bfd_sparc_elf_gc_mark_hook extern bool _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *, struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_omit_section_dynsym - (bfd *, struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_late_size_sections - (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_new_section_hook (bfd *, asection *) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_relax_section (bfd *, struct bfd_section *, struct bfd_link_info *, bool *) ATTRIBUTE_HIDDEN; extern int _bfd_sparc_elf_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 **) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_finish_dynamic_symbol - (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + (struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *sym) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_finish_dynamic_sections - (bfd *, struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_fixup_symbol (struct bfd_link_info *, struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN; extern bool _bfd_sparc_elf_object_p diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 124be5ed0c4..b6dfc108f27 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -495,7 +495,7 @@ #define elf_backend_strip_zero_sized_dynamic_sections 0 #endif #ifndef elf_backend_init_index_section -#define elf_backend_init_index_section _bfd_void_bfd_link +#define elf_backend_init_index_section _bfd_elf_init_0_index_sections #endif #ifndef elf_backend_relocate_section #define elf_backend_relocate_section 0 diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index a13791336ad..f0af9f2f2f5 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -2412,8 +2412,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) omitted when creating a shared library. */ bool -tilegx_elf_omit_section_dynsym (bfd *output_bfd, - struct bfd_link_info *info, +tilegx_elf_omit_section_dynsym (struct bfd_link_info *info, asection *p) { /* We keep the .got section symbol so that explicit relocations @@ -2422,12 +2421,11 @@ tilegx_elf_omit_section_dynsym (bfd *output_bfd, if (strcmp (p->name, ".got") == 0) return false; - return _bfd_elf_omit_section_dynsym_default (output_bfd, info, p); + return _bfd_elf_omit_section_dynsym_default (info, p); } bool -tilegx_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +tilegx_elf_late_size_sections (struct bfd_link_info *info) { struct tilegx_elf_link_hash_table *htab; bfd *dynobj; @@ -2555,7 +2553,7 @@ tilegx_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, || htab->elf.splt->size == 0) && (htab->elf.sgot == NULL || (htab->elf.sgot->size - == get_elf_backend_data (output_bfd)->got_header_size))) + == get_elf_backend_data (info->output_bfd)->got_header_size))) htab->elf.sgotplt->size = 0; } @@ -2618,7 +2616,7 @@ tilegx_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s->alloced = 1; } - return _bfd_elf_add_dynamic_tags (output_bfd, info, true); + return _bfd_elf_add_dynamic_tags (info, true); } /* Return the base VMA address which should be subtracted from real addresses @@ -2796,7 +2794,7 @@ static const bfd_byte *insn_addx_Y0Y1 = insn_tls_ie_addx_Y0Y1; accordingly. */ int -tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +tilegx_elf_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, @@ -2866,7 +2864,8 @@ tilegx_elf_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 { @@ -2942,7 +2941,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else if (is_tls_iele) { /* GD -> IE */ - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) tilegx_replace_insn (contents + rel->r_offset, insn_mask_X1, insn_tls_ie_ld_X1); else @@ -3003,7 +3002,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* 1. copy dest operand into the second source operand. 2. change the opcode to "add". */ src_begin = is_pipe0 ? 12 : 43; - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) insn = is_X0X1 ? insn_add_X0X1 : insn_add_Y0Y1; else insn = is_X0X1 ? insn_addx_X0X1 : insn_addx_Y0Y1; @@ -3035,7 +3034,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { const bfd_byte *mask = NULL; const bfd_byte *add_insn = NULL; - bool is_64bit = ABI_64_P (output_bfd); + bool is_64bit = ABI_64_P (info->output_bfd); switch (r_type) { @@ -3083,7 +3082,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else { /* IE -> IE */ - if (ABI_64_P (output_bfd)) + if (ABI_64_P (info->output_bfd)) tilegx_replace_insn (contents + rel->r_offset, insn_mask_X1_no_dest_no_srca, insn_tls_ie_ld_X1); @@ -3144,7 +3143,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, off &= ~1; else { - TILEGX_ELF_PUT_WORD (htab, output_bfd, relocation, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, relocation, htab->elf.sgot->contents + off); h->got.offset |= 1; } @@ -3183,10 +3182,10 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, TILEGX_ELF_R_INFO (htab, NULL, 0, R_TILEGX_RELATIVE); outrel.r_addend = relocation; relocation = 0; - tilegx_elf_append_rela (output_bfd, s, &outrel); + tilegx_elf_append_rela (info->output_bfd, s, &outrel); } - TILEGX_ELF_PUT_WORD (htab, output_bfd, relocation, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, relocation, htab->elf.sgot->contents + off); local_got_offsets[r_symndx] |= 1; } @@ -3324,8 +3323,8 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, skip = 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) @@ -3424,7 +3423,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } } - tilegx_elf_append_rela (output_bfd, sreloc, &outrel); + tilegx_elf_append_rela (info->output_bfd, sreloc, &outrel); /* This reloc will be computed at runtime, so there's no need to do anything now. */ @@ -3447,8 +3446,8 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (sreloc != NULL); skip = 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) @@ -3464,7 +3463,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + rel->r_addend; } - tilegx_elf_append_rela (output_bfd, sreloc, &outrel); + tilegx_elf_append_rela (info->output_bfd, sreloc, &outrel); continue; } relocation = tpoff (info, relocation); @@ -3571,7 +3570,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, case R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE: case R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE: if (need_relocs) { - TILEGX_ELF_PUT_WORD (htab, output_bfd, 0, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, 0, htab->elf.sgot->contents + off); outrel.r_offset = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); @@ -3580,9 +3579,10 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_addend = relocation - dtpoff_base (info); outrel.r_info = TILEGX_ELF_R_INFO (htab, NULL, indx, TILEGX_ELF_TPOFF_RELOC (htab)); - tilegx_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + tilegx_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); } else { - TILEGX_ELF_PUT_WORD (htab, output_bfd, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, tpoff (info, relocation), htab->elf.sgot->contents + off); } @@ -3600,26 +3600,28 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_addend = 0; outrel.r_info = TILEGX_ELF_R_INFO (htab, NULL, indx, TILEGX_ELF_DTPMOD_RELOC (htab)); - TILEGX_ELF_PUT_WORD (htab, output_bfd, 0, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, 0, htab->elf.sgot->contents + off); - tilegx_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + tilegx_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); if (indx == 0) { BFD_ASSERT (! unresolved_reloc); - TILEGX_ELF_PUT_WORD (htab, output_bfd, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, relocation - dtpoff_base (info), (htab->elf.sgot->contents + off + TILEGX_ELF_WORD_BYTES (htab))); } else { - TILEGX_ELF_PUT_WORD (htab, output_bfd, 0, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, 0, (htab->elf.sgot->contents + off + TILEGX_ELF_WORD_BYTES (htab))); outrel.r_info = TILEGX_ELF_R_INFO (htab, NULL, indx, TILEGX_ELF_DTPOFF_RELOC (htab)); outrel.r_offset += TILEGX_ELF_WORD_BYTES (htab); - tilegx_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); + tilegx_elf_append_rela (info->output_bfd, + htab->elf.srelgot, &outrel); } } @@ -3629,9 +3631,9 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, static link or an executable link with the symbol binding locally. Mark it as belonging to module 1, the executable. */ - TILEGX_ELF_PUT_WORD (htab, output_bfd, 1, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, 1, htab->elf.sgot->contents + off ); - TILEGX_ELF_PUT_WORD (htab, output_bfd, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, relocation - dtpoff_base (info), htab->elf.sgot->contents + off + TILEGX_ELF_WORD_BYTES (htab)); @@ -3658,7 +3660,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, 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 /* xgettext:c-format */ @@ -3768,8 +3770,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, dynamic sections here. */ bool -tilegx_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, +tilegx_elf_finish_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { @@ -3786,7 +3787,7 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd, Elf_Internal_Rela rela; bfd_byte *loc; bfd_vma r_offset; - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); int rela_index; @@ -3803,12 +3804,12 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd, abort (); /* Fill in the entry in the procedure linkage table. */ - rela_index = tilegx_plt_entry_build (output_bfd, htab, splt, sgotplt, + rela_index = tilegx_plt_entry_build (info->output_bfd, htab, splt, sgotplt, h->plt.offset, &r_offset); /* Fill in the entry in the global offset table, which initially points to the beginning of the plt. */ - TILEGX_ELF_PUT_WORD (htab, output_bfd, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, splt->output_section->vma + splt->output_offset, sgotplt->contents + r_offset); @@ -3820,7 +3821,7 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_info = TILEGX_ELF_R_INFO (htab, NULL, h->dynindx, R_TILEGX_JMP_SLOT); loc = srela->contents + rela_index * TILEGX_ELF_RELA_BYTES (htab); - bed->s->swap_reloca_out (output_bfd, &rela, loc); + bed->s->swap_reloca_out (info->output_bfd, &rela, loc); if (!h->def_regular) { @@ -3875,9 +3876,9 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd, rela.r_addend = 0; } - TILEGX_ELF_PUT_WORD (htab, output_bfd, 0, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, 0, sgot->contents + (h->got.offset & ~(bfd_vma) 1)); - tilegx_elf_append_rela (output_bfd, srela, &rela); + tilegx_elf_append_rela (info->output_bfd, srela, &rela); } if (h->needs_copy) @@ -3899,7 +3900,7 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd, + h->root.u.def.section->output_offset); rela.r_info = TILEGX_ELF_R_INFO (htab, NULL, h->dynindx, R_TILEGX_COPY); rela.r_addend = 0; - tilegx_elf_append_rela (output_bfd, s, &rela); + tilegx_elf_append_rela (info->output_bfd, s, &rela); } /* Mark some specially defined symbols as absolute. */ @@ -3913,7 +3914,7 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ static bool -tilegx_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, +tilegx_finish_dyn (struct bfd_link_info *info, bfd *dynobj, asection *sdyn, asection *splt ATTRIBUTE_UNUSED) { @@ -3924,7 +3925,7 @@ tilegx_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, htab = tilegx_elf_hash_table (info); BFD_ASSERT (htab != NULL); - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); dynsize = bed->s->sizeof_dyn; dynconend = sdyn->contents + sdyn->size; @@ -3953,14 +3954,13 @@ tilegx_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, continue; } - bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (info->output_bfd, &dyn, dyncon); } return true; } bool -tilegx_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +tilegx_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf ATTRIBUTE_UNUSED) { bfd *dynobj; @@ -3982,7 +3982,7 @@ tilegx_elf_finish_dynamic_sections (bfd *output_bfd, splt = htab->elf.splt; BFD_ASSERT (splt != NULL && sdyn != NULL); - ret = tilegx_finish_dyn (output_bfd, info, dynobj, sdyn, splt); + ret = tilegx_finish_dyn (info, dynobj, sdyn, splt); if (!ret) return ret; @@ -3991,13 +3991,13 @@ tilegx_elf_finish_dynamic_sections (bfd *output_bfd, if (splt->size > 0) { memcpy (splt->contents, - ABI_64_P (output_bfd) ? + ABI_64_P (info->output_bfd) ? tilegx64_plt0_entry : tilegx32_plt0_entry, PLT_HEADER_SIZE); memcpy (splt->contents + splt->size - PLT_ENTRY_SIZE + PLT_HEADER_SIZE, - ABI_64_P (output_bfd) ? + ABI_64_P (info->output_bfd) ? tilegx64_plt_tail_entry : tilegx32_plt_tail_entry, PLT_TAIL_SIZE); /* Add padding so that the plt section is a multiple of its @@ -4023,9 +4023,9 @@ tilegx_elf_finish_dynamic_sections (bfd *output_bfd, { /* Write the first two entries in .got.plt, needed for the dynamic linker. */ - TILEGX_ELF_PUT_WORD (htab, output_bfd, (bfd_vma) -1, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, -1, htab->elf.sgotplt->contents); - TILEGX_ELF_PUT_WORD (htab, output_bfd, (bfd_vma) 0, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, 0, htab->elf.sgotplt->contents + GOT_ENTRY_SIZE (htab)); @@ -4043,7 +4043,7 @@ tilegx_elf_finish_dynamic_sections (bfd *output_bfd, bfd_vma val = (sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0); - TILEGX_ELF_PUT_WORD (htab, output_bfd, val, + TILEGX_ELF_PUT_WORD (htab, info->output_bfd, val, htab->elf.sgot->contents); elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = diff --git a/bfd/elfxx-tilegx.h b/bfd/elfxx-tilegx.h index c0e1eb5510b..60d32153cf0 100644 --- a/bfd/elfxx-tilegx.h +++ b/bfd/elfxx-tilegx.h @@ -55,15 +55,14 @@ tilegx_elf_adjust_dynamic_symbol (struct bfd_link_info *, ATTRIBUTE_HIDDEN; extern bool -tilegx_elf_omit_section_dynsym (bfd *, - struct bfd_link_info *, +tilegx_elf_omit_section_dynsym (struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN; extern bool -tilegx_elf_late_size_sections (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; +tilegx_elf_late_size_sections (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern int -tilegx_elf_relocate_section (bfd *, struct bfd_link_info *, +tilegx_elf_relocate_section (struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, @@ -89,13 +88,12 @@ tilegx_additional_program_headers (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern bool -tilegx_elf_finish_dynamic_symbol (bfd *, - struct bfd_link_info *, +tilegx_elf_finish_dynamic_symbol (struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *) ATTRIBUTE_HIDDEN; extern bool -tilegx_elf_finish_dynamic_sections (bfd *, struct bfd_link_info *, bfd_byte *) +tilegx_elf_finish_dynamic_sections (struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; extern bool diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index e54b23b36f5..0f79ef58f02 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -1822,8 +1822,7 @@ enum dynobj_sframe_plt_type of type PLT_SEC_TYPE. */ static bool -_bfd_x86_elf_create_sframe_plt (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_x86_elf_create_sframe_plt (struct bfd_link_info *info, unsigned int plt_sec_type) { struct elf_x86_link_hash_table *htab; @@ -1844,7 +1843,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd, unsigned int num_pltn_entries = 0; const sframe_frame_row_entry * const *pltn_fres; - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); htab = elf_x86_hash_table (info, bed->target_id); /* Whether SFrame stack trace info for plt0 is to be generated. */ switch (plt_sec_type) @@ -1972,8 +1971,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd, PLT_SEC_TYPE. */ static bool -_bfd_x86_elf_write_sframe_plt (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_x86_elf_write_sframe_plt (struct bfd_link_info *info, unsigned int plt_sec_type) { struct elf_x86_link_hash_table *htab; @@ -1985,7 +1983,7 @@ _bfd_x86_elf_write_sframe_plt (bfd *output_bfd, int err = 0; - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); htab = elf_x86_hash_table (info, bed->target_id); dynobj = htab->elf.dynobj; @@ -2275,15 +2273,14 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, /* Set the sizes of the dynamic sections. */ bool -_bfd_x86_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +_bfd_x86_elf_late_size_sections (struct bfd_link_info *info) { struct elf_x86_link_hash_table *htab; bfd *dynobj; asection *s; bool relocs; bfd *ibfd; - elf_backend_data *bed = get_elf_backend_data (output_bfd); + elf_backend_data *bed = get_elf_backend_data (info->output_bfd); htab = elf_x86_hash_table (info, bed->target_id); if (htab == NULL) @@ -2482,7 +2479,7 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd, && (htab->elf.igotplt == NULL || htab->elf.igotplt->size == 0) && (!htab->elf.dynamic_sections_created - || (eh_frame = bfd_get_section_by_name (output_bfd, + || (eh_frame = bfd_get_section_by_name (info->output_bfd, ".eh_frame")) == NULL || eh_frame->rawsize == 0)) { @@ -2539,7 +2536,7 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd, && htab->elf.splt->size != 0 && !bfd_is_abs_section (htab->elf.splt->output_section)) { - _bfd_x86_elf_create_sframe_plt (output_bfd, info, SFRAME_PLT); + _bfd_x86_elf_create_sframe_plt (info, SFRAME_PLT); /* FIXME - Dirty Hack. Set the size to something non-zero for now, so that the section does not get stripped out below. The precise size of this section is known only when the contents are @@ -2552,7 +2549,7 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd, && htab->plt_got->size != 0 && !bfd_is_abs_section (htab->plt_got->output_section)) { - _bfd_x86_elf_create_sframe_plt (output_bfd, info, SFRAME_PLT_GOT); + _bfd_x86_elf_create_sframe_plt (info, SFRAME_PLT_GOT); /* FIXME - Dirty Hack. Set the size to something non-zero for now, so that the section does not get stripped out below. The precise size of this section is known only when the contents are @@ -2566,7 +2563,7 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd, && !bfd_is_abs_section (htab->plt_second->output_section)) { /* SFrame stack trace info for the second PLT. */ - _bfd_x86_elf_create_sframe_plt (output_bfd, info, SFRAME_PLT_SEC); + _bfd_x86_elf_create_sframe_plt (info, SFRAME_PLT_SEC); /* FIXME - Dirty Hack. Set the size to something non-zero for now, so that the section does not get stripped out below. The precise size of this section is known only when the contents are @@ -2731,19 +2728,19 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd, && htab->elf.splt != NULL && htab->elf.splt->size != 0 && htab->plt_sframe->contents == NULL) - _bfd_x86_elf_write_sframe_plt (output_bfd, info, SFRAME_PLT); + _bfd_x86_elf_write_sframe_plt (info, SFRAME_PLT); if (htab->plt_second_sframe != NULL && htab->plt_second != NULL && htab->plt_second->size != 0 && htab->plt_second_sframe->contents == NULL) - _bfd_x86_elf_write_sframe_plt (output_bfd, info, SFRAME_PLT_SEC); + _bfd_x86_elf_write_sframe_plt (info, SFRAME_PLT_SEC); if (htab->plt_got_sframe != NULL && htab->plt_got != NULL && htab->plt_got->size != 0 && htab->plt_got_sframe->contents == NULL) - _bfd_x86_elf_write_sframe_plt (output_bfd, info, SFRAME_PLT_GOT); + _bfd_x86_elf_write_sframe_plt (info, SFRAME_PLT_GOT); } if (resolved_plt != NULL @@ -2752,15 +2749,13 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd, || !_bfd_elf_add_dynamic_entry (info, DT_X86_64_PLTENT, 0))) return false; - return _bfd_elf_maybe_vxworks_add_dynamic_tags (output_bfd, info, - relocs); + return _bfd_elf_maybe_vxworks_add_dynamic_tags (info, relocs); } /* Finish up the x86 dynamic sections. */ struct elf_x86_link_hash_table * -_bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info, +_bfd_x86_elf_finish_dynamic_sections (struct bfd_link_info *info, bfd_byte *buf) { struct elf_x86_link_hash_table *htab; @@ -2770,7 +2765,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, bfd_byte *dyncon, *dynconend; bfd_size_type sizeof_dyn; - bed = get_elf_backend_data (output_bfd); + bed = get_elf_backend_data (info->output_bfd); htab = elf_x86_hash_table (info, bed->target_id); if (htab == NULL) return htab; @@ -2803,20 +2798,20 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, the dynamic linker. */ if (htab->got_entry_size == 8) { - bfd_put_64 (output_bfd, dynamic_addr, + bfd_put_64 (info->output_bfd, dynamic_addr, htab->elf.sgotplt->contents); - bfd_put_64 (output_bfd, (bfd_vma) 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgotplt->contents + 8); - bfd_put_64 (output_bfd, (bfd_vma) 0, + bfd_put_64 (info->output_bfd, 0, htab->elf.sgotplt->contents + 8*2); } else { - bfd_put_32 (output_bfd, dynamic_addr, + bfd_put_32 (info->output_bfd, dynamic_addr, htab->elf.sgotplt->contents); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgotplt->contents + 4); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (info->output_bfd, 0, htab->elf.sgotplt->contents + 4*2); } } @@ -2848,7 +2843,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, default: #ifdef OBJ_MAYBE_ELF_VXWORKS if (htab->elf.target_os == is_vxworks - && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn)) + && elf_vxworks_finish_dynamic_entry (info->output_bfd, &dyn)) break; #endif /* OBJ_MAYBE_ELF_VXWORKS */ continue; @@ -2894,7 +2889,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, break; } - (*bed->s->swap_dyn_out) (output_bfd, &dyn, dyncon); + (*bed->s->swap_dyn_out) (info->output_bfd, &dyn, dyncon); } if (htab->plt_got != NULL && htab->plt_got->size > 0) @@ -2925,7 +2920,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, } if (htab->plt_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME - && !_bfd_elf_write_linker_section_eh_frame (output_bfd, info, + && !_bfd_elf_write_linker_section_eh_frame (info->output_bfd, info, htab->plt_eh_frame, buf)) return NULL; } @@ -2949,7 +2944,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, + PLT_FDE_START_OFFSET); } if (htab->plt_got_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME - && !_bfd_elf_write_linker_section_eh_frame (output_bfd, info, + && !_bfd_elf_write_linker_section_eh_frame (info->output_bfd, info, htab->plt_got_eh_frame, buf)) return NULL; @@ -2975,7 +2970,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, + PLT_FDE_START_OFFSET); } if (htab->plt_second_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME - && !_bfd_elf_write_linker_section_eh_frame (output_bfd, info, + && !_bfd_elf_write_linker_section_eh_frame (info->output_bfd, info, htab->plt_second_eh_frame, buf)) return NULL; @@ -3009,7 +3004,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, } if (htab->plt_sframe->sec_info_type == SEC_INFO_TYPE_SFRAME) { - if (! _bfd_elf_merge_section_sframe (output_bfd, info, + if (! _bfd_elf_merge_section_sframe (info->output_bfd, info, htab->plt_sframe, htab->plt_sframe->contents)) return NULL; @@ -3043,7 +3038,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, } if (htab->plt_second_sframe->sec_info_type == SEC_INFO_TYPE_SFRAME) { - if (! _bfd_elf_merge_section_sframe (output_bfd, info, + if (! _bfd_elf_merge_section_sframe (info->output_bfd, info, htab->plt_second_sframe, htab->plt_second_sframe->contents)) return NULL; @@ -3070,7 +3065,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, } if (htab->plt_got_sframe->sec_info_type == SEC_INFO_TYPE_SFRAME) { - if (! _bfd_elf_merge_section_sframe (output_bfd, info, + if (! _bfd_elf_merge_section_sframe (info->output_bfd, info, htab->plt_got_sframe, htab->plt_got_sframe->contents)) return NULL; @@ -3086,8 +3081,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, bool -_bfd_x86_elf_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +_bfd_x86_elf_early_size_sections (struct bfd_link_info *info) { asection *tls_sec = elf_hash_table (info)->tls_sec; @@ -3103,14 +3097,14 @@ _bfd_x86_elf_early_size_sections (bfd *output_bfd, { struct elf_x86_link_hash_table *htab; 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); htab = elf_x86_hash_table (info, bed->target_id); if (htab == NULL) return false; 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; diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h index 69c348ee42b..4932b2e43c5 100644 --- a/bfd/elfxx-x86.h +++ b/bfd/elfxx-x86.h @@ -884,13 +884,13 @@ extern bool _bfd_elf_x86_valid_reloc_p Elf_Internal_Sym *, Elf_Internal_Shdr *, bool *) ATTRIBUTE_HIDDEN; extern bool _bfd_x86_elf_late_size_sections - (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern struct elf_x86_link_hash_table *_bfd_x86_elf_finish_dynamic_sections - (bfd *, struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *, bfd_byte *) ATTRIBUTE_HIDDEN; extern bool _bfd_x86_elf_early_size_sections - (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; + (struct bfd_link_info *) ATTRIBUTE_HIDDEN; extern void _bfd_x86_elf_merge_symbol_attribute (struct elf_link_hash_entry *, unsigned int, bool, bool) diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em index 54177249f24..28b91871958 100644 --- a/ld/emultempl/aarch64elf.em +++ b/ld/emultempl/aarch64elf.em @@ -259,7 +259,7 @@ gld${EMULATION_NAME}_after_allocation (void) ie. doesn't affect any code, so we can delay resizing the sections. It's likely we'll resize everything in the process of adding stubs. */ - ret = bfd_elf_discard_info (link_info.output_bfd, & link_info); + ret = bfd_elf_discard_info (&link_info); if (ret < 0) { einfo (_("%X%P: .eh_frame/.stab edit: %E\n")); diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 265b77816f4..f70bcf34b8b 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -385,7 +385,7 @@ gld${EMULATION_NAME}_after_allocation (void) ie. doesn't affect any code, so we can delay resizing the sections. It's likely we'll resize everything in the process of adding stubs. */ - ret = bfd_elf_discard_info (link_info.output_bfd, & link_info); + ret = bfd_elf_discard_info (&link_info); if (ret < 0) { einfo (_("%X%P: .eh_frame/.stab edit: %E\n")); diff --git a/ld/emultempl/cskyelf.em b/ld/emultempl/cskyelf.em index 33ddfff35ea..5a191567d9a 100644 --- a/ld/emultempl/cskyelf.em +++ b/ld/emultempl/cskyelf.em @@ -235,7 +235,7 @@ gld${EMULATION_NAME}_after_allocation (void) ie. doesn't affect any code, so we can delay resizing the sections. It's likely we'll resize everything in the process of adding stubs. */ - if (bfd_elf_discard_info (link_info.output_bfd, &link_info)) + if (bfd_elf_discard_info (&link_info)) need_laying_out = 1; /* If generating a relocatable output file, then we don't diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index 9fcf9fa154d..639f4f34f61 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -181,7 +181,7 @@ fragment <elf_backend_late_size_sections - && !bed->elf_backend_late_size_sections (link_info.output_bfd, - &link_info)) + && !bed->elf_backend_late_size_sections (&link_info)) fatal (_("%P: failed to set dynamic section sizes: %E\n")); before_allocation_default (); @@ -205,7 +204,7 @@ gld${EMULATION_NAME}_before_allocation (void) static void gld${EMULATION_NAME}_after_allocation (void) { - int need_layout = bfd_elf_discard_info (link_info.output_bfd, &link_info); + int need_layout = bfd_elf_discard_info (&link_info); if (need_layout < 0) einfo (_("%X%P: .eh_frame/.stab edit: %E\n")); diff --git a/ld/ldelf.c b/ld/ldelf.c index eec13501ef7..17629b833eb 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -1037,7 +1037,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, needed list can actually grow while we are stepping through this loop. */ save_input_bfd_tail = link_info.input_bfds_tail; - needed = bfd_elf_get_needed_list (link_info.output_bfd, &link_info); + needed = bfd_elf_get_needed_list (&link_info); for (l = needed; l != NULL; l = l->next) { struct bfd_link_needed_list *ll; @@ -1148,7 +1148,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, if (use_libpath) { found = 0; - rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info); + rp = bfd_elf_get_runpath_list (&link_info); for (; !found && rp != NULL; rp = rp->next) { path = ldelf_add_sysroot (rp->name); @@ -1408,7 +1408,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, } if (link_info.eh_frame_hdr_type == COMPACT_EH_HDR) - if (!bfd_elf_parse_eh_frame_entries (NULL, &link_info)) + if (!bfd_elf_parse_eh_frame_entries (&link_info)) fatal (_("%P: failed to parse EH frame entries\n")); ldelf_handle_dt_needed (htab, use_libpath, native, is_linux, @@ -1664,8 +1664,7 @@ ldelf_find_exp_assignment (etree_type *exp) will do no harm. */ if (strcmp (exp->assign.dst, ".") != 0) { - if (!bfd_elf_record_link_assignment (link_info.output_bfd, - &link_info, + if (!bfd_elf_record_link_assignment (&link_info, exp->assign.dst, provide, exp->assign.hidden)) fatal (_("%P: failed to record assignment to %s: %E\n"), @@ -1764,7 +1763,7 @@ ldelf_before_allocation (char **audit, char **depaudit, if (is_elf_hash_table (link_info.hash)) { - bfd_elf_tls_setup (link_info.output_bfd, &link_info); + bfd_elf_tls_setup (&link_info); /* Make __ehdr_start hidden if it has been referenced, to prevent the symbol from being dynamic. */ @@ -1839,10 +1838,10 @@ ldelf_before_allocation (char **audit, char **depaudit, } if (! (bfd_elf_size_dynamic_sections - (link_info.output_bfd, command_line.soname, rpath, + (&link_info, command_line.soname, rpath, command_line.filter_shlib, *audit, *depaudit, (const char * const *) command_line.auxiliary_filters, - &link_info, &sinterp))) + &sinterp))) fatal (_("%P: failed to set dynamic section sizes: %E\n")); if (sinterp != NULL) @@ -1908,7 +1907,7 @@ ldelf_before_allocation (char **audit, char **depaudit, before_allocation_default (); - if (!bfd_elf_size_dynsym_hash_dynstr (link_info.output_bfd, &link_info)) + if (!bfd_elf_size_dynsym_hash_dynstr (&link_info)) fatal (_("%P: failed to set dynamic section sizes: %E\n")); if (ehdr_start != NULL)