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 undefined_only = 0; /* print undefined symbols only */
+static int dynamic = 0; /* print dynamic symbols. */
static int show_version = 0; /* show the version number */
/* When to print the names of files. Not mutually exclusive in SYSV format. */
static int filename_per_symbol = 0; /* Once per symbol, at start of line. */
/* Print formats for printing a symbol value. */
-#ifdef HOST_64_BIT
+#ifdef BFD_HOST_64_BIT
static char value_format[] = "%08x%08x";
#else
static char value_format[] = "%08lx";
{
{"debug-syms", no_argument, &print_debug_syms, 1},
{"demangle", no_argument, &do_demangle, 1},
+ {"dynamic", no_argument, &dynamic, 1},
{"extern-only", no_argument, &external_only, 1},
{"format", required_argument, 0, 'f'},
{"help", no_argument, 0, 'h'},
int status;
{
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\
[--numeric-sort] [--no-sort] [--reverse-sort] [--undefined-only]\n\
[--portability] [-f {bsd,sysv,posix}] [--format={bsd,sysv,posix}]\n\
- [--demangle] [--version] [--help] [file...]\n",
+ [--demangle] [--dynamic] [--version] [--help] [file...]\n",
program_name);
exit (status);
}
case 'd':
case 'o':
case 'x':
-#ifdef HOST_64_BIT
+#ifdef BFD_HOST_64_BIT
value_format[3] = value_format[7] = *radix;
#else
value_format[4] = *radix;
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)
{
case 'C':
do_demangle = 1;
break;
+ case 'D':
+ dynamic = 1;
+ break;
case 'f':
set_output_format (optarg);
break;
asymbol **syms;
long symcount = 0;
- if (!(bfd_get_file_flags (abfd) & HAS_SYMS))
+ if (dynamic)
{
- printf ("No symbols in \"%s\".\n", bfd_get_filename (abfd));
- return;
+ if (!(bfd_get_file_flags (abfd) & DYNAMIC))
+ {
+ 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)
bfd_fatal (bfd_get_filename (abfd));
if (storage == 0)
{
nosymz:
- fprintf (stderr, "%s: Symflags set but there are none?\n",
- bfd_get_filename (abfd));
+ if (dynamic)
+ 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;
}
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)
bfd_fatal (bfd_get_filename (abfd));
if (symcount == 0)
printf (" ");
else
{
-#ifdef HOST_64_BIT
+#ifdef BFD_HOST_64_BIT
printf (value_format, uint64_typeHIGH (info->value),
uint64_typeLOW (info->value));
#else
printf (" "); /* Value */
else
{
-#ifdef HOST_64_BIT
+#ifdef BFD_HOST_64_BIT
printf (value_format, uint64_typeHIGH (info->value),
uint64_typeLOW (info->value));
#else
printf (" ");
else
{
-#ifdef HOST_64_BIT
+#ifdef BFD_HOST_64_BIT
printf (value_format, uint64_typeHIGH (info->value),
uint64_typeLOW (info->value));
#else