This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

Re: GDB in C++


Hello Daniel,

On Sun, Jul 01, 2007 at 04:53:55PM -0400, Daniel Jacobowitz wrote:
> I've seen this complain from at least three different people.
> 
> I'm in favor of switching to C++.  I'm not going to argue about it if
> others disagree, but I'll offer to do most of the work if the
> consensus is positive.

I had looked whether gdb could be compiled with g++, but hadn't gone
very far. The attached applies on HEAD and doesn't cause additional
testsuite failures on i386-linux. Please let me know if you need it, I
could continue (albeit slowly). It looks like quite a lot of mechanical
work.

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/archive.c gdb/bfd/archive.c
--- gdb.orig/bfd/archive.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/archive.c	2007-07-01 12:04:50.000000000 +0200
@@ -180,7 +180,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;
 
@@ -318,7 +318,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;
@@ -423,7 +423,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
@@ -444,12 +444,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)
@@ -466,7 +466,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;
     }
@@ -514,7 +514,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;
 
   n_nfd = _bfd_create_empty_archive_element_shell (archive);
@@ -622,7 +622,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;
@@ -711,13 +711,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;
 
@@ -746,7 +746,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 = (carsym *) bfd_alloc (abfd, amt);
   if (!ardata->symdefs)
     return FALSE;
 
@@ -786,7 +786,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;
@@ -831,14 +831,14 @@ 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 = (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
@@ -873,7 +873,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] == '/'
@@ -973,12 +973,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:
@@ -1014,7 +1014,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 = (carsym *) bfd_alloc (abfd, amt);
   if (!ardata->symdefs)
     return FALSE;
 
@@ -1071,7 +1071,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;
 
@@ -1080,7 +1080,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:
@@ -1281,7 +1281,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;
 
@@ -1368,7 +1368,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 ();
@@ -1382,7 +1382,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));
@@ -1796,13 +1796,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;
 
@@ -1834,7 +1834,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;
 		}
@@ -1863,7 +1863,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;
 
@@ -1872,10 +1872,10 @@ _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);
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/archures.c gdb/bfd/archures.c
--- gdb.orig/bfd/archures.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/archures.c	2007-07-01 12:11:31.000000000 +0200
@@ -654,7 +654,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;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/bfd-in.h gdb/bfd/bfd-in.h
--- gdb.orig/bfd/bfd-in.h	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/bfd-in.h	2007-07-01 17:50:02.000000000 +0200
@@ -664,13 +664,14 @@ struct bfd_link_needed_list
   const char *name;
 };
 
-enum dynamic_lib_link_class {
-  DYN_NORMAL = 0,
-  DYN_AS_NEEDED = 1,
-  DYN_DT_NEEDED = 2,
-  DYN_NO_ADD_NEEDED = 4,
-  DYN_NO_NEEDED = 8
-};
+typedef char dynamic_lib_link_class;
+
+/* dynamic_lib_link_class values.  */
+#define DYN_NORMAL              0
+#define DYN_AS_NEEDED           1
+#define DYN_DT_NEEDED           2
+#define DYN_NO_ADD_NEEDED       4
+#define DYN_NO_NEEDED           8
 
 enum notice_asneeded_action {
   notice_as_needed,
@@ -696,7 +697,7 @@ extern void bfd_elf_set_dt_needed_name
 extern const char *bfd_elf_get_dt_soname
   (bfd *);
 extern void bfd_elf_set_dyn_lib_class
-  (bfd *, enum dynamic_lib_link_class);
+  (bfd *, dynamic_lib_link_class);
 extern int bfd_elf_get_dyn_lib_class
   (bfd *);
 extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/bfd-in2.h gdb/bfd/bfd-in2.h
--- gdb.orig/bfd/bfd-in2.h	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/bfd-in2.h	2007-07-01 18:27:51.000000000 +0200
@@ -671,13 +671,14 @@ struct bfd_link_needed_list
   const char *name;
 };
 
-enum dynamic_lib_link_class {
-  DYN_NORMAL = 0,
-  DYN_AS_NEEDED = 1,
-  DYN_DT_NEEDED = 2,
-  DYN_NO_ADD_NEEDED = 4,
-  DYN_NO_NEEDED = 8
-};
+typedef char dynamic_lib_link_class;
+
+/* dynamic_lib_link_class values.  */
+#define DYN_NORMAL              0
+#define DYN_AS_NEEDED           1
+#define DYN_DT_NEEDED           2
+#define DYN_NO_ADD_NEEDED       4
+#define DYN_NO_NEEDED           8
 
 enum notice_asneeded_action {
   notice_as_needed,
@@ -703,7 +704,7 @@ extern void bfd_elf_set_dt_needed_name
 extern const char *bfd_elf_get_dt_soname
   (bfd *);
 extern void bfd_elf_set_dyn_lib_class
-  (bfd *, enum dynamic_lib_link_class);
+  (bfd *, dynamic_lib_link_class);
 extern int bfd_elf_get_dyn_lib_class
   (bfd *);
 extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
@@ -4572,6 +4573,15 @@ bfd_boolean bfd_copy_private_symbol_data
             (ibfd, isymbol, obfd, osymbol))
 
 /* Extracted from bfd.c.  */
+/* The direction with which the BFD was opened.  */
+enum bfd_direction
+{
+  no_direction = 0,
+  read_direction = 1,
+  write_direction = 2,
+  both_direction = 3
+};
+
 struct bfd
 {
   /* A unique identifier of the BFD  */
@@ -4622,14 +4632,7 @@ struct bfd
   bfd_format format;
 
   /* The direction with which the BFD was opened.  */
-  enum bfd_direction
-    {
-      no_direction = 0,
-      read_direction = 1,
-      write_direction = 2,
-      both_direction = 3
-    }
-  direction;
+  enum bfd_direction direction;
 
   /* Format_specific flags.  */
   flagword flags;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/bfd.c gdb/bfd/bfd.c
--- gdb.orig/bfd/bfd.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/bfd.c	2007-07-02 00:16:00.000000000 +0200
@@ -34,6 +34,15 @@ SECTION
 
 CODE_FRAGMENT
 .
+.{* The direction with which the BFD was opened.  *}
+.enum bfd_direction
+.{
+.  no_direction = 0,
+.  read_direction = 1,
+.  write_direction = 2,
+.  both_direction = 3
+.};
+.
 .struct bfd
 .{
 .  {* A unique identifier of the BFD  *}
@@ -84,14 +93,7 @@ CODE_FRAGMENT
 .  bfd_format format;
 .
 .  {* The direction with which the BFD was opened.  *}
-.  enum bfd_direction
-.    {
-.      no_direction = 0,
-.      read_direction = 1,
-.      write_direction = 2,
-.      both_direction = 3
-.    }
-.  direction;
+.  enum bfd_direction direction;
 .
 .  {* Format_specific flags.  *}
 .  flagword flags;
@@ -351,7 +353,7 @@ bfd_set_error (bfd_error_type error_tag,
 
       va_start (ap, error_tag);
       input_bfd = va_arg (ap, bfd *);
-      input_error = va_arg (ap, int);
+      input_error = (bfd_error_type) va_arg (ap, int);
       if (input_error >= bfd_error_on_input)
 	abort ();
       va_end (ap);
@@ -1353,7 +1355,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;
 
@@ -1745,7 +1747,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);
@@ -1772,7 +1774,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);
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/bfdio.c gdb/bfd/bfdio.c
--- gdb.orig/bfd/bfdio.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/bfdio.c	2007-07-01 12:24:55.000000000 +0200
@@ -128,7 +128,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)
 	{
@@ -160,7 +160,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)
@@ -173,7 +173,7 @@ bfd_bwrite (const void *ptr, bfd_size_ty
 	  newsize = (bim->size + 127) & ~(bfd_size_type) 127;
 	  if (newsize > oldsize)
 	    {
-	      bim->buffer = bfd_realloc (bim->buffer, newsize);
+              bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize);
 	      if (bim->buffer == 0)
 		{
 		  bim->size = 0;
@@ -277,7 +277,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;
@@ -297,7 +297,8 @@ bfd_seek (bfd *abfd, file_ptr position, 
 	      newsize = (bim->size + 127) & ~(bfd_size_type) 127;
 	      if (newsize > oldsize)
 	        {
-		  bim->buffer = bfd_realloc (bim->buffer, newsize);
+                  bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer,
+							  newsize);
 		  if (bim->buffer == 0)
 		    {
 		      bim->size = 0;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/binary.c gdb/bfd/binary.c
--- gdb.orig/bfd/binary.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/binary.c	2007-07-01 16:26:21.000000000 +0200
@@ -142,7 +142,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 "";
 
@@ -166,7 +166,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 0;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/cache.c gdb/bfd/cache.c
--- gdb.orig/bfd/cache.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/cache.c	2007-07-02 00:16:30.000000000 +0200
@@ -251,7 +251,8 @@ cache_btell (struct bfd *abfd)
 static int
 cache_bseek (struct bfd *abfd, file_ptr offset, int whence)
 {
-  FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : 0);
+  FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR
+			      ? CACHE_NO_SEEK : CACHE_NORMAL);
   if (f == NULL)
     return -1;
   return real_fseek (f, offset, whence);
@@ -281,7 +282,7 @@ cache_bread (struct bfd *abfd, void *buf
   if (nbytes == 0)
     return 0;
 
-  f = bfd_cache_lookup (abfd, 0);
+  f = bfd_cache_lookup (abfd, CACHE_NORMAL);
   if (f == NULL)
     return 0;
 
@@ -315,7 +316,7 @@ static file_ptr
 cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes)
 {
   file_ptr nwrite;
-  FILE *f = bfd_cache_lookup (abfd, 0);
+  FILE *f = bfd_cache_lookup (abfd, CACHE_NORMAL);
   if (f == NULL)
     return 0;
   nwrite = fwrite (where, 1, nbytes, f);
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/coffgen.c gdb/bfd/coffgen.c
--- gdb.orig/bfd/coffgen.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/coffgen.c	2007-07-02 00:17:03.000000000 +0200
@@ -79,7 +79,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);
@@ -89,7 +90,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));
@@ -184,7 +186,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;
 
@@ -423,7 +425,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 && sec->reloc_count > 0)
 	goto error_return;
       external_relocs = free_external;
@@ -437,7 +439,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 && sec->reloc_count > 0)
 	goto error_return;
       internal_relocs = free_internal;
@@ -636,7 +638,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;
@@ -897,7 +899,7 @@ coff_write_symbol (bfd *abfd,
 {
   unsigned int numaux = native->u.syment.n_numaux;
   int type = native->u.syment.n_type;
-  int class = native->u.syment.n_sclass;
+  int sclass = native->u.syment.n_sclass;
   void * buf;
   bfd_size_type symesz;
 
@@ -943,7 +945,7 @@ coff_write_symbol (bfd *abfd,
 	{
 	  bfd_coff_swap_aux_out (abfd,
 				 &((native + j + 1)->u.auxent),
-				 type, class, (int) j,
+				 type, sclass, (int) j,
 				 native->u.syment.n_numaux,
 				 buf);
 	  if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
@@ -1334,7 +1336,7 @@ coff_pointerize_aux (bfd *abfd,
 		     combined_entry_type *auxent)
 {
   unsigned int type = symbol->u.syment.n_type;
-  unsigned int class = symbol->u.syment.n_sclass;
+  unsigned int sclass = symbol->u.syment.n_sclass;
 
   if (coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook)
     {
@@ -1344,16 +1346,16 @@ coff_pointerize_aux (bfd *abfd,
     }
 
   /* Don't bother if this is a file or a section.  */
-  if (class == C_STAT && type == T_NULL)
+  if (sclass == C_STAT && type == T_NULL)
     return;
-  if (class == C_FILE)
+  if (sclass == C_FILE)
     return;
 
   /* Otherwise patch up.  */
 #define N_TMASK coff_data  (abfd)->local_n_tmask
 #define N_BTSHFT coff_data (abfd)->local_n_btshft
   
-  if ((ISFCN (type) || ISTAG (class) || class == C_BLOCK || class == C_FCN)
+  if ((ISFCN (type) || ISTAG (sclass) || sclass == C_BLOCK || sclass == C_FCN)
       && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
     {
       auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p =
@@ -1390,7 +1392,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;
 
@@ -1420,7 +1422,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);
@@ -1513,7 +1515,7 @@ _bfd_coff_read_string_table (bfd *abfd)
       return NULL;
     }
 
-  strings = bfd_malloc (strsize);
+  strings = (char *) bfd_malloc (strsize);
   if (strings == NULL)
     return NULL;
 
@@ -1572,7 +1574,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);
@@ -1678,7 +1680,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);
@@ -1736,17 +1738,17 @@ asymbol *
 coff_make_empty_symbol (bfd *abfd)
 {
   bfd_size_type amt = sizeof (coff_symbol_type);
-  coff_symbol_type *new = bfd_zalloc (abfd, amt);
+  coff_symbol_type *new_symtype = (coff_symbol_type *) bfd_zalloc (abfd, amt);
 
-  if (new == NULL)
+  if (new_symtype == NULL)
     return NULL;
-  new->symbol.section = 0;
-  new->native = 0;
-  new->lineno = NULL;
-  new->done_lineno = FALSE;
-  new->symbol.the_bfd = abfd;
+  new_symtype->symbol.section = 0;
+  new_symtype->native = 0;
+  new_symtype->lineno = NULL;
+  new_symtype->done_lineno = FALSE;
+  new_symtype->symbol.the_bfd = abfd;
 
-  return & new->symbol;
+  return & new_symtype->symbol;
 }
 
 /* Make a debugging symbol.  */
@@ -1757,23 +1759,23 @@ coff_bfd_make_debug_symbol (bfd *abfd,
 			    unsigned long sz ATTRIBUTE_UNUSED)
 {
   bfd_size_type amt = sizeof (coff_symbol_type);
-  coff_symbol_type *new = bfd_alloc (abfd, amt);
+  coff_symbol_type *new_symtype = (coff_symbol_type *) bfd_alloc (abfd, amt);
 
-  if (new == NULL)
+  if (new_symtype == NULL)
     return NULL;
   /* @@ 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;
-  new->native = bfd_zalloc (abfd, amt);
-  if (!new->native)
+  new_symtype->native = (combined_entry_type *) bfd_zalloc (abfd, amt);
+  if (!new_symtype->native)
     return NULL;
-  new->symbol.section = bfd_abs_section_ptr;
-  new->symbol.flags = BSF_DEBUGGING;
-  new->lineno = NULL;
-  new->done_lineno = FALSE;
-  new->symbol.the_bfd = abfd;
+  new_symtype->symbol.section = bfd_abs_section_ptr;
+  new_symtype->symbol.flags = BSF_DEBUGGING;
+  new_symtype->lineno = NULL;
+  new_symtype->done_lineno = FALSE;
+  new_symtype->symbol.the_bfd = abfd;
   
-  return & new->symbol;
+  return & new_symtype->symbol;
 }
 
 void
@@ -2265,7 +2267,7 @@ coff_sizeof_headers (bfd *abfd, struct b
 bfd_boolean
 bfd_coff_set_symbol_class (bfd *         abfd,
 			   asymbol *     symbol,
-			   unsigned int  class)
+			   unsigned int  sym_class)
 {
   coff_symbol_type * csym;
 
@@ -2285,12 +2287,12 @@ 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;
 
       native->u.syment.n_type   = T_NULL;
-      native->u.syment.n_sclass = class;
+      native->u.syment.n_sclass = sym_class;
 
       if (bfd_is_und_section (symbol->section))
 	{
@@ -2319,7 +2321,7 @@ bfd_coff_set_symbol_class (bfd *        
       csym->native = native;
     }
   else
-    csym->native->u.syment.n_sclass = class;
+    csym->native->u.syment.n_sclass = sym_class;
 
   return TRUE;
 }
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/cofflink.c gdb/bfd/cofflink.c
--- gdb.orig/bfd/cofflink.c	2007-07-01 11:05:19.000000000 +0200
+++ gdb/bfd/cofflink.c	2007-07-01 18:37:20.000000000 +0200
@@ -78,7 +78,7 @@ _bfd_coff_link_hash_newfunc (struct bfd_
       /* Set local fields.  */
       ret->indx = -1;
       ret->type = T_NULL;
-      ret->class = C_NULL;
+      ret->sym_class = C_NULL;
       ret->numaux = 0;
       ret->auxbfd = NULL;
       ret->aux = NULL;
@@ -484,14 +484,14 @@ coff_link_add_symbols (bfd *abfd,
                  the hash table, or if we are looking at a symbol
                  definition, then update the symbol class and type in
                  the hash table.  */
-  	      if (((*sym_hash)->class == C_NULL
+  	      if (((*sym_hash)->sym_class == C_NULL
   		   && (*sym_hash)->type == T_NULL)
   		  || sym.n_scnum != 0
   		  || (sym.n_value != 0
   		      && (*sym_hash)->root.type != bfd_link_hash_defined
   		      && (*sym_hash)->root.type != bfd_link_hash_defweak))
   		{
-  		  (*sym_hash)->class = sym.n_sclass;
+  		  (*sym_hash)->sym_class = sym.n_sclass;
   		  if (sym.n_type != T_NULL)
   		    {
   		      /* We want to warn if the type changed, but not
@@ -1592,7 +1592,7 @@ _bfd_coff_link_input_bfd (struct coff_fi
 	  mt = bfd_alloc (input_bfd, amt);
 	  if (mt == NULL)
 	    return FALSE;
-	  mt->class = isym.n_sclass;
+	  mt->type_class = isym.n_sclass;
 
 	  /* Pick up the aux entry, which points to the end of the tag
              entries.  */
@@ -1681,7 +1681,7 @@ _bfd_coff_link_input_bfd (struct coff_fi
 		{
 		  struct coff_debug_merge_element *me, *mel;
 
-		  if (mtl->class != mt->class)
+		  if (mtl->type_class != mt->type_class)
 		    continue;
 
 		  for (me = mt->elements, mel = mtl->elements;
@@ -2543,7 +2543,7 @@ _bfd_coff_write_global_sym (struct coff_
       isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
     }
 
-  isym.n_sclass = h->class;
+  isym.n_sclass = h->sym_class;
   isym.n_type = h->type;
 
   if (isym.n_sclass == C_NULL)
@@ -2929,7 +2929,7 @@ _bfd_coff_generic_relocate_section (bfd 
 
 	  else if (h->root.type == bfd_link_hash_undefweak)
 	    {
-              if (h->class == C_NT_WEAK && h->numaux == 1)
+              if (h->sym_class == C_NT_WEAK && h->numaux == 1)
 		{
 		  /* See _Microsoft Portable Executable and Common Object
                      File Format Specification_, section 5.5.3.
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/doc/chew.c gdb/bfd/doc/chew.c
--- gdb.orig/bfd/doc/chew.c	2005-07-24 18:57:42.000000000 +0200
+++ gdb/bfd/doc/chew.c	2007-07-01 11:51:00.000000000 +0200
@@ -122,26 +122,21 @@ static void catstr (string_type *, strin
 #endif
 
 static void
-init_string_with_size (buffer, size)
-     string_type *buffer;
-     unsigned int size;
+init_string_with_size (string_type *buffer, unsigned int size)
 {
   buffer->write_idx = 0;
   buffer->size = size;
-  buffer->ptr = malloc (size);
+  buffer->ptr = (char *) malloc (size);
 }
 
 static void
-init_string (buffer)
-     string_type *buffer;
+init_string (string_type *buffer)
 {
   init_string_with_size (buffer, DEF_SIZE);
 }
 
 static int
-find (str, what)
-     string_type *str;
-     char *what;
+find (string_type *str, char *what)
 {
   unsigned int i;
   char *p;
@@ -157,32 +152,25 @@ find (str, what)
 }
 
 static void
-write_buffer (buffer, f)
-     string_type *buffer;
-     FILE *f;
+write_buffer (string_type *buffer, FILE *f)
 {
   fwrite (buffer->ptr, buffer->write_idx, 1, f);
 }
 
 static void
-delete_string (buffer)
-     string_type *buffer;
+delete_string (string_type *buffer)
 {
   free (buffer->ptr);
 }
 
 static char *
-addr (buffer, idx)
-     string_type *buffer;
-     unsigned int idx;
+addr (string_type *buffer, unsigned int idx)
 {
   return buffer->ptr + idx;
 }
 
 static char
-at (buffer, pos)
-     string_type *buffer;
-     unsigned int pos;
+at (string_type *buffer, unsigned int pos)
 {
   if (pos >= buffer->write_idx)
     return 0;
@@ -190,23 +178,19 @@ at (buffer, pos)
 }
 
 static void
-catchar (buffer, ch)
-     string_type *buffer;
-     int ch;
+catchar (string_type *buffer, int ch)
 {
   if (buffer->write_idx == buffer->size)
     {
       buffer->size *= 2;
-      buffer->ptr = realloc (buffer->ptr, buffer->size);
+      buffer->ptr = (char *) realloc (buffer->ptr, buffer->size);
     }
 
   buffer->ptr[buffer->write_idx++] = ch;
 }
 
 static void
-overwrite_string (dst, src)
-     string_type *dst;
-     string_type *src;
+overwrite_string (string_type *dst, string_type *src)
 {
   free (dst->ptr);
   dst->size = src->size;
@@ -215,41 +199,32 @@ overwrite_string (dst, src)
 }
 
 static void
-catbuf (buffer, buf, len)
-     string_type *buffer;
-     char *buf;
-     unsigned int len;
+catbuf (string_type *buffer, char *buf, unsigned int len)
 {
   if (buffer->write_idx + len >= buffer->size)
     {
       while (buffer->write_idx + len >= buffer->size)
 	buffer->size *= 2;
-      buffer->ptr = realloc (buffer->ptr, buffer->size);
+      buffer->ptr = (char *) realloc (buffer->ptr, buffer->size);
     }
   memcpy (buffer->ptr + buffer->write_idx, buf, len);
   buffer->write_idx += len;
 }
 
 static void
-cattext (buffer, string)
-     string_type *buffer;
-     char *string;
+cattext (string_type *buffer, char *string)
 {
   catbuf (buffer, string, (unsigned int) strlen (string));
 }
 
 static void
-catstr (dst, src)
-     string_type *dst;
-     string_type *src;
+catstr (string_type *dst, string_type *src)
 {
   catbuf (dst, src->ptr, src->write_idx);
 }
 
 static unsigned int
-skip_white_and_stars (src, idx)
-     string_type *src;
-     unsigned int idx;
+skip_white_and_stars (string_type *src, unsigned int idx)
 {
   char c;
   while ((c = at (src, idx)),
@@ -292,8 +267,7 @@ struct dict_struct
 typedef struct dict_struct dict_type;
 
 static void
-die (msg)
-     char *msg;
+die (char *msg)
 {
   fprintf (stderr, "%s\n", msg);
   exit (1);
@@ -354,8 +328,7 @@ static void chew_exit (void);
 #endif
 
 static void
-exec (word)
-     dict_type *word;
+exec (dict_type *word)
 {
   pc = word->code;
   while (*pc)
@@ -417,9 +390,7 @@ push_text ()
    Blank lines are turned into one blank line.  */
 
 static void
-remove_noncomments (src, dst)
-     string_type *src;
-     string_type *dst;
+remove_noncomments (string_type *src, string_type *dst)
 {
   unsigned int idx = 0;
 
@@ -817,9 +788,7 @@ do_fancy_stuff ()
 /* A command is all upper case,and alone on a line.  */
 
 static int
-iscommand (ptr, idx)
-     string_type *ptr;
-     unsigned int idx;
+iscommand (string_type *ptr, unsigned int idx)
 {
   unsigned int len = 0;
   while (at (ptr, idx))
@@ -843,10 +812,7 @@ iscommand (ptr, idx)
 }
 
 static int
-copy_past_newline (ptr, idx, dst)
-     string_type *ptr;
-     unsigned int idx;
-     string_type *dst;
+copy_past_newline (string_type *ptr, unsigned intidx, string_type *dst)
 {
   int column = 0;
 
@@ -1121,9 +1087,7 @@ maybecatstr ()
 }
 
 char *
-nextword (string, word)
-     char *string;
-     char **word;
+nextword (char *string, char **word)
 {
   char *word_start;
   int idx;
@@ -1173,7 +1137,7 @@ nextword (string, word)
 	}
     }
 
-  *word = malloc (length + 1);
+  *word = (char *) malloc (length + 1);
 
   dst = *word;
   src = word_start;
@@ -1210,8 +1174,7 @@ nextword (string, word)
 dict_type *root;
 
 dict_type *
-lookup_word (word)
-     char *word;
+lookup_word (char *word)
 {
   dict_type *ptr = root;
   while (ptr)
@@ -1260,23 +1223,20 @@ perform ()
 }
 
 dict_type *
-newentry (word)
-     char *word;
+newentry (char *word)
 {
-  dict_type *new = (dict_type *) malloc (sizeof (dict_type));
-  new->word = word;
-  new->next = root;
-  root = new;
-  new->code = (stinst_type *) malloc (sizeof (stinst_type));
-  new->code_length = 1;
-  new->code_end = 0;
-  return new;
+  dict_type *new_entry = (dict_type *) malloc (sizeof (dict_type));
+  new_entry->word = word;
+  new_entry->next = root;
+  root = new_entry;
+  new_entry->code = (stinst_type *) malloc (sizeof (stinst_type));
+  new_entry->code_length = 1;
+  new_entry->code_end = 0;
+  return new_entry;
 }
 
 unsigned int
-add_to_definition (entry, word)
-     dict_type *entry;
-     stinst_type word;
+add_to_definition (dict_type *entry, stinst_type word)
 {
   if (entry->code_end == entry->code_length)
     {
@@ -1291,28 +1251,24 @@ add_to_definition (entry, word)
 }
 
 void
-add_intrinsic (name, func)
-     char *name;
-     void (*func) ();
-{
-  dict_type *new = newentry (name);
-  add_to_definition (new, func);
-  add_to_definition (new, 0);
+add_intrinsic (char *name, void (*func)())
+{
+  dict_type *new_entry = newentry (name);
+  add_to_definition (new_entry, func);
+  add_to_definition (new_entry, 0);
 }
 
 void
-add_var (name)
-     char *name;
+add_var (char *name)
 {
-  dict_type *new = newentry (name);
-  add_to_definition (new, push_number);
-  add_to_definition (new, (stinst_type) (&(new->var)));
-  add_to_definition (new, 0);
+  dict_type *new_entry = newentry (name);
+  add_to_definition (new_entry, push_number);
+  add_to_definition (new_entry, (stinst_type) (&(new_entry->var)));
+  add_to_definition (new_entry, 0);
 }
 
 void
-compile (string)
-     char *string;
+compile (char *string)
 {
   /* Add words to the dictionary.  */
   char *word;
@@ -1434,9 +1390,7 @@ print ()
 }
 
 static void
-read_in (str, file)
-     string_type *str;
-     FILE *file;
+read_in (string_type *str, FILE *file)
 {
   char buff[10000];
   unsigned int r;
@@ -1470,9 +1424,7 @@ chew_exit ()
 }
 
 int
-main (ac, av)
-     int ac;
-     char *av[];
+main (int ac, char *av[])
 {
   unsigned int i;
   string_type buffer;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/dwarf1.c gdb/bfd/dwarf1.c
--- gdb.orig/bfd/dwarf1.c	2007-07-01 11:05:22.000000000 +0200
+++ gdb/bfd/dwarf1.c	2007-07-02 00:09:07.000000000 +0200
@@ -139,7 +139,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);
   x->prev = stash->lastUnit;
   stash->lastUnit = x;
 
@@ -154,7 +154,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);
   x->prev = aUnit->func_list;
   aUnit->func_list = x;
 
@@ -270,7 +270,7 @@ parse_line_table (struct dwarf1_debug* s
 	return FALSE;
 
       size = msec->rawsize ? msec->rawsize : msec->size;
-      stash->line_section = bfd_alloc (stash->abfd, size);
+      stash->line_section = (char *) bfd_alloc (stash->abfd, size);
 
       if (! stash->line_section)
 	return FALSE;
@@ -307,7 +307,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);
 
       for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
 	{
@@ -464,7 +465,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;
@@ -477,7 +478,7 @@ _bfd_dwarf1_find_nearest_line (bfd *abfd
 	return FALSE;
 
       size = msec->rawsize ? msec->rawsize : msec->size;
-      stash->debug_section = bfd_alloc (abfd, size);
+      stash->debug_section = (char *) bfd_alloc (abfd, size);
 
       if (! stash->debug_section)
 	return FALSE;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/dwarf2.c gdb/bfd/dwarf2.c
--- gdb.orig/bfd/dwarf2.c	2007-07-01 11:05:22.000000000 +0200
+++ gdb/bfd/dwarf2.c	2007-07-01 16:44:48.000000000 +0200
@@ -96,7 +96,7 @@ struct dwarf2_debug
   /* Pointer to the bfd, section and address of the beginning of the
      section.  The bfd might be different than expected because of
      gnu_debuglink sections.  */
-  bfd * bfd;
+  bfd * bfd_ptr;
   asection *sec;
   bfd_byte *sec_info_ptr;
 
@@ -333,7 +333,7 @@ read_indirect_string (struct comp_unit* 
 
       sz = msec->rawsize ? msec->rawsize : msec->size;
       stash->dwarf_str_size = sz;
-      stash->dwarf_str_buffer = bfd_alloc (abfd, sz);
+      stash->dwarf_str_buffer = (bfd_byte *) bfd_alloc (abfd, sz);
       if (! stash->dwarf_str_buffer)
 	return NULL;
 
@@ -459,7 +459,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t of
     }
 
   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);
@@ -469,7 +469,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;
@@ -493,7 +493,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;
@@ -571,7 +571,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);
@@ -580,7 +580,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);
@@ -609,7 +609,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);
@@ -618,7 +618,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);
@@ -783,7 +783,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;
@@ -793,7 +793,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);
     }
@@ -903,13 +903,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);
 	}
@@ -953,7 +953,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;
@@ -1006,7 +1006,7 @@ decode_line_info (struct comp_unit *unit
     }
 
   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;
 
@@ -1058,7 +1058,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;
 
@@ -1080,7 +1080,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);
@@ -1106,7 +1106,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);
@@ -1202,7 +1202,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);
@@ -1665,7 +1665,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;
@@ -1705,7 +1706,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;
@@ -1725,7 +1726,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;
@@ -1862,9 +1863,8 @@ 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);
@@ -1908,7 +1908,7 @@ parse_comp_unit (struct dwarf2_debug *st
   bfd_size_type amt;
   bfd_vma low_pc = 0;
   bfd_vma high_pc = 0;
-  bfd *abfd = stash->bfd;
+  bfd *abfd = stash->bfd_ptr;
 
   version = read_2_bytes (abfd, info_ptr);
   info_ptr += 2;
@@ -1969,7 +1969,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->addr_size = addr_size;
   unit->offset_size = offset_size;
@@ -2339,13 +2339,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;
     }
@@ -2424,7 +2424,7 @@ find_line (bfd *abfd,
       for (total_size = 0; msec; msec = find_debug_info (debug_bfd, msec))
 	total_size += msec->size;
 
-      stash->info_ptr = bfd_alloc (debug_bfd, total_size);
+      stash->info_ptr = (bfd_byte *) bfd_alloc (debug_bfd, total_size);
       if (stash->info_ptr == NULL)
 	goto done;
 
@@ -2455,7 +2455,7 @@ find_line (bfd *abfd,
       stash->sec = find_debug_info (debug_bfd, NULL);
       stash->sec_info_ptr = stash->info_ptr;
       stash->syms = symbols;
-      stash->bfd = debug_bfd;
+      stash->bfd_ptr = debug_bfd;
     }
 
   /* A null info_ptr indicates that there is no dwarf2 info
@@ -2499,13 +2499,13 @@ find_line (bfd *abfd,
       unsigned int offset_size = addr_size;
       bfd_byte *info_ptr_unit = stash->info_ptr;
 
-      length = read_4_bytes (stash->bfd, stash->info_ptr);
+      length = read_4_bytes (stash->bfd_ptr, stash->info_ptr);
       /* A 0xffffff length is the DWARF3 way of indicating
 	 we use 64-bit offsets, instead of 32-bit offsets.  */
       if (length == 0xffffffff)
 	{
 	  offset_size = 8;
-	  length = read_8_bytes (stash->bfd, stash->info_ptr + 4);
+	  length = read_8_bytes (stash->bfd_ptr, stash->info_ptr + 4);
 	  stash->info_ptr += 12;
 	}
       /* A zero length is the IRIX way of indicating 64-bit offsets,
@@ -2514,7 +2514,7 @@ find_line (bfd *abfd,
       else if (length == 0)
 	{
 	  offset_size = 8;
-	  length = read_4_bytes (stash->bfd, stash->info_ptr + 4);
+	  length = read_4_bytes (stash->bfd_ptr, stash->info_ptr + 4);
 	  stash->info_ptr += 8;
 	}
       /* In the absence of the hints above, we assume 32-bit DWARF2
@@ -2543,7 +2543,7 @@ find_line (bfd *abfd,
 	  if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
 	      == stash->sec->size)
 	    {
-	      stash->sec = find_debug_info (stash->bfd, stash->sec);
+	      stash->sec = find_debug_info (stash->bfd_ptr, stash->sec);
 	      stash->sec_info_ptr = stash->info_ptr;
 	    }
 
@@ -2631,7 +2631,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;
@@ -2658,7 +2658,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;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elf-attrs.c gdb/bfd/elf-attrs.c
--- gdb.orig/bfd/elf-attrs.c	2007-06-29 18:29:15.000000000 +0200
+++ gdb/bfd/elf-attrs.c	2007-07-01 19:03:49.000000000 +0200
@@ -302,7 +302,7 @@ _bfd_elf_attr_strdup (bfd *abfd, const c
   
   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.  */
@@ -439,7 +439,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,
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elf-bfd.h gdb/bfd/elf-bfd.h
--- gdb.orig/bfd/elf-bfd.h	2007-07-01 11:05:22.000000000 +0200
+++ gdb/bfd/elf-bfd.h	2007-07-01 18:30:46.000000000 +0200
@@ -80,6 +80,28 @@ struct elf_strtab_hash;
 struct got_entry;
 struct plt_entry;
 
+union gotplt_union
+{
+  bfd_signed_vma refcount;
+  bfd_vma offset;
+  struct got_entry *glist;
+  struct plt_entry *plist;
+};
+
+
+struct elf_link_hash_entry_vtable
+{
+  /* Virtual table entry use information.  This array is nominally of size
+     size/sizeof(target_void_pointer), though we have to be able to assume
+     and track a size while the symbol is still undefined.  It is indexed
+     via offset/sizeof(target_void_pointer).  */
+  size_t size;
+  bfd_boolean *used;
+
+  /* Virtual table derivation info.  */
+  struct elf_link_hash_entry *parent;
+};
+
 /* ELF linker hash table entries.  */
 
 struct elf_link_hash_entry
@@ -113,13 +135,7 @@ struct elf_link_hash_entry
      require a global offset table entry.  The second scheme allows
      multiple GOT entries per symbol, managed via a linked list
      pointed to by GLIST.  */
-  union gotplt_union
-    {
-      bfd_signed_vma refcount;
-      bfd_vma offset;
-      struct got_entry *glist;
-      struct plt_entry *plist;
-    } got;
+  union gotplt_union got;
 
   /* Same, but tracks a procedure linkage table entry.  */
   union gotplt_union plt;
@@ -201,18 +217,7 @@ struct elf_link_hash_entry
     struct bfd_elf_version_tree *vertree;
   } verinfo;
 
-  struct
-  {
-    /* Virtual table entry use information.  This array is nominally of size
-       size/sizeof(target_void_pointer), though we have to be able to assume
-       and track a size while the symbol is still undefined.  It is indexed
-       via offset/sizeof(target_void_pointer).  */
-    size_t size;
-    bfd_boolean *used;
-
-    /* Virtual table derivation info.  */
-    struct elf_link_hash_entry *parent;
-  } *vtable;
+  struct elf_link_hash_entry_vtable *vtable;
 };
 
 /* Will references to this symbol always reference the symbol
@@ -1444,7 +1449,7 @@ struct elf_obj_tdata
   /* Whether a dyanmic object was specified normally on the linker
      command line, or was specified when --as-needed was in effect,
      or was found via a DT_NEEDED entry.  */
-  enum dynamic_lib_link_class dyn_lib_class;
+  dynamic_lib_link_class dyn_lib_class;
 
   /* This is set to TRUE if the object was created by the backend
      linker.  */
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elf-eh-frame.c gdb/bfd/elf-eh-frame.c
--- gdb.orig/bfd/elf-eh-frame.c	2007-07-01 11:05:22.000000000 +0200
+++ gdb/bfd/elf-eh-frame.c	2007-07-02 00:12:12.000000000 +0200
@@ -214,8 +214,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
@@ -245,7 +245,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;
 }
 
@@ -508,8 +508,8 @@ _bfd_elf_discard_section_eh_frame
   REQUIRE (ptr_size != 0);
 
   buf = ehbuf;
-  sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info)
-			  + 99 * sizeof (struct eh_cie_fde));
+  sec_info = (struct eh_frame_sec_info *) bfd_zmalloc (
+    sizeof (struct eh_frame_sec_info) + 99 * sizeof (struct eh_cie_fde));
   REQUIRE (sec_info);
 
   entry_alloced = 100;
@@ -541,10 +541,9 @@ _bfd_elf_discard_section_eh_frame
 
       if (sec_info->count == entry_alloced)
 	{
-	  sec_info = bfd_realloc (sec_info,
-				  sizeof (struct eh_frame_sec_info)
-				  + ((entry_alloced + 99)
-				     * sizeof (struct eh_cie_fde)));
+	  sec_info = (struct eh_frame_sec_info *) bfd_realloc (
+            sec_info, sizeof (struct eh_frame_sec_info) +
+            ((entry_alloced + 99) * sizeof (struct eh_cie_fde)));
 	  REQUIRE (sec_info);
 
 	  memset (&sec_info->entry[entry_alloced], 0,
@@ -594,8 +593,8 @@ _bfd_elf_discard_section_eh_frame
 
 	  if (ecie_count == ecie_alloced)
 	    {
-	      ecies = bfd_realloc (ecies,
-				   (ecie_alloced + 20) * sizeof (*ecies));
+	      ecies = (struct extended_cie *) bfd_realloc (
+                ecies, (ecie_alloced + 20) * sizeof (*ecies));
 	      REQUIRE (ecies);
 	      memset (&ecies[ecie_alloced], 0, 20 * sizeof (*ecies));
 	      ecie_alloced += 20;
@@ -823,7 +822,7 @@ _bfd_elf_discard_section_eh_frame
 		}
 	      ecie->usage_count++;
 	      hdr_info->fde_count++;
-	      this_inf->cie_inf = (void *) (ecie - ecies);
+	      this_inf->cie_inf = (struct eh_cie_fde *) (ecie - ecies);
 	    }
 
 	  /* Skip the initial location and address range.  */
@@ -883,8 +882,8 @@ _bfd_elf_discard_section_eh_frame
 	  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;
@@ -1079,7 +1078,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;
@@ -1179,7 +1178,7 @@ _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;
 
@@ -1205,7 +1204,8 @@ _bfd_elf_write_section_eh_frame (bfd *ab
 	  if (eh == NULL || eh->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
 	    continue;
 
-	  eh_inf = elf_section_data (eh)->sec_info;
+	  eh_inf
+            = (struct eh_frame_sec_info *) elf_section_data (eh)->sec_info;
 	  for (ent = eh_inf->entry; ent < eh_inf->entry + eh_inf->count; ++ent)
 	    {
 	      ent->offset += eh->output_offset;
@@ -1216,8 +1216,8 @@ _bfd_elf_write_section_eh_frame (bfd *ab
     }
 
   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;
 
@@ -1494,8 +1494,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)
@@ -1546,7 +1546,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;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elf-strtab.c gdb/bfd/elf-strtab.c
--- gdb.orig/bfd/elf-strtab.c	2007-07-01 11:05:22.000000000 +0200
+++ gdb/bfd/elf-strtab.c	2007-07-02 00:11:38.000000000 +0200
@@ -67,7 +67,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;
 
@@ -96,7 +97,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;
 
@@ -111,7 +112,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);
@@ -165,7 +167,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 (tab->array, tab->alloced * amt);
+	  tab->array = (struct elf_strtab_hash_entry **) bfd_realloc (
+            tab->array, tab->alloced * amt);
 	  if (tab->array == NULL)
 	    return (bfd_size_type) -1;
 	}
@@ -310,7 +313,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;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elf.c gdb/bfd/elf.c
--- gdb.orig/bfd/elf.c	2007-07-01 11:05:22.000000000 +0200
+++ gdb/bfd/elf.c	2007-07-02 00:26:39.000000000 +0200
@@ -267,7 +267,8 @@ 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 == 0
-	  || (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)
@@ -380,8 +381,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
@@ -395,14 +396,16 @@ bfd_elf_get_elf_syms (bfd *ibfd,
 
   if (intsym_buf == NULL)
     {
-      intsym_buf = bfd_malloc2 (symcount, sizeof (Elf_Internal_Sym));
+      intsym_buf = (Elf_Internal_Sym *) bfd_malloc2 (symcount,
+						     sizeof (Elf_Internal_Sym));
       if (intsym_buf == NULL)
 	goto out;
     }
 
   /* 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))
@@ -533,8 +536,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;
 
@@ -555,8 +558,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)
 		    {
@@ -1147,7 +1150,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;
@@ -1380,7 +1383,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:
@@ -1505,7 +1508,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;
     }
@@ -1642,7 +1646,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;
 
@@ -1681,7 +1685,7 @@ bfd_elf_get_dyn_lib_class (bfd *abfd)
 }
 
 void
-bfd_elf_set_dyn_lib_class (bfd *abfd, enum dynamic_lib_link_class lib_class)
+bfd_elf_set_dyn_lib_class (bfd *abfd, dynamic_lib_link_class lib_class)
 {
   if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
       && bfd_get_format (abfd) == bfd_object)
@@ -1785,7 +1789,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;
 
@@ -2123,7 +2127,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);
 	    elf_section_data (target_sect)->rel_hdr2 = hdr2;
 	  }
 	*hdr2 = *hdr;
@@ -2540,7 +2544,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;
@@ -2596,7 +2601,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;
@@ -2607,9 +2612,9 @@ _bfd_elf_make_section_from_phdr (bfd *ab
   split = ((hdr->p_memsz > 0)
 	    && (hdr->p_filesz > 0)
 	    && (hdr->p_memsz > hdr->p_filesz));
-  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);
@@ -2640,9 +2645,9 @@ _bfd_elf_make_section_from_phdr (bfd *ab
 
   if (split)
     {
-      sprintf (namebuf, "%s%db", typename, index);
+      sprintf (namebuf, "%s%db", type_name, index);
       len = strlen (namebuf) + 1;
-      name = bfd_alloc (abfd, len);
+      name = (char *) bfd_alloc (abfd, len);
       if (!name)
 	return FALSE;
       memcpy (name, namebuf, len);
@@ -2728,7 +2733,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);
@@ -2756,7 +2761,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;
 
@@ -2945,7 +2950,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;
   unsigned long symindx;
   asection *elt, *first;
   unsigned char *loc;
@@ -2977,7 +2982,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;
@@ -3137,11 +3142,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);
@@ -3290,7 +3297,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);
@@ -3413,7 +3420,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;
@@ -3464,7 +3471,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;
@@ -3739,7 +3747,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;
@@ -3766,7 +3774,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;
@@ -3854,7 +3863,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;
 
@@ -3884,7 +3894,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;
@@ -3898,7 +3908,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;
@@ -4080,7 +4090,7 @@ _bfd_elf_map_sections_to_segments (bfd *
 	      && CONST_STRNEQ (s->name, ".note"))
 	    {
 	      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;
@@ -4106,7 +4116,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;
@@ -4133,7 +4143,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;
@@ -4148,7 +4158,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;
@@ -4165,7 +4175,7 @@ _bfd_elf_map_sections_to_segments (bfd *
 	  /* We make a PT_GNU_RELRO segment only when there is a
 	     PT_DYNAMIC segment.  */
 	  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;
@@ -4324,7 +4334,8 @@ assign_file_positions_for_load_sections 
       return TRUE;
     }
 
-  phdrs = bfd_alloc2 (abfd, alloc, sizeof (Elf_Internal_Phdr));
+  phdrs = (Elf_Internal_Phdr *) bfd_alloc2 (abfd, alloc,
+					    sizeof (Elf_Internal_Phdr));
   elf_tdata (abfd)->phdr = phdrs;
   if (phdrs == NULL)
     return FALSE;
@@ -5473,7 +5484,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;
 
@@ -5560,7 +5571,7 @@ rewrite_elf_program_header (bfd *ibfd, b
 
       /* Gcc 2.96 miscompiles this code on mips. Don't do casting here
 	 to work around this long long bug.  */
-      sections = bfd_malloc2 (section_count, sizeof (asection *));
+      sections = (asection **) bfd_malloc2 (section_count, sizeof (asection *));
       if (sections == NULL)
 	return FALSE;
 
@@ -5769,7 +5780,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);
@@ -5888,7 +5899,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;
 
@@ -6268,7 +6279,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);
@@ -6281,8 +6293,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);
@@ -6711,14 +6723,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:
@@ -6758,8 +6770,8 @@ 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;
 	    }
@@ -6827,7 +6839,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
@@ -6871,8 +6883,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;
 
@@ -6905,8 +6917,8 @@ 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;
 	    }
@@ -6963,8 +6975,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;
 
@@ -6990,7 +7002,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;
 
@@ -7013,7 +7026,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
@@ -7495,7 +7508,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);
@@ -7641,7 +7654,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)
@@ -7649,7 +7662,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;
 
@@ -8119,7 +8132,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);
@@ -8148,7 +8161,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);
@@ -8233,7 +8246,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);
   dest = buf + *bufsiz;
   *bufsiz += newspace;
   xnp = (Elf_External_Note *) dest;
@@ -8471,7 +8484,7 @@ elfcore_read_notes (bfd *abfd, file_ptr 
   if (bfd_seek (abfd, offset, SEEK_SET) != 0)
     return FALSE;
 
-  buf = bfd_malloc (size);
+  buf = (char *) bfd_malloc (size);
   if (buf == NULL)
     return FALSE;
 
@@ -8783,7 +8796,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
   for (i = 0; i < count; i++, s++, p++)
     size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
 
-  s = *ret = bfd_malloc (size);
+  s = *ret = (asymbol *) bfd_malloc (size);
   if (s == NULL)
     return -1;
 
@@ -8865,7 +8878,7 @@ static struct elf_symbuf_head *
 elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf)
 {
   Elf_Internal_Sym **ind, **indbufend, **indbuf
-    = bfd_malloc2 (symcount, sizeof (*indbuf));
+    = (Elf_Internal_Sym **) bfd_malloc2 (symcount, sizeof (*indbuf));
   struct elf_symbuf_symbol *ssym;
   struct elf_symbuf_head *ssymbuf, *ssymhead;
   bfd_size_type i, shndx_count;
@@ -8887,8 +8900,9 @@ elf_create_symbuf (bfd_size_type symcoun
       if (ind[0]->st_shndx != ind[1]->st_shndx)
 	shndx_count++;
 
-  ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf)
-			+ (indbufend - indbuf) * sizeof (*ssymbuf));
+  ssymbuf = (struct elf_symbuf_head *) bfd_malloc (
+    (shndx_count + 1) * sizeof (*ssymbuf) +
+    (indbufend - indbuf) * sizeof (*ssymbuf));
   if (ssymbuf == NULL)
     {
       free (indbuf);
@@ -8983,8 +8997,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)
     {
@@ -9058,8 +9072,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;
 
@@ -9100,8 +9116,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;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elf32-i386.c gdb/bfd/elf32-i386.c
--- gdb.orig/bfd/elf32-i386.c	2007-07-01 11:05:23.000000000 +0200
+++ gdb/bfd/elf32-i386.c	2007-07-01 16:47:41.000000000 +0200
@@ -705,8 +705,8 @@ link_hash_newfunc (struct bfd_hash_entry
      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;
     }
@@ -734,7 +734,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;
 
@@ -1052,7 +1052,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;
@@ -1250,7 +1251,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_i386_dyn_relocs *) bfd_alloc (
+                    htab->elf.dynobj, amt);
 		  if (p == NULL)
 		    return FALSE;
 		  p->next = *head;
@@ -2043,7 +2045,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;
     }
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elfcode.h gdb/bfd/elfcode.h
--- gdb.orig/bfd/elfcode.h	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/elfcode.h	2007-07-01 16:51:01.000000000 +0200
@@ -173,8 +173,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);
@@ -205,7 +205,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);
@@ -428,7 +428,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);
@@ -439,7 +439,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);
@@ -740,7 +740,7 @@ 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;
@@ -748,7 +748,7 @@ elf_object_p (bfd *abfd)
 	num_sec += SHN_HIRESERVE + 1 - SHN_LORESERVE;
       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;
 
@@ -822,7 +822,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)
@@ -917,7 +917,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 *);
@@ -950,7 +950,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;
@@ -1080,7 +1080,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 = (Elf32_External_Shdr *) bfd_alloc (abfd, amt);
   if (!x_shdrp)
     return FALSE;
 
@@ -1164,7 +1164,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;
 
@@ -1188,7 +1188,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;
 
@@ -1370,7 +1370,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)
@@ -1491,7 +1491,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;
 
@@ -1641,7 +1641,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 = (Elf32_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);
@@ -1705,7 +1706,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);
@@ -1753,7 +1754,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);
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elfcore.h gdb/bfd/elfcore.h
--- gdb.orig/bfd/elfcore.h	2005-05-04 17:53:28.000000000 +0200
+++ gdb/bfd/elfcore.h	2007-07-01 16:51:12.000000000 +0200
@@ -187,7 +187,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;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/elflink.c gdb/bfd/elflink.c
--- gdb.orig/bfd/elflink.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/elflink.c	2007-07-01 19:02:01.000000000 +0200
@@ -581,7 +581,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;
 
@@ -667,7 +667,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;
@@ -689,7 +689,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;
@@ -1490,7 +1490,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);
@@ -1601,7 +1601,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);
@@ -1675,7 +1675,7 @@ nondefault:
 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)
@@ -1735,7 +1735,7 @@ 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;
@@ -1769,7 +1769,7 @@ _bfd_elf_link_find_version_dependencies 
   if (t == NULL)
     {
       amt = sizeof *t;
-      t = bfd_zalloc (rinfo->output_bfd, amt);
+      t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, amt);
       if (t == NULL)
 	{
 	  rinfo->failed = TRUE;
@@ -1782,7 +1782,7 @@ _bfd_elf_link_find_version_dependencies 
     }
 
   amt = sizeof *a;
-  a = bfd_zalloc (rinfo->output_bfd, amt);
+  a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, amt);
 
   /* Note that we are copying a string pointer here, and testing it
      above.  If bfd_elf_string_from_elf_section is ever changed to
@@ -1818,7 +1818,7 @@ _bfd_elf_link_assign_sym_version (struct
   char *p;
   bfd_size_type amt;
 
-  sinfo = data;
+  sinfo = (struct elf_assign_sym_version_info *) data;
   info = sinfo->info;
 
   if (h->root.type == bfd_link_hash_warning)
@@ -1875,7 +1875,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)
 		return FALSE;
 	      memcpy (alc, h->root.root.string, len - 1);
@@ -1919,7 +1919,8 @@ _bfd_elf_link_assign_sym_version (struct
 	    return TRUE;
 
 	  amt = sizeof *t;
-	  t = bfd_zalloc (sinfo->output_bfd, amt);
+	  t = (struct bfd_elf_version_tree *) bfd_zalloc (sinfo->output_bfd,
+							  amt);
 	  if (t == NULL)
 	    {
 	      sinfo->failed = TRUE;
@@ -2081,7 +2082,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)
@@ -2146,9 +2147,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 = bfd_alloc (abfd, size);
+	internal_relocs = (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;
     }
@@ -2226,7 +2227,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;
 
@@ -2237,7 +2238,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;
 
@@ -2492,7 +2494,7 @@ _bfd_elf_fix_symbol_flags (struct elf_li
 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;
 
@@ -2671,7 +2673,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,
@@ -2985,7 +2987,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;
 
@@ -3090,7 +3092,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;
@@ -3335,7 +3337,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;
 
@@ -3443,12 +3445,12 @@ elf_link_add_object_symbols (bfd *abfd, 
 		  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);
@@ -3466,12 +3468,12 @@ elf_link_add_object_symbols (bfd *abfd, 
 		  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);
@@ -3489,15 +3491,15 @@ elf_link_add_object_symbols (bfd *abfd, 
 		{
 		  struct bfd_link_needed_list *n, **pn;
 		  char *fnm, *anm;
-		  unsigned int tagv = dyn.d_un.d_val;
 
 		  amt = sizeof (struct bfd_link_needed_list);
-		  n = bfd_alloc (abfd, amt);
-		  fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
+		  n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+		  fnm = bfd_elf_string_from_elf_section (abfd, shlink,
+							 dyn.d_un.d_val);
 		  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)
 		    {
 		    error_free_dyn:
@@ -3605,7 +3607,7 @@ elf_link_add_object_symbols (bfd *abfd, 
       /* 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;
@@ -3625,7 +3627,7 @@ elf_link_add_object_symbols (bfd *abfd, 
 	  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;
@@ -3940,7 +3942,7 @@ elf_link_add_object_symbols (bfd *abfd, 
 		  && 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);
@@ -4260,7 +4262,8 @@ elf_link_add_object_symbols (bfd *abfd, 
 		    {
 		      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);
 		    }
 		  nondeflt_vers[nondeflt_vers_cnt++] = h;
 		}
@@ -4312,7 +4315,8 @@ elf_link_add_object_symbols (bfd *abfd, 
 		  goto error_free_vers;
 		}
 
-	      elf_dyn_lib_class (abfd) &= ~DYN_AS_NEEDED;
+	      elf_dyn_lib_class (abfd) &=
+                (dynamic_lib_link_class) ~DYN_AS_NEEDED;
 
 	      add_needed = TRUE;
 	      ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
@@ -4418,7 +4422,7 @@ elf_link_add_object_symbols (bfd *abfd, 
 	    continue;
 
 	  amt = p - h->root.root.string;
-	  shortname = bfd_malloc (amt + 1);
+	  shortname = (char *) bfd_malloc (amt + 1);
 	  memcpy (shortname, h->root.root.string, amt);
 	  shortname[amt] = '\0';
 
@@ -4474,7 +4478,7 @@ elf_link_add_object_symbols (bfd *abfd, 
 	 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;
@@ -4682,7 +4686,8 @@ elf_link_add_object_symbols (bfd *abfd, 
       /* 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;
@@ -4733,7 +4738,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;
 
@@ -4810,8 +4815,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;
 
@@ -4969,7 +4974,7 @@ bfd_elf_link_add_symbols (bfd *abfd, str
 static bfd_boolean
 elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
 {
-  unsigned long **valuep = data;
+  unsigned long **valuep = (unsigned long **) data;
   const char *name;
   char *p;
   unsigned long ha;
@@ -4986,7 +4991,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);
       memcpy (alc, name, p - name);
       alc[p - name] = '\0';
       name = alc;
@@ -5034,7 +5039,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;
@@ -5055,7 +5060,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);
       memcpy (alc, name, p - name);
       alc[p - name] = '\0';
       name = alc;
@@ -5084,7 +5089,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;
 
@@ -5194,7 +5199,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;
 
@@ -5477,7 +5482,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);
@@ -5716,7 +5721,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;
 
@@ -5953,7 +5958,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;
 
@@ -6111,7 +6116,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;
 
@@ -6131,7 +6136,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;
 
@@ -6158,7 +6163,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;
 	  hashcodesp = hashcodes;
@@ -6181,7 +6186,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;
 
@@ -6204,7 +6209,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 = (unsigned long int *) bfd_malloc (amt);
 	  if (cinfo.hashcodes == NULL)
 	    return FALSE;
 
@@ -6235,7 +6240,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;
@@ -6279,14 +6284,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 = (unsigned long int *) (cinfo.bitmask + maskwords);
 	      cinfo.indx = cinfo.counts + bucketcount;
 	      cinfo.symindx = dynsymcount - cinfo.nsyms;
 	      memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma));
@@ -6308,7 +6313,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);
@@ -7217,8 +7222,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;
@@ -7242,8 +7247,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)
@@ -7441,7 +7446,7 @@ elf_link_sort_relocs (bfd *abfd, struct 
 	      + (i2e - 1) * sizeof (Elf_Internal_Rela));
 
   count = dynamic_relocs->size / ext_size;
-  sort = bfd_zmalloc (sort_elt * count);
+  sort = (bfd_byte *) bfd_zmalloc (sort_elt * count);
 
   if (sort == NULL)
     {
@@ -7607,7 +7612,8 @@ elf_link_output_sym (struct elf_final_li
 	  bfd_size_type amt;
 
 	  amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
-	  finfo->symshndxbuf = destshndx = bfd_realloc (destshndx, amt * 2);
+	  finfo->symshndxbuf = destshndx =
+            (Elf_External_Sym_Shndx *) bfd_realloc (destshndx, amt * 2);
 	  if (destshndx == NULL)
 	    return FALSE;
 	  memset ((char *) destshndx + amt, 0, amt);
@@ -7731,7 +7737,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;
 
@@ -7799,7 +7805,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;
@@ -9018,7 +9024,7 @@ elf_reloc_link_order (bfd *output_bfd,
       const char *sym_name;
 
       size = bfd_get_reloc_size (howto);
-      buf = bfd_zmalloc (size);
+      buf = (bfd_byte *) bfd_zmalloc (size);
       if (buf == NULL)
 	return FALSE;
       rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
@@ -9581,7 +9587,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)
@@ -9590,7 +9596,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;
     }
@@ -9643,7 +9649,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;
     }
@@ -9659,7 +9665,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;
     }
@@ -9667,22 +9673,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 *) 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;
     }
@@ -9690,7 +9696,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;
     }
@@ -10296,7 +10302,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)
 	goto error_return;
       bfd_elf_set_obj_attr_contents (abfd, contents, attr_size);
@@ -10517,7 +10523,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);
     }
 
@@ -10832,8 +10839,8 @@ bfd_elf_gc_sections (bfd *abfd, struct b
 		tmp = strlen (TEXT_PREFIX2);
 		if (tmp > fn_name_prefix_len)
 		  fn_name_prefix_len = tmp;
-		fn_name
-		  = bfd_malloc (fn_name_prefix_len + strlen (sec_name) + 1);
+		fn_name = (char *) bfd_malloc (fn_name_prefix_len +
+					       strlen (sec_name) + 1);
 		if (fn_name == NULL)
 		  return FALSE;
 
@@ -10907,7 +10914,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_hash_entry_vtable *) bfd_zalloc (
+        abfd, sizeof (*child->vtable));
       if (!child->vtable)
 	return FALSE;
     }
@@ -10939,7 +10947,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_hash_entry_vtable *) bfd_zalloc (
+        abfd, sizeof (*h->vtable));
       if (!h->vtable)
 	return FALSE;
     }
@@ -10972,7 +10981,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)
 	    {
@@ -10984,7 +10993,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;
@@ -11010,7 +11019,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;
 
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -11107,7 +11116,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;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/format.c gdb/bfd/format.c
--- gdb.orig/bfd/format.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/format.c	2007-07-01 12:47:04.000000000 +0200
@@ -145,7 +145,7 @@ bfd_check_format_matches (bfd *abfd, bfd
 
       *matching = NULL;
       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;
     }
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/hash.c gdb/bfd/hash.c
--- gdb.orig/bfd/hash.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/hash.c	2007-07-01 16:03:04.000000000 +0200
@@ -373,7 +373,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);
@@ -406,7 +407,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;
 }
 
@@ -455,16 +456,17 @@ bfd_hash_lookup (struct bfd_hash_table *
     return NULL;
   if (copy)
     {
-      char *new;
+      char *new_obj;
 
-      new = objalloc_alloc ((struct objalloc *) table->memory, len + 1);
-      if (!new)
+      new_obj = (char *) objalloc_alloc ((struct objalloc *) table->memory,
+					 len + 1);
+      if (!new_obj)
 	{
 	  bfd_set_error (bfd_error_no_memory);
 	  return NULL;
 	}
-      memcpy (new, string, len + 1);
-      string = new;
+      memcpy (new_obj, string, len + 1);
+      string = new_obj;
     }
   hashp->string = string;
   hashp->hash = hash;
@@ -560,7 +562,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;
 }
 
@@ -655,7 +658,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;
 
@@ -687,7 +691,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;
 
@@ -750,7 +754,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)
@@ -759,7 +764,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;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/ihex.c gdb/bfd/ihex.c
--- gdb.orig/bfd/ihex.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/ihex.c	2007-07-01 16:31:08.000000000 +0200
@@ -175,7 +175,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;
 
@@ -307,7 +307,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;
@@ -359,7 +359,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);
@@ -581,7 +581,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;
@@ -638,7 +638,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;
     }
 
@@ -666,11 +667,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);
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/libbfd.c gdb/bfd/libbfd.c
--- gdb.orig/bfd/libbfd.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/libbfd.c	2007-07-01 12:52:16.000000000 +0200
@@ -520,35 +520,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;
 }
@@ -556,7 +556,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;
 }
@@ -564,7 +564,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;
@@ -577,7 +577,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];
@@ -590,7 +590,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;
@@ -603,7 +603,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];
@@ -617,7 +617,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;
@@ -640,7 +640,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;
@@ -664,7 +664,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;
@@ -687,7 +687,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;
@@ -709,7 +709,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;
@@ -719,7 +719,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;
@@ -730,7 +730,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;
@@ -748,7 +748,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;
@@ -765,7 +765,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;
 
@@ -785,7 +785,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;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/libcoff-in.h gdb/bfd/libcoff-in.h
--- gdb.orig/bfd/libcoff-in.h	2006-06-19 15:17:43.000000000 +0200
+++ gdb/bfd/libcoff-in.h	2007-07-01 18:37:07.000000000 +0200
@@ -252,7 +252,7 @@ struct coff_link_hash_entry
   unsigned short type;
 
   /* Symbol class.  */
-  unsigned char class;
+  unsigned char sym_class;
 
   /* Number of auxiliary entries.  */
   char numaux;
@@ -392,7 +392,7 @@ struct coff_debug_merge_type
   struct coff_debug_merge_type *next;
 
   /* Class of type.  */
-  int class;
+  int type_class;
 
   /* Symbol index where this type is defined.  */
   long indx;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/libcoff.h gdb/bfd/libcoff.h
--- gdb.orig/bfd/libcoff.h	2006-06-19 15:17:44.000000000 +0200
+++ gdb/bfd/libcoff.h	2007-07-01 18:37:11.000000000 +0200
@@ -256,7 +256,7 @@ struct coff_link_hash_entry
   unsigned short type;
 
   /* Symbol class.  */
-  unsigned char class;
+  unsigned char sym_class;
 
   /* Number of auxiliary entries.  */
   char numaux;
@@ -396,7 +396,7 @@ struct coff_debug_merge_type
   struct coff_debug_merge_type *next;
 
   /* Class of type.  */
-  int class;
+  int type_class;
 
   /* Symbol index where this type is defined.  */
   long indx;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/linker.c gdb/bfd/linker.c
--- gdb.orig/bfd/linker.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/linker.c	2007-07-01 16:22:03.000000000 +0200
@@ -443,7 +443,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,8 +679,8 @@ _bfd_generic_link_hash_newfunc (struct b
      subclass.  */
   if (entry == NULL)
     {
-      entry =
-	bfd_hash_allocate (table, sizeof (struct generic_link_hash_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 @@ 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,9 +1245,8 @@ 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 =
-	    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;
 
@@ -1694,9 +1696,8 @@ _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 =
-	    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;
 
@@ -1975,7 +1976,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);
@@ -2062,7 +2063,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);
@@ -2084,7 +2085,8 @@ _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;
@@ -2138,7 +2140,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;
@@ -2215,7 +2217,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
@@ -2454,7 +2456,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)
@@ -2511,7 +2514,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;
 
@@ -2559,7 +2562,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,
@@ -2607,21 +2610,21 @@ struct bfd_link_order *
 bfd_new_link_order (bfd *abfd, asection *section)
 {
   bfd_size_type amt = sizeof (struct bfd_link_order);
-  struct bfd_link_order *new;
+  struct bfd_link_order *new_lo;
 
-  new = bfd_zalloc (abfd, amt);
-  if (!new)
+  new_lo = (struct bfd_link_order *) bfd_zalloc (abfd, amt);
+  if (!new_lo)
     return NULL;
 
-  new->type = bfd_undefined_link_order;
+  new_lo->type = bfd_undefined_link_order;
 
   if (section->map_tail.link_order != NULL)
-    section->map_tail.link_order->next = new;
+    section->map_tail.link_order->next = new_lo;
   else
-    section->map_head.link_order = new;
-  section->map_tail.link_order = new;
+    section->map_head.link_order = new_lo;
+  section->map_tail.link_order = new_lo;
 
-  return new;
+  return new_lo;
 }
 
 /* Default link order processing routine.  Note that we can not handle
@@ -2674,7 +2677,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;
@@ -2784,7 +2787,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),
@@ -2803,7 +2806,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
@@ -2934,7 +2937,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);
   l->sec = sec;
   l->next = already_linked_list->entry;
   already_linked_list->entry = l;
@@ -2946,7 +2950,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);
 
   ret->entry = NULL;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/merge.c gdb/bfd/merge.c
--- gdb.orig/bfd/merge.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/merge.c	2007-07-01 16:35:35.000000000 +0200
@@ -106,7 +106,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;
 
@@ -238,7 +239,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;
 
@@ -296,7 +297,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;
     }
@@ -393,7 +394,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;
@@ -597,7 +599,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;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/opncls.c gdb/bfd/opncls.c
--- gdb.orig/bfd/opncls.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/opncls.c	2007-07-01 12:58:09.000000000 +0200
@@ -51,7 +51,7 @@ _bfd_new_bfd (void)
 {
   bfd *nbfd;
 
-  nbfd = bfd_zmalloc (sizeof (bfd));
+  nbfd = (bfd *) bfd_zmalloc (sizeof (bfd));
   if (nbfd == NULL)
     return NULL;
 
@@ -341,7 +341,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;
 
@@ -437,14 +437,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;
@@ -457,7 +457,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;
@@ -476,7 +476,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;
@@ -495,7 +495,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)
@@ -551,7 +551,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;
@@ -797,7 +797,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));
   abfd->iostream = bim;
   /* bfd_bwrite will grow these as needed.  */
   bim->size = 0;
@@ -893,7 +893,8 @@ 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;
@@ -932,7 +933,8 @@ 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;
@@ -1248,11 +1250,11 @@ find_separate_debug_file (bfd *abfd, con
   dir[i + 1] = '\0';
   BFD_ASSERT (dir[i] == '/' || dir[0] == '\0');
 
-  debugfile = malloc (strlen (debug_file_directory) + 1
-		      + strlen (dir)
-		      + strlen (".debug/")
-		      + strlen (basename)
-		      + 1);
+  debugfile = (char *) malloc (strlen (debug_file_directory) + 1
+			       + strlen (dir)
+			       + strlen (".debug/")
+			       + strlen (basename)
+			       + 1);
   if (debugfile == NULL)
     {
       free (basename);
@@ -1465,7 +1467,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *
   debuglink_size &= ~3;
   debuglink_size += 4;
 
-  contents = malloc (debuglink_size);
+  contents = (char *) malloc (debuglink_size);
   if (contents == NULL)
     {
       /* XXX Should we delete the section from the bfd ?  */
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/reloc.c gdb/bfd/reloc.c
--- gdb.orig/bfd/reloc.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/reloc.c	2007-07-01 12:57:03.000000000 +0200
@@ -5196,7 +5196,7 @@ bfd_generic_get_relocated_section_conten
   if (reloc_size < 0)
     goto error_return;
 
-  reloc_vector = bfd_malloc (reloc_size);
+  reloc_vector = (arelent **) bfd_malloc (reloc_size);
   if (reloc_vector == NULL && reloc_size != 0)
     goto error_return;
 
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/section.c gdb/bfd/section.c
--- gdb.orig/bfd/section.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/section.c	2007-07-01 12:57:29.000000000 +0200
@@ -912,7 +912,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);
@@ -1460,7 +1460,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;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/simple.c gdb/bfd/simple.c
--- gdb.orig/bfd/simple.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/simple.c	2007-07-01 16:46:12.000000000 +0200
@@ -108,7 +108,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
@@ -124,7 +124,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;
 }
@@ -167,7 +167,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;
 
@@ -205,7 +205,7 @@ bfd_simple_get_relocated_section_content
   data = NULL;
   if (outbuf == NULL)
     {
-      data = bfd_malloc (sec->size);
+      data = (bfd_byte *) bfd_malloc (sec->size);
       if (data == NULL)
 	return NULL;
       outbuf = data;
@@ -235,7 +235,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
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/srec.c gdb/bfd/srec.c
--- gdb.orig/bfd/srec.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/srec.c	2007-07-01 16:25:30.000000000 +0200
@@ -196,7 +196,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;
 
@@ -269,7 +269,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;
 
@@ -361,7 +361,7 @@ srec_scan (bfd *abfd)
 		}
 
 	      alc = 10;
-	      symbuf = bfd_malloc (alc + 1);
+	      symbuf = (char *) bfd_malloc (alc + 1);
 	      if (symbuf == NULL)
 		goto error_return;
 
@@ -376,7 +376,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);
@@ -393,7 +393,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);
@@ -474,7 +474,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;
@@ -530,7 +530,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);
@@ -695,7 +695,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;
@@ -785,7 +785,8 @@ srec_get_section_contents (bfd *abfd,
       if (section->used_by_bfd == NULL && section->size != 0)
 	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;
     }
 
@@ -819,7 +820,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;
 
@@ -829,7 +830,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);
@@ -1128,7 +1129,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 && symcount != 0)
 	return 0;
       abfd->tdata.srec_data->csymbols = csymbols;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/stab-syms.c gdb/bfd/stab-syms.c
--- gdb.orig/bfd/stab-syms.c	2005-05-04 17:53:39.000000000 +0200
+++ gdb/bfd/stab-syms.c	2007-07-01 16:33:59.000000000 +0200
@@ -44,8 +44,7 @@ Foundation, Inc., 51 Franklin Street - F
   __define_name (N_WARNING, "WARNING")
 
 const char *
-bfd_get_stab_name (code)
-     int code;
+bfd_get_stab_name (int code)
 {
   switch (code)
     {
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/stabs.c gdb/bfd/stabs.c
--- gdb.orig/bfd/stabs.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/stabs.c	2007-07-01 16:36:03.000000000 +0200
@@ -125,8 +125,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;
 
@@ -335,7 +335,7 @@ _bfd_link_section_stabs (bfd *abfd,
 		      if (num_chars >= buf_len)
 			{
 			  buf_len += 32 * 1024;
-			  symb = bfd_realloc (symb, buf_len);
+			  symb = (char *) bfd_realloc (symb, buf_len);
 			  if (symb == NULL)
 			    goto error_return;
 			  symb_rover = symb + num_chars;
@@ -373,7 +373,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;
@@ -386,12 +386,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 = bfd_realloc (symb, num_chars); /* Trim data down.  */
+	      /* Trim data down.  */
+	      t->symb = (const char *) bfd_realloc (symb, num_chars);
 	      t->next = incl_entry->totals;
 	      incl_entry->totals = t;
 	    }
@@ -469,7 +471,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;
 
@@ -622,7 +624,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;
 	}
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/syms.c gdb/bfd/syms.c
--- gdb.orig/bfd/syms.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/syms.c	2007-07-01 13:04:45.000000000 +0200
@@ -463,7 +463,7 @@ DESCRIPTION
 void
 bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
 {
-  FILE *file = arg;
+  FILE *file = (FILE *) arg;
 
   flagword type = symbol->flags;
 
@@ -527,10 +527,10 @@ asymbol *
 _bfd_generic_make_empty_symbol (bfd *abfd)
 {
   bfd_size_type amt = sizeof (asymbol);
-  asymbol *new = bfd_zalloc (abfd, amt);
-  if (new)
-    new->the_bfd = abfd;
-  return new;
+  asymbol *new_sym = (asymbol *) bfd_zalloc (abfd, amt);
+  if (new_sym)
+    new_sym->the_bfd = abfd;
+  return new_sym;
 }
 
 /*
@@ -795,7 +795,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;
 
@@ -862,8 +862,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;
@@ -950,7 +950,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)
@@ -975,7 +975,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;
 
@@ -1001,8 +1001,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;
 
@@ -1019,7 +1019,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,
@@ -1116,7 +1116,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;
 
@@ -1371,7 +1371,7 @@ _bfd_stab_section_find_nearest_line (bfd
 	  if (info->filename != NULL)
 	    free (info->filename);
 	  len = strlen (file_name) + 1;
-	  info->filename = bfd_malloc (dirlen + len);
+	  info->filename = (char *) bfd_malloc (dirlen + len);
 	  if (info->filename == NULL)
 	    return FALSE;
 	  memcpy (info->filename, directory_name, dirlen);
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/targets.c gdb/bfd/targets.c
--- gdb.orig/bfd/targets.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/targets.c	2007-07-01 13:04:23.000000000 +0200
@@ -1428,7 +1428,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;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/bfd/tekhex.c gdb/bfd/tekhex.c
--- gdb.orig/bfd/tekhex.c	2007-07-01 11:05:24.000000000 +0200
+++ gdb/bfd/tekhex.c	2007-07-01 16:29:29.000000000 +0200
@@ -217,10 +217,10 @@ tekhex_init (void)
       for (i = 'A'; i <= 'Z'; i++)
 	sum_block[i] = val++;
 
-      sum_block['$'] = val++;
-      sum_block['%'] = val++;
-      sum_block['.'] = val++;
-      sum_block['_'] = val++;
+      sum_block[(int) '$'] = val++;
+      sum_block[(int) '%'] = val++;
+      sum_block[(int) '.'] = val++;
+      sum_block[(int) '_'] = val++;
       for (i = 'a'; i <= 'z'; i++)
 	sum_block[i] = val++;
     }
@@ -322,7 +322,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;
@@ -381,7 +382,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;
@@ -411,31 +412,33 @@ first_phase (bfd *abfd, int type, char *
 	      /* Symbols, add to section.  */
 	      {
 		bfd_size_type amt = sizeof (tekhex_symbol_type);
-		tekhex_symbol_type *new = bfd_alloc (abfd, amt);
+		tekhex_symbol_type *new_thst =
+                  (tekhex_symbol_type *) bfd_alloc (abfd, amt);
 		char stype = (*src);
 
-		if (!new)
+		if (!new_thst)
 		  return FALSE;
-		new->symbol.the_bfd = abfd;
+		new_thst->symbol.the_bfd = abfd;
 		src++;
 		abfd->symcount++;
 		abfd->flags |= HAS_SYMS;
-		new->prev = abfd->tdata.tekhex_data->symbols;
-		abfd->tdata.tekhex_data->symbols = new;
+		new_thst->prev = abfd->tdata.tekhex_data->symbols;
+		abfd->tdata.tekhex_data->symbols = new_thst;
 		if (!getsym (sym, &src, &len))
 		  return FALSE;
-		new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1);
-		if (!new->symbol.name)
+		new_thst->symbol.name = (const char *) bfd_alloc (
+                  abfd, (bfd_size_type) len + 1);
+		if (!new_thst->symbol.name)
 		  return FALSE;
-		memcpy ((char *) (new->symbol.name), sym, len + 1);
-		new->symbol.section = section;
+		memcpy ((char *) (new_thst->symbol.name), sym, len + 1);
+		new_thst->symbol.section = section;
 		if (stype <= '4')
-		  new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT);
+		  new_thst->symbol.flags = (BSF_GLOBAL | BSF_EXPORT);
 		else
-		  new->symbol.flags = BSF_LOCAL;
+		  new_thst->symbol.flags = BSF_LOCAL;
 		if (!getvalue (&src, &val))
 		  return FALSE;
-		new->symbol.value = val - section->vma;
+		new_thst->symbol.value = val - section->vma;
 		break;
 	      }
 	    default:
@@ -528,7 +531,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;
@@ -876,13 +879,13 @@ static asymbol *
 tekhex_make_empty_symbol (bfd *abfd)
 {
   bfd_size_type amt = sizeof (struct tekhex_symbol_struct);
-  tekhex_symbol_type *new = bfd_zalloc (abfd, amt);
+  tekhex_symbol_type *new_thst = (tekhex_symbol_type *) bfd_zalloc (abfd, amt);
 
-  if (!new)
+  if (!new_thst)
     return NULL;
-  new->symbol.the_bfd = abfd;
-  new->prev =  NULL;
-  return &(new->symbol);
+  new_thst->symbol.the_bfd = abfd;
+  new_thst->prev =  NULL;
+  return &(new_thst->symbol);
 }
 
 static void
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/include/bfdlink.h gdb/include/bfdlink.h
--- gdb.orig/include/bfdlink.h	2007-07-01 11:05:33.000000000 +0200
+++ gdb/include/bfdlink.h	2007-07-01 16:14:10.000000000 +0200
@@ -74,6 +74,12 @@ enum bfd_link_common_skip_ar_aymbols
   bfd_link_common_skip_all
 };
 
+struct bfd_link_hash_common_entry
+  {
+    unsigned int alignment_power;	/* Alignment.  */
+    asection *section;			/* Symbol section.  */
+  };
+
 /* The linking routines use a hash table which uses this structure for
    its elements.  */
 
@@ -142,11 +148,7 @@ struct bfd_link_hash_entry
 	     directly because we don't want to increase the size of
 	     the union; this structure is a major space user in the
 	     linker.  */
-	  struct bfd_link_hash_common_entry
-	    {
-	      unsigned int alignment_power;	/* Alignment.  */
-	      asection *section;		/* Symbol section.  */
-	    } *p;
+	  struct bfd_link_hash_common_entry *p;
 	  bfd_size_type size;	/* Common symbol size.  */
 	} c;
     } u;
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/libiberty/argv.c gdb/libiberty/argv.c
--- gdb.orig/libiberty/argv.c	2007-07-01 11:05:33.000000000 +0200
+++ gdb/libiberty/argv.c	2007-07-01 11:40:42.000000000 +0200
@@ -310,7 +310,6 @@ writeargv (char **argv, FILE *f)
 
   while (*argv != NULL)
     {
-      int ret;
       const char *arg = *argv;
 
       while (*arg != EOS)
diff -Naurp -X /home/ibr/w/root/prg/dontdiff.ibr gdb.orig/libiberty/regex.c gdb/libiberty/regex.c
--- gdb.orig/libiberty/regex.c	2005-07-22 06:28:52.000000000 +0200
+++ gdb/libiberty/regex.c	2007-07-01 11:40:03.000000000 +0200
@@ -287,7 +287,7 @@ init_syntax_once (void)
      if (ISALNUM (c))
 	re_syntax_table[c] = Sword;
 
-   re_syntax_table['_'] = Sword;
+   re_syntax_table[(int)'_'] = Sword;
 
    done = 1;
 }
@@ -5521,6 +5521,15 @@ count_mbs_length(int *offset_buffer, int
 }
 #endif /* WCHAR */
 
+/* 1 if this match ends in the same string (string1 or string2) as the
+   best previous match. */
+static inline boolean
+same_str_p(const char *string1, int size1, const CHAR_T *dend,
+	   const CHAR_T *end_match_1, const CHAR_T *match_end)
+{
+	return FIRST_STRING_P (match_end) == MATCHING_IN_FIRST_STRING;
+}
+
 /* This is a separate function so that we can force an alloca cleanup
    afterwards.  */
 #ifdef WCHAR
@@ -5908,16 +5917,12 @@ byte_re_match_2_internal (struct re_patt
              longest match, try backtracking.  */
           if (d != end_match_2)
 	    {
-	      /* 1 if this match ends in the same string (string1 or string2)
-		 as the best previous match.  */
-	      boolean same_str_p = (FIRST_STRING_P (match_end)
-				    == MATCHING_IN_FIRST_STRING);
 	      /* 1 if this match is the best seen so far.  */
 	      boolean best_match_p;
 
 	      /* AIX compiler got confused when this was combined
 		 with the previous declaration.  */
-	      if (same_str_p)
+	      if (same_str_p (string1, size1, dend, end_match_1, match_end))
 		best_match_p = d > match_end;
 	      else
 		best_match_p = !MATCHING_IN_FIRST_STRING;

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