extracting size of a symbol

Alan Modra amodra@bigpond.net.au
Tue Aug 24 06:05:00 GMT 2004


On Mon, Aug 23, 2004 at 10:51:50PM -0700, diz rael wrote:
> I was wondering if someone knows how to do this, or if
> there is a more appropriate mailing list for this kind
> of question.

Have you looked at nm source?  That will give you the general way to
find symbol sizes.  Simpler methods might be available on certain
targets, but you didn't say which target.

> --- diz rael <dizraelus@yahoo.com> wrote:
> 
> > What is the easiest way of extracting the size of a
> > symbol (eg. global variable/function)?
> > 
> > bfd_print_symbol produces this info. but I want to
> > extract just the size, and not print it to a stream.
> > 
> > Currently, I'm just sorting symbols within their
> > sections and subtracting addresses of consecutive
> > entries to calculate their sizes.
> > 
> > I'm sure there is a better way to do this, so any
> > suggestions would be appreciated.
> > 
> > Thanks!

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list