* ldcref.c (cref_fill_array): Call bfd_demangle rather than demangle.
authorAlan Modra <amodra@gmail.com>
Thu, 19 Apr 2007 10:45:59 +0000 (10:45 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 19 Apr 2007 10:45:59 +0000 (10:45 +0000)
* ldlang.c (lang_one_common): Likewise.
* ldmisc.c (vfinfo): Likewise.
(demangle): Delete.
* ldmisc.h (demangle): Delete.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.

ld/ChangeLog
ld/Makefile.am
ld/Makefile.in
ld/ldcref.c
ld/ldlang.c
ld/ldmisc.c
ld/ldmisc.h

index 50a474aed31f64b58989bd31c1994e6bf8e89d23..e2f75847e84f0b1301cfcb18ce8c09317b44e34c 100644 (file)
@@ -1,3 +1,13 @@
+2007-04-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * ldcref.c (cref_fill_array): Call bfd_demangle rather than demangle.
+       * ldlang.c (lang_one_common): Likewise.
+       * ldmisc.c (vfinfo): Likewise.
+       (demangle): Delete.
+       * ldmisc.h (demangle): Delete.
+       * Makefile.am: Run "make dep-am".
+       * Makefile.in: Regenerate.
+
 2007-04-18  Alan Modra  <amodra@bigpond.net.au>
 
        * ldlang.h (enum section_type): Add overlay_section.
index b6ac5a5cfc870abb7decafd021fb78b33dff5bfa..80ec9eba42f5bfa884dacd5bcf8321b556ece408 100644 (file)
@@ -1960,7 +1960,7 @@ ldemul.o: ldemul.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
 ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \
-  ldgram.h ldlang.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+  ldlex.h ldgram.h ldlang.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/safe-ctype.h
 ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
@@ -1998,7 +1998,7 @@ ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/safe-ctype.h ld.h ldexp.h ldlang.h ldwrite.h \
   ldmisc.h ldgram.h ldmain.h
 lexsup.o: lexsup.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/symcat.h sysdep.h $(INCDIR)/fopen-same.h \
+  $(INCDIR)/symcat.h ../bfd/bfdver.h sysdep.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
   $(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \
   ldlang.h ldgram.h ldlex.h ldfile.h ldver.h ldemul.h \
@@ -2010,8 +2010,8 @@ mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
 ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/objalloc.h ld.h ldmain.h ldmisc.h ldexp.h \
-  ldlang.h
+  $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h \
+  ld.h ldmain.h ldmisc.h ldexp.h ldlang.h
 pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
index 28400cc534e7b3de01bfce07a2dde19b41c6732c..1735b808e43aa3d09719008bd4bbdb849dcc062d 100644 (file)
@@ -2735,7 +2735,7 @@ ldemul.o: ldemul.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
 ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \
-  ldgram.h ldlang.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+  ldlex.h ldgram.h ldlang.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/safe-ctype.h
 ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
@@ -2773,7 +2773,7 @@ ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/safe-ctype.h ld.h ldexp.h ldlang.h ldwrite.h \
   ldmisc.h ldgram.h ldmain.h
 lexsup.o: lexsup.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/symcat.h sysdep.h $(INCDIR)/fopen-same.h \
+  $(INCDIR)/symcat.h ../bfd/bfdver.h sysdep.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
   $(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \
   ldlang.h ldgram.h ldlex.h ldfile.h ldver.h ldemul.h \
@@ -2785,8 +2785,8 @@ mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
 ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/objalloc.h ld.h ldmain.h ldmisc.h ldexp.h \
-  ldlang.h
+  $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h \
+  ld.h ldmain.h ldmisc.h ldexp.h ldlang.h
 pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
index e016451680cde2bf57e50d71a5b3c676f42fb2e1..3c0763b5a0573ee48b0f7628f807acaea54577a5 100644 (file)
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 #include "sysdep.h"
 #include "bfdlink.h"
 #include "libiberty.h"
+#include "demangle.h"
 #include "objalloc.h"
 
 #include "ld.h"
@@ -324,7 +325,8 @@ cref_fill_array (struct cref_hash_entry *h, void *data)
   struct cref_hash_entry ***pph = data;
 
   ASSERT (h->demangled == NULL);
-  h->demangled = demangle (h->root.string);
+  h->demangled = bfd_demangle (output_bfd, h->root.string,
+                              DMGL_ANSI | DMGL_PARAMS);
 
   **pph = h;
 
index 297df20a301189ae453d3dac621f0e962a24cc7e..369f6545f4295b390a3a6af6793c99d5b93a7d15 100644 (file)
@@ -5267,7 +5267,8 @@ lang_one_common (struct bfd_link_hash_entry *h, void *info)
          header_printed = TRUE;
        }
 
-      name = demangle (h->root.string);
+      name = bfd_demangle (output_bfd, h->root.string,
+                          DMGL_ANSI | DMGL_PARAMS);
       minfo ("%s", name);
       len = strlen (name);
       free (name);
index 8af043aa2b24bc70be099ca8ffe0d98386e9f6c8..9cf64a98585974473f921a00e1c0df6c81a5c692 100644 (file)
@@ -1,6 +1,6 @@
 /* ldmisc.c
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006
+   2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
@@ -144,17 +144,24 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                const char *name = va_arg (arg, const char *);
 
                if (name == NULL || *name == 0)
-                 fprintf (fp, _("no symbol"));
-               else if (! demangling)
-                 fprintf (fp, "%s", name);
-               else
+                 {
+                   fprintf (fp, _("no symbol"));
+                   break;
+                 }
+               else if (demangling)
                  {
                    char *demangled;
 
-                   demangled = demangle (name);
-                   fprintf (fp, "%s", demangled);
-                   free (demangled);
+                   demangled = bfd_demangle (output_bfd, name,
+                                             DMGL_ANSI | DMGL_PARAMS);
+                   if (demangled != NULL)
+                     {
+                       fprintf (fp, "%s", demangled);
+                       free (demangled);
+                       break;
+                     }
                  }
+               fprintf (fp, "%s", name);
              }
              break;
 
@@ -432,48 +439,6 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
     xexit (1);
 }
 
-/* Wrapper around cplus_demangle.  Strips leading underscores and
-   other such chars that would otherwise confuse the demangler.  */
-
-char *
-demangle (const char *name)
-{
-  char *res;
-  const char *p;
-
-  if (output_bfd != NULL
-      && bfd_get_symbol_leading_char (output_bfd) == name[0])
-    ++name;
-
-  /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
-     or the MS PE format.  These formats have a number of leading '.'s
-     on at least some symbols, so we remove all dots to avoid
-     confusing the demangler.  */
-  p = name;
-  while (*p == '.')
-    ++p;
-
-  res = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS);
-  if (res)
-    {
-      size_t dots = p - name;
-
-      /* Now put back any stripped dots.  */
-      if (dots != 0)
-       {
-         size_t len = strlen (res) + 1;
-         char *add_dots = xmalloc (len + dots);
-
-         memcpy (add_dots, name, dots);
-         memcpy (add_dots + dots, res, len);
-         free (res);
-         res = add_dots;
-       }
-      return res;
-    }
-  return xstrdup (name);
-}
-
 /* Format info message and print on stdout.  */
 
 /* (You would think this should be called just "info", but then you
@@ -512,11 +477,14 @@ info_assert (const char *file, unsigned int line)
 void
 minfo (const char *fmt, ...)
 {
-  va_list arg;
+  if (config.map_file != NULL)
+    {
+      va_list arg;
 
-  va_start (arg, fmt);
-  vfinfo (config.map_file, fmt, arg, FALSE);
-  va_end (arg);
+      va_start (arg, fmt);
+      vfinfo (config.map_file, fmt, arg, FALSE);
+      va_end (arg);
+    }
 }
 
 void
index cf704335463273e3433182d9573b9aa2a97789b5..92f4e2a65eeae43d03f0a4fb15de2a630862a8cd 100644 (file)
@@ -1,5 +1,5 @@
 /* ldmisc.h -
-   Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2001, 2003, 2004
+   Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2001, 2003, 2004, 2007
    Free Software Foundation, Inc.
 
    This file is part of GLD, the Gnu Linker.
@@ -40,6 +40,5 @@ do { info_assert(__FILE__,__LINE__); } while (0)
 
 extern void print_space (void);
 extern void print_nl (void);
-extern char *demangle (const char *);
 
 #endif
This page took 0.041111 seconds and 4 git commands to generate.