* 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.
This commit is contained in:
Alan Modra 2007-04-19 10:45:59 +00:00
parent ed180cc5db
commit 73705ac309
7 changed files with 46 additions and 66 deletions

View 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.

View 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 \

View 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 \

View 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;

View 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);

View 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

View 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