diff options
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 105 | ||||
-rw-r--r-- | gas/app.c | 2 | ||||
-rw-r--r-- | gas/as.c | 9 | ||||
-rw-r--r-- | gas/config/obj-elf.c | 108 | ||||
-rw-r--r-- | gas/config/tc-i386-intel.c | 8 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 30 | ||||
-rw-r--r-- | gas/dw2gencfi.c | 24 | ||||
-rw-r--r-- | gas/dwarf2dbg.c | 38 | ||||
-rw-r--r-- | gas/dwarf2dbg.h | 4 | ||||
-rw-r--r-- | gas/ehopt.c | 28 | ||||
-rw-r--r-- | gas/expr.c | 22 | ||||
-rw-r--r-- | gas/frags.c | 2 | ||||
-rw-r--r-- | gas/hash.c | 8 | ||||
-rw-r--r-- | gas/input-scrub.c | 14 | ||||
-rw-r--r-- | gas/listing.c | 33 | ||||
-rw-r--r-- | gas/macro.c | 8 | ||||
-rw-r--r-- | gas/macro.h | 14 | ||||
-rw-r--r-- | gas/po/gas.pot | 2 | ||||
-rw-r--r-- | gas/read.c | 25 | ||||
-rw-r--r-- | gas/remap.c | 2 | ||||
-rw-r--r-- | gas/stabs.c | 4 | ||||
-rw-r--r-- | gas/subsegs.c | 6 | ||||
-rw-r--r-- | gas/symbols.c | 16 | ||||
-rw-r--r-- | gas/write.c | 6 |
24 files changed, 311 insertions, 207 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 6dc5e82..fe66a37 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,56 @@ +2009-09-11 Nick Clifton <nickc@redhat.com> + + * po/gas.pot: Updated by the Translation project. + +2009-09-11 Martin Thuresson <martint@google.com> + + * as.c (main): Call dwarf2_init. + * config/obj-elf.c (struct group_list): New field. + (build_group_lists): Use hash lookup. + (free_section_idx): New function. + (elf_frob_file): Adjust. + * dwarf2dbg.c (all_segs_hash, last_seg_ptr): New variables. + (get_line_subseg): Adjust. + (dwarf2_init): New function. + * dwarf2dbg.h (dwarf2_init): New declaration. + +2009-09-11 Martin Thuresson <martint@google.com> + + Updated sources to compile cleanly with -Wc++-compat: + * app.c: Add casts. + * as.c: Add casts. + * config/obj-elf.c: Add casts. + (obj_elf_type): Rename variable typename to type_name. + * config/tc-i386-intel.c (i386_operators): Rename member operator to op. + * config/tc-i386.c: Add casts. + (check_cpu_arch_compatible): Rename argument new to new_flag. + (gotrel): Update variable to use enum name instead of integer value. + * dw2gencfi.c: Add casts. + (struct cfi_escape_data): Move to top level. + * dwarf2dbg.c: Add cast. + * dwarf2dbg.h (dwarf2_loc_directive_seen): Make variable extern. + * ehopt.c Add casts. + (enum frame_state): Move to top level. + * expr.c (operatorf): Rename function operator to operatorf. + (operand): Rename variable operator to op. + (expr_set_rank): Rename argument operator to op. + * frags.c: Add cast. + * hash.c: Add casts. + * input-scrub.c: Add cast. + * listing.c: Add casts. + (enum edict_enum): Move to top level. + * macro.c: Add casts. + * macro.h (enum formal_type): Move to top level. + * read.c: Add casts. + (s_include): Rename variable try to try_file. + * remap.c: Add cast. + * stabs.c: Add casts. + * subsegs.c: Add casts. + * symbols.c: Add casts. + * write.c: Add casts. + * libiberty/regex.c (byte_re_match_2_internal): Introduce extra scope to avoid + initialization warning from goto. + 2009-09-11 Hans-Peter Nilsson <hp@bitrange.com> PR gas/10623 @@ -225,7 +278,7 @@ 2009-09-02 Jie Zhang <jie.zhang@analog.com> From Bernd Schmidt <bernd.schmidt@analog.com> - * config/gas/bfin-parse.y (asm_1): Clean up and unify error handling + * config/bfin-parse.y (asm_1): Clean up and unify error handling for load and store insns. (neg_value): Delete function. @@ -427,7 +480,7 @@ Remove. (mkdep section): Remove. * Makefile.in: Regenerate. - * gas/po/POTFILES.in, gas/po/gas.pot: Regenerate. + * po/POTFILES.in, po/gas.pot: Regenerate. * Makefile.am (install-pdf, install-pdf-recursive, install-html) (install-html-recursive): Remove. @@ -492,7 +545,7 @@ * config/obj-coff.h (obj_coff_seh_do_final): Add new function prototype. (obj_coff_generate_pdata): New obj-coff hook. - * gas/write.c (size_seg): Avoid sizing of already sized + * write.c (size_seg): Avoid sizing of already sized sections. (write_object_file): Call conditional hook objc_coff_generate_pdata. @@ -990,28 +1043,28 @@ 2009-06-22 Martin Thuresson <martin@mtme.org> - * gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c, - gas/config/atof-ieee.c, gas/config/obj-aout.c, - gas/config/obj-coff.c, gas/config/obj-ecoff.c, - gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c, - gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c, - gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c, - gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c, - gas/config/tc-i386-intel.c, gas/config/tc-i386.c, - gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c, - gas/config/tc-iq2000.c, gas/config/tc-m32c.c, - gas/config/tc-m32r.c, gas/config/tc-m68hc11.c, - gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c, - gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c, - gas/config/tc-mn10300.c, gas/config/tc-moxie.c, - gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c, - gas/config/tc-s390.c, gas/config/tc-score.c, - gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c, - gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c, - gas/config/tc-xtensa.c, gas/config/xtensa-relax.c, - gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c, - gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c, - gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the + * app, as.c, as.h, atof-generic.c, cgen.c, + config/atof-ieee.c, config/obj-aout.c, + config/obj-coff.c, config/obj-ecoff.c, + config/obj-elf.c, config/obj-som.c, config/tc-alpha.c, + config/tc-arc.c, config/tc-arm.c, config/tc-cr16.c, + config/tc-cris.c, config/tc-crx.c, config/tc-d30v.c, + config/tc-dlx.c, config/tc-hppa.c, config/tc-i370.c, + config/tc-i386-intel.c, config/tc-i386.c, + config/tc-i860.c, config/tc-i960.c, config/tc-ia64.c, + config/tc-iq2000.c, config/tc-m32c.c, + config/tc-m32r.c, config/tc-m68hc11.c, + config/tc-m68k.c, config/tc-maxq.c, config/tc-mcore.c, + config/tc-mep.c, config/tc-mips.c, config/tc-mmix.c, + config/tc-mn10300.c, config/tc-moxie.c, + config/tc-ns32k.c, config/tc-pj.c, config/tc-ppc.c, + config/tc-s390.c, config/tc-score.c, + config/tc-score7.c, config/tc-sh.c, config/tc-sparc.c, + config/tc-spu.c, config/tc-tic30.c, config/tc-vax.c, + config/tc-xtensa.c, config/xtensa-relax.c, + dw2gencfi.c, dwarf2dbg.c, ehopt.c, expr.c, + frags.c, input-file.c, read.c, sb.c, + subsegs.c, symbols.c, write.c: Change the name of the gas macro `assert' to `gas_assert'. 2009-06-22 Daniel Gutson <dgutson@codesourcery.com> @@ -1084,7 +1137,7 @@ 2009-06-18 Nick Clifton <nickc@redhat.com> PR 10169 - * gas/tc-arm.c (do_t_ssat): Move common code from here... + * tc-arm.c (do_t_ssat): Move common code from here... (do_t_usat): ... and here to... (do_t_ssat_usat): New function: ... here. Add code to check that the shift value, if present, is in range. @@ -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; } @@ -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.\n")); 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; @@ -1158,6 +1159,8 @@ main (int argc, char ** argv) itbl_init (); + dwarf2_init (); + /* Now that we have fully initialized, and have created the output file, define any symbols requested by --defsym command line arguments. */ diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index c7e2a83..d477b4e 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -269,7 +269,7 @@ elf_file_symbol (const char *s, int appfile) if (name_length > strlen (S_GET_NAME (sym))) { obstack_grow (¬es, s, name_length + 1); - S_SET_NAME (sym, obstack_finish (¬es)); + S_SET_NAME (sym, (const char *) obstack_finish (¬es)); } else strcpy ((char *) S_GET_NAME (sym), s); @@ -505,7 +505,7 @@ static struct section_stack *section_stack; 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 *dest, symbolS *src) 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_UNUSED) } 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_UNUSED) 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_UNUSED) || *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_UNUSED) } } } - 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_UNUSED) /* 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_UNUSED) /* 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, asection *sec, void *xxx ATTRIBUTE_UNUSED) 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); @@ -2006,6 +2007,7 @@ struct group_list asection **head; /* Section lists. */ unsigned int *elt_count; /* Number of sections in each list. */ unsigned int num_group; /* Number of lists. */ + struct hash_control *indexes; /* Maps group name to index in head array. */ }; /* Called via bfd_map_over_sections. If SEC is a member of a group, @@ -2016,24 +2018,24 @@ 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; + unsigned int *elem_idx; + unsigned int *idx_ptr; if (group_name == NULL) return; /* If this group already has a list, add the section to the head of the list. */ - for (i = 0; i < list->num_group; i++) + elem_idx = (unsigned int *) hash_find (list->indexes, group_name); + if (elem_idx != NULL) { - if (strcmp (group_name, elf_group_name (list->head[i])) == 0) - { - elf_next_in_group (sec) = list->head[i]; - list->head[i] = sec; - list->elt_count[i] += 1; - return; - } + elf_next_in_group (sec) = list->head[*elem_idx]; + list->head[*elem_idx] = sec; + list->elt_count[*elem_idx] += 1; + return; } /* New group. Make the arrays bigger in chunks to minimize calls to @@ -2042,13 +2044,24 @@ build_group_lists (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf) 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; list->num_group += 1; + + /* Add index to hash. */ + idx_ptr = xmalloc (sizeof (unsigned int)); + *idx_ptr = i; + hash_insert (list->indexes, group_name, idx_ptr); +} + +static void free_section_idx (const char *key ATTRIBUTE_UNUSED, void *val) +{ + free ((unsigned int *) val); } void @@ -2063,6 +2076,7 @@ elf_frob_file (void) list.num_group = 0; list.head = NULL; list.elt_count = NULL; + list.indexes = hash_new (); bfd_map_over_sections (stdoutput, build_group_lists, &list); /* Make the SHT_GROUP sections that describe each section group. We @@ -2128,6 +2142,10 @@ elf_frob_file (void) #ifdef elf_tc_final_processing elf_tc_final_processing (); #endif + + /* Cleanup hash. */ + hash_traverse (list.indexes, free_section_idx); + hash_die (list.indexes); } /* It removes any unneeded versioned symbols from the symbol table. */ diff --git a/gas/config/tc-i386-intel.c b/gas/config/tc-i386-intel.c index c12569f..ff20874 100644 --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -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 *name, unsigned int operands, char *pc) 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 *name, unsigned int operands, char *pc) *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 --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index af1994d..a8dc7fc 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -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_UNUSED) 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 *name ATTRIBUTE_UNUSED, /* 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, segment) 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, char **end_op) 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 --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 0b4a64f..e8ba916 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -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_UNUSED) 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 *fde, struct cfi_insn_data **pfirst) 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 --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 4d03659..42d7267 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -168,6 +168,10 @@ struct line_seg { /* Collects data for all line table entries during assembly. */ static struct line_seg *all_segs; +/* Hash used to quickly lookup a segment by name, avoiding the need to search + through the all_segs list. */ +static struct hash_control *all_segs_hash; +static struct line_seg **last_seg_ptr; struct file_entry { const char *filename; @@ -230,23 +234,25 @@ get_line_subseg (segT seg, subsegT subseg) static subsegT last_subseg; static struct line_subseg *last_line_subseg; - struct line_seg **ps, *s; + struct line_seg *s; struct line_subseg **pss, *ss; if (seg == last_seg && subseg == last_subseg) return last_line_subseg; - for (ps = &all_segs; (s = *ps) != NULL; ps = &s->next) - if (s->seg == seg) - goto found_seg; - - s = (struct line_seg *) xmalloc (sizeof (*s)); - s->next = NULL; - s->seg = seg; - s->head = NULL; - *ps = s; + s = (struct line_seg *) hash_find (all_segs_hash, seg->name); + if (s == NULL) + { + s = (struct line_seg *) xmalloc (sizeof (*s)); + s->next = NULL; + s->seg = seg; + s->head = NULL; + *last_seg_ptr = s; + last_seg_ptr = &s->next; + hash_insert (all_segs_hash, seg->name, s); + } + gas_assert (seg == s->seg); - found_seg: for (pss = &s->head; (ss = *pss) != NULL ; pss = &ss->next) { if (ss->subseg == subseg) @@ -467,7 +473,7 @@ get_filenum (const char *filename, unsigned int num) 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; @@ -1702,6 +1708,14 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT ranges_seg) symbol_set_value_now (info_end); } +void +dwarf2_init (void) +{ + all_segs_hash = hash_new (); + last_seg_ptr = &all_segs; +} + + /* Finish the dwarf2 debug sections. We emit .debug.line if there were any .file/.loc directives, or --gdwarf2 was given, or if the file has a non-empty .debug_info section. If we emit .debug_line, diff --git a/gas/dwarf2dbg.h b/gas/dwarf2dbg.h index b019b28..fdeac47 100644 --- a/gas/dwarf2dbg.h +++ b/gas/dwarf2dbg.h @@ -83,13 +83,15 @@ 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 dwarf2_emit_label. */ extern bfd_boolean dwarf2_loc_mark_labels; +extern void dwarf2_init (void); + extern void dwarf2_finish (void); extern int dwarf2dbg_estimate_size_before_relax (fragS *); diff --git a/gas/ehopt.c b/gas/ehopt.c index 1c1ac60..c09eb15 100644 --- a/gas/ehopt.c +++ b/gas/ehopt.c @@ -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, unsigned int *pnbytes) { 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, unsigned int *pnbytes) 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: @@ -48,7 +48,7 @@ static void mri_char_constant (expressionS *); 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 expr_mode mode) #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 expr_mode mode) 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 higher rank. */ /* 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 higher rank. */ } } - 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 --git a/gas/frags.c b/gas/frags.c index af9af5c..fe3b4cc 100644 --- a/gas/frags.c +++ b/gas/frags.c @@ -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; @@ -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, const char *key, void *value) ++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, const char *key, void *value) ++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 --git a/gas/input-scrub.c b/gas/input-scrub.c index 522b485..a2cd31b 100644 --- a/gas/input-scrub.c +++ b/gas/input-scrub.c @@ -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 --git a/gas/listing.c b/gas/listing.c index d6777f2..c8b6d63 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -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_UNUSED) 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 --git a/gas/macro.c b/gas/macro.c index 2c72331..dd7f9a2 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -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 --git a/gas/macro.h b/gas/macro.h index 4db8018..edc1b6b 100644 --- a/gas/macro.h +++ b/gas/macro.h @@ -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 --git a/gas/po/gas.pot b/gas/po/gas.pot index 14e3db3..a091ff3 100644 --- a/gas/po/gas.pot +++ b/gas/po/gas.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: bug-binutils@gnu.org\n" -"POT-Creation-Date: 2009-09-07 12:09+0200\n" +"POT-Creation-Date: 2009-09-07 14:09+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -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 (¬es, '\0'); - retval = obstack_finish (¬es); + retval = (char *) obstack_finish (¬es); } 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 (¬es, '\0'); - filename = obstack_finish (¬es); + filename = (char *) obstack_finish (¬es); 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 --git a/gas/remap.c b/gas/remap.c index ae07896..b334b2c 100644 --- a/gas/remap.c +++ b/gas/remap.c @@ -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 --git a/gas/stabs.c b/gas/stabs.c index 69cca1d..da399ad 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -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 --git a/gas/subsegs.c b/gas/subsegs.c index 0fcd19c..30f8704 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -65,7 +65,7 @@ subseg_change (register segT seg, register int subseg) 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 subseg) { /* 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 force_new) 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 --git a/gas/symbols.c b/gas/symbols.c index 9ce4588..6162318 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -109,7 +109,7 @@ save_symbol_name (const char *name) name_length = strlen (name) + 1; /* +1 for \0. */ obstack_grow (¬es, name, name_length); - ret = obstack_finish (¬es); + ret = (char *) obstack_finish (¬es); #ifdef tc_canonicalize_symbol_name ret = tc_canonicalize_symbol_name (ret); @@ -137,7 +137,7 @@ symbol_create (const char *name, /* It is copied, the caller can destroy/modify. preserved_copy_of_name = save_symbol_name (name); - symbolP = obstack_alloc (¬es, sizeof (symbolS)); + symbolP = (symbolS *) obstack_alloc (¬es, 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, segT section, valueT value, fragS *frag) name_copy = save_symbol_name (name); - ret = obstack_alloc (¬es, sizeof *ret); + ret = (struct local_symbol *) obstack_alloc (¬es, sizeof *ret); ret->lsy_marker = NULL; ret->lsy_name = name_copy; ret->lsy_section = section; @@ -563,7 +563,7 @@ symbol_clone (symbolS *orgsymP, int replace) orgsymP = local_symbol_convert ((struct local_symbol *) orgsymP); bsymorg = orgsymP->bsym; - newsymP = obstack_alloc (¬es, sizeof (*newsymP)); + newsymP = (symbolS *) obstack_alloc (¬es, 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 (¬es, strlen (message_format) + 30); + symbol_decode = (char *) obstack_alloc (¬es, strlen (message_format) + 30); sprintf (symbol_decode, message_format, label_number, instance_number, type); return symbol_decode; diff --git a/gas/write.c b/gas/write.c index c941ae6..8adb87b 100644 --- a/gas/write.c +++ b/gas/write.c @@ -156,7 +156,7 @@ fix_new_internal (fragS *frag, /* Which frag? */ n_fixups++; - fixP = obstack_alloc (¬es, sizeof (fixS)); + fixP = (fixS *) obstack_alloc (¬es, sizeof (fixS)); fixP->fx_frag = frag; fixP->fx_where = where; @@ -1170,7 +1170,7 @@ write_relocs (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) 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)) { |