diff options
Diffstat (limited to 'bfd/elf-hppa.h')
-rw-r--r-- | bfd/elf-hppa.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index b87ee83..75b4e26 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1020,26 +1020,44 @@ _bfd_elf_hppa_gen_reloc_type (bfd *abfd, /* 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: invalid relocation type %d"), 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 |