在每个构建中更改二进制目标文件
在每次构建时使用 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.
相关文章