删除命令的构建信息
bash-2.05$ what xxx
ndmpd:
Product: yyy
Release:
Build number: unknown user-2011-87
Build date: Mon Mar 28 20:51:25 2011
Build arch.: solaris
Build info: unknown host:/xx/yyy/zzz/vv/www,DBG=1,OPT=-O
当我在可执行文件 (xxx) 上运行 what
命令时。我们不希望打印以下行。
Build info: unknown host:/export/home/murugs2/SI/dev,DBG=1,OPT=-O
我不知道老程序员是怎么做到这一点的。我想删除这个。怎么做呢? src 文件(c++ 代码)是使用 gcc 编译的。
bash-2.05$ what xxx
ndmpd:
Product: yyy
Release:
Build number: unknown user-2011-87
Build date: Mon Mar 28 20:51:25 2011
Build arch.: solaris
Build info: unknown host:/xx/yyy/zzz/vv/www,DBG=1,OPT=-O
when I run the what
command on our executable (xxx). We don't want the following line to be printed.
Build info: unknown host:/export/home/murugs2/SI/dev,DBG=1,OPT=-O
I dunno how old programmers did this. I want to remove this. How to do it?
The src file(c++ code ) is compiled using gcc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这些字符串对应于目标文件中找到的 SCCS 版本信息模式。
您可以通过修补二进制文件来删除不需要的内容,但最简单的方法是将其从源代码中删除。通过查找“@(#)”标记可以轻松找到它。
例如:
These strings correspond to SCCS version information patterns that are found in the target files.
You can strip off the unwanted one by patching you binaries but the simplest way would be to remove it from the source code. It will be easily locatable by looking for the "@(#)" token.
eg:
这通常存储在 ELF 注释部分,可以查看、删除、添加或替换为
/usr/ccs/bin/mcs
命令。This is usually stored in the ELF comments section, which can be viewed, deleted, added to, or replaced with the various options to the
/usr/ccs/bin/mcs
command.假设编译的二进制文件不使用它,那么您没有理由不能自己编辑该字符串(通过将所有字符更改为
-
或其他字符)。我不知道有什么实用程序可以做到这一点,尽管strip
可能可以帮助您。Assuming the compiled binary doesn't use it, there's no reason you can't edit the string away yourself (by changing all the characters to
-
or something). I don't know of a utility to do it, althoughstrip
might help you.