2001-03-20 Michael Chastain <chastain@redhat.com>
[deliverable/binutils-gdb.git] / bfd / linker.c
index 947514c3fbdd86f5482dddad54d930d3e41450ae..fcfeb83412d4ee123fec1c8c0820c31b10213404 100644 (file)
@@ -1,5 +1,6 @@
 /* linker.c -- BFD linker routines
-   Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
    Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -59,7 +60,7 @@ SECTION
        a.out (in <<aoutx.h>>) and ECOFF (in <<ecoff.c>>).  The a.out
        routines are used as examples throughout this section.
 
-@menu  
+@menu
 @* Creating a Linker Hash Table::
 @* Adding Symbols to the Hash Table::
 @* Performing the Final Link::
@@ -74,7 +75,7 @@ SUBSECTION
 @cindex target vector (_bfd_link_hash_table_create)
        The linker routines must create a hash table, which must be
        derived from <<struct bfd_link_hash_table>> described in
-       <<bfdlink.c>>.  @xref{Hash Tables} for information on how to
+       <<bfdlink.c>>.  @xref{Hash Tables}, for information on how to
        create a derived hash table.  This entry point is called using
        the target vector of the linker output file.
 
@@ -600,7 +601,7 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
    struct bfd_link_hash_entry * with no explicit cast required on the
    call.  */
 
-void 
+void
 bfd_link_hash_traverse (table, func, info)
      struct bfd_link_hash_table *table;
      boolean (*func) PARAMS ((struct bfd_link_hash_entry *, PTR));
@@ -1360,7 +1361,7 @@ enum link_row
 
 enum link_action
 {
-  FAIL,                /* Abort. */
+  FAIL,                /* Abort.  */
   UND,         /* Mark symbol undefined.  */
   WEAK,                /* Mark symbol weak undefined.  */
   DEF,         /* Mark symbol defined.  */
@@ -1463,7 +1464,7 @@ hash_entry_bfd (h)
      or destructor names as collect2 does.
    HASHP, if not NULL, is a place to store the created hash table
      entry; if *HASHP is not NULL, the caller has already looked up
-     the hash table entry, and stored it in *HASHP. */
+     the hash table entry, and stored it in *HASHP.  */
 
 boolean
 _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
@@ -1748,8 +1749,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
        case MDEF:
          /* Handle a multiple definition.  */
          {
-           asection *msec;
-           bfd_vma mval;
+           asection *msec = NULL;
+           bfd_vma mval = 0;
 
            switch (h->type)
              {
@@ -2053,7 +2054,7 @@ _bfd_generic_final_link (abfd, info)
            }
        }
     }
-  
+
   return true;
 }
 
@@ -2451,7 +2452,7 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
   r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
   if (r == (arelent *) NULL)
     return false;
-      
+
   r->address = link_order->offset;
   r->howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
   if (r->howto == 0)
@@ -2523,7 +2524,9 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
          break;
        }
       ok = bfd_set_section_contents (abfd, sec, (PTR) buf,
-                                    (file_ptr) link_order->offset, size);
+                                    (file_ptr)
+                                     (link_order->offset *
+                                      bfd_octets_per_byte (abfd)), size);
       free (buf);
       if (! ok)
        return false;
@@ -2591,18 +2594,19 @@ _bfd_default_link_order (abfd, info, sec, link_order)
     case bfd_data_link_order:
       return bfd_set_section_contents (abfd, sec,
                                       (PTR) link_order->u.data.contents,
-                                      (file_ptr) link_order->offset,
+                                      (file_ptr)
+                                       (link_order->offset *
+                                        bfd_octets_per_byte (abfd)),
                                       link_order->size);
     }
 }
 
 /* Default routine to handle a bfd_fill_link_order.  */
 
-/*ARGSUSED*/
 static boolean
 default_fill_link_order (abfd, info, sec, link_order)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      asection *sec;
      struct bfd_link_order *link_order;
 {
@@ -2625,7 +2629,9 @@ default_fill_link_order (abfd, info, sec, link_order)
   for (i = 1; i < size; i += 2)
     space[i] = fill;
   result = bfd_set_section_contents (abfd, sec, space,
-                                    (file_ptr) link_order->offset,
+                                    (file_ptr)
+                                     (link_order->offset *
+                                      bfd_octets_per_byte (abfd)),
                                     link_order->size);
   free (space);
   return result;
@@ -2725,7 +2731,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
              if (h != NULL)
                set_symbol_from_hash (sym, h);
            }
-       }         
+       }
     }
 
   /* Get and relocate the section contents.  */
@@ -2742,7 +2748,10 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
   /* Output the section contents.  */
   if (! bfd_set_section_contents (output_bfd, output_section,
                                  (PTR) new_contents,
-                                 link_order->offset, link_order->size))
+                                 (file_ptr)
+                                  (link_order->offset *
+                                   bfd_octets_per_byte (output_bfd)),
+                                  link_order->size))
     goto error_return;
 
   if (contents != NULL)
@@ -2793,12 +2802,10 @@ DESCRIPTION
 
 */
 
-
-
 boolean
 _bfd_generic_link_split_section (abfd, sec)
-     bfd *abfd;
-     asection *sec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
 {
   return false;
 }
This page took 0.024946 seconds and 4 git commands to generate.