From: "H . J . Lu" <hjl@lucon.org>
To: binutils@sourceware.cygnus.com
Subject: PATCH: Update nm.c for 64bit BFD on 32bit ELF files.
Date: Fri, 24 Aug 2001 15:35:00 -0000 [thread overview]
Message-ID: <20010824153533.A11079@lucon.org> (raw)
With the new bfd_?printf_vma, now I got
# nm /tmp/u.o
U foo
00000000 t gcc2_compiled.
00000000 T main
when I used nm with the 64bit BFD on a 32bit ELF file. Here is a patch.
.
H.J.
----
2001-08-24 H.J. Lu <hjl@gnu.org>
* nm.c (print_width): New.
(display_rel_file): Set `print_width' according to
bfd_sprintf_vma.
(print_symbol_info_bsd): Check `print_width' instead of BFD64.
Index: nm.c
===================================================================
RCS file: /work/cvs/gnu/binutils/binutils/nm.c,v
retrieving revision 1.17
diff -u -p -r1.17 nm.c
--- nm.c 2001/08/10 17:02:45 1.17
+++ nm.c 2001/08/24 22:24:33
@@ -245,6 +245,11 @@ static char value_format[] = "%016lx";
/* We don't use value_format for this case. */
#endif
#endif
+#ifdef BFD64
+static int print_width = 16;
+#else
+static int print_width = 8;
+#endif
static int print_radix = 16;
/* Print formats for printing stab info. */
static char other_format[] = "%02x";
@@ -940,6 +945,7 @@ display_rel_file (abfd, archive_bfd)
PTR minisyms;
unsigned int size;
struct size_sym *symsizes;
+ char buf[30];
if (! dynamic)
{
@@ -960,6 +966,9 @@ display_rel_file (abfd, archive_bfd)
return;
}
+ bfd_sprintf_vma (abfd, buf, (bfd_vma) -1);
+ print_width = strlen (buf);
+
/* Discard the symbols we don't want to print.
It's OK to do this in place; we'll free the storage anyway
(after printing). */
@@ -1476,9 +1485,8 @@ print_symbol_info_bsd (info, abfd)
{
if (bfd_is_undefined_symclass (info->type))
{
-#ifdef BFD64
- printf (" ");
-#endif
+ if (print_width == 16)
+ printf (" ");
printf (" ");
}
else
next reply other threads:[~2001-08-24 15:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-24 15:35 H . J . Lu [this message]
2001-08-24 16:14 ` Andrew Cagney
2001-08-24 16:45 ` H . J . Lu
2001-08-25 1:55 ` Nick Clifton
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=20010824153533.A11079@lucon.org \
--to=hjl@lucon.org \
--cc=binutils@sourceware.cygnus.com \
/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).