See sh_elf_info_to_howto in elf32-sh.c for the original. */
-static void
+static bfd_boolean
sh_elf64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
Elf_Internal_Rela *dst)
{
r = ELF64_R_TYPE (dst->r_info);
- BFD_ASSERT (r <= (unsigned int) R_SH_64_PCREL);
+ if (r > (unsigned int) R_SH_64_PCREL)
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC || r > R_SH_LAST_INVALID_RELOC);
BFD_ASSERT (r < R_SH_DIR8WPN || r > R_SH_LAST_INVALID_RELOC_2);
BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_3 || r > R_SH_GOTPLT32);
BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4);
cache_ptr->howto = &sh_elf64_howto_table[r];
+ return cache_ptr->howto != NULL;
}
/* Relocate an SH ELF section.
if ((sym->st_other & STO_SH5_ISA32) != 0)
(*info->callbacks->reloc_dangerous)
(info,
- _("Unexpected STO_SH5_ISA32 on local symbol is not handled"),
+ _("unexpected STO_SH5_ISA32 on local symbol is not handled"),
input_bfd, input_section, rel->r_offset);
if (sec != NULL && discarded_section (sec))
{
_bfd_error_handler
/* xgettext:c-format */
- (_("%pB(%pA+%#Lx): %s relocation against SEC_MERGE section"),
+ (_("%pB(%pA+%#" PRIx64 "): "
+ "%s relocation against SEC_MERGE section"),
input_bfd, input_section,
- rel->r_offset, howto->name);
+ (uint64_t) rel->r_offset, howto->name);
return FALSE;
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+ (_("%pB(%pA+%#" PRIx64 "): "
+ "unresolvable %s relocation against symbol `%s'"),
input_bfd,
input_section,
- rel->r_offset,
+ (uint64_t) rel->r_offset,
howto->name,
h->root.root.string);
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("%pB: error: unaligned relocation type %d at %08Lx reloc %08Lx"),
- input_bfd, (int) r_type, rel->r_offset,
- relocation);
+ (_("%pB: error: unaligned relocation type %d at "
+ "%08" PRIx64 " reloc %08" PRIx64 ""),
+ input_bfd, (int) r_type,
+ (uint64_t) rel->r_offset, (uint64_t) relocation);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}