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]

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


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.

This last sentence appears to not be true, with |GNU nm 2.13.90.0.16
20021126| (redhat binutils-2.13.90.0.16-5 from rawhide) or |GNU nm
2.13.90.0.18 20030121 Debian GNU/Linux| (2.13.90.0.18-1.1 from debian
unstable).

test.c:

void test() {
  int hello_world=1;
}

~$ gcc -c -o test.o test.c

~$ nm test.o
00000000 T test
~$ nm -S test.o
00000000 0000000f T test

So the size is 0xf, at location 0x0

~$ nm --size-sort test.o
00000000 T test

which isn't the size.

On GNU nm 2.11.90.0.8 (redhat 7.2 binutils-2.11.90.0.8-12):

~$ nm --size-sort test.o
00000010 T test

(Its a different machine/compiler, which explains the different size)

mozilla uses this as part of some tools to determine the size of various
subroutines. -S doesn't work in 2.11.90, so we can't use that - is there
an alternative workarround for this bug? Alternativly, is there a way to
use -S (in 2.13.90) to only print the size, without printing the address?

Looking at cvs logs, this appears to have been done in:

http://sources.redhat.com/ml/binutils/2002-06/msg00495.html

and reverting that patch fixes this problem. Was this change in behaviour
done on purpose?

Thanks,

Bradley


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