From 06a30c77e0dd15dc3adf2d261815580ecc534d27 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 17 Mar 2003 10:14:07 +0000 Subject: [PATCH] nm.c (print_symbol_info_bsd): Print the symbol's size instead of the symbol's value when --size-sort is used, unless -S is used. doc/binutils.texi (--size-sort): For non-bsd formats both the value and size of the symbols are displayed. --- binutils/ChangeLog | 7 +++++++ binutils/doc/binutils.texi | 5 ++--- binutils/nm.c | 11 +++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0a7ebbc8c23..fc57abf7cb2 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2003-03-16 Elias Athanasopoulos + + * nm.c (print_symbol_info_bsd): Print the symbol's size instead of + the symbol's value when --size-sort is used, unless -S is used. + doc/binutils.texi (--size-sort): For non-bsd formats both the + value and size of the symbols are displayed. + 2003-03-13 Nick Clifton * po/da.po: Update. diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index fb234395222..5c38b84e73d 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -857,7 +857,7 @@ Equivalent to @samp{-f posix}. @item -S @itemx --print-size -Print size of defined symbols for the @code{bsd} output format. +Print size, not the value, of defined symbols for the @code{bsd} output format. @item -s @itemx --print-armap @@ -874,8 +874,7 @@ last come first. @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 +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. diff --git a/binutils/nm.c b/binutils/nm.c index 4f558c1f26c..8463acb1abd 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -1539,11 +1539,18 @@ print_symbol_info_bsd (info, abfd) } else { - print_value (abfd, SYM_VALUE (info)); + /* 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)) { - printf(" "); + printf (" "); print_value (abfd, SYM_SIZE (info)); } } -- 2.30.2