This is the mail archive of the binutils@sourceware.org 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: "size" of relocatable objects


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


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