PR gdb/1914
[deliverable/binutils-gdb.git] / binutils / nm.c
index c35f7c881552ea98493633017b55de39e92fd211..c1fb4d803e845e1f3de510f813dd99b393d31130 100644 (file)
@@ -1,6 +1,6 @@
 /* nm.c -- Describe symbol table of a rel file.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004
+   2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -17,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 #include "bfd.h"
 #include "progress.h"
@@ -248,12 +248,13 @@ usage (FILE *stream, int status)
   -S, --print-size       Print size of defined symbols\n\
   -s, --print-armap      Include index for symbols from archive members\n\
       --size-sort        Sort symbols by size\n\
-      --skip-special     Ignore special symbols\n\
+      --special-syms     Include special symbols in the output\n\
       --synthetic        Display synthetic symbols as well\n\
   -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\
   -X 32_64               (ignored)\n\
+  @FILE                  Read options from FILE\n\
   -h, --help             Display this information\n\
   -V, --version          Display this program's version number\n\
 \n"));
@@ -905,9 +906,10 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd)
        }
       else if (bfd_get_section (sym)->owner == abfd)
        {
-         if (bfd_find_nearest_line (abfd, bfd_get_section (sym), syms,
-                                    sym->value, &filename, &functionname,
-                                    &lineno)
+         if ((bfd_find_line (abfd, syms, sym, &filename, &lineno)
+              || bfd_find_nearest_line (abfd, bfd_get_section (sym),
+                                        syms, sym->value, &filename,
+                                        &functionname, &lineno))
              && filename != NULL
              && lineno != 0)
            printf ("\t%s:%u", filename, lineno);
@@ -1026,8 +1028,18 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
        }
       else
        {
+         long storage = bfd_get_dynamic_symtab_upper_bound (abfd);
+
          static_count = symcount;
          static_syms = minisyms;
+
+         if (storage > 0)
+           {
+             dyn_syms = xmalloc (storage);
+             dyn_count = bfd_canonicalize_dynamic_symtab (abfd, dyn_syms);
+             if (dyn_count < 0)
+               bfd_fatal (bfd_get_filename (abfd));
+           }
        }
       synth_count = bfd_get_synthetic_symtab (abfd, static_count, static_syms,
                                              dyn_count, dyn_syms, &synthsyms);
@@ -1480,6 +1492,8 @@ main (int argc, char **argv)
 
   START_PROGRESS (program_name, 0);
 
+  expandargv (&argc, &argv);
+
   bfd_init ();
   set_default_bfd_target ();
 
This page took 0.024915 seconds and 4 git commands to generate.