/* Meta support for 32-bit ELF
- Copyright (C) 2013-2017 Free Software Foundation, Inc.
+ Copyright (C) 2013-2020 Free Software Foundation, Inc.
Contributed by Imagination Technologies Ltd.
This file is part of BFD, the Binary File Descriptor library.
elf_hash_table (info)->tls_sec->alignment_power));
}
-static void
-metag_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
+static bfd_boolean
+metag_info_to_howto_rela (bfd *abfd,
arelent *cache_ptr,
Elf_Internal_Rela *dst)
{
if (r_type >= (unsigned int) R_METAG_MAX)
{
/* xgettext:c-format */
- _bfd_error_handler (_("%B: invalid METAG reloc number: %d"), abfd, r_type);
- r_type = 0;
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+ abfd, r_type);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
}
cache_ptr->howto = & elf_metag_howto_table [r_type];
+ return TRUE;
}
static reloc_howto_type *
if (hsh == NULL)
{
/* xgettext:c-format */
- _bfd_error_handler (_("%B: cannot create stub entry %s"),
+ _bfd_error_handler (_("%pB: cannot create stub entry %s"),
section->owner, stub_name);
return NULL;
}
rel, relend, howto, contents) \
{ \
_bfd_clear_contents (howto, input_bfd, input_section, \
- contents + rel->r_offset); \
+ contents, rel->r_offset); \
\
if (bfd_link_relocatable (info) \
&& (input_section->flags & SEC_DEBUGGING)) \
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
- name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+ name = name == NULL ? bfd_section_name (sec) : name;
}
else
{
/* We don't support changing the TLS model. */
/* PR 20675 */
if (bfd_link_pic (info))
- _bfd_error_handler (_("%B(%A): multiple TLS models are not supported"),
+ _bfd_error_handler (_("%pB(%pA): multiple TLS models are not supported"),
input_bfd, input_section);
else
- _bfd_error_handler (_("%B(%A): shared library symbol %s encountered whilst performing a static link"),
+ _bfd_error_handler (_("%pB(%pA): shared library symbol %s encountered whilst performing a static link"),
input_bfd, input_section, name);
return FALSE;
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("%B(%A+%#Lx): %s relocation not permitted in shared object"),
- input_bfd, input_section, rel->r_offset, howto->name);
+ (_("%pB(%pA+%#" PRIx64 "): "
+ "%s relocation not permitted in shared object"),
+ input_bfd, input_section, (uint64_t) rel->r_offset,
+ howto->name);
return FALSE;
}
else
name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
_bfd_error_handler
/* xgettext:c-format */
- (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
+ (_("%pB: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
abfd, elf_metag_howto_table[r_type].name, name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_METAG_GNU_VTENTRY:
- BFD_ASSERT (hh != NULL);
- if (hh != NULL
- && !bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rel->r_addend))
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rel->r_addend))
return FALSE;
break;
}
info->flags |= DF_TEXTREL;
info->callbacks->minfo
- (_("%B: dynamic relocation against `%T' in read-only section `%A'\n"),
+ (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
sec->owner, h->root.root.string, sec);
/* Not an error, just cut short the traversal. */
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
+ else if (CONST_STRNEQ (bfd_section_name (s), ".rela"))
{
if (s->size != 0 && s != htab->etab.srelplt)
relocs = TRUE;
/* Set the Meta ELF ABI version. */
-static void
-elf_metag_post_process_headers (bfd * abfd, struct bfd_link_info * link_info)
+static bfd_boolean
+elf_metag_init_file_header (bfd *abfd, struct bfd_link_info *link_info)
{
Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
- _bfd_elf_post_process_headers (abfd, link_info);
+ if (!_bfd_elf_init_file_header (abfd, link_info))
+ return FALSE;
+
i_ehdrp = elf_elfheader (abfd);
i_ehdrp->e_ident[EI_ABIVERSION] = METAG_ELF_ABI_VERSION;
+ return TRUE;
}
/* Used to decide how to sort relocs in an optimal manner for the
#define elf_backend_finish_dynamic_sections elf_metag_finish_dynamic_sections
#define elf_backend_size_dynamic_sections elf_metag_size_dynamic_sections
#define elf_backend_omit_section_dynsym \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
-#define elf_backend_post_process_headers elf_metag_post_process_headers
+ _bfd_elf_omit_section_dynsym_all
+#define elf_backend_init_file_header elf_metag_init_file_header
#define elf_backend_reloc_type_class elf_metag_reloc_type_class
#define elf_backend_copy_indirect_symbol elf_metag_copy_indirect_symbol
#define elf_backend_plt_sym_val elf_metag_plt_sym_val