/* Lattice Mico32-specific support for 32-bit ELF
- Copyright (C) 2008-2019 Free Software Foundation, Inc.
+ Copyright (C) 2008-2020 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
static bfd_reloc_status_type lm32_elf_gprel_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-/* lm32 ELF linker hash entry. */
-
-struct elf_lm32_link_hash_entry
-{
- struct elf_link_hash_entry root;
-
- /* Track dynamic relocs copied for this symbol. */
- struct elf_dyn_relocs *dyn_relocs;
-};
-
/* lm32 ELF linker hash table. */
struct elf_lm32_link_hash_table
struct weak_symbol_list *next;
};
-/* Create an entry in an lm32 ELF linker hash table. */
-
-static struct bfd_hash_entry *
-lm32_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- struct elf_lm32_link_hash_entry *ret =
- (struct elf_lm32_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == NULL)
- ret = bfd_hash_allocate (table,
- sizeof (struct elf_lm32_link_hash_entry));
- if (ret == NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct elf_lm32_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- struct elf_lm32_link_hash_entry *eh;
-
- eh = (struct elf_lm32_link_hash_entry *) ret;
- eh->dyn_relocs = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
/* Create an lm32 ELF linker hash table. */
static struct bfd_link_hash_table *
lm32_elf_link_hash_table_create (bfd *abfd)
{
struct elf_lm32_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf_lm32_link_hash_table);
+ size_t amt = sizeof (struct elf_lm32_link_hash_table);
ret = bfd_zmalloc (amt);
if (ret == NULL)
return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
- lm32_elf_link_hash_newfunc,
- sizeof (struct elf_lm32_link_hash_entry),
+ _bfd_elf_link_hash_newfunc,
+ sizeof (struct elf_link_hash_entry),
LM32_ELF_DATA))
{
free (ret);
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
- struct elf_lm32_link_hash_entry *eh = (struct elf_lm32_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
{
struct bfd_link_info *info;
struct elf_lm32_link_hash_table *htab;
- struct elf_lm32_link_hash_entry *eh;
struct elf_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect)
if (htab == NULL)
return FALSE;
- eh = (struct elf_lm32_link_hash_entry *) h;
-
if (htab->root.dynamic_sections_created
&& h->plt.refcount > 0)
{
else
h->got.offset = (bfd_vma) -1;
- if (eh->dyn_relocs == NULL)
+ if (h->dyn_relocs == NULL)
return TRUE;
/* In the shared -Bsymbolic case, discard space allocated for
{
struct elf_dyn_relocs **pp;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL;)
+ for (pp = &h->dyn_relocs; (p = *pp) != NULL;)
{
p->count -= p->pc_count;
p->pc_count = 0;
/* Also discard relocs on undefined weak syms with non-default
visibility. */
- if (eh->dyn_relocs != NULL
+ if (h->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
{
if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
- eh->dyn_relocs = NULL;
+ h->dyn_relocs = NULL;
/* Make sure undefined weak symbols are output as a dynamic
symbol in PIEs. */
goto keep;
}
- eh->dyn_relocs = NULL;
+ h->dyn_relocs = NULL;
keep: ;
}
/* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *sreloc = elf_section_data (p->sec)->sreloc;
sreloc->size += p->count * sizeof (Elf32_External_Rela);
struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *ind)
{
- struct elf_lm32_link_hash_entry * edir;
- struct elf_lm32_link_hash_entry * eind;
-
- edir = (struct elf_lm32_link_hash_entry *) dir;
- eind = (struct elf_lm32_link_hash_entry *) ind;
-
- if (eind->dyn_relocs != NULL)
+ if (ind->dyn_relocs != NULL)
{
- if (edir->dyn_relocs != NULL)
+ if (dir->dyn_relocs != NULL)
{
struct elf_dyn_relocs **pp;
struct elf_dyn_relocs *p;
/* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL;)
+ for (pp = &ind->dyn_relocs; (p = *pp) != NULL;)
{
struct elf_dyn_relocs *q;
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
+ for (q = dir->dyn_relocs; q != NULL; q = q->next)
if (q->sec == p->sec)
{
q->pc_count += p->pc_count;
if (q == NULL)
pp = &p->next;
}
- *pp = edir->dyn_relocs;
+ *pp = dir->dyn_relocs;
}
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
+ dir->dyn_relocs = ind->dyn_relocs;
+ ind->dyn_relocs = NULL;
}
_bfd_elf_link_hash_copy_indirect (info, dir, ind);