From: Elias Athanasopoulos <eathan@otenet.gr>
To: Alan Modra <amodra@bigpond.net.au>
Cc: binutils@sources.redhat.com, Olaf Hering <olh@suse.de>
Subject: Re: powerpc64 and "nm -C"
Date: Wed, 26 Jun 2002 10:07:00 -0000 [thread overview]
Message-ID: <20020626202253.D1131@neutrino.particles.org> (raw)
In-Reply-To: <20020626132058.GW22093@bubble.sa.bigpond.net.au>; from amodra@bigpond.net.au on Wed, Jun 26, 2002 at 10:50:58PM +0930
Hi Alan,
On Wed, Jun 26, 2002 at 10:50:58PM +0930, Alan Modra wrote:
> The demangler currently doesn't work very well on powerpc64 due to
> those pesky leading `.'s on function entry point symbols. I also
> think it useful to be able to distinguish function descriptor syms
> (without a dot) from function code syms (with dot) after demangling,
> hence the ldmisc.c change.
Just a thought: wouldn't be better to embed this functionality in
the demangler, since it [the demangler] is not used only by nm?
I have attached a patch which modifies objdump, just like you did in
nm. I can't test it, since the issue concerns powerpc64. I also don't
provide a ChangeLog entry since it is really your code. :-)
Elias
--- objdump.c.orig Wed Jun 26 20:09:48 2002
+++ objdump.c Wed Jun 26 20:19:05 2002
@@ -631,6 +631,7 @@
char *alloc;
const char *name;
const char *print;
+ const char *p;
alloc = NULL;
name = bfd_asymbol_name (sym);
@@ -642,12 +643,36 @@
if (bfd_get_symbol_leading_char (abfd) == name[0])
++name;
- alloc = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS);
- if (alloc == NULL)
- print = name;
- else
+ /* This is a hack for 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;
+
+ alloc = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS);
+ if (alloc)
+ {
+ size_t dots = p - name;
+
+ /* Now put back any stripped dots. */
+ if (dots != 0)
+ {
+ size_t len = strlen (alloc) + 1;
+ char *add_dots = xmalloc (len + dots);
+
+ memcpy (add_dots, name, dots);
+ memcpy (add_dots + dots, alloc, len);
+ free (alloc);
+ alloc = add_dots;
+ }
+
print = alloc;
}
+ else
+ print = name;
+ }
if (info != NULL)
(*info->fprintf_func) (info->stream, "%s", print);
next prev parent reply other threads:[~2002-06-26 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-26 6:21 Alan Modra
2002-06-26 10:07 ` Elias Athanasopoulos [this message]
2002-06-26 22:10 ` Alan Modra
2002-07-01 21:19 ` Alan Modra
2002-07-02 0:17 ` Elias Athanasopoulos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020626202253.D1131@neutrino.particles.org \
--to=eathan@otenet.gr \
--cc=amodra@bigpond.net.au \
--cc=binutils@sources.redhat.com \
--cc=olh@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).