This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
figuring out the size of things
- From: David Byron <dbyron at coactive dot com>
- To: "'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- Date: Thu, 31 Jan 2002 09:22:47 -0800
- Subject: figuring out the size of things
I'm running linux on an embedded system that can only run statically linked executables. Memory is of course tight, so it's important for me to know where all the bytes in an executable are coming from. The size command helps, but I want a little more detail. (I think) what I want is how much space each library (or object file) is responsible for. I could run the size command on each library, but doesn't that ignore the symbols that the linker discards?
I've come to the conclusion that the only way to get this information is by parsing the output of the linker map file. Do people agree that's what's required here? Is there a better way to do this? This seems like information other folks must have wanted before. It's not so tough a script, but something that would be very nice for the linker to just tell me.
What I'd like is a table where down each row would be each library, as well as the objects that don't come from libraries. Each column would be a section, or maybe just text/data/bss since in the end I really need to figure out flash and ram size. The intersection would be the number of bytes that each library/object puts into the section. A totals row and column and I think I would have everything.
Thoughts? I'm not familiar with how the linker is written, so a script is definitely going to be way faster for me than diving into the source. If someone can point me in the right direction, I might give it a shot though.
Thanks much.
-DB
---
David Byron dbyron@coactive.com
Coactive Networks, Inc. http://www.coactive.com
28 Liberty Ship Way voice:(415)289-7800
Sausalito, CA 94965 fax:(415)289-1320