/* SPARC-specific support for 64-bit ELF
- Copyright (C) 1993-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-2017 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
else
relent->address = rela.r_offset - asect->vma;
- if (ELF64_R_SYM (rela.r_info) == STN_UNDEF)
+ if (ELF64_R_SYM (rela.r_info) == STN_UNDEF
+ /* PR 17512: file: 996185f8. */
+ || (!dynamic && ELF64_R_SYM(rela.r_info) > bfd_get_symcount(abfd))
+ || (dynamic
+ && ELF64_R_SYM(rela.r_info) > bfd_get_dynamic_symcount(abfd)))
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
else
{
{
static const char *const stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
- if ((abfd->flags & DYNAMIC) == 0
- && (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE))
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
+ && (abfd->flags & DYNAMIC) == 0
+ && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
+ elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER)
{
case 2: reg -= 2; break;
case 6: reg -= 4; break;
default:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: Only registers %%g[2367] can be declared using STT_REGISTER"),
abfd);
return FALSE;
if (p->name != NULL && strcmp (p->name, *namep))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("Register %%g%d used incompatibly: %s in %B, previously %s in %B"),
abfd, p->abfd, (int) sym->st_value,
**namep ? *namep : "#scratch",
if (type > STT_FUNC)
type = 0;
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("Symbol `%s' has differing types: REGISTER in %B, previously %s in %B"),
abfd, p->abfd, *namep, stt_types[type]);
return FALSE;
if (type > STT_FUNC)
type = 0;
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("Symbol `%s' has differing types: %s in %B, previously REGISTER in %B"),
abfd, p->abfd, *namep, stt_types[type]);
return FALSE;
object file when linking. */
static bfd_boolean
-elf64_sparc_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+elf64_sparc_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
{
+ bfd *obfd = info->output_bfd;
bfd_boolean error;
flagword new_flags, old_flags;
int new_mm, old_mm;
&& (old_flags & EF_SPARC_HAL_R1))
{
error = TRUE;
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: linking UltraSPARC specific with HAL specific code"),
ibfd);
}
if (new_flags != old_flags)
{
error = TRUE;
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
ibfd, (long) new_flags, (long) old_flags);
}
return FALSE;
}
}
- return _bfd_sparc_elf_merge_private_bfd_data (ibfd, obfd);
+ return _bfd_sparc_elf_merge_private_bfd_data (ibfd, info);
}
/* MARCO: Set the correct entry size for the .stab section. */
_bfd_sparc_elf_plt_sym_val
#define bfd_elf64_bfd_link_hash_table_create \
_bfd_sparc_elf_link_hash_table_create
-#define bfd_elf64_bfd_link_hash_table_free \
- _bfd_sparc_elf_link_hash_table_free
#define elf_info_to_howto \
_bfd_sparc_elf_info_to_howto
#define elf_backend_copy_indirect_symbol \
#define elf_backend_plt_readonly 0
#define elf_backend_want_plt_sym 1
#define elf_backend_got_header_size 8
+#define elf_backend_want_dynrelro 1
#define elf_backend_rela_normal 1
/* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table. */