Rename non_ir_ref to non_ir_ref_regular
[deliverable/binutils-gdb.git] / bfd / coff-alpha.c
index 8c68b56a80fb06c8ca3e99e91ad8516ebe7e62d1..8ecba2f0d8f03fd7746adbee7ee718086ccb6b5e 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for ALPHA Extended-Coff files.
-   Copyright (C) 1993-2014 Free Software Foundation, Inc.
+   Copyright (C) 1993-2017 Free Software Foundation, Inc.
    Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
    Ian Lance Taylor <ian@cygnus.com>.
 
@@ -446,7 +446,7 @@ alpha_ecoff_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED,
     return TRUE;
 
   if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f))
-    (*_bfd_error_handler)
+    _bfd_error_handler
       (_("%B: Cannot handle compressed Alpha binaries.\n"
         "   Use compiler flags, or objZ, to generate uncompressed binaries."),
        abfd);
@@ -597,7 +597,8 @@ alpha_adjust_reloc_in (bfd *abfd,
 {
   if (intern->r_type > ALPHA_R_GPVALUE)
     {
-      (*_bfd_error_handler)
+      /* xgettext:c-format */
+      _bfd_error_handler
        (_("%B: unknown/unsupported relocation type %d"),
         abfd, intern->r_type);
       bfd_set_error (bfd_error_bad_value);
@@ -1101,24 +1102,19 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
          switch (r)
            {
            case bfd_reloc_undefined:
-             if (! ((*link_info->callbacks->undefined_symbol)
-                    (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
-                     input_bfd, input_section, rel->address, TRUE)))
-               goto error_return;
+             (*link_info->callbacks->undefined_symbol)
+               (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
+                input_bfd, input_section, rel->address, TRUE);
              break;
            case bfd_reloc_dangerous:
-             if (! ((*link_info->callbacks->reloc_dangerous)
-                    (link_info, err, input_bfd, input_section,
-                     rel->address)))
-               goto error_return;
+             (*link_info->callbacks->reloc_dangerous)
+               (link_info, err, input_bfd, input_section, rel->address);
              break;
            case bfd_reloc_overflow:
-             if (! ((*link_info->callbacks->reloc_overflow)
-                    (link_info, NULL,
-                     bfd_asymbol_name (*rel->sym_ptr_ptr),
-                     rel->howto->name, rel->addend, input_bfd,
-                     input_section, rel->address)))
-               goto error_return;
+             (*link_info->callbacks->reloc_overflow)
+               (link_info, NULL, bfd_asymbol_name (*rel->sym_ptr_ptr),
+                rel->howto->name, rel->addend, input_bfd,
+                input_section, rel->address);
              break;
            case bfd_reloc_outofrange:
            default:
@@ -1226,7 +1222,7 @@ alpha_convert_external_reloc (bfd *output_bfd ATTRIBUTE_UNUSED,
   unsigned long r_symndx;
   bfd_vma relocation;
 
-  BFD_ASSERT (info->relocatable);
+  BFD_ASSERT (bfd_link_relocatable (info));
 
   if (h->root.type == bfd_link_hash_defined
       || h->root.type == bfd_link_hash_defweak)
@@ -1405,7 +1401,7 @@ alpha_relocate_section (bfd *output_bfd,
 
   lita_sec = symndx_to_section[RELOC_SECTION_LITA];
   gp = _bfd_get_gp_value (output_bfd);
-  if (! info->relocatable && lita_sec != NULL)
+  if (! bfd_link_relocatable (info) && lita_sec != NULL)
     {
       struct ecoff_section_tdata *lita_sec_data;
 
@@ -1503,21 +1499,22 @@ alpha_relocate_section (bfd *output_bfd,
       switch (r_type)
        {
        case ALPHA_R_GPRELHIGH:
-         (*_bfd_error_handler)
+         _bfd_error_handler
            (_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"),
             input_bfd);
          bfd_set_error (bfd_error_bad_value);
          continue;
 
        case ALPHA_R_GPRELLOW:
-         (*_bfd_error_handler)
+         _bfd_error_handler
            (_("%B: unsupported relocation: ALPHA_R_GPRELLOW"),
             input_bfd);
          bfd_set_error (bfd_error_bad_value);
          continue;
 
        default:
-         (*_bfd_error_handler)
+         _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: unknown relocation type %d"),
             input_bfd, (int) r_type);
          bfd_set_error (bfd_error_bad_value);
@@ -1530,7 +1527,7 @@ alpha_relocate_section (bfd *output_bfd,
             not otherwise used for anything.  For some reason, the
             address of the relocation does not appear to include the
             section VMA, unlike the other relocation types.  */
-         if (info->relocatable)
+         if (bfd_link_relocatable (info))
            H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
                      ext_rel->r_vaddr);
          adjust_addrp = FALSE;
@@ -1683,7 +1680,7 @@ alpha_relocate_section (bfd *output_bfd,
              if (h == (struct ecoff_link_hash_entry *) NULL)
                abort ();
 
-             if (! info->relocatable)
+             if (! bfd_link_relocatable (info))
                {
                  if (h->root.type == bfd_link_hash_defined
                      || h->root.type == bfd_link_hash_defweak)
@@ -1696,10 +1693,9 @@ alpha_relocate_section (bfd *output_bfd,
                         do not have a meaningful number for the
                         location within the section that is being
                         relocated.  */
-                     if (! ((*info->callbacks->undefined_symbol)
-                            (info, h->root.root.string, input_bfd,
-                             input_section, (bfd_vma) 0, TRUE)))
-                       return FALSE;
+                     (*info->callbacks->undefined_symbol)
+                       (info, h->root.root.string, input_bfd,
+                        input_section, (bfd_vma) 0, TRUE);
                      addend = 0;
                    }
                }
@@ -1712,10 +1708,9 @@ alpha_relocate_section (bfd *output_bfd,
                      /* This symbol is not being written out.  Pass
                         the address as 0, as with undefined_symbol,
                         above.  */
-                     if (! ((*info->callbacks->unattached_reloc)
-                            (info, h->root.root.string, input_bfd,
-                             input_section, (bfd_vma) 0)))
-                       return FALSE;
+                     (*info->callbacks->unattached_reloc)
+                       (info, h->root.root.string,
+                        input_bfd, input_section, (bfd_vma) 0);
                    }
 
                  addend = alpha_convert_external_reloc (output_bfd, info,
@@ -1726,7 +1721,7 @@ alpha_relocate_section (bfd *output_bfd,
 
          addend += r_vaddr;
 
-         if (info->relocatable)
+         if (bfd_link_relocatable (info))
            {
              /* Adjust r_vaddr by the addend.  */
              H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
@@ -1762,7 +1757,7 @@ alpha_relocate_section (bfd *output_bfd,
          /* Store a value from the reloc stack into a bitfield.  If
             we are generating relocatable output, all we do is
             adjust the address of the reloc.  */
-         if (! info->relocatable)
+         if (! bfd_link_relocatable (info))
            {
              bfd_vma mask;
              bfd_vma val;
@@ -1828,7 +1823,7 @@ alpha_relocate_section (bfd *output_bfd,
                abort ();
            }
 
-         if (info->relocatable)
+         if (bfd_link_relocatable (info))
            {
              /* We are generating relocatable output, and must
                 convert the existing reloc.  */
@@ -1839,10 +1834,9 @@ alpha_relocate_section (bfd *output_bfd,
                      && h->indx == -1)
                    {
                      /* This symbol is not being written out.  */
-                     if (! ((*info->callbacks->unattached_reloc)
-                            (info, h->root.root.string, input_bfd,
-                             input_section, r_vaddr - input_section->vma)))
-                       return FALSE;
+                     (*info->callbacks->unattached_reloc)
+                       (info, h->root.root.string, input_bfd,
+                        input_section, r_vaddr - input_section->vma);
                    }
 
                  relocation = alpha_convert_external_reloc (output_bfd,
@@ -1896,11 +1890,9 @@ alpha_relocate_section (bfd *output_bfd,
                    }
                  else
                    {
-                     if (! ((*info->callbacks->undefined_symbol)
-                            (info, h->root.root.string, input_bfd,
-                             input_section,
-                             r_vaddr - input_section->vma, TRUE)))
-                       return FALSE;
+                     (*info->callbacks->undefined_symbol)
+                       (info, h->root.root.string, input_bfd, input_section,
+                        r_vaddr - input_section->vma, TRUE);
                      relocation = 0;
                    }
                }
@@ -1942,19 +1934,17 @@ alpha_relocate_section (bfd *output_bfd,
                    else
                      name = bfd_section_name (input_bfd,
                                               symndx_to_section[r_symndx]);
-                   if (! ((*info->callbacks->reloc_overflow)
-                          (info, NULL, name,
-                           alpha_howto_table[r_type].name,
-                           (bfd_vma) 0, input_bfd, input_section,
-                           r_vaddr - input_section->vma)))
-                     return FALSE;
+                   (*info->callbacks->reloc_overflow)
+                     (info, NULL, name, alpha_howto_table[r_type].name,
+                      (bfd_vma) 0, input_bfd, input_section,
+                      r_vaddr - input_section->vma);
                  }
                  break;
                }
            }
        }
 
-      if (info->relocatable && adjust_addrp)
+      if (bfd_link_relocatable (info) && adjust_addrp)
        {
          /* Change the address of the relocation.  */
          H_PUT_64 (input_bfd,
@@ -1967,10 +1957,9 @@ alpha_relocate_section (bfd *output_bfd,
 
       if (gp_usedp && gp_undefined)
        {
-         if (! ((*info->callbacks->reloc_dangerous)
-                (info, _("GP relative relocation used when GP not defined"),
-                 input_bfd, input_section, r_vaddr - input_section->vma)))
-           return FALSE;
+         (*info->callbacks->reloc_dangerous)
+           (info, _("GP relative relocation used when GP not defined"),
+            input_bfd, input_section, r_vaddr - input_section->vma);
          /* Only give the error once per link.  */
          gp = 4;
          _bfd_set_gp_value (output_bfd, gp);
@@ -2187,7 +2176,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
 static bfd *
 alpha_ecoff_openr_next_archived_file (bfd *archive, bfd *last_file)
 {
-  file_ptr filestart;
+  ufile_ptr filestart;
 
   if (last_file == NULL)
     filestart = bfd_ardata (archive)->first_file_filepos;
@@ -2208,6 +2197,12 @@ alpha_ecoff_openr_next_archived_file (bfd *archive, bfd *last_file)
         BSD-4.4-style element with a long odd size.  */
       filestart = last_file->proxy_origin + size;
       filestart += filestart % 2;
+      if (filestart < last_file->proxy_origin)
+       {
+         /* Prevent looping.  See PR19256.  */
+         bfd_set_error (bfd_error_malformed_archive);
+         return NULL;
+       }
     }
 
   return alpha_ecoff_get_elt_at_filepos (archive, filestart);
@@ -2345,8 +2340,12 @@ static const struct ecoff_backend_data alpha_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_link_check_relocs    _bfd_generic_link_check_relocs
+
+/* Installing internal relocations in a section is also generic.  */
+#define _bfd_ecoff_set_reloc _bfd_generic_set_reloc
 
-const bfd_target ecoffalpha_little_vec =
+const bfd_target alpha_ecoff_le_vec =
 {
   "ecoff-littlealpha",         /* name */
   bfd_target_ecoff_flavour,
This page took 0.039176 seconds and 4 git commands to generate.