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]

Re: [BUG] nm --size-sort doesn't print the size


Hi Elias, Hi Bradley,

> > The nm manpage says:
> > 
> >   --size-sort
> >       Sort  symbols  by  size.   The  size  is computed as the difference
> >       between the value of the symbol and the value of  the  symbol  with
> >       the  next  higher value.  The size of the symbol is printed, rather
> >       than the value.

I am going to apply Elias's patch with two small additions - a
slightly more wordy comment, and a change to the documenation to
reflect the fact that for non-bsd formats both the size and the value
are printed when --size-sort is used.

Cheers
        Nick

Index: binutils/nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.35
diff -c -3 -p -w -r1.35 nm.c
*** binutils/nm.c	4 Mar 2003 16:23:46 -0000	1.35
--- binutils/nm.c	17 Mar 2003 10:10:05 -0000
*************** print_symbol_info_bsd (info, abfd)
*** 1539,1544 ****
--- 1539,1551 ----
      }
    else
      {
+       /* Normally we print the value of the symbol.  If we are printing the
+ 	 size or sorting by size then we print its size, execpt for the
+ 	 (weird) special case where both flags are defined, in which case we
+ 	 print both values.  This conforms to documented behaviour.  */
+       if (sort_by_size && !print_size)
+ 	print_value (abfd, SYM_SIZE (info));
+       else
  	print_value (abfd, SYM_VALUE (info));
  
        if (print_size && SYM_SIZE (info))

Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.30
diff -c -3 -p -w -r1.30 binutils.texi
*** binutils/doc/binutils.texi	24 Feb 2003 16:20:28 -0000	1.30
--- binutils/doc/binutils.texi	17 Mar 2003 10:10:09 -0000
*************** Equivalent to @samp{-f posix}.
*** 857,863 ****
  
  @item -S
  @itemx --print-size
! Print size of defined symbols for the @code{bsd} output format.
  
  @item -s
  @itemx --print-armap
--- 857,863 ----
  
  @item -S
  @itemx --print-size
! Print size, not the value, of defined symbols for the @code{bsd} output format.
  
  @item -s
  @itemx --print-armap
*************** last come first.
*** 874,881 ****
  @item --size-sort
  Sort symbols by size.  The size is computed as the difference between
  the value of the symbol and the value of the symbol with the next higher
! value.  The size of the symbol is printed, rather than the value.
! structure.  If the @code{bsd} output format is used the size of the symbol 
  is printed, rather than the value, and @samp{-S} must be used in order 
  both size and value to be printed.
  
--- 874,880 ----
  @item --size-sort
  Sort symbols by size.  The size is computed as the difference between
  the value of the symbol and the value of the symbol with the next higher
! value.  If the @code{bsd} output format is used the size of the symbol 
  is printed, rather than the value, and @samp{-S} must be used in order 
  both size and value to be printed.
  


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