Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / elf32-epiphany.c
index d5e61a2ad6266cf95f84e7e0cc63b7bfbfa8b606..420dc8bb0780d5a62e236e374859c2dffe879494 100644 (file)
@@ -1,6 +1,5 @@
 /* Adapteva epiphany specific support for 32-bit ELF
 /* Adapteva epiphany specific support for 32-bit ELF
-   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2000-2016 Free Software Foundation, Inc.
    Contributed by Embecosm on behalf of Adapteva, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
    Contributed by Embecosm on behalf of Adapteva, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -64,7 +63,7 @@ static reloc_howto_type epiphany_elf_howto_table [] =
          pr)                   /* pcrel_offset */
 
   /* This reloc does nothing.  */
          pr)                   /* pcrel_offset */
 
   /* This reloc does nothing.  */
-  AHOW (R_EPIPHANY_NONE,    0, 0,32, FALSE, 0, complain_overflow_dont,     "R_EPIPHANY_NONE",        0,          0),
+  AHOW (R_EPIPHANY_NONE,    0, 3,0, FALSE, 0, complain_overflow_dont,     "R_EPIPHANY_NONE",        0,          0),
 
   /* 8 bit absolute (not likely) */
   AHOW (R_EPIPHANY_8,       0, 0, 8, FALSE, 0, complain_overflow_bitfield, "R_EPIPHANY_8",      0x000000ff, 0x000000ff),
 
   /* 8 bit absolute (not likely) */
   AHOW (R_EPIPHANY_8,       0, 0, 8, FALSE, 0, complain_overflow_bitfield, "R_EPIPHANY_8",      0x000000ff, 0x000000ff),
@@ -213,7 +212,7 @@ epiphany_elf_relax_section (bfd *abfd, asection *sec,
   /* We don't have to do anything for a relocatable link,
      if this section does not have relocs, or if this is
      not a code section.  */
   /* We don't have to do anything for a relocatable link,
      if this section does not have relocs, or if this is
      not a code section.  */
-  if (link_info->relocatable
+  if (bfd_link_relocatable (link_info)
       || (sec->flags & SEC_RELOC) == 0
       || sec->reloc_count == 0
       || (sec->flags & SEC_CODE) == 0)
       || (sec->flags & SEC_RELOC) == 0
       || sec->reloc_count == 0
       || (sec->flags & SEC_CODE) == 0)
@@ -371,6 +370,11 @@ epiphany_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED,
   unsigned int r_type;
 
   r_type = ELF32_R_TYPE (dst->r_info);
   unsigned int r_type;
 
   r_type = ELF32_R_TYPE (dst->r_info);
+  if (r_type >= (unsigned int) R_EPIPHANY_max)
+    {
+      _bfd_error_handler (_("%B: invalid Epiphany reloc number: %d"), abfd, r_type);
+      r_type = 0;
+    }
   cache_ptr->howto = & epiphany_elf_howto_table [r_type];
 }
 
   cache_ptr->howto = & epiphany_elf_howto_table [r_type];
 }
 
@@ -515,20 +519,21 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
        {
          bfd_boolean warned ATTRIBUTE_UNUSED;
          bfd_boolean unresolved_reloc ATTRIBUTE_UNUSED;
        {
          bfd_boolean warned ATTRIBUTE_UNUSED;
          bfd_boolean unresolved_reloc ATTRIBUTE_UNUSED;
+         bfd_boolean ignored ATTRIBUTE_UNUSED;
 
          RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
                                   r_symndx, symtab_hdr, sym_hashes,
                                   h, sec, relocation,
 
          RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
                                   r_symndx, symtab_hdr, sym_hashes,
                                   h, sec, relocation,
-                                  unresolved_reloc, warned);
+                                  unresolved_reloc, warned, ignored);
 
          name = h->root.root.string;
        }
 
 
          name = h->root.root.string;
        }
 
-      if (sec != NULL && elf_discarded_section (sec))
+      if (sec != NULL && discarded_section (sec))
        RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
        RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
-                                        rel, relend, howto, contents);
+                                        rel, 1, relend, howto, 0, contents);
 
 
-      if (info->relocatable)
+      if (bfd_link_relocatable (info))
        continue;
 
       /* Finally, the sole EPIPHANY-specific part.  */
        continue;
 
       /* Finally, the sole EPIPHANY-specific part.  */
@@ -542,13 +547,13 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
          switch (r)
            {
            case bfd_reloc_overflow:
          switch (r)
            {
            case bfd_reloc_overflow:
-             r = info->callbacks->reloc_overflow
+             (*info->callbacks->reloc_overflow)
                (info, (h ? &h->root : NULL), name, howto->name,
                 (bfd_vma) 0, input_bfd, input_section, rel->r_offset);
              break;
 
            case bfd_reloc_undefined:
                (info, (h ? &h->root : NULL), name, howto->name,
                 (bfd_vma) 0, input_bfd, input_section, rel->r_offset);
              break;
 
            case bfd_reloc_undefined:
-             r = info->callbacks->undefined_symbol
+             (*info->callbacks->undefined_symbol)
                (info, name, input_bfd, input_section, rel->r_offset, TRUE);
              break;
 
                (info, name, input_bfd, input_section, rel->r_offset, TRUE);
              break;
 
@@ -573,11 +578,8 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
            }
 
          if (msg)
            }
 
          if (msg)
-           r = info->callbacks->warning
-             (info, msg, name, input_bfd, input_section, rel->r_offset);
-
-         if (! r)
-           return FALSE;
+           (*info->callbacks->warning) (info, msg, name, input_bfd,
+                                        input_section, rel->r_offset);
        }
     }
 
        }
     }
 
@@ -585,7 +587,7 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 }
 
 /* We only have a little-endian target.  */
 }
 
 /* We only have a little-endian target.  */
-#define TARGET_LITTLE_SYM       bfd_elf32_epiphany_vec
+#define TARGET_LITTLE_SYM       epiphany_elf32_vec
 #define TARGET_LITTLE_NAME  "elf32-epiphany"
 
 #define ELF_ARCH        bfd_arch_epiphany
 #define TARGET_LITTLE_NAME  "elf32-epiphany"
 
 #define ELF_ARCH        bfd_arch_epiphany
This page took 0.03911 seconds and 4 git commands to generate.