[ELDK] Get big fat busybox when taking eldk 5.0-beta
Wolfgang Denk
wd at denx.de
Sun May 1 11:17:46 CEST 2011
Dear "Gao Ya'nan",
In message <BANLkTi=Us30_BQjKE8GmCGcY3VHapHCCzA at mail.gmail.com> you wrote:
> First, set environment variables:
>
> export PATH=/opt/eldk-5.0/powerpc/sysroots/i686-pokysdk-linux/usr/bin/powerpc-linux:$PATH
> export ARCH=powerpc
> export CROSS_COMPILE=powerpc-linux-
Heh. It really needs no announcements for people to discover new stuff
:-)
> compile busbox, And then I got a 1.5MB big fat dynamic-linking binary.
With "defconfig" I even see 1.8 MiB for busybox_unstripped.
This is the result from GCC compiling the code without optimization,
which in turn results from "-Os" not working.
Please try and apply this patch to the busybox sources:
diff --git a/Makefile.flags b/Makefile.flags
index 363300b..462d5b0 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,-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,-O2,)
endif
endif
You will then probably notice, that the size differences between the
images compiled with ELDK 4.2 and ELDK 5.0 (both now compiling with
-O2) practically disappears.
Yes, with -Os you can save some 10...15% of the image size compared
to building with -O2. Unfortunately we cannot use this (yet) in ELDK
5.0 - see below.
> I compared the compiling process with ELDK-42, and found "-Os" options
> was missing in Makefile.flags adding "-Os" flags
Yes, that's intentionally.
> [xxx at S2 powerpc]$ powerpc-linux-gcc -Os -S -o /dev/null -xc /dev/null
> cc1: error: Do not use -Os option if --enable-target-optspace is not set.
>
> I think --enable-target-optspace is missing when building the
> crosstool. Is there anyone who meet and solve this problem?
Met yes. Solved no.
This is due to a compiler bug in all recent versions of GCC; 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
General information about known (to us) GCC issues that impact ELDK,
U-Boot and Linux can be found here:
http://www.denx.de/wiki/U-Boot/GccBugsAndIssues
We have to wait here until somebody fixes this compiler bug (or pays
us to invest efforts into such a fix).
Thanks for the feedback!!
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: wd at denx.de
Any sufficiently advanced technology is indistinguishable from a
rigged demo. - Andy Finkel, computer guy
More information about the eldk
mailing list