gas: run the sparc test dcti-couples-v9 only in ELF targets.
[deliverable/binutils-gdb.git] / bfd / elf32-h8300.c
index 4cfc30e3ada6129e896c1f49e5899eed32c95a79..5368385fd90724ce1cf9ef52607240061fff05f2 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for Renesas H8/300 ELF binaries.
-   Copyright 1993-2013 Free Software Foundation, Inc.
+   Copyright (C) 1993-2016 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -61,7 +61,7 @@ static reloc_howto_type h8_elf_howto_table[] =
 #define R_H8_NONE_X 0
   HOWTO (R_H8_NONE,            /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        3,                     /* size (0 = byte, 1 = short, 2 = long) */
         0,                     /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
@@ -468,19 +468,19 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
        }
       else
        {
-         bfd_boolean unresolved_reloc, warned;
+         bfd_boolean unresolved_reloc, warned, ignored;
 
          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))
        RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
                                         rel, 1, relend, howto, 0, contents);
 
-      if (info->relocatable)
+      if (bfd_link_relocatable (info))
        continue;
 
       r = elf32_h8_final_link_relocate (r_type, input_bfd, output_bfd,
@@ -507,18 +507,14 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
          switch (r)
            {
            case bfd_reloc_overflow:
-             if (! ((*info->callbacks->reloc_overflow)
-                    (info, (h ? &h->root : NULL), name, howto->name,
-                     (bfd_vma) 0, input_bfd, input_section,
-                     rel->r_offset)))
-               return FALSE;
+             (*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:
-             if (! ((*info->callbacks->undefined_symbol)
-                    (info, name, input_bfd, input_section,
-                     rel->r_offset, TRUE)))
-               return FALSE;
+             (*info->callbacks->undefined_symbol)
+               (info, name, input_bfd, input_section, rel->r_offset, TRUE);
              break;
 
            case bfd_reloc_outofrange:
@@ -538,10 +534,8 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
              /* fall through */
 
            common_error:
-             if (!((*info->callbacks->warning)
-                   (info, msg, name, input_bfd, input_section,
-                    rel->r_offset)))
-               return FALSE;
+             (*info->callbacks->warning) (info, msg, name, input_bfd,
+                                          input_section, rel->r_offset);
              break;
            }
        }
@@ -707,7 +701,7 @@ elf32_h8_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.  */
-  if (link_info->relocatable
+  if (bfd_link_relocatable (link_info)
       || (sec->flags & SEC_RELOC) == 0
       || sec->reloc_count == 0
       || (sec->flags & SEC_CODE) == 0)
@@ -742,7 +736,7 @@ elf32_h8_relax_section (bfd *abfd, asection *sec,
         some long jumps created by the compiler.  */
       if (irel != internal_relocs)
        last_reloc = irel - 1;
-      
+
       switch(ELF32_R_TYPE (irel->r_info))
        {
        case R_H8_DIR24R8:
@@ -1518,7 +1512,7 @@ elf32_h8_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count)
     {
       /* Get the new reloc address.  */
       if ((irel->r_offset > addr
-          && irel->r_offset < toaddr))
+          && irel->r_offset <= toaddr))
        irel->r_offset -= count;
     }
 
@@ -1530,7 +1524,7 @@ elf32_h8_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count)
     {
       if (isym->st_shndx == sec_shndx
          && isym->st_value > addr
-         && isym->st_value < toaddr)
+         && isym->st_value <= toaddr)
        isym->st_value -= count;
     }
 
@@ -1542,14 +1536,13 @@ elf32_h8_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count)
   for (; sym_hashes < end_hashes; sym_hashes++)
     {
       struct elf_link_hash_entry *sym_hash = *sym_hashes;
+
       if ((sym_hash->root.type == bfd_link_hash_defined
           || sym_hash->root.type == bfd_link_hash_defweak)
          && sym_hash->root.u.def.section == sec
          && sym_hash->root.u.def.value > addr
-         && sym_hash->root.u.def.value < toaddr)
-       {
-         sym_hash->root.u.def.value -= count;
-       }
+         && sym_hash->root.u.def.value <= toaddr)
+       sym_hash->root.u.def.value -= count;
     }
 
   return TRUE;
@@ -1706,7 +1699,7 @@ elf32_h8_get_relocated_section_contents (bfd *output_bfd,
 }
 
 
-#define TARGET_BIG_SYM                 bfd_elf32_h8300_vec
+#define TARGET_BIG_SYM                 h8300_elf32_vec
 #define TARGET_BIG_NAME                        "elf32-h8300"
 #define ELF_ARCH                       bfd_arch_h8300
 #define ELF_MACHINE_CODE               EM_H8_300
@@ -1745,3 +1738,12 @@ elf32_h8_get_relocated_section_contents (bfd *output_bfd,
 #define elf_symbol_leading_char '_'
 
 #include "elf32-target.h"
+
+#undef  TARGET_BIG_SYM
+#define TARGET_BIG_SYM                 h8300_elf32_linux_vec
+#undef  TARGET_BIG_NAME
+#define TARGET_BIG_NAME                        "elf32-h8300-linux"
+#undef  elf_symbol_leading_char
+#define elf32_bed                      elf32_h8300_linux_bed
+
+#include "elf32-target.h"
This page took 0.0335220000000001 seconds and 4 git commands to generate.