This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFC] nm -u prints only sym names


Hello!

When nm is invoked with -u it prints only the symbol names. Although this
does not affect the BSD and the POSIX output, it affects the SYSV output,
since information like sym size, type and section is not printed.

filter_symbols does the correct filtering, but there is a check in 
print_symbol which forces nm to print only sym names when -u is used.

This patch removes the check in print_symbol.

Also, there are checks, which I din't remove, in print_symbol_info_bsd and
print_symbol_info_posix which make nm to no print the symbol size when 
-u is used. The size of an ELF's undefined symbol is known and can be printed
(this is already done in print_symbol_info_sysv), but I don't know if 
removing the checks will brake other formats.

Regards,
Elias

-- 
University of Athens			I bet the human brain 
Physics Department				is a kludge --Marvin Minsky 


ChangeLog

2003-02-13  Elias Athanasopoulos  <elathan@phys.uoa.gr>

	* nm.c (print_symbol): Remove check for undefined_only.
	
===================================================================
RCS file: /home/anteater/bucvs/src/binutils/nm.c,v
retrieving revision 1.2
diff -u -r1.2 /home/anteater/bucvs/src/binutils/nm.c
--- /home/anteater/bucvs/src/binutils/nm.c	2003/02/13 12:33:16	1.2
+++ /home/anteater/bucvs/src/binutils/nm.c	2003/02/13 13:17:51
@@ -1214,29 +1214,22 @@
      bfd_vma ssize;
      bfd *archive_bfd;
 {
+  symbol_info syminfo;
+  struct extended_symbol_info info;
+    
   PROGRESS (1);
 
   (*format->print_symbol_filename) (archive_bfd, abfd);
 
-  if (undefined_only)
-    {
-      if (bfd_is_und_section (bfd_get_section (sym)))
-	print_symname ("%s", bfd_asymbol_name (sym), abfd);
-    }
+  bfd_get_symbol_info (abfd, sym, &syminfo);
+  info.sinfo = &syminfo;
+  info.ssize = ssize;
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    info.elfinfo = (elf_symbol_type *) sym;
   else
-    {
-      symbol_info syminfo;
-      struct extended_symbol_info info;
-
-      bfd_get_symbol_info (abfd, sym, &syminfo);
-      info.sinfo = &syminfo;
-      info.ssize = ssize;
-      if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
-	info.elfinfo = (elf_symbol_type *) sym;
-      else
-	info.elfinfo = NULL;
-      (*format->print_symbol_info) (&info, abfd);
-    }
+    info.elfinfo = NULL;
+  
+  (*format->print_symbol_info) (&info, abfd);
 
   if (line_numbers)
     {
	


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]