X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fecoff.c;h=a5fc62cc4baec72b555d99d0ff40f48e285c5602;hb=134c0c8bf4a258ba10e72b724eadf40f731bb7ec;hp=771c8b52bacda1c05fdd5a6a3b5419593f5066f0;hpb=4b95cf5c0c75d6efc1b2f96af72317aecca079f1;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/ecoff.c b/gas/ecoff.c index 771c8b52ba..a5fc62cc4b 100644 --- a/gas/ecoff.c +++ b/gas/ecoff.c @@ -1,5 +1,5 @@ /* ECOFF debugging support. - Copyright (C) 1993-2014 Free Software Foundation, Inc. + Copyright (C) 1993-2016 Free Software Foundation, Inc. Contributed by Cygnus Support. This file was put together by Ian Lance Taylor . A good deal of it comes directly from mips-tfile.c, by Michael @@ -1552,8 +1552,8 @@ add_string (varray_t *vp, /* string obstack */ const char *str, /* string */ shash_t **ret_hash /* return hash pointer */) { - register unsigned long len = strlen (str); - register shash_t *hash_ptr; + unsigned long len = strlen (str); + shash_t *hash_ptr; if (len >= PAGE_USIZE) as_fatal (_("string too big (%lu bytes)"), len); @@ -1561,7 +1561,7 @@ add_string (varray_t *vp, /* string obstack */ hash_ptr = (shash_t *) hash_find (hash_tbl, str); if (hash_ptr == (shash_t *) NULL) { - register const char *err; + const char *err; if (vp->objects_last_page + len >= PAGE_USIZE) { @@ -1604,12 +1604,12 @@ add_ecoff_symbol (const char *str, /* symbol name */ symint_t indx /* index to local/aux. syms */) { localsym_t *psym; - register scope_t *pscope; - register thead_t *ptag_head; - register tag_t *ptag; - register tag_t *ptag_next; - register varray_t *vp; - register int scope_delta = 0; + scope_t *pscope; + thead_t *ptag_head; + tag_t *ptag; + tag_t *ptag_next; + varray_t *vp; + int scope_delta = 0; shash_t *hash_ptr = (shash_t *) NULL; if (cur_file_ptr == (efdr_t *) NULL) @@ -1802,8 +1802,8 @@ add_ecoff_symbol (const char *str, /* symbol name */ static symint_t add_aux_sym_symint (symint_t aux_word /* auxiliary information word */) { - register varray_t *vp; - register aux_t *aux_ptr; + varray_t *vp; + aux_t *aux_ptr; if (cur_file_ptr == (efdr_t *) NULL) as_fatal (_("no current file pointer")); @@ -1825,8 +1825,8 @@ add_aux_sym_symint (symint_t aux_word /* auxiliary information word */) static symint_t add_aux_sym_rndx (int file_index, symint_t sym_index) { - register varray_t *vp; - register aux_t *aux_ptr; + varray_t *vp; + aux_t *aux_ptr; if (cur_file_ptr == (efdr_t *) NULL) as_fatal (_("no current file pointer")); @@ -1852,8 +1852,8 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ hash_state_t state, /* whether to hash type or not */ thash_t **hash_tbl /* pointer to hash table to use */) { - register varray_t *vp; - register aux_t *aux_ptr; + varray_t *vp; + aux_t *aux_ptr; static AUXU init_aux; symint_t ret; int i; @@ -1900,8 +1900,8 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ if (state != hash_no) { - register thash_t *hash_ptr; - register symint_t hi; + thash_t *hash_ptr; + symint_t hi; hi = aux.isym & ((1 << HASHBITS) - 1); hi %= THASH_SIZE; @@ -1957,9 +1957,9 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ || t->basic_type == bt_Union || t->basic_type == bt_Enum) { - register symint_t file_index = t->tag_ptr->ifd; - register localsym_t *sym = t->tag_ptr->sym; - register forward_t *forward_ref = allocate_forward (); + symint_t file_index = t->tag_ptr->ifd; + localsym_t *sym = t->tag_ptr->sym; + forward_t *forward_ref = allocate_forward (); if (sym != (localsym_t *) NULL) { @@ -2114,8 +2114,8 @@ add_unknown_tag (tag_t *ptag /* pointer to tag information */) static void add_procedure (char *func /* func name */) { - register varray_t *vp; - register proc_t *new_proc_ptr; + varray_t *vp; + proc_t *new_proc_ptr; symbolS *sym; #ifdef ECOFF_DEBUG @@ -2184,8 +2184,8 @@ ecoff_get_cur_proc_sym (void) static void add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake) { - register int first_ch; - register efdr_t *fil_ptr; + int first_ch; + efdr_t *fil_ptr; #ifdef ECOFF_DEBUG if (debug) @@ -2196,12 +2196,9 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake) want to use the actual file name. */ if (file_name == (const char *) NULL) { - char *file; - if (first_file != (efdr_t *) NULL) as_fatal (_("fake .file after real one")); - as_where (&file, (unsigned int *) NULL); - file_name = (const char *) file; + file_name = as_where ((unsigned int *) NULL); /* Automatically generate ECOFF debugging information, since I think that's what other ECOFF assemblers do. We don't do @@ -2434,14 +2431,13 @@ ecoff_directive_begin (int ignore ATTRIBUTE_UNUSED) return; } - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); (void) add_ecoff_symbol ((const char *) NULL, st_Block, sc_Text, symbol_find_or_make (name), (bfd_vma) 0, (symint_t) 0, (symint_t) 0); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); /* The line number follows, but we don't use it. */ (void) get_absolute_expression (); @@ -2472,8 +2468,7 @@ ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED) return; } - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); /* The value is the distance between the .bend directive and the corresponding symbol. We fill in the offset when we write out @@ -2485,7 +2480,7 @@ ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED) (void) add_ecoff_symbol ((const char *) NULL, st_End, sc_Text, endsym, (bfd_vma) 0, (symint_t) 0, (symint_t) 0); - *input_line_pointer = name_end; + restore_line_pointer (name_end); /* The line number follows, but we don't use it. */ (void) get_absolute_expression (); @@ -2519,8 +2514,7 @@ ecoff_directive_def (int ignore ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); if (coff_sym_name != (char *) NULL) as_warn (_(".def pseudo-op used inside of .def/.endef; ignored")); @@ -2544,7 +2538,7 @@ ecoff_directive_def (int ignore ATTRIBUTE_UNUSED) coff_sym_addend = 0; } - *input_line_pointer = name_end; + restore_line_pointer (name_end); demand_empty_rest_of_line (); } @@ -2757,12 +2751,11 @@ ecoff_directive_tag (int ignore ATTRIBUTE_UNUSED) return; } - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); coff_tag = xstrdup (name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } @@ -3004,13 +2997,12 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED) return; } - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); if (name == input_line_pointer) { as_warn (_(".end directive has no name")); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); return; } @@ -3031,7 +3023,7 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED) cur_proc_ptr = (proc_t *) NULL; - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } @@ -3053,20 +3045,19 @@ ecoff_directive_ent (int ignore ATTRIBUTE_UNUSED) return; } - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); if (name == input_line_pointer) { as_warn (_(".ent directive has no name")); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); return; } add_procedure (name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); /* The .ent directive is sometimes followed by a number. I'm not really sure what the number means. I don't see any way to store @@ -3095,10 +3086,9 @@ ecoff_directive_extern (int ignore ATTRIBUTE_UNUSED) symbolS *symbolp; valueT size; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolp = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); S_SET_EXTERNAL (symbolp); @@ -3348,10 +3338,9 @@ ecoff_directive_weakext (int ignore ATTRIBUTE_UNUSED) symbolS *symbolP; expressionS exp; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); @@ -3489,11 +3478,9 @@ ecoff_stab (segT sec ATTRIBUTE_UNUSED, return; } - name = input_line_pointer; - name_end = get_symbol_end (); - + name_end = get_symbol_name (&name); sym = symbol_find_or_make (name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); value = 0; addend = 0; @@ -3623,7 +3610,7 @@ ecoff_add_bytes (char **buf, if (need < PAGE_SIZE) need = PAGE_SIZE; want = (*bufend - *buf) + need; - *buf = (char *) xrealloc (*buf, want); + *buf = XRESIZEVEC (char, *buf, want); *bufend = *buf + want; return *buf + at; } @@ -3667,7 +3654,7 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, long *linecntptr) { char *bufptr; - register lineno_list_t *l; + lineno_list_t *l; lineno_list_t *last; efdr_t *file; proc_t *proc; @@ -4592,7 +4579,7 @@ ecoff_build_fdr (const struct ecoff_debug_swap *backend, static void ecoff_setup_ext (void) { - register symbolS *sym; + symbolS *sym; for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym)) { @@ -4704,7 +4691,7 @@ ecoff_build_debug (HDRR *hdr, /* Build the symbolic information. */ offset = 0; - buf = (char *) xmalloc (PAGE_SIZE); + buf = XNEWVEC (char, PAGE_SIZE); bufend = buf + PAGE_SIZE; /* Build the line number information. */ @@ -4788,7 +4775,7 @@ ecoff_build_debug (HDRR *hdr, static page_type * allocate_cluster (unsigned long npages) { - register page_type *value = (page_type *) xmalloc (npages * PAGE_USIZE); + page_type *value = (page_type *) xmalloc (npages * PAGE_USIZE); #ifdef ECOFF_DEBUG if (debug > 3) @@ -4837,7 +4824,7 @@ allocate_page (void) static scope_t * allocate_scope (void) { - register scope_t *ptr; + scope_t *ptr; static scope_t initial_scope; #ifndef MALLOC_CHECK @@ -4847,8 +4834,8 @@ allocate_scope (void) alloc_counts[(int) alloc_type_scope].free_list.f_scope = ptr->free; else { - register int unallocated = alloc_counts[(int) alloc_type_scope].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_scope].cur_page; + int unallocated = alloc_counts[(int) alloc_type_scope].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_scope].cur_page; if (unallocated == 0) { @@ -4863,7 +4850,7 @@ allocate_scope (void) #else - ptr = (scope_t *) xmalloc (sizeof (scope_t)); + ptr = XNEW (scope_t); #endif @@ -4892,13 +4879,13 @@ free_scope (scope_t *ptr) static vlinks_t * allocate_vlinks (void) { - register vlinks_t *ptr; + vlinks_t *ptr; static vlinks_t initial_vlinks; #ifndef MALLOC_CHECK - register int unallocated = alloc_counts[(int) alloc_type_vlinks].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_vlinks].cur_page; + int unallocated = alloc_counts[(int) alloc_type_vlinks].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_vlinks].cur_page; if (unallocated == 0) { @@ -4912,7 +4899,7 @@ allocate_vlinks (void) #else - ptr = (vlinks_t *) xmalloc (sizeof (vlinks_t)); + ptr = XNEW (vlinks_t); #endif @@ -4926,13 +4913,13 @@ allocate_vlinks (void) static shash_t * allocate_shash (void) { - register shash_t *ptr; + shash_t *ptr; static shash_t initial_shash; #ifndef MALLOC_CHECK - register int unallocated = alloc_counts[(int) alloc_type_shash].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_shash].cur_page; + int unallocated = alloc_counts[(int) alloc_type_shash].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_shash].cur_page; if (unallocated == 0) { @@ -4946,7 +4933,7 @@ allocate_shash (void) #else - ptr = (shash_t *) xmalloc (sizeof (shash_t)); + ptr = XNEW (shash_t); #endif @@ -4960,13 +4947,13 @@ allocate_shash (void) static thash_t * allocate_thash (void) { - register thash_t *ptr; + thash_t *ptr; static thash_t initial_thash; #ifndef MALLOC_CHECK - register int unallocated = alloc_counts[(int) alloc_type_thash].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_thash].cur_page; + int unallocated = alloc_counts[(int) alloc_type_thash].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_thash].cur_page; if (unallocated == 0) { @@ -4980,7 +4967,7 @@ allocate_thash (void) #else - ptr = (thash_t *) xmalloc (sizeof (thash_t)); + ptr = XNEW (thash_t); #endif @@ -4994,7 +4981,7 @@ allocate_thash (void) static tag_t * allocate_tag (void) { - register tag_t *ptr; + tag_t *ptr; static tag_t initial_tag; #ifndef MALLOC_CHECK @@ -5004,8 +4991,8 @@ allocate_tag (void) alloc_counts[(int) alloc_type_tag].free_list.f_tag = ptr->free; else { - register int unallocated = alloc_counts[(int) alloc_type_tag].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_tag].cur_page; + int unallocated = alloc_counts[(int) alloc_type_tag].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_tag].cur_page; if (unallocated == 0) { @@ -5020,7 +5007,7 @@ allocate_tag (void) #else - ptr = (tag_t *) xmalloc (sizeof (tag_t)); + ptr = XNEW (tag_t); #endif @@ -5049,13 +5036,13 @@ free_tag (tag_t *ptr) static forward_t * allocate_forward (void) { - register forward_t *ptr; + forward_t *ptr; static forward_t initial_forward; #ifndef MALLOC_CHECK - register int unallocated = alloc_counts[(int) alloc_type_forward].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_forward].cur_page; + int unallocated = alloc_counts[(int) alloc_type_forward].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_forward].cur_page; if (unallocated == 0) { @@ -5069,7 +5056,7 @@ allocate_forward (void) #else - ptr = (forward_t *) xmalloc (sizeof (forward_t)); + ptr = XNEW (forward_t); #endif @@ -5083,7 +5070,7 @@ allocate_forward (void) static thead_t * allocate_thead (void) { - register thead_t *ptr; + thead_t *ptr; static thead_t initial_thead; #ifndef MALLOC_CHECK @@ -5093,8 +5080,8 @@ allocate_thead (void) alloc_counts[(int) alloc_type_thead].free_list.f_thead = ptr->free; else { - register int unallocated = alloc_counts[(int) alloc_type_thead].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_thead].cur_page; + int unallocated = alloc_counts[(int) alloc_type_thead].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_thead].cur_page; if (unallocated == 0) { @@ -5109,7 +5096,7 @@ allocate_thead (void) #else - ptr = (thead_t *) xmalloc (sizeof (thead_t)); + ptr = XNEW (thead_t); #endif @@ -5136,13 +5123,13 @@ free_thead (thead_t *ptr) static lineno_list_t * allocate_lineno_list (void) { - register lineno_list_t *ptr; + lineno_list_t *ptr; static lineno_list_t initial_lineno_list; #ifndef MALLOC_CHECK - register int unallocated = alloc_counts[(int) alloc_type_lineno].unallocated; - register page_type *cur_page = alloc_counts[(int) alloc_type_lineno].cur_page; + int unallocated = alloc_counts[(int) alloc_type_lineno].unallocated; + page_type *cur_page = alloc_counts[(int) alloc_type_lineno].cur_page; if (unallocated == 0) { @@ -5156,7 +5143,7 @@ allocate_lineno_list (void) #else - ptr = (lineno_list_t *) xmalloc (sizeof (lineno_list_t)); + ptr = XNEW (lineno_list_t); #endif @@ -5191,10 +5178,10 @@ void ecoff_generate_asm_lineno (void) { unsigned int lineno; - char *filename; + const char *filename; lineno_list_t *list; - as_where (&filename, &lineno); + filename = as_where (&lineno); if (current_stabs_filename == (char *) NULL || filename_cmp (current_stabs_filename, filename))