/* Or1k-specific support for 32-bit ELF.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed for OR32 by Johan Rydberg, jrydberg@opencores.org
PIC parts added by Stefan Kristiansson, stefan.kristiansson@saunalahti.fi,
{
struct elf_link_hash_table root;
- /* Small local sym to section mapping cache. */
- struct sym_cache sym_sec;
-
bfd_boolean saw_plta;
};
/* Get the ELF linker hash table from a link_info structure. */
#define or1k_elf_hash_table(p) \
- (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
- == OR1K_ELF_DATA ? ((struct elf_or1k_link_hash_table *) ((p)->hash)) : NULL)
+ ((is_elf_hash_table ((p)->hash) \
+ && elf_hash_table_id (elf_hash_table (p)) == OR1K_ELF_DATA) \
+ ? (struct elf_or1k_link_hash_table *) (p)->hash : NULL)
static bfd_boolean
elf_or1k_mkobject (bfd *abfd)
Elf_Internal_Sym *isym;
void *vpp;
- isym = bfd_sym_from_r_symndx (&htab->sym_sec,
+ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx);
if (isym == NULL)
return FALSE;
return FALSE;
}
- if (htab->root.dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in or1k_elf_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (bfd_link_executable (info))
- {
- if (! add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->root.splt->size != 0)
- {
- if (! add_dynamic_entry (DT_PLTGOT, 0)
- || ! add_dynamic_entry (DT_PLTRELSZ, 0)
- || ! add_dynamic_entry (DT_PLTREL, DT_RELA)
- || ! add_dynamic_entry (DT_JMPREL, 0))
- return FALSE;
- }
-
- if (relocs)
- {
- if (! add_dynamic_entry (DT_RELA, 0)
- || ! add_dynamic_entry (DT_RELASZ, 0)
- || ! add_dynamic_entry (DT_RELAENT,
- sizeof (Elf32_External_Rela)))
- return FALSE;
-
- /* If any dynamic relocs apply to a read-only section,
- then we need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->root,
- _bfd_elf_maybe_set_textrel, info);
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (! add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
- }
-
-#undef add_dynamic_entry
- return TRUE;
+ return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs);
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */