Replace bfd_alloc/bfd_malloc + memset with bfd_zalloc/bfd_zmalloc
[deliverable/binutils-gdb.git] / bfd / ecoff.c
index 4e0e9533b90f8de027fbffa031bca556d2d5565e..56165a48cf82342e2c9ec3ded6881a786052cc23 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic ECOFF (Extended-COFF) routines.
-   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -661,10 +661,9 @@ _bfd_ecoff_make_empty_symbol (abfd)
   ecoff_symbol_type *new;
   bfd_size_type amt = sizeof (ecoff_symbol_type);
 
-  new = (ecoff_symbol_type *) bfd_alloc (abfd, amt);
+  new = (ecoff_symbol_type *) bfd_zalloc (abfd, amt);
   if (new == (ecoff_symbol_type *) NULL)
     return (asymbol *) NULL;
-  memset ((PTR) new, 0, sizeof *new);
   new->symbol.section = (asection *) NULL;
   new->fdr = (FDR *) NULL;
   new->local = false;
@@ -3452,7 +3451,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
   struct ecoff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct ecoff_link_hash_table);
 
-  ret = (struct ecoff_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct ecoff_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
   if (! _bfd_link_hash_table_init (&ret->root, abfd,
@@ -4393,6 +4392,13 @@ ecoff_link_write_external (h, data)
   bfd *output_bfd = einfo->abfd;
   boolean strip;
 
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct ecoff_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+       return true;
+    }
+
   /* We need to check if this symbol is being stripped.  */
   if (h->root.type == bfd_link_hash_undefined
       || h->root.type == bfd_link_hash_undefweak)
@@ -4474,6 +4480,7 @@ ecoff_link_write_external (h, data)
   switch (h->root.type)
     {
     default:
+    case bfd_link_hash_warning:
     case bfd_link_hash_new:
       abort ();
     case bfd_link_hash_undefined:
@@ -4502,9 +4509,8 @@ ecoff_link_write_external (h, data)
       h->esym.asym.value = h->root.u.c.size;
       break;
     case bfd_link_hash_indirect:
-    case bfd_link_hash_warning:
-      /* FIXME: Ignore these for now.  The circumstances under which
-        they should be written out are not clear to me.  */
+      /* We ignore these symbols, since the indirected symbol is
+        already in the hash table.  */
       return true;
     }
 
@@ -4758,7 +4764,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
 
   rel.addend = 0;
 
-  /* Move the information into a internal_reloc structure.  */
+  /* Move the information into an internal_reloc structure.  */
   in.r_vaddr = (rel.address
                + bfd_get_section_vma (output_bfd, output_section));
   in.r_type = rel.howto->type;
This page took 0.029124 seconds and 4 git commands to generate.