daily update
[binutils-gdb.git] / bfd / aoutx.h
index 0a3c05ad6e55e90598de85d46bc646e784fc786b..995db426a670d45e68778c657499a99edef59cb5 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD semi-generic back-end for a.out binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-   2001
+   2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -1310,9 +1310,9 @@ aout_get_external_symbols (abfd)
       count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
 
 #ifdef USE_MMAP
-      if (bfd_get_file_window (abfd,
-                              obj_sym_filepos (abfd), exec_hdr (abfd)->a_syms,
-                              &obj_aout_sym_window (abfd), true) == false)
+      if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
+                                exec_hdr (abfd)->a_syms,
+                                &obj_aout_sym_window (abfd), true))
        return false;
       syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
 #else
@@ -1352,8 +1352,8 @@ aout_get_external_symbols (abfd)
       stringsize = GET_WORD (abfd, string_chars);
 
 #ifdef USE_MMAP
-      if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
-                              &obj_aout_string_window (abfd), true) == false)
+      if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
+                                &obj_aout_string_window (abfd), true))
        return false;
       strings = (char *) obj_aout_string_window (abfd).data;
 #else
@@ -1837,11 +1837,9 @@ NAME(aout,slurp_symbol_table) (abfd)
 
   cached_size = obj_aout_external_sym_count (abfd);
   cached_size *= sizeof (aout_symbol_type);
-  cached = (aout_symbol_type *) bfd_malloc (cached_size);
+  cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
   if (cached == NULL && cached_size != 0)
     return false;
-  if (cached_size != 0)
-    memset (cached, 0, (size_t) cached_size);
 
   /* Convert from external symbol information to internal.  */
   if (! (NAME(aout,translate_symbol_table)
@@ -2411,10 +2409,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
   count = reloc_size / each_size;
 
   amt = count * sizeof (arelent);
-  reloc_cache = (arelent *) bfd_malloc (amt);
+  reloc_cache = (arelent *) bfd_zmalloc (amt);
   if (reloc_cache == NULL && count != 0)
     return false;
-  memset (reloc_cache, 0, (size_t) amt);
 
   relocs = bfd_malloc (reloc_size);
   if (relocs == NULL && reloc_size != 0)
@@ -4577,6 +4574,13 @@ aout_link_write_other_symbol (h, data)
   bfd_size_type indx;
   bfd_size_type amt;
 
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct aout_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+       return true;
+    }
+
   output_bfd = finfo->output_bfd;
 
   if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL)
@@ -4605,6 +4609,7 @@ aout_link_write_other_symbol (h, data)
   switch (h->root.type)
     {
     default:
+    case bfd_link_hash_warning:
       abort ();
       /* Avoid variable not initialized warnings.  */
       return true;
@@ -4646,9 +4651,8 @@ aout_link_write_other_symbol (h, data)
       type = N_WEAKU;
       val = 0;
     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;
     }