LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1345|回复: 9

有人用CC='gcc -s'编译系统的吗?

[复制链接]
发表于 2006-11-12 15:25:23 | 显示全部楼层 |阅读模式
听说strip会破坏库文件。CFLAGS加“-s”后,系统还能正常工作吗?现在有人有这个参数吗?
在我所保存的以前用gentoo时的make.conf里是有export CC='gcc -s'的,不过时间久了,记不清当初是否使用了。所以来找别人确认一下
man strip
       -s
       --strip-all
           Remove all symbols.
       -g
       -S
       -d
       --strip-debug
           Remove debugging symbols only.
       --strip-unneeded
           Remove all symbols that are not needed for relocation processing.

man ld
       -s
       --strip-all
           Omit all symbol information from the output file.
       -S
       --strip-debug
           Omit debugger symbol information (but not  all  symbols)  from  the
           output file.

http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
-s
Remove all symbol table and relocation information from the executable.


gcc -s是否相当于strip --strip-all了?或者是ld --strip-all?
gcc -s、strip --strip-all、ld --strip-all之间有何区别阿?
如果要移除符号的话,是设置CFLAGS好呢还是LDFLAGS好呢?
发表于 2006-11-12 16:08:37 | 显示全部楼层
不用操心
除非你的FEATURES里加了nostrip,否则肯定会strip的
回复 支持 反对

使用道具 举报

发表于 2006-11-12 18:38:35 | 显示全部楼层
-s会对系统性能和稳定性有什么影响?
回复 支持 反对

使用道具 举报

发表于 2006-11-12 19:04:28 | 显示全部楼层
none
forget it
回复 支持 反对

使用道具 举报

发表于 2006-11-12 19:31:21 | 显示全部楼层
并且有好处,你的二进制库和执行文件都会变小的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-12 21:13:47 | 显示全部楼层
Post by zhllg
不用操心
除非你的FEATURES里加了nostrip,否则肯定会strip的

不好意思阿,其实我要做的与gentoo无关,只是因为也需要编译,所以才来借鉴一下经验。
主要是想知道这几个问题:
gcc -s是否相当于strip --strip-all了?或者是ld --strip-all?
gcc -s、strip --strip-all、ld --strip-all之间有何区别阿?
如果要移除符号的话,是设置CFLAGS好呢还是LDFLAGS好呢?
回复 支持 反对

使用道具 举报

发表于 2006-11-12 22:38:18 | 显示全部楼层
Read the fine source code
回复 支持 反对

使用道具 举报

发表于 2006-11-13 19:07:31 | 显示全部楼层
Post by cnhnln
不好意思阿,其实我要做的与gentoo无关,只是因为也需要编译,所以才来借鉴一下经验。
主要是想知道这几个问题:
gcc -s是否相当于strip --strip-all了?或者是ld --strip-all?
gcc -s、strip --strip-all、ld --strip-all之间有何区别阿?
如果要移除符号的话,是设置CFLAGS好呢还是LDFLAGS好呢?

最佳答案是阅读Makefile,然后看看CC 和 LDFLAGS 和 CFLAGS 在其中究竟是如何使用的,或许某些诡异的Makefile并非遵循通行的标准
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-14 21:51:47 | 显示全部楼层
读不懂。楼上两位能读懂得老大来解释下
回复 支持 反对

使用道具 举报

发表于 2006-11-15 15:52:41 | 显示全部楼层
strip作用在可执行文件上是没事的,但是一些目标文件strip了可能出现问题。
不信可以去试试,*.o文件strip了可能就不能和其他文件连接了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表