"size" of relocatable objects
Nick Clifton
nickc@redhat.com
Tue May 22 09:31:00 GMT 2007
Hi Alan,
> Someone at IBM noticed that "size" ignores common variables in
> relocatable object files, and wondered whether we could enhance "size"
> to show them. Well, of course we can, but should we? Opinions?
Hmmm, the size of common variables in an object file is not actually
fixed, right ? (Well, when compared to size of the same variable in a
fully linked executable). So including their size is a little bit
disingenuous. But on the other hand, they do contribute to the overall
size of the data in the resulting executable, so omitting them is just
as bad. Hmmm.
> I'm inclined to say "just use awk".
>
> objdump -t some_file.o | grep '\*COM\*' | \
> awk '{ com += strtonum ("0x" $1) } END { print com; }'
But then you need an enhanced script to combine this with the output of
size so that you can get a size-that-includes-COM-variables.
I think that adding a new switch would be reasonable.
Cheers
Nick
More information about the Binutils
mailing list