[Buildroot] Question about Compilation Flags

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri Nov 11 14:03:43 UTC 2016


Hello,

On Fri, 11 Nov 2016 14:49:42 +0530, Anand Sivaram wrote:

> File: package/Makefile.in
> TARGET_CFLAGS += -ffunction-sections -fdata-sections
> TARGET_LDFLAGS += -Wl,--gc-sections

You can also pass these through "menuconfig", using
BR2_TARGET_OPTIMIZATION and BR2_TARGET_LDFLAGS.

> Everything went fine, I saved around 1MB.  But lighttpd with mod-fcgi
> enabled got SIGSEGV with the above change.
> 
> I have a question?  Could I disable these flags *only* for lighttpd, that
> means using the above flags in all packages except lighttpd.

Yes, you can adapt lighttpd.mk for that. You need to do something like
this:

LIGHTTPD_CONF_ENV = \
	CFLAGS=$(filter-out -ffunction-sections -fdata-section,$(TARGET_CFLAGS)) \
	LDFLAGS=$(filter-out -Wl,--gc-sections,$(TARGET_LDFLAGS))

BTW, how much space did you save by using those options? What was the
filesystem size before adding those options and after?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the buildroot mailing list