This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to make bfd compile with -Wc++-compat


The following patch makes bfd compile cleanly with -Wc++-compat. It
adds a lot of casts, and fixes a couple of naming issues.

Build with tested with x86_64-linux and arm-eabi without any new errors.

Thanks,
Martin
? cvs.diff
? sid/component/cfgroot/libltdl/config-h.in]
Index: bfd/aoutx.h
===================================================================
RCS file: /cvs/src/src/bfd/aoutx.h,v
retrieving revision 1.77
diff -u -u -p -r1.77 aoutx.h
--- bfd/aoutx.h	2 Sep 2009 07:18:35 -0000	1.77
+++ bfd/aoutx.h	7 Sep 2009 22:53:10 -0000
@@ -464,7 +464,7 @@ NAME (aout, some_aout_object_p) (bfd *ab
   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;
 
@@ -1309,7 +1309,7 @@ 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);
+      syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE);
       if (syms == NULL)
 	return FALSE;
 
@@ -1349,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;
 
@@ -1750,7 +1750,7 @@ NAME (aout, slurp_symbol_table) (bfd *ab
     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;
 
@@ -2311,7 +2311,7 @@ NAME (aout, slurp_reloc_table) (bfd *abf
     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;
 
@@ -2372,7 +2372,7 @@ NAME (aout, squirt_out_relocs) (bfd *abf
 
   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;
 
@@ -2786,7 +2786,7 @@ NAME (aout, find_nearest_line) (bfd *abf
     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;
@@ -2880,7 +2880,8 @@ NAME (aout, link_hash_newfunc) (struct b
   /* 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;
 
@@ -2919,7 +2920,7 @@ NAME (aout, link_hash_table_create) (bfd
   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;
 
@@ -2974,7 +2975,7 @@ aout_link_add_symbols (bfd *abfd, struct
      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;
@@ -3338,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;
 
@@ -3509,7 +3511,8 @@ aout_link_includes_newfunc (struct bfd_h
   /* 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;
 
@@ -3786,7 +3789,7 @@ aout_link_reloc_link_order (struct aout_
 	  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,
@@ -5136,7 +5139,8 @@ aout_link_write_symbols (struct aout_fin
 		{
 		  /* 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;
@@ -5427,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)
Index: bfd/archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.58
diff -u -u -p -r1.58 archive.c
--- bfd/archive.c	2 Sep 2009 07:18:35 -0000	1.58
+++ bfd/archive.c	7 Sep 2009 22:53:10 -0000
@@ -181,7 +181,7 @@ _bfd_generic_mkarchive (bfd *abfd)
 {
   bfd_size_type amt = sizeof (struct artdata);
 
-  abfd->tdata.aout_ar_data = bfd_zalloc (abfd, amt);
+  abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
   if (bfd_ardata (abfd) == NULL)
     return FALSE;
 
@@ -319,7 +319,7 @@ _bfd_add_bfd_to_archive_cache (bfd *arch
     }
 
   /* Insert new_elt into the hash table by filepos.  */
-  cache = bfd_zalloc (arch_bfd, sizeof (struct ar_cache));
+  cache = (struct ar_cache *) bfd_zalloc (arch_bfd, sizeof (struct ar_cache));
   cache->ptr = filepos;
   cache->arbfd = new_elt;
   *htab_find_slot (hash_table, (const void *) cache, INSERT) = cache;
@@ -462,7 +462,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd,
       allocsize += namelen + 1;
       parsed_size -= namelen;
 
-      allocptr = bfd_zalloc (abfd, allocsize);
+      allocptr = (char *) bfd_zalloc (abfd, allocsize);
       if (allocptr == NULL)
 	return NULL;
       filename = (allocptr
@@ -483,12 +483,12 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd,
 	 spaces, so only look for ' ' if we don't find '/'.  */
 
       char *e;
-      e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
+      e = (char *) memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
       if (e == NULL)
 	{
-	  e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
+	  e = (char *) memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
 	  if (e == NULL)
-	    e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
+	    e = (char *) memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
 	}
 
       if (e != NULL)
@@ -505,7 +505,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd,
 
   if (!allocptr)
     {
-      allocptr = bfd_zalloc (abfd, allocsize);
+      allocptr = (char *) bfd_zalloc (abfd, allocsize);
       if (allocptr == NULL)
 	return NULL;
     }
@@ -546,7 +546,7 @@ append_relative_path (bfd *arch, char *e
     return elt_name;
 
   prefix_len = base_name - arch_name;
-  filename = bfd_alloc (arch, prefix_len + strlen (elt_name) + 1);
+  filename = (char *) bfd_alloc (arch, prefix_len + strlen (elt_name) + 1);
   if (filename == NULL)
     return NULL;
 
@@ -579,7 +579,7 @@ _bfd_get_elt_at_filepos (bfd *archive, f
   if (0 > bfd_seek (archive, filepos, SEEK_SET))
     return NULL;
 
-  if ((new_areldata = _bfd_read_ar_hdr (archive)) == NULL)
+  if ((new_areldata = (struct areltdata *) _bfd_read_ar_hdr (archive)) == NULL)
     return NULL;
 
   filename = new_areldata->filename;
@@ -745,7 +745,7 @@ bfd_generic_archive_p (bfd *abfd)
   tdata_hold = bfd_ardata (abfd);
 
   amt = sizeof (struct artdata);
-  bfd_ardata (abfd) = bfd_zalloc (abfd, amt);
+  bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
   if (bfd_ardata (abfd) == NULL)
     {
       bfd_ardata (abfd) = tdata_hold;
@@ -835,13 +835,13 @@ do_slurp_bsd_armap (bfd *abfd)
   bfd_size_type parsed_size, amt;
   carsym *set;
 
-  mapdata = _bfd_read_ar_hdr (abfd);
+  mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
   bfd_release (abfd, mapdata);	/* Don't need it any more.  */
 
-  raw_armap = bfd_zalloc (abfd, parsed_size);
+  raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
   if (raw_armap == NULL)
     return FALSE;
 
@@ -870,7 +870,7 @@ do_slurp_bsd_armap (bfd *abfd)
 		+ ardata->symdef_count * BSD_SYMDEF_SIZE
 		+ BSD_STRING_COUNT_SIZE);
   amt = ardata->symdef_count * sizeof (carsym);
-  ardata->symdefs = bfd_alloc (abfd, amt);
+  ardata->symdefs = (struct carsym *) bfd_alloc (abfd, amt);
   if (!ardata->symdefs)
     return FALSE;
 
@@ -911,7 +911,7 @@ do_slurp_coff_armap (bfd *abfd)
   bfd_size_type carsym_size, ptrsize;
   unsigned int i;
 
-  mapdata = _bfd_read_ar_hdr (abfd);
+  mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
@@ -956,14 +956,15 @@ do_slurp_coff_armap (bfd *abfd)
   if (carsym_size + stringsize + 1 <= carsym_size)
     return FALSE;
 
-  ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1);
+  ardata->symdefs = (struct carsym *) bfd_zalloc (abfd,
+                                                  carsym_size + stringsize + 1);
   if (ardata->symdefs == NULL)
     return FALSE;
   carsyms = ardata->symdefs;
   stringbase = ((char *) ardata->symdefs) + carsym_size;
 
   /* Allocate and read in the raw offsets.  */
-  raw_armap = bfd_alloc (abfd, ptrsize);
+  raw_armap = (int *) bfd_alloc (abfd, ptrsize);
   if (raw_armap == NULL)
     goto release_symdefs;
   if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
@@ -998,7 +999,7 @@ do_slurp_coff_armap (bfd *abfd)
     struct areltdata *tmp;
 
     bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
-    tmp = _bfd_read_ar_hdr (abfd);
+    tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
     if (tmp != NULL)
       {
 	if (tmp->arch_header[0] == '/'
@@ -1098,12 +1099,12 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
       return TRUE;
     }
 
-  mapdata = _bfd_read_ar_hdr (abfd);
+  mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
   if (mapdata == NULL)
     return FALSE;
 
   amt = mapdata->parsed_size;
-  raw_armap = bfd_zalloc (abfd, amt);
+  raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt);
   if (raw_armap == NULL)
     {
     byebye:
@@ -1139,7 +1140,7 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
 		+ BSD_STRING_COUNT_SIZE);
   rbase = (bfd_byte *) stringbase + stringsize;
   amt = ardata->symdef_count * BSD_SYMDEF_SIZE;
-  ardata->symdefs = bfd_alloc (abfd, amt);
+  ardata->symdefs = (struct carsym *) bfd_alloc (abfd, amt);
   if (!ardata->symdefs)
     return FALSE;
 
@@ -1196,7 +1197,7 @@ _bfd_slurp_extended_name_table (bfd *abf
 	  return TRUE;
 	}
 
-      namedata = _bfd_read_ar_hdr (abfd);
+      namedata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
       if (namedata == NULL)
 	return FALSE;
 
@@ -1205,7 +1206,7 @@ _bfd_slurp_extended_name_table (bfd *abf
         goto byebye;
 
       bfd_ardata (abfd)->extended_names_size = amt;
-      bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt + 1);
+      bfd_ardata (abfd)->extended_names = (char *) bfd_zalloc (abfd, amt + 1);
       if (bfd_ardata (abfd)->extended_names == NULL)
 	{
 	byebye:
@@ -1355,7 +1356,7 @@ adjust_relative_path (const char * path,
       if (pathbuf != NULL)
 	free (pathbuf);
       pathbuf_len = 0;
-      pathbuf = bfd_malloc (len);
+      pathbuf = (char *) bfd_malloc (len);
       if (pathbuf == NULL)
 	return path;
       pathbuf_len = len;
@@ -1505,7 +1506,7 @@ _bfd_construct_extended_name_table (bfd 
   if (total_namelen == 0)
     return TRUE;
 
-  *tabloc = bfd_zalloc (abfd, total_namelen);
+  *tabloc = (char *) bfd_zalloc (abfd, total_namelen);
   if (*tabloc == NULL)
     return FALSE;
 
@@ -1639,7 +1640,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, c
   if (member && (member->flags & BFD_IN_MEMORY) != 0)
     {
       /* Assume we just "made" the member, and fake it.  */
-      struct bfd_in_memory *bim = member->iostream;
+      struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
       time (&status.st_mtime);
       status.st_uid = getuid ();
       status.st_gid = getgid ();
@@ -1663,7 +1664,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, c
     }
 
   amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
-  ared = bfd_zalloc (abfd, amt);
+  ared = (struct areltdata *) bfd_zalloc (abfd, amt);
   if (ared == NULL)
     return NULL;
   hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
@@ -2088,13 +2089,13 @@ _bfd_compute_and_write_armap (bfd *arch,
   elength += elength % 2;
 
   amt = orl_max * sizeof (struct orl);
-  map = bfd_malloc (amt);
+  map = (struct orl *) bfd_malloc (amt);
   if (map == NULL)
     goto error_return;
 
   /* We put the symbol names on the arch objalloc, and then discard
      them when done.  */
-  first_name = bfd_alloc (arch, 1);
+  first_name = (char *) bfd_alloc (arch, 1);
   if (first_name == NULL)
     goto error_return;
 
@@ -2126,7 +2127,7 @@ _bfd_compute_and_write_armap (bfd *arch,
 		  if (syms_max > 0)
 		    free (syms);
 		  syms_max = storage;
-		  syms = bfd_malloc (syms_max);
+		  syms = (asymbol **) bfd_malloc (syms_max);
 		  if (syms == NULL)
 		    goto error_return;
 		}
@@ -2155,7 +2156,7 @@ _bfd_compute_and_write_armap (bfd *arch,
 			{
 			  orl_max *= 2;
 			  amt = orl_max * sizeof (struct orl);
-			  new_map = bfd_realloc (map, amt);
+			  new_map = (struct orl *) bfd_realloc (map, amt);
 			  if (new_map == NULL)
 			    goto error_return;
 
@@ -2164,10 +2165,11 @@ _bfd_compute_and_write_armap (bfd *arch,
 
 		      namelen = strlen (syms[src_count]->name);
 		      amt = sizeof (char *);
-		      map[orl_count].name = bfd_alloc (arch, amt);
+		      map[orl_count].name = (char **) bfd_alloc (arch, amt);
 		      if (map[orl_count].name == NULL)
 			goto error_return;
-		      *(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
+		      *(map[orl_count].name) = (char *) bfd_alloc (arch,
+                                                                   namelen + 1);
 		      if (*(map[orl_count].name) == NULL)
 			goto error_return;
 		      strcpy (*(map[orl_count].name), syms[src_count]->name);
Index: bfd/archive64.c
===================================================================
RCS file: /cvs/src/src/bfd/archive64.c,v
retrieving revision 1.11
diff -u -u -p -r1.11 archive64.c
--- bfd/archive64.c	2 Sep 2009 07:18:35 -0000	1.11
+++ bfd/archive64.c	7 Sep 2009 22:53:10 -0000
@@ -95,13 +95,13 @@ bfd_elf64_archive_slurp_armap (bfd *abfd
   ptrsize = 8 * nsymz;
 
   amt = carsym_size + stringsize + 1;
-  ardata->symdefs = bfd_zalloc (abfd, amt);
+  ardata->symdefs = (struct carsym *) bfd_zalloc (abfd, amt);
   if (ardata->symdefs == NULL)
     return FALSE;
   carsyms = ardata->symdefs;
   stringbase = ((char *) ardata->symdefs) + carsym_size;
 
-  raw_armap = bfd_alloc (abfd, ptrsize);
+  raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
   if (raw_armap == NULL)
     goto release_symdefs;
 
Index: bfd/archures.c
===================================================================
RCS file: /cvs/src/src/bfd/archures.c,v
retrieving revision 1.143
diff -u -u -p -r1.143 archures.c
--- bfd/archures.c	6 Aug 2009 17:37:59 -0000	1.143
+++ bfd/archures.c	7 Sep 2009 22:53:10 -0000
@@ -691,7 +691,7 @@ bfd_arch_list (void)
     }
 
   amt = (vec_length + 1) * sizeof (char **);
-  name_list = bfd_malloc (amt);
+  name_list = (const char **) bfd_malloc (amt);
   if (name_list == NULL)
     return NULL;
 
Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.110
diff -u -u -p -r1.110 bfd.c
--- bfd/bfd.c	30 Aug 2009 05:46:27 -0000	1.110
+++ bfd/bfd.c	7 Sep 2009 22:53:10 -0000
@@ -1448,7 +1448,7 @@ bfd_record_phdr (bfd *abfd,
 
   amt = sizeof (struct elf_segment_map);
   amt += ((bfd_size_type) count - 1) * sizeof (asection *);
-  m = bfd_zalloc (abfd, amt);
+  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
   if (m == NULL)
     return FALSE;
 
@@ -1858,7 +1858,7 @@ bfd_demangle (bfd *abfd, const char *nam
   suf = strchr (name, '@');
   if (suf != NULL)
     {
-      alloc = bfd_malloc (suf - name + 1);
+      alloc = (char *) bfd_malloc (suf - name + 1);
       if (alloc == NULL)
 	return NULL;
       memcpy (alloc, name, suf - name);
@@ -1876,7 +1876,7 @@ bfd_demangle (bfd *abfd, const char *nam
       if (skip_lead)
 	{
 	  size_t len = strlen (pre) + 1;
-	  alloc = bfd_malloc (len);
+	  alloc = (char *) bfd_malloc (len);
 	  if (alloc == NULL)
 	    return NULL;
 	  memcpy (alloc, pre, len);
@@ -1896,7 +1896,7 @@ bfd_demangle (bfd *abfd, const char *nam
       if (suf == NULL)
 	suf = res + len;
       suf_len = strlen (suf) + 1;
-      final = bfd_malloc (pre_len + len + suf_len);
+      final = (char *) bfd_malloc (pre_len + len + suf_len);
       if (final != NULL)
 	{
 	  memcpy (final, pre, pre_len);
Index: bfd/bfdio.c
===================================================================
RCS file: /cvs/src/src/bfd/bfdio.c,v
retrieving revision 1.24
diff -u -u -p -r1.24 bfdio.c
--- bfd/bfdio.c	2 Sep 2009 07:18:35 -0000	1.24
+++ bfd/bfdio.c	7 Sep 2009 22:53:10 -0000
@@ -187,7 +187,7 @@ bfd_bread (void *ptr, bfd_size_type size
       struct bfd_in_memory *bim;
       bfd_size_type get;
 
-      bim = abfd->iostream;
+      bim = (struct bfd_in_memory *) abfd->iostream;
       get = size;
       if (abfd->where + get > bim->size)
 	{
@@ -219,7 +219,7 @@ bfd_bwrite (const void *ptr, bfd_size_ty
 
   if ((abfd->flags & BFD_IN_MEMORY) != 0)
     {
-      struct bfd_in_memory *bim = abfd->iostream;
+      struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
 
       size = (size_t) size;
       if (abfd->where + size > bim->size)
@@ -232,7 +232,8 @@ bfd_bwrite (const void *ptr, bfd_size_ty
 	  newsize = (bim->size + 127) & ~(bfd_size_type) 127;
 	  if (newsize > oldsize)
 	    {
-	      bim->buffer = bfd_realloc_or_free (bim->buffer, newsize);
+	      bim->buffer = (bfd_byte *) bfd_realloc_or_free (bim->buffer,
+                                                              newsize);
 	      if (bim->buffer == NULL)
 		{
 		  bim->size = 0;
@@ -338,7 +339,7 @@ bfd_seek (bfd *abfd, file_ptr position, 
     {
       struct bfd_in_memory *bim;
 
-      bim = abfd->iostream;
+      bim = (struct bfd_in_memory *) abfd->iostream;
 
       if (direction == SEEK_SET)
 	abfd->where = position;
@@ -358,7 +359,8 @@ bfd_seek (bfd *abfd, file_ptr position, 
 	      newsize = (bim->size + 127) & ~(bfd_size_type) 127;
 	      if (newsize > oldsize)
 	        {
-		  bim->buffer = bfd_realloc_or_free (bim->buffer, newsize);
+		  bim->buffer = (bfd_byte *) bfd_realloc_or_free (bim->buffer,
+                                                                  newsize);
 		  if (bim->buffer == NULL)
 		    {
 		      bim->size = 0;
Index: bfd/binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.36
diff -u -u -p -r1.36 binary.c
--- bfd/binary.c	2 Sep 2009 07:18:35 -0000	1.36
+++ bfd/binary.c	7 Sep 2009 22:53:10 -0000
@@ -143,7 +143,7 @@ mangle_name (bfd *abfd, char *suffix)
 	  + strlen (suffix)
 	  + sizeof "_binary__");
 
-  buf = bfd_alloc (abfd, size);
+  buf = (char *) bfd_alloc (abfd, size);
   if (buf == NULL)
     return "";
 
@@ -167,7 +167,7 @@ binary_canonicalize_symtab (bfd *abfd, a
   unsigned int i;
   bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
 
-  syms = bfd_alloc (abfd, amt);
+  syms = (asymbol *) bfd_alloc (abfd, amt);
   if (syms == NULL)
     return -1;
 
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.160
diff -u -u -p -r1.160 coffcode.h
--- bfd/coffcode.h	5 Sep 2009 16:38:48 -0000	1.160
+++ bfd/coffcode.h	7 Sep 2009 22:53:11 -0000
@@ -1071,7 +1071,7 @@ handle_COMDAT (bfd * abfd,
 
 		amt = sizeof (struct coff_comdat_info);
 		coff_section_data (abfd, section)->comdat
-		  = bfd_alloc (abfd, amt);
+		  = (struct coff_comdat_info *) bfd_alloc (abfd, amt);
 		if (coff_section_data (abfd, section)->comdat == NULL)
 		  abort ();
 
@@ -1079,7 +1079,7 @@ handle_COMDAT (bfd * abfd,
 		  (esym - esymstart) / bfd_coff_symesz (abfd);
 
 		amt = strlen (symname) + 1;
-		newname = bfd_alloc (abfd, amt);
+		newname = (char *) bfd_alloc (abfd, amt);
 		if (newname == NULL)
 		  abort ();
 
@@ -1714,7 +1714,7 @@ coff_new_section_hook (bfd * abfd, asect
      @@ The 10 is a guess at a plausible maximum number of aux entries
      (but shouldn't be a constant).  */
   amt = sizeof (combined_entry_type) * 10;
-  native = bfd_zalloc (abfd, amt);
+  native = (combined_entry_type *) bfd_zalloc (abfd, amt);
   if (native == NULL)
     return FALSE;
 
@@ -3207,7 +3207,7 @@ coff_compute_section_file_positions (bfd
 
     /* We allocate an extra cell to simplify the final loop.  */
     amt = sizeof (struct asection *) * (count + 1);
-    section_list = bfd_malloc (amt);
+    section_list = (asection **) bfd_malloc (amt);
     if (section_list == NULL)
       return FALSE;
 
@@ -4278,7 +4278,7 @@ coff_write_object_contents (bfd * abfd)
     char * buff;
     bfd_size_type amount = bfd_coff_filhsz (abfd);
 
-    buff = bfd_malloc (amount);
+    buff = (char *) bfd_malloc (amount);
     if (buff == NULL)
       return FALSE;
 
@@ -4298,7 +4298,7 @@ coff_write_object_contents (bfd * abfd)
       char * buff;
       bfd_size_type amount = bfd_coff_aoutsz (abfd);
 
-      buff = bfd_malloc (amount);
+      buff = (char *) bfd_malloc (amount);
       if (buff == NULL)
 	return FALSE;
 
@@ -4467,7 +4467,7 @@ coff_slurp_line_table (bfd *abfd, asecti
   BFD_ASSERT (asect->lineno == NULL);
 
   amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
-  lineno_cache = bfd_alloc (abfd, amt);
+  lineno_cache = (alent *) bfd_alloc (abfd, amt);
   if (lineno_cache == NULL)
     return FALSE;
 
@@ -4546,7 +4546,7 @@ coff_slurp_line_table (bfd *abfd, asecti
       alent *n_lineno_cache;
 
       /* Create a table of functions.  */
-      func_table = bfd_alloc (abfd, nbr_func * sizeof (alent *));
+      func_table = (alent **) bfd_alloc (abfd, nbr_func * sizeof (alent *));
       if (func_table != NULL)
 	{
 	  alent **p = func_table;
@@ -4561,7 +4561,7 @@ coff_slurp_line_table (bfd *abfd, asecti
 
 	  /* Create the new sorted table.  */
 	  amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
-	  n_lineno_cache = bfd_alloc (abfd, amt);
+	  n_lineno_cache = (alent *) bfd_alloc (abfd, amt);
 	  if (n_lineno_cache != NULL)
 	    {
 	      alent *n_cache_ptr = n_lineno_cache;
@@ -4615,13 +4615,13 @@ coff_slurp_symbol_table (bfd * abfd)
   /* Allocate enough room for all the symbols in cached form.  */
   amt = obj_raw_syment_count (abfd);
   amt *= sizeof (coff_symbol_type);
-  cached_area = bfd_alloc (abfd, amt);
+  cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
   if (cached_area == NULL)
     return FALSE;
 
   amt = obj_raw_syment_count (abfd);
   amt *= sizeof (unsigned int);
-  table_ptr = bfd_alloc (abfd, amt);
+  table_ptr = (unsigned int *) bfd_alloc (abfd, amt);
 
   if (table_ptr == NULL)
     return FALSE;
@@ -5113,7 +5113,7 @@ coff_slurp_reloc_table (bfd * abfd, sec_
   amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count;
   native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt);
   amt = (bfd_size_type) asect->reloc_count * sizeof (arelent);
-  reloc_cache = bfd_alloc (abfd, amt);
+  reloc_cache = (arelent *) bfd_alloc (abfd, amt);
 
   if (reloc_cache == NULL || native_relocs == NULL)
     return FALSE;
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.75
diff -u -u -p -r1.75 coffgen.c
--- bfd/coffgen.c	5 Sep 2009 07:56:21 -0000	1.75
+++ bfd/coffgen.c	7 Sep 2009 22:53:11 -0000
@@ -90,7 +90,8 @@ make_a_section_from_file (bfd *abfd,
              strindex does not run us past the end, but right now we
              don't know the length of the string table.  */
 	  strings += strindex;
-	  name = bfd_alloc (abfd, (bfd_size_type) strlen (strings) + 1);
+	  name = (char *) bfd_alloc (abfd,
+                                     (bfd_size_type) strlen (strings) + 1);
 	  if (name == NULL)
 	    return FALSE;
 	  strcpy (name, strings);
@@ -100,7 +101,8 @@ make_a_section_from_file (bfd *abfd,
   if (name == NULL)
     {
       /* Assorted wastage to null-terminate the name, thanks AT&T! */
-      name = bfd_alloc (abfd, (bfd_size_type) sizeof (hdr->s_name) + 1);
+      name = (char *) bfd_alloc (abfd,
+                                 (bfd_size_type) sizeof (hdr->s_name) + 1);
       if (name == NULL)
 	return FALSE;
       strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
@@ -195,7 +197,7 @@ coff_real_object_p (bfd *abfd,
 
   scnhsz = bfd_coff_scnhsz (abfd);
   readsize = (bfd_size_type) nscns * scnhsz;
-  external_sections = bfd_alloc (abfd, readsize);
+  external_sections = (char *) bfd_alloc (abfd, readsize);
   if (!external_sections)
     goto fail;
 
@@ -437,7 +439,7 @@ _bfd_coff_read_internal_relocs (bfd *abf
   amt = sec->reloc_count * relsz;
   if (external_relocs == NULL)
     {
-      free_external = bfd_malloc (amt);
+      free_external = (bfd_byte *) bfd_malloc (amt);
       if (free_external == NULL)
 	goto error_return;
       external_relocs = free_external;
@@ -451,7 +453,7 @@ _bfd_coff_read_internal_relocs (bfd *abf
     {
       amt = sec->reloc_count;
       amt *= sizeof (struct internal_reloc);
-      free_internal = bfd_malloc (amt);
+      free_internal = (struct internal_reloc *) bfd_malloc (amt);
       if (free_internal == NULL)
 	goto error_return;
       internal_relocs = free_internal;
@@ -651,7 +653,7 @@ coff_renumber_symbols (bfd *bfd_ptr, int
     bfd_size_type amt;
 
     amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
-    newsyms = bfd_alloc (bfd_ptr, amt);
+    newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
     if (!newsyms)
       return FALSE;
     bfd_ptr->outsymbols = newsyms;
@@ -912,7 +914,7 @@ coff_write_symbol (bfd *abfd,
 {
   unsigned int numaux = native->u.syment.n_numaux;
   int type = native->u.syment.n_type;
-  int n_sclass = native->u.syment.n_sclass;
+  int n_sclass = (int) native->u.syment.n_sclass;
   void * buf;
   bfd_size_type symesz;
 
@@ -1448,7 +1450,7 @@ build_debug_section (bfd *abfd)
     }
 
   sec_size = sect->size;
-  debug_section = bfd_alloc (abfd, sec_size);
+  debug_section = (char *) bfd_alloc (abfd, sec_size);
   if (debug_section == NULL)
     return NULL;
 
@@ -1478,7 +1480,7 @@ copy_name (bfd *abfd, char *name, size_t
     if (name[len] == '\0')
       break;
 
-  if ((newname = bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
+  if ((newname = (char *) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
     return NULL;
 
   strncpy (newname, name, len);
@@ -1573,7 +1575,7 @@ _bfd_coff_read_string_table (bfd *abfd)
       return NULL;
     }
 
-  strings = bfd_malloc (strsize);
+  strings = (char *) bfd_malloc (strsize);
   if (strings == NULL)
     return NULL;
 
@@ -1632,7 +1634,7 @@ coff_get_normalized_symtab (bfd *abfd)
     return obj_raw_syments (abfd);
 
   size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
-  internal = bfd_zalloc (abfd, size);
+  internal = (combined_entry_type *) bfd_zalloc (abfd, size);
   if (internal == NULL && size != 0)
     return NULL;
   internal_end = internal + obj_raw_syment_count (abfd);
@@ -1738,7 +1740,7 @@ coff_get_normalized_symtab (bfd *abfd)
 		if (internal_ptr->u.syment._n._n_name[i] == '\0')
 		  break;
 
-	      newstring = bfd_zalloc (abfd, (bfd_size_type) (i + 1));
+	      newstring = (char *) bfd_zalloc (abfd, (bfd_size_type) (i + 1));
 	      if (newstring == NULL)
 		return NULL;
 	      strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
@@ -2338,7 +2340,7 @@ bfd_coff_set_symbol_class (bfd *        
       combined_entry_type * native;
       bfd_size_type amt = sizeof (* native);
 
-      native = bfd_zalloc (abfd, amt);
+      native = (combined_entry_type *) bfd_zalloc (abfd, amt);
       if (native == NULL)
 	return FALSE;
 
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.70
diff -u -u -p -r1.70 cofflink.c
--- bfd/cofflink.c	5 Sep 2009 07:56:22 -0000	1.70
+++ bfd/cofflink.c	7 Sep 2009 22:53:11 -0000
@@ -110,7 +110,7 @@ _bfd_coff_link_hash_table_create (bfd *a
   struct coff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct coff_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = (struct coff_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -320,7 +320,7 @@ coff_link_add_symbols (bfd *abfd,
   /* We keep a list of the linker hash table entries that correspond
      to particular symbols.  */
   amt = symcount * sizeof (struct coff_link_hash_entry *);
-  sym_hash = bfd_zalloc (abfd, amt);
+  sym_hash = (struct coff_link_hash_entry **) bfd_zalloc (abfd, amt);
   if (sym_hash == NULL)
     goto error_return;
   obj_coff_sym_hashes (abfd) = sym_hash;
@@ -772,7 +772,7 @@ _bfd_coff_final_link (bfd *abfd,
          the target_index fields are 1 based.  */
       amt = abfd->section_count + 1;
       amt *= sizeof (struct coff_link_section_info);
-      finfo.section_info = bfd_malloc (amt);
+      finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
       if (finfo.section_info == NULL)
 	goto error_return;
       for (i = 0; i <= abfd->section_count; i++)
@@ -815,10 +815,12 @@ _bfd_coff_final_link (bfd *abfd,
 	  BFD_ASSERT (info->relocatable);
 	  amt = o->reloc_count;
 	  amt *= sizeof (struct internal_reloc);
-	  finfo.section_info[o->target_index].relocs = bfd_malloc (amt);
+	  finfo.section_info[o->target_index].relocs =
+              (struct internal_reloc *) bfd_malloc (amt);
 	  amt = o->reloc_count;
 	  amt *= sizeof (struct coff_link_hash_entry *);
-	  finfo.section_info[o->target_index].rel_hashes = bfd_malloc (amt);
+	  finfo.section_info[o->target_index].rel_hashes =
+              (struct coff_link_hash_entry **) bfd_malloc (amt);
 	  if (finfo.section_info[o->target_index].relocs == NULL
 	      || finfo.section_info[o->target_index].rel_hashes == NULL)
 	    goto error_return;
@@ -851,21 +853,21 @@ _bfd_coff_final_link (bfd *abfd,
 
   /* Allocate some buffers used while linking.  */
   amt = max_sym_count * sizeof (struct internal_syment);
-  finfo.internal_syms = bfd_malloc (amt);
+  finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
   amt = max_sym_count * sizeof (asection *);
-  finfo.sec_ptrs = bfd_malloc (amt);
+  finfo.sec_ptrs = (asection **) bfd_malloc (amt);
   amt = max_sym_count * sizeof (long);
-  finfo.sym_indices = bfd_malloc (amt);
-  finfo.outsyms = bfd_malloc ((max_sym_count + 1) * symesz);
+  finfo.sym_indices = (long int *) bfd_malloc (amt);
+  finfo.outsyms = (bfd_byte *) bfd_malloc ((max_sym_count + 1) * symesz);
   amt = max_lineno_count * bfd_coff_linesz (abfd);
-  finfo.linenos = bfd_malloc (amt);
-  finfo.contents = bfd_malloc (max_contents_size);
+  finfo.linenos = (bfd_byte *) bfd_malloc (amt);
+  finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
   amt = max_reloc_count * relsz;
-  finfo.external_relocs = bfd_malloc (amt);
+  finfo.external_relocs = (bfd_byte *) bfd_malloc (amt);
   if (! info->relocatable)
     {
       amt = max_reloc_count * sizeof (struct internal_reloc);
-      finfo.internal_relocs = bfd_malloc (amt);
+      finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
     }
   if ((finfo.internal_syms == NULL && max_sym_count > 0)
       || (finfo.sec_ptrs == NULL && max_sym_count > 0)
@@ -1015,7 +1017,7 @@ _bfd_coff_final_link (bfd *abfd,
 	 the symbol indices to use for relocs against them, and we can
 	 finally write out the relocs.  */
       amt = max_output_reloc_count * relsz;
-      external_relocs = bfd_malloc (amt);
+      external_relocs = (bfd_byte *) bfd_malloc (amt);
       if (external_relocs == NULL)
 	goto error_return;
 
@@ -1602,7 +1604,7 @@ _bfd_coff_link_input_bfd (struct coff_fi
              out to be a duplicate, we pass this address to
              bfd_release.  */
 	  amt = sizeof (struct coff_debug_merge_type);
-	  mt = bfd_alloc (input_bfd, amt);
+	  mt = (struct coff_debug_merge_type *) bfd_alloc (input_bfd, amt);
 	  if (mt == NULL)
 	    return FALSE;
 	  mt->type_class = isym.n_sclass;
@@ -1629,7 +1631,8 @@ _bfd_coff_link_input_bfd (struct coff_fi
 	      bfd_coff_swap_sym_in (input_bfd, esl, islp);
 
 	      amt = sizeof (struct coff_debug_merge_element);
-	      *epp = bfd_alloc (input_bfd, amt);
+	      *epp = (struct coff_debug_merge_element *)
+                  bfd_alloc (input_bfd, amt);
 	      if (*epp == NULL)
 		return FALSE;
 
@@ -1639,7 +1642,7 @@ _bfd_coff_link_input_bfd (struct coff_fi
 		return FALSE;
 
 	      amt = strlen (elename) + 1;
-	      name_copy = bfd_alloc (input_bfd, amt);
+	      name_copy = (char *) bfd_alloc (input_bfd, amt);
 	      if (name_copy == NULL)
 		return FALSE;
 	      strcpy (name_copy, elename);
@@ -2729,7 +2732,7 @@ _bfd_coff_reloc_link_order (bfd *output_
       file_ptr loc;
 
       size = bfd_get_reloc_size (howto);
-      buf = bfd_zmalloc (size);
+      buf = (bfd_byte *) bfd_zmalloc (size);
       if (buf == NULL)
 	return FALSE;
 
Index: bfd/compress.c
===================================================================
RCS file: /cvs/src/src/bfd/compress.c,v
retrieving revision 1.1
diff -u -u -p -r1.1 compress.c
--- bfd/compress.c	10 Jul 2008 01:32:21 -0000	1.1
+++ bfd/compress.c	7 Sep 2009 22:53:11 -0000
@@ -89,7 +89,7 @@ bfd_uncompress_section_contents (bfd_byt
   strm.avail_in = compressed_size - header_size;
   strm.next_in = (Bytef*) compressed_buffer + header_size;
   strm.avail_out = uncompressed_size;
-  uncompressed_buffer = bfd_malloc (uncompressed_size);
+  uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
   if (! uncompressed_buffer)
     return FALSE;
 
Index: bfd/dwarf1.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf1.c,v
retrieving revision 1.20
diff -u -u -p -r1.20 dwarf1.c
--- bfd/dwarf1.c	2 Sep 2009 07:18:36 -0000	1.20
+++ bfd/dwarf1.c	7 Sep 2009 22:53:11 -0000
@@ -143,7 +143,7 @@ alloc_dwarf1_unit (struct dwarf1_debug* 
 {
   bfd_size_type amt = sizeof (struct dwarf1_unit);
 
-  struct dwarf1_unit* x = bfd_zalloc (stash->abfd, amt);
+  struct dwarf1_unit* x = (struct dwarf1_unit *) bfd_zalloc (stash->abfd, amt);
   if (x)
     {
       x->prev = stash->lastUnit;
@@ -161,7 +161,7 @@ alloc_dwarf1_func (struct dwarf1_debug* 
 {
   bfd_size_type amt = sizeof (struct dwarf1_func);
 
-  struct dwarf1_func* x = bfd_zalloc (stash->abfd, amt);
+  struct dwarf1_func* x = (struct dwarf1_func *) bfd_zalloc (stash->abfd, amt);
   if (x)
     {
       x->prev = aUnit->func_list;
@@ -312,7 +312,8 @@ parse_line_table (struct dwarf1_debug* s
 
       /* Allocate an array for the entries.  */
       amt = sizeof (struct linenumber) * aUnit->line_count;
-      aUnit->linenumber_table = bfd_alloc (stash->abfd, amt);
+      aUnit->linenumber_table = (struct linenumber *) bfd_alloc (stash->abfd,
+                                                                 amt);
       if (!aUnit->linenumber_table)
 	return FALSE;
 
@@ -473,7 +474,7 @@ _bfd_dwarf1_find_nearest_line (bfd *abfd
       bfd_size_type size = sizeof (struct dwarf1_debug);
 
       stash = elf_tdata (abfd)->dwarf1_find_line_info
-	= bfd_zalloc (abfd, size);
+	= (struct dwarf1_debug *) bfd_zalloc (abfd, size);
 
       if (! stash)
 	return FALSE;
Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.122
diff -u -u -p -r1.122 dwarf2.c
--- bfd/dwarf2.c	10 Jul 2009 15:26:56 -0000	1.122
+++ bfd/dwarf2.c	7 Sep 2009 22:53:12 -0000
@@ -316,7 +316,8 @@ info_hash_table_newfunc (struct bfd_hash
      derived class.  */
   if (ret == NULL)
     {
-      ret = bfd_hash_allocate (table, sizeof (* ret));
+      ret = (struct info_hash_entry *) bfd_hash_allocate (table,
+                                                          sizeof (* ret));
       if (ret == NULL)
 	return NULL;
     }
@@ -341,7 +342,8 @@ create_info_hash_table (bfd *abfd)
 {
   struct info_hash_table *hash_table;
 
-  hash_table = bfd_alloc (abfd, sizeof (struct info_hash_table));
+  hash_table = (struct info_hash_table *)
+      bfd_alloc (abfd, sizeof (struct info_hash_table));
   if (!hash_table)
     return hash_table;
 
@@ -374,7 +376,8 @@ insert_info_hash_table (struct info_hash
   if (!entry)
     return FALSE;
 
-  node = bfd_hash_allocate (&hash_table->base, sizeof (*node));
+  node = (struct info_list_node *) bfd_hash_allocate (&hash_table->base,
+                                                      sizeof (*node));
   if (!node)
     return FALSE;
 
@@ -442,7 +445,7 @@ read_section (bfd *           abfd,
 	}
       else
 	{
-	  *section_buffer = bfd_malloc (*section_size);
+	  *section_buffer = (bfd_byte *) bfd_malloc (*section_size);
 	  if (! *section_buffer)
 	    return FALSE;
 	  if (! bfd_get_section_contents (abfd, msec, *section_buffer,
@@ -643,7 +646,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t of
     return 0;
 
   amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE;
-  abbrevs = bfd_zalloc (abfd, amt);
+  abbrevs = (struct abbrev_info **) bfd_zalloc (abfd, amt);
 
   abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
   abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
@@ -653,7 +656,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t of
   while (abbrev_number)
     {
       amt = sizeof (struct abbrev_info);
-      cur_abbrev = bfd_zalloc (abfd, amt);
+      cur_abbrev = (struct abbrev_info *) bfd_zalloc (abfd, amt);
 
       /* Read in abbrev header.  */
       cur_abbrev->number = abbrev_number;
@@ -677,7 +680,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t of
 
 	      amt = cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK;
 	      amt *= sizeof (struct attr_abbrev);
-	      tmp = bfd_realloc (cur_abbrev->attrs, amt);
+	      tmp = (struct attr_abbrev *) bfd_realloc (cur_abbrev->attrs, amt);
 	      if (tmp == NULL)
 		{
 		  size_t i;
@@ -766,7 +769,7 @@ read_attribute_value (struct attribute *
       break;
     case DW_FORM_block2:
       amt = sizeof (struct dwarf_block);
-      blk = bfd_alloc (abfd, amt);
+      blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
       blk->size = read_2_bytes (abfd, info_ptr);
       info_ptr += 2;
       blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -775,7 +778,7 @@ read_attribute_value (struct attribute *
       break;
     case DW_FORM_block4:
       amt = sizeof (struct dwarf_block);
-      blk = bfd_alloc (abfd, amt);
+      blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
       blk->size = read_4_bytes (abfd, info_ptr);
       info_ptr += 4;
       blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -804,7 +807,7 @@ read_attribute_value (struct attribute *
       break;
     case DW_FORM_block:
       amt = sizeof (struct dwarf_block);
-      blk = bfd_alloc (abfd, amt);
+      blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
       blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
       info_ptr += bytes_read;
       blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -813,7 +816,7 @@ read_attribute_value (struct attribute *
       break;
     case DW_FORM_block1:
       amt = sizeof (struct dwarf_block);
-      blk = bfd_alloc (abfd, amt);
+      blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
       blk->size = read_1_byte (abfd, info_ptr);
       info_ptr += 1;
       blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -978,7 +981,7 @@ add_line_info (struct line_info_table *t
 	       int end_sequence)
 {
   bfd_size_type amt = sizeof (struct line_info);
-  struct line_info* info = bfd_alloc (table->abfd, amt);
+  struct line_info* info = (struct line_info *) bfd_alloc (table->abfd, amt);
 
   /* Set member data of 'info'.  */
   info->address = address;
@@ -988,7 +991,7 @@ add_line_info (struct line_info_table *t
 
   if (filename && filename[0])
     {
-      info->filename = bfd_alloc (table->abfd, strlen (filename) + 1);
+      info->filename = (char *) bfd_alloc (table->abfd, strlen (filename) + 1);
       if (info->filename)
 	strcpy (info->filename, filename);
     }
@@ -1109,13 +1112,13 @@ concat_filename (struct line_info_table 
       if (subdirname)
 	{
 	  len += strlen (subdirname) + 1;
-	  name = bfd_malloc (len);
+	  name = (char *) bfd_malloc (len);
 	  if (name)
 	    sprintf (name, "%s/%s/%s", dirname, subdirname, filename);
 	}
       else
 	{
-	  name = bfd_malloc (len);
+	  name = (char *) bfd_malloc (len);
 	  if (name)
 	    sprintf (name, "%s/%s", dirname, filename);
 	}
@@ -1159,7 +1162,7 @@ arange_add (bfd *abfd, struct arange *fi
 
   /* Need to allocate a new arange and insert it into the arange list.
      Order isn't significant, so just insert after the first arange. */
-  arange = bfd_zalloc (abfd, sizeof (*arange));
+  arange = (struct arange *) bfd_zalloc (abfd, sizeof (*arange));
   arange->low = low_pc;
   arange->high = high_pc;
   arange->next = first_arange->next;
@@ -1187,7 +1190,7 @@ decode_line_info (struct comp_unit *unit
     return 0;
 
   amt = sizeof (struct line_info_table);
-  table = bfd_alloc (abfd, amt);
+  table = (struct line_info_table *) bfd_alloc (abfd, amt);
   table->abfd = abfd;
   table->comp_dir = unit->comp_dir;
 
@@ -1239,7 +1242,7 @@ decode_line_info (struct comp_unit *unit
   lh.opcode_base = read_1_byte (abfd, line_ptr);
   line_ptr += 1;
   amt = lh.opcode_base * sizeof (unsigned char);
-  lh.standard_opcode_lengths = bfd_alloc (abfd, amt);
+  lh.standard_opcode_lengths = (unsigned char *) bfd_alloc (abfd, amt);
 
   lh.standard_opcode_lengths[0] = 1;
 
@@ -1261,7 +1264,7 @@ decode_line_info (struct comp_unit *unit
 	  amt = table->num_dirs + DIR_ALLOC_CHUNK;
 	  amt *= sizeof (char *);
 
-	  tmp = bfd_realloc (table->dirs, amt);
+	  tmp = (char **) bfd_realloc (table->dirs, amt);
 	  if (tmp == NULL)
 	    {
 	      free (table->dirs);
@@ -1287,7 +1290,7 @@ decode_line_info (struct comp_unit *unit
 	  amt = table->num_files + FILE_ALLOC_CHUNK;
 	  amt *= sizeof (struct fileinfo);
 
-	  tmp = bfd_realloc (table->files, amt);
+	  tmp = (struct fileinfo *) bfd_realloc (table->files, amt);
 	  if (tmp == NULL)
 	    {
 	      free (table->files);
@@ -1383,7 +1386,7 @@ decode_line_info (struct comp_unit *unit
 
 		      amt = table->num_files + FILE_ALLOC_CHUNK;
 		      amt *= sizeof (struct fileinfo);
-		      tmp = bfd_realloc (table->files, amt);
+		      tmp = (struct fileinfo *) bfd_realloc (table->files, amt);
 		      if (tmp == NULL)
 			{
 			  free (table->files);
@@ -1837,7 +1840,8 @@ scan_unit_for_symbols (struct comp_unit 
   /* Maintain a stack of in-scope functions and inlined functions, which we
      can use to set the caller_func field.  */
   nested_funcs_size = 32;
-  nested_funcs = bfd_malloc (nested_funcs_size * sizeof (struct funcinfo *));
+  nested_funcs = (struct funcinfo **)
+      bfd_malloc (nested_funcs_size * sizeof (struct funcinfo *));
   if (nested_funcs == NULL)
     return FALSE;
   nested_funcs[nesting_level] = 0;
@@ -1877,7 +1881,7 @@ scan_unit_for_symbols (struct comp_unit 
 	  || abbrev->tag == DW_TAG_inlined_subroutine)
 	{
 	  bfd_size_type amt = sizeof (struct funcinfo);
-	  func = bfd_zalloc (abfd, amt);
+	  func = (struct funcinfo *) bfd_zalloc (abfd, amt);
 	  func->tag = abbrev->tag;
 	  func->prev_func = unit->function_table;
 	  unit->function_table = func;
@@ -1898,7 +1902,7 @@ scan_unit_for_symbols (struct comp_unit 
 	  if (abbrev->tag == DW_TAG_variable)
 	    {
 	      bfd_size_type amt = sizeof (struct varinfo);
-	      var = bfd_zalloc (abfd, amt);
+	      var = (struct varinfo *) bfd_zalloc (abfd, amt);
 	      var->tag = abbrev->tag;
 	      var->stack = 1;
 	      var->prev_var = unit->variable_table;
@@ -2036,9 +2040,9 @@ scan_unit_for_symbols (struct comp_unit 
 	      struct funcinfo **tmp;
 
 	      nested_funcs_size *= 2;
-	      tmp = bfd_realloc (nested_funcs,
-				 (nested_funcs_size
-				  * sizeof (struct funcinfo *)));
+	      tmp = (struct funcinfo **)
+                 bfd_realloc (nested_funcs,
+                              (nested_funcs_size * sizeof (struct funcinfo *)));
 	      if (tmp == NULL)
 		{
 		  free (nested_funcs);
@@ -2143,7 +2147,7 @@ parse_comp_unit (struct dwarf2_debug *st
     }
 
   amt = sizeof (struct comp_unit);
-  unit = bfd_zalloc (abfd, amt);
+  unit = (struct comp_unit *) bfd_zalloc (abfd, amt);
   unit->abfd = abfd;
   unit->version = version;
   unit->addr_size = addr_size;
@@ -2650,7 +2654,7 @@ info_hash_lookup_funcinfo (struct info_h
        node;
        node = node->next)
     {
-      each_func = node->info;
+      each_func = (struct funcinfo *) node->info;
       for (arange = &each_func->arange;
 	   arange;
 	   arange = arange->next)
@@ -2698,7 +2702,7 @@ info_hash_lookup_varinfo (struct info_ha
        node;
        node = node->next)
     {
-      each = node->info;
+      each = (struct varinfo *) node->info;
       if (each->addr == addr
 	  && (!each->sec || each->sec == sec))
 	{
@@ -2889,13 +2893,13 @@ find_line (bfd *abfd,
   bfd_vma found = FALSE;
   bfd_boolean do_line;
 
-  stash = *pinfo;
+  stash = (struct dwarf2_debug *) *pinfo;
 
   if (! stash)
     {
       bfd_size_type amt = sizeof (struct dwarf2_debug);
 
-      stash = bfd_zalloc (abfd, amt);
+      stash = (struct dwarf2_debug *) bfd_zalloc (abfd, amt);
       if (! stash)
 	return FALSE;
     }
@@ -2999,7 +3003,7 @@ find_line (bfd *abfd,
 	  if (all_uncompressed)
 	    {
 	      /* Case 2: multiple sections, but none is compressed.  */
-	      stash->info_ptr_memory = bfd_malloc (total_size);
+	      stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size);
 	      if (stash->info_ptr_memory == NULL)
 		goto done;
 
@@ -3050,8 +3054,8 @@ find_line (bfd *abfd,
 			  goto done;
 			}
 		    }
-		  stash->info_ptr_memory = bfd_realloc (stash->info_ptr_memory,
-							total_size + size);
+		  stash->info_ptr_memory =  (bfd_byte *)
+                      bfd_realloc (stash->info_ptr_memory, total_size + size);
 		  memcpy (stash->info_ptr_memory + total_size, buffer, size);
 		  free (buffer);
 		  total_size += size;
@@ -3277,7 +3281,7 @@ _bfd_dwarf2_find_inliner_info (bfd *abfd
 {
   struct dwarf2_debug *stash;
 
-  stash = *pinfo;
+  stash = (struct dwarf2_debug *) *pinfo;
   if (stash)
     {
       struct funcinfo *func = stash->inliner_chain;
@@ -3304,7 +3308,7 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abf
   if (abfd == NULL || elf_tdata (abfd) == NULL)
     return;
 
-  stash = elf_tdata (abfd)->dwarf2_find_line_info;
+  stash = (struct dwarf2_debug *) elf_tdata (abfd)->dwarf2_find_line_info;
 
   if (stash == NULL)
     return;
Index: bfd/elf-attrs.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-attrs.c,v
retrieving revision 1.9
diff -u -u -p -r1.9 elf-attrs.c
--- bfd/elf-attrs.c	2 Sep 2009 07:18:36 -0000	1.9
+++ bfd/elf-attrs.c	7 Sep 2009 22:53:12 -0000
@@ -307,10 +307,10 @@ _bfd_elf_attr_strdup (bfd *abfd, const c
 {
   char * p;
   int len;
-  
+
   len = strlen (s) + 1;
   p = (char *) bfd_alloc (abfd, len);
-  return memcpy (p, s, len);
+  return (char *) memcpy (p, s, len);
 }
 
 /* Add a string object attribute.  */
@@ -428,7 +428,7 @@ _bfd_elf_parse_attributes (bfd *abfd, El
   bfd_vma len;
   const char *std_section;
 
-  contents = bfd_malloc (hdr->sh_size);
+  contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
   if (!contents)
     return;
   if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0,
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.293
diff -u -u -p -r1.293 elf-bfd.h
--- bfd/elf-bfd.h	31 Aug 2009 12:02:33 -0000	1.293
+++ bfd/elf-bfd.h	7 Sep 2009 22:53:12 -0000
@@ -210,7 +210,7 @@ struct elf_link_hash_entry
     struct bfd_elf_version_tree *vertree;
   } verinfo;
 
-  struct
+  struct elf_link_virtual_table_entry
   {
     /* Virtual table entry use information.  This array is nominally of size
        size/sizeof(target_void_pointer), though we have to be able to assume
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.77
diff -u -u -p -r1.77 elf-eh-frame.c
--- bfd/elf-eh-frame.c	2 Sep 2009 07:18:36 -0000	1.77
+++ bfd/elf-eh-frame.c	7 Sep 2009 22:53:12 -0000
@@ -215,8 +215,8 @@ write_value (bfd *abfd, bfd_byte *buf, b
 static int
 cie_eq (const void *e1, const void *e2)
 {
-  const struct cie *c1 = e1;
-  const struct cie *c2 = e2;
+  const struct cie *c1 = (const struct cie *) e1;
+  const struct cie *c2 = (const struct cie *) e2;
 
   if (c1->hash == c2->hash
       && c1->length == c2->length
@@ -246,7 +246,7 @@ cie_eq (const void *e1, const void *e2)
 static hashval_t
 cie_hash (const void *e)
 {
-  const struct cie *c = e;
+  const struct cie *c = (const struct cie *) e;
   return c->hash;
 }
 
@@ -529,12 +529,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
       REQUIRE (skip_bytes (&buf, end, hdr_length - 4));
     }
 
-  sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info)
-			  + (num_entries - 1) * sizeof (struct eh_cie_fde));
+  sec_info = (struct eh_frame_sec_info *)
+      bfd_zmalloc (sizeof (struct eh_frame_sec_info)
+                   + (num_entries - 1) * sizeof (struct eh_cie_fde));
   REQUIRE (sec_info);
 
   /* We need to have a "struct cie" for each CIE in this section.  */
-  local_cies = bfd_zmalloc (num_cies * sizeof (*local_cies));
+  local_cies = (struct cie *) bfd_zmalloc (num_cies * sizeof (*local_cies));
   REQUIRE (local_cies);
 
   /* FIXME: octets_per_byte.  */
@@ -848,8 +849,8 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
 	  unsigned int cnt;
 	  bfd_byte *p;
 
-	  this_inf->set_loc = bfd_malloc ((set_loc_count + 1)
-					  * sizeof (unsigned int));
+	  this_inf->set_loc = (unsigned int *)
+              bfd_malloc ((set_loc_count + 1) * sizeof (unsigned int));
 	  REQUIRE (this_inf->set_loc);
 	  this_inf->set_loc[0] = set_loc_count;
 	  p = insns;
@@ -1055,7 +1056,7 @@ find_merged_cie (bfd *abfd, asection *se
   if (new_cie == NULL)
     {
       /* Keep CIE_INF and record it in the hash table.  */
-      new_cie = malloc (sizeof (struct cie));
+      new_cie = (struct cie *) malloc (sizeof (struct cie));
       if (new_cie == NULL)
 	return cie_inf;
 
@@ -1246,7 +1247,7 @@ _bfd_elf_eh_frame_section_offset (bfd *o
 
   if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
     return offset;
-  sec_info = elf_section_data (sec)->sec_info;
+  sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info;
 
   if (offset >= sec->rawsize)
     return offset - sec->rawsize + sec->size;
@@ -1336,13 +1337,13 @@ _bfd_elf_write_section_eh_frame (bfd *ab
 	      ->elf_backend_eh_frame_address_size (abfd, sec));
   BFD_ASSERT (ptr_size != 0);
 
-  sec_info = elf_section_data (sec)->sec_info;
+  sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info;
   htab = elf_hash_table (info);
   hdr_info = &htab->eh_info;
 
   if (hdr_info->table && hdr_info->array == NULL)
-    hdr_info->array
-      = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
+    hdr_info->array = (struct eh_frame_array_ent *)
+        bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
   if (hdr_info->array == NULL)
     hdr_info = NULL;
 
@@ -1629,8 +1630,8 @@ _bfd_elf_write_section_eh_frame (bfd *ab
 static int
 vma_compare (const void *a, const void *b)
 {
-  const struct eh_frame_array_ent *p = a;
-  const struct eh_frame_array_ent *q = b;
+  const struct eh_frame_array_ent *p = (const struct eh_frame_array_ent *) a;
+  const struct eh_frame_array_ent *q = (const struct eh_frame_array_ent *) b;
   if (p->initial_loc > q->initial_loc)
     return 1;
   if (p->initial_loc < q->initial_loc)
@@ -1681,7 +1682,7 @@ _bfd_elf_write_section_eh_frame_hdr (bfd
   size = EH_FRAME_HDR_SIZE;
   if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
     size += 4 + hdr_info->fde_count * 8;
-  contents = bfd_malloc (size);
+  contents = (bfd_byte *) bfd_malloc (size);
   if (contents == NULL)
     return FALSE;
 
Index: bfd/elf-strtab.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-strtab.c,v
retrieving revision 1.15
diff -u -u -p -r1.15 elf-strtab.c
--- bfd/elf-strtab.c	20 Feb 2008 17:42:35 -0000	1.15
+++ bfd/elf-strtab.c	7 Sep 2009 22:53:12 -0000
@@ -68,7 +68,8 @@ elf_strtab_hash_newfunc (struct bfd_hash
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (entry == NULL)
-    entry = bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
+    entry = (struct bfd_hash_entry *)
+        bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
   if (entry == NULL)
     return NULL;
 
@@ -97,7 +98,7 @@ _bfd_elf_strtab_init (void)
   struct elf_strtab_hash *table;
   bfd_size_type amt = sizeof (struct elf_strtab_hash);
 
-  table = bfd_malloc (amt);
+  table = (struct elf_strtab_hash *) bfd_malloc (amt);
   if (table == NULL)
     return NULL;
 
@@ -112,7 +113,8 @@ _bfd_elf_strtab_init (void)
   table->size = 1;
   table->alloced = 64;
   amt = sizeof (struct elf_strtab_hasn_entry *);
-  table->array = bfd_malloc (table->alloced * amt);
+  table->array = (struct elf_strtab_hash_entry **)
+      bfd_malloc (table->alloced * amt);
   if (table->array == NULL)
     {
       free (table);
@@ -166,7 +168,8 @@ _bfd_elf_strtab_add (struct elf_strtab_h
 	{
 	  bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
 	  tab->alloced *= 2;
-	  tab->array = bfd_realloc_or_free (tab->array, tab->alloced * amt);
+	  tab->array = (struct elf_strtab_hash_entry **)
+              bfd_realloc_or_free (tab->array, tab->alloced * amt);
 	  if (tab->array == NULL)
 	    return (bfd_size_type) -1;
 	}
@@ -311,7 +314,7 @@ _bfd_elf_strtab_finalize (struct elf_str
 
   /* Sort the strings by suffix and length.  */
   amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
-  array = bfd_malloc (amt);
+  array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
   if (array == NULL)
     goto alloc_failure;
 
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.490
diff -u -u -p -r1.490 elf.c
--- bfd/elf.c	31 Aug 2009 12:02:34 -0000	1.490
+++ bfd/elf.c	7 Sep 2009 22:53:12 -0000
@@ -283,7 +283,7 @@ bfd_elf_get_str_section (bfd *abfd, unsi
       /* Allocate and clear an extra byte at the end, to prevent crashes
 	 in case the string table is not terminated.  */
       if (shstrtabsize + 1 <= 1
-	  || (shstrtab = bfd_alloc (abfd, shstrtabsize + 1)) == NULL
+	  || (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL
 	  || bfd_seek (abfd, offset, SEEK_SET) != 0)
 	shstrtab = NULL;
       else if (bfd_bread (shstrtab, shstrtabsize, abfd) != shstrtabsize)
@@ -407,8 +407,8 @@ bfd_elf_get_elf_syms (bfd *ibfd,
       pos = shndx_hdr->sh_offset + symoffset * sizeof (Elf_External_Sym_Shndx);
       if (extshndx_buf == NULL)
 	{
-	  alloc_extshndx = bfd_malloc2 (symcount,
-					sizeof (Elf_External_Sym_Shndx));
+	  alloc_extshndx = (Elf_External_Sym_Shndx *)
+              bfd_malloc2 (symcount, sizeof (Elf_External_Sym_Shndx));
 	  extshndx_buf = alloc_extshndx;
 	}
       if (extshndx_buf == NULL
@@ -422,7 +422,8 @@ bfd_elf_get_elf_syms (bfd *ibfd,
 
   if (intsym_buf == NULL)
     {
-      alloc_intsym = bfd_malloc2 (symcount, sizeof (Elf_Internal_Sym));
+      alloc_intsym = (Elf_Internal_Sym *)
+          bfd_malloc2 (symcount, sizeof (Elf_Internal_Sym));
       intsym_buf = alloc_intsym;
       if (intsym_buf == NULL)
 	goto out;
@@ -430,7 +431,8 @@ bfd_elf_get_elf_syms (bfd *ibfd,
 
   /* Convert the symbols to internal form.  */
   isymend = intsym_buf + symcount;
-  for (esym = extsym_buf, isym = intsym_buf, shndx = extshndx_buf;
+  for (esym = (const bfd_byte *) extsym_buf, isym = intsym_buf,
+           shndx = extshndx_buf;
        isym < isymend;
        esym += extsym_size, isym++, shndx = shndx != NULL ? shndx + 1 : NULL)
     if (!(*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym))
@@ -564,8 +566,8 @@ setup_group (bfd *abfd, Elf_Internal_Shd
 	  bfd_size_type amt;
 
 	  elf_tdata (abfd)->num_group = num_group;
-	  elf_tdata (abfd)->group_sect_ptr
-	    = bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *));
+	  elf_tdata (abfd)->group_sect_ptr = (Elf_Internal_Shdr **)
+              bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *));
 	  if (elf_tdata (abfd)->group_sect_ptr == NULL)
 	    return FALSE;
 
@@ -586,8 +588,8 @@ setup_group (bfd *abfd, Elf_Internal_Shd
 		  /* Read the raw contents.  */
 		  BFD_ASSERT (sizeof (*dest) >= 4);
 		  amt = shdr->sh_size * sizeof (*dest) / 4;
-		  shdr->contents = bfd_alloc2 (abfd, shdr->sh_size,
-					       sizeof (*dest) / 4);
+		  shdr->contents = (unsigned char *)
+                      bfd_alloc2 (abfd, shdr->sh_size, sizeof (*dest) / 4);
 		  /* PR binutils/4110: Handle corrupt group headers.  */
 		  if (shdr->contents == NULL)
 		    {
@@ -1091,7 +1093,7 @@ get_segment_type (unsigned int p_type)
 bfd_boolean
 _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
 {
-  FILE *f = farg;
+  FILE *f = (FILE *) farg;
   Elf_Internal_Phdr *p;
   asection *s;
   bfd_byte *dynbuf = NULL;
@@ -1334,7 +1336,7 @@ bfd_elf_print_symbol (bfd *abfd,
 		      asymbol *symbol,
 		      bfd_print_symbol_type how)
 {
-  FILE *file = filep;
+  FILE *file = (FILE *) filep;
   switch (how)
     {
     case bfd_print_symbol_name:
@@ -1775,7 +1777,7 @@ bfd_section_from_shdr (bfd *abfd, unsign
 	    bfd_size_type amt;
 	    BFD_ASSERT (elf_section_data (target_sect)->rel_hdr2 == NULL);
 	    amt = sizeof (*hdr2);
-	    hdr2 = bfd_alloc (abfd, amt);
+	    hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
 	    if (hdr2 == NULL)
 	      return FALSE;
 	    elf_section_data (target_sect)->rel_hdr2 = hdr2;
@@ -2193,7 +2195,8 @@ _bfd_elf_new_section_hook (bfd *abfd, as
   sdata = (struct bfd_elf_section_data *) sec->used_by_bfd;
   if (sdata == NULL)
     {
-      sdata = bfd_zalloc (abfd, sizeof (*sdata));
+      sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd,
+                                                          sizeof (*sdata));
       if (sdata == NULL)
 	return FALSE;
       sec->used_by_bfd = sdata;
@@ -2249,7 +2252,7 @@ bfd_boolean
 _bfd_elf_make_section_from_phdr (bfd *abfd,
 				 Elf_Internal_Phdr *hdr,
 				 int index,
-				 const char *typename)
+				 const char *type_name)
 {
   asection *newsect;
   char *name;
@@ -2263,9 +2266,9 @@ _bfd_elf_make_section_from_phdr (bfd *ab
 
   if (hdr->p_filesz > 0)
     {
-      sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
+      sprintf (namebuf, "%s%d%s", type_name, index, split ? "a" : "");
       len = strlen (namebuf) + 1;
-      name = bfd_alloc (abfd, len);
+      name = (char *) bfd_alloc (abfd, len);
       if (!name)
 	return FALSE;
       memcpy (name, namebuf, len);
@@ -2299,9 +2302,9 @@ _bfd_elf_make_section_from_phdr (bfd *ab
     {
       bfd_vma align;
 
-      sprintf (namebuf, "%s%d%s", typename, index, split ? "b" : "");
+      sprintf (namebuf, "%s%d%s", type_name, index, split ? "b" : "");
       len = strlen (namebuf) + 1;
-      name = bfd_alloc (abfd, len);
+      name = (char *) bfd_alloc (abfd, len);
       if (!name)
 	return FALSE;
       memcpy (name, namebuf, len);
@@ -2400,7 +2403,7 @@ _bfd_elf_init_reloc_shdr (bfd *abfd,
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
   bfd_size_type amt = sizeof ".rela" + strlen (asect->name);
 
-  name = bfd_alloc (abfd, amt);
+  name = (char *) bfd_alloc (abfd, amt);
   if (name == NULL)
     return FALSE;
   sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name);
@@ -2440,7 +2443,7 @@ static void
 elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
 {
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-  bfd_boolean *failedptr = failedptrarg;
+  bfd_boolean *failedptr = (bfd_boolean *) failedptrarg;
   Elf_Internal_Shdr *this_hdr;
   unsigned int sh_type;
 
@@ -2640,7 +2643,7 @@ elf_fake_sections (bfd *abfd, asection *
 void
 bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
 {
-  bfd_boolean *failedptr = failedptrarg;
+  bfd_boolean *failedptr = (bfd_boolean *) failedptrarg;
   asection *elt, *first;
   unsigned char *loc;
   bfd_boolean gas;
@@ -2700,7 +2703,7 @@ bfd_elf_set_group_contents (bfd *abfd, a
   if (sec->contents == NULL)
     {
       gas = FALSE;
-      sec->contents = bfd_alloc (abfd, sec->size);
+      sec->contents = (unsigned char *) bfd_alloc (abfd, sec->size);
 
       /* Arrange for the section to be written out.  */
       elf_section_data (sec)->this_hdr.contents = sec->contents;
@@ -2846,11 +2849,13 @@ assign_section_numbers (bfd *abfd, struc
 
   /* Set up the list of section header pointers, in agreement with the
      indices.  */
-  i_shdrp = bfd_zalloc2 (abfd, section_number, sizeof (Elf_Internal_Shdr *));
+  i_shdrp = (Elf_Internal_Shdr **) bfd_zalloc2 (abfd, section_number,
+                                                sizeof (Elf_Internal_Shdr *));
   if (i_shdrp == NULL)
     return FALSE;
 
-  i_shdrp[0] = bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
+  i_shdrp[0] = (Elf_Internal_Shdr *) bfd_zalloc (abfd,
+                                                 sizeof (Elf_Internal_Shdr));
   if (i_shdrp[0] == NULL)
     {
       bfd_release (abfd, i_shdrp);
@@ -2999,7 +3004,7 @@ assign_section_numbers (bfd *abfd, struc
 	      char *alc;
 
 	      len = strlen (sec->name);
-	      alc = bfd_malloc (len - 2);
+	      alc = (char *) bfd_malloc (len - 2);
 	      if (alc == NULL)
 		return FALSE;
 	      memcpy (alc, sec->name, len - 3);
@@ -3119,7 +3124,7 @@ elf_map_symbols (bfd *abfd)
     }
 
   max_index++;
-  sect_syms = bfd_zalloc2 (abfd, max_index, sizeof (asymbol *));
+  sect_syms = (asymbol **) bfd_zalloc2 (abfd, max_index, sizeof (asymbol *));
   if (sect_syms == NULL)
     return FALSE;
   elf_section_syms (abfd) = sect_syms;
@@ -3171,7 +3176,8 @@ elf_map_symbols (bfd *abfd)
     }
 
   /* Now sort the symbols so the local symbols are first.  */
-  new_syms = bfd_alloc2 (abfd, num_locals + num_globals, sizeof (asymbol *));
+  new_syms = (asymbol **) bfd_alloc2 (abfd, num_locals + num_globals,
+                                      sizeof (asymbol *));
 
   if (new_syms == NULL)
     return FALSE;
@@ -3480,7 +3486,7 @@ make_mapping (bfd *abfd,
 
   amt = sizeof (struct elf_segment_map);
   amt += (to - from - 1) * sizeof (asection *);
-  m = bfd_zalloc (abfd, amt);
+  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
   if (m == NULL)
     return NULL;
   m->next = NULL;
@@ -3507,7 +3513,8 @@ _bfd_elf_make_dynamic_segment (bfd *abfd
 {
   struct elf_segment_map *m;
 
-  m = bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+  m = (struct elf_segment_map *) bfd_zalloc (abfd,
+                                             sizeof (struct elf_segment_map));
   if (m == NULL)
     return NULL;
   m->next = NULL;
@@ -3598,7 +3605,8 @@ _bfd_elf_map_sections_to_segments (bfd *
 
       /* Select the allocated sections, and sort them.  */
 
-      sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *));
+      sections = (asection **) bfd_malloc2 (bfd_count_sections (abfd),
+                                            sizeof (asection *));
       if (sections == NULL)
 	goto error_return;
 
@@ -3628,7 +3636,7 @@ _bfd_elf_map_sections_to_segments (bfd *
       if (s != NULL && (s->flags & SEC_LOAD) != 0)
 	{
 	  amt = sizeof (struct elf_segment_map);
-	  m = bfd_zalloc (abfd, amt);
+	  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
 	  if (m == NULL)
 	    goto error_return;
 	  m->next = NULL;
@@ -3642,7 +3650,7 @@ _bfd_elf_map_sections_to_segments (bfd *
 	  pm = &m->next;
 
 	  amt = sizeof (struct elf_segment_map);
-	  m = bfd_zalloc (abfd, amt);
+	  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
 	  if (m == NULL)
 	    goto error_return;
 	  m->next = NULL;
@@ -3852,7 +3860,7 @@ _bfd_elf_map_sections_to_segments (bfd *
 		      break;
 		  }
 	      amt += (count - 1) * sizeof (asection *);
-	      m = bfd_zalloc (abfd, amt);
+	      m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
 	      if (m == NULL)
 		goto error_return;
 	      m->next = NULL;
@@ -3884,7 +3892,7 @@ _bfd_elf_map_sections_to_segments (bfd *
 
 	  amt = sizeof (struct elf_segment_map);
 	  amt += (tls_count - 1) * sizeof (asection *);
-	  m = bfd_zalloc (abfd, amt);
+	  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
 	  if (m == NULL)
 	    goto error_return;
 	  m->next = NULL;
@@ -3911,7 +3919,7 @@ _bfd_elf_map_sections_to_segments (bfd *
 	  && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0)
 	{
 	  amt = sizeof (struct elf_segment_map);
-	  m = bfd_zalloc (abfd, amt);
+	  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
 	  if (m == NULL)
 	    goto error_return;
 	  m->next = NULL;
@@ -3926,7 +3934,7 @@ _bfd_elf_map_sections_to_segments (bfd *
       if (elf_tdata (abfd)->stack_flags)
 	{
 	  amt = sizeof (struct elf_segment_map);
-	  m = bfd_zalloc (abfd, amt);
+	  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
 	  if (m == NULL)
 	    goto error_return;
 	  m->next = NULL;
@@ -3959,7 +3967,7 @@ _bfd_elf_map_sections_to_segments (bfd *
 	  if (m != NULL)
 	    {
 	      amt = sizeof (struct elf_segment_map);
-	      m = bfd_zalloc (abfd, amt);
+	      m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
 	      if (m == NULL)
 		goto error_return;
 	      m->next = NULL;
@@ -4161,10 +4169,10 @@ assign_file_positions_for_load_sections 
      last iterations for the testcase ld-elf/header.  */
   BFD_ASSERT (elf_tdata (abfd)->program_header_size % bed->s->sizeof_phdr
 	      == 0);
-  phdrs = bfd_zalloc2 (abfd,
-		       (elf_tdata (abfd)->program_header_size
-			/ bed->s->sizeof_phdr),
-		       sizeof (Elf_Internal_Phdr));
+  phdrs = (Elf_Internal_Phdr *)
+     bfd_zalloc2 (abfd,
+                  (elf_tdata (abfd)->program_header_size / bed->s->sizeof_phdr),
+                  sizeof (Elf_Internal_Phdr));
   elf_tdata (abfd)->phdr = phdrs;
   if (phdrs == NULL)
     return FALSE;
@@ -5356,7 +5364,7 @@ rewrite_elf_program_header (bfd *ibfd, b
 	 all of the sections we have selected.  */
       amt = sizeof (struct elf_segment_map);
       amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
-      map = bfd_zalloc (obfd, amt);
+      map = (struct elf_segment_map *) bfd_zalloc (obfd, amt);
       if (map == NULL)
 	return FALSE;
 
@@ -5440,7 +5448,7 @@ rewrite_elf_program_header (bfd *ibfd, b
 	 pointers that we are interested in.  As these sections get assigned
 	 to a segment, they are removed from this array.  */
 
-      sections = bfd_malloc2 (section_count, sizeof (asection *));
+      sections = (asection **) bfd_malloc2 (section_count, sizeof (asection *));
       if (sections == NULL)
 	return FALSE;
 
@@ -5686,7 +5694,7 @@ rewrite_elf_program_header (bfd *ibfd, b
 		 and carry on looping.  */
 	      amt = sizeof (struct elf_segment_map);
 	      amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
-	      map = bfd_alloc (obfd, amt);
+	      map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
 	      if (map == NULL)
 		{
 		  free (sections);
@@ -5807,7 +5815,7 @@ copy_elf_program_header (bfd *ibfd, bfd 
       amt = sizeof (struct elf_segment_map);
       if (section_count != 0)
 	amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
-      map = bfd_zalloc (obfd, amt);
+      map = (struct elf_segment_map *) bfd_zalloc (obfd, amt);
       if (map == NULL)
 	return FALSE;
 
@@ -6211,7 +6219,8 @@ swap_out_syms (bfd *abfd,
   symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
   symstrtab_hdr->sh_type = SHT_STRTAB;
 
-  outbound_syms = bfd_alloc2 (abfd, 1 + symcount, bed->s->sizeof_sym);
+  outbound_syms = (bfd_byte *) bfd_alloc2 (abfd, 1 + symcount,
+                                           bed->s->sizeof_sym);
   if (outbound_syms == NULL)
     {
       _bfd_stringtab_free (stt);
@@ -6224,8 +6233,8 @@ swap_out_syms (bfd *abfd,
   if (symtab_shndx_hdr->sh_name != 0)
     {
       amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
-      outbound_shndx = bfd_zalloc2 (abfd, 1 + symcount,
-				    sizeof (Elf_External_Sym_Shndx));
+      outbound_shndx =  (bfd_byte *)
+          bfd_zalloc2 (abfd, 1 + symcount, sizeof (Elf_External_Sym_Shndx));
       if (outbound_shndx == NULL)
 	{
 	  _bfd_stringtab_free (stt);
@@ -6663,14 +6672,14 @@ _bfd_elf_slurp_version_tables (bfd *abfd
 
       hdr = &elf_tdata (abfd)->dynverref_hdr;
 
-      elf_tdata (abfd)->verref = bfd_zalloc2 (abfd, hdr->sh_info,
-					      sizeof (Elf_Internal_Verneed));
+      elf_tdata (abfd)->verref = (Elf_Internal_Verneed *)
+          bfd_zalloc2 (abfd, hdr->sh_info, sizeof (Elf_Internal_Verneed));
       if (elf_tdata (abfd)->verref == NULL)
 	goto error_return;
 
       elf_tdata (abfd)->cverrefs = hdr->sh_info;
 
-      contents = bfd_malloc (hdr->sh_size);
+      contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
       if (contents == NULL)
 	{
 error_return_verref:
@@ -6710,8 +6719,9 @@ error_return_verref:
 	    iverneed->vn_auxptr = NULL;
 	  else
 	    {
-	      iverneed->vn_auxptr = bfd_alloc2 (abfd, iverneed->vn_cnt,
-						sizeof (Elf_Internal_Vernaux));
+	      iverneed->vn_auxptr = (struct elf_internal_vernaux *)
+                  bfd_alloc2 (abfd, iverneed->vn_cnt,
+                              sizeof (Elf_Internal_Vernaux));
 	      if (iverneed->vn_auxptr == NULL)
 		goto error_return_verref;
 	    }
@@ -6779,7 +6789,7 @@ error_return_verref:
 
       hdr = &elf_tdata (abfd)->dynverdef_hdr;
 
-      contents = bfd_malloc (hdr->sh_size);
+      contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
       if (contents == NULL)
 	goto error_return;
       if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
@@ -6823,8 +6833,8 @@ error_return_verref:
 	  else
 	    freeidx = ++maxidx;
 	}
-      elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, maxidx,
-					      sizeof (Elf_Internal_Verdef));
+      elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *)
+          bfd_zalloc2 (abfd, maxidx, sizeof (Elf_Internal_Verdef));
       if (elf_tdata (abfd)->verdef == NULL)
 	goto error_return;
 
@@ -6857,8 +6867,9 @@ error_return_verdef:
 	    iverdef->vd_auxptr = NULL;
 	  else
 	    {
-	      iverdef->vd_auxptr = bfd_alloc2 (abfd, iverdef->vd_cnt,
-					       sizeof (Elf_Internal_Verdaux));
+	      iverdef->vd_auxptr = (struct elf_internal_verdaux *)
+                  bfd_alloc2 (abfd, iverdef->vd_cnt,
+                              sizeof (Elf_Internal_Verdaux));
 	      if (iverdef->vd_auxptr == NULL)
 		goto error_return_verdef;
 	    }
@@ -6915,8 +6926,8 @@ error_return_verdef:
       else
 	freeidx++;
 
-      elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, freeidx,
-					      sizeof (Elf_Internal_Verdef));
+      elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *)
+          bfd_zalloc2 (abfd, freeidx, sizeof (Elf_Internal_Verdef));
       if (elf_tdata (abfd)->verdef == NULL)
 	goto error_return;
 
@@ -6942,7 +6953,8 @@ error_return_verdef:
       if (iverdef->vd_nodename == NULL)
 	goto error_return_verdef;
       iverdef->vd_nextdef = NULL;
-      iverdef->vd_auxptr = bfd_alloc (abfd, sizeof (Elf_Internal_Verdaux));
+      iverdef->vd_auxptr = (struct elf_internal_verdaux *)
+          bfd_alloc (abfd, sizeof (Elf_Internal_Verdaux));
       if (iverdef->vd_auxptr == NULL)
 	goto error_return_verdef;
 
@@ -6965,7 +6977,7 @@ _bfd_elf_make_empty_symbol (bfd *abfd)
   elf_symbol_type *newsym;
   bfd_size_type amt = sizeof (elf_symbol_type);
 
-  newsym = bfd_zalloc (abfd, amt);
+  newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt);
   if (!newsym)
     return NULL;
   else
@@ -7450,7 +7462,7 @@ _bfd_elfcore_make_pseudosection (bfd *ab
 
   sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
   len = strlen (buf) + 1;
-  threaded_name = bfd_alloc (abfd, len);
+  threaded_name = (char *) bfd_alloc (abfd, len);
   if (threaded_name == NULL)
     return FALSE;
   memcpy (threaded_name, buf, len);
@@ -7608,7 +7620,7 @@ char *
 _bfd_elfcore_strndup (bfd *abfd, char *start, size_t max)
 {
   char *dups;
-  char *end = memchr (start, '\0', max);
+  char *end = (char *) memchr (start, '\0', max);
   size_t len;
 
   if (end == NULL)
@@ -7616,7 +7628,7 @@ _bfd_elfcore_strndup (bfd *abfd, char *s
   else
     len = end - start;
 
-  dups = bfd_alloc (abfd, len + 1);
+  dups = (char *) bfd_alloc (abfd, len + 1);
   if (dups == NULL)
     return NULL;
 
@@ -7836,7 +7848,7 @@ elfcore_grok_win32pstatus (bfd *abfd, El
       sprintf (buf, ".reg/%ld", (long) bfd_get_32 (abfd, note->descdata + 8));
 
       len = strlen (buf) + 1;
-      name = bfd_alloc (abfd, len);
+      name = (char *) bfd_alloc (abfd, len);
       if (name == NULL)
 	return FALSE;
 
@@ -7867,7 +7879,7 @@ elfcore_grok_win32pstatus (bfd *abfd, El
       sprintf (buf, ".module/%08lx", (unsigned long) base_addr);
 
       len = strlen (buf) + 1;
-      name = bfd_alloc (abfd, len);
+      name = (char *) bfd_alloc (abfd, len);
       if (name == NULL)
 	return FALSE;
 
@@ -7978,7 +7990,7 @@ static bfd_boolean
 elfobj_grok_gnu_build_id (bfd *abfd, Elf_Internal_Note *note)
 {
   elf_tdata (abfd)->build_id_size = note->descsz;
-  elf_tdata (abfd)->build_id = bfd_alloc (abfd, note->descsz);
+  elf_tdata (abfd)->build_id = (bfd_byte *) bfd_alloc (abfd, note->descsz);
   if (elf_tdata (abfd)->build_id == NULL)
     return FALSE;
 
@@ -8197,7 +8209,7 @@ elfcore_grok_nto_status (bfd *abfd, Elf_
   /* Make a ".qnx_core_status/%d" section.  */
   sprintf (buf, ".qnx_core_status/%ld", *tid);
 
-  name = bfd_alloc (abfd, strlen (buf) + 1);
+  name = (char *) bfd_alloc (abfd, strlen (buf) + 1);
   if (name == NULL)
     return FALSE;
   strcpy (name, buf);
@@ -8226,7 +8238,7 @@ elfcore_grok_nto_regs (bfd *abfd,
   /* Make a "(base)/%d" section.  */
   sprintf (buf, "%s/%ld", base, tid);
 
-  name = bfd_alloc (abfd, strlen (buf) + 1);
+  name = (char *) bfd_alloc (abfd, strlen (buf) + 1);
   if (name == NULL)
     return FALSE;
   strcpy (name, buf);
@@ -8283,7 +8295,7 @@ elfcore_grok_spu_note (bfd *abfd, Elf_In
 
   /* Use note name as section name.  */
   len = note->namesz;
-  name = bfd_alloc (abfd, len);
+  name = (char *) bfd_alloc (abfd, len);
   if (name == NULL)
     return FALSE;
   memcpy (name, note->namedata, len);
@@ -8337,7 +8349,7 @@ elfcore_write_note (bfd *abfd,
 
   newspace = 12 + ((namesz + 3) & -4) + ((size + 3) & -4);
 
-  buf = realloc (buf, *bufsiz + newspace);
+  buf = (char *) realloc (buf, *bufsiz + newspace);
   if (buf == NULL)
     return buf;
   dest = buf + *bufsiz;
@@ -8697,7 +8709,7 @@ elf_read_notes (bfd *abfd, file_ptr offs
   if (bfd_seek (abfd, offset, SEEK_SET) != 0)
     return FALSE;
 
-  buf = bfd_malloc (size);
+  buf = (char *) bfd_malloc (size);
   if (buf == NULL)
     return FALSE;
 
@@ -8927,7 +8939,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
 	}
     }
 
-  s = *ret = bfd_malloc (size);
+  s = *ret = (asymbol *) bfd_malloc (size);
   if (s == NULL)
     return -1;
 
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.224
diff -u -u -p -r1.224 elf32-i386.c
--- bfd/elf32-i386.c	2 Sep 2009 07:18:36 -0000	1.224
+++ bfd/elf32-i386.c	7 Sep 2009 22:53:13 -0000
@@ -704,8 +704,8 @@ elf_i386_link_hash_newfunc (struct bfd_h
      subclass.  */
   if (entry == NULL)
     {
-      entry = bfd_hash_allocate (table,
-				 sizeof (struct elf_i386_link_hash_entry));
+      entry = (struct bfd_hash_entry *)
+          bfd_hash_allocate (table, sizeof (struct elf_i386_link_hash_entry));
       if (entry == NULL)
 	return entry;
     }
@@ -802,7 +802,7 @@ elf_i386_link_hash_table_create (bfd *ab
   struct elf_i386_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = (struct elf_i386_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -1511,7 +1511,8 @@ elf_i386_check_relocs (bfd *abfd,
 		    size = symtab_hdr->sh_info;
 		    size *= (sizeof (bfd_signed_vma)
 			     + sizeof (bfd_vma) + sizeof(char));
-		    local_got_refcounts = bfd_zalloc (abfd, size);
+		    local_got_refcounts = (bfd_signed_vma *)
+                        bfd_zalloc (abfd, size);
 		    if (local_got_refcounts == NULL)
 		      return FALSE;
 		    elf_local_got_refcounts (abfd) = local_got_refcounts;
@@ -1687,7 +1688,8 @@ elf_i386_check_relocs (bfd *abfd,
 	      if (p == NULL || p->sec != sec)
 		{
 		  bfd_size_type amt = sizeof *p;
-		  p = bfd_alloc (htab->elf.dynobj, amt);
+		  p = (struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj,
+                                                           amt);
 		  if (p == NULL)
 		    return FALSE;
 		  p->next = *head;
@@ -2559,7 +2561,7 @@ elf_i386_size_dynamic_sections (bfd *out
 	 section's contents are written out.  This should not happen,
 	 but this way if it does, we get a R_386_NONE reloc instead
 	 of garbage.  */
-      s->contents = bfd_zalloc (dynobj, s->size);
+      s->contents = (unsigned char *) bfd_zalloc (dynobj, s->size);
       if (s->contents == NULL)
 	return FALSE;
     }
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.185
diff -u -u -p -r1.185 elf64-x86-64.c
--- bfd/elf64-x86-64.c	2 Sep 2009 07:18:36 -0000	1.185
+++ bfd/elf64-x86-64.c	7 Sep 2009 22:53:15 -0000
@@ -517,8 +517,9 @@ elf64_x86_64_link_hash_newfunc (struct b
      subclass.  */
   if (entry == NULL)
     {
-      entry = bfd_hash_allocate (table,
-				 sizeof (struct elf64_x86_64_link_hash_entry));
+      entry = (struct bfd_hash_entry *)
+          bfd_hash_allocate (table,
+                             sizeof (struct elf64_x86_64_link_hash_entry));
       if (entry == NULL)
 	return entry;
     }
Index: bfd/elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.95
diff -u -u -p -r1.95 elfcode.h
--- bfd/elfcode.h	23 Jul 2009 13:00:20 -0000	1.95
+++ bfd/elfcode.h	7 Sep 2009 22:53:15 -0000
@@ -176,8 +176,8 @@ elf_swap_symbol_in (bfd *abfd,
 		    const void *pshn,
 		    Elf_Internal_Sym *dst)
 {
-  const Elf_External_Sym *src = psrc;
-  const Elf_External_Sym_Shndx *shndx = pshn;
+  const Elf_External_Sym *src = (const Elf_External_Sym *) psrc;
+  const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn;
   int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
 
   dst->st_name = H_GET_32 (abfd, src->st_name);
@@ -210,7 +210,7 @@ elf_swap_symbol_out (bfd *abfd,
 		     void *shndx)
 {
   unsigned int tmp;
-  Elf_External_Sym *dst = cdst;
+  Elf_External_Sym *dst = (Elf_External_Sym *) cdst;
   H_PUT_32 (abfd, src->st_name, dst->st_name);
   H_PUT_WORD (abfd, src->st_value, dst->st_value);
   H_PUT_WORD (abfd, src->st_size, dst->st_size);
@@ -439,7 +439,7 @@ elf_swap_dyn_in (bfd *abfd,
 		 const void *p,
 		 Elf_Internal_Dyn *dst)
 {
-  const Elf_External_Dyn *src = p;
+  const Elf_External_Dyn *src = (const Elf_External_Dyn *) p;
 
   dst->d_tag = H_GET_WORD (abfd, src->d_tag);
   dst->d_un.d_val = H_GET_WORD (abfd, src->d_un.d_val);
@@ -450,7 +450,7 @@ elf_swap_dyn_out (bfd *abfd,
 		  const Elf_Internal_Dyn *src,
 		  void *p)
 {
-  Elf_External_Dyn *dst = p;
+  Elf_External_Dyn *dst = (Elf_External_Dyn *) p;
 
   H_PUT_WORD (abfd, src->d_tag, dst->d_tag);
   H_PUT_WORD (abfd, src->d_un.d_val, dst->d_un.d_val);
@@ -736,13 +736,13 @@ elf_object_p (bfd *abfd)
       unsigned int num_sec;
 
       amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
-      i_shdrp = bfd_alloc (abfd, amt);
+      i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
       if (!i_shdrp)
 	goto got_no_match;
       num_sec = i_ehdrp->e_shnum;
       elf_numsections (abfd) = num_sec;
       amt = sizeof (i_shdrp) * num_sec;
-      elf_elfsections (abfd) = bfd_alloc (abfd, amt);
+      elf_elfsections (abfd) = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
       if (!elf_elfsections (abfd))
 	goto got_no_match;
 
@@ -807,7 +807,7 @@ elf_object_p (bfd *abfd)
       unsigned int i;
 
       amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr);
-      elf_tdata (abfd)->phdr = bfd_alloc (abfd, amt);
+      elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
       if (elf_tdata (abfd)->phdr == NULL)
 	goto got_no_match;
       if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
@@ -898,7 +898,7 @@ elf_object_p (bfd *abfd)
 void
 elf_write_relocs (bfd *abfd, asection *sec, void *data)
 {
-  bfd_boolean *failedp = data;
+  bfd_boolean *failedp = (bfd_boolean *) data;
   Elf_Internal_Shdr *rela_hdr;
   bfd_vma addr_offset;
   void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
@@ -931,7 +931,7 @@ elf_write_relocs (bfd *abfd, asection *s
   rela_hdr = &elf_section_data (sec)->rel_hdr;
 
   rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
-  rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
+  rela_hdr->contents = (unsigned char *) bfd_alloc (abfd, rela_hdr->sh_size);
   if (rela_hdr->contents == NULL)
     {
       *failedp = TRUE;
@@ -1061,7 +1061,7 @@ elf_write_shdrs_and_ehdr (bfd *abfd)
   /* at this point we've concocted all the ELF sections...  */
   amt = i_ehdrp->e_shnum;
   amt *= sizeof (*x_shdrp);
-  x_shdrp = bfd_alloc (abfd, amt);
+  x_shdrp = (Elf_External_Shdr *) bfd_alloc (abfd, amt);
   if (!x_shdrp)
     return FALSE;
 
@@ -1189,7 +1189,7 @@ elf_slurp_symbol_table (bfd *abfd, asymb
 
       amt = symcount;
       amt *= sizeof (elf_symbol_type);
-      symbase = bfd_zalloc (abfd, amt);
+      symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
       if (symbase == (elf_symbol_type *) NULL)
 	goto error_return;
 
@@ -1213,7 +1213,7 @@ elf_slurp_symbol_table (bfd *abfd, asymb
 	  if (bfd_seek (abfd, verhdr->sh_offset, SEEK_SET) != 0)
 	    goto error_return;
 
-	  xverbuf = bfd_malloc (verhdr->sh_size);
+	  xverbuf = (Elf_External_Versym *) bfd_malloc (verhdr->sh_size);
 	  if (xverbuf == NULL && verhdr->sh_size != 0)
 	    goto error_return;
 
@@ -1402,7 +1402,7 @@ elf_slurp_reloc_table_from_section (bfd 
 	  != rel_hdr->sh_size))
     goto error_return;
 
-  native_relocs = allocated;
+  native_relocs = (bfd_byte *) allocated;
 
   entsize = rel_hdr->sh_entsize;
   BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
@@ -1523,7 +1523,7 @@ elf_slurp_reloc_table (bfd *abfd,
     }
 
   amt = (reloc_count + reloc_count2) * sizeof (arelent);
-  relents = bfd_alloc (abfd, amt);
+  relents = (arelent *) bfd_alloc (abfd, amt);
   if (relents == NULL)
     return FALSE;
 
@@ -1674,7 +1674,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
       return NULL;
     }
 
-  x_phdrs = bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
+  x_phdrs = (Elf_External_Phdr *)
+      bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
   if (x_phdrs == NULL)
     {
       bfd_set_error (bfd_error_no_memory);
@@ -1742,7 +1743,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
     contents_size = last_phdr->p_offset + last_phdr->p_filesz;
 
   /* Now we know the size of the whole image we want read in.  */
-  contents = bfd_zmalloc (contents_size);
+  contents = (bfd_byte *) bfd_zmalloc (contents_size);
   if (contents == NULL)
     {
       free (x_phdrs);
@@ -1787,7 +1788,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
   memcpy (contents, &x_ehdr, sizeof x_ehdr);
 
   /* Now we have a memory image of the ELF file contents.  Make a BFD.  */
-  bim = bfd_malloc (sizeof (struct bfd_in_memory));
+  bim = (struct bfd_in_memory *) bfd_malloc (sizeof (struct bfd_in_memory));
   if (bim == NULL)
     {
       free (contents);
Index: bfd/elfcore.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcore.h,v
retrieving revision 1.28
diff -u -u -p -r1.28 elfcore.h
--- bfd/elfcore.h	1 Aug 2008 12:21:28 -0000	1.28
+++ bfd/elfcore.h	7 Sep 2009 22:53:16 -0000
@@ -190,7 +190,7 @@ elf_core_file_p (bfd *abfd)
 
   /* Allocate space for the program headers.  */
   amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
-  i_phdrp = bfd_alloc (abfd, amt);
+  i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
   if (!i_phdrp)
     goto fail;
 
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.352
diff -u -u -p -r1.352 elflink.c
--- bfd/elflink.c	11 Aug 2009 02:21:34 -0000	1.352
+++ bfd/elflink.c	7 Sep 2009 22:53:16 -0000
@@ -634,7 +634,7 @@ bfd_elf_link_record_local_dynamic_symbol
       return 1;
 
   amt = sizeof (*entry);
-  entry = bfd_alloc (input_bfd, amt);
+  entry = (struct elf_link_local_dynamic_entry *) bfd_alloc (input_bfd, amt);
   if (entry == NULL)
     return 0;
 
@@ -719,7 +719,7 @@ static bfd_boolean
 elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
 				      void *data)
 {
-  size_t *count = data;
+  size_t *count = (size_t *) data;
 
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -741,7 +741,7 @@ static bfd_boolean
 elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
 					    void *data)
 {
-  size_t *count = data;
+  size_t *count = (size_t *) data;
 
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -1624,7 +1624,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
   dynamic = (abfd->flags & DYNAMIC) != 0;
 
   shortlen = p - name;
-  shortname = bfd_hash_allocate (&info->hash->table, shortlen + 1);
+  shortname = (char *) bfd_hash_allocate (&info->hash->table, shortlen + 1);
   if (shortname == NULL)
     return FALSE;
   memcpy (shortname, name, shortlen);
@@ -1735,7 +1735,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
 
 nondefault:
   len = strlen (name);
-  shortname = bfd_hash_allocate (&info->hash->table, len);
+  shortname = (char *) bfd_hash_allocate (&info->hash->table, len);
   if (shortname == NULL)
     return FALSE;
   memcpy (shortname, name, shortlen);
@@ -1809,7 +1809,7 @@ nondefault:
 static bfd_boolean
 _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
 {
-  struct elf_info_failed *eif = data;
+  struct elf_info_failed *eif = (struct elf_info_failed *) data;
 
   /* Ignore this if we won't export it.  */
   if (!eif->info->export_dynamic && !h->dynamic)
@@ -1852,7 +1852,7 @@ static bfd_boolean
 _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
 					 void *data)
 {
-  struct elf_find_verdep_info *rinfo = data;
+  struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
   Elf_Internal_Verneed *t;
   Elf_Internal_Vernaux *a;
   bfd_size_type amt;
@@ -1888,7 +1888,7 @@ _bfd_elf_link_find_version_dependencies 
   if (t == NULL)
     {
       amt = sizeof *t;
-      t = bfd_zalloc (rinfo->info->output_bfd, amt);
+      t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->info->output_bfd, amt);
       if (t == NULL)
 	{
 	  rinfo->failed = TRUE;
@@ -1901,7 +1901,7 @@ _bfd_elf_link_find_version_dependencies 
     }
 
   amt = sizeof *a;
-  a = bfd_zalloc (rinfo->info->output_bfd, amt);
+  a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->info->output_bfd, amt);
   if (a == NULL)
     {
       rinfo->failed = TRUE;
@@ -1942,7 +1942,7 @@ _bfd_elf_link_assign_sym_version (struct
   char *p;
   bfd_size_type amt;
 
-  sinfo = data;
+  sinfo = (struct elf_info_failed *) data;
   info = sinfo->info;
 
   if (h->root.type == bfd_link_hash_warning)
@@ -1999,7 +1999,7 @@ _bfd_elf_link_assign_sym_version (struct
 	      struct bfd_elf_version_expr *d;
 
 	      len = p - h->root.root.string;
-	      alc = bfd_malloc (len);
+	      alc = (char *) bfd_malloc (len);
 	      if (alc == NULL)
 		{
 		  sinfo->failed = TRUE;
@@ -2046,7 +2046,7 @@ _bfd_elf_link_assign_sym_version (struct
 	    return TRUE;
 
 	  amt = sizeof *t;
-	  t = bfd_zalloc (info->output_bfd, amt);
+	  t = (struct bfd_elf_version_tree *) bfd_zalloc (info->output_bfd, amt);
 	  if (t == NULL)
 	    {
 	      sinfo->failed = TRUE;
@@ -2148,7 +2148,7 @@ elf_link_read_relocs_from_section (bfd *
       return FALSE;
     }
 
-  erela = external_relocs;
+  erela = (const bfd_byte *) external_relocs;
   erelaend = erela + shdr->sh_size;
   irela = internal_relocs;
   while (erela < erelaend)
@@ -2226,9 +2226,9 @@ _bfd_elf_link_read_relocs (bfd *abfd,
       size = o->reloc_count;
       size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
       if (keep_memory)
-	internal_relocs = alloc2 = bfd_alloc (abfd, size);
+	internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
       else
-	internal_relocs = alloc2 = bfd_malloc (size);
+	internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_malloc (size);
       if (internal_relocs == NULL)
 	goto error_return;
     }
@@ -2311,7 +2311,7 @@ _bfd_elf_link_size_reloc_section (bfd *a
      allocate it with bfd_alloc rather than malloc.  Also since we
      cannot be sure that the contents will actually be filled in,
      we zero the allocated space.  */
-  rel_hdr->contents = bfd_zalloc (abfd, rel_hdr->sh_size);
+  rel_hdr->contents = (unsigned char *) bfd_zalloc (abfd, rel_hdr->sh_size);
   if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
     return FALSE;
 
@@ -2322,7 +2322,8 @@ _bfd_elf_link_size_reloc_section (bfd *a
     {
       struct elf_link_hash_entry **p;
 
-      p = bfd_zmalloc (num_rel_hashes * sizeof (struct elf_link_hash_entry *));
+      p = (struct elf_link_hash_entry **)
+          bfd_zmalloc (num_rel_hashes * sizeof (struct elf_link_hash_entry *));
       if (p == NULL)
 	return FALSE;
 
@@ -2571,7 +2572,7 @@ _bfd_elf_fix_symbol_flags (struct elf_li
 static bfd_boolean
 _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
 {
-  struct elf_info_failed *eif = data;
+  struct elf_info_failed *eif = (struct elf_info_failed *) data;
   bfd *dynobj;
   const struct elf_backend_data *bed;
 
@@ -2752,7 +2753,7 @@ _bfd_elf_link_sec_merge_syms (struct elf
       && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
       && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
     {
-      bfd *output_bfd = data;
+      bfd *output_bfd = (bfd *) data;
 
       h->root.u.def.value =
 	_bfd_merged_section_offset (output_bfd,
@@ -3067,7 +3068,7 @@ _bfd_elf_add_dynamic_entry (struct bfd_l
   BFD_ASSERT (s != NULL);
 
   newsize = s->size + bed->s->sizeof_dyn;
-  newcontents = bfd_realloc (s->contents, newsize);
+  newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize);
   if (newcontents == NULL)
     return FALSE;
 
@@ -3182,7 +3183,7 @@ elf_sort_symbol (const void *arg1, const
 static bfd_boolean
 elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
 {
-  struct elf_strtab_hash *dynstr = data;
+  struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
 
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -3473,7 +3474,7 @@ elf_link_add_object_symbols (bfd *abfd, 
 		}
 
 	      sz = s->size;
-	      msg = bfd_alloc (abfd, sz + 1);
+	      msg = (char *) bfd_alloc (abfd, sz + 1);
 	      if (msg == NULL)
 		goto error_return;
 
@@ -3585,12 +3586,12 @@ error_free_dyn:
 		  unsigned int tagv = dyn.d_un.d_val;
 
 		  amt = sizeof (struct bfd_link_needed_list);
-		  n = bfd_alloc (abfd, amt);
+		  n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
 		  fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
 		  if (n == NULL || fnm == NULL)
 		    goto error_free_dyn;
 		  amt = strlen (fnm) + 1;
-		  anm = bfd_alloc (abfd, amt);
+		  anm = (char *) bfd_alloc (abfd, amt);
 		  if (anm == NULL)
 		    goto error_free_dyn;
 		  memcpy (anm, fnm, amt);
@@ -3608,12 +3609,12 @@ error_free_dyn:
 		  unsigned int tagv = dyn.d_un.d_val;
 
 		  amt = sizeof (struct bfd_link_needed_list);
-		  n = bfd_alloc (abfd, amt);
+		  n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
 		  fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
 		  if (n == NULL || fnm == NULL)
 		    goto error_free_dyn;
 		  amt = strlen (fnm) + 1;
-		  anm = bfd_alloc (abfd, amt);
+		  anm = (char *) bfd_alloc (abfd, amt);
 		  if (anm == NULL)
 		    goto error_free_dyn;
 		  memcpy (anm, fnm, amt);
@@ -3634,12 +3635,12 @@ error_free_dyn:
 		  unsigned int tagv = dyn.d_un.d_val;
 
 		  amt = sizeof (struct bfd_link_needed_list);
-		  n = bfd_alloc (abfd, amt);
+		  n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
 		  fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
 		  if (n == NULL || fnm == NULL)
 		    goto error_free_dyn;
 		  amt = strlen (fnm) + 1;
-		  anm = bfd_alloc (abfd, amt);
+		  anm = (char *) bfd_alloc (abfd, amt);
 		  if (anm == NULL)
 		    goto error_free_dyn;
 		  memcpy (anm, fnm, amt);
@@ -3743,7 +3744,7 @@ error_free_dyn:
       /* We store a pointer to the hash table entry for each external
 	 symbol.  */
       amt = extsymcount * sizeof (struct elf_link_hash_entry *);
-      sym_hash = bfd_alloc (abfd, amt);
+      sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt);
       if (sym_hash == NULL)
 	goto error_free_sym;
       elf_sym_hashes (abfd) = sym_hash;
@@ -3763,7 +3764,7 @@ error_free_dyn:
 	  Elf_Internal_Shdr *versymhdr;
 
 	  versymhdr = &elf_tdata (abfd)->dynversym_hdr;
-	  extversym = bfd_malloc (versymhdr->sh_size);
+	  extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
 	  if (extversym == NULL)
 	    goto error_free_sym;
 	  amt = versymhdr->sh_size;
@@ -4079,7 +4080,7 @@ error_free_dyn:
 		  && isym->st_shndx != SHN_UNDEF)
 		++newlen;
 
-	      newname = bfd_hash_allocate (&htab->root.table, newlen);
+	      newname = (char *) bfd_hash_allocate (&htab->root.table, newlen);
 	      if (newname == NULL)
 		goto error_free_vers;
 	      memcpy (newname, name, namelen);
@@ -4384,7 +4385,8 @@ error_free_dyn:
 		    {
 		      amt = ((isymend - isym + 1)
 			     * sizeof (struct elf_link_hash_entry *));
-		      nondeflt_vers = bfd_malloc (amt);
+		      nondeflt_vers =
+                          (struct elf_link_hash_entry **) bfd_malloc (amt);
 		      if (!nondeflt_vers)
 			goto error_free_vers;
 		    }
@@ -4547,7 +4549,7 @@ error_free_dyn:
 	    continue;
 
 	  amt = p - h->root.root.string;
-	  shortname = bfd_malloc (amt + 1);
+	  shortname = (char *) bfd_malloc (amt + 1);
 	  if (!shortname)
 	    goto error_free_vers;
 	  memcpy (shortname, h->root.root.string, amt);
@@ -4605,7 +4607,7 @@ error_free_dyn:
 	 defined symbol, search time for N weak defined symbols will be
 	 O(N^2). Binary search will cut it down to O(NlogN).  */
       amt = extsymcount * sizeof (struct elf_link_hash_entry *);
-      sorted_sym_hash = bfd_malloc (amt);
+      sorted_sym_hash = (struct elf_link_hash_entry **) bfd_malloc (amt);
       if (sorted_sym_hash == NULL)
 	goto error_return;
       sym_hash = sorted_sym_hash;
@@ -4818,7 +4820,8 @@ error_free_dyn:
       /* Add this bfd to the loaded list.  */
       struct elf_link_loaded_list *n;
 
-      n = bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
+      n = (struct elf_link_loaded_list *)
+          bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
       if (n == NULL)
 	goto error_return;
       n->abfd = abfd;
@@ -4869,7 +4872,7 @@ _bfd_elf_archive_symbol_lookup (bfd *abf
 
   /* First check with only one `@'.  */
   len = strlen (name);
-  copy = bfd_alloc (abfd, len);
+  copy = (char *) bfd_alloc (abfd, len);
   if (copy == NULL)
     return (struct elf_link_hash_entry *) 0 - 1;
 
@@ -4946,8 +4949,8 @@ elf_link_add_archive_symbols (bfd *abfd,
     return TRUE;
   amt = c;
   amt *= sizeof (bfd_boolean);
-  defined = bfd_zmalloc (amt);
-  included = bfd_zmalloc (amt);
+  defined = (bfd_boolean *) bfd_zmalloc (amt);
+  included = (bfd_boolean *) bfd_zmalloc (amt);
   if (defined == NULL || included == NULL)
     goto error_return;
 
@@ -5111,7 +5114,7 @@ struct hash_codes_info
 static bfd_boolean
 elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
 {
-  struct hash_codes_info *inf = data;
+  struct hash_codes_info *inf = (struct hash_codes_info *) data;
   const char *name;
   char *p;
   unsigned long ha;
@@ -5128,7 +5131,7 @@ elf_collect_hash_codes (struct elf_link_
   p = strchr (name, ELF_VER_CHR);
   if (p != NULL)
     {
-      alc = bfd_malloc (p - name + 1);
+      alc = (char *) bfd_malloc (p - name + 1);
       if (alc == NULL)
 	{
 	  inf->error = TRUE;
@@ -5182,7 +5185,7 @@ struct collect_gnu_hash_codes
 static bfd_boolean
 elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *data)
 {
-  struct collect_gnu_hash_codes *s = data;
+  struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
   const char *name;
   char *p;
   unsigned long ha;
@@ -5203,7 +5206,7 @@ elf_collect_gnu_hash_codes (struct elf_l
   p = strchr (name, ELF_VER_CHR);
   if (p != NULL)
     {
-      alc = bfd_malloc (p - name + 1);
+      alc = (char *) bfd_malloc (p - name + 1);
       if (alc == NULL)
 	{
 	  s->error = TRUE;
@@ -5237,7 +5240,7 @@ elf_collect_gnu_hash_codes (struct elf_l
 static bfd_boolean
 elf_renumber_gnu_hash_syms (struct elf_link_hash_entry *h, void *data)
 {
-  struct collect_gnu_hash_codes *s = data;
+  struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
   unsigned long int bucket;
   unsigned long int val;
 
@@ -5349,7 +5352,7 @@ compute_bucket_count (struct bfd_link_in
 	 since the size could be large.  */
       amt = maxsize;
       amt *= sizeof (unsigned long int);
-      counts = bfd_malloc (amt);
+      counts = (unsigned long int *) bfd_malloc (amt);
       if (counts == NULL)
 	return 0;
 
@@ -5631,7 +5634,7 @@ bfd_elf_size_dynamic_sections (bfd *outp
 	      verlen = strlen (verstr);
 	      newlen = namelen + verlen + 3;
 
-	      newname = bfd_malloc (newlen);
+	      newname = (char *) bfd_malloc (newlen);
 	      if (newname == NULL)
 		return FALSE;
 	      memcpy (newname, name, namelen);
@@ -5869,7 +5872,7 @@ bfd_elf_size_dynamic_sections (bfd *outp
 	    }
 
 	  s->size = size;
-	  s->contents = bfd_alloc (output_bfd, s->size);
+	  s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
 	  if (s->contents == NULL && s->size != 0)
 	    return FALSE;
 
@@ -6107,7 +6110,7 @@ bfd_elf_size_dynamic_sections (bfd *outp
 	      }
 
 	    s->size = size;
-	    s->contents = bfd_alloc (output_bfd, s->size);
+	    s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
 	    if (s->contents == NULL)
 	      return FALSE;
 
@@ -6267,7 +6270,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 	  && (s->flags & SEC_EXCLUDE) == 0)
 	{
 	  s->size = dynsymcount * sizeof (Elf_External_Versym);
-	  s->contents = bfd_zalloc (output_bfd, s->size);
+	  s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
 	  if (s->contents == NULL)
 	    return FALSE;
 
@@ -6287,7 +6290,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 
       if (dynsymcount != 0)
 	{
-	  s->contents = bfd_alloc (output_bfd, s->size);
+	  s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
 	  if (s->contents == NULL)
 	    return FALSE;
 
@@ -6314,7 +6317,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 	     time store the values in an array so that we could use them for
 	     optimizations.  */
 	  amt = dynsymcount * sizeof (unsigned long int);
-	  hashcodes = bfd_malloc (amt);
+	  hashcodes = (unsigned long int *) bfd_malloc (amt);
 	  if (hashcodes == NULL)
 	    return FALSE;
 	  hashinf.hashcodes = hashcodes;
@@ -6343,7 +6346,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 	  BFD_ASSERT (s != NULL);
 	  hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
 	  s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
-	  s->contents = bfd_zalloc (output_bfd, s->size);
+	  s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
 	  if (s->contents == NULL)
 	    return FALSE;
 
@@ -6366,7 +6369,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 	     time store the values in an array so that we could use them for
 	     optimizations.  */
 	  amt = dynsymcount * 2 * sizeof (unsigned long int);
-	  cinfo.hashcodes = bfd_malloc (amt);
+	  cinfo.hashcodes = (long unsigned int *) bfd_malloc (amt);
 	  if (cinfo.hashcodes == NULL)
 	    return FALSE;
 
@@ -6402,7 +6405,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 	      BFD_ASSERT (cinfo.min_dynindx == -1);
 	      free (cinfo.hashcodes);
 	      s->size = 5 * 4 + bed->s->arch_size / 8;
-	      contents = bfd_zalloc (output_bfd, s->size);
+	      contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
 	      if (contents == NULL)
 		return FALSE;
 	      s->contents = contents;
@@ -6446,14 +6449,14 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 	      maskwords = 1 << (maskbitslog2 - cinfo.shift1);
 	      amt = bucketcount * sizeof (unsigned long int) * 2;
 	      amt += maskwords * sizeof (bfd_vma);
-	      cinfo.bitmask = bfd_malloc (amt);
+	      cinfo.bitmask = (bfd_vma *) bfd_malloc (amt);
 	      if (cinfo.bitmask == NULL)
 		{
 		  free (cinfo.hashcodes);
 		  return FALSE;
 		}
 
-	      cinfo.counts = (void *) (cinfo.bitmask + maskwords);
+	      cinfo.counts = (long unsigned int *) (cinfo.bitmask + maskwords);
 	      cinfo.indx = cinfo.counts + bucketcount;
 	      cinfo.symindx = dynsymcount - cinfo.nsyms;
 	      memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma));
@@ -6475,7 +6478,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
 
 	      s->size = (4 + bucketcount + cinfo.nsyms) * 4;
 	      s->size += cinfo.maskbits / 8;
-	      contents = bfd_zalloc (output_bfd, s->size);
+	      contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
 	      if (contents == NULL)
 		{
 		  free (cinfo.bitmask);
@@ -6599,7 +6602,8 @@ _bfd_elf_link_hash_newfunc (struct bfd_h
      subclass.  */
   if (entry == NULL)
     {
-      entry = bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
+      entry = (struct bfd_hash_entry *)
+          bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
       if (entry == NULL)
 	return entry;
     }
@@ -6740,7 +6744,7 @@ _bfd_elf_link_hash_table_create (bfd *ab
   struct elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = (struct elf_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -6883,7 +6887,7 @@ bfd_elf_get_bfd_needed_list (bfd *abfd,
 	    goto error_return;
 
 	  amt = sizeof *l;
-	  l = bfd_alloc (abfd, amt);
+	  l = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
 	  if (l == NULL)
 	    goto error_return;
 
@@ -6955,7 +6959,7 @@ elf_create_symbuf (bfd_size_type symcoun
   struct elf_symbuf_head *ssymbuf, *ssymhead;
   bfd_size_type i, shndx_count, total_size;
 
-  indbuf = bfd_malloc2 (symcount, sizeof (*indbuf));
+  indbuf = (Elf_Internal_Sym **) bfd_malloc2 (symcount, sizeof (*indbuf));
   if (indbuf == NULL)
     return NULL;
 
@@ -6975,7 +6979,7 @@ elf_create_symbuf (bfd_size_type symcoun
 
   total_size = ((shndx_count + 1) * sizeof (*ssymbuf)
 		+ (indbufend - indbuf) * sizeof (*ssym));
-  ssymbuf = bfd_malloc (total_size);
+  ssymbuf = (struct elf_symbuf_head *) bfd_malloc (total_size);
   if (ssymbuf == NULL)
     {
       free (indbuf);
@@ -7056,8 +7060,8 @@ bfd_elf_match_symbols_in_sections (asect
   result = FALSE;
   isymbuf1 = NULL;
   isymbuf2 = NULL;
-  ssymbuf1 = elf_tdata (bfd1)->symbuf;
-  ssymbuf2 = elf_tdata (bfd2)->symbuf;
+  ssymbuf1 = (struct elf_symbuf_head *) elf_tdata (bfd1)->symbuf;
+  ssymbuf2 = (struct elf_symbuf_head *) elf_tdata (bfd2)->symbuf;
 
   if (ssymbuf1 == NULL)
     {
@@ -7131,8 +7135,10 @@ bfd_elf_match_symbols_in_sections (asect
       if (count1 == 0 || count2 == 0 || count1 != count2)
 	goto done;
 
-      symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol));
-      symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol));
+      symtable1 = (struct elf_symbol *)
+          bfd_malloc (count1 * sizeof (struct elf_symbol));
+      symtable2 = (struct elf_symbol *)
+          bfd_malloc (count2 * sizeof (struct elf_symbol));
       if (symtable1 == NULL || symtable2 == NULL)
 	goto done;
 
@@ -7173,8 +7179,10 @@ bfd_elf_match_symbols_in_sections (asect
       goto done;
     }
 
-  symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol));
-  symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol));
+  symtable1 = (struct elf_symbol *)
+      bfd_malloc (symcount1 * sizeof (struct elf_symbol));
+  symtable2 = (struct elf_symbol *)
+      bfd_malloc (symcount2 * sizeof (struct elf_symbol));
   if (symtable1 == NULL || symtable2 == NULL)
     goto done;
 
@@ -7878,8 +7886,8 @@ struct elf_link_sort_rela
 static int
 elf_link_sort_cmp1 (const void *A, const void *B)
 {
-  const struct elf_link_sort_rela *a = A;
-  const struct elf_link_sort_rela *b = B;
+  const struct elf_link_sort_rela *a = (const struct elf_link_sort_rela *) A;
+  const struct elf_link_sort_rela *b = (const struct elf_link_sort_rela *) B;
   int relativea, relativeb;
 
   relativea = a->type == reloc_class_relative;
@@ -7903,8 +7911,8 @@ elf_link_sort_cmp1 (const void *A, const
 static int
 elf_link_sort_cmp2 (const void *A, const void *B)
 {
-  const struct elf_link_sort_rela *a = A;
-  const struct elf_link_sort_rela *b = B;
+  const struct elf_link_sort_rela *a = (const struct elf_link_sort_rela *) A;
+  const struct elf_link_sort_rela *b = (const struct elf_link_sort_rela *) B;
   int copya, copyb;
 
   if (a->u.offset < b->u.offset)
@@ -8104,7 +8112,7 @@ elf_link_sort_relocs (bfd *abfd, struct 
   count = dynamic_relocs->size / ext_size;
   if (count == 0)
     return 0;
-  sort = bfd_zmalloc (sort_elt * count);
+  sort = (bfd_byte *) bfd_zmalloc (sort_elt * count);
 
   if (sort == NULL)
     {
@@ -8273,7 +8281,8 @@ elf_link_output_sym (struct elf_final_li
 	  bfd_size_type amt;
 
 	  amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
-	  destshndx = bfd_realloc (destshndx, amt * 2);
+	  destshndx = (Elf_External_Sym_Shndx *) bfd_realloc (destshndx,
+                                                              amt * 2);
 	  if (destshndx == NULL)
 	    return 0;
 	  finfo->symshndxbuf = destshndx;
@@ -8399,7 +8408,7 @@ elf_link_check_versioned_symbol (struct 
 
       /* Read in any version definitions.  */
       versymhdr = &elf_tdata (input)->dynversym_hdr;
-      extversym = bfd_malloc (versymhdr->sh_size);
+      extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
       if (extversym == NULL)
 	goto error_ret;
 
@@ -8467,7 +8476,7 @@ elf_link_check_versioned_symbol (struct 
 static bfd_boolean
 elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
 {
-  struct elf_outext_info *eoinfo = data;
+  struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
   struct elf_final_link_info *finfo = eoinfo->finfo;
   bfd_boolean strip;
   Elf_Internal_Sym sym;
@@ -9809,8 +9818,8 @@ elf_reloc_link_order (bfd *output_bfd,
       bfd_boolean ok;
       const char *sym_name;
 
-      size = bfd_get_reloc_size (howto);
-      buf = bfd_zmalloc (size);
+      size = (bfd_size_type) bfd_get_reloc_size (howto);
+      buf = (bfd_byte *) bfd_zmalloc (size);
       if (buf == NULL)
 	return FALSE;
       rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
@@ -10368,7 +10377,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
     finfo.symbuf_size = max_sym_count;
   amt = finfo.symbuf_size;
   amt *= bed->s->sizeof_sym;
-  finfo.symbuf = bfd_malloc (amt);
+  finfo.symbuf = (bfd_byte *) bfd_malloc (amt);
   if (finfo.symbuf == NULL)
     goto error_return;
   if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF))
@@ -10377,7 +10386,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
       amt = 2 * max_sym_count + elf_numsections (abfd) + 1000;
       finfo.shndxbuf_size = amt;
       amt *= sizeof (Elf_External_Sym_Shndx);
-      finfo.symshndxbuf = bfd_zmalloc (amt);
+      finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt);
       if (finfo.symshndxbuf == NULL)
 	goto error_return;
     }
@@ -10428,7 +10437,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
      files.  */
   if (max_contents_size != 0)
     {
-      finfo.contents = bfd_malloc (max_contents_size);
+      finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
       if (finfo.contents == NULL)
 	goto error_return;
     }
@@ -10444,7 +10453,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
     {
       amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
       amt *= sizeof (Elf_Internal_Rela);
-      finfo.internal_relocs = bfd_malloc (amt);
+      finfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
       if (finfo.internal_relocs == NULL)
 	goto error_return;
     }
@@ -10452,22 +10461,22 @@ bfd_elf_final_link (bfd *abfd, struct bf
   if (max_sym_count != 0)
     {
       amt = max_sym_count * bed->s->sizeof_sym;
-      finfo.external_syms = bfd_malloc (amt);
+      finfo.external_syms = (bfd_byte *) bfd_malloc (amt);
       if (finfo.external_syms == NULL)
 	goto error_return;
 
       amt = max_sym_count * sizeof (Elf_Internal_Sym);
-      finfo.internal_syms = bfd_malloc (amt);
+      finfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt);
       if (finfo.internal_syms == NULL)
 	goto error_return;
 
       amt = max_sym_count * sizeof (long);
-      finfo.indices = bfd_malloc (amt);
+      finfo.indices = (long int *) bfd_malloc (amt);
       if (finfo.indices == NULL)
 	goto error_return;
 
       amt = max_sym_count * sizeof (asection *);
-      finfo.sections = bfd_malloc (amt);
+      finfo.sections = (asection **) bfd_malloc (amt);
       if (finfo.sections == NULL)
 	goto error_return;
     }
@@ -10475,7 +10484,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
   if (max_sym_shndx_count != 0)
     {
       amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
-      finfo.locsym_shndx = bfd_malloc (amt);
+      finfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
       if (finfo.locsym_shndx == NULL)
 	goto error_return;
     }
@@ -11080,7 +11089,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
 
   if (attr_section)
     {
-      bfd_byte *contents = bfd_malloc (attr_size);
+      bfd_byte *contents = (bfd_byte *) bfd_malloc (attr_size);
       if (contents == NULL)
 	return FALSE;	/* Bail out and fail.  */
       bfd_elf_set_obj_attr_contents (abfd, contents, attr_size);
@@ -11422,7 +11431,8 @@ elf_gc_sweep_symbol (struct elf_link_has
       && !h->root.u.def.section->gc_mark
       && !(h->root.u.def.section->owner->flags & DYNAMIC))
     {
-      struct elf_gc_sweep_symbol_info *inf = data;
+      struct elf_gc_sweep_symbol_info *inf =
+          (struct elf_gc_sweep_symbol_info *) data;
       (*inf->hide_symbol) (inf->info, h, TRUE);
     }
 
@@ -11803,7 +11813,8 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
  win:
   if (!child->vtable)
     {
-      child->vtable = bfd_zalloc (abfd, sizeof (*child->vtable));
+      child->vtable = (struct elf_link_virtual_table_entry *)
+          bfd_zalloc (abfd, sizeof (*child->vtable));
       if (!child->vtable)
 	return FALSE;
     }
@@ -11835,7 +11846,8 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATT
 
   if (!h->vtable)
     {
-      h->vtable = bfd_zalloc (abfd, sizeof (*h->vtable));
+      h->vtable = (struct elf_link_virtual_table_entry *)
+          bfd_zalloc (abfd, sizeof (*h->vtable));
       if (!h->vtable)
 	return FALSE;
     }
@@ -11868,7 +11880,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATT
 
       if (ptr)
 	{
-	  ptr = bfd_realloc (ptr - 1, bytes);
+	  ptr = (bfd_boolean *) bfd_realloc (ptr - 1, bytes);
 
 	  if (ptr != NULL)
 	    {
@@ -11880,7 +11892,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATT
 	    }
 	}
       else
-	ptr = bfd_zmalloc (bytes);
+	ptr = (bfd_boolean *) bfd_zmalloc (bytes);
 
       if (ptr == NULL)
 	return FALSE;
@@ -11906,7 +11918,7 @@ struct alloc_got_off_arg {
 static bfd_boolean
 elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg)
 {
-  struct alloc_got_off_arg *gofarg = arg;
+  struct alloc_got_off_arg *gofarg = (struct alloc_got_off_arg *) arg;
   bfd *obfd = gofarg->info->output_bfd;
   const struct elf_backend_data *bed = get_elf_backend_data (obfd);
 
@@ -12006,7 +12018,7 @@ bfd_elf_gc_common_final_link (bfd *abfd,
 bfd_boolean
 bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
 {
-  struct elf_reloc_cookie *rcookie = cookie;
+  struct elf_reloc_cookie *rcookie = (struct elf_reloc_cookie *) cookie;
 
   if (rcookie->bad_symtab)
     rcookie->rel = rcookie->rels;
Index: bfd/format.c
===================================================================
RCS file: /cvs/src/src/bfd/format.c,v
retrieving revision 1.28
diff -u -u -p -r1.28 format.c
--- bfd/format.c	2 Sep 2009 07:18:37 -0000	1.28
+++ bfd/format.c	7 Sep 2009 22:53:16 -0000
@@ -149,7 +149,7 @@ bfd_check_format_matches (bfd *abfd, bfd
       bfd_size_type amt;
 
       amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries;
-      matching_vector = bfd_malloc (amt);
+      matching_vector = (const bfd_target **) bfd_malloc (amt);
       if (!matching_vector)
 	return FALSE;
     }
Index: bfd/hash.c
===================================================================
RCS file: /cvs/src/src/bfd/hash.c,v
retrieving revision 1.29
diff -u -u -p -r1.29 hash.c
--- bfd/hash.c	2 Sep 2009 07:18:37 -0000	1.29
+++ bfd/hash.c	7 Sep 2009 22:53:16 -0000
@@ -374,7 +374,8 @@ bfd_hash_table_init_n (struct bfd_hash_t
       bfd_set_error (bfd_error_no_memory);
       return FALSE;
     }
-  table->table = objalloc_alloc ((struct objalloc *) table->memory, alloc);
+  table->table = (struct bfd_hash_entry **)
+      objalloc_alloc ((struct objalloc *) table->memory, alloc);
   if (table->table == NULL)
     {
       bfd_set_error (bfd_error_no_memory);
@@ -407,7 +408,7 @@ bfd_hash_table_init (struct bfd_hash_tab
 void
 bfd_hash_table_free (struct bfd_hash_table *table)
 {
-  objalloc_free (table->memory);
+  objalloc_free ((struct objalloc *) table->memory);
   table->memory = NULL;
 }
 
@@ -581,7 +582,8 @@ bfd_hash_newfunc (struct bfd_hash_entry 
 		  const char *string ATTRIBUTE_UNUSED)
 {
   if (entry == NULL)
-    entry = bfd_hash_allocate (table, sizeof (* entry));
+    entry = (struct bfd_hash_entry *) bfd_hash_allocate (table,
+                                                         sizeof (* entry));
   return entry;
 }
 
@@ -676,7 +678,8 @@ strtab_hash_newfunc (struct bfd_hash_ent
   /* 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 strtab_hash_entry *) bfd_hash_allocate (table,
+                                                          sizeof (* ret));
   if (ret == NULL)
     return NULL;
 
@@ -708,7 +711,7 @@ _bfd_stringtab_init (void)
   struct bfd_strtab_hash *table;
   bfd_size_type amt = sizeof (* table);
 
-  table = bfd_malloc (amt);
+  table = (struct bfd_strtab_hash *) bfd_malloc (amt);
   if (table == NULL)
     return NULL;
 
@@ -771,7 +774,8 @@ _bfd_stringtab_add (struct bfd_strtab_ha
     }
   else
     {
-      entry = bfd_hash_allocate (&tab->table, sizeof (* entry));
+      entry = (struct strtab_hash_entry *) bfd_hash_allocate (&tab->table,
+                                                              sizeof (* entry));
       if (entry == NULL)
 	return (bfd_size_type) -1;
       if (! copy)
@@ -780,7 +784,7 @@ _bfd_stringtab_add (struct bfd_strtab_ha
 	{
 	  char *n;
 
-	  n = bfd_hash_allocate (&tab->table, strlen (str) + 1);
+	  n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
 	  if (n == NULL)
 	    return (bfd_size_type) -1;
 	  entry->root.string = n;
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.38
diff -u -u -p -r1.38 ihex.c
--- bfd/ihex.c	2 Sep 2009 07:18:37 -0000	1.38
+++ bfd/ihex.c	7 Sep 2009 22:53:16 -0000
@@ -177,7 +177,7 @@ ihex_mkobject (bfd *abfd)
 {
   struct ihex_data_struct *tdata;
 
-  tdata = bfd_alloc (abfd, sizeof (* tdata));
+  tdata = (struct ihex_data_struct *) bfd_alloc (abfd, sizeof (* tdata));
   if (tdata == NULL)
     return FALSE;
 
@@ -309,7 +309,7 @@ ihex_scan (bfd *abfd)
 	  chars = len * 2 + 2;
 	  if (chars >= bufsize)
 	    {
-	      buf = bfd_realloc (buf, (bfd_size_type) chars);
+	      buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
 	      if (buf == NULL)
 		goto error_return;
 	      bufsize = chars;
@@ -361,7 +361,7 @@ ihex_scan (bfd *abfd)
 
 		  sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
 		  amt = strlen (secbuf) + 1;
-		  secname = bfd_alloc (abfd, amt);
+		  secname = (char *) bfd_alloc (abfd, amt);
 		  if (secname == NULL)
 		    goto error_return;
 		  strcpy (secname, secbuf);
@@ -583,7 +583,7 @@ ihex_read_section (bfd *abfd, asection *
 
       if (len * 2 > bufsize)
 	{
-	  buf = bfd_realloc (buf, (bfd_size_type) len * 2);
+	  buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2);
 	  if (buf == NULL)
 	    goto error_return;
 	  bufsize = len * 2;
@@ -640,7 +640,8 @@ ihex_get_section_contents (bfd *abfd,
       section->used_by_bfd = bfd_alloc (abfd, section->size);
       if (section->used_by_bfd == NULL)
 	return FALSE;
-      if (! ihex_read_section (abfd, section, section->used_by_bfd))
+      if (! ihex_read_section (abfd, section,
+                               (bfd_byte *) section->used_by_bfd))
 	return FALSE;
     }
 
@@ -668,11 +669,11 @@ ihex_set_section_contents (bfd *abfd,
       || (section->flags & SEC_LOAD) == 0)
     return TRUE;
 
-  n = bfd_alloc (abfd, sizeof (* n));
+  n = (struct ihex_data_list *) bfd_alloc (abfd, sizeof (* n));
   if (n == NULL)
     return FALSE;
 
-  data = bfd_alloc (abfd, count);
+  data = (bfd_byte *) bfd_alloc (abfd, count);
   if (data == NULL)
     return FALSE;
   memcpy (data, location, (size_t) count);
Index: bfd/libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.49
diff -u -u -p -r1.49 libbfd.c
--- bfd/libbfd.c	20 Feb 2008 17:42:36 -0000	1.49
+++ bfd/libbfd.c	7 Sep 2009 22:53:16 -0000
@@ -549,35 +549,35 @@ DESCRIPTION
 bfd_vma
 bfd_getb16 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   return (addr[0] << 8) | addr[1];
 }
 
 bfd_vma
 bfd_getl16 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   return (addr[1] << 8) | addr[0];
 }
 
 bfd_signed_vma
 bfd_getb_signed_16 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   return COERCE16 ((addr[0] << 8) | addr[1]);
 }
 
 bfd_signed_vma
 bfd_getl_signed_16 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   return COERCE16 ((addr[1] << 8) | addr[0]);
 }
 
 void
 bfd_putb16 (bfd_vma data, void *p)
 {
-  bfd_byte *addr = p;
+  bfd_byte *addr = (bfd_byte *) p;
   addr[0] = (data >> 8) & 0xff;
   addr[1] = data & 0xff;
 }
@@ -585,7 +585,7 @@ bfd_putb16 (bfd_vma data, void *p)
 void
 bfd_putl16 (bfd_vma data, void *p)
 {
-  bfd_byte *addr = p;
+  bfd_byte *addr = (bfd_byte *) p;
   addr[0] = data & 0xff;
   addr[1] = (data >> 8) & 0xff;
 }
@@ -593,7 +593,7 @@ bfd_putl16 (bfd_vma data, void *p)
 bfd_vma
 bfd_getb32 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   unsigned long v;
 
   v = (unsigned long) addr[0] << 24;
@@ -606,7 +606,7 @@ bfd_getb32 (const void *p)
 bfd_vma
 bfd_getl32 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   unsigned long v;
 
   v = (unsigned long) addr[0];
@@ -619,7 +619,7 @@ bfd_getl32 (const void *p)
 bfd_signed_vma
 bfd_getb_signed_32 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   unsigned long v;
 
   v = (unsigned long) addr[0] << 24;
@@ -632,7 +632,7 @@ bfd_getb_signed_32 (const void *p)
 bfd_signed_vma
 bfd_getl_signed_32 (const void *p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   unsigned long v;
 
   v = (unsigned long) addr[0];
@@ -646,7 +646,7 @@ bfd_uint64_t
 bfd_getb64 (const void *p ATTRIBUTE_UNUSED)
 {
 #ifdef BFD_HOST_64_BIT
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   bfd_uint64_t v;
 
   v  = addr[0]; v <<= 8;
@@ -669,7 +669,7 @@ bfd_uint64_t
 bfd_getl64 (const void *p ATTRIBUTE_UNUSED)
 {
 #ifdef BFD_HOST_64_BIT
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   bfd_uint64_t v;
 
   v  = addr[7]; v <<= 8;
@@ -693,7 +693,7 @@ bfd_int64_t
 bfd_getb_signed_64 (const void *p ATTRIBUTE_UNUSED)
 {
 #ifdef BFD_HOST_64_BIT
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   bfd_uint64_t v;
 
   v  = addr[0]; v <<= 8;
@@ -716,7 +716,7 @@ bfd_int64_t
 bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED)
 {
 #ifdef BFD_HOST_64_BIT
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   bfd_uint64_t v;
 
   v  = addr[7]; v <<= 8;
@@ -738,7 +738,7 @@ bfd_getl_signed_64 (const void *p ATTRIB
 void
 bfd_putb32 (bfd_vma data, void *p)
 {
-  bfd_byte *addr = p;
+  bfd_byte *addr = (bfd_byte *) p;
   addr[0] = (data >> 24) & 0xff;
   addr[1] = (data >> 16) & 0xff;
   addr[2] = (data >>  8) & 0xff;
@@ -748,7 +748,7 @@ bfd_putb32 (bfd_vma data, void *p)
 void
 bfd_putl32 (bfd_vma data, void *p)
 {
-  bfd_byte *addr = p;
+  bfd_byte *addr = (bfd_byte *) p;
   addr[0] = data & 0xff;
   addr[1] = (data >>  8) & 0xff;
   addr[2] = (data >> 16) & 0xff;
@@ -759,7 +759,7 @@ void
 bfd_putb64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
 {
 #ifdef BFD_HOST_64_BIT
-  bfd_byte *addr = p;
+  bfd_byte *addr = (bfd_byte *) p;
   addr[0] = (data >> (7*8)) & 0xff;
   addr[1] = (data >> (6*8)) & 0xff;
   addr[2] = (data >> (5*8)) & 0xff;
@@ -777,7 +777,7 @@ void
 bfd_putl64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
 {
 #ifdef BFD_HOST_64_BIT
-  bfd_byte *addr = p;
+  bfd_byte *addr = (bfd_byte *) p;
   addr[7] = (data >> (7*8)) & 0xff;
   addr[6] = (data >> (6*8)) & 0xff;
   addr[5] = (data >> (5*8)) & 0xff;
@@ -794,7 +794,7 @@ bfd_putl64 (bfd_uint64_t data ATTRIBUTE_
 void
 bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
 {
-  bfd_byte *addr = p;
+  bfd_byte *addr = (bfd_byte *) p;
   int i;
   int bytes;
 
@@ -814,7 +814,7 @@ bfd_put_bits (bfd_uint64_t data, void *p
 bfd_uint64_t
 bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
 {
-  const bfd_byte *addr = p;
+  const bfd_byte *addr = (const bfd_byte *) p;
   bfd_uint64_t data;
   int i;
   int bytes;
Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.74
diff -u -u -p -r1.74 linker.c
--- bfd/linker.c	2 Sep 2009 07:18:37 -0000	1.74
+++ bfd/linker.c	7 Sep 2009 22:53:17 -0000
@@ -444,7 +444,8 @@ _bfd_link_hash_newfunc (struct bfd_hash_
      subclass.  */
   if (entry == NULL)
     {
-      entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
+      entry = (struct bfd_hash_entry *)
+          bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
       if (entry == NULL)
 	return entry;
     }
@@ -548,7 +549,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
              references to SYM with references to __wrap_SYM.  */
 
 	  amt = strlen (l) + sizeof WRAP + 1;
-	  n = bfd_malloc (amt);
+	  n = (char *) bfd_malloc (amt);
 	  if (n == NULL)
 	    return NULL;
 
@@ -579,7 +580,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
              with references to SYM.  */
 
 	  amt = strlen (l + sizeof REAL - 1) + 2;
-	  n = bfd_malloc (amt);
+	  n = (char *) bfd_malloc (amt);
 	  if (n == NULL)
 	    return NULL;
 
@@ -678,7 +679,7 @@ _bfd_generic_link_hash_newfunc (struct b
      subclass.  */
   if (entry == NULL)
     {
-      entry =
+      entry = (struct bfd_hash_entry *)
 	bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry));
       if (entry == NULL)
 	return entry;
@@ -707,7 +708,7 @@ _bfd_generic_link_hash_table_create (bfd
   struct generic_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct generic_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = (struct generic_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
   if (! _bfd_link_hash_table_init (&ret->root, abfd,
@@ -748,7 +749,8 @@ bfd_generic_link_read_symbols (bfd *abfd
       symsize = bfd_get_symtab_upper_bound (abfd);
       if (symsize < 0)
 	return FALSE;
-      bfd_get_outsymbols (abfd) = bfd_alloc (abfd, symsize);
+      bfd_get_outsymbols (abfd) = (struct bfd_symbol **) bfd_alloc (abfd,
+                                                                    symsize);
       if (bfd_get_outsymbols (abfd) == NULL && symsize != 0)
 	return FALSE;
       symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd));
@@ -880,7 +882,8 @@ archive_hash_newfunc (struct bfd_hash_en
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (ret == NULL)
-    ret = bfd_hash_allocate (table, sizeof (struct archive_hash_entry));
+    ret = (struct archive_hash_entry *)
+        bfd_hash_allocate (table, sizeof (struct archive_hash_entry));
   if (ret == NULL)
     return NULL;
 
@@ -1051,7 +1054,7 @@ _bfd_generic_link_add_archive_symbols
 	  if (info->pei386_auto_import)
 	    {
 	      bfd_size_type amt = strlen (h->root.string) + 10;
-	      char *buf = bfd_malloc (amt);
+	      char *buf = (char *) bfd_malloc (amt);
 	      if (buf == NULL)
 		return FALSE;
 
@@ -1242,7 +1245,7 @@ generic_link_check_archive_element (bfd 
 	     attached to symbfd to ensure that it is in a BFD which
 	     will be linked in.  */
 	  h->type = bfd_link_hash_common;
-	  h->u.c.p =
+	  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)
@@ -1691,7 +1694,7 @@ _bfd_generic_link_add_one_symbol (struct
 	  if (h->type == bfd_link_hash_new)
 	    bfd_link_add_undef (info->hash, h);
 	  h->type = bfd_link_hash_common;
-	  h->u.c.p =
+	  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)
@@ -1972,7 +1975,7 @@ _bfd_generic_link_add_one_symbol (struct
 		char *w;
 		size_t len = strlen (string) + 1;
 
-		w = bfd_hash_allocate (&info->hash->table, len);
+		w = (char *) bfd_hash_allocate (&info->hash->table, len);
 		if (w == NULL)
 		  return FALSE;
 		memcpy (w, string, len);
@@ -2059,7 +2062,7 @@ _bfd_generic_final_link (bfd *abfd, stru
 						       input_section);
 		  if (relsize < 0)
 		    return FALSE;
-		  relocs = bfd_malloc (relsize);
+		  relocs = (arelent **) bfd_malloc (relsize);
 		  if (!relocs && relsize != 0)
 		    return FALSE;
 		  symbols = _bfd_generic_link_get_symbols (input_bfd);
@@ -2081,7 +2084,7 @@ _bfd_generic_final_link (bfd *abfd, stru
 
 	      amt = o->reloc_count;
 	      amt *= sizeof (arelent *);
-	      o->orelocation = bfd_alloc (abfd, amt);
+	      o->orelocation = (struct reloc_cache_entry **) bfd_alloc (abfd, amt);
 	      if (!o->orelocation)
 		return FALSE;
 	      o->flags |= SEC_RELOC;
@@ -2135,7 +2138,7 @@ generic_add_output_symbol (bfd *output_b
 	*psymalloc *= 2;
       amt = *psymalloc;
       amt *= sizeof (asymbol *);
-      newsyms = bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
+      newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
       if (newsyms == NULL)
 	return FALSE;
       bfd_get_outsymbols (output_bfd) = newsyms;
@@ -2212,7 +2215,7 @@ _bfd_generic_link_output_symbols (bfd *o
 	  || bfd_is_ind_section (bfd_get_section (sym)))
 	{
 	  if (sym->udata.p != NULL)
-	    h = sym->udata.p;
+	    h = (struct generic_link_hash_entry *) sym->udata.p;
 	  else if ((sym->flags & BSF_CONSTRUCTOR) != 0)
 	    {
 	      /* This case normally means that the main linker code
@@ -2451,7 +2454,8 @@ bfd_boolean
 _bfd_generic_link_write_global_symbol (struct generic_link_hash_entry *h,
 				       void *data)
 {
-  struct generic_write_global_symbol_info *wginfo = data;
+  struct generic_write_global_symbol_info *wginfo =
+      (struct generic_write_global_symbol_info *) data;
   asymbol *sym;
 
   if (h->root.type == bfd_link_hash_warning)
@@ -2508,7 +2512,7 @@ _bfd_generic_reloc_link_order (bfd *abfd
   if (sec->orelocation == NULL)
     abort ();
 
-  r = bfd_alloc (abfd, sizeof (arelent));
+  r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
   if (r == NULL)
     return FALSE;
 
@@ -2556,7 +2560,7 @@ _bfd_generic_reloc_link_order (bfd *abfd
       file_ptr loc;
 
       size = bfd_get_reloc_size (r->howto);
-      buf = bfd_zmalloc (size);
+      buf = (bfd_byte *) bfd_zmalloc (size);
       if (buf == NULL)
 	return FALSE;
       rstat = _bfd_relocate_contents (r->howto, abfd,
@@ -2671,7 +2675,7 @@ default_data_link_order (bfd *abfd,
   if (fill_size != 0 && fill_size < size)
     {
       bfd_byte *p;
-      fill = bfd_malloc (size);
+      fill = (bfd_byte *) bfd_malloc (size);
       if (fill == NULL)
 	return FALSE;
       p = fill;
@@ -2781,7 +2785,7 @@ default_indirect_link_order (bfd *output
 	      /* sym->udata may have been set by
 		 generic_link_add_symbol_list.  */
 	      if (sym->udata.p != NULL)
-		h = sym->udata.p;
+		h = (struct bfd_link_hash_entry *) sym->udata.p;
 	      else if (bfd_is_und_section (bfd_get_section (sym)))
 		h = bfd_wrapped_link_hash_lookup (output_bfd, info,
 						  bfd_asymbol_name (sym),
@@ -2816,7 +2820,7 @@ default_indirect_link_order (bfd *output
       sec_size = (input_section->rawsize > input_section->size
 		  ? input_section->rawsize
 		  : input_section->size);
-      contents = bfd_malloc (sec_size);
+      contents = (bfd_byte *) bfd_malloc (sec_size);
       if (contents == NULL && sec_size != 0)
 	goto error_return;
       new_contents = (bfd_get_relocated_section_contents
@@ -2949,7 +2953,8 @@ bfd_section_already_linked_table_insert
 
   /* Allocate the memory from the same obstack as the hash table is
      kept in.  */
-  l = bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l);
+  l = (struct bfd_section_already_linked *)
+      bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l);
   if (l == NULL)
     return FALSE;
   l->sec = sec;
@@ -2964,7 +2969,8 @@ already_linked_newfunc (struct bfd_hash_
 			const char *string ATTRIBUTE_UNUSED)
 {
   struct bfd_section_already_linked_hash_entry *ret =
-    bfd_hash_allocate (table, sizeof *ret);
+    (struct bfd_section_already_linked_hash_entry *)
+      bfd_hash_allocate (table, sizeof *ret);
 
   if (ret == NULL)
     return NULL;
Index: bfd/merge.c
===================================================================
RCS file: /cvs/src/src/bfd/merge.c,v
retrieving revision 1.37
diff -u -u -p -r1.37 merge.c
--- bfd/merge.c	2 Sep 2009 07:18:37 -0000	1.37
+++ bfd/merge.c	7 Sep 2009 22:53:17 -0000
@@ -108,7 +108,8 @@ sec_merge_hash_newfunc (struct bfd_hash_
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (entry == NULL)
-    entry = bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry));
+    entry = (struct bfd_hash_entry *)
+        bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry));
   if (entry == NULL)
     return NULL;
 
@@ -235,7 +236,7 @@ sec_merge_init (unsigned int entsize, bf
 {
   struct sec_merge_hash *table;
 
-  table = bfd_malloc (sizeof (struct sec_merge_hash));
+  table = (struct sec_merge_hash *) bfd_malloc (sizeof (struct sec_merge_hash));
   if (table == NULL)
     return NULL;
 
@@ -293,7 +294,7 @@ sec_merge_emit (bfd *abfd, struct sec_me
 
   if (alignment_power)
     {
-      pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
+      pad = (char *) bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
       if (pad == NULL)
 	return FALSE;
     }
@@ -390,7 +391,8 @@ _bfd_add_merge_section (bfd *abfd, void 
   if (sinfo == NULL)
     {
       /* Initialize the information we need to keep track of.  */
-      sinfo = bfd_alloc (abfd, sizeof (struct sec_merge_info));
+      sinfo = (struct sec_merge_info *)
+          bfd_alloc (abfd, sizeof (struct sec_merge_info));
       if (sinfo == NULL)
 	goto error_return;
       sinfo->next = (struct sec_merge_info *) *psinfo;
@@ -601,7 +603,7 @@ merge_strings (struct sec_merge_info *si
 
   /* Now sort the strings */
   amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
-  array = bfd_malloc (amt);
+  array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
   if (array == NULL)
     goto alloc_failure;
 
Index: bfd/opncls.c
===================================================================
RCS file: /cvs/src/src/bfd/opncls.c,v
retrieving revision 1.57
diff -u -u -p -r1.57 opncls.c
--- bfd/opncls.c	2 Sep 2009 07:18:37 -0000	1.57
+++ bfd/opncls.c	7 Sep 2009 22:53:17 -0000
@@ -52,7 +52,7 @@ _bfd_new_bfd (void)
 {
   bfd *nbfd;
 
-  nbfd = bfd_zmalloc (sizeof (bfd));
+  nbfd = (bfd *) bfd_zmalloc (sizeof (bfd));
   if (nbfd == NULL)
     return NULL;
 
@@ -342,7 +342,7 @@ DESCRIPTION
 bfd *
 bfd_openstreamr (const char *filename, const char *target, void *streamarg)
 {
-  FILE *stream = streamarg;
+  FILE *stream = (FILE *) streamarg;
   bfd *nbfd;
   const bfd_target *target_vec;
 
@@ -438,14 +438,14 @@ struct opncls
 static file_ptr
 opncls_btell (struct bfd *abfd)
 {
-  struct opncls *vec = abfd->iostream;
+  struct opncls *vec = (struct opncls *) abfd->iostream;
   return vec->where;
 }
 
 static int
 opncls_bseek (struct bfd *abfd, file_ptr offset, int whence)
 {
-  struct opncls *vec = abfd->iostream;
+  struct opncls *vec = (struct opncls *) abfd->iostream;
   switch (whence)
     {
     case SEEK_SET: vec->where = offset; break;
@@ -458,7 +458,7 @@ opncls_bseek (struct bfd *abfd, file_ptr
 static file_ptr
 opncls_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
 {
-  struct opncls *vec = abfd->iostream;
+  struct opncls *vec = (struct opncls *) abfd->iostream;
   file_ptr nread = (vec->pread) (abfd, vec->stream, buf, nbytes, vec->where);
   if (nread < 0)
     return nread;
@@ -477,7 +477,7 @@ opncls_bwrite (struct bfd *abfd ATTRIBUT
 static int
 opncls_bclose (struct bfd *abfd)
 {
-  struct opncls *vec = abfd->iostream;
+  struct opncls *vec = (struct opncls *) abfd->iostream;
   /* Since the VEC's memory is bound to the bfd deleting the bfd will
      free it.  */
   int status = 0;
@@ -496,7 +496,7 @@ opncls_bflush (struct bfd *abfd ATTRIBUT
 static int
 opncls_bstat (struct bfd *abfd, struct stat *sb)
 {
-  struct opncls *vec = abfd->iostream;
+  struct opncls *vec = (struct opncls *) abfd->iostream;
 
   memset (sb, 0, sizeof (*sb));
   if (vec->stat == NULL)
@@ -564,7 +564,7 @@ bfd_openr_iovec (const char *filename, c
       return NULL;
     }
 
-  vec = bfd_zalloc (nbfd, sizeof (struct opncls));
+  vec = (struct opncls *) bfd_zalloc (nbfd, sizeof (struct opncls));
   vec->stream = stream;
   vec->pread = pread;
   vec->close = close;
@@ -708,7 +708,7 @@ bfd_close (bfd *abfd)
       /* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io
 	 vector.
 	 Until that's done, at least don't leak memory.  */
-      struct bfd_in_memory *bim = abfd->iostream;
+      struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
       free (bim->buffer);
       free (bim);
       ret = TRUE;
@@ -819,7 +819,7 @@ bfd_make_writable (bfd *abfd)
       return FALSE;
     }
 
-  bim = bfd_malloc (sizeof (struct bfd_in_memory));
+  bim = (struct bfd_in_memory *) bfd_malloc (sizeof (struct bfd_in_memory));
   if (bim == NULL)
     return FALSE;	/* bfd_error already set.  */
   abfd->iostream = bim;
@@ -917,7 +917,7 @@ bfd_alloc (bfd *abfd, bfd_size_type size
       return NULL;
     }
 
-  ret = objalloc_alloc (abfd->memory, (unsigned long) size);
+  ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size);
   if (ret == NULL)
     bfd_set_error (bfd_error_no_memory);
   return ret;
@@ -956,7 +956,7 @@ bfd_alloc2 (bfd *abfd, bfd_size_type nme
       return NULL;
     }
 
-  ret = objalloc_alloc (abfd->memory, (unsigned long) size);
+  ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size);
   if (ret == NULL)
     bfd_set_error (bfd_error_no_memory);
   return ret;
@@ -1266,7 +1266,7 @@ find_separate_debug_file (bfd *abfd, con
     if (IS_DIR_SEPARATOR (abfd->filename[dirlen - 1]))
       break;
 
-  dir = bfd_malloc (dirlen + 1);
+  dir = (char *) bfd_malloc (dirlen + 1);
   if (dir == NULL)
     {
       free (basename);
@@ -1283,11 +1283,12 @@ find_separate_debug_file (bfd *abfd, con
       break;
   canon_dir[canon_dirlen] = '\0';
 
-  debugfile = bfd_malloc (strlen (debug_file_directory) + 1
-			  + (canon_dirlen > dirlen ? canon_dirlen : dirlen)
-			  + strlen (".debug/")
-			  + strlen (basename)
-			  + 1);
+  debugfile = (char *)
+      bfd_malloc (strlen (debug_file_directory) + 1
+                  + (canon_dirlen > dirlen ? canon_dirlen : dirlen)
+                  + strlen (".debug/")
+                  + strlen (basename)
+                  + 1);
   if (debugfile == NULL)
     {
       free (basename);
@@ -1507,7 +1508,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *
   debuglink_size &= ~3;
   debuglink_size += 4;
 
-  contents = bfd_malloc (debuglink_size);
+  contents = (char *) bfd_malloc (debuglink_size);
   if (contents == NULL)
     {
       /* XXX Should we delete the section from the bfd ?  */
Index: bfd/peXXigen.c
===================================================================
RCS file: /cvs/src/src/bfd/peXXigen.c,v
retrieving revision 1.58
diff -u -u -p -r1.58 peXXigen.c
--- bfd/peXXigen.c	5 Sep 2009 07:56:22 -0000	1.58
+++ bfd/peXXigen.c	7 Sep 2009 22:53:17 -0000
@@ -160,7 +160,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void *
 
 	  if (name == namebuf)
 	    {
-	      name = bfd_alloc (abfd, strlen (namebuf) + 1);
+	      name = (const char *) bfd_alloc (abfd, strlen (namebuf) + 1);
 	      if (name == NULL)
 		/* FIXME: Return error.  */
 		abort ();
@@ -1263,7 +1263,7 @@ pe_print_idata (bfd * abfd, void * vfile
 	      else
 		{
 		  ft_idx = first_thunk - (ft_section->vma - extra->ImageBase);
-		  ft_data = bfd_malloc (datasize);
+		  ft_data = (bfd_byte *) bfd_malloc (datasize);
 		  if (ft_data == NULL)
 		    continue;
 
@@ -1432,7 +1432,7 @@ pe_print_edata (bfd * abfd, void * vfile
   fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"),
 	   section->name, (unsigned long) addr);
 
-  data = bfd_malloc (datasize);
+  data = (bfd_byte *) bfd_malloc (datasize);
   if (data == NULL)
     return FALSE;
 
@@ -1736,7 +1736,7 @@ slurp_symtab (bfd *abfd, sym_cache *psc)
   if (storage < 0)
     return NULL;
   if (storage)
-    sy = bfd_malloc (storage);
+    sy = (asymbol **) bfd_malloc (storage);
 
   psc->symcount = bfd_canonicalize_symtab (abfd, sy);
   if (psc->symcount < 0)
@@ -1857,7 +1857,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd *
 	    {
 	      int xx = (begin_addr - 8) - tsection->vma;
 
-	      tdata = bfd_malloc (8);
+	      tdata = (bfd_byte *) bfd_malloc (8);
 	      if (bfd_get_section_contents (abfd, tsection, tdata, (bfd_vma) xx, 8))
 		{
 		  bfd_vma eh, eh_data;
Index: bfd/peicode.h
===================================================================
RCS file: /cvs/src/src/bfd/peicode.h,v
retrieving revision 1.59
diff -u -u -p -r1.59 peicode.h
--- bfd/peicode.h	2 Sep 2009 07:18:37 -0000	1.59
+++ bfd/peicode.h	7 Sep 2009 22:53:17 -0000
@@ -780,7 +780,7 @@ pe_ILF_build_a_bfd (bfd *           abfd
 
      We are going to construct the contents of the BFD in memory,
      so allocate all the space that we will need right now.  */
-  ptr = bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE);
+  ptr = (bfd_byte *) bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE);
   if (ptr == NULL)
     return FALSE;
 
@@ -1194,7 +1194,7 @@ pe_ILF_object_p (bfd * abfd)
   /* ptr += 2; */
 
   /* Now read in the two strings that follow.  */
-  ptr = bfd_alloc (abfd, size);
+  ptr = (bfd_byte *) bfd_alloc (abfd, size);
   if (ptr == NULL)
     return NULL;
 
Index: bfd/reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.193
diff -u -u -p -r1.193 reloc.c
--- bfd/reloc.c	2 Sep 2009 07:18:37 -0000	1.193
+++ bfd/reloc.c	7 Sep 2009 22:53:17 -0000
@@ -5475,7 +5475,7 @@ bfd_generic_get_relocated_section_conten
   if (reloc_size == 0)
     return data;
 
-  reloc_vector = bfd_malloc (reloc_size);
+  reloc_vector = (arelent **) bfd_malloc (reloc_size);
   if (reloc_vector == NULL)
     return NULL;
 
Index: bfd/section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.103
diff -u -u -p -r1.103 section.c
--- bfd/section.c	6 Aug 2009 17:38:00 -0000	1.103
+++ bfd/section.c	7 Sep 2009 22:53:17 -0000
@@ -937,7 +937,7 @@ bfd_get_unique_section_name (bfd *abfd, 
   char *sname;
 
   len = strlen (templat);
-  sname = bfd_malloc (len + 8);
+  sname = (char *) bfd_malloc (len + 8);
   if (sname == NULL)
     return NULL;
   memcpy (sname, templat, len);
@@ -1495,7 +1495,8 @@ bfd_malloc_and_get_section (bfd *abfd, s
   if (sz == 0)
     return TRUE;
 
-  p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
+  p = (bfd_byte *)
+      bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
   if (p == NULL)
     return FALSE;
   *buf = p;
Index: bfd/simple.c
===================================================================
RCS file: /cvs/src/src/bfd/simple.c,v
retrieving revision 1.32
diff -u -u -p -r1.32 simple.c
--- bfd/simple.c	2 Sep 2009 07:18:37 -0000	1.32
+++ bfd/simple.c	7 Sep 2009 22:53:17 -0000
@@ -109,7 +109,7 @@ simple_save_output_info (bfd *abfd ATTRI
 			 asection *section,
 			 void *ptr)
 {
-  struct saved_output_info *output_info = ptr;
+  struct saved_output_info *output_info = (struct saved_output_info *) ptr;
   output_info[section->index].offset = section->output_offset;
   output_info[section->index].section = section->output_section;
   if ((section->flags & SEC_DEBUGGING) != 0
@@ -125,7 +125,7 @@ simple_restore_output_info (bfd *abfd AT
 			    asection *section,
 			    void *ptr)
 {
-  struct saved_output_info *output_info = ptr;
+  struct saved_output_info *output_info = (struct saved_output_info *) ptr;
   section->output_offset = output_info[section->index].offset;
   section->output_section = output_info[section->index].section;
 }
@@ -171,7 +171,7 @@ bfd_simple_get_relocated_section_content
       bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;
 
       if (outbuf == NULL)
-	contents = bfd_malloc (amt);
+	contents = (bfd_byte *) bfd_malloc (amt);
       else
 	contents = outbuf;
 
@@ -211,7 +211,7 @@ bfd_simple_get_relocated_section_content
   if (outbuf == NULL)
     {
       bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
-      data = bfd_malloc (amt);
+      data = (bfd_byte *) bfd_malloc (amt);
       if (data == NULL)
 	return NULL;
       outbuf = data;
@@ -241,7 +241,7 @@ bfd_simple_get_relocated_section_content
       _bfd_generic_link_add_symbols (abfd, &link_info);
 
       storage_needed = bfd_get_symtab_upper_bound (abfd);
-      symbol_table = bfd_malloc (storage_needed);
+      symbol_table = (asymbol **) bfd_malloc (storage_needed);
       bfd_canonicalize_symtab (abfd, symbol_table);
     }
   else
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.48
diff -u -u -p -r1.48 srec.c
--- bfd/srec.c	2 Sep 2009 07:18:37 -0000	1.48
+++ bfd/srec.c	7 Sep 2009 22:53:18 -0000
@@ -198,7 +198,7 @@ srec_mkobject (bfd *abfd)
 
   srec_init ();
 
-  tdata = bfd_alloc (abfd, sizeof (tdata_type));
+  tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
   if (tdata == NULL)
     return FALSE;
 
@@ -271,7 +271,7 @@ srec_new_symbol (bfd *abfd, const char *
 {
   struct srec_symbol *n;
 
-  n = bfd_alloc (abfd, sizeof (* n));
+  n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (* n));
   if (n == NULL)
     return FALSE;
 
@@ -363,7 +363,7 @@ srec_scan (bfd *abfd)
 		}
 
 	      alc = 10;
-	      symbuf = bfd_malloc (alc + 1);
+	      symbuf = (char *) bfd_malloc (alc + 1);
 	      if (symbuf == NULL)
 		goto error_return;
 
@@ -378,7 +378,7 @@ srec_scan (bfd *abfd)
 		      char *n;
 
 		      alc *= 2;
-		      n = bfd_realloc (symbuf, alc + 1);
+		      n = (char *) bfd_realloc (symbuf, alc + 1);
 		      if (n == NULL)
 			goto error_return;
 		      p = n + (p - symbuf);
@@ -395,7 +395,7 @@ srec_scan (bfd *abfd)
 		}
 
 	      *p++ = '\0';
-	      symname = bfd_alloc (abfd, (bfd_size_type) (p - symbuf));
+	      symname = (char *) bfd_alloc (abfd, (bfd_size_type) (p - symbuf));
 	      if (symname == NULL)
 		goto error_return;
 	      strcpy (symname, symbuf);
@@ -482,7 +482,7 @@ srec_scan (bfd *abfd)
 	      {
 		if (buf != NULL)
 		  free (buf);
-		buf = bfd_malloc ((bfd_size_type) bytes * 2);
+		buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
 		if (buf == NULL)
 		  goto error_return;
 		bufsize = bytes * 2;
@@ -542,7 +542,7 @@ srec_scan (bfd *abfd)
 
 		    sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
 		    amt = strlen (secbuf) + 1;
-		    secname = bfd_alloc (abfd, amt);
+		    secname = (char *) bfd_alloc (abfd, amt);
 		    strcpy (secname, secbuf);
 		    flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
 		    sec = bfd_make_section_with_flags (abfd, secname, flags);
@@ -738,7 +738,7 @@ srec_read_section (bfd *abfd, asection *
 	{
 	  if (buf != NULL)
 	    free (buf);
-	  buf = bfd_malloc ((bfd_size_type) bytes * 2);
+	  buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
 	  if (buf == NULL)
 	    goto error_return;
 	  bufsize = bytes * 2;
@@ -838,7 +838,8 @@ srec_get_section_contents (bfd *abfd,
       if (section->used_by_bfd == NULL)
 	return FALSE;
 
-      if (! srec_read_section (abfd, section, section->used_by_bfd))
+      if (! srec_read_section (abfd, section,
+                               (bfd_byte *) section->used_by_bfd))
 	return FALSE;
     }
 
@@ -872,7 +873,7 @@ srec_set_section_contents (bfd *abfd,
   tdata_type *tdata = abfd->tdata.srec_data;
   srec_data_list_type *entry;
 
-  entry = bfd_alloc (abfd, sizeof (* entry));
+  entry = (srec_data_list_type *) bfd_alloc (abfd, sizeof (* entry));
   if (entry == NULL)
     return FALSE;
 
@@ -882,7 +883,7 @@ srec_set_section_contents (bfd *abfd,
     {
       bfd_byte *data;
 
-      data = bfd_alloc (abfd, bytes_to_do);
+      data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
       if (data == NULL)
 	return FALSE;
       memcpy ((void *) data, location, (size_t) bytes_to_do);
@@ -1181,7 +1182,7 @@ srec_canonicalize_symtab (bfd *abfd, asy
       asymbol *c;
       struct srec_symbol *s;
 
-      csymbols = bfd_alloc (abfd, symcount * sizeof (asymbol));
+      csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
       if (csymbols == NULL)
 	return -1;
       abfd->tdata.srec_data->csymbols = csymbols;
Index: bfd/stabs.c
===================================================================
RCS file: /cvs/src/src/bfd/stabs.c,v
retrieving revision 1.32
diff -u -u -p -r1.32 stabs.c
--- bfd/stabs.c	2 Sep 2009 07:18:37 -0000	1.32
+++ bfd/stabs.c	7 Sep 2009 22:53:18 -0000
@@ -127,8 +127,8 @@ stab_link_includes_newfunc (struct bfd_h
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (ret == NULL)
-    ret = bfd_hash_allocate (table,
-			     sizeof (struct stab_link_includes_entry));
+    ret = (struct stab_link_includes_entry *)
+        bfd_hash_allocate (table, sizeof (struct stab_link_includes_entry));
   if (ret == NULL)
     return NULL;
 
@@ -337,7 +337,7 @@ _bfd_link_section_stabs (bfd *abfd,
 		      if (num_chars >= buf_len)
 			{
 			  buf_len += 32 * 1024;
-			  symb = bfd_realloc_or_free (symb, buf_len);
+			  symb = (char *) bfd_realloc_or_free (symb, buf_len);
 			  if (symb == NULL)
 			    goto error_return;
 			  symb_rover = symb + num_chars;
@@ -375,7 +375,7 @@ _bfd_link_section_stabs (bfd *abfd,
 	  /* Record this symbol, so that we can set the value
 	     correctly.  */
 	  amt = sizeof *ne;
-	  ne = bfd_alloc (abfd, amt);
+	  ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
 	  if (ne == NULL)
 	    goto error_return;
 	  ne->offset = sym - stabbuf;
@@ -388,12 +388,14 @@ _bfd_link_section_stabs (bfd *abfd,
 	    {
 	      /* This is the first time we have seen this header file
 		 with this set of stabs strings.  */
-	      t = bfd_hash_allocate (&sinfo->includes, sizeof *t);
+	      t = (struct stab_link_includes_totals *)
+                  bfd_hash_allocate (&sinfo->includes, sizeof *t);
 	      if (t == NULL)
 		goto error_return;
 	      t->sum_chars = sum_chars;
 	      t->num_chars = num_chars;
-	      t->symb = symb = bfd_realloc_or_free (symb, num_chars); /* Trim data down.  */
+              /* Trim data down.  */
+	      t->symb = symb = (char *) bfd_realloc_or_free (symb, num_chars);
 	      t->next = incl_entry->totals;
 	      incl_entry->totals = t;
 	    }
@@ -471,7 +473,7 @@ _bfd_link_section_stabs (bfd *abfd,
       bfd_size_type *pskips;
 
       amt = count * sizeof (bfd_size_type);
-      secinfo->cumulative_skips = bfd_alloc (abfd, amt);
+      secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
       if (secinfo->cumulative_skips == NULL)
 	goto error_return;
 
@@ -624,7 +626,7 @@ _bfd_discard_section_stabs (bfd *abfd,
       if (secinfo->cumulative_skips == NULL)
 	{
 	  amt = count * sizeof (bfd_size_type);
-	  secinfo->cumulative_skips = bfd_alloc (abfd, amt);
+	  secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
 	  if (secinfo->cumulative_skips == NULL)
 	    goto error_return;
 	}
Index: bfd/syms.c
===================================================================
RCS file: /cvs/src/src/bfd/syms.c,v
retrieving revision 1.54
diff -u -u -p -r1.54 syms.c
--- bfd/syms.c	2 Sep 2009 07:18:37 -0000	1.54
+++ bfd/syms.c	7 Sep 2009 22:53:18 -0000
@@ -474,7 +474,7 @@ DESCRIPTION
 void
 bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
 {
-  FILE *file = arg;
+  FILE *file = (FILE *) arg;
 
   flagword type = symbol->flags;
 
@@ -811,7 +811,7 @@ _bfd_generic_read_minisymbols (bfd *abfd
   if (storage == 0)
     return 0;
 
-  syms = bfd_malloc (storage);
+  syms = (asymbol **) bfd_malloc (storage);
   if (syms == NULL)
     goto error_return;
 
@@ -878,8 +878,8 @@ struct indexentry
 static int
 cmpindexentry (const void *a, const void *b)
 {
-  const struct indexentry *contestantA = a;
-  const struct indexentry *contestantB = b;
+  const struct indexentry *contestantA = (const struct indexentry *) a;
+  const struct indexentry *contestantB = (const struct indexentry *) b;
 
   if (contestantA->val < contestantB->val)
     return -1;
@@ -966,7 +966,7 @@ _bfd_stab_section_find_nearest_line (bfd
 #define VALOFF (8)
 #define STABSIZE (12)
 
-  info = *pinfo;
+  info = (struct stab_find_info *) *pinfo;
   if (info != NULL)
     {
       if (info->stabsec == NULL || info->strsec == NULL)
@@ -991,7 +991,7 @@ _bfd_stab_section_find_nearest_line (bfd
       char *function_name;
       bfd_size_type amt = sizeof *info;
 
-      info = bfd_zalloc (abfd, amt);
+      info = (struct stab_find_info *) bfd_zalloc (abfd, amt);
       if (info == NULL)
 	return FALSE;
 
@@ -1024,8 +1024,8 @@ _bfd_stab_section_find_nearest_line (bfd
 		 ? info->strsec->rawsize
 		 : info->strsec->size);
 
-      info->stabs = bfd_alloc (abfd, stabsize);
-      info->strs = bfd_alloc (abfd, strsize);
+      info->stabs = (bfd_byte *) bfd_alloc (abfd, stabsize);
+      info->strs = (bfd_byte *) bfd_alloc (abfd, strsize);
       if (info->stabs == NULL || info->strs == NULL)
 	return FALSE;
 
@@ -1042,7 +1042,7 @@ _bfd_stab_section_find_nearest_line (bfd
       reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
       if (reloc_size < 0)
 	return FALSE;
-      reloc_vector = bfd_malloc (reloc_size);
+      reloc_vector = (arelent **) bfd_malloc (reloc_size);
       if (reloc_vector == NULL && reloc_size != 0)
 	return FALSE;
       reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
@@ -1139,7 +1139,7 @@ _bfd_stab_section_find_nearest_line (bfd
 
       amt = info->indextablesize;
       amt *= sizeof (struct indexentry);
-      info->indextable = bfd_alloc (abfd, amt);
+      info->indextable = (struct indexentry *) bfd_alloc (abfd, amt);
       if (info->indextable == NULL)
 	return FALSE;
 
@@ -1395,7 +1395,7 @@ _bfd_stab_section_find_nearest_line (bfd
 	     apps keep a copy of a previously returned file name
 	     pointer.  */
 	  len = strlen (file_name) + 1;
-	  info->filename = bfd_alloc (abfd, dirlen + len);
+	  info->filename = (char *) bfd_alloc (abfd, dirlen + len);
 	  if (info->filename == NULL)
 	    return FALSE;
 	  memcpy (info->filename, directory_name, dirlen);
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.177
diff -u -u -p -r1.177 targets.c
--- bfd/targets.c	2 Sep 2009 07:18:37 -0000	1.177
+++ bfd/targets.c	7 Sep 2009 22:53:18 -0000
@@ -1455,7 +1455,7 @@ bfd_target_list (void)
     vec_length++;
 
   amt = (vec_length + 1) * sizeof (char **);
-  name_ptr = name_list = bfd_malloc (amt);
+  name_ptr = name_list = (const  char **) bfd_malloc (amt);
 
   if (name_list == NULL)
     return NULL;
Index: bfd/tekhex.c
===================================================================
RCS file: /cvs/src/src/bfd/tekhex.c,v
retrieving revision 1.36
diff -u -u -p -r1.36 tekhex.c
--- bfd/tekhex.c	2 Sep 2009 07:18:37 -0000	1.36
+++ bfd/tekhex.c	7 Sep 2009 22:53:18 -0000
@@ -324,7 +324,8 @@ find_chunk (bfd *abfd, bfd_vma vma)
   if (!d)
     {
       /* No chunk for this address, so make one up.  */
-      d = bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct));
+      d = (struct data_struct *)
+          bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct));
 
       if (!d)
 	return NULL;
@@ -383,7 +384,7 @@ first_phase (bfd *abfd, int type, char *
       section = bfd_get_section_by_name (abfd, sym);
       if (section == NULL)
 	{
-	  char *n = bfd_alloc (abfd, (bfd_size_type) len + 1);
+	  char *n = (char *) bfd_alloc (abfd, (bfd_size_type) len + 1);
 
 	  if (!n)
 	    return FALSE;
@@ -534,7 +535,7 @@ tekhex_mkobject (bfd *abfd)
 {
   tdata_type *tdata;
 
-  tdata = bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
+  tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
   if (!tdata)
     return FALSE;
   abfd->tdata.tekhex_data = tdata;
Index: bfd/verilog.c
===================================================================
RCS file: /cvs/src/src/bfd/verilog.c,v
retrieving revision 1.1
diff -u -u -p -r1.1 verilog.c
--- bfd/verilog.c	27 Apr 2009 14:27:34 -0000	1.1
+++ bfd/verilog.c	7 Sep 2009 22:53:18 -0000
@@ -114,7 +114,7 @@ verilog_set_section_contents (bfd *abfd,
   tdata_type *tdata = abfd->tdata.verilog_data;
   verilog_data_list_type *entry;
 
-  entry = bfd_alloc (abfd, sizeof (* entry));
+  entry = (verilog_data_list_type *) bfd_alloc (abfd, sizeof (* entry));
   if (entry == NULL)
     return FALSE;
 
@@ -124,7 +124,7 @@ verilog_set_section_contents (bfd *abfd,
     {
       bfd_byte *data;
 
-      data = bfd_alloc (abfd, bytes_to_do);
+      data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
       if (data == NULL)
 	return FALSE;
       memcpy ((void *) data, location, (size_t) bytes_to_do);
@@ -283,7 +283,7 @@ verilog_mkobject (bfd *abfd)
 
   verilog_init ();
 
-  tdata = bfd_alloc (abfd, sizeof (tdata_type));
+  tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
   if (tdata == NULL)
     return FALSE;
 

Attachment: bfd_fix.changelog
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]