correct ft32 reloc range test
[deliverable/binutils-gdb.git] / bfd / elf-hppa.h
index f48a11d09b6c50dd6cc3fc2eaac89fd8aeae6b92..95ac96c7345edb25537c26e9746cf0df313cf6a7 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -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: 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
This page took 0.023255 seconds and 4 git commands to generate.