merge from gcc
[external/binutils.git] / gas / ecoff.c
index 27cfd6e..f4e22ac 100644 (file)
@@ -1,5 +1,6 @@
 /* ECOFF debugging support.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+   2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    This file was put together by Ian Lance Taylor <ian@cygnus.com>.  A
@@ -10,7 +11,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,
@@ -20,8 +21,8 @@
 
    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"
 
@@ -1505,6 +1506,16 @@ ecoff_symbol_new_hook (symbolS *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.  */
 
@@ -2312,7 +2323,7 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake)
    compiler output, only in hand coded assembler.  */
 
 void
-ecoff_new_file (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)
     return;
@@ -2777,7 +2788,7 @@ ecoff_directive_val (int ignore ATTRIBUTE_UNUSED)
   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;
     }
@@ -2863,7 +2874,7 @@ ecoff_directive_endef (int ignore ATTRIBUTE_UNUSED)
   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;
     }
@@ -3185,14 +3196,10 @@ ecoff_directive_frame (int ignore ATTRIBUTE_UNUSED)
 
   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.  */
@@ -3326,7 +3333,7 @@ mark_stabs (int ignore ATTRIBUTE_UNUSED)
     {
       /* Add a dummy @stabs dymbol.  */
       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));
@@ -3619,7 +3626,7 @@ ecoff_add_bytes (char **buf,
   if (need < PAGE_SIZE)
     need = PAGE_SIZE;
   want = (*bufend - *buf) + need;
-  *buf = xrealloc (*buf, want);
+  *buf = (char *) xrealloc (*buf, want);
   *bufend = *buf + want;
   return *buf + at;
 }
@@ -3685,6 +3692,8 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
   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
@@ -3891,7 +3900,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend,
                     unsigned long offset)
 {
   const bfd_size_type external_sym_size = backend->external_sym_size;
-  void (* const swap_sym_out) (bfd *, const SYMR *, PTR)
+  void (* const swap_sym_out) (bfd *, const SYMR *, void *)
     = backend->swap_sym_out;
   char *sym_out;
   long isym;
@@ -4130,7 +4139,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend,
                        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)
                        {
@@ -4256,7 +4265,7 @@ ecoff_build_procs (const struct ecoff_debug_swap *backend,
                   unsigned long offset)
 {
   const bfd_size_type external_pdr_size = backend->external_pdr_size;
-  void (* const swap_pdr_out) (bfd *, const PDR *, PTR)
+  void (* const swap_pdr_out) (bfd *, const PDR *, void *)
     = backend->swap_pdr_out;
   char *pdr_out;
   long iproc;
@@ -4541,7 +4550,7 @@ ecoff_build_fdr (const struct ecoff_debug_swap *backend,
                 unsigned long offset)
 {
   const bfd_size_type external_fdr_size = backend->external_fdr_size;
-  void (* const swap_fdr_out) (bfd *, const FDR *, PTR)
+  void (* const swap_fdr_out) (bfd *, const FDR *, void *)
     = backend->swap_fdr_out;
   long ifile;
   char *fdr_out;
@@ -4698,7 +4707,7 @@ ecoff_build_debug (HDRR *hdr,
 
   /* Build the symbolic information.  */
   offset = 0;
-  buf = xmalloc (PAGE_SIZE);
+  buf = (char *) xmalloc (PAGE_SIZE);
   bufend = buf + PAGE_SIZE;
 
   /* Build the line number information.  */
@@ -4877,7 +4886,7 @@ free_scope (scope_t *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