gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gas / ecoff.c
index 40b129b877f55b7d7079be52a900c43787e82dde..08bfee1fc5c6412934ae1ecd40e1ebbf8078b509 100644 (file)
@@ -1,6 +1,5 @@
 /* ECOFF debugging support.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
+   Copyright (C) 1993-2020 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    This file was put together by Ian Lance Taylor <ian@cygnus.com>.  A
    good deal of it comes directly from mips-tfile.c, by Michael
@@ -10,7 +9,7 @@
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GAS is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 #include "as.h"
 
 /* This file is compiled conditionally for those targets which use
-   ECOFF debugging information (e.g., MIPS ECOFF, MIPS ELF, Alpha
-   ECOFF).  */
+   ECOFF debugging information (e.g., MIPS ELF, Alpha ECOFF).  */
 
 #include "ecoff.h"
 
@@ -36,7 +34,7 @@
 #include "coff/internal.h"
 #include "coff/symconst.h"
 #include "aout/stab_gnu.h"
-
+#include "filenames.h"
 #include "safe-ctype.h"
 
 /* Why isn't this in coff/sym.h?  */
 
    Each file table has offsets for where the line numbers, local
    strings, local symbols, and procedure table starts from within the
-   global tables, and the indexs are reset to 0 for each of those
+   global tables, and the indices are reset to 0 for each of those
    tables for the file.
 
    The procedure table contains the binary equivalents of the .ent
     #26             48  0x00000030  struct no name { ifd = -1, index = 1048575 }
 */
 \f
-/* Redefinition of of storage classes as an enumeration for better
+/* Redefinition of storage classes as an enumeration for better
    debugging.  */
 
 typedef enum sc {
@@ -1408,76 +1406,74 @@ static char stabs_symbol[] = STABS_SYMBOL;
 \f
 /* Prototypes for functions defined in this file.  */
 
-static void add_varray_page PARAMS ((varray_t *vp));
-static symint_t add_string PARAMS ((varray_t *vp,
-                                   struct hash_control *hash_tbl,
-                                   const char *str,
-                                   shash_t **ret_hash));
-static localsym_t *add_ecoff_symbol PARAMS ((const char *str, st_t type,
-                                            sc_t storage, symbolS *sym,
-                                            bfd_vma addend, symint_t value,
-                                            symint_t indx));
-static symint_t add_aux_sym_symint PARAMS ((symint_t aux_word));
-static symint_t add_aux_sym_rndx PARAMS ((int file_index,
-                                         symint_t sym_index));
-static symint_t add_aux_sym_tir PARAMS ((type_info_t *t,
-                                        hash_state_t state,
-                                        thash_t **hash_tbl));
-static tag_t *get_tag PARAMS ((const char *tag, localsym_t *sym,
-                              bt_t basic_type));
-static void add_unknown_tag PARAMS ((tag_t *ptag));
-static void add_procedure PARAMS ((char *func));
-static void add_file PARAMS ((const char *file_name, int indx, int fake));
+static void add_varray_page (varray_t *vp);
+static symint_t add_string (varray_t *vp,
+                           struct hash_control *hash_tbl,
+                           const char *str,
+                           shash_t **ret_hash);
+static localsym_t *add_ecoff_symbol (const char *str, st_t type,
+                                    sc_t storage, symbolS *sym,
+                                    bfd_vma addend, symint_t value,
+                                    symint_t indx);
+static symint_t add_aux_sym_symint (symint_t aux_word);
+static symint_t add_aux_sym_rndx (int file_index, symint_t sym_index);
+static symint_t add_aux_sym_tir (type_info_t *t,
+                                hash_state_t state,
+                                thash_t **hash_tbl);
+static tag_t *get_tag (const char *tag, localsym_t *sym, bt_t basic_type);
+static void add_unknown_tag (tag_t *ptag);
+static void add_procedure (char *func, int aent);
+static void add_file (const char *file_name, int indx, int fake);
 #ifdef ECOFF_DEBUG
-static char *sc_to_string PARAMS ((sc_t storage_class));
-static char *st_to_string PARAMS ((st_t symbol_type));
+static char *sc_to_string (sc_t storage_class);
+static char *st_to_string (st_t symbol_type);
 #endif
-static void mark_stabs PARAMS ((int));
-static char *ecoff_add_bytes PARAMS ((char **buf, char **bufend,
-                                     char *bufptr, unsigned long need));
+static void mark_stabs (int);
+static char *ecoff_add_bytes (char **buf, char **bufend,
+                             char *bufptr, unsigned long need);
 static unsigned long ecoff_padding_adjust
-  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
-          unsigned long offset, char **bufptrptr));
+  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
+   unsigned long offset, char **bufptrptr);
 static unsigned long ecoff_build_lineno
-  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
-          unsigned long offset, long *linecntptr));
+  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
+   unsigned long offset, long *linecntptr);
 static unsigned long ecoff_build_symbols
-  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
-          unsigned long offset));
+  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
+   unsigned long offset);
 static unsigned long ecoff_build_procs
-  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
-          unsigned long offset));
+  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
+   unsigned long offset);
 static unsigned long ecoff_build_aux
-  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
-          unsigned long offset));
-static unsigned long ecoff_build_strings PARAMS ((char **buf, char **bufend,
-                                                 unsigned long offset,
-                                                 varray_t *vp));
+  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
+   unsigned long offset);
+static unsigned long ecoff_build_strings (char **buf, char **bufend,
+                                         unsigned long offset,
+                                         varray_t *vp);
 static unsigned long ecoff_build_ss
-  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
-          unsigned long offset));
+  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
+   unsigned long offset);
 static unsigned long ecoff_build_fdr
-  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
-          unsigned long offset));
-static void ecoff_setup_ext PARAMS ((void));
-static page_type *allocate_cluster PARAMS ((unsigned long npages));
-static page_type *allocate_page PARAMS ((void));
-static scope_t *allocate_scope PARAMS ((void));
-static void free_scope PARAMS ((scope_t *ptr));
-static vlinks_t *allocate_vlinks PARAMS ((void));
-static shash_t *allocate_shash PARAMS ((void));
-static thash_t *allocate_thash PARAMS ((void));
-static tag_t *allocate_tag PARAMS ((void));
-static void free_tag PARAMS ((tag_t *ptr));
-static forward_t *allocate_forward PARAMS ((void));
-static thead_t *allocate_thead PARAMS ((void));
-static void free_thead PARAMS ((thead_t *ptr));
-static lineno_list_t *allocate_lineno_list PARAMS ((void));
+  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
+   unsigned long offset);
+static void ecoff_setup_ext (void);
+static page_type *allocate_cluster (unsigned long npages);
+static page_type *allocate_page (void);
+static scope_t *allocate_scope (void);
+static void free_scope (scope_t *ptr);
+static vlinks_t *allocate_vlinks (void);
+static shash_t *allocate_shash (void);
+static thash_t *allocate_thash (void);
+static tag_t *allocate_tag (void);
+static void free_tag (tag_t *ptr);
+static forward_t *allocate_forward (void);
+static thead_t *allocate_thead (void);
+static void free_thead (thead_t *ptr);
+static lineno_list_t *allocate_lineno_list (void);
 \f
 /* This function should be called when the assembler starts up.  */
 
 void
-ecoff_read_begin_hook ()
+ecoff_read_begin_hook (void)
 {
   tag_hash = hash_new ();
   top_tag_head = allocate_thead ();
@@ -1490,8 +1486,7 @@ ecoff_read_begin_hook ()
 /* This function should be called when a symbol is created.  */
 
 void
-ecoff_symbol_new_hook (symbolP)
-     symbolS *symbolP;
+ecoff_symbol_new_hook (symbolS *symbolP)
 {
   OBJ_SYMFIELD_TYPE *obj;
 
@@ -1508,12 +1503,21 @@ ecoff_symbol_new_hook (symbolP)
   obj->ecoff_symbol = NULL;
   obj->ecoff_extern_size = 0;
 }
+
+void
+ecoff_symbol_clone_hook (symbolS *newsymP, symbolS *orgsymP)
+{
+  OBJ_SYMFIELD_TYPE *n, *o;
+
+  n = symbol_get_obj (newsymP);
+  o = symbol_get_obj (orgsymP);
+  memcpy (n, o, sizeof *n);
+}
 \f
 /* Add a page to a varray object.  */
 
 static void
-add_varray_page (vp)
-     varray_t *vp;                             /* varray to add page to */
+add_varray_page (varray_t *vp /* varray to add page to */)
 {
   vlinks_t *new_links = allocate_vlinks ();
 
@@ -1543,14 +1547,13 @@ add_varray_page (vp)
 /* Add a string (and null pad) to one of the string tables.  */
 
 static symint_t
-add_string (vp, hash_tbl, str, ret_hash)
-     varray_t *vp;                     /* string obstack */
-     struct hash_control *hash_tbl;    /* ptr to hash table */
-     const char *str;                  /* string */
-     shash_t **ret_hash;               /* return hash pointer */
+add_string (varray_t *vp,                      /* string obstack */
+           struct hash_control *hash_tbl,      /* ptr to hash table */
+           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);
@@ -1558,7 +1561,7 @@ add_string (vp, hash_tbl, str, ret_hash)
   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)
        {
@@ -1592,22 +1595,21 @@ add_string (vp, hash_tbl, str, ret_hash)
 /* Add debugging information for a symbol.  */
 
 static localsym_t *
-add_ecoff_symbol (str, type, storage, sym_value, addend, value, indx)
-     const char *str;                  /* symbol name */
-     st_t type;                                /* symbol type */
-     sc_t storage;                     /* storage class */
-     symbolS *sym_value;               /* associated symbol.  */
-     bfd_vma addend;                   /* addend to sym_value.  */
-     symint_t value;                   /* value of symbol */
-     symint_t indx;                    /* index to local/aux. syms */
+add_ecoff_symbol (const char *str,     /* symbol name */
+                 st_t type,            /* symbol type */
+                 sc_t storage,         /* storage class */
+                 symbolS *sym_value,   /* associated symbol.  */
+                 bfd_vma addend,       /* addend to sym_value.  */
+                 symint_t value,       /* value of symbol */
+                 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)
@@ -1750,7 +1752,7 @@ add_ecoff_symbol (str, type, storage, sym_value, addend, value, indx)
              ty = add_aux_sym_tir (&last_func_type_info,
                                    hash_no,
                                    &cur_file_ptr->thash_head[0]);
-
+             (void) ty;
 /* This seems to be unnecessary.  I'm not even sure what it is
  * intended to do.  It's from mips-tfile.
  *           if (last_func_sym_value != (symbolS *) NULL)
@@ -1798,11 +1800,10 @@ add_ecoff_symbol (str, type, storage, sym_value, addend, value, indx)
    for integral aux types, not just symints.  */
 
 static symint_t
-add_aux_sym_symint (aux_word)
-     symint_t aux_word;                /* auxiliary information word */
+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"));
@@ -1822,12 +1823,10 @@ add_aux_sym_symint (aux_word)
 /* Add an auxiliary symbol (passing a file/symbol index combo).  */
 
 static symint_t
-add_aux_sym_rndx (file_index, sym_index)
-     int file_index;
-     symint_t sym_index;
+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"));
@@ -1849,13 +1848,12 @@ add_aux_sym_rndx (file_index, sym_index)
    type qualifiers).  */
 
 static symint_t
-add_aux_sym_tir (t, state, hash_tbl)
-     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 */
+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;
@@ -1902,8 +1900,8 @@ add_aux_sym_tir (t, state, hash_tbl)
 
   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;
@@ -1959,9 +1957,9 @@ add_aux_sym_tir (t, state, hash_tbl)
       || 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)
        {
@@ -2006,10 +2004,9 @@ add_aux_sym_tir (t, state, hash_tbl)
 /* Add a tag to the tag table (unless it already exists).  */
 
 static tag_t *
-get_tag (tag, sym, basic_type)
-     const char *tag;                  /* tag name */
-     localsym_t *sym;                  /* tag start block */
-     bt_t basic_type;                  /* bt_Struct, bt_Union, or bt_Enum */
+get_tag (const char *tag,      /* tag name */
+        localsym_t *sym,       /* tag start block */
+        bt_t basic_type        /* bt_Struct, bt_Union, or bt_Enum */)
 {
   shash_t *hash_ptr;
   const char *err;
@@ -2066,8 +2063,7 @@ get_tag (tag, sym, basic_type)
 /* Add an unknown {struct, union, enum} tag.  */
 
 static void
-add_unknown_tag (ptag)
-     tag_t *ptag;              /* pointer to tag information */
+add_unknown_tag (tag_t *ptag /* pointer to tag information */)
 {
   shash_t *hash_ptr    = ptag->hash_ptr;
   char *name           = hash_ptr->string;
@@ -2113,14 +2109,14 @@ add_unknown_tag (ptag)
 }
 \f
 /* Add a procedure to the current file's list of procedures, and record
-   this is the current procedure.  */
+   this is the current procedure.  If AENT, then only set the requested
+   symbol's function type.  */
 
 static void
-add_procedure (func)
-     char *func;                       /* func name */
+add_procedure (char *func /* func name */, int aent)
 {
-  register varray_t *vp;
-  register proc_t *new_proc_ptr;
+  varray_t *vp;
+  proc_t *new_proc_ptr;
   symbolS *sym;
 
 #ifdef ECOFF_DEBUG
@@ -2128,6 +2124,13 @@ add_procedure (func)
     fputc ('\n', stderr);
 #endif
 
+  /* Set the BSF_FUNCTION flag for the symbol.  */
+  sym = symbol_find_or_make (func);
+  symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
+
+  if (aent)
+    return;
+
   if (cur_file_ptr == (efdr_t *) NULL)
     as_fatal (_("no current file pointer"));
 
@@ -2148,10 +2151,6 @@ add_procedure (func)
   new_proc_ptr->pdr.lnLow = -1;
   new_proc_ptr->pdr.lnHigh = -1;
 
-  /* Set the BSF_FUNCTION flag for the symbol.  */
-  sym = symbol_find_or_make (func);
-  symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
-
   /* Push the start of the function.  */
   new_proc_ptr->sym = add_ecoff_symbol ((const char *) NULL, st_Proc, sc_Text,
                                        sym, (bfd_vma) 0, (symint_t) 0,
@@ -2177,7 +2176,7 @@ add_procedure (func)
 }
 
 symbolS *
-ecoff_get_cur_proc_sym ()
+ecoff_get_cur_proc_sym (void)
 {
   return (cur_proc_ptr ? cur_proc_ptr->sym->as_sym : NULL);
 }
@@ -2187,13 +2186,10 @@ ecoff_get_cur_proc_sym ()
    where the current file structure lives.  */
 
 static void
-add_file (file_name, indx, fake)
-     const char *file_name;            /* file name */
-     int indx ATTRIBUTE_UNUSED;
-     int fake;
+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)
@@ -2204,12 +2200,9 @@ add_file (file_name, indx, 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
@@ -2234,7 +2227,7 @@ add_file (file_name, indx, fake)
   if (stabs_seen)
     {
       (void) add_ecoff_symbol (file_name, st_Nil, sc_Nil,
-                              symbol_new ("L0\001", now_seg,
+                              symbol_new (FAKE_LABEL_NAME, now_seg,
                                           (valueT) frag_now_fix (),
                                           frag_now),
                               (bfd_vma) 0, 0, ECOFF_MARK_STAB (N_SOL));
@@ -2262,7 +2255,7 @@ add_file (file_name, indx, fake)
        fil_ptr = fil_ptr->next_file)
     {
       if (first_ch == fil_ptr->name[0]
-         && strcmp (file_name, fil_ptr->name) == 0
+         && filename_cmp (file_name, fil_ptr->name) == 0
          && fil_ptr->fdr.fMerge)
        {
          cur_file_ptr = fil_ptr;
@@ -2328,10 +2321,9 @@ add_file (file_name, indx, fake)
    compiler output, only in hand coded assembler.  */
 
 void
-ecoff_new_file (name)
-     const char *name;
+ecoff_new_file (const char *name, int appfile ATTRIBUTE_UNUSED)
 {
-  if (cur_file_ptr != NULL && strcmp (cur_file_ptr->name, name) == 0)
+  if (cur_file_ptr != NULL && filename_cmp (cur_file_ptr->name, name) == 0)
     return;
   add_file (name, 0, 0);
 
@@ -2424,8 +2416,7 @@ st_to_string (symbol_type)
    which gives the location of the start of the block.  */
 
 void
-ecoff_directive_begin (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_begin (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   char name_end;
@@ -2444,14 +2435,13 @@ ecoff_directive_begin (ignore)
       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 ();
@@ -2462,8 +2452,7 @@ ecoff_directive_begin (ignore)
    which gives the location of the end of the block.  */
 
 void
-ecoff_directive_bend (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   char name_end;
@@ -2483,8 +2472,7 @@ ecoff_directive_bend (ignore)
       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
@@ -2496,7 +2484,7 @@ ecoff_directive_bend (ignore)
     (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 ();
@@ -2521,8 +2509,7 @@ static int coff_inside_enumeration;
 /* Handle a .def directive: start defining a symbol.  */
 
 void
-ecoff_directive_def (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_def (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   char name_end;
@@ -2531,8 +2518,7 @@ ecoff_directive_def (ignore)
 
   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"));
@@ -2540,11 +2526,9 @@ ecoff_directive_def (ignore)
     as_warn (_("empty symbol name in .def; ignored"));
   else
     {
-      if (coff_sym_name != (char *) NULL)
-       free (coff_sym_name);
-      if (coff_tag != (char *) NULL)
-       free (coff_tag);
-      
+      free (coff_sym_name);
+      free (coff_tag);
+
       coff_sym_name = xstrdup (name);
       coff_type = type_info_init;
       coff_storage_class = sc_Nil;
@@ -2556,7 +2540,7 @@ ecoff_directive_def (ignore)
       coff_sym_addend = 0;
     }
 
-  *input_line_pointer = name_end;
+  restore_line_pointer (name_end);
 
   demand_empty_rest_of_line ();
 }
@@ -2567,8 +2551,7 @@ ecoff_directive_def (ignore)
    more than that anyhow, so I will also make that assumption.  */
 
 void
-ecoff_directive_dim (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_dim (int ignore ATTRIBUTE_UNUSED)
 {
   int dimens[N_TQ];
   int i;
@@ -2617,8 +2600,7 @@ ecoff_directive_dim (ignore)
    symbol.  */
 
 void
-ecoff_directive_scl (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_scl (int ignore ATTRIBUTE_UNUSED)
 {
   long val;
 
@@ -2642,8 +2624,7 @@ ecoff_directive_scl (ignore)
    never generate more than one argument.  */
 
 void
-ecoff_directive_size (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_size (int ignore ATTRIBUTE_UNUSED)
 {
   int sizes[N_TQ];
   int i;
@@ -2692,8 +2673,7 @@ ecoff_directive_size (ignore)
    symbol.  */
 
 void
-ecoff_directive_type (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_type (int ignore ATTRIBUTE_UNUSED)
 {
   long val;
   tq_t *tq_ptr;
@@ -2761,8 +2741,7 @@ ecoff_directive_type (ignore)
    union or enum.  */
 
 void
-ecoff_directive_tag (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_tag (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   char name_end;
@@ -2774,12 +2753,11 @@ ecoff_directive_tag (ignore)
       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 ();
 }
@@ -2788,8 +2766,7 @@ ecoff_directive_tag (ignore)
    may be the name of a static or global symbol.  */
 
 void
-ecoff_directive_val (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_val (int ignore ATTRIBUTE_UNUSED)
 {
   expressionS exp;
 
@@ -2803,7 +2780,7 @@ ecoff_directive_val (ignore)
   expression (&exp);
   if (exp.X_op != O_constant && exp.X_op != O_symbol)
     {
-      as_bad (_(".val expression is too copmlex"));
+      as_bad (_(".val expression is too complex"));
       demand_empty_rest_of_line ();
       return;
     }
@@ -2823,8 +2800,7 @@ ecoff_directive_val (ignore)
    debugging information for a symbol.  */
 
 void
-ecoff_directive_endef (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_endef (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   symint_t indx;
@@ -2890,7 +2866,7 @@ ecoff_directive_endef (ignore)
   else if (coff_symbol_typ == st_Member
           && coff_type.num_sizes - coff_type.extra_sizes == 1)
     {
-      /* Is this a bitfield?  This is indicated by a structure memeber
+      /* Is this a bitfield?  This is indicated by a structure member
          having a size field that isn't an array.  */
       coff_type.bitfield = 1;
     }
@@ -3003,8 +2979,7 @@ ecoff_directive_endef (ignore)
 /* Parse .end directives.  */
 
 void
-ecoff_directive_end (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_end (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   char name_end;
@@ -3024,13 +2999,12 @@ ecoff_directive_end (ignore)
       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;
     }
@@ -3044,22 +3018,25 @@ ecoff_directive_end (ignore)
     as_warn (_(".end directive names unknown symbol"));
   else
     (void) add_ecoff_symbol ((const char *) NULL, st_End, sc_Text,
-                            symbol_new ("L0\001", now_seg,
+                            symbol_new (FAKE_LABEL_NAME, now_seg,
                                         (valueT) frag_now_fix (),
                                         frag_now),
                             (bfd_vma) 0, (symint_t) 0, (symint_t) 0);
 
+#ifdef md_flush_pending_output
+  md_flush_pending_output ();
+#endif
+
   cur_proc_ptr = (proc_t *) NULL;
 
-  *input_line_pointer = name_end;
+  (void) restore_line_pointer (name_end);
   demand_empty_rest_of_line ();
 }
 \f
 /* Parse .ent directives.  */
 
 void
-ecoff_directive_ent (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_ent (int aent)
 {
   char *name;
   char name_end;
@@ -3067,27 +3044,26 @@ ecoff_directive_ent (ignore)
   if (cur_file_ptr == (efdr_t *) NULL)
     add_file ((const char *) NULL, 0, 1);
 
-  if (cur_proc_ptr != (proc_t *) NULL)
+  if (!aent && cur_proc_ptr != (proc_t *) NULL)
     {
       as_warn (_("second .ent directive found before .end directive"));
       demand_empty_rest_of_line ();
       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;
+      as_warn (_("%s directive has no name"), aent ? ".aent" : ".ent");
+      (void) restore_line_pointer (name_end);
       demand_empty_rest_of_line ();
       return;
     }
 
-  add_procedure (name);
+  add_procedure (name, aent);
 
-  *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
@@ -3109,18 +3085,16 @@ ecoff_directive_ent (ignore)
 /* Parse .extern directives.  */
 
 void
-ecoff_directive_extern (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_extern (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   int c;
   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);
 
@@ -3134,8 +3108,7 @@ ecoff_directive_extern (ignore)
 /* Parse .file directives.  */
 
 void
-ecoff_directive_file (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_file (int ignore ATTRIBUTE_UNUSED)
 {
   int indx;
   char *name;
@@ -3161,8 +3134,7 @@ ecoff_directive_file (ignore)
 /* Parse .fmask directives.  */
 
 void
-ecoff_directive_fmask (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_fmask (int ignore ATTRIBUTE_UNUSED)
 {
   long val;
 
@@ -3190,8 +3162,7 @@ ecoff_directive_fmask (ignore)
 /* Parse .frame directives.  */
 
 void
-ecoff_directive_frame (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_frame (int ignore ATTRIBUTE_UNUSED)
 {
   long val;
 
@@ -3218,21 +3189,16 @@ ecoff_directive_frame (ignore)
 
   cur_proc_ptr->pdr.pcreg = tc_get_register (0);
 
-#if 0
   /* Alpha-OSF1 adds "the offset of saved $a0 from $sp", according to
      Sandro.  I don't yet know where this value should be stored, if
-     anywhere.  */
-  demand_empty_rest_of_line ();
-#else
+     anywhere.  Don't call demand_empty_rest_of_line ().  */
   s_ignore (42);
-#endif
 }
 \f
 /* Parse .mask directives.  */
 
 void
-ecoff_directive_mask (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_mask (int ignore ATTRIBUTE_UNUSED)
 {
   long val;
 
@@ -3260,8 +3226,7 @@ ecoff_directive_mask (ignore)
 /* Parse .loc directives.  */
 
 void
-ecoff_directive_loc (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_loc (int ignore ATTRIBUTE_UNUSED)
 {
   lineno_list_t *list;
   symint_t lineno;
@@ -3297,7 +3262,7 @@ ecoff_directive_loc (ignore)
   if (stabs_seen)
     {
       (void) add_ecoff_symbol ((char *) NULL, st_Label, sc_Text,
-                              symbol_new ("L0\001", now_seg,
+                              symbol_new (FAKE_LABEL_NAME, now_seg,
                                           (valueT) frag_now_fix (),
                                           frag_now),
                               (bfd_vma) 0, 0, lineno);
@@ -3341,9 +3306,7 @@ ecoff_directive_loc (ignore)
    information so that it points to the instruction after the nop.  */
 
 void
-ecoff_fix_loc (old_frag, old_frag_offset)
-     fragS *old_frag;
-     unsigned long old_frag_offset;
+ecoff_fix_loc (fragS *old_frag, unsigned long old_frag_offset)
 {
   if (last_lineno != NULL
       && last_lineno->frag == old_frag
@@ -3357,14 +3320,13 @@ ecoff_fix_loc (old_frag, old_frag_offset)
 /* Make sure the @stabs symbol is emitted.  */
 
 static void
-mark_stabs (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+mark_stabs (int ignore ATTRIBUTE_UNUSED)
 {
   if (! stabs_seen)
     {
-      /* Add a dummy @stabs dymbol.  */
+      /* Add a dummy @stabs symbol.  */
       stabs_seen = 1;
-      (void) add_ecoff_symbol (stabs_symbol, stNil, scInfo,
+      (void) add_ecoff_symbol (stabs_symbol, st_Nil, sc_Info,
                               (symbolS *) NULL,
                               (bfd_vma) 0, (symint_t) -1,
                               ECOFF_MARK_STAB (0));
@@ -3375,18 +3337,16 @@ mark_stabs (ignore)
 #ifndef TC_MIPS
 /* For TC_MIPS use the version in tc-mips.c.  */
 void
-ecoff_directive_weakext (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+ecoff_directive_weakext (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   int c;
   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 ();
 
@@ -3454,13 +3414,12 @@ ecoff_directive_weakext (ignore)
        value           a numeric value or an address.  */
 
 void
-ecoff_stab (sec, what, string, type, other, desc)
-     segT sec ATTRIBUTE_UNUSED;
-     int what;
-     const char *string;
-     int type;
-     int other;
-     int desc;
+ecoff_stab (segT sec ATTRIBUTE_UNUSED,
+           int what,
+           const char *string,
+           int type,
+           int other,
+           int desc)
 {
   efdr_t *save_file_ptr = cur_file_ptr;
   symbolS *sym;
@@ -3525,11 +3484,9 @@ ecoff_stab (sec, what, string, type, other, desc)
          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;
@@ -3609,8 +3566,7 @@ ecoff_stab (sec, what, string, type, other, desc)
    .scommon section rather than bfd_com_section.  */
 
 void
-ecoff_frob_symbol (sym)
-     symbolS *sym;
+ecoff_frob_symbol (symbolS *sym)
 {
   if (S_IS_COMMON (sym)
       && S_GET_VALUE (sym) > 0
@@ -3623,12 +3579,12 @@ ecoff_frob_symbol (sym)
          but with the name .scommon.  */
       if (scom_section.name == NULL)
        {
-         scom_section = bfd_com_section;
+         scom_section = *bfd_com_section_ptr;
          scom_section.name = ".scommon";
          scom_section.output_section = &scom_section;
          scom_section.symbol = &scom_symbol;
          scom_section.symbol_ptr_ptr = &scom_section.symbol;
-         scom_symbol = *bfd_com_section.symbol;
+         scom_symbol = *bfd_com_section_ptr->symbol;
          scom_symbol.name = ".scommon";
          scom_symbol.section = &scom_section;
        }
@@ -3647,11 +3603,10 @@ ecoff_frob_symbol (sym)
 /* Add bytes to the symbolic information buffer.  */
 
 static char *
-ecoff_add_bytes (buf, bufend, bufptr, need)
-     char **buf;
-     char **bufend;
-     char *bufptr;
-     unsigned long need;
+ecoff_add_bytes (char **buf,
+                char **bufend,
+                char *bufptr,
+                unsigned long need)
 {
   unsigned long at;
   unsigned long want;
@@ -3661,7 +3616,7 @@ ecoff_add_bytes (buf, bufend, bufptr, need)
   if (need < PAGE_SIZE)
     need = PAGE_SIZE;
   want = (*bufend - *buf) + need;
-  *buf = xrealloc (*buf, want);
+  *buf = XRESIZEVEC (char, *buf, want);
   *bufend = *buf + want;
   return *buf + at;
 }
@@ -3670,12 +3625,11 @@ ecoff_add_bytes (buf, bufend, bufptr, need)
    for the ECOFF target debugging information.  */
 
 static unsigned long
-ecoff_padding_adjust (backend, buf, bufend, offset, bufptrptr)
-     const struct ecoff_debug_swap *backend;
-     char **buf;
-     char **bufend;
-     unsigned long offset;
-     char **bufptrptr;
+ecoff_padding_adjust (const struct ecoff_debug_swap *backend,
+                     char **buf,
+                     char **bufend,
+                     unsigned long offset,
+                     char **bufptrptr)
 {
   bfd_size_type align;
 
@@ -3699,15 +3653,14 @@ ecoff_padding_adjust (backend, buf, bufend, offset, bufptrptr)
 /* Build the line number information.  */
 
 static unsigned long
-ecoff_build_lineno (backend, buf, bufend, offset, linecntptr)
-     const struct ecoff_debug_swap *backend;
-     char **buf;
-     char **bufend;
-     unsigned long offset;
-     long *linecntptr;
+ecoff_build_lineno (const struct ecoff_debug_swap *backend,
+                   char **buf,
+                   char **bufend,
+                   unsigned long offset,
+                   long *linecntptr)
 {
   char *bufptr;
-  register lineno_list_t *l;
+  lineno_list_t *l;
   lineno_list_t *last;
   efdr_t *file;
   proc_t *proc;
@@ -3729,6 +3682,8 @@ ecoff_build_lineno (backend, buf, bufend, offset, linecntptr)
   iline = 0;
   totcount = 0;
 
+  /* FIXME?  Now that MIPS embedded-PIC is gone, it may be safe to
+     remove this code.  */
   /* For some reason the address of the first procedure is ignored
      when reading line numbers.  This doesn't matter if the address of
      the first procedure is 0, but when gcc is generating MIPS
@@ -3743,8 +3698,7 @@ ecoff_build_lineno (backend, buf, bufend, offset, linecntptr)
       && first_proc_ptr != (proc_t *) NULL
       && local_first_lineno != (lineno_list_t *) NULL
       && ((S_GET_VALUE (first_proc_ptr->sym->as_sym)
-          + bfd_get_section_vma (stdoutput,
-                                 S_GET_SEGMENT (first_proc_ptr->sym->as_sym)))
+          + bfd_section_vma (S_GET_SEGMENT (first_proc_ptr->sym->as_sym)))
          != 0))
     {
       first.file = local_first_lineno->file;
@@ -3929,14 +3883,13 @@ ecoff_build_lineno (backend, buf, bufend, offset, linecntptr)
 /* Build and swap out the symbols.  */
 
 static unsigned long
-ecoff_build_symbols (backend, buf, bufend, offset)
-     const struct ecoff_debug_swap *backend;
-     char **buf;
-     char **bufend;
-     unsigned long offset;
+ecoff_build_symbols (const struct ecoff_debug_swap *backend,
+                    char **buf,
+                    char **bufend,
+                    unsigned long offset)
 {
   const bfd_size_type external_sym_size = backend->external_sym_size;
-  void (* const swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR))
+  void (* const swap_sym_out) (bfd *, const SYMR *, void *)
     = backend->swap_sym_out;
   char *sym_out;
   long isym;
@@ -4025,8 +3978,7 @@ ecoff_build_symbols (backend, buf, bufend, offset)
                      else
                        sym_ptr->ecoff_sym.asym.value =
                          (S_GET_VALUE (as_sym)
-                          + bfd_get_section_vma (stdoutput,
-                                                 S_GET_SEGMENT (as_sym))
+                          + bfd_section_vma (S_GET_SEGMENT (as_sym))
                           + sym_ptr->addend);
 
                      sym_ptr->ecoff_sym.weakext = S_IS_WEAK (as_sym);
@@ -4112,7 +4064,7 @@ ecoff_build_symbols (backend, buf, bufend, offset)
                            sc = sc_Bss;
                          else if (strcmp (segname, ".sbss") == 0)
                            sc = sc_SBss;
-                         else if (seg == &bfd_abs_section)
+                         else if (seg == bfd_abs_section_ptr)
                            sc = sc_Abs;
                          else
                            {
@@ -4148,10 +4100,10 @@ ecoff_build_symbols (backend, buf, bufend, offset)
                      /* If an st_end symbol has an associated gas
                         symbol, then it is a local label created for
                         a .bend or .end directive.  Stabs line
-                        numbers will have \001 in the names.  */
+                        numbers will have FAKE_LABEL_CHAR in the names.  */
                      if (local
                          && sym_ptr->ecoff_sym.asym.st != st_End
-                         && strchr (sym_ptr->name, '\001') == 0)
+                         && strchr (sym_ptr->name, FAKE_LABEL_CHAR) == 0)
                        sym_ptr->ecoff_sym.asym.iss =
                          add_string (&fil_ptr->strings,
                                      fil_ptr->str_hash,
@@ -4175,7 +4127,7 @@ ecoff_build_symbols (backend, buf, bufend, offset)
                        sym_ptr->ecoff_sym.asym.iss =
                          begin_ptr->ecoff_sym.asym.iss;
 
-                     begin_type = begin_ptr->ecoff_sym.asym.st;
+                     begin_type = (st_t) begin_ptr->ecoff_sym.asym.st;
                      if (begin_type == st_File
                          || begin_type == st_Block)
                        {
@@ -4295,14 +4247,13 @@ ecoff_build_symbols (backend, buf, bufend, offset)
 /* Swap out the procedure information.  */
 
 static unsigned long
-ecoff_build_procs (backend, buf, bufend, offset)
-     const struct ecoff_debug_swap *backend;
-     char **buf;
-     char **bufend;
-     unsigned long offset;
+ecoff_build_procs (const struct ecoff_debug_swap *backend,
+                  char **buf,
+                  char **bufend,
+                  unsigned long offset)
 {
   const bfd_size_type external_pdr_size = backend->external_pdr_size;
-  void (* const swap_pdr_out) PARAMS ((bfd *, const PDR *, PTR))
+  void (* const swap_pdr_out) (bfd *, const PDR *, void *)
     = backend->swap_pdr_out;
   char *pdr_out;
   long iproc;
@@ -4355,8 +4306,7 @@ ecoff_build_procs (backend, buf, bufend, offset)
 
                  adr_sym = proc_ptr->sym->as_sym;
                  adr = (S_GET_VALUE (adr_sym)
-                        + bfd_get_section_vma (stdoutput,
-                                               S_GET_SEGMENT (adr_sym)));
+                        + bfd_section_vma (S_GET_SEGMENT (adr_sym)));
                  if (first)
                    {
                      /* This code used to force the adr of the very
@@ -4386,11 +4336,10 @@ ecoff_build_procs (backend, buf, bufend, offset)
 /* Swap out the aux information.  */
 
 static unsigned long
-ecoff_build_aux (backend, buf, bufend, offset)
-     const struct ecoff_debug_swap *backend;
-     char **buf;
-     char **bufend;
-     unsigned long offset;
+ecoff_build_aux (const struct ecoff_debug_swap *backend,
+                char **buf,
+                char **bufend,
+                unsigned long offset)
 {
   int bigendian;
   union aux_ext *aux_out;
@@ -4501,11 +4450,10 @@ ecoff_build_aux (backend, buf, bufend, offset)
    bytes copied, rather than the new offset.  */
 
 static unsigned long
-ecoff_build_strings (buf, bufend, offset, vp)
-     char **buf;
-     char **bufend;
-     unsigned long offset;
-     varray_t *vp;
+ecoff_build_strings (char **buf,
+                    char **bufend,
+                    unsigned long offset,
+                    varray_t *vp)
 {
   unsigned long istr;
   char *str_out;
@@ -4540,11 +4488,10 @@ ecoff_build_strings (buf, bufend, offset, vp)
 /* Dump out the local strings.  */
 
 static unsigned long
-ecoff_build_ss (backend, buf, bufend, offset)
-     const struct ecoff_debug_swap *backend;
-     char **buf;
-     char **bufend;
-     unsigned long offset;
+ecoff_build_ss (const struct ecoff_debug_swap *backend,
+               char **buf,
+               char **bufend,
+               unsigned long offset)
 {
   long iss;
   vlinks_t *file_link;
@@ -4584,14 +4531,13 @@ ecoff_build_ss (backend, buf, bufend, offset)
 /* Swap out the file descriptors.  */
 
 static unsigned long
-ecoff_build_fdr (backend, buf, bufend, offset)
-     const struct ecoff_debug_swap *backend;
-     char **buf;
-     char **bufend;
-     unsigned long offset;
+ecoff_build_fdr (const struct ecoff_debug_swap *backend,
+                char **buf,
+                char **bufend,
+                unsigned long offset)
 {
   const bfd_size_type external_fdr_size = backend->external_fdr_size;
-  void (* const swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR))
+  void (* const swap_fdr_out) (bfd *, const FDR *, void *)
     = backend->swap_fdr_out;
   long ifile;
   char *fdr_out;
@@ -4634,9 +4580,9 @@ ecoff_build_fdr (backend, buf, bufend, offset)
    calls a backend function to deal with it.  */
 
 static void
-ecoff_setup_ext ()
+ecoff_setup_ext (void)
 {
-  register symbolS *sym;
+  symbolS *sym;
 
   for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym))
     {
@@ -4664,10 +4610,9 @@ ecoff_setup_ext ()
 /* Build the ECOFF debugging information.  */
 
 unsigned long
-ecoff_build_debug (hdr, bufp, backend)
-     HDRR *hdr;
-     char **bufp;
-     const struct ecoff_debug_swap *backend;
+ecoff_build_debug (HDRR *hdr,
+                  char **bufp,
+                  const struct ecoff_debug_swap *backend)
 {
   const bfd_size_type external_pdr_size = backend->external_pdr_size;
   tag_t *ptag;
@@ -4749,7 +4694,7 @@ ecoff_build_debug (hdr, bufp, backend)
 
   /* Build the symbolic information.  */
   offset = 0;
-  buf = xmalloc (PAGE_SIZE);
+  buf = XNEWVEC (char, PAGE_SIZE);
   bufend = buf + PAGE_SIZE;
 
   /* Build the line number information.  */
@@ -4831,10 +4776,9 @@ ecoff_build_debug (hdr, bufp, backend)
 #ifndef MALLOC_CHECK
 
 static page_type *
-allocate_cluster (npages)
-     unsigned long npages;
+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)
@@ -4854,7 +4798,7 @@ static unsigned long pages_left = 0;
 /* Allocate one page (which is initialized to 0).  */
 
 static page_type *
-allocate_page ()
+allocate_page (void)
 {
 #ifndef MALLOC_CHECK
 
@@ -4881,9 +4825,9 @@ allocate_page ()
 /* Allocate scoping information.  */
 
 static scope_t *
-allocate_scope ()
+allocate_scope (void)
 {
-  register scope_t *ptr;
+  scope_t *ptr;
   static scope_t initial_scope;
 
 #ifndef MALLOC_CHECK
@@ -4893,8 +4837,8 @@ allocate_scope ()
     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)
        {
@@ -4909,7 +4853,7 @@ allocate_scope ()
 
 #else
 
-  ptr = (scope_t *) xmalloc (sizeof (scope_t));
+  ptr = XNEW (scope_t);
 
 #endif
 
@@ -4921,8 +4865,7 @@ allocate_scope ()
 /* Free scoping information.  */
 
 static void
-free_scope (ptr)
-     scope_t *ptr;
+free_scope (scope_t *ptr)
 {
   alloc_counts[(int) alloc_type_scope].total_free++;
 
@@ -4930,22 +4873,22 @@ free_scope (ptr)
   ptr->free = alloc_counts[(int) alloc_type_scope].free_list.f_scope;
   alloc_counts[(int) alloc_type_scope].free_list.f_scope = ptr;
 #else
-  free ((PTR) ptr);
+  free ((void *) ptr);
 #endif
 }
 \f
 /* Allocate links for pages in a virtual array.  */
 
 static vlinks_t *
-allocate_vlinks ()
+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)
     {
@@ -4959,7 +4902,7 @@ allocate_vlinks ()
 
 #else
 
-  ptr = (vlinks_t *) xmalloc (sizeof (vlinks_t));
+  ptr = XNEW (vlinks_t);
 
 #endif
 
@@ -4971,15 +4914,15 @@ allocate_vlinks ()
 /* Allocate string hash buckets.  */
 
 static shash_t *
-allocate_shash ()
+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)
     {
@@ -4993,7 +4936,7 @@ allocate_shash ()
 
 #else
 
-  ptr = (shash_t *) xmalloc (sizeof (shash_t));
+  ptr = XNEW (shash_t);
 
 #endif
 
@@ -5005,15 +4948,15 @@ allocate_shash ()
 /* Allocate type hash buckets.  */
 
 static thash_t *
-allocate_thash ()
+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)
     {
@@ -5027,7 +4970,7 @@ allocate_thash ()
 
 #else
 
-  ptr = (thash_t *) xmalloc (sizeof (thash_t));
+  ptr = XNEW (thash_t);
 
 #endif
 
@@ -5039,9 +4982,9 @@ allocate_thash ()
 /* Allocate structure, union, or enum tag information.  */
 
 static tag_t *
-allocate_tag ()
+allocate_tag (void)
 {
-  register tag_t *ptr;
+  tag_t *ptr;
   static tag_t initial_tag;
 
 #ifndef MALLOC_CHECK
@@ -5051,8 +4994,8 @@ allocate_tag ()
     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)
        {
@@ -5067,7 +5010,7 @@ allocate_tag ()
 
 #else
 
-  ptr = (tag_t *) xmalloc (sizeof (tag_t));
+  ptr = XNEW (tag_t);
 
 #endif
 
@@ -5079,8 +5022,7 @@ allocate_tag ()
 /* Free scoping information.  */
 
 static void
-free_tag (ptr)
-     tag_t *ptr;
+free_tag (tag_t *ptr)
 {
   alloc_counts[(int) alloc_type_tag].total_free++;
 
@@ -5095,15 +5037,15 @@ free_tag (ptr)
 /* Allocate forward reference to a yet unknown tag.  */
 
 static forward_t *
-allocate_forward ()
+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)
     {
@@ -5117,7 +5059,7 @@ allocate_forward ()
 
 #else
 
-  ptr = (forward_t *) xmalloc (sizeof (forward_t));
+  ptr = XNEW (forward_t);
 
 #endif
 
@@ -5129,9 +5071,9 @@ allocate_forward ()
 /* Allocate head of type hash list.  */
 
 static thead_t *
-allocate_thead ()
+allocate_thead (void)
 {
-  register thead_t *ptr;
+  thead_t *ptr;
   static thead_t initial_thead;
 
 #ifndef MALLOC_CHECK
@@ -5141,8 +5083,8 @@ allocate_thead ()
     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)
        {
@@ -5157,7 +5099,7 @@ allocate_thead ()
 
 #else
 
-  ptr = (thead_t *) xmalloc (sizeof (thead_t));
+  ptr = XNEW (thead_t);
 
 #endif
 
@@ -5169,8 +5111,7 @@ allocate_thead ()
 /* Free scoping information.  */
 
 static void
-free_thead (ptr)
-     thead_t *ptr;
+free_thead (thead_t *ptr)
 {
   alloc_counts[(int) alloc_type_thead].total_free++;
 
@@ -5183,15 +5124,15 @@ free_thead (ptr)
 }
 \f
 static lineno_list_t *
-allocate_lineno_list ()
+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)
     {
@@ -5205,7 +5146,7 @@ allocate_lineno_list ()
 
 #else
 
-  ptr = (lineno_list_t *) xmalloc (sizeof (lineno_list_t));
+  ptr = XNEW (lineno_list_t);
 
 #endif
 
@@ -5215,8 +5156,7 @@ allocate_lineno_list ()
 }
 
 void
-ecoff_set_gp_prolog_size (sz)
-     int sz;
+ecoff_set_gp_prolog_size (int sz)
 {
   if (cur_proc_ptr == 0)
     return;
@@ -5232,22 +5172,22 @@ ecoff_set_gp_prolog_size (sz)
 }
 
 int
-ecoff_no_current_file ()
+ecoff_no_current_file (void)
 {
   return cur_file_ptr == (efdr_t *) NULL;
 }
 
 void
-ecoff_generate_asm_lineno ()
+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
-      || strcmp (current_stabs_filename, filename))
+      || filename_cmp (current_stabs_filename, filename))
     add_file (filename, 0, 1);
 
   list = allocate_lineno_list ();
@@ -5285,7 +5225,7 @@ ecoff_generate_asm_lineno ()
 #else
 
 void
-ecoff_generate_asm_lineno ()
+ecoff_generate_asm_lineno (void)
 {
 }
 
This page took 0.046473 seconds and 4 git commands to generate.