compilation - 如何从PE中删除Mingw版本信息?

标签 compilation mingw

使用mingw时,编译器会在.rdata段添加很多版本字符串。例如在 Linux 中:

GCC: (Gentoo Hardened 4.8.1-r1 p1.2, pie-0.5.7) 4.8.1
GCC: (Gentoo Hardened 4.8.1-r1 p1.2, pie-0.5.7) 4.8.1
GCC: (Gentoo Hardened 4.8.1-r1 p1.2, pie-0.5.7) 4.8.1
...

或者在 Windows 中:

GCC: (GNU) 4.8.1
GCC: (GNU) 4.8.1
GCC: (GNU) 4.8.1
...

有没有办法删除它们,或者至少将它们放入一个单独的部分(例如 .comment)?

谢谢!

最佳答案

正确的解决方案:在没有 --with-pkgversion 标志的情况下重新编译你的工具链。

hacky 解决方案:在十六进制编辑器中打开g++,找到所述字符串,替换为0x00s

关于compilation - 如何从PE中删除Mingw版本信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20093856/

相关文章:

c - 使用 MinGW 和 CMake 编译 HDF5 时出错

c++ - 生成文件-.o : file not recognized: File truncated?

haskell - 如何更改 GHC 的编译目录?

c - 在 Windows 7 中使用 MinGW-w64 编译 C 代码时出错

c++ - 使用 MinGW 编译时链接 GLEW 库

c++ - 最小网关: "No rule to make target"

.NET const 影响编译的程序集大小

compilation - 找不到 org.apache.hadoop.classification.InterfaceAudience 的 Cloudera Hadoop 类文件

linux - 如何加速 Linux 内核重建

python - pip install 给出 : skipping incompatible python libs and gcc failed with exit status 1