daily update
[deliverable/binutils-gdb.git] / bfd / pdp11.c
index 83029c46d04721d594d7efec7d033b09e39bd351..ed2bec1e7db99a5bc86135aff47ab1073cffbf74 100644 (file)
@@ -1,11 +1,12 @@
 /* BFD back-end for PDP-11 a.out binaries.
-   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   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,
@@ -15,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.
 
@@ -69,6 +72,7 @@
                  && ((x).a_info != A_MAGIC5) \
                  && ((x).a_info != A_MAGIC6))
 
+#include "sysdep.h"
 #include "bfd.h"
 
 #define external_exec pdp11_external_exec
@@ -122,7 +126,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"
 
@@ -276,6 +279,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)
 {
@@ -1110,32 +1129,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
@@ -2375,7 +2389,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;
 }
@@ -2446,9 +2461,10 @@ NAME (aout, link_hash_table_init) (struct aout_link_hash_table *table,
                                   bfd *abfd,
                                   struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
                                                                     struct bfd_hash_table *,
-                                                                    const char *))
+                                                                    const char *),
+                                  unsigned int entsize)
 {
-  return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
+  return _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
 }
 
 /* Create an a.out link hash table.  */
@@ -2463,7 +2479,8 @@ NAME (aout, link_hash_table_create) (bfd *abfd)
   if (ret == NULL)
     return NULL;
   if (! NAME (aout, link_hash_table_init) (ret, abfd,
-                                          NAME (aout, link_hash_newfunc)))
+                                          NAME (aout, link_hash_newfunc),
+                                          sizeof (struct aout_link_hash_entry)))
     {
       free (ret);
       return NULL;
@@ -3657,9 +3674,10 @@ NAME (aout, final_link) (bfd *abfd,
   aout_info.symbol_map = NULL;
   aout_info.output_syms = NULL;
 
-  if (! bfd_hash_table_init_n (&aout_info.includes.root,
-                              aout_link_includes_newfunc,
-                              251))
+  if (!bfd_hash_table_init_n (&aout_info.includes.root,
+                             aout_link_includes_newfunc,
+                             sizeof (struct aout_link_includes_entry),
+                             251))
     goto error_return;
   includes_hash_initialized = TRUE;
 
This page took 0.029426 seconds and 4 git commands to generate.