Proper bound check in _bfd_doprnt_scan
[deliverable/binutils-gdb.git] / bfd / coff-mips.c
index cdcdde2bcf25848b4939203f1bb261fc8cce1bc2..c3ade6216999d6d6ee206530af23e894f76c0f20 100644 (file)
@@ -1,7 +1,5 @@
 /* BFD back-end for MIPS Extended-Coff files.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1990-2017 Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
 
@@ -45,7 +43,7 @@ static bfd_reloc_status_type
 mips_reflo_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type
-mips_gprel_reloc 
+mips_gprel_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 
 \f
@@ -942,11 +940,10 @@ mips_relocate_section (bfd *output_bfd,
        {
          if (gp_undefined)
            {
-             if (! ((*info->callbacks->reloc_dangerous)
-                    (info, _("GP relative relocation used when GP not defined"),
-                     input_bfd, input_section,
-                     int_rel.r_vaddr - input_section->vma)))
-               return FALSE;
+             (*info->callbacks->reloc_dangerous)
+               (info, _("GP relative relocation used when GP not defined"),
+                input_bfd, input_section,
+                int_rel.r_vaddr - input_section->vma);
              /* Only give the error once per link.  */
              gp = 4;
              _bfd_set_gp_value (output_bfd, gp);
@@ -962,7 +959,7 @@ mips_relocate_section (bfd *output_bfd,
                 and the GP value of OUTPUT_BFD (which is in GP).  */
              addend = ecoff_data (input_bfd)->gp - gp;
            }
-         else if (! info->relocatable
+         else if (! bfd_link_relocatable (info)
                   || h->root.type == bfd_link_hash_defined
                   || h->root.type == bfd_link_hash_defweak)
            {
@@ -988,7 +985,7 @@ mips_relocate_section (bfd *output_bfd,
            }
        }
 
-      if (info->relocatable)
+      if (bfd_link_relocatable (info))
        {
          /* We are generating relocatable output, and must convert
             the existing reloc.  */
@@ -1077,11 +1074,9 @@ mips_relocate_section (bfd *output_bfd,
                  if (int_rel.r_symndx == -1)
                    {
                      /* This symbol is not being written out.  */
-                     if (! ((*info->callbacks->unattached_reloc)
-                            (info, h->root.root.string, input_bfd,
-                             input_section,
-                             int_rel.r_vaddr - input_section->vma)))
-                       return FALSE;
+                     (*info->callbacks->unattached_reloc)
+                       (info, h->root.root.string, input_bfd, input_section,
+                        int_rel.r_vaddr - input_section->vma);
                      int_rel.r_symndx = 0;
                    }
                  relocation = 0;
@@ -1153,11 +1148,9 @@ mips_relocate_section (bfd *output_bfd,
                }
              else
                {
-                 if (! ((*info->callbacks->undefined_symbol)
-                        (info, h->root.root.string, input_bfd,
-                         input_section,
-                         int_rel.r_vaddr - input_section->vma, TRUE)))
-                   return FALSE;
+                 (*info->callbacks->undefined_symbol)
+                   (info, h->root.root.string, input_bfd, input_section,
+                    int_rel.r_vaddr - input_section->vma, TRUE);
                  relocation = 0;
                }
            }
@@ -1225,11 +1218,10 @@ mips_relocate_section (bfd *output_bfd,
                  name = NULL;
                else
                  name = bfd_section_name (input_bfd, s);
-               if (! ((*info->callbacks->reloc_overflow)
-                      (info, (h ? &h->root : NULL), name, howto->name,
-                       (bfd_vma) 0, input_bfd, input_section,
-                       int_rel.r_vaddr - input_section->vma)))
-                 return FALSE;
+               (*info->callbacks->reloc_overflow)
+                 (info, (h ? &h->root : NULL), name, howto->name,
+                  (bfd_vma) 0, input_bfd, input_section,
+                  int_rel.r_vaddr - input_section->vma);
              }
              break;
            }
@@ -1255,8 +1247,8 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
     (unsigned (*) (bfd *,void *,void *)) bfd_void, /* reloc_out */
     mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
     mips_ecoff_swap_scnhdr_out,
-    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, 
-    ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2,
+    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE,
+    ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2, 32768,
     mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
     mips_ecoff_swap_scnhdr_in, NULL,
     mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
@@ -1364,10 +1356,12 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
 #define _bfd_ecoff_section_already_linked \
   _bfd_coff_section_already_linked
 #define _bfd_ecoff_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define _bfd_ecoff_bfd_define_start_stop bfd_generic_define_start_stop
+#define _bfd_ecoff_set_reloc _bfd_generic_set_reloc
 
-extern const bfd_target ecoff_big_vec;
+extern const bfd_target mips_ecoff_be_vec;
 
-const bfd_target ecoff_little_vec =
+const bfd_target mips_ecoff_le_vec =
 {
   "ecoff-littlemips",          /* name */
   bfd_target_ecoff_flavour,
@@ -1407,12 +1401,12 @@ const bfd_target ecoff_little_vec =
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  & ecoff_big_vec,
+  & mips_ecoff_be_vec,
 
   & mips_ecoff_backend_data
 };
 
-const bfd_target ecoff_big_vec =
+const bfd_target mips_ecoff_be_vec =
 {
   "ecoff-bigmips",             /* name */
   bfd_target_ecoff_flavour,
@@ -1451,12 +1445,12 @@ const bfd_target ecoff_big_vec =
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  & ecoff_little_vec,
+  & mips_ecoff_le_vec,
 
   & mips_ecoff_backend_data
 };
 
-const bfd_target ecoff_biglittle_vec =
+const bfd_target mips_ecoff_bele_vec =
 {
   "ecoff-biglittlemips",               /* name */
   bfd_target_ecoff_flavour,
This page took 0.033603 seconds and 4 git commands to generate.