sczhang_0001 发表于 2010-08-18 16:10

请教一个gcc option选项的问题

为了减小可执行文件的size,我在makefile中加了CFLAGS += -ffunction-sections -fdata-sections。LDFLAG 加了--gc-section。
但是出现了一个小问题:
没有初始化的静态全局变量不再被初始化为0了。

谁能帮我?

谢谢!

prolj 发表于 2010-08-18 16:51

gc-section是GC的选项吧,去查查参数吧。

EricFisher 发表于 2010-08-18 17:56

-ffunction-sections
-fdata-sections

Only use these options when there are significant benefits from doing so. When you specify these options, the assembler and linker will create larger object and executable files and will also be slower.

这些选项能减小可执行文件的size么?

jzhang918 发表于 2010-08-18 19:58

为了减小可执行文件的size,我在makefile中加了CFLAGS += -ffunction-sections -fdata-sections。LDFLAG 加 ...
sczhang_0001 发表于 2010-08-18 16:10 http://linux.chinaunix.net/bbs/images/common/back.gif

给gcc报个bug。

jzhang918 发表于 2010-08-18 19:59

回复 3# EricFisher


    有时候是可以的。
页: [1]
查看完整版本: 请教一个gcc option选项的问题