summaryrefslogtreecommitdiffstats
path: root/contrib/binutils
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-01-27 12:09:38 +0000
committerobrien <obrien@FreeBSD.org>2002-01-27 12:09:38 +0000
commit7ddb3a2a40da4ca9fd46c185d0998bc73033ced5 (patch)
tree4347ebef3726230356537fc9f1cc43fb6efdb40f /contrib/binutils
parent146ad69232ad550fb28dc1a5078771d85e762731 (diff)
downloadFreeBSD-src-7ddb3a2a40da4ca9fd46c185d0998bc73033ced5.zip
FreeBSD-src-7ddb3a2a40da4ca9fd46c185d0998bc73033ced5.tar.gz
Use the vendor's 2.12.0_snap version of this file as in rev 1.4.
Diffstat (limited to 'contrib/binutils')
-rw-r--r--contrib/binutils/binutils/nm.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/contrib/binutils/binutils/nm.c b/contrib/binutils/binutils/nm.c
index 984733d..11ace29 100644
--- a/contrib/binutils/binutils/nm.c
+++ b/contrib/binutils/binutils/nm.c
@@ -154,7 +154,7 @@ print_symbol_filename_posix PARAMS ((bfd * archive_bfd, bfd * abfd));
static void
-print_value PARAMS ((bfd_vma));
+print_value PARAMS ((bfd *, bfd_vma));
static void
print_symbol_info_bsd PARAMS ((symbol_info * info, bfd * abfd));
@@ -247,6 +247,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";
@@ -294,9 +299,9 @@ usage (stream, status)
FILE *stream;
int status;
{
- fprintf (stream, _("Usage: %s [OPTION]... [FILE]...\n"), program_name);
- fprintf (stream, _("List symbols from FILEs (a.out by default).\n"));
- fprintf (stream, _("\n\
+ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
+ fprintf (stream, _(" List symbols in [file(s)] (a.out by default).\n"));
+ fprintf (stream, _(" The options are:\n\
-a, --debug-syms Display debugger-only symbols\n\
-A, --print-file-name Print name of the input file before every symbol\n\
-B Same as --format=bsd\n\
@@ -310,7 +315,6 @@ usage (stream, status)
-f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n\
`sysv' or `posix'. The default is `bsd'\n\
-g, --extern-only Display only external symbols\n\
- -h, --help Display this information\n\
-l, --line-numbers Use debugging information to find a filename and\n\
line number for each symbol\n\
-n, --numeric-sort Sort symbols numerically by address\n\
@@ -323,8 +327,9 @@ usage (stream, status)
-t, --radix=RADIX Use RADIX for printing symbol values\n\
--target=BFDNAME Specify the target object format as BFDNAME\n\
-u, --undefined-only Display only undefined symbols\n\
- -V, --version Display this program's version number\n\
-X 32_64 (ignored)\n\
+ -h, --help Display this information\n\
+ -V, --version Display this program's version number\n\
\n"));
list_supported_targets (program_name, stream);
if (status == 0)
@@ -391,6 +396,8 @@ set_output_format (f)
format = &formats[i];
}
+int main PARAMS ((int, char **));
+
int
main (argc, argv)
int argc;
@@ -402,6 +409,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -413,7 +423,7 @@ main (argc, argv)
bfd_init ();
set_default_bfd_target ();
- while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvVX:",
+ while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrst:uvVvX:",
long_options, (int *) 0)) != EOF)
{
switch (c)
@@ -454,6 +464,7 @@ main (argc, argv)
case 'g':
external_only = 1;
break;
+ case 'H':
case 'h':
usage (stdout, 0);
case 'l':
@@ -941,6 +952,7 @@ display_rel_file (abfd, archive_bfd)
PTR minisyms;
unsigned int size;
struct size_sym *symsizes;
+ char buf[30];
if (! dynamic)
{
@@ -961,6 +973,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). */
@@ -1439,7 +1454,8 @@ print_symbol_filename_posix (archive_bfd, abfd)
/* Print a symbol value. */
static void
-print_value (val)
+print_value (abfd, val)
+ bfd *abfd;
bfd_vma val;
{
#if ! defined (BFD64) || BFD_HOST_64BIT_LONG
@@ -1447,7 +1463,7 @@ print_value (val)
#else
/* We have a 64 bit value to print, but the host is only 32 bit. */
if (print_radix == 16)
- fprintf_vma (stdout, val);
+ bfd_fprintf_vma (abfd, stdout, val);
else
{
char buf[30];
@@ -1476,13 +1492,12 @@ print_symbol_info_bsd (info, abfd)
{
if (bfd_is_undefined_symclass (info->type))
{
-#ifdef BFD64
- printf (" ");
-#endif
+ if (print_width == 16)
+ printf (" ");
printf (" ");
}
else
- print_value (info->value);
+ print_value (abfd, info->value);
printf (" %c", info->type);
if (info->type == '-')
{
@@ -1505,7 +1520,7 @@ print_symbol_info_sysv (info, abfd)
if (bfd_is_undefined_symclass (info->type))
printf (" "); /* Value */
else
- print_value (info->value);
+ print_value (abfd, info->value);
printf ("| %c |", info->type); /* Class */
if (info->type == '-')
{
@@ -1528,7 +1543,7 @@ print_symbol_info_posix (info, abfd)
if (bfd_is_undefined_symclass (info->type))
printf (" ");
else
- print_value (info->value);
+ print_value (abfd, info->value);
/* POSIX.2 wants the symbol size printed here, when applicable;
BFD currently doesn't provide it, so we take the easy way out by
considering it to never be applicable. */
OpenPOWER on IntegriCloud