bfd target vector rationalisation
[deliverable/binutils-gdb.git] / bfd / elf32-v850.c
index 3e24dca1a5437cf299264aed1c4f9dbbf6cd6016..2589a25254903e15e0edf8247284ad543ae29789 100644 (file)
@@ -1,7 +1,5 @@
 /* V850-specific support for 32-bit ELF
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1996-2014 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -85,6 +83,10 @@ v850_elf_check_relocs (bfd *abfd,
          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;
+
+         /* PR15323, ref flags aren't set for references in the same
+            object.  */
+         h->root.non_ir_ref = 1;
        }
 
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -1918,6 +1920,12 @@ v850_elf_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
   return (   (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
          || (name[0] == '_' &&  name[1] == '.' && name[2] == 'L' && name[3] == '_'));
 }
+
+static bfd_boolean
+v850_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
+{
+  return v850_elf_is_local_label_name (abfd, sym->name);
+}
 \f
 /* We overload some of the bfd_reloc error codes for own purposes.  */
 #define bfd_reloc_gp_not_found         bfd_reloc_other
@@ -2203,7 +2211,7 @@ v850_elf_relocate_section (bfd *output_bfd,
        }
       else
        {
-         bfd_boolean unresolved_reloc, warned;
+         bfd_boolean unresolved_reloc, warned, ignored;
 
          /* Note - this check is delayed until now as it is possible and
             valid to have a file without any symbols but with relocs that
@@ -2220,7 +2228,7 @@ v850_elf_relocate_section (bfd *output_bfd,
          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);
        }
 
       if (sec != NULL && discarded_section (sec))
@@ -2340,7 +2348,8 @@ v850_elf_object_p (bfd *abfd)
     {
     case EM_V800:
       arch = bfd_arch_v850_rh850;
-      mach = bfd_mach_v850e2v3;
+      mach = (elf_elfheader (abfd)->e_flags & EF_V800_850E3)
+       ? bfd_mach_v850e3v5 : bfd_mach_v850e2v3;
       break;
 
     case EM_CYGNUS_V850:
@@ -2354,6 +2363,7 @@ v850_elf_object_p (bfd *abfd)
        case E_V850E1_ARCH:   mach = bfd_mach_v850e1; break;
        case E_V850E2_ARCH:   mach = bfd_mach_v850e2; break;
        case E_V850E2V3_ARCH: mach = bfd_mach_v850e2v3; break;
+       case E_V850E3V5_ARCH: mach = bfd_mach_v850e3v5; break;
        }
       break;
 
@@ -2376,6 +2386,8 @@ v850_elf_final_write_processing (bfd *abfd,
     {
     case bfd_arch_v850_rh850:
       val = EF_RH850_ABI;
+      if (bfd_get_mach (abfd) == bfd_mach_v850e3v5)
+       val |= EF_V800_850E3;
       elf_elfheader (abfd)->e_flags |= val;
       break;
 
@@ -2388,6 +2400,7 @@ v850_elf_final_write_processing (bfd *abfd,
        case bfd_mach_v850e1:   val = E_V850E1_ARCH; break;
        case bfd_mach_v850e2:   val = E_V850E2_ARCH; break;
        case bfd_mach_v850e2v3: val = E_V850E2V3_ARCH; break;
+       case bfd_mach_v850e3v5: val = E_V850E3V5_ARCH; break;
        }
       elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH;
       elf_elfheader (abfd)->e_flags |= val;
@@ -2507,6 +2520,17 @@ v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
          return TRUE;
        }
 
+      if ((   (in_flags & EF_V850_ARCH) == E_V850_ARCH
+          || (in_flags & EF_V850_ARCH) == E_V850E_ARCH
+          || (in_flags & EF_V850_ARCH) == E_V850E2_ARCH
+           || (in_flags & EF_V850_ARCH) == E_V850E2V3_ARCH)
+         && (out_flags & EF_V850_ARCH) == E_V850E3V5_ARCH)
+       {
+         elf_elfheader (obfd)->e_flags =
+           ((out_flags & ~ EF_V850_ARCH) | E_V850E3V5_ARCH);
+         return TRUE;
+       }
+
       _bfd_error_handler (_("%B: Architecture mismatch with previous modules"),
                          ibfd);
     }
@@ -2550,6 +2574,7 @@ v850_elf_print_private_bfd_data (bfd *abfd, void * ptr)
        case E_V850E1_ARCH: fprintf (file, _("v850e1 architecture")); break;
        case E_V850E2_ARCH: fprintf (file, _("v850e2 architecture")); break;
        case E_V850E2V3_ARCH: fprintf (file, _("v850e2v3 architecture")); break;
+       case E_V850E3V5_ARCH: fprintf (file, _("v850e3v5 architecture")); break;
        }
     }
 
@@ -3116,7 +3141,7 @@ v850_elf_relax_section (bfd *abfd,
 
          if (alignmoveto < alignto)
            {
-             unsigned int i;
+             bfd_vma i;
 
              align_pad_size = alignto - alignmoveto;
 #ifdef DEBUG_RELAX
@@ -3745,7 +3770,7 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] =
   { NULL,                     0,           0, 0,                0 }
 };
 \f
-#define TARGET_LITTLE_SYM                      bfd_elf32_v850_vec
+#define TARGET_LITTLE_SYM                      v850_elf32_vec
 #define TARGET_LITTLE_NAME                     "elf32-v850"
 #define ELF_ARCH                               bfd_arch_v850
 #define ELF_MACHINE_CODE                       EM_V850
@@ -3772,6 +3797,8 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] =
 #define elf_backend_rela_normal 1
 
 #define bfd_elf32_bfd_is_local_label_name      v850_elf_is_local_label_name
+#define bfd_elf32_bfd_is_target_special_symbol v850_elf_is_target_special_symbol
+
 #define bfd_elf32_bfd_reloc_type_lookup                v850_elf_reloc_type_lookup
 #define bfd_elf32_bfd_reloc_name_lookup                v850_elf_reloc_name_lookup
 #define bfd_elf32_bfd_merge_private_bfd_data   v850_elf_merge_private_bfd_data
@@ -3878,7 +3905,7 @@ v800_elf_info_to_howto (bfd *               abfd,
 \f
 
 #undef  TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM                      bfd_elf32_v850_rh850_vec
+#define TARGET_LITTLE_SYM                      v800_elf32_vec
 #undef  TARGET_LITTLE_NAME
 #define TARGET_LITTLE_NAME                     "elf32-v850-rh850"
 #undef  ELF_ARCH
This page took 0.058653 seconds and 4 git commands to generate.