博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
strip, 关于去除目标文件种的不必要信息
阅读量:5925 次
发布时间:2019-06-19

本文共 675 字,大约阅读时间需要 2 分钟。

对于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.

 

转载地址:http://yrxvx.baihongyu.com/

你可能感兴趣的文章
我的友情链接
查看>>
XenServer上虚拟机密码恢复
查看>>
浏览器获取地理方位
查看>>
C语言学习笔记—08-02
查看>>
Linux 信号signal处理机制
查看>>
mybatis-使用set动态拼接sql
查看>>
javascript获取浏览器相关信息
查看>>
配置datanode主机名slaves
查看>>
MySQL5.7 my.cnf常用参数、调优参数及常用语句
查看>>
apache mina 2 Chapter 2 - Basics
查看>>
javascript面向对象编程幻灯片效果
查看>>
JQuery层次选择器
查看>>
数据库密码管理基本常识
查看>>
Android 配置
查看>>
android app的类响应式设计【半月谈投稿】
查看>>
Android 应用的动画实践--View Animation篇
查看>>
Oracle 11g 归档模式基本操作
查看>>
安装APK文件到Android虚拟机
查看>>
【Java例题】5.5 映射类的使用
查看>>
我的友情链接
查看>>