Tool to analyze size of ELF sections and symbol

前端 未结 3 1779
予麋鹿
予麋鹿 2020-12-02 10:26

I need a way to analyze output file of my GCC compiler for ARM. I am compiling for bare metal and I am quite concerned with size. I can use arm-none-eabi-objdump

相关标签:
3条回答
  • 2020-12-02 11:06

    You can use nm and size to get the size of functions and ELF sections.

    To get the size of the functions (and objects with static storage duration):

    $ nm --print-size --size-sort --radix=d tst.o
    

    The second column shows the size in decimal of function and objects.

    To get the size of the sections:

    $ size -A -d tst.o
    

    The second column shows the size in decimal of the sections.

    0 讨论(0)
  • 2020-12-02 11:08

    puncover uses objdump and a few other gcc tools to generate html pages you can easily browse to figure out where your code and data space is going.

    It's a much nicer frontend than the text output of the gcc tools.

    0 讨论(0)
  • 2020-12-02 11:09

    The readelf utility is handy for displaying a variety of section information, including section sizes, e.g.:

    arm-none-eabi-readelf -e foo.o
    

    If you're interested in the run-time memory footprint, you can ignore the sections that do not have the 'A' (allocate) flag set.

    0 讨论(0)
提交回复
热议问题