summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/ChangeLog10
-rw-r--r--ld/Makefile.am8
-rw-r--r--ld/Makefile.in8
-rw-r--r--ld/ldcref.c4
-rw-r--r--ld/ldlang.c3
-rw-r--r--ld/ldmisc.c76
-rw-r--r--ld/ldmisc.h3
7 files changed, 46 insertions, 66 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 50a474aed3..e2f75847e8 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -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.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index b6ac5a5cfc..80ec9eba42 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -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 \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 28400cc534..1735b808e4 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -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 \
diff --git a/ld/ldcref.c b/ld/ldcref.c
index e016451680..3c0763b5a0 100644
--- a/ld/ldcref.c
+++ b/ld/ldcref.c
@@ -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;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 297df20a30..369f6545f4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -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);
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 8af043aa2b..9cf64a9858 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -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
diff --git a/ld/ldmisc.h b/ld/ldmisc.h
index cf70433546..92f4e2a65e 100644
--- a/ld/ldmisc.h
+++ b/ld/ldmisc.h
@@ -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