strip, 关于去除目标文件种的不必要信息
2015-10-07 14:51
459 查看
对于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
对于a库,还可以考虑使用这2个strip选项进行瘦身:
-g
-S
-d
--strip-debug
Remove debugging symbols only.
--strip-unneeded
Remove all symbols that are not needed for relocation processing.
对于静态库和目标文件(.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 -O3the 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.
相关文章推荐
- UVA 1152 4 Values whose Sum is 0
- 惠普实训第一阶段学习总结
- Jekyll & Github Pages
- 11.14 MATLAB编译错误中英对照29
- shell文字过滤程序(十):cut命令
- CF 584B Kolya and Tanya
- codeforces 584E Anton and Ira [想法题]
- Servlet基本的传递参数的设置
- Linux GDB 常用命令
- 字符串q次操作将(l,r)内的字符升序或降序排列 计数排序 + 线段树优化 Codeforces div2 558E A Simple Task
- 11.13 matlab编译生成执行文件注意的若干问题
- Android中AsyncTask用法
- 全栈开发教学学习系列1——前言
- 当幸福来敲门
- 信号量线程控制
- (转)史上最全设计模式导学目录(完整版)
- 【ACM从零开始】LeetCode OJ-Add Digits
- live555的有关代码学习笔记整理
- Eclipse创建Maven web项目jsp表头报错
- 强制使用者第一次登录时修改密码