Dear "Gao Ya'nan", In message <[email protected]> you wrote: > > compile busbox, And then I got a 1.5MB big fat dynamic-linking binary.
I think this should be fixed in BusyBox - when _os is not available, they should use -O2 or similar instead. I just posted the following patch on the BB mailing list: >From 4f96a2cd4113998d0321787659d32faab15c79a4 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk <[email protected]> Date: Sun, 1 May 2011 13:48:49 +0200 Subject: [PATCH] Compile options: default to -O2 when -Os is not available Recent versions of GCC for PowerPC systems suffer from some compiler bugs which prevent the use of "--enable-target-optspace" in their configuration, which makes the compiler option "-Os" unavailable; for reference see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48278 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45053 In the result, BusyBox will be compiled without any optimization options, which causes a huge binary (1.8 MiB for default configuration on PPC, built with gcc 54.51 from the Yocto / Poky / OpenEmbedded tool chains). This commit changes behaviour so "-O2" gets used as fallback when "-Os" is not available. This reduces the image size in above test to 1.3 MiB. This is still 10...15% more then what we get with "-Os", but much better than using no optimization at all. Signed-off-by: Wolfgang Denk <[email protected]> --- Makefile.flags | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.flags b/Makefile.flags index 363300b..b3e1371 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -58,14 +58,14 @@ CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 #CFLAGS += $(call cc-option,-Wconversion,) ifneq ($(CONFIG_DEBUG),y) -CFLAGS += $(call cc-option,-Os,) +CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,)) else CFLAGS += $(call cc-option,-g,) #CFLAGS += "-D_FORTIFY_SOURCE=2" ifeq ($(CONFIG_DEBUG_PESSIMIZE),y) CFLAGS += $(call cc-option,-O0,) else -CFLAGS += $(call cc-option,-Os,) +CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,)) endif endif -- 1.7.4.4 Hope this helps. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] I am a computer. I am dumber than any human and smarter than any ad- ministrator. _______________________________________________ eldk mailing list [email protected] http://lists.denx.de/mailman/listinfo/eldk
