ld/
[deliverable/binutils-gdb.git] / bfd / coff-h8300.c
index 0137049d06aea2adb35ea6df2670fdeecc15025d..1a9c4a70ad8302e09962d2266672bcbbe42c84f7 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for Renesas H8/300 COFF binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005
+   2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Written by Steve Chamberlain, <sac@cygnus.com>.
 
@@ -18,7 +18,7 @@
 
    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., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -63,13 +63,6 @@ static struct bfd_hash_entry *
 funcvec_hash_newfunc
   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
 
-static bfd_boolean
-funcvec_hash_table_init
-  (struct funcvec_hash_table *, bfd *,
-   struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
-                              struct bfd_hash_table *,
-                              const char *));
-
 static bfd_reloc_status_type special
   (bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **);
 static int select_reloc
@@ -181,13 +174,14 @@ funcvec_hash_table_init (struct funcvec_hash_table *table,
                         struct bfd_hash_entry *(*newfunc)
                           (struct bfd_hash_entry *,
                            struct bfd_hash_table *,
-                           const char *))
+                           const char *),
+                        unsigned int entsize)
 {
   /* Initialize our local fields, then call the generic initialization
      routine.  */
   table->offset = 0;
   table->abfd = abfd;
-  return (bfd_hash_table_init (&table->root, newfunc));
+  return (bfd_hash_table_init (&table->root, newfunc, entsize));
 }
 
 /* Create the derived linker hash table.  We use a derived hash table
@@ -204,7 +198,8 @@ h8300_coff_link_hash_table_create (bfd *abfd)
   if (ret == NULL)
     return NULL;
   if (!_bfd_link_hash_table_init (&ret->root.root, abfd,
-                                 _bfd_generic_link_hash_newfunc))
+                                 _bfd_generic_link_hash_newfunc,
+                                 sizeof (struct generic_link_hash_entry)))
     {
       free (ret);
       return NULL;
@@ -671,7 +666,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
       /* Get the address of the target of this branch.  */
       value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
-      dot = (link_order->offset
+      dot = (input_section->output_offset
             + dst_address
             + link_order->u.indirect.section->output_section->vma);
 
@@ -703,7 +698,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
       value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* Get the address of the instruction (not the reloc).  */
-      dot = (link_order->offset
+      dot = (input_section->output_offset
             + dst_address
             + link_order->u.indirect.section->output_section->vma + 1);
 
@@ -817,7 +812,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
       value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* Get the address of the next instruction.  */
-      dot = (link_order->offset
+      dot = (input_section->output_offset
             + dst_address
             + link_order->u.indirect.section->output_section->vma + 1);
 
@@ -864,7 +859,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
       value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* Get the address of the instruction (not the reloc).  */
-      dot = (link_order->offset
+      dot = (input_section->output_offset
             + dst_address
             + link_order->u.indirect.section->output_section->vma - 1);
 
@@ -925,7 +920,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
       value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* Get the address of the instruction (not the reloc).  */
-      dot = (link_order->offset
+      dot = (input_section->output_offset
             + dst_address
             + link_order->u.indirect.section->output_section->vma + 2);
 
@@ -1064,7 +1059,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
       /* Get the address of the target of this branch.  */
       value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
-      dot = (link_order->offset
+      dot = (input_section->output_offset
             + dst_address
             + link_order->u.indirect.section->output_section->vma) + 1;
 
@@ -1281,12 +1276,12 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
       /* Make sure the appropriate flags are set, including SEC_IN_MEMORY.  */
       flags = (SEC_ALLOC | SEC_LOAD
               | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY);
-      htab->vectors_sec = bfd_make_section (abfd, ".vectors");
+      htab->vectors_sec = bfd_make_section_with_flags (abfd, ".vectors",
+                                                      flags);
 
       /* If the section wasn't created, or we couldn't set the flags,
         quit quickly now, rather than dying a painful death later.  */
-      if (!htab->vectors_sec
-         || !bfd_set_section_flags (abfd, htab->vectors_sec, flags))
+      if (!htab->vectors_sec)
        return FALSE;
 
       /* Also create the vector hash table.  */
@@ -1298,7 +1293,8 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
 
       /* And initialize the funcvec hash table.  */
       if (!funcvec_hash_table_init (funcvec_hash_table, abfd,
-                                   funcvec_hash_newfunc))
+                                   funcvec_hash_newfunc,
+                                   sizeof (struct funcvec_hash_entry)))
        {
          bfd_release (abfd, funcvec_hash_table);
          return FALSE;
This page took 0.026304 seconds and 4 git commands to generate.