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.

  • 相关阅读:
    调整数组顺序使奇数位于偶数前面
    数值的整数次方
    矩形覆盖
    变态跳台阶
    跳台阶
    ubuntu图形界面切换文字界面(文字界面切换图形界面)
    Django环境安装、虚拟机端口映射、pycharm远程配置
    sql注入(一)-----数字型
    mysql基本语法
    渗透测试之------信息收集
  • 原文地址:https://www.cnblogs.com/welhzh/p/4858695.html
Copyright © 2011-2022 走看看