分析 ELF 部分和符号大小的工具 [英] Tool to analyze size of ELF sections and symbol

查看:30
本文介绍了分析 ELF 部分和符号大小的工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法来分析我的 ARM 的 GCC 编译器的输出文件.我正在为裸机编译,我非常关心大小.我可以使用交叉编译器提供的 arm-none-eabi-objdump 但如果存在用于此任务的工具,解析输出并不是我渴望做的事情.您知道存在这样的工具吗?我的搜索没有结果.

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 provided by the cross-compiler but parsing the output is not something I would be eager to do if there exists a tool for this task. Do you know of such a tool existing? My search turned out no results.

还有一件事,我自己代码中的每个函数都在自己的部分中.

One more thing, every function in my own code is in its own section.

推荐答案

您可以使用 nmsize 来获取函数和 ELF 部分的大小.

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.

要获取部分的大小:

$ size -A -d tst.o

第二列显示部分的十进制大小.

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

这篇关于分析 ELF 部分和符号大小的工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆