Browse Source

* nm.c: HOST_64_BIT was renamed to BFD_HOST_64_BIT.

gdb-4_18-branch
Ian Lance Taylor 33 years ago
parent
commit
8291be48a9
  1. 2
      binutils/ChangeLog
  2. 56
      binutils/nm.c

2
binutils/ChangeLog

@ -1,5 +1,7 @@
Fri Jun 10 15:41:25 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) Fri Jun 10 15:41:25 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* nm.c: HOST_64_BIT was renamed to BFD_HOST_64_BIT.
* objcopy.c (copy_archive): Make the temporary directory in the * objcopy.c (copy_archive): Make the temporary directory in the
same directory as the output BFD, since we may not have write same directory as the output BFD, since we may not have write
permission on the current directory. Set the permissions of the permission on the current directory. Set the permissions of the

56
binutils/nm.c

@ -152,6 +152,7 @@ static int print_armap = 0; /* describe __.SYMDEF data in archive files. */
static int reverse_sort = 0; /* sort in downward(alpha or numeric) order */ static int reverse_sort = 0; /* sort in downward(alpha or numeric) order */
static int sort_numerically = 0; /* sort in numeric rather than alpha order */ static int sort_numerically = 0; /* sort in numeric rather than alpha order */
static int undefined_only = 0; /* print undefined symbols only */ static int undefined_only = 0; /* print undefined symbols only */
static int dynamic = 0; /* print dynamic symbols. */
static int show_version = 0; /* show the version number */ static int show_version = 0; /* show the version number */
/* When to print the names of files. Not mutually exclusive in SYSV format. */ /* When to print the names of files. Not mutually exclusive in SYSV format. */
@ -159,7 +160,7 @@ static int filename_per_file = 0; /* Once per file, on its own line. */
static int filename_per_symbol = 0; /* Once per symbol, at start of line. */ static int filename_per_symbol = 0; /* Once per symbol, at start of line. */
/* Print formats for printing a symbol value. */ /* Print formats for printing a symbol value. */
#ifdef HOST_64_BIT #ifdef BFD_HOST_64_BIT
static char value_format[] = "%08x%08x"; static char value_format[] = "%08x%08x";
#else #else
static char value_format[] = "%08lx"; static char value_format[] = "%08lx";
@ -178,6 +179,7 @@ static struct option long_options[] =
{ {
{"debug-syms", no_argument, &print_debug_syms, 1}, {"debug-syms", no_argument, &print_debug_syms, 1},
{"demangle", no_argument, &do_demangle, 1}, {"demangle", no_argument, &do_demangle, 1},
{"dynamic", no_argument, &dynamic, 1},
{"extern-only", no_argument, &external_only, 1}, {"extern-only", no_argument, &external_only, 1},
{"format", required_argument, 0, 'f'}, {"format", required_argument, 0, 'f'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
@ -202,11 +204,11 @@ usage (stream, status)
int status; int status;
{ {
fprintf (stream, "\ fprintf (stream, "\
Usage: %s [-aABCgnopPrsuvV] [-t radix] [--radix=radix] [--target=bfdname]\n\ Usage: %s [-aABCDgnopPrsuvV] [-t radix] [--radix=radix] [--target=bfdname]\n\
[--debug-syms] [--extern-only] [--print-armap] [--print-file-name]\n\ [--debug-syms] [--extern-only] [--print-armap] [--print-file-name]\n\
[--numeric-sort] [--no-sort] [--reverse-sort] [--undefined-only]\n\ [--numeric-sort] [--no-sort] [--reverse-sort] [--undefined-only]\n\
[--portability] [-f {bsd,sysv,posix}] [--format={bsd,sysv,posix}]\n\ [--portability] [-f {bsd,sysv,posix}] [--format={bsd,sysv,posix}]\n\
[--demangle] [--version] [--help] [file...]\n", [--demangle] [--dynamic] [--version] [--help] [file...]\n",
program_name); program_name);
exit (status); exit (status);
} }
@ -222,7 +224,7 @@ set_print_radix (radix)
case 'd': case 'd':
case 'o': case 'o':
case 'x': case 'x':
#ifdef HOST_64_BIT #ifdef BFD_HOST_64_BIT
value_format[3] = value_format[7] = *radix; value_format[3] = value_format[7] = *radix;
#else #else
value_format[4] = *radix; value_format[4] = *radix;
@ -275,7 +277,7 @@ main (argc, argv)
bfd_init (); bfd_init ();
while ((c = getopt_long (argc, argv, "aABCf:gnopPrst:uvV", long_options, (int *) 0)) != EOF) while ((c = getopt_long (argc, argv, "aABCDf:gnopPrst:uvV", long_options, (int *) 0)) != EOF)
{ {
switch (c) switch (c)
{ {
@ -292,6 +294,9 @@ main (argc, argv)
case 'C': case 'C':
do_demangle = 1; do_demangle = 1;
break; break;
case 'D':
dynamic = 1;
break;
case 'f': case 'f':
set_output_format (optarg); set_output_format (optarg);
break; break;
@ -509,26 +514,47 @@ display_rel_file (abfd, archive_bfd)
asymbol **syms; asymbol **syms;
long symcount = 0; long symcount = 0;
if (!(bfd_get_file_flags (abfd) & HAS_SYMS)) if (dynamic)
{ {
printf ("No symbols in \"%s\".\n", bfd_get_filename (abfd)); if (!(bfd_get_file_flags (abfd) & DYNAMIC))
return; {
printf ("\"%s\" is not a dynamic object.\n",
bfd_get_filename (abfd));
return;
}
}
else
{
if (!(bfd_get_file_flags (abfd) & HAS_SYMS))
{
printf ("No symbols in \"%s\".\n", bfd_get_filename (abfd));
return;
}
} }
storage = bfd_get_symtab_upper_bound (abfd); if (dynamic)
storage = bfd_get_dynamic_symtab_upper_bound (abfd);
else
storage = bfd_get_symtab_upper_bound (abfd);
if (storage < 0) if (storage < 0)
bfd_fatal (bfd_get_filename (abfd)); bfd_fatal (bfd_get_filename (abfd));
if (storage == 0) if (storage == 0)
{ {
nosymz: nosymz:
fprintf (stderr, "%s: Symflags set but there are none?\n", if (dynamic)
bfd_get_filename (abfd)); fprintf (stderr, "%s: no symbols\n", bfd_get_filename (abfd));
else
fprintf (stderr, "%s: Symflags set but there are none?\n",
bfd_get_filename (abfd));
return; return;
} }
syms = (asymbol **) xmalloc (storage); syms = (asymbol **) xmalloc (storage);
symcount = bfd_canonicalize_symtab (abfd, syms); if (dynamic)
symcount = bfd_canonicalize_dynamic_symtab (abfd, syms);
else
symcount = bfd_canonicalize_symtab (abfd, syms);
if (symcount < 0) if (symcount < 0)
bfd_fatal (bfd_get_filename (abfd)); bfd_fatal (bfd_get_filename (abfd));
if (symcount == 0) if (symcount == 0)
@ -800,7 +826,7 @@ print_symbol_info_bsd (info, abfd)
printf (" "); printf (" ");
else else
{ {
#ifdef HOST_64_BIT #ifdef BFD_HOST_64_BIT
printf (value_format, uint64_typeHIGH (info->value), printf (value_format, uint64_typeHIGH (info->value),
uint64_typeLOW (info->value)); uint64_typeLOW (info->value));
#else #else
@ -830,7 +856,7 @@ print_symbol_info_sysv (info, abfd)
printf (" "); /* Value */ printf (" "); /* Value */
else else
{ {
#ifdef HOST_64_BIT #ifdef BFD_HOST_64_BIT
printf (value_format, uint64_typeHIGH (info->value), printf (value_format, uint64_typeHIGH (info->value),
uint64_typeLOW (info->value)); uint64_typeLOW (info->value));
#else #else
@ -860,7 +886,7 @@ print_symbol_info_posix (info, abfd)
printf (" "); printf (" ");
else else
{ {
#ifdef HOST_64_BIT #ifdef BFD_HOST_64_BIT
printf (value_format, uint64_typeHIGH (info->value), printf (value_format, uint64_typeHIGH (info->value),
uint64_typeLOW (info->value)); uint64_typeLOW (info->value));
#else #else

Loading…
Cancel
Save