/* 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. */
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
/* 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.
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);
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
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. */
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 *));
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
/* 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;
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
(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;
(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
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
(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;
(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
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;
(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;
\f
/* 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,
{
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
{
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,
*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);
/* 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,
{
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
{
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
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,
*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;
/* 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;
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)
{
{
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)));
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
+ 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));
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;
/* 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
}
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;
}
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;
+ 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;
/* 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;
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;
}
}
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));
}
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;
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))
/* 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)));
}
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 */
|| 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;
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);
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.
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,
{
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
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)
= 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,
{
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);
}
}
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);
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;
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)
{
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);
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. */
/* 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);
}
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. */
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);
/* 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;
s->alloced = 1;
}
- return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs_exist);
+ return _bfd_elf_add_dynamic_tags (info, relocs_exist);
}
/* 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,
}
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
}
}
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
{
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,
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
/* 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;
&& (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);
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;
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;
}
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;
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)
{
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;
}
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);
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,
/* 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;
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;
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:
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
== 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;
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))
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)
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);
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
}
{
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);
}
}
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;
+ 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);
}
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)
{
$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 *,
&& (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);
}
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;
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)
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);
}
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);
}
{
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)
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;
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);
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. */
/* 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)
{
/* 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,
{
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);
*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;
}
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,
{
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
{
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
sgot->contents + off);
h->got.offset |= 1;
}
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))
{
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;
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;
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,
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
{
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);
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. */
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
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
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)
{
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;
+ 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;
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))
{
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
{
bfd_vma offset;
- if (_bfinfdpic_osec_readonly_p (output_bfd,
+ if (_bfinfdpic_osec_readonly_p (info->output_bfd,
input_section
->output_section))
{
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
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;
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
&& (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))
{
{
if (offset != (bfd_vma)-1)
{
- _bfinfdpic_add_rofixup (output_bfd,
+ _bfinfdpic_add_rofixup (info->output_bfd,
bfinfdpic_gotfixup_section
(info),
offset + input_section
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);
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))
{
}
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
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),
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);
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. */
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)
{
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. */
/* 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)
{
/* 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;
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");
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;
}
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;
+ 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))
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;
}
}
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)
{
/* 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;
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)
{
{
_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.
}
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;
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)
}
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;
/* 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,
{
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
{
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,
*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;
/* 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;
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)
{
}
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;
+ 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;
/* 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;
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;
}
}
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);
}
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,
{
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));
|| 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))
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
sgot->contents + off);
h->got.offset |= 1;
}
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))
{
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;
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
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
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
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;
/* 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);
/* 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;
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;
/* 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
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;
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)
{
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;
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);
}
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
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)
&& 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)
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. */
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;
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:
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:
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;
}
}
/* 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,
{
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);
{
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);
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;
/* 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;
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
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)
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 *);
*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);
/* 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,
{
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
{
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)
{
/* 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;
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)
{
|| ((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);
}
+ 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
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;
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)
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. */
/* 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;
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;
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);
}
}
{
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;
}
/* 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,
/* 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
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;
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))
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;
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;
}
relative_reloc = true;
}
}
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
htab->elf.sgot->contents + off);
if (relative_reloc)
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;
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. */
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))
{
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;
* 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
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)
* 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
= (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;
}
+ 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));
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++;
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);
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)
/* 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,
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;
}
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,
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,
{
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);
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,
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;
{
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);
{
case R_FRV_LABEL24:
case R_FRV_32:
- if (! IS_FDPIC (output_bfd))
+ if (! IS_FDPIC (info->output_bfd))
goto non_fdpic;
/* Fall through. */
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))
{
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
{
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)
{
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;
+ 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;
{
bfd_vma offset;
- if (_frvfdpic_osec_readonly_p (output_bfd,
+ if (_frvfdpic_osec_readonly_p (info->output_bfd,
input_section
->output_section))
{
}
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
{
bfd_vma offset;
- if (_frvfdpic_osec_readonly_p (output_bfd,
+ if (_frvfdpic_osec_readonly_p (info->output_bfd,
input_section
->output_section))
{
}
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
break;
case R_FRV_32:
- if (! IS_FDPIC (output_bfd))
+ if (! IS_FDPIC (info->output_bfd))
{
check_segment[0] = check_segment[1] = -1;
break;
&& (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))
{
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
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
{
bfd_vma offset;
- if (_frvfdpic_osec_readonly_p (output_bfd,
+ if (_frvfdpic_osec_readonly_p (info->output_bfd,
input_section
->output_section))
{
}
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
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),
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);
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;
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;
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;
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;
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. */
}
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)
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. */
/* 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)
{
/* 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;
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;
/* 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. */
}
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;
+ 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
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;
}
}
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)
{
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;
{
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);
(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 **);
\f
/* 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,
{
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
{
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,
*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;
/* 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;
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. */
/* 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,
/* 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
{
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);
}
/* 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:
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);
}
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);
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;
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;
}
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
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)
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;
}
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;
}
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)
{
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;
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);
}
}
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. */
/* 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;
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:
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 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);
}
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;
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
/* 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,
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;
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
base_got->contents + off);
h->got.offset |= 1;
}
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);
(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),
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,
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
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;
(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)
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)
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
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 */
}
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++;
/* 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;
}
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)
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
{
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;
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;
}
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;
}
+ 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);
}
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:
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
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
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;
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
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)
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
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)
{
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),
+ 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. */
+ 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);
}
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
/* 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),
}
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
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));
}
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),
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);
{
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);
}
_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);
}
}
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;
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
|| 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
/* 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;
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),
+ 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. */
+ 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. */
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);
}
}
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 *,
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,
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,
/* 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
/* 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,
/* 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;
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
{
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
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
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;
}
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))
{
{
/* 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))
{
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
/* 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;
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;
}
}
{
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 =
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)
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
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)
{
}
/* 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
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)
{
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;
}
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;
}
/* 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;
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;
}
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;
}
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);
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,
/* 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;
}
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;
/* 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;
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.
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,
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
+ 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))
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
sgot->contents + off);
h->got.offset |= 1;
}
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))
{
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;
}
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);
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
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)
{
/* 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
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)
{
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;
}
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;
}
/* 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;
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;
}
}
{
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 =
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;
}
/* 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,
(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;
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;
}
/* 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;
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
/* 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,
{
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
{
is done in the finish_dynamic_symbol routine. */
elf_m68k_init_got_entry_static (info,
- output_bfd,
+ info->output_bfd,
r_type,
sgot,
off,
BFD_ASSERT (srela != NULL);
elf_m68k_init_got_entry_local_shared (info,
- output_bfd,
+ info->output_bfd,
r_type,
sgot,
off,
else /* h == NULL && !bfd_link_pic (info) */
{
elf_m68k_init_got_entry_static (info,
- output_bfd,
+ info->output_bfd,
r_type,
sgot,
off,
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;
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
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
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)
{
+ 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);
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
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)
{
{
bfd_vma relocation;
- relocation = bfd_get_signed_32 (output_bfd,
+ relocation = bfd_get_signed_32 (info->output_bfd,
(sgot->contents
+ got_entry_offset));
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);
}
elf_m68k_init_got_entry_local_shared (info,
- output_bfd,
+ info->output_bfd,
r_type,
sgot,
got_entry_offset,
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));
}
{
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:
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;
/* 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;
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;
}
}
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;
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,
{
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
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,
{
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);
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,
{
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);
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);
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
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);
}
+ 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);
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;
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;
}
/* 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;
}
}
- 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)
{
/* 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);
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
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)
{
{
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)
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. */
/* 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;
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;
}
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 =
{
/* 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);
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,
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;
if (sec == 0)
continue;
sym_name = "<local symbol>";
- 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;
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,
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,
{
/* 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))
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
{
*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,
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)
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
/* 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;
/* ??? 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)
{
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); */
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)
{
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,
}
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));
}
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. */
/* 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;
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;
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)
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;
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,
{
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);
/* 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,
{
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);
(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 [] =
{
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,
{
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);
/* 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;
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
(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,
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;
}
/* 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++)
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. */
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 */
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:
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:
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:
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;
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
{
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))
{
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;
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);
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);
}
}
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
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
sgot->contents + off);
h->got.offset |= 1;
}
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))
{
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)
{
/* 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
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. */
}
else if (eff_tls_type & GOT_TLS_IEGP)
{
- relocation -= elf_gp (output_bfd);
+ relocation -= elf_gp (info->output_bfd);
}
}
else
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)
{
+ 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)
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);
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;
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);
/* 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);
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)
{
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;
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));
}
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;
}
/* 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;
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:
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;
}
}
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);
+ 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);
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;
}
}
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 *,
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,
{
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);
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;
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;
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;
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)
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;
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);
}
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
/* 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;
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);
}
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;
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;
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)
{
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;
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)
{
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;
}
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;
}
/* 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;
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. */
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;
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
/* 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;
#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
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,
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
{
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);
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));
}
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
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)
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;
}
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
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)
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;
}
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)
{
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
/* 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;
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);
}
}
_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)
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
{
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))
{
+ 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. */
+ 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
{
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);
}
}
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;
}
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);
}
}
}
+ 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;
}
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;
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 *)
/* 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,
{
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
{
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,
{
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);
/* 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;
}
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;
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,
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;
{
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);
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;
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;
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;
break;
case R_RX_DIR32_REV:
- if (BIGE (output_bfd))
+ if (BIGE (info->output_bfd))
{
OP (0) = relocation;
OP (1) = relocation >> 8;
{
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;
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;
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;
/* 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;
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
/* 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,
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] +
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
{
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
base_got->contents + off);
h->got.offset |= 1;
}
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);
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))
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;
/* 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);
}
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,
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)
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
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. */
/* 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;
}
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);
}
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);
}
}
}
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;
}
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)
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;
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;
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)
/* 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);
}
}
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)
{
/* 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;
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 */
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)
{
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 +
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),
/* 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)
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
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
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)
{
/* 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;
}
{
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)
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. */
/* 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;
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. */
{
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);
/* 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)
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
/* 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,
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;
}
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;
| (((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;
| (((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;
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);
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);
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);
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))
}
/* 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) :
/* 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;
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. */
}
/* 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;
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)
/* 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)
{
{
_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);
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. */
{
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;
/* 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;
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;
/* 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:
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;
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);
}
}
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,
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
}
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
}
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
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 *,
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
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
/* 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,
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;
}
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;
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);
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);
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))
}
/* 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) :
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;
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. */
}
/* 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;
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)
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)
{
{
_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);
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. */
{
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;
/* 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;
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;
/* 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:
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;
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);
}
}
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);
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;
}
/* 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;
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);
}
\f
/* Add a dynamic relocation to the SRELOC section. */
/* 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,
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;
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. */
}
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)
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);
+ 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))
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;
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;
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;
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
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);
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation,
+ bfd_put_32 (info->output_bfd, relocation,
sgot->contents + off);
h->got.offset |= 1;
&& 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);
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))
{
}
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);
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;
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;
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;
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;
{
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
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);
{
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
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,
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;
}
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;
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;
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;
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;
(_("%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
{
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;
}
&& ! 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;
}
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);
}
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);
}
}
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);
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;
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;
}
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;
}
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;
}
}
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)
*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;
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)
{
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));
{
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),
* 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
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. */
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))
{
+ 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
+ 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)
}
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)
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,
/* 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;
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;
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;
}
}
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)),
+ 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.
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);
}
}
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)
+ 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);
/* 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,
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));
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
{
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)
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
}
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;
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)
{
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;
/* 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);
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)
{
|| 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
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);
}
}
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. */
/* 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)
}
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,
{
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
{
/* 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
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)
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
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;
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
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;
}
/* 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;
*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);
}
#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)
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;
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. */
- 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)
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
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. */
#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;
|| 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;
}
s->alloced = 1;
}
- return _bfd_elf_add_dynamic_tags (output_bfd, info, true);
+ return _bfd_elf_add_dynamic_tags (info, true);
}
\f
/* Return the base VMA address which should be subtracted from real addresses
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,
{
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
{
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;
}
}
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;
}
}
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)
}
}
- 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. */
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)
+ 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);
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;
+ 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);
}
}
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);
}
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 */
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)
{
/* 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. */
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)
{
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)
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. */
/* 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)
{
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;
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;
{
/* 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);
}
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
/* 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,
{
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
{
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,
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 *);
/* 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;
/* 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;
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
/* 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,
{
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
{
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. */
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)
}
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
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)
{
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,
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)
{
+ 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)
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. */
/* 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;
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;
}
}
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)),
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)
/* 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,
/* 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);
}
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;
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,
{
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
{
/* 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;
/* 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;
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;
}
#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)
}
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;
{
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;
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,
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
{
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)
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;
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);
}
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);
}
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
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)
{
/* 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;
{
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);
}
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;
}
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);
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);
}
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,
/* 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;
}
break;
}
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bfd_elf32_swap_dyn_out (info->output_bfd, &dyn, dyncon);
}
return true;
}
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,
{
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
{
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,
}
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;
/* 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;
#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
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,
/* 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,
/* 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);
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
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
{
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
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);
}
&& (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)))
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);
}
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
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);
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);
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);
}
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);
}
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)
{
{
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)
{
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)
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);
}
}
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);
}
/* 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;
break;
}
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon);
}
/* Initialize the plt header. */
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;
#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,
(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 *);
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;
/* 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;
}
#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
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)
{
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);
}
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;
/* 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);
/* 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;
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:
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:
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;
}
/* 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;
/* 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
{
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);
}
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;
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)))
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;
}
}
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,
->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;
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
{
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;
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;
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;
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))
{
/* 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;
{
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);
{
/* 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)
{
}
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)
{
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)
/* 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);
}
}
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;
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);
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;
}
continue;
}
- bfd_elf64_swap_dyn_out (abfd, &dyn, dyncon);
+ bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon);
}
}
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,
{
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,
/* 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)
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;
/* 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;
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))
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,
}
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;
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)
{
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
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)
{
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
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);
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);
}
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;
/* 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))
}
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));
}
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);
}
}
|| 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;
}
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;
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
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
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)
{
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;
/* 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;
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;
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;
continue;
}
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bfd_elf64_swap_dyn_out (info->output_bfd, &dyn, dyncon);
}
}
{
/* 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. */
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,
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,
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;
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;
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;
/* 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;
_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
/* 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,
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] +
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
{
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;
}
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);
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))
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;
if (op == 0xc000)
{
/* larl rX,<weak sym> -> 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;
else if (op == 0xc005)
{
/* brasl rX,<weak sym> -> 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;
if (op == 0xc000)
{
/* larl rX,<weak sym> -> 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;
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;
|| (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;
/* 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);
}
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,
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)
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
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. */
/* 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;
}
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);
}
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);
}
}
}
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;
}
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)
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;
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;
}
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)
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)
{
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;
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 */
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)
{
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 +
/* 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 +
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
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)
{
/* 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;
}
{
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)
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. */
/* 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;
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. */
/* 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,
/* 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)
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);
}
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;
}
}
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;
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 *,
}
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
/* 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,
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. */
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)
{
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. */
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:
/* 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);
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,
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. */
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;
(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)
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)
}
}
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,
(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
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;
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,
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;
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;
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;
}
{
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)
{
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
{
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;
/* 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;
}
}
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;
/* 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;
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;
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;
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);
}
}
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)
{
- 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++;
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
}
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;
}
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;
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
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)
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)
{
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));
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. */
= 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));
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)
|| (!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));
}
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;
}
{
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;
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;
}
_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);
}
}
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;
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
|| 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
/* 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;
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
/* 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
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,
/* 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
/* 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
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 *,
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)
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)
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);
/* 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;
}
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;
}
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;
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)
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;
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)
{
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;
}
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;
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;
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;
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;
}
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;
{
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);
}
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)
+ 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);
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);
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);
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;
}
}
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;
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
{
/* 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)
{
}
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)
{
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);
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;
}
}
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;
}
}
}
- 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)
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. */
|| !_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)
/* 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))
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;
/* 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)
/* 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)
}
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;
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;
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
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)
{
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;
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;
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);
}
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. */
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
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);
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;
}
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;
}
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);
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;
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;
&& 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;
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;
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;
/* 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);
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;
}
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;
}
/* 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). */
}
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;
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;
/* 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)
{
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;
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;
|| !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;
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;
}
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)
_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;
}
/* 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;
}
}
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;
}
/* 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);
#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))
{
/* 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,
(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)
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,
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);
/* 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);
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);
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);
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);
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
/* 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 *,
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))
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);
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;
#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)
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)))
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))
_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;
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;
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)
{
|| 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
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;
{
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;
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:
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
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
}
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;
break;
}
- bfd_elfNN_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bfd_elfNN_swap_dyn_out (info->output_bfd, &dyn, dyncon);
}
}
/* 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;
}
/* 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));
/* 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);
}
{
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);
}
}
}
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;
#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))
}
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,
->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;
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
{
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;
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);
}
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;
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))
{
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);
}
{
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
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);
{
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);
}
{
/* 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)
{
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);
}
}
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)
{
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. */
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)
/* 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);
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. */
}
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;
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++)
{
break;
}
- bfd_elfNN_swap_dyn_out (abfd, &dyn, dyncon);
+ bfd_elfNN_swap_dyn_out (info->output_bfd, &dyn, dyncon);
}
/* Initialize the PLT0 entry. */
/* 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,
(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
{
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,
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);
/* 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);
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);
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);
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)
/* 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 *,
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);
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;
/* 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;
_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;
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;
/* 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)
{
|| 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
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;
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)
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
}
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;
break;
}
- bfd_elfNN_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bfd_elfNN_swap_dyn_out (info->output_bfd, &dyn, dyncon);
}
}
/* 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;
/* 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);
}
{
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);
}
}
}
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;
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";
}
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,
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)
/* 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);
relocation, input_bfd,
contents);
else
- loongarch_elf_append_rela (output_bfd, sreloc,
- &outrel);
+ loongarch_elf_append_rela (info->output_bfd,
+ sreloc, &outrel);
}
}
{
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)
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;
}
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;
}
}
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;
}
}
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);
}
}
{
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;
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);
}
}
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);
}
}
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);
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);
}
}
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;
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);
}
}
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? */
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)
{
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;
+ 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
{
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)
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
{
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),
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);
rela.r_addend = 0;
}
- loongarch_elf_append_rela (output_bfd, srela, &rela);
+ loongarch_elf_append_rela (info->output_bfd, srela, &rela);
}
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;
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);
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,
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 *,
}
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;
{
BFD_ASSERT (htab->elf.splt && sdyn);
- if (!loongarch_finish_dyn (output_bfd, info, dynobj, sdyn))
+ if (!loongarch_finish_dyn (info, dynobj, sdyn))
return false;
}
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;
{
/* 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);
}
/* 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;
}
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;
|| 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;
}
/* 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
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,
{
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)
/* 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);
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
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
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. */
&& !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;
}
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;
}
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)
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)
}
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;
}
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
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));
{
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;
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);
}
}
{
/* 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;
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);
}
}
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 "
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)
{
/* 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;
}
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)
{
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;
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
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);
}
}
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. */
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;
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;
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;
/* 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;
/* 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;
/* 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;
}
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;
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;
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));
}
/* 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));
}
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)
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;
}
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;
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);
/* 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);
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)
{
/* 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)
/* 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;
/* 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;
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;
}
}
#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 */
}
/* 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,
/* 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;
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;
}
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;
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
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,
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
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. */
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)
{
/* 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);
/* 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). */
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);
}
}
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
{
/* 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);
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];
{
_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;
}
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);
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)
gg = g;
- e.abfd = output_bfd;
+ e.abfd = info->output_bfd;
e.symndx = -1;
e.d.h = hmips;
e.tls_type = GOT_TLS_NONE;
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);
}
}
}
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)
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. */
/* 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)
{
/* 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_. */
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;
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
{
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));
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. */
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;
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);
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;
}
/* 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;
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;
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;
/* 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:
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)
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;
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;
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. */
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;
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;
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
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");
+ 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));
{
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);
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;
}
}
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
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
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;
/* 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)
{
#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;
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)
/* 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,
".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;
{
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)
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
outrel.r_addend = rel->r_addend;
}
- sparc_elf_append_rela (output_bfd, sreloc, &outrel);
+ sparc_elf_append_rela (info->output_bfd, sreloc, &outrel);
continue;
}
/* {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,
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;
}
}
&& 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;
}
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;
}
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);
}
/* 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
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)
}
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);
}
}
- 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. */
{
/* 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;
}
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);
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)
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)));
}
/* 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;
{
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
}
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);
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 */
/* 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;
}
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;
__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;
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:
/* 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;
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;
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 */
{
bfd_vma x;
- if (! ABI_64_P (output_bfd))
+ if (! ABI_64_P (info->output_bfd))
abort ();
relocation += rel->r_addend;
/* 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 */
&& (((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))
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)
{
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;
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);
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);
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)
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)
{
/* 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
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)
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,
/* 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)
{
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;
{
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
{
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;
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
|| 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;
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");
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. */
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);
}
}
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);
}
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)
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
#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
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
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;
|| 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;
}
s->alloced = 1;
}
- return _bfd_elf_add_dynamic_tags (output_bfd, info, true);
+ return _bfd_elf_add_dynamic_tags (info, true);
}
\f
/* Return the base VMA address which should be subtracted from real addresses
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,
{
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
{
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
/* 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;
{
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)
{
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);
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;
}
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;
}
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)
}
}
- 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. */
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)
+ 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);
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);
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);
}
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);
}
}
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));
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 */
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)
{
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;
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);
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)
{
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)
+ 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. */
/* 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)
{
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;
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;
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;
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
{
/* 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));
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 =
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 *,
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
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;
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)
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;
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;
/* 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)
&& (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))
{
&& 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
&& 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
&& !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
&& 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
|| !_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;
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;
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);
}
}
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;
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)
}
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;
}
+ 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;
+ 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;
}
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;
}
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;
}
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;
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;
{
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;
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)
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"));
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"));
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
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"));
ie. doesn't affect code size, 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"));
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"));
as we can't reliably tell if they're used until after relaxation. */
if (!bfd_link_relocatable (&link_info))
{
- need_layout = bfd_elf_discard_info (link_info.output_bfd, &link_info);
+ need_layout = bfd_elf_discard_info (&link_info);
if (need_layout < 0)
{
einfo (_("%X%P: .eh_frame/.stab edit: %E\n"));
ie. doesn't affect code size, 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"));
einfo (_("%X%P: inline PLT: %E\n"));
}
- if (ppc_elf_tls_setup (link_info.output_bfd, &link_info)
+ if (ppc_elf_tls_setup (&link_info)
&& !notlsopt)
{
if (!ppc_elf_tls_optimize (link_info.output_bfd, &link_info))
been generated. Otherwise the glink .eh_frame CIE won't be
merged with other CIEs, and worse, the glink .eh_frame FDEs won't
be listed in .eh_frame_hdr. */
- 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"));
as we can't reliably tell if they're used until after relaxation. */
if (!bfd_link_relocatable (&link_info))
{
- need_layout = bfd_elf_discard_info (link_info.output_bfd, &link_info);
+ need_layout = bfd_elf_discard_info (&link_info);
if (need_layout < 0)
{
einfo (_("%X%P: .eh_frame/.stab edit: %E\n"));
/* bfd_elf32_discard_info just plays with debugging sections,
ie. doesn't affect any code, so we can delay resizing the
sections. */
- 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"));
sections. */
elf_backend_data *bed = get_elf_backend_data (link_info.output_bfd);
if (bed->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 ();
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"));
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;
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);
}
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,
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"),
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. */
}
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)
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)