C++ “条”(GCC 应用程序)用于什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1413171/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is "strip" (GCC application) used for?
提问by Carlos Aguilera
what is this little application for?
这个小应用有什么用?
When using it without any options reduces the size of the executables, but how/what it does?
在没有任何选项的情况下使用它会减少可执行文件的大小,但它是如何/做什么的?
回答by dmckee --- ex-moderator kitten
From the (Mac OS X, but others are similar) man page:
从(Mac OS X,但其他类似)手册页:
strip removes or modifies the symbol table attached to the output of the assembler and link editor. This is useful to save space after a program has been debugged and to limit dynamically bound symbols.
strip 删除或修改附加到汇编器和链接编辑器输出的符号表。这对于在调试程序后节省空间和限制动态绑定符号很有用。
Note the bit about "after a program has been debugged" because debugging a stripped executable is veryhard, indeed. The "limit dynamically bound symbols" is a rarer use: it lets you make some of the functions in an external library inaccessible by taking away the index entries that tell where the actual code is located. This is also explained in the man page.
请注意有关“调试程序之后”的部分,因为调试剥离的可执行文件确实非常困难。“限制动态绑定符号”很少使用:它允许您通过删除指示实际代码所在位置的索引条目来使外部库中的某些函数无法访问。这也在手册页中进行了解释。
As cheap and plentiful as disk is in most situation you simply wouldn't bother with this anymore. But you might want it for space constrained situation like embeded devices, rescue disks, etc.
在大多数情况下,磁盘既便宜又丰富,您根本就不会再为此烦恼了。但是您可能希望它用于空间受限的情况,例如嵌入式设备、救援磁盘等。
回答by Mehrdad Afshari
It strips symbol information from the binary. The binary contains some information that maps symbols (e.g. function names) to particular locations. strip
removes those.
它从二进制中剥离符号信息。二进制文件包含一些将符号(例如函数名称)映射到特定位置的信息。strip
删除那些。