How can I exclude source file metadata from output when compiling?

拜拜、爱过 提交于 2019-12-24 12:26:05

问题


For example:

$ gcc -O3 foobar.c -o foobar
$ grep 'foobar\.c' foobar
Binary file foobar matches

How can I exclude such unnecessary and revealing metadata from the output of gcc and other compilers? It appears regardless of whether the output is an assembly file, object file, or executable.


回答1:


man strip(1)

> strip -s a.out


来源:https://stackoverflow.com/questions/28377292/how-can-i-exclude-source-file-metadata-from-output-when-compiling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!