Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry
[deliverable/binutils-gdb.git] / bfd / elf-m10300.c
index efb000363eb489a62779d5c89c5bb22cd6cae7f1..f0ef8eb0bed52baef5f324f3e9b8c3a8a261b6f5 100644 (file)
@@ -1,5 +1,5 @@
 /* Matsushita 10300 specific support for 32-bit ELF
-   Copyright (C) 1996-2018 Free Software Foundation, Inc.
+   Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -798,8 +798,8 @@ bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 
 /* Set the howto pointer for an MN10300 ELF reloc.  */
 
-static void
-mn10300_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+static bfd_boolean
+mn10300_info_to_howto (bfd *abfd,
                       arelent *cache_ptr,
                       Elf_Internal_Rela *dst)
 {
@@ -809,12 +809,13 @@ mn10300_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
   if (r_type >= R_MN10300_MAX)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: unrecognised MN10300 reloc number: %d"),
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
                          abfd, r_type);
       bfd_set_error (bfd_error_bad_value);
-      r_type = R_MN10300_NONE;
+      return FALSE;
     }
   cache_ptr->howto = elf_mn10300_howto_table + r_type;
+  return TRUE;
 }
 
 static int
@@ -1025,7 +1026,7 @@ mn10300_do_tls_transition (bfd *   input_bfd,
     default:
       _bfd_error_handler
        /* xgettext:c-format */
-       (_("%pB: Unsupported transition from %s to %s"),
+       (_("%pB: unsupported transition from %s to %s"),
         input_bfd,
         elf_mn10300_howto_table[r_type].name,
         elf_mn10300_howto_table[tls_r_type].name);
@@ -1135,9 +1136,7 @@ mn10300_elf_check_relocs (bfd *abfd,
        /* This relocation describes which C++ vtable entries are actually
           used.  Record for later use during GC.  */
        case R_MN10300_GNU_VTENTRY:
-         BFD_ASSERT (h != NULL);
-         if (h != NULL
-             && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+         if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
            goto fail;
          break;
 
@@ -2090,10 +2089,11 @@ mn10300_elf_relocate_section (bfd *output_bfd,
 
            _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.root.string);
        }
@@ -5543,7 +5543,7 @@ mn10300_elf_mkobject (bfd *abfd)
 #endif
 
 #define elf_info_to_howto              mn10300_info_to_howto
-#define elf_info_to_howto_rel          0
+#define elf_info_to_howto_rel          NULL
 #define elf_backend_can_gc_sections    1
 #define elf_backend_rela_normal                1
 #define elf_backend_check_relocs       mn10300_elf_check_relocs
This page took 0.026025 seconds and 4 git commands to generate.