*** empty log message ***
[deliverable/binutils-gdb.git] / bfd / pdp11.c
index e4096f32c6f2eac952f4eaba90ad951ef222bc10..5f4d28c6277e8dca542334a6a03a684695d8fc14 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for PDP-11 a.out binaries.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1569,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')
@@ -1581,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
@@ -2545,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;
@@ -2600,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;
@@ -2628,7 +2630,7 @@ aout_link_check_ar_symbols (bfd *abfd,
                         in the object file.  This is done for the -u
                         option in the linker.  */
                      if (! (*info->callbacks->add_archive_element)
-                         (info, abfd, name))
+                         (info, abfd, name, subsbfd))
                        return FALSE;
                      *pneeded = TRUE;
                      return TRUE;
@@ -2680,15 +2682,21 @@ aout_link_check_archive_element (bfd *abfd,
                                 struct bfd_link_info *info,
                                 bfd_boolean *pneeded)
 {
+  bfd *subsbfd = NULL;
+
   if (! aout_get_external_symbols (abfd))
     return FALSE;
 
-  if (! aout_link_check_ar_symbols (abfd, info, pneeded))
+  if (! aout_link_check_ar_symbols (abfd, info, pneeded, &subsbfd))
     return FALSE;
 
   if (*pneeded)
     {
-      if (! aout_link_add_symbols (abfd, info))
+      /* Potentially, the add_archive_element hook may have set a
+        substitute BFD for us.  */
+      if (subsbfd && ! aout_get_external_symbols (subsbfd))
+       return FALSE;
+      if (! aout_link_add_symbols (subsbfd ? subsbfd : abfd, info))
        return FALSE;
     }
 
@@ -3214,7 +3222,6 @@ 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;
 
@@ -3231,7 +3238,6 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
   sym_hashes = obj_aout_sym_hashes (input_bfd);
   symbol_map = finfo->symbol_map;
 
-  reloc_count = rel_size / RELOC_SIZE;
   rel = relocs;
   rel_end = rel + rel_size;
   for (; rel < rel_end; rel += RELOC_SIZE)
@@ -3568,8 +3574,6 @@ aout_link_input_section (struct aout_final_link_info *finfo,
 static bfd_boolean
 aout_link_input_bfd (struct aout_final_link_info *finfo, 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.  */
@@ -3583,8 +3587,6 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
   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))
This page took 0.027689 seconds and 4 git commands to generate.