“gcc -s”与“gcc -s”是什么区别?和“条”命令? [英] What is the difference between "gcc -s" and a "strip" command?

查看:3584
本文介绍了“gcc -s”与“gcc -s”是什么区别?和“条”命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道这两者之间有什么区别:


  • gcc -s :从可执行文件中删除所有符号表和重定位信息。


  • strip :Discard


    它们具有相同的含义吗?



    您使用哪一个:
    $ b

    • 减少可执行文件的大小?

    • 加速运行?
    • code> gcc 是一个编译器/链接器,它的 -s 选项是在编译和链接时完成的 。它也是不可配置的 - 它有一组信息,它被删除,不多不少。

      strip 是可以在已编译的目标文件上运行的东西。它还具有各种命令行选项,您可以使用它们来配置哪些信息将被删除。例如, -g 仅剥离 gcc -g 添加的调试信息。



      请注意, strip 不是bash命令,尽管您可能正在从bash shell运行它。它是一个完全独立于bash的命令,是GNU二进制工具套件的一部分。


      I wonder what is the difference between these two:

      • gcc -s: Remove all symbol table and relocation information from the executable.

      • strip: Discard symbols from object files.

      Do they have the same meaning?

      Which one do you use to:

      • reduce the size of executable?
      • speed up its running?

      解决方案

      gcc being a compiler/linker, its -s option is something done while compiling and linking. It's also not configurable - it has a set of information which it removes, no more no less.

      strip is something which can be run on an object file which is already compiled. It also has a variety of command-line options which you can use to configure which information will be removed. For example, -g strips only the debug information which gcc -g adds.

      Note that strip is not a bash command, though you may be running it from a bash shell. It is a command totally separate from bash, part of the GNU binary utilities suite.

      这篇关于“gcc -s”与“gcc -s”是什么区别?和“条”命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆