Remove trailing white spaces in bfd
[deliverable/binutils-gdb.git] / bfd / pdp11.c
index 37f960f1992a809630ac85f7002db3760bb415ea..706beefe2a45674ef99b8d5f243a66565553e64a 100644 (file)
@@ -1,12 +1,12 @@
 /* BFD back-end for PDP-11 a.out binaries.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -16,7 +16,9 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA. */
+
 
 /* BFD backend for PDP-11, running 2.11BSD in particular.
 
 /* The header is not included in the text segment.  */
 #define N_HEADER_IN_TEXT(x)    0
 
-/* There are no shared libraries.  */
-#define N_SHARED_LIB(x)        0
-
 /* There is no flags field.  */
 #define N_FLAGS(exec)          0
 
 #define N_SET_FLAGS(exec, flags) do { } while (0)
-#define N_BADMAG(x) (((x).a_info != OMAGIC)   \
-                 && ((x).a_info != NMAGIC)   \
-                 && ((x).a_info != A_MAGIC3) \
-                 && ((x).a_info != A_MAGIC4) \
-                 && ((x).a_info != A_MAGIC5) \
-                 && ((x).a_info != A_MAGIC6))
+#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC      \
+                    && N_MAGIC(x) != NMAGIC    \
+                    && N_MAGIC(x) != ZMAGIC)
 
+#include "sysdep.h"
 #include "bfd.h"
 
 #define external_exec pdp11_external_exec
@@ -123,7 +120,6 @@ struct pdp11_external_nlist
 
 #define WRITE_HEADERS(abfd, execp) pdp11_aout_write_headers (abfd, execp)
 
-#include "sysdep.h"
 #include "libbfd.h"
 #include "libaout.h"
 
@@ -277,6 +273,22 @@ NAME (aout, reloc_type_lookup) (bfd * abfd ATTRIBUTE_UNUSED,
     }
 }
 
+reloc_howto_type *
+NAME (aout, reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
+                                     const char *r_name)
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < sizeof (howto_table_pdp11) / sizeof (howto_table_pdp11[0]);
+       i++)
+    if (howto_table_pdp11[i].name != NULL
+       && strcasecmp (howto_table_pdp11[i].name, r_name) == 0)
+      return &howto_table_pdp11[i];
+
+  return NULL;
+}
+
 static int
 pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp)
 {
@@ -328,7 +340,7 @@ pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp)
       if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0
          || !NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))
          || bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0
-         || !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))  
+         || !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
        return FALSE;
     }
 
@@ -489,19 +501,12 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
       abfd->flags |= D_PAGED | WP_TEXT;
       adata (abfd).magic = z_magic;
     }
-  else if (N_MAGIC (*execp) == QMAGIC)
-    {
-      abfd->flags |= D_PAGED | WP_TEXT;
-      adata (abfd).magic = z_magic;
-      adata (abfd).subformat = q_magic_format;
-    }
   else if (N_MAGIC (*execp) == NMAGIC)
     {
       abfd->flags |= WP_TEXT;
       adata (abfd).magic = n_magic;
     }
-  else if (N_MAGIC (*execp) == OMAGIC
-          || N_MAGIC (*execp) == BMAGIC)
+  else if (N_MAGIC (*execp) == OMAGIC)
     adata (abfd).magic = o_magic;
   else
     {
@@ -940,10 +945,7 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
   execp->a_text = obj_textsec(abfd)->size;
   if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
     execp->a_text += adata(abfd).exec_bytes_size;
-  if (obj_aout_subformat (abfd) == q_magic_format)
-    N_SET_MAGIC (*execp, QMAGIC);
-  else
-    N_SET_MAGIC (*execp, ZMAGIC);
+  N_SET_MAGIC (*execp, ZMAGIC);
 
   /* Spec says data section should be rounded up to page boundary.  */
   obj_datasec(abfd)->size
@@ -1111,32 +1113,27 @@ NAME (aout, new_section_hook) (bfd *abfd, asection *newsect)
   if (bfd_get_format (abfd) == bfd_object)
     {
       if (obj_textsec (abfd) == NULL
-         && ! strcmp (newsect->name, ".text"))
+         && !strcmp (newsect->name, ".text"))
        {
          obj_textsec(abfd)= newsect;
          newsect->target_index = N_TEXT;
-         return TRUE;
        }
-
-    if (obj_datasec (abfd) == NULL
-       && ! strcmp (newsect->name, ".data"))
-      {
-       obj_datasec (abfd) = newsect;
-       newsect->target_index = N_DATA;
-       return TRUE;
-      }
-
-    if (obj_bsssec (abfd) == NULL
-       && !strcmp (newsect->name, ".bss"))
-      {
-       obj_bsssec (abfd) = newsect;
-       newsect->target_index = N_BSS;
-       return TRUE;
-      }
-  }
+      else if (obj_datasec (abfd) == NULL
+              && !strcmp (newsect->name, ".data"))
+       {
+         obj_datasec (abfd) = newsect;
+         newsect->target_index = N_DATA;
+       }
+      else if (obj_bsssec (abfd) == NULL
+              && !strcmp (newsect->name, ".bss"))
+       {
+         obj_bsssec (abfd) = newsect;
+         newsect->target_index = N_BSS;
+       }
+    }
 
   /* We allow more than three sections internally.  */
-  return TRUE;
+  return _bfd_generic_new_section_hook (abfd, newsect);
 }
 
 bfd_boolean
@@ -1433,13 +1430,13 @@ asymbol *
 NAME (aout, make_empty_symbol) (bfd *abfd)
 {
   bfd_size_type amt = sizeof (aout_symbol_type);
-  aout_symbol_type *new = bfd_zalloc (abfd, amt);
+  aout_symbol_type *new_symbol_type = bfd_zalloc (abfd, amt);
 
-  if (!new)
+  if (!new_symbol_type)
     return NULL;
-  new->symbol.the_bfd = abfd;
+  new_symbol_type->symbol.the_bfd = abfd;
 
-  return &new->symbol;
+  return &new_symbol_type->symbol;
 }
 
 /* Translate a set of internal symbols into external symbols.  */
@@ -1572,7 +1569,7 @@ add_to_stringtab (bfd *abfd,
                  bfd_boolean copy)
 {
   bfd_boolean hash;
-  bfd_size_type index;
+  bfd_size_type str_index;
 
   /* An index of 0 always means the empty string.  */
   if (str == 0 || *str == '\0')
@@ -1584,14 +1581,14 @@ add_to_stringtab (bfd *abfd,
   if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
     hash = FALSE;
 
-  index = _bfd_stringtab_add (tab, str, hash, copy);
+  str_index = _bfd_stringtab_add (tab, str, hash, copy);
 
-  if (index != (bfd_size_type) -1)
+  if (str_index != (bfd_size_type) -1)
     /* Add BYTES_IN_LONG to the return value to account for the
        space taken up by the string table size.  */
-    index += BYTES_IN_LONG;
+    str_index += BYTES_IN_LONG;
 
-  return index;
+  return str_index;
 }
 
 /* Write out a strtab.  ABFD is already at the right location in the
@@ -2376,7 +2373,8 @@ NAME (aout, find_nearest_line) (bfd *abfd,
 }
 
 int
-NAME (aout, sizeof_headers) (bfd *abfd, bfd_boolean execable ATTRIBUTE_UNUSED)
+NAME (aout, sizeof_headers) (bfd *abfd,
+                            struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   return adata (abfd).exec_bytes_size;
 }
@@ -2547,7 +2545,8 @@ aout_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
 static bfd_boolean
 aout_link_check_ar_symbols (bfd *abfd,
                            struct bfd_link_info *info,
-                           bfd_boolean *pneeded)
+                           bfd_boolean *pneeded,
+                           bfd **subsbfd)
 {
   struct external_nlist *p;
   struct external_nlist *pend;
@@ -2602,7 +2601,8 @@ aout_link_check_ar_symbols (bfd *abfd,
             but not if it is defined in the .text section.  That
             seems a bit crazy to me, and I haven't implemented it.
             However, it might be correct.  */
-         if (! (*info->callbacks->add_archive_element) (info, abfd, name))
+         if (!(*info->callbacks
+               ->add_archive_element) (info, abfd, name, subsbfd))
            return FALSE;
          *pneeded = TRUE;
          return TRUE;
@@ -2629,8 +2629,8 @@ aout_link_check_ar_symbols (bfd *abfd,
                         outside BFD.  We assume that we should link
                         in the object file.  This is done for the -u
                         option in the linker.  */
-                     if (! (*info->callbacks->add_archive_element)
-                         (info, abfd, name))
+                     if (!(*info->callbacks
+                           ->add_archive_element) (info, abfd, name, subsbfd))
                        return FALSE;
                      *pneeded = TRUE;
                      return TRUE;
@@ -2682,21 +2682,36 @@ aout_link_check_archive_element (bfd *abfd,
                                 struct bfd_link_info *info,
                                 bfd_boolean *pneeded)
 {
-  if (! aout_get_external_symbols (abfd))
+  bfd *oldbfd;
+  bfd_boolean needed;
+
+  if (!aout_get_external_symbols (abfd))
     return FALSE;
 
-  if (! aout_link_check_ar_symbols (abfd, info, pneeded))
+  oldbfd = abfd;
+  if (!aout_link_check_ar_symbols (abfd, info, pneeded, &abfd))
     return FALSE;
 
-  if (*pneeded)
+  needed = *pneeded;
+  if (needed)
     {
-      if (! aout_link_add_symbols (abfd, info))
+      /* Potentially, the add_archive_element hook may have set a
+        substitute BFD for us.  */
+      if (abfd != oldbfd)
+       {
+         if (!info->keep_memory
+             && !aout_link_free_symbols (oldbfd))
+           return FALSE;
+         if (!aout_get_external_symbols (abfd))
+           return FALSE;
+       }
+      if (!aout_link_add_symbols (abfd, info))
        return FALSE;
     }
 
-  if (! info->keep_memory || ! *pneeded)
+  if (!info->keep_memory || !needed)
     {
-      if (! aout_link_free_symbols (abfd))
+      if (!aout_link_free_symbols (abfd))
        return FALSE;
     }
 
@@ -2771,7 +2786,9 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
       switch (type)
        {
        default:
-         abort ();
+         /* Anything else should be a debugging symbol.  */
+         BFD_ASSERT ((type & N_STAB) != 0);
+         continue;
 
        case N_UNDF:
        case N_ABS:
@@ -2875,9 +2892,10 @@ aout_link_includes_newfunc (struct bfd_hash_entry *entry,
 }
 
 static bfd_boolean
-aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
+aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
 {
-  struct aout_final_link_info *finfo = (struct aout_final_link_info *) data;
+  struct aout_link_hash_entry *h = (struct aout_link_hash_entry *) bh;
+  struct aout_final_link_info *flaginfo = (struct aout_final_link_info *) data;
   bfd *output_bfd;
   int type;
   bfd_vma val;
@@ -2892,12 +2910,12 @@ aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
        return TRUE;
     }
 
-  output_bfd = finfo->output_bfd;
+  output_bfd = flaginfo->output_bfd;
 
   if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL)
     {
       if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol)
-            (output_bfd, finfo->info, h)))
+            (output_bfd, flaginfo->info, h)))
        {
          /* FIXME: No way to handle errors.  */
          abort ();
@@ -2911,9 +2929,9 @@ aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
 
   /* An indx of -2 means the symbol must be written.  */
   if (h->indx != -2
-      && (finfo->info->strip == strip_all
-         || (finfo->info->strip == strip_some
-             && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
+      && (flaginfo->info->strip == strip_all
+         || (flaginfo->info->strip == strip_some
+             && bfd_hash_lookup (flaginfo->info->keep_hash, h->root.root.string,
                                  FALSE, FALSE) == NULL)))
     return TRUE;
 
@@ -2968,7 +2986,7 @@ aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
     }
 
   H_PUT_8 (output_bfd, type, outsym.e_type);
-  indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string,
+  indx = add_to_stringtab (output_bfd, flaginfo->strtab, h->root.root.string,
                           FALSE);
   if (indx == (bfd_size_type) -1)
     /* FIXME: No way to handle errors.  */
@@ -2978,12 +2996,12 @@ aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
   PUT_WORD (output_bfd, val, outsym.e_value);
 
   amt = EXTERNAL_NLIST_SIZE;
-  if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0
+  if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0
       || bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt)
     /* FIXME: No way to handle errors.  */
     abort ();
 
-  finfo->symoff += amt;
+  flaginfo->symoff += amt;
   h->indx = obj_aout_external_sym_count (output_bfd);
   ++obj_aout_external_sym_count (output_bfd);
 
@@ -2993,7 +3011,7 @@ aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
 /* Handle a link order which is supposed to generate a reloc.  */
 
 static bfd_boolean
-aout_link_reloc_link_order (struct aout_final_link_info *finfo,
+aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
                            asection *o,
                            struct bfd_link_order *p)
 {
@@ -3015,7 +3033,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
        r_index = N_ABS | N_EXT;
       else
        {
-         BFD_ASSERT (pr->u.section->owner == finfo->output_bfd);
+         BFD_ASSERT (pr->u.section->owner == flaginfo->output_bfd);
          r_index = pr->u.section->target_index;
        }
     }
@@ -3026,7 +3044,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
       BFD_ASSERT (p->type == bfd_symbol_reloc_link_order);
       r_extern = 1;
       h = ((struct aout_link_hash_entry *)
-          bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info,
+          bfd_wrapped_link_hash_lookup (flaginfo->output_bfd, flaginfo->info,
                                         pr->u.name, FALSE, FALSE, TRUE));
       if (h != NULL
          && h->indx >= 0)
@@ -3039,35 +3057,35 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
             symbol.  */
          h->indx = -2;
          h->written = FALSE;
-         if (! aout_link_write_other_symbol (h, (void *) finfo))
+         if (!aout_link_write_other_symbol (&h->root.root, flaginfo))
            return FALSE;
          r_index = h->indx;
        }
       else
        {
-         if (! ((*finfo->info->callbacks->unattached_reloc)
-                (finfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0)))
+         if (! ((*flaginfo->info->callbacks->unattached_reloc)
+                (flaginfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0)))
            return FALSE;
          r_index = 0;
        }
     }
 
-  howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc);
+  howto = bfd_reloc_type_lookup (flaginfo->output_bfd, pr->reloc);
   if (howto == 0)
     {
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
 
-  if (o == obj_textsec (finfo->output_bfd))
-    reloff_ptr = &finfo->treloff;
-  else if (o == obj_datasec (finfo->output_bfd))
-    reloff_ptr = &finfo->dreloff;
+  if (o == obj_textsec (flaginfo->output_bfd))
+    reloff_ptr = &flaginfo->treloff;
+  else if (o == obj_datasec (flaginfo->output_bfd))
+    reloff_ptr = &flaginfo->dreloff;
   else
     abort ();
 
 #ifdef MY_put_reloc
-  MY_put_reloc(finfo->output_bfd, r_extern, r_index, p->offset, howto,
+  MY_put_reloc(flaginfo->output_bfd, r_extern, r_index, p->offset, howto,
               &srel);
 #else
   {
@@ -3085,8 +3103,8 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
     r_relative = (howto->type & 32) != 0;
     r_length = howto->size;
 
-    PUT_WORD (finfo->output_bfd, p->offset, srel.r_address);
-    if (bfd_header_big_endian (finfo->output_bfd))
+    PUT_WORD (flaginfo->output_bfd, p->offset, srel.r_address);
+    if (bfd_header_big_endian (flaginfo->output_bfd))
       {
        srel.r_index[0] = r_index >> 16;
        srel.r_index[1] = r_index >> 8;
@@ -3132,7 +3150,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
       buf = bfd_zmalloc (size);
       if (buf == NULL)
        return FALSE;
-      r = MY_relocate_contents (howto, finfo->output_bfd,
+      r = MY_relocate_contents (howto, flaginfo->output_bfd,
                                pr->addend, buf);
       switch (r)
        {
@@ -3142,10 +3160,10 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
        case bfd_reloc_outofrange:
          abort ();
        case bfd_reloc_overflow:
-         if (! ((*finfo->info->callbacks->reloc_overflow)
-                (finfo->info, NULL,
+         if (! ((*flaginfo->info->callbacks->reloc_overflow)
+                (flaginfo->info, NULL,
                  (p->type == bfd_section_reloc_link_order
-                  ? bfd_section_name (finfo->output_bfd,
+                  ? bfd_section_name (flaginfo->output_bfd,
                                       pr->u.section)
                   : pr->u.name),
                  howto->name, pr->addend, NULL,
@@ -3156,7 +3174,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
            }
          break;
        }
-      ok = bfd_set_section_contents (finfo->output_bfd, o,
+      ok = bfd_set_section_contents (flaginfo->output_bfd, o,
                                     (void *) buf,
                                     (file_ptr) p->offset,
                                     size);
@@ -3165,19 +3183,19 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
        return FALSE;
     }
 
-  rel_size = obj_reloc_entry_size (finfo->output_bfd);
-  if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
-      || bfd_bwrite (rel_ptr, rel_size, finfo->output_bfd) != rel_size)
+  rel_size = obj_reloc_entry_size (flaginfo->output_bfd);
+  if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
+      || bfd_bwrite (rel_ptr, rel_size, flaginfo->output_bfd) != rel_size)
     return FALSE;
 
   *reloff_ptr += rel_size;
 
   /* Assert that the relocs have not run into the symbols, and that n
      the text relocs have not run into the data relocs.  */
-  BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
-             && (reloff_ptr != &finfo->treloff
+  BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (flaginfo->output_bfd)
+             && (reloff_ptr != &flaginfo->treloff
                  || (*reloff_ptr
-                     <= obj_datasec (finfo->output_bfd)->rel_filepos)));
+                     <= obj_datasec (flaginfo->output_bfd)->rel_filepos)));
 
   return TRUE;
 }
@@ -3199,7 +3217,7 @@ aout_reloc_type_to_section (bfd *abfd, int type)
 }
 
 static bfd_boolean
-pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
+pdp11_aout_link_input_section (struct aout_final_link_info *flaginfo,
                               bfd *input_bfd,
                               asection *input_section,
                               bfd_byte *relocs,
@@ -3216,24 +3234,22 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
   char *strings;
   struct aout_link_hash_entry **sym_hashes;
   int *symbol_map;
-  bfd_size_type reloc_count;
   bfd_byte *rel;
   bfd_byte *rel_end;
 
-  output_bfd = finfo->output_bfd;
+  output_bfd = flaginfo->output_bfd;
   check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc;
 
   BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_SIZE);
   BFD_ASSERT (input_bfd->xvec->header_byteorder
              == output_bfd->xvec->header_byteorder);
 
-  relocatable = finfo->info->relocatable;
+  relocatable = flaginfo->info->relocatable;
   syms = obj_aout_external_syms (input_bfd);
   strings = obj_aout_external_strings (input_bfd);
   sym_hashes = obj_aout_sym_hashes (input_bfd);
-  symbol_map = finfo->symbol_map;
+  symbol_map = flaginfo->symbol_map;
 
-  reloc_count = rel_size / RELOC_SIZE;
   rel = relocs;
   rel_end = rel + rel_size;
   for (; rel < rel_end; rel += RELOC_SIZE)
@@ -3320,8 +3336,8 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
                            {
                              h->indx = -2;
                              h->written = FALSE;
-                             if (! aout_link_write_other_symbol (h,
-                                                                 (void *) finfo))
+                             if (!aout_link_write_other_symbol (&h->root.root,
+                                                                flaginfo))
                                return FALSE;
                            }
                          r_index = h->indx;
@@ -3332,8 +3348,8 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
 
                          name = strings + GET_WORD (input_bfd,
                                                     syms[r_index].e_strx);
-                         if (! ((*finfo->info->callbacks->unattached_reloc)
-                                (finfo->info, name, input_bfd, input_section,
+                         if (! ((*flaginfo->info->callbacks->unattached_reloc)
+                                (flaginfo->info, name, input_bfd, input_section,
                                  r_addr)))
                            return FALSE;
                          r_index = 0;
@@ -3428,7 +3444,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
              bfd_boolean skip;
 
              if (! ((*check_dynamic_reloc)
-                    (finfo->info, input_bfd, input_section, h,
+                    (flaginfo->info, input_bfd, input_section, h,
                      (void *) rel, contents, &skip, &relocation)))
                return FALSE;
              if (skip)
@@ -3438,7 +3454,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
          /* Now warn if a global symbol is undefined.  We could not
              do this earlier, because check_dynamic_reloc might want
              to skip this reloc.  */
-         if (hundef && ! finfo->info->shared)
+         if (hundef && ! flaginfo->info->shared)
            {
              const char *name;
 
@@ -3446,8 +3462,8 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
                name = h->root.root.string;
              else
                name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
-             if (! ((*finfo->info->callbacks->undefined_symbol)
-                    (finfo->info, name, input_bfd, input_section,
+             if (! ((*flaginfo->info->callbacks->undefined_symbol)
+                    (flaginfo->info, name, input_bfd, input_section,
                      r_addr, TRUE)))
                return FALSE;
            }
@@ -3481,8 +3497,8 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
                    s = aout_reloc_type_to_section (input_bfd, r_type);
                    name = bfd_section_name (input_bfd, s);
                  }
-               if (! ((*finfo->info->callbacks->reloc_overflow)
-                      (finfo->info, (h ? &h->root : NULL), name,
+               if (! ((*flaginfo->info->callbacks->reloc_overflow)
+                      (flaginfo->info, (h ? &h->root : NULL), name,
                        howto->name, (bfd_vma) 0, input_bfd,
                        input_section, r_addr)))
                  return FALSE;
@@ -3498,7 +3514,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
 /* Link an a.out section into the output file.  */
 
 static bfd_boolean
-aout_link_input_section (struct aout_final_link_info *finfo,
+aout_link_input_section (struct aout_final_link_info *flaginfo,
                         bfd *input_bfd,
                         asection *input_section,
                         file_ptr *reloff_ptr,
@@ -3510,7 +3526,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
   /* Get the section contents.  */
   input_size = input_section->size;
   if (! bfd_get_section_contents (input_bfd, input_section,
-                                 (void *) finfo->contents,
+                                 (void *) flaginfo->contents,
                                  (file_ptr) 0, input_size))
     return FALSE;
 
@@ -3520,7 +3536,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
     relocs = aout_section_data (input_section)->relocs;
   else
     {
-      relocs = finfo->relocs;
+      relocs = flaginfo->relocs;
       if (rel_size > 0)
        {
          if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
@@ -3530,36 +3546,36 @@ aout_link_input_section (struct aout_final_link_info *finfo,
     }
 
   /* Relocate the section contents.  */
-  if (! pdp11_aout_link_input_section (finfo, input_bfd, input_section,
+  if (! pdp11_aout_link_input_section (flaginfo, input_bfd, input_section,
                                       (bfd_byte *) relocs,
-                                      rel_size, finfo->contents))
+                                      rel_size, flaginfo->contents))
     return FALSE;
 
   /* Write out the section contents.  */
-  if (! bfd_set_section_contents (finfo->output_bfd,
+  if (! bfd_set_section_contents (flaginfo->output_bfd,
                                  input_section->output_section,
-                                 (void *) finfo->contents,
+                                 (void *) flaginfo->contents,
                                  (file_ptr) input_section->output_offset,
                                  input_size))
     return FALSE;
 
   /* If we are producing relocatable output, the relocs were
      modified, and we now write them out.  */
-  if (finfo->info->relocatable && rel_size > 0)
+  if (flaginfo->info->relocatable && rel_size > 0)
     {
-      if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
+      if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
        return FALSE;
-      if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size)
+      if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size)
        return FALSE;
       *reloff_ptr += rel_size;
 
       /* Assert that the relocs have not run into the symbols, and
         that if these are the text relocs they have not run into the
         data relocs.  */
-      BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
-                 && (reloff_ptr != &finfo->treloff
+      BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (flaginfo->output_bfd)
+                 && (reloff_ptr != &flaginfo->treloff
                      || (*reloff_ptr
-                         <= obj_datasec (finfo->output_bfd)->rel_filepos)));
+                         <= obj_datasec (flaginfo->output_bfd)->rel_filepos)));
     }
 
   return TRUE;
@@ -3568,28 +3584,24 @@ aout_link_input_section (struct aout_final_link_info *finfo,
 /* Link an a.out input BFD into the output file.  */
 
 static bfd_boolean
-aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
+aout_link_input_bfd (struct aout_final_link_info *flaginfo, bfd *input_bfd)
 {
-  bfd_size_type sym_count;
-
   BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object);
 
   /* If this is a dynamic object, it may need special handling.  */
   if ((input_bfd->flags & DYNAMIC) != 0
       && aout_backend_info (input_bfd)->link_dynamic_object != NULL)
     return ((*aout_backend_info (input_bfd)->link_dynamic_object)
-           (finfo->info, input_bfd));
+           (flaginfo->info, input_bfd));
 
   /* Get the symbols.  We probably have them already, unless
-     finfo->info->keep_memory is FALSE.  */
+     flaginfo->info->keep_memory is FALSE.  */
   if (! aout_get_external_symbols (input_bfd))
     return FALSE;
 
-  sym_count = obj_aout_external_sym_count (input_bfd);
-
   /* Write out the symbols and get a map of the new indices.  The map
-     is placed into finfo->symbol_map.  */
-  if (! aout_link_write_symbols (finfo, input_bfd))
+     is placed into flaginfo->symbol_map.  */
+  if (! aout_link_write_symbols (flaginfo, input_bfd))
     return FALSE;
 
   /* Relocate and write out the sections.  These functions use the
@@ -3598,17 +3610,17 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
      link, which will normally be the case.  */
   if (obj_textsec (input_bfd)->linker_mark)
     {
-      if (! aout_link_input_section (finfo, input_bfd,
+      if (! aout_link_input_section (flaginfo, input_bfd,
                                     obj_textsec (input_bfd),
-                                    &finfo->treloff,
+                                    &flaginfo->treloff,
                                     exec_hdr (input_bfd)->a_trsize))
        return FALSE;
     }
   if (obj_datasec (input_bfd)->linker_mark)
     {
-      if (! aout_link_input_section (finfo, input_bfd,
+      if (! aout_link_input_section (flaginfo, input_bfd,
                                     obj_datasec (input_bfd),
-                                    &finfo->dreloff,
+                                    &flaginfo->dreloff,
                                     exec_hdr (input_bfd)->a_drsize))
        return FALSE;
     }
@@ -3616,7 +3628,7 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
   /* If we are not keeping memory, we don't need the symbols any
      longer.  We still need them if we are keeping memory, because the
      strings in the hash table point into them.  */
-  if (! finfo->info->keep_memory)
+  if (! flaginfo->info->keep_memory)
     {
       if (! aout_link_free_symbols (input_bfd))
        return FALSE;
@@ -3788,7 +3800,7 @@ NAME (aout, final_link) (bfd *abfd,
     h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC",
                               FALSE, FALSE, FALSE);
     if (h != NULL)
-      aout_link_write_other_symbol (h, &aout_info);
+      aout_link_write_other_symbol (&h->root.root, &aout_info);
   }
 
   /* The most time efficient way to do the link would be to read all
@@ -3860,9 +3872,9 @@ NAME (aout, final_link) (bfd *abfd,
     }
 
   /* Write out any symbols that we have not already written out.  */
-  aout_link_hash_traverse (aout_hash_table (info),
-                          aout_link_write_other_symbol,
-                          (void *) &aout_info);
+  bfd_hash_traverse (&info->hash->table,
+                    aout_link_write_other_symbol,
+                    &aout_info);
 
   /* Now handle any relocs we were asked to create by the linker.
      These did not come from any input file.  We must do these after
@@ -3970,7 +3982,7 @@ NAME (aout, final_link) (bfd *abfd,
    symbol indices into a symbol_map.  */
 
 static bfd_boolean
-aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
+aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd)
 {
   bfd *output_bfd;
   bfd_size_type sym_count;
@@ -3986,23 +3998,23 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
   bfd_boolean pass;
   bfd_boolean skip_next;
 
-  output_bfd = finfo->output_bfd;
+  output_bfd = flaginfo->output_bfd;
   sym_count = obj_aout_external_sym_count (input_bfd);
   strings = obj_aout_external_strings (input_bfd);
-  strip = finfo->info->strip;
-  discard = finfo->info->discard;
-  outsym = finfo->output_syms;
+  strip = flaginfo->info->strip;
+  discard = flaginfo->info->discard;
+  outsym = flaginfo->output_syms;
 
   /* First write out a symbol for this object file, unless we are
      discarding such symbols.  */
   if (strip != strip_all
       && (strip != strip_some
-         || bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename,
+         || bfd_hash_lookup (flaginfo->info->keep_hash, input_bfd->filename,
                              FALSE, FALSE) != NULL)
       && discard != discard_all)
     {
       H_PUT_8 (output_bfd, N_TEXT, outsym->e_type);
-      strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
+      strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
                                       input_bfd->filename, FALSE);
       if (strtab_index == (bfd_size_type) -1)
        return FALSE;
@@ -4021,7 +4033,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
   sym = obj_aout_external_syms (input_bfd);
   sym_end = sym + sym_count;
   sym_hash = obj_aout_sym_hashes (input_bfd);
-  symbol_map = finfo->symbol_map;
+  symbol_map = flaginfo->symbol_map;
   memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map);
   for (; sym < sym_end; sym++, sym_hash++, symbol_map++)
     {
@@ -4120,7 +4132,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
                skip = TRUE;
              break;
            case strip_some:
-             if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
+             if (bfd_hash_lookup (flaginfo->info->keep_hash, name, FALSE, FALSE)
                  == NULL)
                skip = TRUE;
              break;
@@ -4348,8 +4360,8 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
              /* If we have already included a header file with the
                  same value, then replace this one with an N_EXCL
                  symbol.  */
-             copy = ! finfo->info->keep_memory;
-             incl_entry = aout_link_includes_lookup (&finfo->includes,
+             copy = ! flaginfo->info->keep_memory;
+             incl_entry = aout_link_includes_lookup (&flaginfo->includes,
                                                      name, TRUE, copy);
              if (incl_entry == NULL)
                return FALSE;
@@ -4360,7 +4372,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
                {
                  /* This is the first time we have seen this header
                      file with this set of stabs strings.  */
-                 t = bfd_hash_allocate (&finfo->includes.root,
+                 t = bfd_hash_allocate (&flaginfo->includes.root,
                                         sizeof *t);
                  if (t == NULL)
                    return FALSE;
@@ -4407,7 +4419,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
         write out.  */
       H_PUT_8 (output_bfd, type, outsym->e_type);
       copy = FALSE;
-      if (! finfo->info->keep_memory)
+      if (! flaginfo->info->keep_memory)
        {
          /* name points into a string table which we are going to
             free.  If there is a hash table entry, use that string.
@@ -4417,7 +4429,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
          else
            copy = TRUE;
        }
-      strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
+      strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
                                       name, copy);
       if (strtab_index == (bfd_size_type) -1)
        return FALSE;
@@ -4429,17 +4441,17 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
     }
 
   /* Write out the output symbols we have just constructed.  */
-  if (outsym > finfo->output_syms)
+  if (outsym > flaginfo->output_syms)
     {
       bfd_size_type size;
 
-      if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0)
+      if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0)
        return FALSE;
-      size = outsym - finfo->output_syms;
+      size = outsym - flaginfo->output_syms;
       size *= EXTERNAL_NLIST_SIZE;
-      if (bfd_bwrite ((void *) finfo->output_syms, size, output_bfd) != size)
+      if (bfd_bwrite ((void *) flaginfo->output_syms, size, output_bfd) != size)
        return FALSE;
-      finfo->symoff += size;
+      flaginfo->symoff += size;
     }
 
   return TRUE;
@@ -4500,6 +4512,7 @@ const bfd_target MY (vec) =
   MY_symbol_leading_char,
   AR_PAD_CHAR,                 /* AR_pad_char.  */
   15,                          /* AR_max_namelen.  */
+  0,                           /* match priority.  */
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
      bfd_getp32, bfd_getp_signed_32, bfd_putp32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data.  */
This page took 0.044587 seconds and 4 git commands to generate.