Fix excessive memory allocation attempts and possible integer overfloaws when attempt...
[deliverable/binutils-gdb.git] / bfd / elf32-m32r.c
index 90408237d4ac3ba13867c9c18184c698ce7b384f..6d83aff3d4050c1f19793d5401ec9a64e4f745da 100644 (file)
@@ -2537,10 +2537,11 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
                {
                  _bfd_error_handler
                    /* xgettext:c-format */
-                   (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+                   (_("%B(%A+%#Lx): unresolvable %s relocation "
+                      "against symbol `%s'"),
                     input_bfd,
                     input_section,
-                    (long) rel->r_offset,
+                    rel->r_offset,
                     howto->name,
                     h->root.root.string);
                }
@@ -3539,122 +3540,6 @@ m32r_elf_gc_mark_hook (asection *sec,
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
 }
 
-static bfd_boolean
-m32r_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
-                       struct bfd_link_info *info ATTRIBUTE_UNUSED,
-                       asection *sec ATTRIBUTE_UNUSED,
-                       const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
-  /* Update the got entry reference counts for the section being removed.  */
-  Elf_Internal_Shdr *symtab_hdr;
-  struct elf_link_hash_entry **sym_hashes;
-  bfd_signed_vma *local_got_refcounts;
-  const Elf_Internal_Rela *rel, *relend;
-
-  if (bfd_link_relocatable (info))
-    return TRUE;
-
-  elf_section_data (sec)->local_dynrel = NULL;
-
-  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  sym_hashes = elf_sym_hashes (abfd);
-  local_got_refcounts = elf_local_got_refcounts (abfd);
-
-  relend = relocs + sec->reloc_count;
-  for (rel = relocs; rel < relend; rel++)
-    {
-      unsigned long r_symndx;
-      struct elf_link_hash_entry *h = NULL;
-
-      r_symndx = ELF32_R_SYM (rel->r_info);
-      if (r_symndx >= symtab_hdr->sh_info)
-       {
-         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-         while (h->root.type == bfd_link_hash_indirect
-                || h->root.type == bfd_link_hash_warning)
-           h = (struct elf_link_hash_entry *) h->root.u.i.link;
-       }
-
-      switch (ELF32_R_TYPE (rel->r_info))
-       {
-       case R_M32R_GOT16_HI_ULO:
-       case R_M32R_GOT16_HI_SLO:
-       case R_M32R_GOT16_LO:
-       case R_M32R_GOTOFF:
-       case R_M32R_GOTOFF_HI_ULO:
-       case R_M32R_GOTOFF_HI_SLO:
-       case R_M32R_GOTOFF_LO:
-       case R_M32R_GOT24:
-       case R_M32R_GOTPC_HI_ULO:
-       case R_M32R_GOTPC_HI_SLO:
-       case R_M32R_GOTPC_LO:
-       case R_M32R_GOTPC24:
-         if (h != NULL)
-           {
-             if (h->got.refcount > 0)
-               h->got.refcount--;
-           }
-         else
-           {
-             if (local_got_refcounts && local_got_refcounts[r_symndx] > 0)
-               local_got_refcounts[r_symndx]--;
-           }
-         break;
-
-       case R_M32R_16_RELA:
-       case R_M32R_24_RELA:
-       case R_M32R_32_RELA:
-       case R_M32R_REL32:
-       case R_M32R_HI16_ULO_RELA:
-       case R_M32R_HI16_SLO_RELA:
-       case R_M32R_LO16_RELA:
-       case R_M32R_SDA16_RELA:
-       case R_M32R_10_PCREL_RELA:
-       case R_M32R_18_PCREL_RELA:
-       case R_M32R_26_PCREL_RELA:
-         if (h != NULL)
-           {
-             struct elf_m32r_link_hash_entry *eh;
-             struct elf_m32r_dyn_relocs **pp;
-             struct elf_m32r_dyn_relocs *p;
-
-             if (!bfd_link_pic (info) && h->plt.refcount > 0)
-               h->plt.refcount -= 1;
-
-             eh = (struct elf_m32r_link_hash_entry *) h;
-
-             for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-               if (p->sec == sec)
-                 {
-                   if (   ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
-                       || ELF32_R_TYPE (rel->r_info) == R_M32R_18_PCREL_RELA
-                       || ELF32_R_TYPE (rel->r_info) == R_M32R_10_PCREL_RELA
-                       || ELF32_R_TYPE (rel->r_info) == R_M32R_REL32)
-                     p->pc_count -= 1;
-                   p->count -= 1;
-                   if (p->count == 0)
-                     *pp = p->next;
-                   break;
-                 }
-           }
-         break;
-
-       case R_M32R_26_PLTREL:
-         if (h != NULL)
-           {
-             if (h->plt.refcount > 0)
-               h->plt.refcount--;
-           }
-         break;
-
-       default:
-         break;
-       }
-    }
-
-  return TRUE;
-}
-
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
@@ -3973,7 +3858,6 @@ m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
 #define elf_backend_add_symbol_hook            m32r_elf_add_symbol_hook
 #define elf_backend_relocate_section           m32r_elf_relocate_section
 #define elf_backend_gc_mark_hook                m32r_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook               m32r_elf_gc_sweep_hook
 #define elf_backend_check_relocs                m32r_elf_check_relocs
 
 #define elf_backend_create_dynamic_sections     m32r_elf_create_dynamic_sections
@@ -4014,6 +3898,8 @@ m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
 #define bfd_elf32_bfd_print_private_bfd_data   m32r_elf_print_private_bfd_data
 #define elf_backend_special_sections           m32r_elf_special_sections
 
+#define elf_backend_linux_prpsinfo32_ugid16    TRUE
+
 #include "elf32-target.h"
 
 #undef  ELF_MAXPAGESIZE
This page took 0.025618 seconds and 4 git commands to generate.