[PATCH] use per function sections + --gc-sections: saves ~5k

Bernhard Fischer rep.nop at aon.at
Fri Mar 3 16:57:25 UTC 2006


On Fri, Mar 03, 2006 at 08:24:59AM +0200, Denis Vlasenko wrote:
>Hi,
>
>This patch passes -ffunction-sections -fdata-sections to gcc
>and --gc-sections to ld. Result:

>diff -urpN busybox.org/Rules.mak busybox.sections/Rules.mak
>--- busybox.org/Rules.mak	Thu Feb  9 11:43:43 2006
>+++ busybox.sections/Rules.mak	Thu Mar  2 21:33:55 2006
>@@ -171,6 +171,7 @@ ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 
> 	OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,)
> endif # gcc-4.1 and beyond
> endif
>+OPTIMIZATION+=$(call check_gcc,-ffunction-sections -fdata-sections,)
> OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)

Does this help all versions of gcc? What are the numbers for 3.3, 3.4,
4.0, 4.1 with and without these two flags for size and on-disk size?
> 
> #

Not sure why this one was needed since it's in the tree already?
>@@ -205,6 +206,7 @@ else
>     LDFLAGS += $(call check_ld,--sort-common,)
>     STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
> endif
>+LDFLAGS += $(call check_ld,--gc-sections,)
> ifeq ($(strip $(CONFIG_STATIC)),y)
>     PROG_CFLAGS += $(call check_gcc,-static,)
> endif

>_______________________________________________
>busybox mailing list
>busybox at busybox.net
>http://busybox.net/cgi-bin/mailman/listinfo/busybox



More information about the busybox mailing list