https://sourceware.org/bugzilla/show_bug.cgi?id=31458
this is opt-in by each backend. */
- elf_backend_data *bed = get_elf_backend_data (info->output_bfd);
- if (bed != NULL && bed->use_mmap)
+ elf_backend_data *obed = get_elf_backend_data (info->output_bfd);
+ if (obed->use_mmap)
return false;
#endif
bfd *abfd;
/* Define a symbol in a dynamic linkage section. */
struct elf_link_hash_entry *
-_bfd_elf_define_linkage_sym (bfd *abfd,
+_bfd_elf_define_linkage_sym (bfd *dynobj,
struct bfd_link_info *info,
asection *sec,
const char *name)
{
struct elf_link_hash_entry *h;
struct bfd_link_hash_entry *bh;
- elf_backend_data *bed;
+ elf_backend_data *obed;
h = elf_link_hash_lookup (elf_hash_table (info), name, false, false, false);
if (h != NULL)
else
bh = NULL;
- bed = get_elf_backend_data (abfd);
- if (!_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_GLOBAL,
- sec, 0, NULL, false, bed->collect,
+ obed = get_elf_backend_data (dynobj);
+ if (!_bfd_generic_link_add_one_symbol (info, dynobj, name, BSF_GLOBAL,
+ sec, 0, NULL, false, obed->collect,
&bh))
return NULL;
h = (struct elf_link_hash_entry *) bh;
if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ obed->elf_backend_hide_symbol (info, h, true);
return h;
}
bool
-_bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
+_bfd_elf_create_got_section (bfd *dynobj, struct bfd_link_info *info)
{
flagword flags;
asection *s;
struct elf_link_hash_entry *h;
- elf_backend_data *bed = get_elf_backend_data (abfd);
+ elf_backend_data *obed = get_elf_backend_data (dynobj);
struct elf_link_hash_table *htab = elf_hash_table (info);
/* This function may be called more than once. */
if (htab->sgot != NULL)
return true;
- flags = bed->dynamic_sec_flags;
+ flags = obed->dynamic_sec_flags;
- s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
+ s = bfd_make_section_anyway_with_flags (dynobj, ".got", flags);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
htab->sgot = s;
- if (bed->want_got_plt)
+ if (obed->want_got_plt)
{
- s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
+ s = bfd_make_section_anyway_with_flags (dynobj, ".got.plt", flags);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
htab->sgotplt = s;
}
/* The first bit of the global offset table is the header. */
- s->size += bed->got_header_size;
+ s->size += obed->got_header_size;
- if (bed->want_got_sym)
+ if (obed->want_got_sym)
{
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
(or .got.plt) section. We don't do this in the linker script
because we don't want to define the symbol if we are not creating
a global offset table. */
- h = _bfd_elf_define_linkage_sym (abfd, info, s,
+ h = _bfd_elf_define_linkage_sym (dynobj, info, s,
"_GLOBAL_OFFSET_TABLE_");
elf_hash_table (info)->hgot = h;
if (h == NULL)
return false;
}
- s = bfd_make_section_anyway_with_flags (abfd,
- (bed->rela_plts_and_copies_p
+ s = bfd_make_section_anyway_with_flags (dynobj,
+ (obed->rela_plts_and_copies_p
? ".rela.got" : ".rel.got"),
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
htab->srelgot = s;
{
flagword flags;
asection *s;
- elf_backend_data *bed;
+ bfd *dynobj;
+ elf_backend_data *obed;
struct elf_link_hash_entry *h;
if (! is_elf_hash_table (info->hash))
if (!_bfd_elf_link_create_dynstrtab (abfd, info))
return false;
- abfd = elf_hash_table (info)->dynobj;
- bed = get_elf_backend_data (abfd);
+ dynobj = elf_hash_table (info)->dynobj;
+ obed = get_elf_backend_data (dynobj);
- flags = bed->dynamic_sec_flags;
+ flags = obed->dynamic_sec_flags;
/* A dynamically linked executable has a .interp section, but a
shared library does not. */
if (bfd_link_executable (info) && !info->nointerp)
{
- s = bfd_make_section_anyway_with_flags (abfd, ".interp",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".interp",
flags | SEC_READONLY);
if (s == NULL)
return false;
/* Create sections to hold version informations. These are removed
if they are not needed. */
- s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_d",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".gnu.version_d",
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
- s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".gnu.version",
flags | SEC_READONLY);
if (s == NULL
|| !bfd_set_section_alignment (s, 1))
return false;
- s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_r",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".gnu.version_r",
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
- s = bfd_make_section_anyway_with_flags (abfd, ".dynsym",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".dynsym",
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
elf_hash_table (info)->dynsym = s;
- s = bfd_make_section_anyway_with_flags (abfd, ".dynstr",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".dynstr",
flags | SEC_READONLY);
if (s == NULL)
return false;
- s = bfd_make_section_anyway_with_flags (abfd, ".dynamic", flags);
+ s = bfd_make_section_anyway_with_flags (dynobj, ".dynamic", flags);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
elf_hash_table (info)->dynamic = s;
section. We don't want to define it if there is no .dynamic
section, since on some ELF platforms the start up code examines it
to decide how to initialize the process. */
- h = _bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC");
+ h = _bfd_elf_define_linkage_sym (dynobj, info, s, "_DYNAMIC");
elf_hash_table (info)->hdynamic = h;
if (h == NULL)
return false;
if (info->emit_hash)
{
- s = bfd_make_section_anyway_with_flags (abfd, ".hash",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".hash",
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
- elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
+ elf_section_data (s)->this_hdr.sh_entsize = obed->s->sizeof_hash_entry;
}
- if (info->emit_gnu_hash && bed->record_xhash_symbol == NULL)
+ if (info->emit_gnu_hash && obed->record_xhash_symbol == NULL)
{
- s = bfd_make_section_anyway_with_flags (abfd, ".gnu.hash",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".gnu.hash",
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
/* For 64-bit ELF, .gnu.hash is a non-uniform entity size section:
4 32-bit words followed by variable count of 64-bit words, then
variable count of 32-bit words. */
- if (bed->s->arch_size == 64)
+ if (obed->s->arch_size == 64)
elf_section_data (s)->this_hdr.sh_entsize = 0;
else
elf_section_data (s)->this_hdr.sh_entsize = 4;
if (info->enable_dt_relr)
{
- s = bfd_make_section_anyway_with_flags (abfd, ".relr.dyn",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".relr.dyn",
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
elf_hash_table (info)->srelrdyn = s;
}
/* Let the backend create the rest of the sections. This lets the
backend set the right flags. The backend will normally create
the .got and .plt sections. */
- if (bed->elf_backend_create_dynamic_sections == NULL
- || ! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
+ if (obed->elf_backend_create_dynamic_sections == NULL
+ || !obed->elf_backend_create_dynamic_sections (dynobj, info))
return false;
elf_hash_table (info)->dynamic_sections_created = true;
/* Create dynamic sections when linking against a dynamic object. */
bool
-_bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
+_bfd_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
flagword flags, pltflags;
struct elf_link_hash_entry *h;
asection *s;
- elf_backend_data *bed = get_elf_backend_data (abfd);
+ elf_backend_data *obed = get_elf_backend_data (dynobj);
struct elf_link_hash_table *htab = elf_hash_table (info);
/* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
.rel[a].bss sections. */
- flags = bed->dynamic_sec_flags;
+ flags = obed->dynamic_sec_flags;
pltflags = flags;
- if (bed->plt_not_loaded)
+ if (obed->plt_not_loaded)
/* We do not clear SEC_ALLOC here because we still want the OS to
allocate space for the section; it's just that there's nothing
to read in from the object file. */
pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
else
pltflags |= SEC_ALLOC | SEC_CODE | SEC_LOAD;
- if (bed->plt_readonly)
+ if (obed->plt_readonly)
pltflags |= SEC_READONLY;
- s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
+ s = bfd_make_section_anyway_with_flags (dynobj, ".plt", pltflags);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->plt_alignment))
+ || !bfd_set_section_alignment (s, obed->plt_alignment))
return false;
htab->splt = s;
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
.plt section. */
- if (bed->want_plt_sym)
+ if (obed->want_plt_sym)
{
- h = _bfd_elf_define_linkage_sym (abfd, info, s,
+ h = _bfd_elf_define_linkage_sym (dynobj, info, s,
"_PROCEDURE_LINKAGE_TABLE_");
elf_hash_table (info)->hplt = h;
if (h == NULL)
return false;
}
- s = bfd_make_section_anyway_with_flags (abfd,
- (bed->rela_plts_and_copies_p
+ s = bfd_make_section_anyway_with_flags (dynobj,
+ (obed->rela_plts_and_copies_p
? ".rela.plt" : ".rel.plt"),
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
htab->srelplt = s;
- if (! _bfd_elf_create_got_section (abfd, info))
+ if (! _bfd_elf_create_got_section (dynobj, info))
return false;
- if (bed->want_dynbss)
+ if (obed->want_dynbss)
{
/* The .dynbss section is a place to put symbols which are defined
by dynamic objects, are referenced by regular objects, and are
image and use a R_*_COPY reloc to tell the dynamic linker to
initialize them at run time. The linker script puts the .dynbss
section into the .bss section of the final image. */
- s = bfd_make_section_anyway_with_flags (abfd, ".dynbss",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".dynbss",
SEC_ALLOC | SEC_LINKER_CREATED);
if (s == NULL)
return false;
htab->sdynbss = s;
- if (bed->want_dynrelro)
+ if (obed->want_dynrelro)
{
/* Similarly, but for symbols that were originally in read-only
sections. This section doesn't really need to have contents,
but make it like other .data.rel.ro sections. */
- s = bfd_make_section_anyway_with_flags (abfd, ".data.rel.ro",
+ s = bfd_make_section_anyway_with_flags (dynobj, ".data.rel.ro",
flags);
if (s == NULL)
return false;
copy relocs. */
if (bfd_link_executable (info))
{
- s = bfd_make_section_anyway_with_flags (abfd,
- (bed->rela_plts_and_copies_p
+ s = bfd_make_section_anyway_with_flags (dynobj,
+ (obed->rela_plts_and_copies_p
? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY);
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
htab->srelbss = s;
- if (bed->want_dynrelro)
+ if (obed->want_dynrelro)
{
s = (bfd_make_section_anyway_with_flags
- (abfd, (bed->rela_plts_and_copies_p
- ? ".rela.data.rel.ro" : ".rel.data.rel.ro"),
+ (dynobj, (obed->rela_plts_and_copies_p
+ ? ".rela.data.rel.ro" : ".rel.data.rel.ro"),
flags | SEC_READONLY));
if (s == NULL
- || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ || !bfd_set_section_alignment (s, obed->s->log_file_align))
return false;
htab->sreldynrelro = s;
}
{
struct elf_link_hash_entry *h, *hv;
struct elf_link_hash_table *htab;
- elf_backend_data *bed;
+ elf_backend_data *obed;
if (!is_elf_hash_table (info->hash))
return true;
case bfd_link_hash_indirect:
/* We had a versioned symbol in a dynamic library. We make the
the versioned symbol point to this one. */
- bed = get_elf_backend_data (output_bfd);
+ obed = get_elf_backend_data (output_bfd);
hv = h;
while (hv->root.type == bfd_link_hash_indirect
|| hv->root.type == bfd_link_hash_warning)
h->root.type = bfd_link_hash_undefined;
hv->root.type = bfd_link_hash_indirect;
hv->root.u.i.link = (struct bfd_link_hash_entry *) h;
- (*bed->elf_backend_copy_indirect_symbol) (info, h, hv);
+ obed->elf_backend_copy_indirect_symbol (info, h, hv);
break;
default:
BFD_FAIL ();
if (hidden)
{
- bed = get_elf_backend_data (output_bfd);
+ obed = get_elf_backend_data (output_bfd);
if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ obed->elf_backend_hide_symbol (info, h, true);
}
/* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects
if (bfd_link_pic (info)
|| elf_hash_table (info)->is_relocatable_executable)
{
- elf_backend_data *bed = get_elf_backend_data (output_bfd);
+ elf_backend_data *obed = get_elf_backend_data (output_bfd);
asection *p;
for (p = output_bfd->sections; p ; p = p->next)
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))
+ && !obed->elf_backend_omit_section_dynsym (output_bfd, info, p))
{
++dynsymcount;
if (do_sec)
char *shortname;
struct elf_link_hash_entry *hi;
struct bfd_link_hash_entry *bh;
- elf_backend_data *bed;
+ elf_backend_data *obed;
bool collect;
bool dynamic;
bfd *override;
return true;
}
- bed = get_elf_backend_data (info->output_bfd);
- collect = bed->collect;
+ obed = get_elf_backend_data (info->output_bfd);
+ collect = obed->collect;
dynamic = (abfd->flags & DYNAMIC) != 0;
shortlen = p - name;
hi->root.root.string, &hide);
if (hi->verinfo.vertree != NULL && hide)
{
- (*bed->elf_backend_hide_symbol) (info, hi, true);
+ obed->elf_backend_hide_symbol (info, hi, true);
goto nondefault;
}
}
struct elf_link_hash_entry *ht;
ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
- (*bed->elf_backend_copy_indirect_symbol) (info, ht, hi);
+ obed->elf_backend_copy_indirect_symbol (info, ht, hi);
/* If we first saw a reference to SHORTNAME with non-default
visibility, merge that visibility to the @@VER symbol. */
to the user in that case. */
if (hi->root.type == bfd_link_hash_indirect)
{
- (*bed->elf_backend_copy_indirect_symbol) (info, h, hi);
+ obed->elf_backend_copy_indirect_symbol (info, h, hi);
h->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak;
hi->dynamic_def |= h->dynamic_def;
{
const char *p;
bool hide = false;
- elf_backend_data *bed = get_elf_backend_data (info->output_bfd);
+ elf_backend_data *obed = get_elf_backend_data (info->output_bfd);
/* Version script only hides symbols defined in regular objects. */
if (!h->def_regular && !ELF_COMMON_DEF_P (h))
&& hide)
{
if (hide)
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ obed->elf_backend_hide_symbol (info, h, true);
return true;
}
}
h->root.root.string, &hide);
if (h->verinfo.vertree != NULL && hide)
{
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ obed->elf_backend_hide_symbol (info, h, true);
return true;
}
}
{
struct elf_info_failed *sinfo;
struct bfd_link_info *info;
- elf_backend_data *bed;
+ elf_backend_data *obed;
struct elf_info_failed eif;
const char *p;
bool hide;
return false;
}
- bed = get_elf_backend_data (info->output_bfd);
+ obed = get_elf_backend_data (info->output_bfd);
/* We only need version numbers for symbols defined in regular
objects. */
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& discarded_section (h->root.u.def.section))
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ obed->elf_backend_hide_symbol (info, h, true);
return true;
}
}
if (hide)
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ obed->elf_backend_hide_symbol (info, h, true);
/* If we are building an application, we need to create a
version node for this version. */
= bfd_find_version_for_sym (sinfo->info->version_info,
h->root.root.string, &hide);
if (h->verinfo.vertree != NULL && hide)
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ obed->elf_backend_hide_symbol (info, h, true);
}
return true;
section header for a section containing relocations for O. */
static bool
-_bfd_elf_link_size_reloc_section (bfd *abfd,
+_bfd_elf_link_size_reloc_section (bfd *obfd,
struct bfd_elf_section_reloc_data *reldata)
{
Elf_Internal_Shdr *rel_hdr = reldata->hdr;
allocate it with bfd_alloc rather than malloc. Also since we
cannot be sure that the contents will actually be filled in,
we zero the allocated space. */
- rel_hdr->contents = (unsigned char *) bfd_zalloc (abfd, rel_hdr->sh_size);
+ rel_hdr->contents = bfd_zalloc (obfd, rel_hdr->sh_size);
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
return false;
{
struct elf_link_hash_entry **p;
- p = ((struct elf_link_hash_entry **)
- bfd_zmalloc (reldata->count * sizeof (*p)));
+ p = bfd_zmalloc (reldata->count * sizeof (*p));
if (p == NULL)
return false;
bfd_byte *erel;
struct bfd_elf_section_reloc_data *output_reldata;
asection *output_section;
- elf_backend_data *bed;
+ elf_backend_data *obed;
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
struct bfd_elf_section_data *esdo;
output_section = input_section->output_section;
- bed = get_elf_backend_data (output_bfd);
+ obed = get_elf_backend_data (output_bfd);
esdo = elf_section_data (output_section);
if (esdo->rel.hdr && esdo->rel.hdr->sh_entsize == input_rel_hdr->sh_entsize)
{
output_reldata = &esdo->rel;
- swap_out = bed->s->swap_reloc_out;
+ swap_out = obed->s->swap_reloc_out;
}
else if (esdo->rela.hdr
&& esdo->rela.hdr->sh_entsize == input_rel_hdr->sh_entsize)
{
output_reldata = &esdo->rela;
- swap_out = bed->s->swap_reloca_out;
+ swap_out = obed->s->swap_reloca_out;
}
else
{
erel += output_reldata->count * input_rel_hdr->sh_entsize;
irela = internal_relocs;
irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
- * bed->s->int_rels_per_ext_rel);
+ * obed->s->int_rels_per_ext_rel);
while (irela < irelaend)
{
if (rel_hash && *rel_hash)
(*rel_hash)->has_reloc = 1;
(*swap_out) (output_bfd, irela, erel);
- irela += bed->s->int_rels_per_ext_rel;
+ irela += obed->s->int_rels_per_ext_rel;
erel += input_rel_hdr->sh_entsize;
if (rel_hash)
rel_hash++;
_bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
struct elf_info_failed *eif)
{
- elf_backend_data *bed;
+ elf_backend_data *obed;
/* If this symbol was mentioned in a non-ELF file, try to set
DEF_REGULAR and REF_REGULAR correctly. This is the only way to
}
/* Backend specific symbol fixup. */
- bed = get_elf_backend_data (eif->info->output_bfd);
- if (bed->elf_backend_fixup_symbol
- && !(*bed->elf_backend_fixup_symbol) (eif->info, h))
+ obed = get_elf_backend_data (eif->info->output_bfd);
+ if (obed->elf_backend_fixup_symbol
+ && !obed->elf_backend_fixup_symbol (eif->info, h))
return false;
/* If this is a final link, and the symbol was defined as a common
/* Symbols defined in discarded sections shouldn't be dynamic. */
if (h->root.type == bfd_link_hash_undefined && h->indx == -3)
- (*bed->elf_backend_hide_symbol) (eif->info, h, true);
+ obed->elf_backend_hide_symbol (eif->info, h, true);
/* If a weak undefined symbol has non-default visibility, we also
hide it from the dynamic linker. */
else if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
&& h->root.type == bfd_link_hash_undefweak)
- (*bed->elf_backend_hide_symbol) (eif->info, h, true);
+ obed->elf_backend_hide_symbol (eif->info, h, true);
/* A hidden versioned symbol in executable should be forced local if
it is is locally defined, not referenced by shared library and not
&& !h->dynamic
&& !h->ref_dynamic
&& h->def_regular)
- (*bed->elf_backend_hide_symbol) (eif->info, h, true);
+ obed->elf_backend_hide_symbol (eif->info, h, true);
/* If -Bsymbolic was used (which means to bind references to global
symbols to the definition within the shared object), and this
force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN);
- (*bed->elf_backend_hide_symbol) (eif->info, h, force_local);
+ obed->elf_backend_hide_symbol (eif->info, h, force_local);
}
/* If this is a weak defined symbol in a dynamic object, and we know
BFD_ASSERT (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak);
BFD_ASSERT (def->def_dynamic);
- (*bed->elf_backend_copy_indirect_symbol) (eif->info, def, h);
+ obed->elf_backend_copy_indirect_symbol (eif->info, def, h);
}
}
{
struct elf_info_failed *eif = (struct elf_info_failed *) data;
struct elf_link_hash_table *htab;
- elf_backend_data *bed;
+ elf_backend_data *obed;
if (! is_elf_hash_table (eif->info->hash))
return false;
if (! _bfd_elf_fix_symbol_flags (h, eif))
return false;
- bed = get_elf_backend_data (htab->dynobj);
+ obed = get_elf_backend_data (htab->dynobj);
if (h->root.type == bfd_link_hash_undefweak)
{
if (eif->info->dynamic_undefined_weak == 0)
- (*bed->elf_backend_hide_symbol) (eif->info, h, true);
+ obed->elf_backend_hide_symbol (eif->info, h, true);
else if (eif->info->dynamic_undefined_weak > 0
&& h->ref_regular
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
(_("warning: type and size of dynamic symbol `%s' are not defined"),
h->root.root.string);
- if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h))
+ if (!obed->elf_backend_adjust_dynamic_symbol (eif->info, h))
{
eif->failed = true;
return false;
bool not_local_protected)
{
bool binding_stays_local_p;
- elf_backend_data *bed;
+ elf_backend_data *obed;
struct elf_link_hash_table *hash_table;
if (h == NULL)
if (!is_elf_hash_table (&hash_table->root))
return false;
- bed = get_elf_backend_data (hash_table->dynobj);
+ obed = get_elf_backend_data (hash_table->dynobj);
/* Proper resolution for function pointer equality may require
that these symbols perhaps be resolved dynamically, even though
we should be resolving them to the current module. */
- if (!not_local_protected || !bed->is_function_type (h->type))
+ if (!not_local_protected || !obed->is_function_type (h->type))
binding_stays_local_p = true;
break;
struct bfd_link_info *info,
bool local_protected)
{
- elf_backend_data *bed;
+ elf_backend_data *obed;
struct elf_link_hash_table *hash_table;
/* If it's a local sym, of course we resolve locally. */
if (info->indirect_extern_access > 0)
return true;
- bed = get_elf_backend_data (hash_table->dynobj);
+ obed = get_elf_backend_data (hash_table->dynobj);
/* If extern_protected_data is false, STV_PROTECTED non-function
symbols are local. */
if ((!info->extern_protected_data
|| (info->extern_protected_data < 0
- && !bed->extern_protected_data))
- && !bed->is_function_type (h->type))
+ && !obed->extern_protected_data))
+ && !obed->is_function_type (h->type))
return true;
/* Function pointer equality tests may require that STV_PROTECTED
/* Return TRUE iff this is a non-common, definition of a non-function symbol. */
static bool
-is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
+is_global_data_symbol_definition (bfd *abfd,
Elf_Internal_Sym *sym)
{
elf_backend_data *bed;
bfd_vma val)
{
struct elf_link_hash_table *hash_table;
- elf_backend_data *bed;
+ elf_backend_data *obed;
asection *s;
bfd_size_type newsize;
bfd_byte *newcontents;
if (tag == DT_RELA || tag == DT_REL)
hash_table->dynamic_relocs = true;
- bed = get_elf_backend_data (hash_table->dynobj);
+ obed = get_elf_backend_data (hash_table->dynobj);
s = hash_table->dynamic;
BFD_ASSERT (s != NULL);
- newsize = s->size + bed->s->sizeof_dyn;
+ newsize = s->size + obed->s->sizeof_dyn;
newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize);
if (newcontents == NULL)
return false;
dyn.d_tag = tag;
dyn.d_un.d_val = val;
- bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->size);
+ obed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->size);
s->size = newsize;
s->contents = newcontents;
_bfd_elf_strip_zero_sized_dynamic_sections (struct bfd_link_info *info)
{
struct elf_link_hash_table *hash_table;
- elf_backend_data *bed;
+ elf_backend_data *obed;
asection *s, *sdynamic, **pp;
asection *rela_dyn, *rel_dyn;
Elf_Internal_Dyn dyn;
if (!sdynamic)
return true;
- bed = get_elf_backend_data (hash_table->dynobj);
- swap_dyn_in = bed->s->swap_dyn_in;
+ obed = get_elf_backend_data (hash_table->dynobj);
+ swap_dyn_in = obed->s->swap_dyn_in;
strip_zero_sized = false;
strip_zero_sized_plt = false;
extdyn < sdynamic->contents + sdynamic->size;
extdyn = next)
{
- next = extdyn + bed->s->sizeof_dyn;
+ next = extdyn + obed->s->sizeof_dyn;
swap_dyn_in (hash_table->dynobj, extdyn, &dyn);
switch (dyn.d_tag)
{
if (_bfd_elf_strtab_refcount (hash_table->dynstr, strindex) != 1)
{
asection *sdyn;
- elf_backend_data *bed;
+ elf_backend_data *obed;
bfd_byte *extdyn;
- bed = get_elf_backend_data (hash_table->dynobj);
+ obed = get_elf_backend_data (hash_table->dynobj);
sdyn = hash_table->dynamic;
if (sdyn != NULL && sdyn->size != 0)
for (extdyn = sdyn->contents;
extdyn < sdyn->contents + sdyn->size;
- extdyn += bed->s->sizeof_dyn)
+ extdyn += obed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
- bed->s->swap_dyn_in (hash_table->dynobj, extdyn, &dyn);
+ obed->s->swap_dyn_in (hash_table->dynobj, extdyn, &dyn);
if (dyn.d_tag == DT_NEEDED
&& dyn.d_un.d_val == strindex)
{
bfd *dynobj = hash_table->dynobj;
asection *sdyn;
bfd_size_type size;
- elf_backend_data *bed;
+ elf_backend_data *obed;
bfd_byte *extdyn;
_bfd_elf_strtab_finalize (dynstr);
if (info->callbacks->examine_strtab)
info->callbacks->examine_strtab (dynstr);
- bed = get_elf_backend_data (dynobj);
+ obed = get_elf_backend_data (dynobj);
sdyn = hash_table->dynamic;
BFD_ASSERT (sdyn != NULL);
/* Update all .dynamic entries referencing .dynstr strings. */
for (extdyn = sdyn->contents;
extdyn < PTR_ADD (sdyn->contents, sdyn->size);
- extdyn += bed->s->sizeof_dyn)
+ extdyn += obed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
- bed->s->swap_dyn_in (dynobj, extdyn, &dyn);
+ obed->s->swap_dyn_in (dynobj, extdyn, &dyn);
switch (dyn.d_tag)
{
case DT_STRSZ:
default:
continue;
}
- bed->s->swap_dyn_out (dynobj, &dyn, extdyn);
+ obed->s->swap_dyn_out (dynobj, &dyn, extdyn);
}
/* Now update local dynamic symbols. */
uint64_t best_chlen = ~((uint64_t) 0);
bfd *dynobj = elf_hash_table (info)->dynobj;
size_t dynsymcount = elf_hash_table (info)->dynsymcount;
- elf_backend_data *bed = get_elf_backend_data (dynobj);
+ elf_backend_data *obed = get_elf_backend_data (dynobj);
unsigned long int *counts;
bfd_size_type amt;
unsigned int no_improvement_count = 0;
/* We in any case need 2 + DYNSYMCOUNT entries for the size values
and the chains. */
- max = (2 + dynsymcount) * bed->s->sizeof_hash_entry;
+ max = (2 + dynsymcount) * obed->s->sizeof_hash_entry;
# if 1
/* Variant 1: optimize for short chains. We add the squares
max += counts[j] * counts[j];
/* This adds penalties for the overall size of the table. */
- fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
+ fact = i / (BFD_TARGET_PAGESIZE / obed->s->sizeof_hash_entry) + 1;
max *= fact * fact;
# else
/* Variant 2: Optimize a lot more for small table. Here we
/* The overall size of the table is considered, but not as
strong as in variant 1, where it is squared. */
- fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
+ fact = i / (BFD_TARGET_PAGESIZE / obed->s->sizeof_hash_entry) + 1;
max *= fact;
# endif
asection **sinterpptr)
{
bfd *dynobj;
- elf_backend_data *bed;
+ elf_backend_data *obed;
*sinterpptr = NULL;
elf_hash_table (info)->init_plt_refcount
= elf_hash_table (info)->init_plt_offset;
- bed = get_elf_backend_data (output_bfd);
+ obed = get_elf_backend_data (output_bfd);
/* The backend may have to create some sections regardless of whether
we're dynamic or not. */
- if (bed->elf_backend_early_size_sections
- && !bed->elf_backend_early_size_sections (output_bfd, info))
+ if (obed->elf_backend_early_size_sections
+ && !obed->elf_backend_early_size_sections (output_bfd, info))
return false;
dynobj = elf_hash_table (info)->dynobj;
}
}
- if (info->gc_sections && bed->can_gc_sections)
+ if (info->gc_sections && obed->can_gc_sections)
{
struct elf_gc_sweep_symbol_info sweep_info;
/* Remove the symbols that were in the swept sections from the
dynamic symbol table. */
sweep_info.info = info;
- sweep_info.hide_symbol = bed->elf_backend_hide_symbol;
+ sweep_info.hide_symbol = obed->elf_backend_hide_symbol;
elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol,
&sweep_info);
}
if (sinfo.failed)
return false;
- bed->elf_backend_add_glibc_version_dependency (&sinfo);
+ obed->elf_backend_add_glibc_version_dependency (&sinfo);
if (sinfo.failed)
return false;
break;
}
}
- else if (bed->default_execstack && info->default_execstack)
+ else if (obed->default_execstack && info->default_execstack)
{
exec = PF_X;
emptyobj = inputobj;
if ((info->emit_hash
&& !_bfd_elf_add_dynamic_entry (info, DT_HASH, 0))
|| (info->emit_gnu_hash
- && (bed->record_xhash_symbol == NULL
+ && (obed->record_xhash_symbol == NULL
&& !_bfd_elf_add_dynamic_entry (info, DT_GNU_HASH, 0)))
|| !_bfd_elf_add_dynamic_entry (info, DT_STRTAB, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize)
|| !_bfd_elf_add_dynamic_entry (info, DT_SYMENT,
- bed->s->sizeof_sym)
+ obed->s->sizeof_sym)
|| (info->gnu_flags_1
&& !_bfd_elf_add_dynamic_entry (info, DT_GNU_FLAGS_1,
info->gnu_flags_1)))
/* The backend must work out the sizes of all the other dynamic
sections. */
- if (bed->elf_backend_late_size_sections != NULL
- && !bed->elf_backend_late_size_sections (output_bfd, info))
+ if (obed->elf_backend_late_size_sections != NULL
+ && !obed->elf_backend_late_size_sections (output_bfd, info))
return false;
if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created)
bool
bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
{
- elf_backend_data *bed;
+ elf_backend_data *obed;
unsigned long section_sym_count;
bfd_size_type dynsymcount = 0;
if (!is_elf_hash_table (info->hash))
return true;
- bed = get_elf_backend_data (output_bfd);
- (*bed->elf_backend_init_index_section) (output_bfd, info);
+ obed = get_elf_backend_data (output_bfd);
+ obed->elf_backend_init_index_section (output_bfd, info);
/* Assign dynsym indices. In a shared library we generate a section
symbol for each output section, which come first. Next come all
data in that case, to satisfy those relocations). */
if (elf_hash_table (info)->dynamic_sections_created
- || bed->always_renumber_dynsyms)
+ || obed->always_renumber_dynsyms)
dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info,
§ion_sym_count);
section as we went along in elf_link_add_object_symbols. */
s = elf_hash_table (info)->dynsym;
BFD_ASSERT (s != NULL);
- s->size = dynsymcount * bed->s->sizeof_sym;
+ s->size = dynsymcount * obed->s->sizeof_sym;
s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
if (s->contents == NULL)
/* The first entry in .dynsym is a dummy symbol. Clear all the
section syms, in case we don't output them all. */
++section_sym_count;
- memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym);
+ memset (s->contents, 0, section_sym_count * obed->s->sizeof_sym);
elf_hash_table (info)->bucketcount = 0;
cinfo.hashval = cinfo.hashcodes + dynsymcount;
cinfo.min_dynindx = -1;
cinfo.output_bfd = output_bfd;
- cinfo.bed = bed;
+ cinfo.bed = obed;
/* Put all hash values in HASHCODES. */
elf_link_hash_traverse (elf_hash_table (info),
return false;
}
- s = bfd_get_linker_section (dynobj, GNU_HASH_SECTION_NAME (bed));
+ s = bfd_get_linker_section (dynobj, GNU_HASH_SECTION_NAME (obed));
BFD_ASSERT (s != NULL);
if (cinfo.nsyms == 0)
/* Empty .gnu.hash or .MIPS.xhash section is special. */
BFD_ASSERT (cinfo.min_dynindx == -1);
free (cinfo.hashcodes);
- s->size = 5 * 4 + bed->s->arch_size / 8;
+ s->size = 5 * 4 + obed->s->arch_size / 8;
contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
if (contents == NULL)
return false;
/* Only hash fn bloom filter. */
bfd_put_32 (output_bfd, 0, contents + 12);
/* No hashes are valid - empty bitmask. */
- bfd_put (bed->s->arch_size, output_bfd, 0, contents + 16);
+ bfd_put (obed->s->arch_size, output_bfd, 0, contents + 16);
/* No hashes in the only bucket. */
bfd_put_32 (output_bfd, 0,
- contents + 16 + bed->s->arch_size / 8);
+ contents + 16 + obed->s->arch_size / 8);
}
else
{
maskbitslog2 = maskbitslog2 + 3;
else
maskbitslog2 = maskbitslog2 + 2;
- if (bed->s->arch_size == 64)
+ if (obed->s->arch_size == 64)
{
if (maskbitslog2 == 5)
maskbitslog2 = 6;
s->size = (4 + bucketcount + cinfo.nsyms) * 4;
s->size += cinfo.maskbits / 8;
- if (bed->record_xhash_symbol != NULL)
+ if (obed->record_xhash_symbol != NULL)
s->size += cinfo.nsyms * 4;
contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
if (contents == NULL)
contents = s->contents + 16;
for (i = 0; i < maskwords; ++i)
{
- bfd_put (bed->s->arch_size, output_bfd, cinfo.bitmask[i],
+ bfd_put (obed->s->arch_size, output_bfd, cinfo.bitmask[i],
contents);
- contents += bed->s->arch_size / 8;
+ contents += obed->s->arch_size / 8;
}
free (cinfo.bitmask);
{
if (is_elf_hash_table (info->hash))
{
- elf_backend_data *bed = get_elf_backend_data (output_bfd);
+ elf_backend_data *obed = get_elf_backend_data (output_bfd);
struct elf_link_hash_entry *eh = (struct elf_link_hash_entry *) h;
eh->def_dynamic = 0;
eh->ref_dynamic = 0;
eh->dynamic_def = 0;
- bed->elf_backend_hide_symbol (info, eh, true);
+ obed->elf_backend_hide_symbol (info, eh, true);
}
}
bool
_bfd_elf_link_hash_table_init
(struct elf_link_hash_table *table,
- bfd *abfd,
+ bfd *obfd,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
unsigned int entsize)
{
bool ret;
- elf_backend_data *bed = get_elf_backend_data (abfd);
- int can_refcount = bed->can_refcount;
+ elf_backend_data *obed = get_elf_backend_data (obfd);
+ int can_refcount = obed->can_refcount;
table->init_got_refcount.refcount = can_refcount - 1;
table->init_plt_refcount.refcount = can_refcount - 1;
/* The first dynamic symbol is a dummy. */
table->dynsymcount = 1;
- ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
+ ret = _bfd_link_hash_table_init (&table->root, obfd, newfunc, entsize);
table->root.type = bfd_link_elf_hash_table;
- table->hash_table_id = bed->target_id;
- table->target_os = bed->target_os;
+ table->hash_table_id = obed->target_id;
+ table->target_os = obed->target_os;
table->root.hash_table_free = _bfd_elf_link_hash_table_free;
return ret;
/* Create an ELF linker hash table. */
struct bfd_link_hash_table *
-_bfd_elf_link_hash_table_create (bfd *abfd)
+_bfd_elf_link_hash_table_create (bfd *obfd)
{
struct elf_link_hash_table *ret;
size_t amt = sizeof (struct elf_link_hash_table);
if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc,
+ if (! _bfd_elf_link_hash_table_init (ret, obfd, _bfd_elf_link_hash_newfunc,
sizeof (struct elf_link_hash_entry)))
{
free (ret);
entry for a dynamic object. */
void
-bfd_elf_set_dt_needed_name (bfd *abfd, const char *name)
+bfd_elf_set_dt_needed_name (bfd *obfd, const char *name)
{
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_get_format (abfd) == bfd_object)
- elf_dt_name (abfd) = name;
+ if (bfd_get_flavour (obfd) == bfd_target_elf_flavour
+ && bfd_get_format (obfd) == bfd_object)
+ elf_dt_name (obfd) = name;
}
int
the linker ELF emulation code. */
struct bfd_link_needed_list *
-bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
+bfd_elf_get_needed_list (bfd *obfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
if (! is_elf_hash_table (info->hash))
hook for the linker ELF emulation code. */
struct bfd_link_needed_list *
-bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED,
+bfd_elf_get_runpath_list (bfd *obfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
if (! is_elf_hash_table (info->hash))
}
static size_t
-elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
+elf_link_sort_relocs (bfd *obfd, struct bfd_link_info *info, asection **psec)
{
asection *dynamic_relocs;
asection *rela_dyn;
size_t i, ret, sort_elt, ext_size;
bfd_byte *sort, *s_non_relative, *p;
struct elf_link_sort_rela *sq;
- elf_backend_data *bed = get_elf_backend_data (abfd);
- int i2e = bed->s->int_rels_per_ext_rel;
- unsigned int opb = bfd_octets_per_byte (abfd, NULL);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
+ int i2e = obed->s->int_rels_per_ext_rel;
+ unsigned int opb = bfd_octets_per_byte (obfd, NULL);
void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
struct bfd_link_order *lo;
bool use_rela;
/* Find a dynamic reloc section. */
- rela_dyn = bfd_get_section_by_name (abfd, ".rela.dyn");
- rel_dyn = bfd_get_section_by_name (abfd, ".rel.dyn");
+ rela_dyn = bfd_get_section_by_name (obfd, ".rela.dyn");
+ rel_dyn = bfd_get_section_by_name (obfd, ".rel.dyn");
if (rela_dyn != NULL && rela_dyn->size > 0
&& rel_dyn != NULL && rel_dyn->size > 0)
{
{
asection *o = lo->u.indirect.section;
- if ((o->size % bed->s->sizeof_rela) == 0)
+ if ((o->size % obed->s->sizeof_rela) == 0)
{
- if ((o->size % bed->s->sizeof_rel) == 0)
+ if ((o->size % obed->s->sizeof_rel) == 0)
/* Section size is divisible by both rel and rela sizes.
It is of no help to us. */
;
{
_bfd_error_handler (_("%pB: unable to sort relocs - "
"they are in more than one size"),
- abfd);
+ obfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
}
}
}
- else if ((o->size % bed->s->sizeof_rel) == 0)
+ else if ((o->size % obed->s->sizeof_rel) == 0)
{
/* Section size is only divisible by rel. */
if (use_rela_initialised && use_rela)
{
_bfd_error_handler (_("%pB: unable to sort relocs - "
"they are in more than one size"),
- abfd);
+ obfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
/* The section size is not divisible by either -
something is wrong. */
_bfd_error_handler (_("%pB: unable to sort relocs - "
- "they are of an unknown size"), abfd);
+ "they are of an unknown size"), obfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
{
asection *o = lo->u.indirect.section;
- if ((o->size % bed->s->sizeof_rela) == 0)
+ if ((o->size % obed->s->sizeof_rela) == 0)
{
- if ((o->size % bed->s->sizeof_rel) == 0)
+ if ((o->size % obed->s->sizeof_rel) == 0)
/* Section size is divisible by both rel and rela sizes.
It is of no help to us. */
;
{
_bfd_error_handler (_("%pB: unable to sort relocs - "
"they are in more than one size"),
- abfd);
+ obfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
}
}
}
- else if ((o->size % bed->s->sizeof_rel) == 0)
+ else if ((o->size % obed->s->sizeof_rel) == 0)
{
/* Section size is only divisible by rel. */
if (use_rela_initialised && use_rela)
{
_bfd_error_handler (_("%pB: unable to sort relocs - "
"they are in more than one size"),
- abfd);
+ obfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
/* The section size is not divisible by either -
something is wrong. */
_bfd_error_handler (_("%pB: unable to sort relocs - "
- "they are of an unknown size"), abfd);
+ "they are of an unknown size"), obfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
if (use_rela)
{
dynamic_relocs = rela_dyn;
- ext_size = bed->s->sizeof_rela;
- swap_in = bed->s->swap_reloca_in;
- swap_out = bed->s->swap_reloca_out;
+ ext_size = obed->s->sizeof_rela;
+ swap_in = obed->s->swap_reloca_in;
+ swap_out = obed->s->swap_reloca_out;
}
else
{
dynamic_relocs = rel_dyn;
- ext_size = bed->s->sizeof_rel;
- swap_in = bed->s->swap_reloc_in;
- swap_out = bed->s->swap_reloc_out;
+ ext_size = obed->s->sizeof_rel;
+ swap_in = obed->s->swap_reloc_in;
+ swap_out = obed->s->swap_reloc_out;
}
size = 0;
if (sort == NULL)
{
(*info->callbacks->warning)
- (info, _("not enough memory to sort relocations"), 0, abfd, 0, 0);
+ (info, _("not enough memory to sort relocations"), 0, obfd, 0, 0);
return 0;
}
- if (bed->s->arch_size == 32)
+ if (obed->s->arch_size == 32)
r_sym_mask = ~(bfd_vma) 0xff;
else
r_sym_mask = ~(bfd_vma) 0xffffffff;
{
struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
- (*swap_in) (abfd, erel, s->rela);
- s->type = (*bed->elf_backend_reloc_type_class) (info, o, s->rela);
+ (*swap_in) (obfd, erel, s->rela);
+ s->type = obed->elf_backend_reloc_type_class (info, o, s->rela);
s->u.sym_mask = r_sym_mask;
p += sort_elt;
erel += ext_size;
while (erel < erelend)
{
struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
- (*swap_out) (abfd, s->rela, erel);
+ (*swap_out) (obfd, s->rela, erel);
p += sort_elt;
erel += ext_size;
}
return ret;
}
-/* Return TRUE if the dynamic symbol SYM in ABFD is supported. */
+/* Return TRUE if the dynamic symbol SYM in OBFD is supported. */
static bool
-check_dynsym (bfd *abfd, Elf_Internal_Sym *sym)
+check_dynsym (bfd *obfd, Elf_Internal_Sym *sym)
{
if (sym->st_shndx >= (SHN_LORESERVE & 0xffff)
&& sym->st_shndx < SHN_LORESERVE)
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: too many sections: %d (>= %d)"),
- abfd, bfd_count_sections (abfd), SHN_LORESERVE & 0xffff);
+ obfd, bfd_count_sections (obfd), SHN_LORESERVE & 0xffff);
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
return true;
}
-/* Generate an import library in INFO->implib_bfd from symbols in ABFD.
+/* Generate an import library in INFO->implib_bfd from symbols in OBFD.
Returns TRUE upon success, FALSE otherwise. */
static bool
-elf_output_implib (bfd *abfd, struct bfd_link_info *info)
+elf_output_implib (bfd *obfd, struct bfd_link_info *info)
{
bool ret = false;
bfd *implib_bfd;
- elf_backend_data *bed;
+ elf_backend_data *obed;
flagword flags;
enum bfd_architecture arch;
unsigned int mach;
size_t amt;
implib_bfd = info->out_implib_bfd;
- bed = get_elf_backend_data (abfd);
+ obed = get_elf_backend_data (obfd);
if (!bfd_set_format (implib_bfd, bfd_object))
return false;
/* Use flag from executable but make it a relocatable object. */
- flags = bfd_get_file_flags (abfd);
+ flags = bfd_get_file_flags (obfd);
flags &= ~HAS_RELOC;
if (!bfd_set_start_address (implib_bfd, 0)
|| !bfd_set_file_flags (implib_bfd, flags & ~EXEC_P))
return false;
/* Copy architecture of output file to import library file. */
- arch = bfd_get_arch (abfd);
- mach = bfd_get_mach (abfd);
+ arch = bfd_get_arch (obfd);
+ mach = bfd_get_mach (obfd);
if (!bfd_set_arch_mach (implib_bfd, arch, mach)
- && (abfd->target_defaulted
- || bfd_get_arch (abfd) != bfd_get_arch (implib_bfd)))
+ && (obfd->target_defaulted
+ || bfd_get_arch (obfd) != bfd_get_arch (implib_bfd)))
return false;
/* Get symbol table size. */
- symsize = bfd_get_symtab_upper_bound (abfd);
+ symsize = bfd_get_symtab_upper_bound (obfd);
if (symsize < 0)
return false;
if (sympp == NULL)
return false;
- symcount = bfd_canonicalize_symtab (abfd, sympp);
+ symcount = bfd_canonicalize_symtab (obfd, sympp);
if (symcount < 0)
goto free_sym_buf;
/* Allow the BFD backend to copy any private header data it
understands from the output BFD to the import library BFD. */
- if (! bfd_copy_private_header_data (abfd, implib_bfd))
+ if (! bfd_copy_private_header_data (obfd, implib_bfd))
goto free_sym_buf;
/* Filter symbols to appear in the import library. */
- if (bed->elf_backend_filter_implib_symbols)
- symcount = bed->elf_backend_filter_implib_symbols (abfd, info, sympp,
- symcount);
+ if (obed->elf_backend_filter_implib_symbols)
+ symcount = obed->elf_backend_filter_implib_symbols (obfd, info, sympp,
+ symcount);
else
- symcount = _bfd_elf_filter_global_symbols (abfd, info, sympp, symcount);
+ symcount = _bfd_elf_filter_global_symbols (obfd, info, sympp, symcount);
if (symcount == 0)
{
bfd_set_error (bfd_error_no_symbols);
/* Allow the BFD backend to copy any private data it understands
from the output BFD to the import library BFD. This is done last
to permit the routine to look at the filtered symbol table. */
- if (! bfd_copy_private_bfd_data (abfd, implib_bfd))
+ if (! bfd_copy_private_bfd_data (obfd, implib_bfd))
goto free_sym_buf;
if (!bfd_close (implib_bfd))
/* Do the final step of an ELF link. */
bool
-_bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
+_bfd_elf_final_link (bfd *obfd, struct bfd_link_info *info)
{
bool dynamic;
bool emit_relocs;
unsigned int i;
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Shdr *symtab_shndx_hdr;
- elf_backend_data *bed = get_elf_backend_data (abfd);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
struct elf_outext_info eoinfo;
bool merged;
size_t relativecount;
return false;
if (bfd_link_pic (info))
- abfd->flags |= DYNAMIC;
+ obfd->flags |= DYNAMIC;
dynamic = htab->dynamic_sections_created;
dynobj = htab->dynobj;
memset (&flinfo, 0, sizeof (flinfo));
flinfo.info = info;
- flinfo.output_bfd = abfd;
+ flinfo.output_bfd = obfd;
flinfo.symstrtab = _bfd_elf_strtab_init ();
if (flinfo.symstrtab == NULL)
return false;
section. */
sections_removed = false;
#ifdef OBJ_MAYBE_ELF_ATTRIBUTES
- const char *obj_attrs_section = get_elf_backend_data (abfd)->obj_attrs_section;
+ const char *obj_attrs_section = get_elf_backend_data (obfd)->obj_attrs_section;
#endif
- for (o = abfd->sections; o != NULL; o = o->next)
+ for (o = obfd->sections; o != NULL; o = o->next)
{
bool remove_section = false;
/* Skip this section later on. */
o->map_head.link_order = NULL;
- bfd_vma attr_size = bfd_elf_obj_attr_size (abfd);
+ bfd_vma attr_size = bfd_elf_obj_attr_size (obfd);
/* Once ELF headers have been written, the size of a section is
frozen. We need to set the size of the attribute section before
_bfd_elf_compute_section_file_positions. */
bfd_set_section_size (o, attr_size);
if (attr_size > 0)
- elf_obj_object_attributes (abfd) = o;
+ elf_obj_object_attributes (obfd) = o;
else
remove_section = true;
}
if (remove_section)
{
o->flags |= SEC_EXCLUDE;
- bfd_section_list_remove (abfd, o);
- abfd->section_count--;
+ bfd_section_list_remove (obfd, o);
+ obfd->section_count--;
sections_removed = true;
}
}
section, so that we know the sizes of the reloc sections. We
also figure out some maximum sizes. */
#ifdef USE_MMAP
- if (bed->use_mmap)
+ if (obed->use_mmap)
{
/* Mmap is used only if section size >= the minimum mmap section
size. The initial max_contents_size value covers all sections
max_sym_count = 0;
max_sym_shndx_count = 0;
merged = false;
- for (o = abfd->sections; o != NULL; o = o->next)
+ for (o = obfd->sections; o != NULL; o = o->next)
{
struct bfd_elf_section_data *esdo = elf_section_data (o);
bfd_size_type size_align = 1;
/* eh_frame editing can extend last FDE to cover padding
between one section and the next. */
size_align = (((bfd_size_type) 1 << o->alignment_power)
- * bfd_octets_per_byte (abfd, o));
+ * bfd_octets_per_byte (obfd, o));
}
o->reloc_count = 0;
#ifdef USE_MMAP
/* Mmap is used only on non-compressed, non-linker created
sections whose rawsize == size. */
- if (!bed->use_mmap
+ if (!obed->use_mmap
|| sec->compress_status != COMPRESS_SECTION_NONE
|| (sec->flags & SEC_LINKER_CREATED) != 0
|| sec->rawsize != sec->size)
symbols. */
if (elf_bad_symtab (sec->owner))
sym_count = (elf_symtab_hdr (sec->owner).sh_size
- / bed->s->sizeof_sym);
+ / obed->s->sizeof_sym);
else
sym_count = elf_symtab_hdr (sec->owner).sh_info;
else if (emit_relocs)
{
reloc_count = sec->reloc_count;
- if (bed->elf_backend_count_additional_relocs)
+ if (obed->elf_backend_count_additional_relocs)
{
int c;
- c = (*bed->elf_backend_count_additional_relocs) (sec);
+ c = obed->elf_backend_count_additional_relocs (sec);
additional_reloc_count += c;
}
}
- else if (bed->elf_backend_count_relocs)
- reloc_count = (*bed->elf_backend_count_relocs) (info, sec);
+ else if (obed->elf_backend_count_relocs)
+ reloc_count = obed->elf_backend_count_relocs (info, sec);
if ((sec->flags & SEC_RELOC) != 0)
{
#ifdef USE_MMAP
- if (!bed->use_mmap)
+ if (!obed->use_mmap)
#endif
{
size_t ext_size = 0;
}
if (! bfd_link_relocatable (info) && merged)
- elf_link_hash_traverse (htab, _bfd_elf_link_sec_merge_syms, abfd);
+ elf_link_hash_traverse (htab, _bfd_elf_link_sec_merge_syms, obfd);
/* Figure out the file positions for everything but the symbol table
and the relocs. We set symcount to force assign_section_numbers
to create a symbol table. */
- abfd->symcount = info->strip != strip_all || emit_relocs;
- BFD_ASSERT (! abfd->output_has_begun);
- if (! _bfd_elf_compute_section_file_positions (abfd, info))
+ obfd->symcount = info->strip != strip_all || emit_relocs;
+ BFD_ASSERT (! obfd->output_has_begun);
+ if (! _bfd_elf_compute_section_file_positions (obfd, info))
goto error_return;
/* Set sizes, and assign file positions for reloc sections. */
- for (o = abfd->sections; o != NULL; o = o->next)
+ for (o = obfd->sections; o != NULL; o = o->next)
{
struct bfd_elf_section_data *esdo = elf_section_data (o);
if ((o->flags & SEC_RELOC) != 0)
{
if (esdo->rel.hdr
- && !(_bfd_elf_link_size_reloc_section (abfd, &esdo->rel)))
+ && !(_bfd_elf_link_size_reloc_section (obfd, &esdo->rel)))
goto error_return;
if (esdo->rela.hdr
- && !(_bfd_elf_link_size_reloc_section (abfd, &esdo->rela)))
+ && !(_bfd_elf_link_size_reloc_section (obfd, &esdo->rela)))
goto error_return;
}
.strtab, and non-loaded reloc and compressed debugging sections. We start
the .symtab section at the current file position, and write directly to it.
We build the .strtab section in memory. */
- abfd->symcount = 0;
- symtab_hdr = &elf_symtab_hdr (abfd);
+ obfd->symcount = 0;
+ symtab_hdr = &elf_symtab_hdr (obfd);
/* sh_name is set in prep_headers. */
symtab_hdr->sh_type = SHT_SYMTAB;
/* sh_flags, sh_addr and sh_size all start off zero. */
- symtab_hdr->sh_entsize = bed->s->sizeof_sym;
+ symtab_hdr->sh_entsize = obed->s->sizeof_sym;
/* sh_link is set in assign_section_numbers. */
/* sh_info is set below. */
/* sh_offset is set just below. */
- symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align;
+ symtab_hdr->sh_addralign = (bfd_vma) 1 << obed->s->log_file_align;
if (max_sym_count < 20)
max_sym_count = 20;
goto error_return;
/* The real buffer will be allocated in elf_link_swap_symbols_out. */
flinfo.symshndxbuf
- = (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF)
+ = (elf_numsections (obfd) > (SHN_LORESERVE & 0xFFFF)
? (Elf_External_Sym_Shndx *) -1 : NULL);
if (info->strip != strip_all || emit_relocs)
{
- file_ptr off = elf_next_file_pos (abfd);
+ file_ptr off = elf_next_file_pos (obfd);
_bfd_elf_assign_file_position_for_section (symtab_hdr, off, true, 0);
- /* Note that at this point elf_next_file_pos (abfd) is
+ /* Note that at this point elf_next_file_pos (obfd) is
incorrect. We do not yet know the size of the .symtab section.
We correct next_file_pos below, after we do know the size. */
index of each one in the index field of the section, so that
we can find it again when outputting relocs. */
- if (bfd_keep_unused_section_symbols (abfd) || emit_relocs)
+ if (bfd_keep_unused_section_symbols (obfd) || emit_relocs)
{
bool name_local_sections
- = (bed->elf_backend_name_local_section_symbols
- && bed->elf_backend_name_local_section_symbols (abfd));
+ = (obed->elf_backend_name_local_section_symbols
+ && obed->elf_backend_name_local_section_symbols (obfd));
const char *name = NULL;
elfsym.st_size = 0;
elfsym.st_other = 0;
elfsym.st_value = 0;
elfsym.st_target_internal = 0;
- for (i = 1; i < elf_numsections (abfd); i++)
+ for (i = 1; i < elf_numsections (obfd); i++)
{
- o = bfd_section_from_elf_index (abfd, i);
+ o = bfd_section_from_elf_index (obfd, i);
if (o != NULL)
{
- o->target_index = bfd_get_symcount (abfd);
+ o->target_index = bfd_get_symcount (obfd);
elfsym.st_shndx = i;
if (!bfd_link_relocatable (info))
elfsym.st_value = o->vma;
/* On some targets like Irix 5 the symbol split between local and global
ones recorded in the sh_info field needs to be done between section
and all other symbols. */
- if (bed->elf_backend_elfsym_local_is_section
- && bed->elf_backend_elfsym_local_is_section (abfd))
- symtab_hdr->sh_info = bfd_get_symcount (abfd);
+ if (obed->elf_backend_elfsym_local_is_section
+ && obed->elf_backend_elfsym_local_is_section (obfd))
+ symtab_hdr->sh_info = bfd_get_symcount (obfd);
/* Allocate some memory to hold information read in from the input
files. */
if (max_sym_count != 0)
{
- amt = max_sym_count * bed->s->sizeof_sym;
+ amt = max_sym_count * obed->s->sizeof_sym;
flinfo.external_syms = (bfd_byte *) bfd_malloc (amt);
if (flinfo.external_syms == NULL)
goto error_return;
sec = sec->next)
{
bfd_size_type size = sec->size;
- unsigned int opb = bfd_octets_per_byte (abfd, sec);
+ unsigned int opb = bfd_octets_per_byte (obfd, sec);
if (size == 0
&& (sec->flags & SEC_HAS_CONTENTS) == 0)
base = htab->tls_sec->vma;
/* Only align end of TLS section if static TLS doesn't have special
alignment requirements. */
- if (bed->static_tls_alignment == 1)
+ if (obed->static_tls_alignment == 1)
end = align_power (end, htab->tls_sec->alignment_power);
htab->tls_size = end - base;
}
/* Finish relative relocations here after regular symbol processing
is finished if DT_RELR is enabled. */
if (info->enable_dt_relr
- && bed->finish_relative_relocs
- && !bed->finish_relative_relocs (info))
+ && obed->finish_relative_relocs
+ && !obed->finish_relative_relocs (info))
info->callbacks->fatal
- (_("%P: %pB: failed to finish relative relocations\n"), abfd);
+ (_("%P: %pB: failed to finish relative relocations\n"), obfd);
/* Since ELF permits relocations to be against local symbols, we
must have the local symbols available when we do the relocations.
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
sub->output_has_begun = false;
- for (o = abfd->sections; o != NULL; o = o->next)
+ for (o = obfd->sections; o != NULL; o = o->next)
{
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour ((sub = p->u.indirect.section->owner))
== bfd_target_elf_flavour)
- && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass)
+ && elf_elfheader (sub)->e_ident[EI_CLASS] == obed->s->elfclass)
{
if (! sub->output_has_begun)
{
else if (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order)
{
- if (! elf_reloc_link_order (abfd, info, o, p))
+ if (! elf_reloc_link_order (obfd, info, o, p))
goto error_return;
}
else
{
- if (! _bfd_default_link_order (abfd, info, o, p))
+ if (! _bfd_default_link_order (obfd, info, o, p))
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour (sub)
== bfd_target_elf_flavour)
&& (elf_elfheader (sub)->e_ident[EI_CLASS]
- != bed->s->elfclass))
+ != obed->s->elfclass))
{
const char *iclass, *oclass;
- switch (bed->s->elfclass)
+ switch (obed->s->elfclass)
{
case ELFCLASS64: oclass = "ELFCLASS64"; break;
case ELFCLASS32: oclass = "ELFCLASS32"; break;
/* If backend needs to output some local symbols not present in the hash
table, do it now. */
- if (bed->elf_backend_output_arch_local_syms)
+ if (obed->elf_backend_output_arch_local_syms)
{
- if (! ((*bed->elf_backend_output_arch_local_syms)
- (abfd, info, &flinfo, elf_link_output_symstrtab)))
+ if (!obed->elf_backend_output_arch_local_syms (obfd, info, &flinfo,
+ elf_link_output_symstrtab))
goto error_return;
}
/* The sh_info field records the index of the first non local symbol. */
if (!symtab_hdr->sh_info)
- symtab_hdr->sh_info = bfd_get_symcount (abfd);
+ symtab_hdr->sh_info = bfd_get_symcount (obfd);
if (dynamic
&& htab->dynsym != NULL
sym.st_other = 0;
sym.st_target_internal = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
+ for (s = obfd->sections; s != NULL; s = s->next)
{
int indx;
bfd_byte *dest;
indx = elf_section_data (s)->this_idx;
BFD_ASSERT (indx > 0);
sym.st_shndx = indx;
- if (! check_dynsym (abfd, &sym))
+ if (! check_dynsym (obfd, &sym))
goto error_return;
sym.st_value = s->vma;
- dest = dynsym + dynindx * bed->s->sizeof_sym;
+ dest = dynsym + dynindx * obed->s->sizeof_sym;
/* Inform the linker of the addition of this symbol. */
if (info->callbacks->ctf_new_dynsym)
info->callbacks->ctf_new_dynsym (dynindx, &sym);
- bed->s->swap_symbol_out (abfd, &sym, dest, 0);
+ obed->s->swap_symbol_out (obfd, &sym, dest, 0);
}
}
{
sym.st_shndx =
elf_section_data (s->output_section)->this_idx;
- if (! check_dynsym (abfd, &sym))
+ if (! check_dynsym (obfd, &sym))
goto error_return;
sym.st_value = (s->output_section->vma
+ s->output_offset
if (info->callbacks->ctf_new_dynsym)
info->callbacks->ctf_new_dynsym (e->dynindx, &sym);
- dest = dynsym + e->dynindx * bed->s->sizeof_sym;
- bed->s->swap_symbol_out (abfd, &sym, dest, 0);
+ dest = dynsym + e->dynindx * obed->s->sizeof_sym;
+ obed->s->swap_symbol_out (obfd, &sym, dest, 0);
}
}
}
/* If backend needs to output some symbols not present in the hash
table, do it now. */
- if (bed->elf_backend_output_arch_syms
+ if (obed->elf_backend_output_arch_syms
&& (info->strip != strip_all || emit_relocs))
{
- if (! ((*bed->elf_backend_output_arch_syms)
- (abfd, info, &flinfo, elf_link_output_symstrtab)))
+ if (!obed->elf_backend_output_arch_syms (obfd, info, &flinfo,
+ elf_link_output_symstrtab))
goto error_return;
}
htab->strtab = NULL;
/* Now we know the size of the symtab section. */
- if (bfd_get_symcount (abfd) > 0)
+ if (bfd_get_symcount (obfd) > 0)
{
/* Finish up and write out the symbol string table (.strtab)
section. */
Elf_Internal_Shdr *symstrtab_hdr = NULL;
file_ptr off = symtab_hdr->sh_offset + symtab_hdr->sh_size;
- if (elf_symtab_shndx_list (abfd))
+ if (elf_symtab_shndx_list (obfd))
{
- symtab_shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
+ symtab_shndx_hdr = & elf_symtab_shndx_list (obfd)->hdr;
if (symtab_shndx_hdr != NULL && symtab_shndx_hdr->sh_name != 0)
{
symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
- amt = bfd_get_symcount (abfd) * sizeof (Elf_External_Sym_Shndx);
+ amt = bfd_get_symcount (obfd) * sizeof (Elf_External_Sym_Shndx);
symtab_shndx_hdr->sh_size = amt;
off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr,
off, true, 0);
- if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_write (flinfo.symshndxbuf, amt, abfd) != amt))
+ if (bfd_seek (obfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
+ || (bfd_write (flinfo.symshndxbuf, amt, obfd) != amt))
goto error_return;
}
}
- symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
+ symstrtab_hdr = &elf_tdata (obfd)->strtab_hdr;
symstrtab_hdr->sh_type = SHT_STRTAB;
symstrtab_hdr->sh_size = _bfd_elf_strtab_size (flinfo.symstrtab);
symstrtab_hdr->sh_addralign = 1;
off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr,
off, true, 0);
- elf_next_file_pos (abfd) = off;
+ elf_next_file_pos (obfd) = off;
- if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
- || ! _bfd_elf_strtab_emit (abfd, flinfo.symstrtab))
+ if (bfd_seek (obfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
+ || ! _bfd_elf_strtab_emit (obfd, flinfo.symstrtab))
goto error_return;
}
- if (info->out_implib_bfd && !elf_output_implib (abfd, info))
+ if (info->out_implib_bfd && !elf_output_implib (obfd, info))
{
_bfd_error_handler (_("%pB: failed to generate import library"),
info->out_implib_bfd);
}
/* Adjust the relocs to have the correct symbol indices. */
- for (o = abfd->sections; o != NULL; o = o->next)
+ for (o = obfd->sections; o != NULL; o = o->next)
{
struct bfd_elf_section_data *esdo = elf_section_data (o);
bool sort;
if ((o->flags & SEC_RELOC) == 0)
continue;
- sort = bed->sort_relocs_p == NULL || (*bed->sort_relocs_p) (o);
+ sort = obed->sort_relocs_p == NULL || obed->sort_relocs_p (o);
if (esdo->rel.hdr != NULL
- && !elf_link_adjust_relocs (abfd, o, &esdo->rel, sort, info))
+ && !elf_link_adjust_relocs (obfd, o, &esdo->rel, sort, info))
goto error_return;
if (esdo->rela.hdr != NULL
- && !elf_link_adjust_relocs (abfd, o, &esdo->rela, sort, info))
+ && !elf_link_adjust_relocs (obfd, o, &esdo->rela, sort, info))
goto error_return;
/* Set the reloc_count field to 0 to prevent write_relocs from
relativecount = 0;
if (dynamic && info->combreloc && dynobj != NULL)
- relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
+ relativecount = elf_link_sort_relocs (obfd, info, &reldyn);
relr_entsize = 0;
if (htab->srelrdyn != NULL
relr_entsize = elf_section_data (s)->this_hdr.sh_entsize;
if (relr_entsize == 0)
{
- relr_entsize = bed->s->arch_size / 8;
+ relr_entsize = obed->s->arch_size / 8;
elf_section_data (s)->this_hdr.sh_entsize = relr_entsize;
}
}
dyncon = o->contents;
dynconend = PTR_ADD (o->contents, o->size);
- for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
+ for (; dyncon < dynconend; dyncon += obed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
const char *name;
bfd_size_type sh_size;
bfd_vma sh_addr;
- bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
+ obed->s->swap_dyn_in (dynobj, dyncon, &dyn);
switch (dyn.d_tag)
{
case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break;
}
if (dyn.d_tag != DT_NULL
- && dynconend - dyncon >= bed->s->sizeof_dyn)
+ && dynconend - dyncon >= obed->s->sizeof_dyn)
{
dyn.d_un.d_val = relativecount;
relativecount = 0;
}
if (relr_entsize != 0)
{
- if (dynconend - dyncon >= 3 * bed->s->sizeof_dyn)
+ if (dynconend - dyncon >= 3 * obed->s->sizeof_dyn)
{
asection *s = htab->srelrdyn;
dyn.d_tag = DT_RELR;
dyn.d_un.d_ptr
= s->output_section->vma + s->output_offset;
- bed->s->swap_dyn_out (dynobj, &dyn, dyncon);
- dyncon += bed->s->sizeof_dyn;
+ obed->s->swap_dyn_out (dynobj, &dyn, dyncon);
+ dyncon += obed->s->sizeof_dyn;
dyn.d_tag = DT_RELRSZ;
dyn.d_un.d_val = s->size;
- bed->s->swap_dyn_out (dynobj, &dyn, dyncon);
- dyncon += bed->s->sizeof_dyn;
+ obed->s->swap_dyn_out (dynobj, &dyn, dyncon);
+ dyncon += obed->s->sizeof_dyn;
dyn.d_tag = DT_RELRENT;
dyn.d_un.d_val = relr_entsize;
case DT_FINI_ARRAYSZ:
name = ".fini_array";
get_out_size:
- o = bfd_get_section_by_name (abfd, name);
+ o = bfd_get_section_by_name (obfd, name);
if (o == NULL)
{
_bfd_error_handler
case DT_FINI_ARRAY:
name = ".fini_array";
get_out_vma:
- o = bfd_get_section_by_name (abfd, name);
+ o = bfd_get_section_by_name (obfd, name);
goto do_vma;
case DT_HASH:
type = SHT_RELA;
sh_size = 0;
sh_addr = 0;
- for (i = 1; i < elf_numsections (abfd); i++)
+ for (i = 1; i < elf_numsections (obfd); i++)
{
Elf_Internal_Shdr *hdr;
- hdr = elf_elfsections (abfd)[i];
+ hdr = elf_elfsections (obfd)[i];
if (hdr->sh_type == type
&& (hdr->sh_flags & SHF_ALLOC) != 0)
{
}
}
- if (bed->dtrel_excludes_plt && htab->srelplt != NULL)
+ if (obed->dtrel_excludes_plt && htab->srelplt != NULL)
{
- unsigned int opb = bfd_octets_per_byte (abfd, o);
+ unsigned int opb = bfd_octets_per_byte (obfd, o);
/* Don't count procedure linkage table relocs in the
overall reloc count. */
dyn.d_un.d_ptr = sh_addr;
break;
}
- bed->s->swap_dyn_out (dynobj, &dyn, dyncon);
+ obed->s->swap_dyn_out (dynobj, &dyn, dyncon);
}
}
/* If we have created any dynamic sections, then output them. */
if (dynobj != NULL)
{
- if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info,
- flinfo.contents))
+ if (!obed->elf_backend_finish_dynamic_sections (obfd, info,
+ flinfo.contents))
goto error_return;
/* Check for DT_TEXTREL (late, in case the backend removes it). */
dyncon = o->contents;
dynconend = o->contents + o->size;
- for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
+ for (; dyncon < dynconend; dyncon += obed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
- bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
+ obed->s->swap_dyn_in (dynobj, dyncon, &dyn);
if (dyn.d_tag == DT_TEXTREL)
{
if (strcmp (o->name, ".dynstr") != 0)
{
bfd_size_type octets = ((file_ptr) o->output_offset
- * bfd_octets_per_byte (abfd, o));
- if (!bfd_set_section_contents (abfd, o->output_section,
+ * bfd_octets_per_byte (obfd, o));
+ if (!bfd_set_section_contents (obfd, o->output_section,
o->contents, octets, o->size))
goto error_return;
}
file_ptr off;
off = elf_section_data (o->output_section)->this_hdr.sh_offset;
- if (bfd_seek (abfd, off, SEEK_SET) != 0
- || !_bfd_elf_strtab_emit (abfd, htab->dynstr))
+ if (bfd_seek (obfd, off, SEEK_SET) != 0
+ || !_bfd_elf_strtab_emit (obfd, htab->dynstr))
goto error_return;
}
}
bool failed = false;
BFD_ASSERT (bfd_link_relocatable (info));
- bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
+ bfd_map_over_sections (obfd, bfd_elf_set_group_contents, &failed);
if (failed)
goto error_return;
}
/* If we have optimized stabs strings, output them. */
if (htab->stab_info.stabstr != NULL)
{
- if (!_bfd_write_stab_strings (abfd, &htab->stab_info))
+ if (!_bfd_write_stab_strings (obfd, &htab->stab_info))
goto error_return;
}
- if (! _bfd_elf_write_section_eh_frame_hdr (abfd, info))
+ if (! _bfd_elf_write_section_eh_frame_hdr (obfd, info))
goto error_return;
- if (! _bfd_elf_write_section_sframe (abfd, info))
+ if (! _bfd_elf_write_section_sframe (obfd, info))
goto error_return;
- if (! _bfd_elf_write_section_object_attributes (abfd, info))
+ if (! _bfd_elf_write_section_object_attributes (obfd, info))
goto error_ret2;
if (info->callbacks->emit_ctf)
info->callbacks->emit_ctf ();
- elf_final_link_free (abfd, &flinfo);
+ elf_final_link_free (obfd, &flinfo);
if (info->unique_symbol)
bfd_hash_table_free (&flinfo.local_hash_table);
error_return:
free (htab->strtab);
htab->strtab = NULL;
- elf_final_link_free (abfd, &flinfo);
+ elf_final_link_free (obfd, &flinfo);
error_ret2:
if (info->unique_symbol)
bfd_hash_table_free (&flinfo.local_hash_table);
}
static bool
-elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
+elf_gc_sweep (bfd *obfd, struct bfd_link_info *info)
{
bfd *sub;
- elf_backend_data *bed = get_elf_backend_data (abfd);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
{
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
|| elf_object_id (sub) != elf_hash_table_id (elf_hash_table (info))
- || !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
+ || !obed->relocs_compatible (sub->xvec, obfd->xvec))
continue;
o = sub->sections;
if (o == NULL || o->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
}
bool
-bfd_elf_parse_eh_frame_entries (bfd *abfd ATTRIBUTE_UNUSED,
+bfd_elf_parse_eh_frame_entries (bfd *obfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
bfd *ibfd = info->input_bfds;
/* Do mark and sweep of unused sections. */
bool
-bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
+bfd_elf_gc_sections (bfd *obfd, struct bfd_link_info *info)
{
bool ok = true;
bfd *sub;
elf_gc_mark_hook_fn gc_mark_hook;
- elf_backend_data *bed = get_elf_backend_data (abfd);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
struct elf_link_hash_table *htab;
struct link_info_ok info_ok;
- if (!bed->can_gc_sections
+ if (!obed->can_gc_sections
|| !is_elf_hash_table (info->hash))
{
_bfd_error_handler(_("warning: gc-sections option ignored"));
return true;
}
- bed->gc_keep (info);
+ obed->gc_keep (info);
htab = elf_hash_table (info);
/* Try to parse each bfd's .eh_frame section. Point elf_eh_frame_section
/* Mark dynamically referenced symbols. */
if (htab->dynamic_sections_created || info->gc_keep_exported)
- elf_link_hash_traverse (htab, bed->gc_mark_dynamic_ref, info);
+ elf_link_hash_traverse (htab, obed->gc_mark_dynamic_ref, info);
/* Grovel through relocs to find out who stays ... */
- gc_mark_hook = bed->gc_mark_hook;
+ gc_mark_hook = obed->gc_mark_hook;
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
{
asection *o;
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
|| elf_object_id (sub) != elf_hash_table_id (htab)
- || !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
+ || !obed->relocs_compatible (sub->xvec, obfd->xvec))
continue;
o = sub->sections;
}
/* Allow the backend to mark additional target specific sections. */
- bed->gc_mark_extra_sections (info, gc_mark_hook);
+ obed->gc_mark_extra_sections (info, gc_mark_hook);
/* ... and mark SEC_EXCLUDE for those that go. */
- return elf_gc_sweep (abfd, info);
+ return elf_gc_sweep (obfd, info);
}
\f
/* Called from check_relocs to record the existence of a VTINHERIT reloc. */
if (!flaginfo->flags_initialized)
{
bfd *obfd = info->output_bfd;
- elf_backend_data *bed = get_elf_backend_data (obfd);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
struct flag_info_list *tf = flaginfo->flag_list;
int with_hex = 0;
int without_hex = 0;
unsigned i;
flagword (*lookup) (char *);
- lookup = bed->elf_backend_lookup_section_flags_hook;
+ lookup = obed->elf_backend_lookup_section_flags_hook;
if (lookup != NULL)
{
flagword hexval = (*lookup) ((char *) tf->name);
{
struct alloc_got_off_arg *gofarg = (struct alloc_got_off_arg *) arg;
bfd *obfd = gofarg->info->output_bfd;
- elf_backend_data *bed = get_elf_backend_data (obfd);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
if (h->got.refcount > 0)
{
h->got.offset = gofarg->gotoff;
- gofarg->gotoff += bed->got_elt_size (obfd, gofarg->info, h, NULL, 0);
+ gofarg->gotoff += obed->got_elt_size (obfd, gofarg->info, h, NULL, 0);
}
else
h->got.offset = (bfd_vma) -1;
we're done. Should be called from final_link. */
bool
-bfd_elf_gc_common_finalize_got_offsets (bfd *abfd,
+bfd_elf_gc_common_finalize_got_offsets (bfd *obfd,
struct bfd_link_info *info)
{
bfd *i;
- elf_backend_data *bed = get_elf_backend_data (abfd);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
bfd_vma gotoff;
struct alloc_got_off_arg gofarg;
- BFD_ASSERT (abfd == info->output_bfd);
+ BFD_ASSERT (obfd == info->output_bfd);
if (! is_elf_hash_table (info->hash))
return false;
/* The GOT offset is relative to the .got section, but the GOT header is
put into the .got.plt section, if the backend uses it. */
- if (bed->want_got_plt)
+ if (obed->want_got_plt)
gotoff = 0;
else
- gotoff = bed->got_header_size;
+ gotoff = obed->got_header_size;
/* Do the local .got entries first. */
for (i = info->input_bfds; i; i = i->link.next)
symtab_hdr = &elf_symtab_hdr (i);
if (elf_bad_symtab (i))
- locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
+ locsymcount = symtab_hdr->sh_size / obed->s->sizeof_sym;
else
locsymcount = symtab_hdr->sh_info;
if (local_got[j] > 0)
{
local_got[j] = gotoff;
- gotoff += bed->got_elt_size (abfd, info, NULL, i, j);
+ gotoff += obed->got_elt_size (obfd, info, NULL, i, j);
}
else
local_got[j] = (bfd_vma) -1;
got entry reference counting is enabled. */
bool
-_bfd_elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
+_bfd_elf_gc_common_final_link (bfd *obfd, struct bfd_link_info *info)
{
- if (!bfd_elf_gc_common_finalize_got_offsets (abfd, info))
+ if (!bfd_elf_gc_common_finalize_got_offsets (obfd, info))
return false;
/* Invoke the regular ELF backend linker to do all the work. */
- return _bfd_elf_final_link (abfd, info);
+ return _bfd_elf_final_link (obfd, info);
}
bool
}
bfd_vma
-_bfd_elf_default_got_elt_size (bfd *abfd,
+_bfd_elf_default_got_elt_size (bfd *obfd,
struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED,
bfd *ibfd ATTRIBUTE_UNUSED,
unsigned long symndx ATTRIBUTE_UNUSED)
{
- elf_backend_data *bed = get_elf_backend_data (abfd);
- return bed->s->arch_size / 8;
+ elf_backend_data *obed = get_elf_backend_data (obfd);
+ return obed->s->arch_size / 8;
}
/* Routines to support the creation of dynamic relocs. */
if we found a strong non-dynamic definition for HDEST (except that
ld ignores multiple definition errors). */
void
-_bfd_elf_copy_link_hash_symbol_type (bfd *abfd,
+_bfd_elf_copy_link_hash_symbol_type (bfd *obfd,
struct bfd_link_hash_entry *hdest,
struct bfd_link_hash_entry *hsrc)
{
ehdest->target_internal = ehsrc->target_internal;
isym.st_other = ehsrc->other;
- elf_merge_st_other (abfd, ehdest, isym.st_other, NULL, true, false);
+ elf_merge_st_other (obfd, ehdest, isym.st_other, NULL, true, false);
}
-/* Append a RELA relocation REL to section S in BFD. */
+/* Append a RELA relocation REL to section S. */
void
-_bfd_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
+_bfd_elf_append_rela (bfd *obfd, asection *s, Elf_Internal_Rela *rel)
{
- elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_byte *loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela);
- BFD_ASSERT (loc + bed->s->sizeof_rela <= s->contents + s->size);
- bed->s->swap_reloca_out (abfd, rel, loc);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
+ bfd_byte *loc = s->contents + (s->reloc_count++ * obed->s->sizeof_rela);
+ BFD_ASSERT (loc + obed->s->sizeof_rela <= s->contents + s->size);
+ obed->s->swap_reloca_out (obfd, rel, loc);
}
-/* Append a REL relocation REL to section S in BFD. */
+/* Append a REL relocation REL to section S. */
void
-_bfd_elf_append_rel (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
+_bfd_elf_append_rel (bfd *obfd, asection *s, Elf_Internal_Rela *rel)
{
- elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_byte *loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rel);
- BFD_ASSERT (loc + bed->s->sizeof_rel <= s->contents + s->size);
- bed->s->swap_reloc_out (abfd, rel, loc);
+ elf_backend_data *obed = get_elf_backend_data (obfd);
+ bfd_byte *loc = s->contents + (s->reloc_count++ * obed->s->sizeof_rel);
+ BFD_ASSERT (loc + obed->s->sizeof_rel <= s->contents + s->size);
+ obed->s->swap_reloc_out (obfd, rel, loc);
}
/* Define __start, __stop, .startof. or .sizeof. symbol. */
if (symbol[0] == '.')
{
/* .startof. and .sizeof. symbols are local. */
- elf_backend_data *bed = get_elf_backend_data (info->output_bfd);
- (*bed->elf_backend_hide_symbol) (info, h, true);
+ elf_backend_data *obed = get_elf_backend_data (info->output_bfd);
+ obed->elf_backend_hide_symbol (info, h, true);
}
else
{
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- elf_backend_data *bed = get_elf_backend_data (output_bfd);
+ elf_backend_data *obed = get_elf_backend_data (output_bfd);
if (bfd_link_executable (info))
{
{
if (!add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL,
- (bed->rela_plts_and_copies_p
+ (obed->rela_plts_and_copies_p
? DT_RELA : DT_REL))
|| !add_dynamic_entry (DT_JMPREL, 0))
return false;
if (need_dynamic_reloc)
{
- if (bed->rela_plts_and_copies_p)
+ if (obed->rela_plts_and_copies_p)
{
if (!add_dynamic_entry (DT_RELA, 0)
|| !add_dynamic_entry (DT_RELASZ, 0)
|| !add_dynamic_entry (DT_RELAENT,
- bed->s->sizeof_rela))
+ obed->s->sizeof_rela))
return false;
}
else
if (!add_dynamic_entry (DT_REL, 0)
|| !add_dynamic_entry (DT_RELSZ, 0)
|| !add_dynamic_entry (DT_RELENT,
- bed->s->sizeof_rel))
+ obed->s->sizeof_rel))
return false;
}