]> oss.titaniummirror.com Git - msp430-binutils.git/blobdiff - bfd/aoutx.h
Imported binutils-2.20
[msp430-binutils.git] / bfd / aoutx.h
index 1244510981f9e49c3c9dc7a54d3fb2357fa654a1..23fd5c407ba58bd6fdd802e7825905e56de4a7ed 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, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -464,7 +464,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
   const bfd_target *result;
   bfd_size_type amt = sizeof (* rawptr);
 
-  rawptr = bfd_zalloc (abfd, amt);
+  rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
   if (rawptr == NULL)
     return NULL;
 
@@ -679,7 +679,7 @@ NAME (aout, mkobject) (bfd *abfd)
 
   bfd_set_error (bfd_error_system_call);
 
-  rawptr = bfd_zalloc (abfd, amt);
+  rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
   if (rawptr == NULL)
     return FALSE;
 
@@ -786,6 +786,8 @@ NAME (aout, machine_type) (enum bfd_architecture arch,
        case bfd_mach_mips9000:
        case bfd_mach_mips10000:
        case bfd_mach_mips12000:
+       case bfd_mach_mips14000:
+       case bfd_mach_mips16000:
        case bfd_mach_mips16:
        case bfd_mach_mipsisa32:
        case bfd_mach_mipsisa32r2:
@@ -793,6 +795,7 @@ NAME (aout, machine_type) (enum bfd_architecture arch,
        case bfd_mach_mipsisa64:
        case bfd_mach_mipsisa64r2:
        case bfd_mach_mips_sb1:
+       case bfd_mach_mips_xlr:
          /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc.  */
          arch_flags = M_MIPS2;
          break;
@@ -1291,9 +1294,10 @@ aout_get_external_symbols (bfd *abfd)
     {
       bfd_size_type count;
       struct external_nlist *syms;
-      bfd_size_type amt;
 
       count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
+      if (count == 0)
+       return TRUE;            /* Nothing to do.  */
 
 #ifdef USE_MMAP
       if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
@@ -1305,17 +1309,20 @@ aout_get_external_symbols (bfd *abfd)
       /* We allocate using malloc to make the values easy to free
         later on.  If we put them on the objalloc it might not be
         possible to free them.  */
-      syms = bfd_malloc (count * EXTERNAL_NLIST_SIZE);
-      if (syms == NULL && count != 0)
+      syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE);
+      if (syms == NULL)
        return FALSE;
 
-      amt = exec_hdr (abfd)->a_syms;
-      if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
-         || bfd_bread (syms, amt, abfd) != amt)
-       {
-         free (syms);
-         return FALSE;
-       }
+      {
+       bfd_size_type amt;
+       amt = exec_hdr (abfd)->a_syms;
+       if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
+           || bfd_bread (syms, amt, abfd) != amt)
+         {
+           free (syms);
+           return FALSE;
+         }
+      }
 #endif
 
       obj_aout_external_syms (abfd) = syms;
@@ -1342,7 +1349,7 @@ aout_get_external_symbols (bfd *abfd)
        return FALSE;
       strings = (char *) obj_aout_string_window (abfd).data;
 #else
-      strings = bfd_malloc (stringsize + 1);
+      strings = (char *) bfd_malloc (stringsize + 1);
       if (strings == NULL)
        return FALSE;
 
@@ -1661,12 +1668,12 @@ NAME (aout, make_empty_symbol) (bfd *abfd)
 {
   bfd_size_type amt = sizeof (aout_symbol_type);
 
-  aout_symbol_type *new = bfd_zalloc (abfd, amt);
-  if (!new)
+  aout_symbol_type *new_symbol = (aout_symbol_type *) bfd_zalloc (abfd, amt);
+  if (!new_symbol)
     return NULL;
-  new->symbol.the_bfd = abfd;
+  new_symbol->symbol.the_bfd = abfd;
 
-  return &new->symbol;
+  return &new_symbol->symbol;
 }
 
 /* Translate a set of internal symbols into external symbols.  */
@@ -1743,7 +1750,7 @@ NAME (aout, slurp_symbol_table) (bfd *abfd)
     return TRUE;               /* Nothing to do.  */
 
   cached_size *= sizeof (aout_symbol_type);
-  cached = bfd_zmalloc (cached_size);
+  cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
   if (cached == NULL)
     return FALSE;
 
@@ -2304,7 +2311,7 @@ NAME (aout, slurp_reloc_table) (bfd *abfd, sec_ptr asect, asymbol **symbols)
     return TRUE;               /* Nothing to be done.  */
 
   amt = count * sizeof (arelent);
-  reloc_cache = bfd_zmalloc (amt);
+  reloc_cache = (arelent *) bfd_zmalloc (amt);
   if (reloc_cache == NULL)
     return FALSE;
 
@@ -2365,7 +2372,7 @@ NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section)
 
   each_size = obj_reloc_entry_size (abfd);
   natsize = (bfd_size_type) each_size * count;
-  native = bfd_zalloc (abfd, natsize);
+  native = (unsigned char *) bfd_zalloc (abfd, natsize);
   if (!native)
     return FALSE;
 
@@ -2779,7 +2786,7 @@ NAME (aout, find_nearest_line) (bfd *abfd,
     adata (abfd).line_buf = buf = NULL;
   else
     {
-      buf = bfd_malloc (filelen + funclen + 3);
+      buf = (char *) bfd_malloc (filelen + funclen + 3);
       adata (abfd).line_buf = buf;
       if (buf == NULL)
        return FALSE;
@@ -2873,7 +2880,8 @@ NAME (aout, link_hash_newfunc) (struct bfd_hash_entry *entry,
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (ret == NULL)
-    ret = bfd_hash_allocate (table, sizeof (* ret));
+    ret = (struct aout_link_hash_entry *) bfd_hash_allocate (table,
+                                                             sizeof (* ret));
   if (ret == NULL)
     return NULL;
 
@@ -2912,7 +2920,7 @@ NAME (aout, link_hash_table_create) (bfd *abfd)
   struct aout_link_hash_table *ret;
   bfd_size_type amt = sizeof (* ret);
 
-  ret = bfd_malloc (amt);
+  ret = (struct aout_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -2967,7 +2975,7 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
      table, but keeping the list is more efficient.  Perhaps this
      should be conditional on info->keep_memory.  */
   amt = sym_count * sizeof (struct aout_link_hash_entry *);
-  sym_hash = bfd_alloc (abfd, amt);
+  sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt);
   if (sym_hash == NULL)
     return FALSE;
   obj_aout_sym_hashes (abfd) = sym_hash;
@@ -3331,8 +3339,9 @@ aout_link_check_ar_symbols (bfd *abfd,
                  /* Turn the current link symbol into a common
                     symbol.  It is already on the undefs list.  */
                  h->type = bfd_link_hash_common;
-                 h->u.c.p = bfd_hash_allocate (&info->hash->table,
-                                               sizeof (struct bfd_link_hash_common_entry));
+                 h->u.c.p = (struct bfd_link_hash_common_entry *)
+                      bfd_hash_allocate (&info->hash->table,
+                                         sizeof (struct bfd_link_hash_common_entry));
                  if (h->u.c.p == NULL)
                    return FALSE;
 
@@ -3502,7 +3511,8 @@ aout_link_includes_newfunc (struct bfd_hash_entry *entry,
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (ret == NULL)
-    ret = bfd_hash_allocate (table, sizeof (* ret));
+    ret = (struct aout_link_includes_entry *)
+        bfd_hash_allocate (table, sizeof (* ret));
   if (ret == NULL)
     return NULL;
 
@@ -3779,7 +3789,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
          bfd_boolean ok;
 
          size = bfd_get_reloc_size (howto);
-         buf = bfd_zmalloc (size);
+         buf = (bfd_byte *) bfd_zmalloc (size);
          if (buf == NULL)
            return FALSE;
          r = MY_relocate_contents (howto, finfo->output_bfd,
@@ -5129,7 +5139,8 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
                {
                  /* This is the first time we have seen this header
                      file with this set of stabs strings.  */
-                 t = bfd_hash_allocate (&finfo->includes.root,
+                 t = (struct aout_link_includes_totals *)
+                      bfd_hash_allocate (&finfo->includes.root,
                                         sizeof *t);
                  if (t == NULL)
                    return FALSE;
@@ -5420,11 +5431,11 @@ NAME (aout, final_link) (bfd *abfd,
     goto error_return;
 
   /* Allocate buffers to hold section contents and relocs.  */
-  aout_info.contents = bfd_malloc (max_contents_size);
+  aout_info.contents = (bfd_byte *) bfd_malloc (max_contents_size);
   aout_info.relocs = bfd_malloc (max_relocs_size);
-  aout_info.symbol_map = bfd_malloc (max_sym_count * sizeof (int *));
-  aout_info.output_syms = bfd_malloc ((max_sym_count + 1)
-                                     * sizeof (struct external_nlist));
+  aout_info.symbol_map = (int *) bfd_malloc (max_sym_count * sizeof (int *));
+  aout_info.output_syms = (struct external_nlist *)
+      bfd_malloc ((max_sym_count + 1) * sizeof (struct external_nlist));
   if ((aout_info.contents == NULL && max_contents_size != 0)
       || (aout_info.relocs == NULL && max_relocs_size != 0)
       || (aout_info.symbol_map == NULL && max_sym_count != 0)