Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measure size of libraries in Linux

I'm developing S/W for some device which uses Linux O.S. So, the size of libraries (RAM/ROM) which I use is very important.

How can I easily calculate RAM / ROM required by my software? (including libraries I used). I think it's too easy question for experienced Linux developer.

like image 861
Wonil Avatar asked Oct 24 '11 09:10

Wonil


1 Answers

Run

size <object>

or

size <archive>

or

size <shared-object>

. (or "target-"size in case you're cross-compiling: arm-size if you're using arm-gcc)

It will give you a

text    data     bss     dec     hex filename

table where text is program-size, bss the initialized globals and data the read-only data.

While this answers your question, you probably will want to use a specific LdScript (when using ld as linker) where you will place the sections into the available memories manually when doing the final link.

like image 62
Patrick B. Avatar answered Oct 23 '22 04:10

Patrick B.