Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22122

How to calculate text& rodata& data& bss size of one module in C?

$
0
0

Dears,

In my project, first compile aa_1.c, aa_2.c .. in folder A, compile bb_1.c bb_2.c .. from folder B. Then use gcc-ar achieves to libapps.a. At last, link with other static libraries.

Now I want to calculate text, rodata, data, bss section of folder A.

My method is gcc-nm -S --size-sort folder/*.o, and accumulate text, rodata, data, bss section. But some function may be optimized away because no one call it.

So how call i calculate text, data, rodata, bss size?

I also have another question, use gcc-nm -S --size-sort a.o there is no 'b' type. But use gcc-size a.o show bss section is 8 bytes. So which is right?

Can you kindly give me some advice.

Best Regards, Qiao


Viewing all articles
Browse latest Browse all 22122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>