在二进制文件中查找静态库的大小贡献 - linux [英] Finding the size contribution of a static library in a binary - linux

查看:150
本文介绍了在二进制文件中查找静态库的大小贡献 - linux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个剥离的二进制mytest(大小说23 MB)。它有一个静态链接的另一个库libtest.a



有没有一种可靠的方法我可以从地图文件中找到libtest.a在mystest上的大小贡献?或通过任何其他方式?



我尝试过:



我试图获取链接器映射文件,并且无法弄清楚如何从映射文件中解释库的大小贡献

解决方案

不是我所知道的,因为静态库所归属的大小是在链接时动态确定的(可能是让链接器明确告诉你它所引入的符号但不确定大小会显示的方法)。这是因为链接的库将被搜索到未解析的外部符号,并且这些符号将被拉入,任何未引用的内容都不会被拉入。我相信这是当前的默认行为,您可以禁用它,但这会导致不必要的大二进制文件。

I have a stripped down binary mytest (size say 23 MB). It has a statically linked another library libtest.a

Is there a solid way i can find the size contribution of the libtest.a on mystest from the map file? or by anyother means?

What I have tried:

I have tried to get the linker map file, and unable to figure out how to interpret from the map file the size contribution for the library

解决方案

Not that I know of, because the size attributed by a static library is determined dynamically at link time (possibly a way to have the linker tell you explicitly what symbols it pulled in but not sure the size would be displayed). This is because the linked libraries will be searched for unresolved external symbols and those will be pulled in, anything unreferenced will not be pulled in. I believe this is the default behavior nowadays, you can disable it but that would lead to unnecessarily large binaries.


这篇关于在二进制文件中查找静态库的大小贡献 - linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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