gcc编译的二进制文件有不同的大小? [英] gcc compiled binaries w/different sizes?

查看:214
本文介绍了gcc编译的二进制文件有不同的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果相同的代码是在不同的时间w / gcc构建的,生成的二进制将有不同的内容。好吧,我不是那么疯狂,但这是它是什么。

If the same code is built at different times w/gcc, the resulting binary will have different contents. OK, I'm not wild about that, but that's what it is.

但是,我最近遇到了一种情况,相同的代码,版本的gcc,是生成一个二进制的大小不同于以前的版本(大约1900字节)。

However, I've recently run into a situation where the same code, built with the same version of gcc, is generating a binary with a different size than a prior build (by about 1900 bytes).

有没有人知道什么可能导致这些情况?这是一种ELF问题吗?有没有任何工具(除了ldd),可以用于转储二进制文件的内容,看看到底是什么不同?

Does anyone have any idea what may be causing either of these situations? Is this some kind of ELF issue? Are there any tools out there (other than ldd) that can be used to dump contents of binaries to see what exactly is different?

提前感谢。

推荐答案

我已经设法整理了事情,至少我的满意,并希望通过我的发现。

I've managed to sort things out, at least to my satisfaction, and wanted to pass along what I've found.

使用readelf,(readelf -a -W)我创建了一个列出这两个版本的内容的报告并对它们进行比较(使用Beyond Compare)。这表明一些额外的符号被从提升库中提取。

Using readelf, (readelf -a -W ) I created a report listing contents of both builds and compared them (using Beyond Compare). This showed that a couple of extra symbols were getting pulled in from boost libs.

Lo,看着,我们实际上是建立一个不同版本的依赖库和didn实现它。在这种情况下没有伤害,但很高兴知道你的可执行文件是什么。

Lo and behold, we were in fact building against a different version of a dependent library and didn't realize it. No harm done in this case, but it's good to know what's going into your executable.

感谢所有的周到的回复。

Thanks to all for the thoughtful replies.

这篇关于gcc编译的二进制文件有不同的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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