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


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

Patches to make gas/* gprof/* ld/* compile with -Wc++-compat


These three patches makes the target x86_64-linux compile cleanly with
-Wc++-compat on gcc.4.5.0 20090908.

The patches are tested together on x86_64-linux and arm-eabi without
regressions.

Thanks,
Martin

Attachment: gas.changelog
Description: Binary data

diff -urp src.head/gas/app.c src.gas/gas/app.c
--- src.head/gas/app.c	2009-09-07 13:21:22.488585000 -0700
+++ src.gas/gas/app.c	2009-09-10 09:50:01.390884000 -0700
@@ -258,7 +258,7 @@ app_push (void)
     saved->saved_input = NULL;
   else
     {
-      saved->saved_input = xmalloc (saved_input_len);
+      saved->saved_input = (char *) xmalloc (saved_input_len);
       memcpy (saved->saved_input, saved_input, saved_input_len);
       saved->saved_input_len = saved_input_len;
     }
diff -urp src.head/gas/as.c src.gas/gas/as.c
--- src.head/gas/as.c	2009-09-07 13:21:22.509595000 -0700
+++ src.gas/gas/as.c	2009-09-10 09:51:18.067745000 -0700
@@ -506,7 +506,8 @@ parse_args (int * pargc, char *** pargv)
      dependent list.  Include space for an extra NULL option and
      always NULL terminate.  */
   shortopts = concat (std_shortopts, md_shortopts, (char *) NULL);
-  longopts = xmalloc (sizeof (std_longopts) + md_longopts_size + sizeof (struct option));
+  longopts = (struct option *) xmalloc (sizeof (std_longopts)
+                                        + md_longopts_size + sizeof (struct option));
   memcpy (longopts, std_longopts, sizeof (std_longopts));
   memcpy (((char *) longopts) + sizeof (std_longopts), md_longopts, md_longopts_size);
   memset (((char *) longopts) + sizeof (std_longopts) + md_longopts_size,
@@ -517,7 +518,7 @@ parse_args (int * pargc, char *** pargv)
   old_argv = *pargv;
 
   /* Initialize a new argv that contains no options.  */
-  new_argv = xmalloc (sizeof (char *) * (old_argc + 1));
+  new_argv = (char **) xmalloc (sizeof (char *) * (old_argc + 1));
   new_argv[0] = old_argv[0];
   new_argc = 1;
   new_argv[new_argc] = NULL;
@@ -646,7 +647,7 @@ This program has absolutely no warranty.
 	      as_fatal (_("bad defsym; format is --defsym name=value"));
 	    *s++ = '\0';
 	    i = bfd_scan_vma (s, (const char **) NULL, 0);
-	    n = xmalloc (sizeof *n);
+	    n = (struct defsym_list *) xmalloc (sizeof *n);
 	    n->next = defsyms;
 	    n->name = optarg;
 	    n->value = i;
diff -urp src.head/gas/config/obj-elf.c src.gas/gas/config/obj-elf.c
--- src.head/gas/config/obj-elf.c	2009-09-07 13:21:23.923315000 -0700
+++ src.gas/gas/config/obj-elf.c	2009-09-10 10:12:49.832540000 -0700
@@ -269,7 +269,7 @@ elf_file_symbol (const char *s, int appf
       if (name_length > strlen (S_GET_NAME (sym)))
 	{
 	  obstack_grow (&notes, s, name_length + 1);
-	  S_SET_NAME (sym, obstack_finish (&notes));
+	  S_SET_NAME (sym, (const char *) obstack_finish (&notes));
 	}
       else
 	strcpy ((char *) S_GET_NAME (sym), s);
@@ -505,7 +505,7 @@ static struct section_stack *section_sta
 static bfd_boolean
 get_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
 {
-  const char *gname = inf;
+  const char *gname = (const char *) inf;
   const char *group_name = elf_group_name (sec);
 
   return (group_name == gname
@@ -555,7 +555,7 @@ obj_elf_change_section (const char *name
   if (push)
     {
       struct section_stack *elt;
-      elt = xmalloc (sizeof (struct section_stack));
+      elt = (struct section_stack *) xmalloc (sizeof (struct section_stack));
       elt->next = section_stack;
       elt->seg = now_seg;
       elt->prev_seg = previous_section;
@@ -885,7 +885,7 @@ obj_elf_section_name (void)
 	  return NULL;
 	}
 
-      name = xmalloc (end - input_line_pointer + 1);
+      name = (char *) xmalloc (end - input_line_pointer + 1);
       memcpy (name, input_line_pointer, end - input_line_pointer);
       name[end - input_line_pointer] = '\0';
 #ifdef tc_canonicalize_section_name
@@ -1441,7 +1441,7 @@ elf_copy_symbol_attributes (symbolS *des
   if (srcelf->size)
     {
       if (destelf->size == NULL)
-	destelf->size = xmalloc (sizeof (expressionS));
+	destelf->size = (expressionS *) xmalloc (sizeof (expressionS));
       *destelf->size = *srcelf->size;
     }
   else
@@ -1558,7 +1558,8 @@ obj_elf_size (int ignore ATTRIBUTE_UNUSE
     }
   else
     {
-      symbol_get_obj (sym)->size = xmalloc (sizeof (expressionS));
+      symbol_get_obj (sym)->size =
+          (expressionS *) xmalloc (sizeof (expressionS));
       *symbol_get_obj (sym)->size = exp;
     }
   demand_empty_rest_of_line ();
@@ -1609,7 +1610,7 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSE
   char *name;
   char c;
   int type;
-  const char *typename;
+  const char *type_name;
   symbolS *sym;
   elf_symbol_type *elfsym;
 
@@ -1630,28 +1631,28 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSE
       || *input_line_pointer == '%')
     ++input_line_pointer;
 
-  typename = obj_elf_type_name (& c);
+  type_name = obj_elf_type_name (& c);
 
   type = 0;
-  if (strcmp (typename, "function") == 0
-      || strcmp (typename, "2") == 0
-      || strcmp (typename, "STT_FUNC") == 0)
+  if (strcmp (type_name, "function") == 0
+      || strcmp (type_name, "2") == 0
+      || strcmp (type_name, "STT_FUNC") == 0)
     type = BSF_FUNCTION;
-  else if (strcmp (typename, "object") == 0
-	   || strcmp (typename, "1") == 0
-	   || strcmp (typename, "STT_OBJECT") == 0)
+  else if (strcmp (type_name, "object") == 0
+	   || strcmp (type_name, "1") == 0
+	   || strcmp (type_name, "STT_OBJECT") == 0)
     type = BSF_OBJECT;
-  else if (strcmp (typename, "tls_object") == 0
-	   || strcmp (typename, "6") == 0
-	   || strcmp (typename, "STT_TLS") == 0)
+  else if (strcmp (type_name, "tls_object") == 0
+	   || strcmp (type_name, "6") == 0
+	   || strcmp (type_name, "STT_TLS") == 0)
     type = BSF_OBJECT | BSF_THREAD_LOCAL;
-  else if (strcmp (typename, "notype") == 0
-	   || strcmp (typename, "0") == 0
-	   || strcmp (typename, "STT_NOTYPE") == 0)
+  else if (strcmp (type_name, "notype") == 0
+	   || strcmp (type_name, "0") == 0
+	   || strcmp (type_name, "STT_NOTYPE") == 0)
     ;
-  else if (strcmp (typename, "common") == 0
-	   || strcmp (typename, "5") == 0
-	   || strcmp (typename, "STT_COMMON") == 0)
+  else if (strcmp (type_name, "common") == 0
+	   || strcmp (type_name, "5") == 0
+	   || strcmp (type_name, "STT_COMMON") == 0)
     {
       type = BSF_OBJECT;
 
@@ -1677,9 +1678,9 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSE
 	    }
 	}
     }
-  else if (strcmp (typename, "gnu_indirect_function") == 0
-	   || strcmp (typename, "10") == 0
-	   || strcmp (typename, "STT_GNU_IFUNC") == 0)
+  else if (strcmp (type_name, "gnu_indirect_function") == 0
+	   || strcmp (type_name, "10") == 0
+	   || strcmp (type_name, "STT_GNU_IFUNC") == 0)
     {
       const struct elf_backend_data *bed;
 
@@ -1688,10 +1689,10 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSE
 	    /* GNU/Linux is still using the default value 0.  */
 	    || bed->elf_osabi == ELFOSABI_NONE))
 	as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
-		typename);
+		type_name);
       type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
     }
-  else if (strcmp (typename, "gnu_unique_object") == 0)
+  else if (strcmp (type_name, "gnu_unique_object") == 0)
     {
       struct elf_backend_data *bed;
 
@@ -1700,17 +1701,17 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSE
 	    /* GNU/Linux is still using the default value 0.  */
 	    || bed->elf_osabi == ELFOSABI_NONE))
 	as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
-		typename);
+		type_name);
       type = BSF_OBJECT | BSF_GNU_UNIQUE;
       /* PR 10549: Always set OSABI field to LINUX for objects containing unique symbols.  */
       bed->elf_osabi = ELFOSABI_LINUX;
     }
 #ifdef md_elf_symbol_type
-  else if ((type = md_elf_symbol_type (typename, sym, elfsym)) != -1)
+  else if ((type = md_elf_symbol_type (type_name, sym, elfsym)) != -1)
     ;
 #endif
   else
-    as_bad (_("unrecognized symbol type \"%s\""), typename);
+    as_bad (_("unrecognized symbol type \"%s\""), type_name);
 
   *input_line_pointer = c;
 
@@ -1774,7 +1775,7 @@ obj_elf_init_stab_section (segT seg)
   /* Zero it out.  */
   memset (p, 0, 12);
   as_where (&file, NULL);
-  stabstr_name = xmalloc (strlen (segment_name (seg)) + 4);
+  stabstr_name = (char *) xmalloc (strlen (segment_name (seg)) + 4);
   strcpy (stabstr_name, segment_name (seg));
   strcat (stabstr_name, "str");
   stroff = get_stab_string_offset (file, stabstr_name);
@@ -1800,7 +1801,7 @@ adjust_stab_sections (bfd *abfd, asectio
   if (!strcmp ("str", sec->name + strlen (sec->name) - 3))
     return;
 
-  name = alloca (strlen (sec->name) + 4);
+  name = (char *) alloca (strlen (sec->name) + 4);
   strcpy (name, sec->name);
   strcat (name, "str");
   strsec = bfd_get_section_by_name (abfd, name);
@@ -2016,7 +2017,7 @@ struct group_list
 static void
 build_group_lists (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
 {
-  struct group_list *list = inf;
+  struct group_list *list = (struct group_list *) inf;
   const char *group_name = elf_group_name (sec);
   unsigned int i;
 
@@ -2042,9 +2043,10 @@ build_group_lists (bfd *abfd ATTRIBUTE_U
   if ((i & 127) == 0)
     {
       unsigned int newsize = i + 128;
-      list->head = xrealloc (list->head, newsize * sizeof (*list->head));
-      list->elt_count = xrealloc (list->elt_count,
-				  newsize * sizeof (*list->elt_count));
+      list->head = (asection **) xrealloc (list->head,
+                                           newsize * sizeof (*list->head));
+      list->elt_count = (unsigned int *)
+          xrealloc (list->elt_count, newsize * sizeof (*list->elt_count));
     }
   list->head[i] = sec;
   list->elt_count[i] = 1;
diff -urp src.head/gas/config/tc-i386-intel.c src.gas/gas/config/tc-i386-intel.c
--- src.head/gas/config/tc-i386-intel.c	2009-08-14 10:59:51.486195000 -0700
+++ src.gas/gas/config/tc-i386-intel.c	2009-09-10 10:10:45.915481000 -0700
@@ -65,7 +65,7 @@ intel_state;
 static struct
   {
     const char *name;
-    operatorT operator;
+    operatorT op;
     unsigned int operands;
   }
 const i386_operators[] =
@@ -91,7 +91,7 @@ const i386_operators[] =
 static struct
   {
     const char *name;
-    operatorT operator;
+    operatorT op;
     unsigned short sz[3];
   }
 const i386_types[] =
@@ -158,7 +158,7 @@ operatorT i386_operator (const char *nam
 	if (i386_operators[j].operands
 	    && i386_operators[j].operands != operands)
 	  return O_illegal;
-	return i386_operators[j].operator;
+	return i386_operators[j].op;
       }
 
   for (j = 0; i386_types[j].name; ++j)
@@ -175,7 +175,7 @@ operatorT i386_operator (const char *nam
 	  *pc = c;
 	  if (intel_syntax > 0 || operands != 1)
 	    return O_illegal;
-	  return i386_types[j].operator;
+	  return i386_types[j].op;
 	}
 
       *input_line_pointer = c;
diff -urp src.head/gas/config/tc-i386.c src.gas/gas/config/tc-i386.c
--- src.head/gas/config/tc-i386.c	2009-09-09 15:43:05.098177000 -0700
+++ src.gas/gas/config/tc-i386.c	2009-09-10 10:10:10.282723000 -0700
@@ -1851,7 +1851,7 @@ add_prefix (unsigned int prefix)
 static void
 set_code_flag (int value)
 {
-  flag_code = value;
+  flag_code = (enum flag_code) value;
   if (flag_code == CODE_64BIT)
     {
       cpu_arch_flags.bitfield.cpu64 = 1;
@@ -1876,7 +1876,7 @@ set_code_flag (int value)
 static void
 set_16bit_gcc_code_flag (int new_code_flag)
 {
-  flag_code = new_code_flag;
+  flag_code = (enum flag_code) new_code_flag;
   if (flag_code != CODE_16BIT)
     abort ();
   cpu_arch_flags.bitfield.cpu64 = 0;
@@ -1961,7 +1961,7 @@ set_sse_check (int dummy ATTRIBUTE_UNUSE
 
 static void
 check_cpu_arch_compatible (const char *name ATTRIBUTE_UNUSED,
-			   i386_cpu_flags new ATTRIBUTE_UNUSED)
+			   i386_cpu_flags new_flag ATTRIBUTE_UNUSED)
 {
 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
   static const char *arch;
@@ -1981,7 +1981,7 @@ check_cpu_arch_compatible (const char *n
 
   /* If we are targeting Intel L1OM, we must enable it.  */
   if (get_elf_backend_data (stdoutput)->elf_machine_code != EM_L1OM
-      || new.bitfield.cpul1om)
+      || new_flag.bitfield.cpul1om)
     return;
   
   as_bad (_("`%s' is not supported on `%s'"), name, arch);
@@ -6019,28 +6019,28 @@ lex_got (enum bfd_reloc_code_real *reloc
     const enum bfd_reloc_code_real rel[2];
     const i386_operand_type types64;
   } gotrel[] = {
-    { "PLTOFF",   { 0,
+    { "PLTOFF",   { _dummy_first_bfd_reloc_code_real,
 		    BFD_RELOC_X86_64_PLTOFF64 },
       OPERAND_TYPE_IMM64 },
     { "PLT",      { BFD_RELOC_386_PLT32,
 		    BFD_RELOC_X86_64_PLT32    },
       OPERAND_TYPE_IMM32_32S_DISP32 },
-    { "GOTPLT",   { 0,
+    { "GOTPLT",   { _dummy_first_bfd_reloc_code_real,
 		    BFD_RELOC_X86_64_GOTPLT64 },
       OPERAND_TYPE_IMM64_DISP64 },
     { "GOTOFF",   { BFD_RELOC_386_GOTOFF,
 		    BFD_RELOC_X86_64_GOTOFF64 },
       OPERAND_TYPE_IMM64_DISP64 },
-    { "GOTPCREL", { 0,
+    { "GOTPCREL", { _dummy_first_bfd_reloc_code_real,
 		    BFD_RELOC_X86_64_GOTPCREL },
       OPERAND_TYPE_IMM32_32S_DISP32 },
     { "TLSGD",    { BFD_RELOC_386_TLS_GD,
 		    BFD_RELOC_X86_64_TLSGD    },
       OPERAND_TYPE_IMM32_32S_DISP32 },
     { "TLSLDM",   { BFD_RELOC_386_TLS_LDM,
-		    0                         },
+		    _dummy_first_bfd_reloc_code_real },
       OPERAND_TYPE_NONE },
-    { "TLSLD",    { 0,
+    { "TLSLD",    { _dummy_first_bfd_reloc_code_real,
 		    BFD_RELOC_X86_64_TLSLD    },
       OPERAND_TYPE_IMM32_32S_DISP32 },
     { "GOTTPOFF", { BFD_RELOC_386_TLS_IE_32,
@@ -6050,17 +6050,17 @@ lex_got (enum bfd_reloc_code_real *reloc
 		    BFD_RELOC_X86_64_TPOFF32  },
       OPERAND_TYPE_IMM32_32S_64_DISP32_64 },
     { "NTPOFF",   { BFD_RELOC_386_TLS_LE,
-		    0                         },
+		    _dummy_first_bfd_reloc_code_real },
       OPERAND_TYPE_NONE },
     { "DTPOFF",   { BFD_RELOC_386_TLS_LDO_32,
 		    BFD_RELOC_X86_64_DTPOFF32 },
 
       OPERAND_TYPE_IMM32_32S_64_DISP32_64 },
     { "GOTNTPOFF",{ BFD_RELOC_386_TLS_GOTIE,
-		    0                         },
+		    _dummy_first_bfd_reloc_code_real },
       OPERAND_TYPE_NONE },
     { "INDNTPOFF",{ BFD_RELOC_386_TLS_IE,
-		    0                         },
+		    _dummy_first_bfd_reloc_code_real },
       OPERAND_TYPE_NONE },
     { "GOT",      { BFD_RELOC_386_GOT32,
 		    BFD_RELOC_X86_64_GOT32    },
@@ -6125,7 +6125,7 @@ lex_got (enum bfd_reloc_code_real *reloc
 
 	      /* Allocate and copy string.  The trailing NUL shouldn't
 		 be necessary, but be safe.  */
-	      tmpbuf = xmalloc (first + second + 2);
+	      tmpbuf = (char *) xmalloc (first + second + 2);
 	      memcpy (tmpbuf, input_line_pointer, first);
 	      if (second != 0 && *past_reloc != ' ')
 		/* Replace the relocation token with ' ', so that
@@ -7104,7 +7104,7 @@ md_estimate_size_before_relax (fragP, se
       int old_fr_fix;
 
       if (fragP->fr_var != NO_RELOC)
-	reloc_type = fragP->fr_var;
+	reloc_type = (enum bfd_reloc_code_real) fragP->fr_var;
       else if (size == 2)
 	reloc_type = BFD_RELOC_16_PCREL;
       else
@@ -7553,7 +7553,7 @@ parse_real_register (char *reg_string, c
 	      if (*s == ')')
 		{
 		  *end_op = s + 1;
-		  r = hash_find (reg_hash, "st(0)");
+		  r = (const reg_entry *) hash_find (reg_hash, "st(0)");
 		  know (r);
 		  return r + fpr;
 		}
diff -urp src.head/gas/dw2gencfi.c src.gas/gas/dw2gencfi.c
--- src.head/gas/dw2gencfi.c	2009-08-14 10:59:45.685081000 -0700
+++ src.gas/gas/dw2gencfi.c	2009-09-10 09:54:14.665201000 -0700
@@ -63,6 +63,10 @@
 # define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
 #endif
 
+struct cfi_escape_data {
+  struct cfi_escape_data *next;
+  expressionS exp;
+};
 
 struct cfi_insn_data
 {
@@ -87,10 +91,7 @@ struct cfi_insn_data
       symbolS *lab2;
     } ll;
 
-    struct cfi_escape_data {
-      struct cfi_escape_data *next;
-      expressionS exp;
-    } *esc;
+    struct cfi_escape_data *esc;
 
     struct {
       unsigned reg, encoding;
@@ -155,9 +156,11 @@ struct frch_cfi_data
 static struct fde_entry *
 alloc_fde_entry (void)
 {
-  struct fde_entry *fde = xcalloc (1, sizeof (struct fde_entry));
+  struct fde_entry *fde = (struct fde_entry *)
+      xcalloc (1, sizeof (struct fde_entry));
 
-  frchain_now->frch_cfi_data = xcalloc (1, sizeof (struct frch_cfi_data));
+  frchain_now->frch_cfi_data = (struct frch_cfi_data *)
+      xcalloc (1, sizeof (struct frch_cfi_data));
   frchain_now->frch_cfi_data->cur_fde_data = fde;
   *last_fde_data = fde;
   last_fde_data = &fde->next;
@@ -179,7 +182,8 @@ alloc_fde_entry (void)
 static struct cfi_insn_data *
 alloc_cfi_insn_data (void)
 {
-  struct cfi_insn_data *insn = xcalloc (1, sizeof (struct cfi_insn_data));
+  struct cfi_insn_data *insn = (struct cfi_insn_data *)
+      xcalloc (1, sizeof (struct cfi_insn_data));
   struct fde_entry *cur_fde_data = frchain_now->frch_cfi_data->cur_fde_data;
 
   *cur_fde_data->last = insn;
@@ -353,7 +357,7 @@ cfi_add_CFA_remember_state (void)
 
   cfi_add_CFA_insn (DW_CFA_remember_state);
 
-  p = xmalloc (sizeof (*p));
+  p = (struct cfa_save_data *) xmalloc (sizeof (*p));
   p->cfa_offset = frchain_now->frch_cfi_data->cur_cfa_offset;
   p->next = frchain_now->frch_cfi_data->cfa_save_stack;
   frchain_now->frch_cfi_data->cfa_save_stack = p;
@@ -637,7 +641,7 @@ dot_cfi_escape (int ignored ATTRIBUTE_UN
   tail = &head;
   do
     {
-      e = xmalloc (sizeof (*e));
+      e = (struct cfi_escape_data *) xmalloc (sizeof (*e));
       do_parse_cons_expression (&e->exp, 1);
       *tail = e;
       tail = &e->next;
@@ -1454,7 +1458,7 @@ select_cie_for_fde (struct fde_entry *fd
     fail:;
     }
 
-  cie = xmalloc (sizeof (struct cie_entry));
+  cie = (struct cie_entry *) xmalloc (sizeof (struct cie_entry));
   cie->next = cie_root;
   cie_root = cie;
   cie->return_column = fde->return_column;
diff -urp src.head/gas/dwarf2dbg.c src.gas/gas/dwarf2dbg.c
--- src.head/gas/dwarf2dbg.c	2009-09-07 13:21:22.777508000 -0700
+++ src.gas/gas/dwarf2dbg.c	2009-09-10 09:51:56.871064000 -0700
@@ -467,7 +467,7 @@ get_filenum (const char *filename, unsig
 		     xrealloc (dirs, (dir + 32) * sizeof (const char *));
 	    }
 
-	  dirs[dir] = xmalloc (dir_len + 1);
+	  dirs[dir] = (char *) xmalloc (dir_len + 1);
 	  memcpy (dirs[dir], filename, dir_len);
 	  dirs[dir][dir_len] = '\0';
 	  dirs_in_use = dir + 1;
diff -urp src.head/gas/dwarf2dbg.h src.gas/gas/dwarf2dbg.h
--- src.head/gas/dwarf2dbg.h	2009-09-07 13:21:22.797478000 -0700
+++ src.gas/gas/dwarf2dbg.h	2009-09-10 09:51:42.901065000 -0700
@@ -83,7 +83,7 @@ extern void dwarf2_emit_label (symbolS *
 
 /* True when we've seen a .loc directive recently.  Used to avoid
    doing work when there's nothing to do.  */
-bfd_boolean dwarf2_loc_directive_seen;
+extern bfd_boolean dwarf2_loc_directive_seen;
 
 /* True when we're supposed to set the basic block mark whenever a label
    is seen.  Unless the target is doing Something Weird, just call 
diff -urp src.head/gas/ehopt.c src.gas/gas/ehopt.c
--- src.head/gas/ehopt.c	2009-09-07 13:21:22.853442000 -0700
+++ src.gas/gas/ehopt.c	2009-09-10 09:55:26.653728000 -0700
@@ -227,6 +227,19 @@ get_cie_info (struct cie_info *info)
   return 1;
 }
 
+enum frame_state
+{
+  state_idle,
+  state_saw_size,
+  state_saw_cie_offset,
+  state_saw_pc_begin,
+  state_seeing_aug_size,
+  state_skipping_aug,
+  state_wait_loc4,
+  state_saw_loc4,
+  state_error,
+};
+
 /* This function is called from emit_expr.  It looks for cases which
    we can optimize.
 
@@ -245,18 +258,7 @@ check_eh_frame (expressionS *exp, unsign
 {
   struct frame_data
   {
-    enum frame_state
-    {
-      state_idle,
-      state_saw_size,
-      state_saw_cie_offset,
-      state_saw_pc_begin,
-      state_seeing_aug_size,
-      state_skipping_aug,
-      state_wait_loc4,
-      state_saw_loc4,
-      state_error,
-    } state;
+    enum frame_state state;
 
     int cie_info_ok;
     struct cie_info cie_info;
@@ -324,7 +326,7 @@ check_eh_frame (expressionS *exp, unsign
     case state_saw_size:
     case state_saw_cie_offset:
       /* Assume whatever form it appears in, it appears atomically.  */
-      d->state += 1;
+      d->state = (enum frame_state) (d->state + 1);
       break;
 
     case state_saw_pc_begin:
diff -urp src.head/gas/expr.c src.gas/gas/expr.c
--- src.head/gas/expr.c	2009-09-07 13:21:22.893473000 -0700
+++ src.gas/gas/expr.c	2009-09-10 09:57:02.300815000 -0700
@@ -48,7 +48,7 @@ static void mri_char_constant (expressio
 static void current_location (expressionS *);
 static void clean_up_expression (expressionS * expressionP);
 static segT operand (expressionS *, enum expr_mode);
-static operatorT operator (int *);
+static operatorT operatorf (int *);
 
 extern const char EXP_CHARS[], FLT_CHARS[];
 
@@ -1228,9 +1228,9 @@ operand (expressionS *expressionP, enum 
 
 #ifdef md_operator
 	  {
-	    operatorT operator = md_operator (name, 1, &c);
+	    operatorT op = md_operator (name, 1, &c);
 
-	    switch (operator)
+	    switch (op)
 	      {
 	      case O_uminus:
 		*input_line_pointer = c;
@@ -1250,14 +1250,14 @@ operand (expressionS *expressionP, enum 
 	      default:
 		break;
 	      }
-	    if (operator != O_absent && operator != O_illegal)
+	    if (op != O_absent && op != O_illegal)
 	      {
 		*input_line_pointer = c;
 		expr (9, expressionP, mode);
 		expressionP->X_add_symbol = make_expr_symbol (expressionP);
 		expressionP->X_op_symbol = NULL;
 		expressionP->X_add_number = 0;
-		expressionP->X_op = operator;
+		expressionP->X_op = op;
 		break;
 	      }
 	  }
@@ -1546,10 +1546,10 @@ expr_set_precedence (void)
 }
 
 void
-expr_set_rank (operatorT operator, operator_rankT rank)
+expr_set_rank (operatorT op, operator_rankT rank)
 {
-  gas_assert (operator >= O_md1 && operator < ARRAY_SIZE (op_rank));
-  op_rank[operator] = rank;
+  gas_assert (op >= O_md1 && op < ARRAY_SIZE (op_rank));
+  op_rank[op] = rank;
 }
 
 /* Initialize the expression parser.  */
@@ -1572,7 +1572,7 @@ expr_begin (void)
    Does not advance INPUT_LINE_POINTER.  */
 
 static inline operatorT
-operator (int *num_chars)
+operatorf (int *num_chars)
 {
   int c;
   operatorT ret;
@@ -1732,7 +1732,7 @@ expr (int rankarg,		/* Larger # is highe
   /* operand () gobbles spaces.  */
   know (*input_line_pointer != ' ');
 
-  op_left = operator (&op_chars);
+  op_left = operatorf (&op_chars);
   while (op_left != O_illegal && op_rank[(int) op_left] > rank)
     {
       segT rightseg;
@@ -1763,7 +1763,7 @@ expr (int rankarg,		/* Larger # is highe
 	    }
 	}
 
-      op_right = operator (&op_chars);
+      op_right = operatorf (&op_chars);
 
       know (op_right == O_illegal || op_left == O_index
 	    || op_rank[(int) op_right] <= op_rank[(int) op_left]);
diff -urp src.head/gas/frags.c src.gas/gas/frags.c
--- src.head/gas/frags.c	2009-09-07 13:21:22.969442000 -0700
+++ src.gas/gas/frags.c	2009-09-10 09:58:05.313685000 -0700
@@ -69,7 +69,7 @@ frag_alloc (struct obstack *ob)
   (void) obstack_alloc (ob, 0);
   oalign = obstack_alignment_mask (ob);
   obstack_alignment_mask (ob) = 0;
-  ptr = obstack_alloc (ob, SIZEOF_STRUCT_FRAG);
+  ptr = (fragS *) obstack_alloc (ob, SIZEOF_STRUCT_FRAG);
   obstack_alignment_mask (ob) = oalign;
   memset (ptr, 0, SIZEOF_STRUCT_FRAG);
   return ptr;
diff -urp src.head/gas/hash.c src.gas/gas/hash.c
--- src.head/gas/hash.c	2009-06-16 09:07:26.074705000 -0700
+++ src.gas/gas/hash.c	2009-09-10 09:58:38.804898000 -0700
@@ -113,10 +113,10 @@ hash_new (void)
 
   size = get_gas_hash_table_size ();
 
-  ret = xmalloc (sizeof *ret);
+  ret = (struct hash_control *) xmalloc (sizeof *ret);
   obstack_begin (&ret->memory, chunksize);
   alloc = size * sizeof (struct hash_entry *);
-  ret->table = obstack_alloc (&ret->memory, alloc);
+  ret->table = (struct hash_entry **) obstack_alloc (&ret->memory, alloc);
   memset (ret->table, 0, alloc);
   ret->size = size;
 
@@ -237,7 +237,7 @@ hash_insert (struct hash_control *table,
   ++table->insertions;
 #endif
 
-  p = obstack_alloc (&table->memory, sizeof (*p));
+  p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
   p->string = key;
   p->hash = hash;
   p->data = value;
@@ -274,7 +274,7 @@ hash_jam (struct hash_control *table, co
       ++table->insertions;
 #endif
 
-      p = obstack_alloc (&table->memory, sizeof (*p));
+      p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
       p->string = key;
       p->hash = hash;
       p->data = value;
diff -urp src.head/gas/input-scrub.c src.gas/gas/input-scrub.c
--- src.head/gas/input-scrub.c	2009-09-07 13:21:23.351445000 -0700
+++ src.gas/gas/input-scrub.c	2009-09-10 09:59:08.036637000 -0700
@@ -165,7 +165,8 @@ input_scrub_push (char *saved_position)
   buffer_length = input_file_buffer_size ();
   sb_index = -1;
 
-  buffer_start = xmalloc ((BEFORE_SIZE + buffer_length + buffer_length + AFTER_SIZE));
+  buffer_start = (char *) xmalloc ((BEFORE_SIZE + buffer_length
+                                    + buffer_length + AFTER_SIZE));
   memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE);
 
   return saved;
@@ -209,7 +210,8 @@ input_scrub_begin (void)
 
   buffer_length = input_file_buffer_size ();
 
-  buffer_start = xmalloc ((BEFORE_SIZE + buffer_length + buffer_length + AFTER_SIZE));
+  buffer_start = (char *) xmalloc ((BEFORE_SIZE + buffer_length
+                                    + buffer_length + AFTER_SIZE));
   memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE);
 
   /* Line number things.  */
@@ -363,10 +365,10 @@ input_scrub_next_buffer (char **bufp)
 
 	  limoff = limit - buffer_start;
 	  buffer_length += input_file_buffer_size ();
-	  buffer_start = xrealloc (buffer_start,
-				   (BEFORE_SIZE
-				    + 2 * buffer_length
-				    + AFTER_SIZE));
+	  buffer_start = (char *) xrealloc (buffer_start,
+                                            (BEFORE_SIZE
+                                             + 2 * buffer_length
+                                             + AFTER_SIZE));
 	  *bufp = buffer_start + BEFORE_SIZE;
 	  limit = input_file_give_next_buffer (buffer_start + limoff);
 
diff -urp src.head/gas/listing.c src.gas/gas/listing.c
--- src.head/gas/listing.c	2009-09-07 13:21:23.399454000 -0700
+++ src.gas/gas/listing.c	2009-09-10 10:00:43.690762000 -0700
@@ -130,6 +130,18 @@ typedef struct file_info_struct
   int                       at_end;
 } file_info_type;
 
+enum edict_enum
+{
+  EDICT_NONE,
+  EDICT_SBTTL,
+  EDICT_TITLE,
+  EDICT_NOLIST,
+  EDICT_LIST,
+  EDICT_NOLIST_NEXT,
+  EDICT_EJECT
+};
+
+
 /* This structure remembers which line from which file goes into which
    frag.  */
 struct list_info_struct
@@ -160,16 +172,7 @@ struct list_info_struct
   /* Pointer to any error message associated with this line.  */
   char *message;
 
-  enum
-    {
-      EDICT_NONE,
-      EDICT_SBTTL,
-      EDICT_TITLE,
-      EDICT_NOLIST,
-      EDICT_LIST,
-      EDICT_NOLIST_NEXT,
-      EDICT_EJECT
-    } edict;
+  enum edict_enum edict;
   char *edict_arg;
 
   /* Nonzero if this line is to be omitted because it contains
@@ -260,7 +263,7 @@ file_info (const char *file_name)
     }
 
   /* Make new entry.  */
-  p = xmalloc (sizeof (file_info_type));
+  p = (file_info_type *) xmalloc (sizeof (file_info_type));
   p->next = file_info_head;
   file_info_head = p;
   p->filename = xstrdup (file_name);
@@ -352,7 +355,7 @@ listing_newline (char *ps)
 
 	  len = (copy - input_line_pointer) + 2;
 
-	  copy = xmalloc (len);
+	  copy = (char *) xmalloc (len);
 
 	  if (copy != NULL)
 	    {
@@ -1147,8 +1150,8 @@ listing_listing (char *name ATTRIBUTE_UN
   int show_listing = 1;
   unsigned int width;
 
-  buffer = xmalloc (listing_rhs_width);
-  data_buffer = xmalloc (MAX_BYTES);
+  buffer = (char *) xmalloc (listing_rhs_width);
+  data_buffer = (char *) xmalloc (MAX_BYTES);
   eject = 1;
   list = head->next;
 
@@ -1509,7 +1512,7 @@ listing_title (int depth)
 	  if (listing)
 	    {
 	      length = input_line_pointer - start;
-	      ttl = xmalloc (length + 1);
+	      ttl = (char *) xmalloc (length + 1);
 	      memcpy (ttl, start, length);
 	      ttl[length] = 0;
 	      listing_tail->edict = depth ? EDICT_SBTTL : EDICT_TITLE;
diff -urp src.head/gas/macro.c src.gas/gas/macro.c
--- src.head/gas/macro.c	2009-06-16 09:07:26.133696000 -0700
+++ src.gas/gas/macro.c	2009-09-10 10:02:09.783335000 -0700
@@ -393,7 +393,7 @@ get_any_string (int idx, sb *in, sb *out
 	}
       else
 	{
-	  char *br_buf = xmalloc(1);
+	  char *br_buf = (char *) xmalloc(1);
 	  char *in_br = br_buf;
 
 	  *in_br = '\0';
@@ -424,7 +424,7 @@ get_any_string (int idx, sb *in, sb *out
 		    --in_br;
 		  else
 		    {
-		      br_buf = xmalloc(strlen(in_br) + 2);
+		      br_buf = (char *) xmalloc(strlen(in_br) + 2);
 		      strcpy(br_buf + 1, in_br);
 		      free(in_br);
 		      in_br = br_buf;
@@ -457,7 +457,7 @@ new_formal (void)
 {
   formal_entry *formal;
 
-  formal = xmalloc (sizeof (formal_entry));
+  formal = (formal_entry *) xmalloc (sizeof (formal_entry));
 
   sb_new (&formal->name);
   sb_new (&formal->def);
@@ -1273,7 +1273,7 @@ delete_macro (const char *name)
   /* We can only ask hash_delete to free memory if we are deleting
      macros in reverse order to their definition.
      So just clear out the entry.  */
-  if ((macro = hash_find (macro_hash, copy)) != NULL)
+  if ((macro = (macro_entry *) hash_find (macro_hash, copy)) != NULL)
     {
       hash_jam (macro_hash, copy, NULL);
       free_macro (macro);
diff -urp src.head/gas/macro.h src.gas/gas/macro.h
--- src.head/gas/macro.h	2009-09-07 13:21:23.432440000 -0700
+++ src.gas/gas/macro.h	2009-09-10 10:01:48.939401000 -0700
@@ -34,6 +34,13 @@
    name and its default value.  Each time the macro is expanded, the
    formals get the actual values attached to them.  */
 
+enum formal_type
+  {
+    FORMAL_OPTIONAL,
+    FORMAL_REQUIRED,
+    FORMAL_VARARG
+  };
+
 /* Describe the formal arguments to a macro.  */
 
 typedef struct formal_struct {
@@ -42,12 +49,7 @@ typedef struct formal_struct {
   sb def;			/* The default value.  */
   sb actual;			/* The actual argument (changed on each expansion).  */
   int index;			/* The index of the formal 0..formal_count - 1.  */
-  enum formal_type
-    {
-      FORMAL_OPTIONAL,
-      FORMAL_REQUIRED,
-      FORMAL_VARARG
-    } type;			/* The kind of the formal.  */
+  enum formal_type type;	/* The kind of the formal.  */
 } formal_entry;
 
 /* Other values found in the index field of a formal_entry.  */
diff -urp src.head/gas/read.c src.gas/gas/read.c
--- src.head/gas/read.c	2009-09-09 15:43:04.991145000 -0700
+++ src.gas/gas/read.c	2009-09-10 10:03:19.545210000 -0700
@@ -1034,7 +1034,7 @@ read_a_source_file (char *name)
 		     that goes with this #APP  There is one.  The specs
 		     guarantee it...  */
 		  tmp_len = buffer_limit - s;
-		  tmp_buf = xmalloc (tmp_len + 1);
+		  tmp_buf = (char *) xmalloc (tmp_len + 1);
 		  memcpy (tmp_buf, s, tmp_len);
 		  do
 		    {
@@ -1050,7 +1050,7 @@ read_a_source_file (char *name)
 		      else
 			num = buffer_limit - buffer;
 
-		      tmp_buf = xrealloc (tmp_buf, tmp_len + num);
+		      tmp_buf = (char *) xrealloc (tmp_buf, tmp_len + num);
 		      memcpy (tmp_buf + tmp_len, buffer, num);
 		      tmp_len += num;
 		    }
@@ -1087,7 +1087,7 @@ read_a_source_file (char *name)
 		      break;
 		    }
 
-		  new_buf = xrealloc (new_buf, new_length + 100);
+		  new_buf = (char *) xrealloc (new_buf, new_length + 100);
 		  new_tmp = new_buf + new_length;
 		  new_length += 100;
 		}
@@ -2097,7 +2097,7 @@ s_vendor_attribute (int vendor)
       if (i == 0)
 	goto bad;
 
-      name = alloca (i + 1);
+      name = (char *) alloca (i + 1);
       memcpy (name, s, i);
       name[i] = '\0';
 
@@ -3857,7 +3857,7 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
   int c;
   struct reloc_list *reloc;
 
-  reloc = xmalloc (sizeof (*reloc));
+  reloc = (struct reloc_list *) xmalloc (sizeof (*reloc));
 
   if (flag_mri)
     stop = mri_comment_field (&stopc);
@@ -5407,7 +5407,7 @@ demand_copy_string (int *lenP)
       /* JF this next line is so demand_copy_C_string will return a
 	 null terminated string.  */
       obstack_1grow (&notes, '\0');
-      retval = obstack_finish (&notes);
+      retval = (char *) obstack_finish (&notes);
     }
   else
     {
@@ -5516,7 +5516,7 @@ s_incbin (int x ATTRIBUTE_UNUSED)
     {
       int i;
 
-      path = xmalloc ((unsigned long) len + include_dir_maxlen + 5);
+      path = (char *) xmalloc ((unsigned long) len + include_dir_maxlen + 5);
 
       for (i = 0; i < include_dir_count; i++)
 	{
@@ -5586,7 +5586,7 @@ s_include (int arg ATTRIBUTE_UNUSED)
 {
   char *filename;
   int i;
-  FILE *try;
+  FILE *try_file;
   char *path;
 
   if (!flag_m68k_mri)
@@ -5613,22 +5613,23 @@ s_include (int arg ATTRIBUTE_UNUSED)
 	}
 
       obstack_1grow (&notes, '\0');
-      filename = obstack_finish (&notes);
+      filename = (char *) obstack_finish (&notes);
       while (!is_end_of_line[(unsigned char) *input_line_pointer])
 	++input_line_pointer;
     }
 
   demand_empty_rest_of_line ();
-  path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
+  path = (char *) xmalloc ((unsigned long) i
+                           + include_dir_maxlen + 5 /* slop */ );
 
   for (i = 0; i < include_dir_count; i++)
     {
       strcpy (path, include_dirs[i]);
       strcat (path, "/");
       strcat (path, filename);
-      if (0 != (try = fopen (path, FOPEN_RT)))
+      if (0 != (try_file = fopen (path, FOPEN_RT)))
 	{
-	  fclose (try);
+	  fclose (try_file);
 	  goto gotit;
 	}
     }
diff -urp src.head/gas/remap.c src.gas/gas/remap.c
--- src.head/gas/remap.c	2009-06-16 09:07:26.188659000 -0700
+++ src.gas/gas/remap.c	2009-09-10 10:03:33.976140000 -0700
@@ -52,7 +52,7 @@ add_debug_prefix_map (const char *arg)
       as_fatal (_("invalid argument '%s' to -fdebug-prefix-map"), arg);
       return;
     }
-  map = xmalloc (sizeof (debug_prefix_map));
+  map = (struct debug_prefix_map *) xmalloc (sizeof (debug_prefix_map));
   o = xstrdup (arg);
   map->old_prefix = o;
   map->old_len = p - arg;
diff -urp src.head/gas/stabs.c src.gas/gas/stabs.c
--- src.head/gas/stabs.c	2009-06-16 09:07:26.197662000 -0700
+++ src.gas/gas/stabs.c	2009-09-10 10:03:44.073700000 -0700
@@ -498,7 +498,7 @@ stabs_generate_asm_file (void)
       char *dir2;
 
       dir = remap_debug_filename (getpwd ());
-      dir2 = alloca (strlen (dir) + 2);
+      dir2 = (char *) alloca (strlen (dir) + 2);
       sprintf (dir2, "%s%s", dir, "/");
       generate_asm_file (N_SO, dir2);
     }
@@ -536,7 +536,7 @@ generate_asm_file (int type, char *file)
   /* Allocate enough space for the file name (possibly extended with
      doubled up backslashes), the symbol name, and the other characters
      that make up a stabs file directive.  */
-  bufp = buf = xmalloc (2 * strlen (file) + strlen (sym) + 12);
+  bufp = buf = (char *) xmalloc (2 * strlen (file) + strlen (sym) + 12);
 
   *bufp++ = '"';
 
diff -urp src.head/gas/subsegs.c src.gas/gas/subsegs.c
--- src.head/gas/subsegs.c	2009-09-07 13:21:23.576452000 -0700
+++ src.gas/gas/subsegs.c	2009-09-10 10:04:26.271571000 -0700
@@ -65,7 +65,7 @@ subseg_change (register segT seg, regist
 
   if (! seginfo)
     {
-      seginfo = xcalloc (1, sizeof (*seginfo));
+      seginfo = (segment_info_type *) xcalloc (1, sizeof (*seginfo));
       seginfo->bfd_section = seg;
       bfd_set_section_userdata (stdoutput, seg, seginfo);
     }
@@ -103,7 +103,7 @@ subseg_set_rest (segT seg, subsegT subse
     {
       /* This should be the only code that creates a frchainS.  */
 
-      newP = obstack_alloc (&frchains, sizeof (frchainS));
+      newP = (frchainS *) obstack_alloc (&frchains, sizeof (frchainS));
       newP->frch_subseg = subseg;
       newP->fix_root = NULL;
       newP->fix_tail = NULL;
@@ -167,7 +167,7 @@ subseg_get (const char *segname, int for
   if (! seginfo)
     {
       secptr->output_section = secptr;
-      seginfo = xcalloc (1, sizeof (*seginfo));
+      seginfo = (segment_info_type *) xcalloc (1, sizeof (*seginfo));
       seginfo->bfd_section = secptr;
       bfd_set_section_userdata (stdoutput, secptr, seginfo);
     }
diff -urp src.head/gas/symbols.c src.gas/gas/symbols.c
--- src.head/gas/symbols.c	2009-09-09 15:43:05.007168000 -0700
+++ src.gas/gas/symbols.c	2009-09-10 10:05:33.432776000 -0700
@@ -109,7 +109,7 @@ save_symbol_name (const char *name)
 
   name_length = strlen (name) + 1;	/* +1 for \0.  */
   obstack_grow (&notes, name, name_length);
-  ret = obstack_finish (&notes);
+  ret = (char *) obstack_finish (&notes);
 
 #ifdef tc_canonicalize_symbol_name
   ret = tc_canonicalize_symbol_name (ret);
@@ -137,7 +137,7 @@ symbol_create (const char *name, /* It i
 
   preserved_copy_of_name = save_symbol_name (name);
 
-  symbolP = obstack_alloc (&notes, sizeof (symbolS));
+  symbolP = (symbolS *) obstack_alloc (&notes, sizeof (symbolS));
 
   /* symbol must be born in some fixed state.  This seems as good as any.  */
   memset (symbolP, 0, sizeof (symbolS));
@@ -197,7 +197,7 @@ local_symbol_make (const char *name, seg
 
   name_copy = save_symbol_name (name);
 
-  ret = obstack_alloc (&notes, sizeof *ret);
+  ret = (struct local_symbol *) obstack_alloc (&notes, sizeof *ret);
   ret->lsy_marker = NULL;
   ret->lsy_name = name_copy;
   ret->lsy_section = section;
@@ -563,7 +563,7 @@ symbol_clone (symbolS *orgsymP, int repl
     orgsymP = local_symbol_convert ((struct local_symbol *) orgsymP);
   bsymorg = orgsymP->bsym;
 
-  newsymP = obstack_alloc (&notes, sizeof (*newsymP));
+  newsymP = (symbolS *) obstack_alloc (&notes, sizeof (*newsymP));
   *newsymP = *orgsymP;
   bsymnew = bfd_make_empty_symbol (bfd_asymbol_bfd (bsymorg));
   if (bsymnew == NULL)
@@ -1453,7 +1453,7 @@ static void
 resolve_local_symbol (const char *key ATTRIBUTE_UNUSED, void *value)
 {
   if (value != NULL)
-    resolve_symbol_value (value);
+    resolve_symbol_value ((symbolS *) value);
 }
 
 /* Resolve all local symbols.  */
@@ -1603,7 +1603,7 @@ define_dollar_label (long label)
     {
       dollar_labels = (long *) xmalloc (DOLLAR_LABEL_BUMP_BY * sizeof (long));
       dollar_label_instances = (long *) xmalloc (DOLLAR_LABEL_BUMP_BY * sizeof (long));
-      dollar_label_defines = xmalloc (DOLLAR_LABEL_BUMP_BY);
+      dollar_label_defines = (char *) xmalloc (DOLLAR_LABEL_BUMP_BY);
       dollar_label_max = DOLLAR_LABEL_BUMP_BY;
       dollar_label_count = 0;
     }
@@ -1614,7 +1614,7 @@ define_dollar_label (long label)
 					 dollar_label_max * sizeof (long));
       dollar_label_instances = (long *) xrealloc ((char *) dollar_label_instances,
 					  dollar_label_max * sizeof (long));
-      dollar_label_defines = xrealloc (dollar_label_defines, dollar_label_max);
+      dollar_label_defines = (char *) xrealloc (dollar_label_defines, dollar_label_max);
     }				/* if we needed to grow  */
 
   dollar_labels[dollar_label_count] = label;
@@ -1887,7 +1887,7 @@ decode_local_label_name (char *s)
     instance_number = (10 * instance_number) + *p - '0';
 
   message_format = _("\"%d\" (instance number %d of a %s label)");
-  symbol_decode = obstack_alloc (&notes, strlen (message_format) + 30);
+  symbol_decode = (char *) obstack_alloc (&notes, strlen (message_format) + 30);
   sprintf (symbol_decode, message_format, label_number, instance_number, type);
 
   return symbol_decode;
diff -urp src.head/gas/write.c src.gas/gas/write.c
--- src.head/gas/write.c	2009-09-07 13:21:23.648452000 -0700
+++ src.gas/gas/write.c	2009-09-10 10:06:06.136105000 -0700
@@ -156,7 +156,7 @@ fix_new_internal (fragS *frag,		/* Which
 
   n_fixups++;
 
-  fixP = obstack_alloc (&notes, sizeof (fixS));
+  fixP = (fixS *) obstack_alloc (&notes, sizeof (fixS));
 
   fixP->fx_frag = frag;
   fixP->fx_where = where;
@@ -1170,7 +1170,7 @@ write_relocs (bfd *abfd, asection *sec, 
 	rp = &r->next;
     }
 
-  relocs = xcalloc (n, sizeof (arelent *));
+  relocs = (arelent **) xcalloc (n, sizeof (arelent *));
 
   i = 0;
   for (fixp = seginfo->fix_root; fixp != (fixS *) NULL; fixp = fixp->fx_next)
@@ -1398,7 +1398,7 @@ set_symtab (void)
       int i;
       bfd_size_type amt = (bfd_size_type) nsyms * sizeof (asymbol *);
 
-      asympp = bfd_alloc (stdoutput, amt);
+      asympp = (asymbol **) bfd_alloc (stdoutput, amt);
       symp = symbol_rootP;
       for (i = 0; i < nsyms; i++, symp = symbol_next (symp))
 	{
diff -urp src.head/libiberty/regex.c src.gas/libiberty/regex.c
--- src.head/libiberty/regex.c	2009-06-16 09:07:22.690146000 -0700
+++ src.gas/libiberty/regex.c	2009-09-10 09:49:33.190912000 -0700
@@ -5908,22 +5908,24 @@ 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)
-		best_match_p = d > match_end;
-	      else
-		best_match_p = !MATCHING_IN_FIRST_STRING;
-
-              DEBUG_PRINT1 ("backtracking.\n");
+              {
+                /* 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);
+
+                /* AIX compiler got confused when this was combined
+                   with the previous declaration.  */
+                if (same_str_p)
+                  best_match_p = d > match_end;
+                else
+                  best_match_p = !MATCHING_IN_FIRST_STRING;
 
+                DEBUG_PRINT1 ("backtracking.\n");
+              }
               if (!FAIL_STACK_EMPTY ())
                 { /* More failure points to try.  */
 

Attachment: gprof.changelog
Description: Binary data

diff -urp src.head/gprof/basic_blocks.c src.gas/gprof/basic_blocks.c
--- src.head/gprof/basic_blocks.c	2009-06-16 09:08:11.374086000 -0700
+++ src.gas/gprof/basic_blocks.c	2009-09-10 10:25:11.964052000 -0700
@@ -319,7 +319,7 @@ print_exec_counts ()
 static void
 annotate_with_count (char *buf, unsigned int width, int line_num, PTR arg)
 {
-  Source_File *sf = arg;
+  Source_File *sf = (Source_File *) arg;
   Sym *b;
   unsigned int i;
   static unsigned long last_count;
@@ -328,7 +328,7 @@ annotate_with_count (char *buf, unsigned
   b = NULL;
 
   if (line_num <= sf->num_lines)
-    b = sf->line[line_num - 1];
+    b = (Sym *) sf->line[line_num - 1];
 
   if (!b)
     {
@@ -488,7 +488,7 @@ print_annotated_source ()
     {
       if (sf->num_lines > 0)
 	{
-	  sf->line = (void *) xmalloc (sf->num_lines * sizeof (sf->line[0]));
+	  sf->line = (void **) xmalloc (sf->num_lines * sizeof (sf->line[0]));
 	  memset (sf->line, 0, sf->num_lines * sizeof (sf->line[0]));
 	}
     }
@@ -502,7 +502,7 @@ print_annotated_source ()
 		  && !sym_lookup (&syms[EXCL_ANNO], sym->addr))))
 	{
 	  sym->file->ncalls += sym->ncalls;
-	  line_stats = sym->file->line[sym->line_num - 1];
+	  line_stats = (Sym *) sym->file->line[sym->line_num - 1];
 
 	  if (!line_stats)
 	    {
@@ -552,7 +552,7 @@ print_annotated_source ()
 
 	  for (i = 0; i < table_len; ++i)
 	    {
-	      sym = sf->line[i];
+	      sym = (Sym *) sf->line[i];
 
 	      if (!sym || sym->ncalls == 0)
 		  break;
diff -urp src.head/gprof/cg_dfn.c src.gas/gprof/cg_dfn.c
--- src.head/gprof/cg_dfn.c	2009-06-16 09:08:11.420059000 -0700
+++ src.gas/gprof/cg_dfn.c	2009-09-10 10:25:56.229667000 -0700
@@ -217,7 +217,8 @@ pre_visit (Sym *parent)
   if (dfn_depth >= dfn_maxdepth)
     {
       dfn_maxdepth += DFN_INCR_DEPTH;
-      dfn_stack = xrealloc (dfn_stack, dfn_maxdepth * sizeof *dfn_stack);
+      dfn_stack = (DFN_Stack *) xrealloc (dfn_stack,
+                                          dfn_maxdepth * sizeof *dfn_stack);
     }
 
   dfn_stack[dfn_depth].sym = parent;
diff -urp src.head/gprof/corefile.c src.gas/gprof/corefile.c
--- src.head/gprof/corefile.c	2009-09-07 13:21:31.327312000 -0700
+++ src.gas/gprof/corefile.c	2009-09-10 10:27:08.707119000 -0700
@@ -140,7 +140,7 @@ read_function_mappings (const char *file
 	}
 
       /* dummy has the filename, go ahead and copy it.  */
-      symbol_map[count].file_name = xmalloc (strlen (dummy) + 1);
+      symbol_map[count].file_name = (char *) xmalloc (strlen (dummy) + 1);
       strcpy (symbol_map[count].file_name, dummy);
 
       /* Now we need the function name.  */
@@ -148,7 +148,7 @@ read_function_mappings (const char *file
       if (!matches)
 	parse_error (filename);
       tmp = strrchr (dummy, ' ') + 1;
-      symbol_map[count].function_name = xmalloc (strlen (tmp) + 1);
+      symbol_map[count].function_name = (char *) xmalloc (strlen (tmp) + 1);
       strcpy (symbol_map[count].function_name, tmp);
       count++;
     }
@@ -227,7 +227,7 @@ core_init (const char * aout_name)
       long i;
 
       new_size = (core_num_syms + synth_count + 1) * sizeof (*core_syms);
-      core_syms = xrealloc (core_syms, new_size);
+      core_syms = (asymbol **) xrealloc (core_syms, new_size);
       symp = core_syms + core_num_syms;
       core_num_syms += synth_count;
       for (i = 0; i < synth_count; i++)
@@ -577,8 +577,10 @@ core_create_function_syms (void)
       /* Don't create a symtab entry for a function that has
 	 a mapping to a file, unless it's the first function
 	 in the file.  */
-      found = bsearch (core_syms[i]->name, symbol_map, symbol_map_count,
-		       sizeof (struct function_map), search_mapped_symbol);
+      found = (struct function_map *) bsearch (core_syms[i]->name, symbol_map,
+                                               symbol_map_count,
+                                               sizeof (struct function_map),
+                                               search_mapped_symbol);
       if (found == NULL || found->is_first)
 	++symtab.len;
     }
@@ -609,7 +611,8 @@ core_create_function_syms (void)
 	  continue;
 	}
 
-      found = bsearch (core_syms[i]->name, symbol_map, symbol_map_count,
+      found = (struct function_map *) bsearch (core_syms[i]->name, symbol_map,
+                                               symbol_map_count,
 		       sizeof (struct function_map), search_mapped_symbol);
       if (found && ! found->is_first)
 	continue;
@@ -726,8 +729,8 @@ core_create_line_syms (void)
      BFD would provide an iterator for enumerating all line infos.  */
   prev_name_len = PATH_MAX;
   prev_filename_len = PATH_MAX;
-  prev_name = xmalloc (prev_name_len);
-  prev_filename = xmalloc (prev_filename_len);
+  prev_name = (char *) xmalloc (prev_name_len);
+  prev_filename = (char *) xmalloc (prev_filename_len);
   ltab.len = 0;
   prev_line_num = 0;
 
@@ -751,7 +754,7 @@ core_create_line_syms (void)
 	{
 	  prev_name_len = len + 1024;
 	  free (prev_name);
-	  prev_name = xmalloc (prev_name_len);
+	  prev_name = (char *) xmalloc (prev_name_len);
 	}
 
       strcpy (prev_name, dummy.name);
@@ -761,7 +764,7 @@ core_create_line_syms (void)
 	{
 	  prev_filename_len = len + 1024;
 	  free (prev_filename);
-	  prev_filename = xmalloc (prev_filename_len);
+	  prev_filename = (char *) xmalloc (prev_filename_len);
 	}
 
       strcpy (prev_filename, filename);
diff -urp src.head/gprof/gmon_io.c src.gas/gprof/gmon_io.c
--- src.head/gprof/gmon_io.c	2009-06-16 09:08:11.594998000 -0700
+++ src.gas/gprof/gmon_io.c	2009-09-10 10:28:07.813605000 -0700
@@ -493,13 +493,13 @@ gmon_out_read (const char *filename)
       if (!histograms)
 	{
 	  num_histograms = 1;
-	  histograms = xmalloc (sizeof (struct histogram));
+	  histograms = (struct histogram *) xmalloc (sizeof (struct histogram));
 	  histograms->lowpc = tmp.low_pc;
 	  histograms->highpc = tmp.high_pc;
 	  histograms->num_bins = hist_num_bins;
 	  hist_scale = (double)((tmp.high_pc - tmp.low_pc) / sizeof (UNIT))
 	    / hist_num_bins;
-	  histograms->sample = xmalloc (hist_num_bins * sizeof (int));
+	  histograms->sample = (int *) xmalloc (hist_num_bins * sizeof (int));
 	  memset (histograms->sample, 0, 
 		  hist_num_bins * sizeof (int));
 	}
diff -urp src.head/gprof/hist.c src.gas/gprof/hist.c
--- src.head/gprof/hist.c	2009-06-16 09:08:11.680008000 -0700
+++ src.gas/gprof/hist.c	2009-09-10 10:28:28.566588000 -0700
@@ -198,8 +198,8 @@ hist_read_rec (FILE * ifp, const char *f
 
       /* This is new record.  Add it to global array and allocate space for
 	 the samples.  */
-      histograms = xrealloc (histograms,
-			     sizeof (histogram) * (num_histograms + 1));
+      histograms = (struct histogram *)
+          xrealloc (histograms, sizeof (histogram) * (num_histograms + 1));
       memcpy (histograms + num_histograms,
 	      &n_record, sizeof (histogram));
       record = &histograms[num_histograms];      
diff -urp src.head/gprof/source.c src.gas/gprof/source.c
--- src.head/gprof/source.c	2009-06-16 09:08:11.727997000 -0700
+++ src.gas/gprof/source.c	2009-09-10 10:28:39.935899000 -0700
@@ -237,7 +237,7 @@ annotate_source (Source_File *sf, unsign
       fprintf (ofp, _("*** File %s:\n"), sf->name);
     }
 
-  annotation = xmalloc (max_width + 1);
+  annotation = (char *) xmalloc (max_width + 1);
   line_num = 1;
   new_line = TRUE;
 
diff -urp src.head/gprof/sym_ids.c src.gas/gprof/sym_ids.c
--- src.head/gprof/sym_ids.c	2009-06-16 09:08:11.744003000 -0700
+++ src.gas/gprof/sym_ids.c	2009-09-10 10:30:06.417082000 -0700
@@ -29,23 +29,25 @@
 #include "sym_ids.h"
 #include "corefile.h"
 
-static struct sym_id
+struct match
+  {
+    int prev_index;	/* Index of prev match.  */
+    Sym *prev_match;	/* Previous match.  */
+    Sym *first_match;	/* Chain of all matches.  */
+    Sym sym;
+  };
+
+struct sym_id
   {
     struct sym_id *next;
     char *spec;			/* Parsing modifies this.  */
     Table_Id which_table;
     bfd_boolean has_right;
 
-    struct match
-      {
-	int prev_index;		/* Index of prev match.  */
-	Sym *prev_match;	/* Previous match.  */
-	Sym *first_match;	/* Chain of all matches.  */
-	Sym sym;
-      }
-    left, right;
-  }
- *id_list;
+    struct match left, right;
+  };
+
+static struct sym_id  *id_list;
 
 static void parse_spec
   (char *, Sym *);

Attachment: ld.changelog
Description: Binary data

diff -urp src.head/ld/emultempl/elf32.em src.gas/ld/emultempl/elf32.em
--- src.head/ld/emultempl/elf32.em	2009-09-07 13:21:35.146724000 -0700
+++ src.gas/ld/emultempl/elf32.em	2009-09-10 15:52:32.831148000 -0700
@@ -137,7 +137,8 @@ gld${EMULATION_NAME}_load_symbols (lang_
       || (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) == 0)
     return FALSE;
 
-  bfd_elf_set_dyn_lib_class (entry->the_bfd, link_class);
+  bfd_elf_set_dyn_lib_class (entry->the_bfd,
+                             (enum dynamic_lib_link_class) link_class);
 
   /* Continue on with normal load_symbols processing.  */
   return FALSE;
@@ -428,7 +429,7 @@ fragment <<EOF
       && (bfd_elf_get_dyn_lib_class (needed->by) & DYN_NO_ADD_NEEDED) != 0)
     link_class |= DYN_NO_NEEDED | DYN_NO_ADD_NEEDED;
 
-  bfd_elf_set_dyn_lib_class (abfd, link_class);
+  bfd_elf_set_dyn_lib_class (abfd, (enum dynamic_lib_link_class) link_class);
 
   /* Add this file into the symbol table.  */
   if (! bfd_link_add_symbols (abfd, &link_info))
@@ -930,7 +931,7 @@ static bfd_boolean
 gld${EMULATION_NAME}_write_build_id_section (bfd *abfd)
 {
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-  struct build_id_info *info =
+  struct build_id_info *info = (struct build_id_info *)
     elf_tdata (abfd)->after_write_object_contents_info;
   asection *asec;
   Elf_Internal_Shdr *i_shdr;
@@ -950,13 +951,13 @@ gld${EMULATION_NAME}_write_build_id_sect
   if (i_shdr->contents == NULL)
     {
       if (asec->contents == NULL)
-	asec->contents = xmalloc (asec->size);
+	asec->contents = (unsigned char *) xmalloc (asec->size);
       contents = asec->contents;
     }
   else
     contents = i_shdr->contents + asec->output_offset;
 
-  e_note = (void *) contents;
+  e_note = (Elf_External_Note *) contents;
   size = offsetof (Elf_External_Note, name[sizeof "GNU"]);
   size = (size + 3) & -(bfd_size_type) 4;
   id_bits = contents + size;
@@ -1075,7 +1076,8 @@ gld${EMULATION_NAME}_after_open (void)
 	      if (s != NULL && bfd_set_section_alignment (abfd, s, 2))
 		{
 		  struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
-		  struct build_id_info *b = xmalloc (sizeof *b);
+		  struct build_id_info *b =
+                      (struct build_id_info *) xmalloc (sizeof *b);
 
 		  b->style = link_info.emit_note_gnu_build_id;
 		  b->sec = s;
@@ -1453,7 +1455,7 @@ ${ELF_INTERPRETER_SET_DEFAULT}
 	  continue;
 
 	sz = s->size;
-	msg = xmalloc ((size_t) (sz + 1));
+	msg = (char *) xmalloc ((size_t) (sz + 1));
 	if (! bfd_get_section_contents (is->the_bfd, s,	msg,
 					(file_ptr) 0, sz))
 	  einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n",
diff -urp src.head/ld/ld.h src.gas/ld/ld.h
--- src.head/ld/ld.h	2009-08-14 11:07:07.670979000 -0700
+++ src.gas/ld/ld.h	2009-09-10 11:26:56.998806000 -0700
@@ -124,6 +124,22 @@ typedef struct fat_user_section_struct {
 #define LONG_SIZE	(4)
 #define QUAD_SIZE	(8)
 
+enum endian_enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE };
+
+enum symbolic_enum
+  {
+    symbolic_unset = 0,
+    symbolic,
+    symbolic_functions,
+  };
+
+enum dynamic_list_enum
+  {
+    dynamic_list_unset = 0,
+    dynamic_list_data,
+    dynamic_list
+  };
+
 typedef struct {
   /* 1 => assign space to common symbols even if `relocatable_output'.  */
   bfd_boolean force_common_definition;
@@ -161,24 +177,14 @@ typedef struct {
   bfd_boolean accept_unknown_input_arch;
 
   /* Big or little endian as set on command line.  */
-  enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian;
+  enum endian_enum endian;
 
   /* -Bsymbolic and -Bsymbolic-functions, as set on command line.  */
-  enum
-    {
-      symbolic_unset = 0,
-      symbolic,
-      symbolic_functions,
-    } symbolic;
+  enum symbolic_enum symbolic;
 
   /* --dynamic-list, --dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo
      and --dynamic-list FILE, as set on command line.  */
-  enum
-    {
-      dynamic_list_unset = 0,
-      dynamic_list_data,
-      dynamic_list
-    } dynamic_list;
+  enum dynamic_list_enum dynamic_list;
 
   /* Name of runtime interpreter to invoke.  */
   char *interpreter;
diff -urp src.head/ld/ldcref.c src.gas/ld/ldcref.c
--- src.head/ld/ldcref.c	2009-09-07 13:21:33.943861000 -0700
+++ src.gas/ld/ldcref.c	2009-09-10 13:58:04.433796000 -0700
@@ -179,7 +179,7 @@ add_cref (const char *name,
 
   if (r == NULL)
     {
-      r = bfd_hash_allocate (&cref_table.root, sizeof *r);
+      r = (struct cref_ref *) bfd_hash_allocate (&cref_table.root, sizeof *r);
       if (r == NULL)
 	einfo (_("%X%P: cref alloc failed: %E\n"));
       r->next = h->refs;
@@ -324,7 +324,7 @@ handle_asneeded_cref (bfd *abfd ATTRIBUT
 static bfd_boolean
 cref_fill_array (struct cref_hash_entry *h, void *data)
 {
-  struct cref_hash_entry ***pph = data;
+  struct cref_hash_entry ***pph = (struct cref_hash_entry ***) data;
 
   ASSERT (h->demangled == NULL);
   h->demangled = bfd_demangle (link_info.output_bfd, h->root.string,
@@ -344,8 +344,10 @@ cref_fill_array (struct cref_hash_entry 
 static int
 cref_sort_array (const void *a1, const void *a2)
 {
-  const struct cref_hash_entry * const *p1 = a1;
-  const struct cref_hash_entry * const *p2 = a2;
+  const struct cref_hash_entry * const *p1 =
+      (const struct cref_hash_entry * const *) a1;
+  const struct cref_hash_entry * const *p2 =
+      (const struct cref_hash_entry * const *) a2;
 
   return strcmp ((*p1)->demangled, (*p2)->demangled);
 }
@@ -378,7 +380,7 @@ output_cref (FILE *fp)
       return;
     }
 
-  csyms = xmalloc (cref_symcount * sizeof (*csyms));
+  csyms = (struct cref_hash_entry **) xmalloc (cref_symcount * sizeof (*csyms));
 
   csym_fill = csyms;
   cref_hash_traverse (&cref_table, cref_fill_array, &csym_fill);
@@ -602,7 +604,7 @@ check_refs (const char *name,
 static void
 check_reloc_refs (bfd *abfd, asection *sec, void *iarg)
 {
-  struct check_refs_info *info = iarg;
+  struct check_refs_info *info = (struct check_refs_info *) iarg;
   asection *outsec;
   const char *outsecname;
   asection *outdefsec;
@@ -649,7 +651,7 @@ check_reloc_refs (bfd *abfd, asection *s
   if (relsize == 0)
     return;
 
-  relpp = xmalloc (relsize);
+  relpp = (arelent **) xmalloc (relsize);
   relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols);
   if (relcount < 0)
     einfo (_("%B%F: could not read relocs: %E\n"), abfd);
diff -urp src.head/ld/ldctor.c src.gas/ld/ldctor.c
--- src.head/ld/ldctor.c	2009-09-07 13:21:33.955867000 -0700
+++ src.gas/ld/ldctor.c	2009-09-10 11:56:22.462013000 -0700
@@ -70,7 +70,7 @@ ldctor_add_set_entry (struct bfd_link_ha
 
   if (p == NULL)
     {
-      p = xmalloc (sizeof (struct set_info));
+      p = (struct set_info *) xmalloc (sizeof (struct set_info));
       p->next = sets;
       sets = p;
       p->h = h;
@@ -106,7 +106,7 @@ ldctor_add_set_entry (struct bfd_link_ha
 	}
     }
 
-  e = xmalloc (sizeof (struct set_element));
+  e = (struct set_element *) xmalloc (sizeof (struct set_element));
   e->next = NULL;
   e->name = name;
   e->section = section;
@@ -153,8 +153,10 @@ ctor_prio (const char *name)
 static int
 ctor_cmp (const void *p1, const void *p2)
 {
-  const struct set_element * const *pe1 = p1;
-  const struct set_element * const *pe2 = p2;
+  const struct set_element * const *pe1 =
+      (const struct set_element * const *) p1;
+  const struct set_element * const *pe2 =
+      (const struct set_element * const *) p2;
   const char *n1;
   const char *n2;
   int prio1;
@@ -223,7 +225,7 @@ ldctor_build_sets (void)
 	  for (e = p->elements; e != NULL; e = e->next)
 	    ++c;
 
-	  array = xmalloc (c * sizeof *array);
+	  array = (struct set_element **) xmalloc (c * sizeof *array);
 
 	  i = 0;
 	  for (e = p->elements; e != NULL; e = e->next)
diff -urp src.head/ld/ldexp.c src.gas/ld/ldexp.c
--- src.head/ld/ldexp.c	2009-09-07 13:21:34.001855000 -0700
+++ src.gas/ld/ldexp.c	2009-09-10 12:47:36.608098000 -0700
@@ -946,7 +946,7 @@ exp_provide (const char *dst, etree_type
 {
   etree_type *n;
 
-  n = stat_alloc (sizeof (n->assign));
+  n = (etree_type *) stat_alloc (sizeof (n->assign));
   n->assign.type.node_code = '=';
   n->assign.type.lineno = src->type.lineno;
   n->assign.type.node_class = etree_provide;
@@ -963,7 +963,7 @@ exp_assert (etree_type *exp, const char 
 {
   etree_type *n;
 
-  n = stat_alloc (sizeof (n->assert_s));
+  n = (etree_type *) stat_alloc (sizeof (n->assert_s));
   n->assert_s.type.node_code = '!';
   n->assert_s.type.lineno = exp->type.lineno;
   n->assert_s.type.node_class = etree_assert;
@@ -1095,7 +1095,7 @@ exp_get_fill (etree_type *tree, fill_typ
     {
       unsigned char *dst;
       unsigned char *s;
-      fill = xmalloc ((len + 1) / 2 + sizeof (*fill) - 1);
+      fill = (fill_type *) xmalloc ((len + 1) / 2 + sizeof (*fill) - 1);
       fill->size = (len + 1) / 2;
       dst = fill->data;
       s = (unsigned char *) expld.result.str;
@@ -1120,7 +1120,7 @@ exp_get_fill (etree_type *tree, fill_typ
     }
   else
     {
-      fill = xmalloc (4 + sizeof (*fill) - 1);
+      fill = (fill_type *) xmalloc (4 + sizeof (*fill) - 1);
       val = expld.result.value;
       fill->data[0] = (val >> 24) & 0xff;
       fill->data[1] = (val >> 16) & 0xff;
diff -urp src.head/ld/ldexp.h src.gas/ld/ldexp.h
--- src.head/ld/ldexp.h	2009-06-16 09:08:14.310705000 -0700
+++ src.gas/ld/ldexp.h	2009-09-10 11:42:50.987609000 -0700
@@ -30,21 +30,23 @@ typedef struct {
   bfd_boolean valid_p;
 } etree_value_type;
 
+enum node_tree_enum {
+  etree_binary,
+  etree_trinary,
+  etree_unary,
+  etree_name,
+  etree_assign,
+  etree_provide,
+  etree_provided,
+  etree_value,
+  etree_assert,
+  etree_rel
+};
+
 typedef struct {
   int node_code;
   unsigned int lineno;
-  enum {
-    etree_binary,
-    etree_trinary,
-    etree_unary,
-    etree_name,
-    etree_assign,
-    etree_provide,
-    etree_provided,
-    etree_value,
-    etree_assert,
-    etree_rel
-  } node_class;
+  enum  node_tree_enum node_class;
 } node_type;
 
 typedef union etree_union {
@@ -100,6 +102,21 @@ typedef enum {
 
 union lang_statement_union;
 
+enum phase_enum {
+  exp_dataseg_none,
+  exp_dataseg_align_seen,
+  exp_dataseg_relro_seen,
+  exp_dataseg_end_seen,
+  exp_dataseg_relro_adjust,
+  exp_dataseg_adjust
+};
+
+enum relro_enum {
+  exp_dataseg_relro_none,
+  exp_dataseg_relro_start,
+  exp_dataseg_relro_end,
+};
+
 struct ldexp_control {
   /* Modify expression evaluation depending on this.  */
   lang_phase_type phase;
@@ -117,22 +134,11 @@ struct ldexp_control {
 
   /* State machine and results for DATASEG.  */
   struct {
-    enum {
-      exp_dataseg_none,
-      exp_dataseg_align_seen,
-      exp_dataseg_relro_seen,
-      exp_dataseg_end_seen,
-      exp_dataseg_relro_adjust,
-      exp_dataseg_adjust
-    } phase;
+    enum phase_enum phase;
 
     bfd_vma base, min_base, relro_end, end, pagesize, maxpagesize;
 
-    enum {
-      exp_dataseg_relro_none,
-      exp_dataseg_relro_start,
-      exp_dataseg_relro_end,
-    } relro;
+    enum relro_enum relro;
 
     union lang_statement_union *relro_start_stat;
     union lang_statement_union *relro_end_stat;
diff -urp src.head/ld/ldlang.c src.gas/ld/ldlang.c
--- src.head/ld/ldlang.c	2009-08-31 10:37:54.149616000 -0700
+++ src.gas/ld/ldlang.c	2009-09-10 11:51:54.761903000 -0700
@@ -307,7 +307,7 @@ typedef struct
 static bfd_boolean
 section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data)
 {
-  section_iterator_callback_data *d = data;
+  section_iterator_callback_data *d = (section_iterator_callback_data *) data;
 
   if (d->found_section != NULL)
     {
@@ -452,7 +452,7 @@ output_section_callback_fast (lang_wild_
   if (unique_section_p (section))
     return;
 
-  node = xmalloc (sizeof (lang_section_bst_type));
+  node = (lang_section_bst_type *) xmalloc (sizeof (lang_section_bst_type));
   node->left = 0;
   node->right = 0;
   node->section = section;
@@ -813,7 +813,9 @@ walk_wild_file (lang_wild_statement_type
 	     lang_input_statement.  */
 	  if (member->usrdata != NULL)
 	    {
-	      walk_wild_section (s, member->usrdata, callback, data);
+	      walk_wild_section (s,
+                                 (lang_input_statement_type *) member->usrdata,
+                                 callback, data);
 	    }
 
 	  member = bfd_openr_next_archived_file (f->the_bfd, member);
@@ -1095,7 +1097,8 @@ output_section_statement_newfunc (struct
 
   if (entry == NULL)
     {
-      entry = bfd_hash_allocate (table, sizeof (*ret));
+      entry = (struct bfd_hash_entry *) bfd_hash_allocate (table,
+                                                           sizeof (*ret));
       if (entry == NULL)
 	return entry;
     }
@@ -1296,7 +1299,7 @@ lang_memory_region_alias (const char * a
            alias);
 
   /* Add alias to region name list.  */
-  n = stat_alloc (sizeof (lang_memory_region_name));
+  n = (lang_memory_region_name *) stat_alloc (sizeof (lang_memory_region_name));
   n->name = xstrdup (alias);
   n->next = region->name_list.next;
   region->name_list.next = n;
@@ -1717,8 +1720,8 @@ lang_insert_orphan (asection *s,
 
   os_tail = ((lang_output_section_statement_type **)
 	     lang_output_section_statement.tail);
-  os = lang_enter_output_section_statement (secname, address, 0, NULL, NULL,
-					    NULL, constraint);
+  os = lang_enter_output_section_statement (secname, address, normal_section,
+                                            NULL, NULL, NULL, constraint);
 
   ps = NULL;
   if (config.build_constructors && *os_tail == os)
@@ -2012,18 +2015,20 @@ sort_def_symbol (struct bfd_link_hash_en
       struct fat_user_section_struct *ud;
       struct map_symbol_def *def;
 
-      ud = get_userdata (hash_entry->u.def.section);
+      ud = (struct fat_user_section_struct *)
+          get_userdata (hash_entry->u.def.section);
       if  (! ud)
 	{
 	  /* ??? What do we have to do to initialize this beforehand?  */
 	  /* The first time we get here is bfd_abs_section...  */
 	  init_map_userdata (0, hash_entry->u.def.section, 0);
-	  ud = get_userdata (hash_entry->u.def.section);
+	  ud = (struct fat_user_section_struct *)
+              get_userdata (hash_entry->u.def.section);
 	}
       else if  (!ud->map_symbol_def_tail)
 	ud->map_symbol_def_tail = &ud->map_symbol_def_head;
 
-      def = obstack_alloc (&map_obstack, sizeof *def);
+      def = (struct map_symbol_def *) obstack_alloc (&map_obstack, sizeof *def);
       def->entry = hash_entry;
       *(ud->map_symbol_def_tail) = def;
       ud->map_symbol_def_tail = &def->next;
@@ -2139,7 +2144,7 @@ exp_init_os (etree_type *exp)
 static void
 section_already_linked (bfd *abfd, asection *sec, void *data)
 {
-  lang_input_statement_type *entry = data;
+  lang_input_statement_type *entry = (lang_input_statement_type *) data;
 
   /* If we are only reading symbols from this object, then we want to
      discard all sections.  */
@@ -2528,9 +2533,9 @@ add_excluded_libs (const char *list)
       end = strpbrk (p, ",:");
       if (end == NULL)
 	end = p + strlen (p);
-      entry = xmalloc (sizeof (*entry));
+      entry = (struct excluded_lib *) xmalloc (sizeof (*entry));
       entry->next = excluded_libs;
-      entry->name = xmalloc (end - p + 1);
+      entry->name = (char *) xmalloc (end - p + 1);
       memcpy (entry->name, p, end - p);
       entry->name[end - p] = '\0';
       excluded_libs = entry;
@@ -2751,7 +2756,7 @@ wild (lang_wild_statement_type *s,
 static int
 get_target (const bfd_target *target, void *data)
 {
-  const char *sought = data;
+  const char *sought = (const char *) data;
 
   return strcmp (target->name, sought) == 0;
 }
@@ -2798,8 +2803,8 @@ name_compare (char *first, char *second)
   char *copy2;
   int result;
 
-  copy1 = xmalloc (strlen (first) + 1);
-  copy2 = xmalloc (strlen (second) + 1);
+  copy1 = (char *) xmalloc (strlen (first) + 1);
+  copy2 = (char *) xmalloc (strlen (second) + 1);
 
   /* Convert the names to lower case.  */
   stricpy (copy1, first);
@@ -2837,7 +2842,7 @@ static const bfd_target *winner;
 static int
 closest_target_match (const bfd_target *target, void *data)
 {
-  const bfd_target *original = data;
+  const bfd_target *original = (const bfd_target *) data;
 
   if (command_line.endian == ENDIAN_BIG
       && target->byteorder != BFD_ENDIAN_BIG)
@@ -3932,7 +3937,7 @@ print_input_statement (lang_input_statem
 static bfd_boolean
 print_one_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr)
 {
-  asection *sec = ptr;
+  asection *sec = (asection *) ptr;
 
   if ((hash_entry->type == bfd_link_hash_defined
        || hash_entry->type == bfd_link_hash_defweak)
@@ -3970,7 +3975,8 @@ hash_entry_addr_cmp (const void *a, cons
 static void
 print_all_symbols (asection *sec)
 {
-  struct fat_user_section_struct *ud = get_userdata (sec);
+  struct fat_user_section_struct *ud =
+      (struct fat_user_section_struct *) get_userdata (sec);
   struct map_symbol_def *def;
   struct bfd_link_hash_entry **entries;
   unsigned int i;
@@ -3981,8 +3987,8 @@ print_all_symbols (asection *sec)
   *ud->map_symbol_def_tail = 0;
   
   /* Sort the symbols by address.  */
-  entries = obstack_alloc (&map_obstack,
-                           ud->map_symbol_def_count * sizeof (*entries));
+  entries = (struct bfd_link_hash_entry **)
+      obstack_alloc (&map_obstack, ud->map_symbol_def_count * sizeof (*entries));
 
   for (i = 0, def = ud->map_symbol_def_head; def; def = def->next, i++)
     entries[i] = def->entry;
@@ -4419,7 +4425,8 @@ insert_pad (lang_statement_union_type **
   else
     {
       /* Make a new padding statement, linked into existing chain.  */
-      pad = stat_alloc (sizeof (lang_padding_statement_type));
+      pad = (lang_statement_union_type *)
+          stat_alloc (sizeof (lang_padding_statement_type));
       pad->header.next = *ptr;
       *ptr = pad;
       pad->header.type = lang_padding_statement_enum;
@@ -4535,7 +4542,7 @@ lang_check_section_addresses (void)
     return;
 
   amt = bfd_count_sections (link_info.output_bfd) * sizeof (asection *);
-  sections = xmalloc (amt);
+  sections = (asection **) xmalloc (amt);
 
   /* Scan all sections in the output list.  */
   count = 0;
@@ -5465,7 +5472,7 @@ lang_set_startof (void)
       struct bfd_link_hash_entry *h;
 
       secname = bfd_get_section_name (link_info.output_bfd, s);
-      buf = xmalloc (10 + strlen (secname));
+      buf = (char *) xmalloc (10 + strlen (secname));
 
       sprintf (buf, ".startof.%s", secname);
       h = bfd_link_hash_lookup (link_info.hash, buf, FALSE, FALSE, TRUE);
@@ -6762,7 +6769,7 @@ lang_new_phdr (const char *name,
 {
   struct lang_phdr *n, **pp;
 
-  n = stat_alloc (sizeof (struct lang_phdr));
+  n = (struct lang_phdr *) stat_alloc (sizeof (struct lang_phdr));
   n->next = NULL;
   n->name = name;
   n->type = exp_get_value_int (type, 0, "program header type");
@@ -6789,7 +6796,7 @@ lang_record_phdrs (void)
   lang_output_section_statement_type *os;
 
   alc = 10;
-  secs = xmalloc (alc * sizeof (asection *));
+  secs = (asection **) xmalloc (alc * sizeof (asection *));
   last = NULL;
 
   for (l = lang_phdr_list; l != NULL; l = l->next)
@@ -6856,7 +6863,8 @@ lang_record_phdrs (void)
 		  if (c >= alc)
 		    {
 		      alc *= 2;
-		      secs = xrealloc (secs, alc * sizeof (asection *));
+		      secs = (asection **) xrealloc (secs,
+                                                     alc * sizeof (asection *));
 		    }
 		  secs[c] = os->bfd_section;
 		  ++c;
@@ -6910,7 +6918,7 @@ lang_add_nocrossref (lang_nocrossref_typ
 {
   struct lang_nocrossrefs *n;
 
-  n = xmalloc (sizeof *n);
+  n = (struct lang_nocrossrefs *) xmalloc (sizeof *n);
   n->next = nocrossref_list;
   n->list = l;
   nocrossref_list = n;
@@ -6972,7 +6980,7 @@ lang_enter_overlay_section (const char *
     overlay_vma = exp_nameop (ADDR, name);
 
   /* Remember the section.  */
-  n = xmalloc (sizeof *n);
+  n = (struct overlay_list *) xmalloc (sizeof *n);
   n->os = current_section;
   n->next = overlay_list;
   overlay_list = n;
@@ -7008,20 +7016,20 @@ lang_leave_overlay_section (fill_type *f
 
   /* Define the magic symbols.  */
 
-  clean = xmalloc (strlen (name) + 1);
+  clean = (char *) xmalloc (strlen (name) + 1);
   s2 = clean;
   for (s1 = name; *s1 != '\0'; s1++)
     if (ISALNUM (*s1) || *s1 == '_')
       *s2++ = *s1;
   *s2 = '\0';
 
-  buf = xmalloc (strlen (clean) + sizeof "__load_start_");
+  buf = (char *) xmalloc (strlen (clean) + sizeof "__load_start_");
   sprintf (buf, "__load_start_%s", clean);
   lang_add_assignment (exp_provide (buf,
 				    exp_nameop (LOADADDR, name),
 				    FALSE));
 
-  buf = xmalloc (strlen (clean) + sizeof "__load_stop_");
+  buf = (char *) xmalloc (strlen (clean) + sizeof "__load_stop_");
   sprintf (buf, "__load_stop_%s", clean);
   lang_add_assignment (exp_provide (buf,
 				    exp_binop ('+',
@@ -7087,7 +7095,7 @@ lang_leave_overlay (etree_type *lma_expr
 	{
 	  lang_nocrossref_type *nc;
 
-	  nc = xmalloc (sizeof *nc);
+	  nc = (lang_nocrossref_type *) xmalloc (sizeof *nc);
 	  nc->name = l->os->name;
 	  nc->next = nocrossref;
 	  nocrossref = nc;
@@ -7148,7 +7156,8 @@ lang_vers_match (struct bfd_elf_version_
 	  if (head->mask & BFD_ELF_VERSION_C_TYPE)
 	    {
 	      e.pattern = sym;
-	      expr = htab_find (head->htab, &e);
+	      expr = (struct bfd_elf_version_expr *)
+                  htab_find ((htab_t) head->htab, &e);
 	      while (expr && strcmp (expr->pattern, sym) == 0)
 		if (expr->mask == BFD_ELF_VERSION_C_TYPE)
 		  goto out_ret;
@@ -7160,7 +7169,8 @@ lang_vers_match (struct bfd_elf_version_
 	  if (head->mask & BFD_ELF_VERSION_CXX_TYPE)
 	    {
 	      e.pattern = cxx_sym;
-	      expr = htab_find (head->htab, &e);
+	      expr = (struct bfd_elf_version_expr *)
+                  htab_find ((htab_t) head->htab, &e);
 	      while (expr && strcmp (expr->pattern, cxx_sym) == 0)
 		if (expr->mask == BFD_ELF_VERSION_CXX_TYPE)
 		  goto out_ret;
@@ -7172,7 +7182,8 @@ lang_vers_match (struct bfd_elf_version_
 	  if (head->mask & BFD_ELF_VERSION_JAVA_TYPE)
 	    {
 	      e.pattern = java_sym;
-	      expr = htab_find (head->htab, &e);
+	      expr = (struct bfd_elf_version_expr *)
+                  htab_find ((htab_t) head->htab, &e);
 	      while (expr && strcmp (expr->pattern, java_sym) == 0)
 		if (expr->mask == BFD_ELF_VERSION_JAVA_TYPE)
 		  goto out_ret;
@@ -7226,7 +7237,7 @@ realsymbol (const char *pattern)
 {
   const char *p;
   bfd_boolean changed = FALSE, backslash = FALSE;
-  char *s, *symbol = xmalloc (strlen (pattern) + 1);
+  char *s, *symbol = (char *) xmalloc (strlen (pattern) + 1);
 
   for (p = pattern, s = symbol; *p != '\0'; ++p)
     {
@@ -7313,7 +7324,7 @@ lang_new_vers_node (struct bfd_elf_versi
 {
   struct bfd_elf_version_tree *ret;
 
-  ret = xcalloc (1, sizeof *ret);
+  ret = (struct bfd_elf_version_tree *) xcalloc (1, sizeof *ret);
   ret->globals.list = globals;
   ret->locals.list = locals;
   ret->match = lang_vers_match;
@@ -7328,7 +7339,8 @@ static int version_index;
 static hashval_t
 version_expr_head_hash (const void *p)
 {
-  const struct bfd_elf_version_expr *e = p;
+  const struct bfd_elf_version_expr *e =
+      (const struct bfd_elf_version_expr *) p;
 
   return htab_hash_string (e->pattern);
 }
@@ -7336,8 +7348,10 @@ version_expr_head_hash (const void *p)
 static int
 version_expr_head_eq (const void *p1, const void *p2)
 {
-  const struct bfd_elf_version_expr *e1 = p1;
-  const struct bfd_elf_version_expr *e2 = p2;
+  const struct bfd_elf_version_expr *e1 =
+      (const struct bfd_elf_version_expr *) p1;
+  const struct bfd_elf_version_expr *e2 =
+      (const struct bfd_elf_version_expr *) p2;
 
   return strcmp (e1->pattern, e2->pattern) == 0;
 }
@@ -7372,13 +7386,13 @@ lang_finalize_version_expr_head (struct 
 	    }
 	  else
 	    {
-	      void **loc = htab_find_slot (head->htab, e, INSERT);
+	      void **loc = htab_find_slot ((htab_t) head->htab, e, INSERT);
 
 	      if (*loc)
 		{
 		  struct bfd_elf_version_expr *e1, *last;
 
-		  e1 = *loc;
+		  e1 = (struct bfd_elf_version_expr *) *loc;
 		  last = NULL;
 		  do
 		    {
@@ -7463,7 +7477,8 @@ lang_register_vers_node (const char *nam
 
 	  if (t->locals.htab && e1->literal)
 	    {
-	      e2 = htab_find (t->locals.htab, e1);
+	      e2 = (struct bfd_elf_version_expr *)
+                  htab_find ((htab_t) t->locals.htab, e1);
 	      while (e2 && strcmp (e1->pattern, e2->pattern) == 0)
 		{
 		  if (e1->mask == e2->mask)
@@ -7489,7 +7504,8 @@ lang_register_vers_node (const char *nam
 
 	  if (t->globals.htab && e1->literal)
 	    {
-	      e2 = htab_find (t->globals.htab, e1);
+	      e2 = (struct bfd_elf_version_expr *)
+                  htab_find ((htab_t) t->globals.htab, e1);
 	      while (e2 && strcmp (e1->pattern, e2->pattern) == 0)
 		{
 		  if (e1->mask == e2->mask)
@@ -7531,7 +7547,7 @@ lang_add_vers_depend (struct bfd_elf_ver
   struct bfd_elf_version_deps *ret;
   struct bfd_elf_version_tree *t;
 
-  ret = xmalloc (sizeof *ret);
+  ret = (struct bfd_elf_version_deps *) xmalloc (sizeof *ret);
   ret->next = list;
 
   for (t = lang_elf_version_info; t != NULL; t = t->next)
@@ -7563,7 +7579,7 @@ lang_do_version_exports_section (void)
 	continue;
 
       len = sec->size;
-      contents = xmalloc (len);
+      contents = (char *) xmalloc (len);
       if (!bfd_get_section_contents (is->the_bfd, sec, contents, 0, len))
 	einfo (_("%X%P: unable to read .exports section contents\n"), sec);
 
@@ -7594,7 +7610,7 @@ lang_add_unique (const char *name)
     if (strcmp (ent->name, name) == 0)
       return;
 
-  ent = xmalloc (sizeof *ent);
+  ent = (struct unique_sections *) xmalloc (sizeof *ent);
   ent->name = xstrdup (name);
   ent->next = unique_section_list;
   unique_section_list = ent;
@@ -7617,7 +7633,7 @@ lang_append_dynamic_list (struct bfd_elf
     {
       struct bfd_elf_dynamic_list *d;
 
-      d = xcalloc (1, sizeof *d);
+      d = (struct bfd_elf_dynamic_list *) xcalloc (1, sizeof *d);
       d->head.list = dynamic;
       d->match = lang_vers_match;
       link_info.dynamic_list = d;
diff -urp src.head/ld/ldlang.h src.gas/ld/ldlang.h
--- src.head/ld/ldlang.h	2009-08-31 10:37:54.168625000 -0700
+++ src.gas/ld/ldlang.h	2009-09-10 11:53:14.495299000 -0700
@@ -66,28 +66,30 @@ typedef struct memory_region_struct
   bfd_boolean had_full_message;
 } lang_memory_region_type;
 
+enum statement_enum
+{
+  lang_output_section_statement_enum,
+  lang_assignment_statement_enum,
+  lang_input_statement_enum,
+  lang_address_statement_enum,
+  lang_wild_statement_enum,
+  lang_input_section_enum,
+  lang_object_symbols_statement_enum,
+  lang_fill_statement_enum,
+  lang_data_statement_enum,
+  lang_reloc_statement_enum,
+  lang_target_statement_enum,
+  lang_output_statement_enum,
+  lang_padding_statement_enum,
+  lang_group_statement_enum,
+  lang_insert_statement_enum,
+  lang_constructors_statement_enum
+};
+
 typedef struct lang_statement_header_struct
 {
   union lang_statement_union *next;
-  enum statement_enum
-  {
-    lang_output_section_statement_enum,
-    lang_assignment_statement_enum,
-    lang_input_statement_enum,
-    lang_address_statement_enum,
-    lang_wild_statement_enum,
-    lang_input_section_enum,
-    lang_object_symbols_statement_enum,
-    lang_fill_statement_enum,
-    lang_data_statement_enum,
-    lang_reloc_statement_enum,
-    lang_target_statement_enum,
-    lang_output_statement_enum,
-    lang_padding_statement_enum,
-    lang_group_statement_enum,
-    lang_insert_statement_enum,
-    lang_constructors_statement_enum
-  } type;
+  enum statement_enum type;
 } lang_statement_header_type;
 
 typedef struct
diff -urp src.head/ld/ldmain.c src.gas/ld/ldmain.c
--- src.head/ld/ldmain.c	2009-09-07 13:21:34.110865000 -0700
+++ src.gas/ld/ldmain.c	2009-09-10 12:46:38.128530000 -0700
@@ -399,7 +399,7 @@ main (int argc, char **argv)
 	{
 	  static const int ld_bufsz = 8193;
 	  size_t n;
-	  char *buf = xmalloc (ld_bufsz);
+	  char *buf = (char *) xmalloc (ld_bufsz);
 
 	  rewind (saved_script_handle);
 	  while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0)
@@ -503,9 +503,9 @@ main (int argc, char **argv)
 	      FILE *src;
 	      FILE *dst;
 	      const int bsize = 4096;
-	      char *buf = xmalloc (bsize);
+	      char *buf = (char *) xmalloc (bsize);
 	      int l;
-	      char *dst_name = xmalloc (len + 5);
+	      char *dst_name = (char *) xmalloc (len + 5);
 
 	      strcpy (dst_name, output_filename);
 	      strcat (dst_name, ".exe");
@@ -540,7 +540,7 @@ main (int argc, char **argv)
   if (config.stats)
     {
 #ifdef HAVE_SBRK
-      char *lim = sbrk (0);
+      char *lim = (char *) sbrk (0);
 #endif
       long run_time = get_run_time () - start_time;
 
@@ -672,7 +672,8 @@ add_ysym (const char *name)
 {
   if (link_info.notice_hash == NULL)
     {
-      link_info.notice_hash = xmalloc (sizeof (struct bfd_hash_table));
+      link_info.notice_hash =
+          (struct bfd_hash_table *) xmalloc (sizeof (struct bfd_hash_table));
       if (!bfd_hash_table_init_n (link_info.notice_hash,
 				  bfd_hash_newfunc,
 				  sizeof (struct bfd_hash_entry),
@@ -691,7 +692,8 @@ add_wrap (const char *name)
 {
   if (link_info.wrap_hash == NULL)
     {
-      link_info.wrap_hash = xmalloc (sizeof (struct bfd_hash_table));
+      link_info.wrap_hash =
+          (struct bfd_hash_table *) xmalloc (sizeof (struct bfd_hash_table));
       if (!bfd_hash_table_init_n (link_info.wrap_hash,
 				  bfd_hash_newfunc,
 				  sizeof (struct bfd_hash_entry),
@@ -724,13 +726,14 @@ add_keepsyms_file (const char *filename)
       return;
     }
 
-  link_info.keep_hash = xmalloc (sizeof (struct bfd_hash_table));
+  link_info.keep_hash = (struct bfd_hash_table *)
+      xmalloc (sizeof (struct bfd_hash_table));
   if (!bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc,
 			    sizeof (struct bfd_hash_entry)))
     einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
 
   bufsize = 100;
-  buf = xmalloc (bufsize);
+  buf = (char *) xmalloc (bufsize);
 
   c = getc (file);
   while (c != EOF)
@@ -749,7 +752,7 @@ add_keepsyms_file (const char *filename)
 	      if (len >= bufsize)
 		{
 		  bufsize *= 2;
-		  buf = xrealloc (buf, bufsize);
+		  buf = (char *) xrealloc (buf, bufsize);
 		}
 	      c = getc (file);
 	    }
@@ -780,7 +783,8 @@ add_archive_element (struct bfd_link_inf
 {
   lang_input_statement_type *input;
 
-  input = xcalloc (1, sizeof (lang_input_statement_type));
+  input = (lang_input_statement_type *)
+      xcalloc (1, sizeof (lang_input_statement_type));
   input->filename = abfd->filename;
   input->local_sym_name = abfd->filename;
   input->the_bfd = abfd;
@@ -1127,7 +1131,7 @@ warning_callback (struct bfd_link_info *
 static void
 warning_find_reloc (bfd *abfd, asection *sec, void *iarg)
 {
-  struct warning_callback_info *info = iarg;
+  struct warning_callback_info *info = (struct warning_callback_info *) iarg;
   long relsize;
   arelent **relpp;
   long relcount;
@@ -1142,7 +1146,7 @@ warning_find_reloc (bfd *abfd, asection 
   if (relsize == 0)
     return;
 
-  relpp = xmalloc (relsize);
+  relpp = (arelent **) xmalloc (relsize);
   relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols);
   if (relcount < 0)
     einfo (_("%B%F: could not read relocs: %E\n"), abfd);
@@ -1190,7 +1194,8 @@ undefined_symbol (struct bfd_link_info *
       /* Only warn once about a particular undefined symbol.  */
       if (hash == NULL)
 	{
-	  hash = xmalloc (sizeof (struct bfd_hash_table));
+	  hash = (struct bfd_hash_table *)
+              xmalloc (sizeof (struct bfd_hash_table));
 	  if (!bfd_hash_table_init (hash, bfd_hash_newfunc,
 				    sizeof (struct bfd_hash_entry)))
 	    einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
@@ -1376,7 +1381,7 @@ notice (struct bfd_link_info *info,
   if (name == NULL)
     {
       if (command_line.cref || nocrossref_list != NULL)
-	return handle_asneeded_cref (abfd, value);
+	return handle_asneeded_cref (abfd, (enum notice_asneeded_action) value);
       return TRUE;
     }
 
diff -urp src.head/ld/ldwrite.c src.gas/ld/ldwrite.c
--- src.head/ld/ldwrite.c	2009-06-16 09:08:14.399643000 -0700
+++ src.gas/ld/ldwrite.c	2009-09-10 12:47:12.995428000 -0700
@@ -57,7 +57,7 @@ build_link_order (lang_statement_union_t
 
 	link_order->type = bfd_data_link_order;
 	link_order->offset = statement->data_statement.output_offset;
-	link_order->u.data.contents = xmalloc (QUAD_SIZE);
+	link_order->u.data.contents = (bfd_byte *) xmalloc (QUAD_SIZE);
 
 	value = statement->data_statement.value;
 
@@ -198,7 +198,8 @@ build_link_order (lang_statement_union_t
 	link_order->offset = rs->output_offset;
 	link_order->size = bfd_get_reloc_size (rs->howto);
 
-	link_order->u.reloc.p = xmalloc (sizeof (struct bfd_link_order_reloc));
+	link_order->u.reloc.p = (struct bfd_link_order_reloc *)
+            xmalloc (sizeof (struct bfd_link_order_reloc));
 
 	link_order->u.reloc.p->reloc = rs->reloc;
 	link_order->u.reloc.p->addend = rs->addend_value;
@@ -333,7 +334,7 @@ clone_section (bfd *abfd, asection *s, c
   /* Invent a section name from the section name and a dotted numeric
      suffix.   */
   len = strlen (name);
-  tname = xmalloc (len + 1);
+  tname = (char *) xmalloc (len + 1);
   memcpy (tname, name, len + 1);
   /* Remove a dotted number suffix, from a previous split link. */
   while (len && ISDIGIT (tname[len-1]))
diff -urp src.head/ld/lexsup.c src.gas/ld/lexsup.c
--- src.head/ld/lexsup.c	2009-09-07 13:21:34.175885000 -0700
+++ src.gas/ld/lexsup.c	2009-09-10 11:27:26.844480000 -0700
@@ -172,6 +172,25 @@ enum option_values
 /* The long options.  This structure is used for both the option
    parsing and the help text.  */
 
+enum control_enum {
+  /* Use one dash before long option name.  */
+  ONE_DASH,
+  /* Use two dashes before long option name.  */
+  TWO_DASHES,
+  /* Only accept two dashes before the long option name.
+     This is an overloading of the use of this enum, since originally it
+     was only intended to tell the --help display function how to display
+     the long option name.  This feature was added in order to resolve
+     the confusion about the -omagic command line switch.  Is it setting
+     the output file name to "magic" or is it setting the NMAGIC flag on
+     the output ?  It has been decided that it is setting the output file
+     name, and that if you want to set the NMAGIC flag you should use -N
+     or --omagic.  */
+  EXACTLY_TWO_DASHES,
+  /* Don't mention this option in --help output.  */
+  NO_HELP
+};
+
 struct ld_option
 {
   /* The long option information.  */
@@ -183,24 +202,7 @@ struct ld_option
   /* The documentation string.  If this is NULL, this is a synonym for
      the previous option.  */
   const char *doc;
-  enum {
-    /* Use one dash before long option name.  */
-    ONE_DASH,
-    /* Use two dashes before long option name.  */
-    TWO_DASHES,
-    /* Only accept two dashes before the long option name.
-       This is an overloading of the use of this enum, since originally it
-       was only intended to tell the --help display function how to display
-       the long option name.  This feature was added in order to resolve
-       the confusion about the -omagic command line switch.  Is it setting
-       the output file name to "magic" or is it setting the NMAGIC flag on
-       the output ?  It has been decided that it is setting the output file
-       name, and that if you want to set the NMAGIC flag you should use -N
-       or --omagic.  */
-    EXACTLY_TWO_DASHES,
-    /* Don't mention this option in --help output.  */
-    NO_HELP
-  } control;
+  enum control_enum control;
 };
 
 static const struct ld_option ld_options[] =
@@ -590,9 +592,11 @@ parse_args (unsigned argc, char **argv)
   int last_optind;
   enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
 
-  shortopts = xmalloc (OPTION_COUNT * 3 + 2);
-  longopts = xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
-  really_longopts = xmalloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
+  shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
+  longopts = (struct option *)
+      xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
+  really_longopts = (struct option *)
+      malloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
 
   /* Starting the short option string with '-' is for programs that
      expect options and other ARGV-elements in any order and that care about
@@ -677,7 +681,7 @@ parse_args (unsigned argc, char **argv)
 	{
 	  char *n;
 
-	  n = xmalloc (strlen (argv[i]) + 20);
+	  n = (char *) xmalloc (strlen (argv[i]) + 20);
 	  sprintf (n, "--library=%s", argv[i] + 2);
 	  argv[i] = n;
 	}
@@ -833,7 +837,8 @@ parse_args (unsigned argc, char **argv)
 	case 'f':
 	  if (command_line.auxiliary_filters == NULL)
 	    {
-	      command_line.auxiliary_filters = xmalloc (2 * sizeof (char *));
+	      command_line.auxiliary_filters = (char **)
+                  xmalloc (2 * sizeof (char *));
 	      command_line.auxiliary_filters[0] = optarg;
 	      command_line.auxiliary_filters[1] = NULL;
 	    }
@@ -845,8 +850,8 @@ parse_args (unsigned argc, char **argv)
 	      c = 0;
 	      for (p = command_line.auxiliary_filters; *p != NULL; p++)
 		++c;
-	      command_line.auxiliary_filters
-		= xrealloc (command_line.auxiliary_filters,
+	      command_line.auxiliary_filters = (char **)
+                  xrealloc (command_line.auxiliary_filters,
 			    (c + 2) * sizeof (char *));
 	      command_line.auxiliary_filters[c] = optarg;
 	      command_line.auxiliary_filters[c + 1] = NULL;
@@ -1092,7 +1097,7 @@ parse_args (unsigned argc, char **argv)
 
 	      if (cp == NULL)
 		{
-		  buf = xmalloc (rpath_len + optarg_len + 2);
+		  buf = (char *) xmalloc (rpath_len + optarg_len + 2);
 		  sprintf (buf, "%s%c%s", command_line.rpath,
 			   config.rpath_separator, optarg);
 		  free (command_line.rpath);
@@ -1107,9 +1112,9 @@ parse_args (unsigned argc, char **argv)
 	    {
 	      char *buf;
 
-	      buf = xmalloc (strlen (command_line.rpath_link)
-			     + strlen (optarg)
-			     + 2);
+	      buf = (char *) xmalloc (strlen (command_line.rpath_link)
+                                      + strlen (optarg)
+                                      + 2);
 	      sprintf (buf, "%s%c%s", command_line.rpath_link,
 		       config.rpath_separator, optarg);
 	      free (command_line.rpath_link);
@@ -1224,7 +1229,7 @@ parse_args (unsigned argc, char **argv)
 	    /* We must copy the section name as set_section_start
 	       doesn't do it for us.  */
 	    len = optarg2 - optarg;
-	    sec_name = xmalloc (len);
+	    sec_name = (char *) xmalloc (len);
 	    memcpy (sec_name, optarg, len - 1);
 	    sec_name[len - 1] = 0;
 
@@ -1549,7 +1554,7 @@ set_segment_start (const char *section, 
       }
   /* There was no existing value so we must create a new segment
      entry.  */
-  seg = stat_alloc (sizeof (*seg));
+  seg = (segment_type *) stat_alloc (sizeof (*seg));
   seg->name = name;
   seg->value = val;
   seg->used = FALSE;
diff -urp src.head/ld/mri.c src.gas/ld/mri.c
--- src.head/ld/mri.c	2009-06-16 09:08:14.409637000 -0700
+++ src.gas/ld/mri.c	2009-09-10 11:54:01.253515000 -0700
@@ -68,7 +68,8 @@ lookup (const char *name, struct section
 	ptr = &((*ptr)->next);
     }
 
-  *ptr = xmalloc (sizeof (struct section_name_struct));
+  *ptr = (struct section_name_struct *)
+      xmalloc (sizeof (struct section_name_struct));
   return ptr;
 }
 
@@ -206,10 +207,10 @@ mri_draw_tree (void)
 	    base = p->vma ? p->vma : exp_nameop (NAME, ".");
 
 	  lang_enter_output_section_statement (p->name, base,
-					       p->ok_to_load ? 0 : noload_section,
+					       p->ok_to_load ? normal_section : noload_section,
 					       align, subalign, NULL, 0);
 	  base = 0;
-	  tmp = xmalloc (sizeof *tmp);
+	  tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
 	  tmp->next = NULL;
 	  tmp->spec.name = p->name;
 	  tmp->spec.exclude_name_list = NULL;
@@ -220,7 +221,7 @@ mri_draw_tree (void)
 	  for (aptr = alias; aptr; aptr = aptr->next)
 	    if (strcmp (aptr->alias, p->name) == 0)
 	      {
-		tmp = xmalloc (sizeof *tmp);
+		tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
 		tmp->next = NULL;
 		tmp->spec.name = aptr->name;
 		tmp->spec.exclude_name_list = NULL;

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