zoukankan      html  css  js  c++  java
  • strip, 关于去除目标文件种的不必要信息

    对于so动态库及可执行文件,可以直接调用不带参数的strip (-s, 即--strip-all)去除大多数不必要的信息。因为so库非常标准,所以strip之后仍然可以进行完美的动态连接;而可执行文件已经进行了链接,所以也可以用strip进行完美的strip。

    对于静态库和目标文件(.o文件),不能直接调用不带参数的strip,因为o文件大多数是relocate文件,如果去除的参数不恰当,在编译成so或可执行文件时就无法找到对应的符号。

    对于a库,可以先采用编译优化 -O3,将某些不必要的信息进行掩盖或去除:

    Use of the GCC optimization flags will help make the code look much less readable to a human. When you compile with the highest level of optimization gcc -O3 the compiler will move things around such that the "flow" might not be at all what you expect.

    对于a库,还可以考虑使用这2个strip选项进行瘦身:

           -g
           -S
           -d
           --strip-debug
               Remove debugging symbols only.

           --strip-unneeded
               Remove all symbols that are not needed for relocation processing.

  • 相关阅读:
    sphinx安装
    如何获取原生数据
    DOM详解
    JavaScript简单入门(补充篇)
    JavaScript的简单入门
    Java正则表达式练习
    Java反射机制(Reflect)解析
    21070118记
    CSS3设置Table奇数行和偶数行样式
    获取当前地址
  • 原文地址:https://www.cnblogs.com/welhzh/p/4858695.html
Copyright © 2011-2022 走看看