在每个构建中更改二进制目标文件 [英] binary object file changing in each build

查看:12
本文介绍了在每个构建中更改二进制目标文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在每次构建时使用 G++ GNU 编译器进行编译时,在不更改源代码的情况下,我会得到一个不同的二进制目标文件.是否有一个编译选项每次都会给我相同的二进制文件.

When compiling using G++ GNU compiler every time I do a build, without changing source code I get a different binary object file. Is there a compile option that will give me the same binary each time.

推荐答案

复制自 GCC 手册页:

Copied from the GCC man-page:

-frandom-seed=字符串
此选项提供 GCC 使用的种子,否则使用随机数.它是用于生成某些必须不同的符号名称在每个编译的文件中.它也用于在覆盖数据文件中放置唯一的标记以及产生的目标文件他们.您可以使用 -frandom-seed 选项生成可重现的相同目标文件.

-frandom-seed=string
This option provides a seed that GCC uses when it would otherwise use random numbers. It is used to generate certain symbol names that have to be different in every compiled file. It is also used to place unique stamps in coverage data files and the object files that produce them. You can use the -frandom-seed option to produce reproducibly identical object files.

您编译的每个文件的字符串应该不同.

The string should be different for every file you compile.

这篇关于在每个构建中更改二进制目标文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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