/* Common code for PA ELF implementations.
- Copyright (C) 1999-2017 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* Translate from an elf into field into a howto relocation pointer. */
-static void
+static bfd_boolean
elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
arelent *bfd_reloc,
Elf_Internal_Rela *elf_reloc)
{
- BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
- < (unsigned int) R_PARISC_UNIMPLEMENTED);
- bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
+ unsigned int r_type = ELF32_R_TYPE (elf_reloc->r_info);
+
+ if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+ abfd, r_type);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ bfd_reloc->howto = &elf_hppa_howto_table[r_type];
+ return TRUE;
}
/* Translate from an elf into field into a howto relocation pointer. */
-static void
-elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
+static bfd_boolean
+elf_hppa_info_to_howto_rel (bfd *abfd,
arelent *bfd_reloc,
Elf_Internal_Rela *elf_reloc)
{
- BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
- < (unsigned int) R_PARISC_UNIMPLEMENTED);
- bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
+ unsigned int r_type = ELF_R_TYPE (elf_reloc->r_info);
+
+ if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r_type);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ bfd_reloc->howto = &elf_hppa_howto_table[r_type];
+ return TRUE;
}
/* Return the address of the howto table entry to perform the CODE