Created attachment 78 [details] Use machine config I'm rying to build "poky-image-sdk" for a PPC 6xx target, using top of tree of master, with just the attached machine config added. The build runs a pretty long time, but ultimately fails because gcc cannot find it's register save and restore functions (_savegpr_??_x, _restgpr_??_x, _savefpr_??_x, _restfpr_??_x), see attached log (full log available on request). I see the same problem (but when linking other files) when trying to build for a PPC 405 target. This problem happens on build hosts running Fedora 14 / i686, Fedora 14 / x86_64, and Ubuntu 10.04 / x86_64.
Created attachment 79 [details] BB log file
Wolfgang, Looking at the qemuppc machine config in the poky tree. I see this line which is missing in your machine config: PACKAGE_EXTRA_ARCHS = "ppc603e" Can you try adding that line to your machine.config and see if it helps?
Another question, does the qemuppc machine working for you?
I might have made a mistake in the bug report. Unfortunately I cannot check because I lost that build tree by accident. But it's pretty likely that my statement "using top of tree of master" might have been incorrect - probably I had this change included: diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc index 4393777..6292551 100644 --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc @@ -32,6 +32,7 @@ EXTRA_OECONF = "${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d, --enable-shared \ --enable-languages=${LANGUAGES} \ --enable-threads=posix \ + --enable-target-optspace \ ${GCCMULTILIB} \ --enable-c99 \ --enable-long-long \ I need to be able to use "-Os" for some packages where it's mandatory (like U-Boot) and for some where it helps to improve performance (like on PPC8xx and PPC4xx systems with tiny caches). With this patch included, I get the same problem even when building for qemuppc in laverne-4.0 (for pango_1.28.0.bb). It seems recent GCC (4.4+) performs out-of-line epilogues in some cases, when optimizing for size. This causes a link error for _restgpr_XX_x (and similar) if libgcc.a is not linked. What I don't understand is why only libgcc.a has these routines - the linker command uses libgcc_s.so where trhese functions are NOT included.
It seems this is a problem in other environments as well - see GCC Bug 43810 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810 Unfortunately this doesn't seem to provide a solution (if I understand correctly, they recommend to uodate to gcc 4.5.1 or 4.5.2 ?)
Retired the same with current top of tree, which is based on gcc 4.5.1. The same problem, so simply updating to GCC 4.5.1 does not help.
Retried again (building meta-toolchain-sdk for qemuppc), with current top of tree plus the posted patches for GCC 4.5.2. The problem is still present. What I don't really understand is - why pango-view (as part of pango_1.28.3.bb) fails to build; what is so special about pango - tons of other packages were built successfully before. - why does pango get built at all for meta-toolchain-sdk; I would expect that such a target package is not needed for the cross tool chain.
gcc 4.5.x has optspace (-Os) issue for powerpc, and is disabled in the recipe. These are the lines in gcc-configure-common.inc. SPECIAL_ARCH_LIST = "powerpc" OPTSPACE = ${@base_contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)}
bwaiting for fixing of this bug for upstream gcc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810
Wolfgang, Is this issue still present in the current gcc 4.6.1 ? If not, then we can close this bug. Thanks, Nitin
I tried building core-image-sato-sdk for qemuppc machine, and I did not see any failure. If no response to this bug, then we can close the bug as not-a-bug.
closing this bug, as it is not a issue anymore. if still have any issue please open a new bug.
reopening this older bug as a new is opened for this.
*** Bug 1470 has been marked as a duplicate of this bug. ***
Wolfgang, this is a known issue of ppc gcc. It's optspace optimization is broken. Hence it is disabled in the recipe. Until upstream gcc has fix for this we can not enable it. So waiting for upstream to fix this issue.
(In reply to comment #15) > Wolfgang, this is a known issue of ppc gcc. It's optspace optimization is > broken. Hence it is disabled in the recipe. Until upstream gcc has fix for this > we can not enable it. So waiting for upstream to fix this issue. Well, at least CodeSourcery appears to have fixed this problem: gcc version 4.5.1 (Sourcery G++ Lite 2010.09-55) accepts "-Os" just fine...
Good to know, There is newer version of CodeSourcery CodeBench Lite 2011.03-93 https://sourcery.mentor.com/sgpp/lite/mips/portal/release1872 You can check the version of the newer g++, and see if that fixes the issue too, Also they have posted sources also there.
khem, do you have any solution for -Os issue of mips gcc ?
(In reply to comment #17) > Good to know, There is newer version of CodeSourcery CodeBench Lite 2011.03-93 > > https://sourcery.mentor.com/sgpp/lite/mips/portal/release1872 Please note that this bug is about problems with the PowerPC compilers. The latest Sourcery CodeBench Lite Edition I can find for PPC is of Fall 2010 > You can check the version of the newer g++, and see if that fixes the issue > too, Also they have posted sources also there. The source tarball for 2010.09-55 contains a 25 MiB diff containing >2600 individual modifications. Sorry, I am not a GCC expert, and completely overstrained by this.
(In reply to comment #18) > khem, do you have any solution for -Os issue of mips gcc ? Its ppc problem. Wolfgang, Are you seeing this issue with gcc 4.6.x as well ? If yes then give me steps to reproduce it -Khem
Created attachment 258 [details] Build log for core-image-sato-dev image / qemuppc machine
(In reply to comment #20) > > Are you seeing this issue with gcc 4.6.x as well ? Yes. > If yes then give me steps to reproduce it Please see the bug description to # Bug 1470 My test was using 1.1_M3.final, which is using gcc 4.6 My test case is to enable --enable-target-optspace like this: diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc index 869d1b6..e61536b 100644 --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc @@ -17,7 +17,7 @@ LANGUAGES ?= "c,c++${FORTRAN}${JAVA}" # hidden symbols in libgcc.a which linker complains # when linking shared libraries further in the build like (gnutls) -SPECIAL_ARCH_LIST = "powerpc" +SPECIAL_ARCH_LIST = "" OPTSPACE = ${@base_contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)} EXTRA_OECONF_BASE ?= "" and then run a build of core-image-sato-dev for the qemuppc machine. Please see attached the complete build log for this test.
(In reply to comment #22) > (In reply to comment #20) > > > > Are you seeing this issue with gcc 4.6.x as well ? > > Yes. > > > If yes then give me steps to reproduce it > > Please see the bug description to # Bug 1470 > > My test was using 1.1_M3.final, which is using gcc 4.6 > > My test case is to enable --enable-target-optspace like this: > > diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc > b/meta/recipes-devtools/gcc/gcc-configure-common.inc > index 869d1b6..e61536b 100644 > --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc > +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc > @@ -17,7 +17,7 @@ LANGUAGES ?= "c,c++${FORTRAN}${JAVA}" > # hidden symbols in libgcc.a which linker complains > # when linking shared libraries further in the build like (gnutls) > > -SPECIAL_ARCH_LIST = "powerpc" > +SPECIAL_ARCH_LIST = "" > OPTSPACE = ${@base_contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", > "--enable-target-optspace",d)} > > EXTRA_OECONF_BASE ?= "" > > > and then run a build of core-image-sato-dev for the qemuppc machine. > > Please see attached the complete build log for this test. OK. Problem is that the functionality required by gcc for Os is put into libgcc but when we use Os to compile libgcc then gcc meets with this catch-22 situation thats what I remember was one case. Another case is where libgcc.so was not a linker script scrub but a symlink to libgcc.so.1 Can you make sure that libgcc.so in <sysroot>/usr/lib is a linker stub ?
looking at the testcase its the crtend.o object that has reference to this symbol and is specified last on the linker commandline. so if linker did not read in object from libgcc.a before then it wont reopen them again since thats the last object. I will try to reproduce it and see what can be done. btw enable-optspace only makes the runtime libraries like libgcc libstdc++ to be compiled with -Os it does not imply that gcc will by default optimize for size. While there is size reduction due to compiling the runtime with Os it diminishes in grand scheme of things so much unless you compile the complete root file system with -Os. Secondly just letting the runtime compile with default opts which is O2 and rest of root file system use -Os is best fit in given scenario IMO. is that you specifically want gcc rumtime objects and libraries to be optimized for size ? If yes how much difference in size do u see.
(In reply to comment #24) > looking at the testcase its the crtend.o object that has reference to this > symbol > and is specified last on the linker commandline. so if linker did not read in > object from libgcc.a before then it wont reopen them again since thats the last > object. I will try to reproduce it and see what can be done. Thanks. > btw enable-optspace only makes the runtime libraries like libgcc libstdc++ to > be compiled with -Os it does not imply that gcc will by default optimize for > size. Please keep in mind that GCC is not only used to compile user space stuff like tools and libraries, but also bare metal code like the Linux kernel or the U-Boot boot loader. For these, being able to use "-Os" is very important - no matter how user space has been built. > While there is size reduction due to compiling the runtime with Os it > diminishes in grand scheme of things so much unless you compile the complete > root file system > with -Os. Agreed, when we are talking about user space code. > Secondly just letting the runtime compile with default opts which is O2 and > rest of root file system use -Os is best fit in given scenario IMO. > > is that you specifically want gcc rumtime objects and libraries to be optimized > for size ? If yes how much difference in size do u see. We see 5...10% smaller code with -Os compared to -O2. What is sometimes even more important is that we also see 5...10% faster execution, especially on low-end systems (where any boost of performance is twice welcome). [It may be a surprise that smaller code runs faster that code that has been optimized for speed, but many low-end systems have just tiny caches, and performance becomes frequently limited by the bus bandwidth - and the smaller the code, the better the chances it fits into the cache, and the less code has to be shuffled over the bus.] And for things like a boot loader the question is often simply like "does the image fit in the allocated number of blocks in flash"?
(In reply to comment #23) > > OK. Problem is that the functionality required by gcc for Os is put into > libgcc but when we use Os to compile libgcc then gcc meets with this catch-22 > situation thats what I remember was one case. > > Another case is where libgcc.so was not a linker script scrub but a symlink > to libgcc.so.1 > > Can you make sure that libgcc.so in <sysroot>/usr/lib is a linker stub ? At the point where the build fails there is no libgcc.so anywhere in the build tree. I see the following files and links: -rw-r--r-- 1 wd wd 135 Sep 10 14:28 tmp/sysroots/generic-powerpc-tcbootstrap/lib/libgcc_s.so lrwxrwxrwx 1 wd wd 13 Sep 10 14:28 tmp/sysroots/i686-nativesdk-eldk-linux-tcbootstrap/opt/eldk-5.1/powerpc/sysroots/i686-eldk-linux/lib/libgcc_s.so -> libgcc_s.so.1 -rw-r--r-- 1 wd wd 4786842 Sep 10 14:28 tmp/sysroots/x86_64-linux/usr/lib/i686-eldk-linux.gcc-crosssdk-intermediate/gcc/i686-eldk-linux/4.6.1/libgcc.a -rw-r--r-- 1 wd wd 125210 Sep 10 14:28 tmp/sysroots/x86_64-linux/usr/lib/i686-eldk-linux.gcc-crosssdk-intermediate/gcc/i686-eldk-linux/4.6.1/libgcc_eh.a -rw-r--r-- 1 wd wd 1971178 Sep 10 14:28 tmp/sysroots/x86_64-linux/usr/lib/powerpc-linux.gcc-cross-intermediate/gcc/powerpc-linux/4.6.1/libgcc.a -rw-r--r-- 1 wd wd 213104 Sep 10 14:28 tmp/sysroots/x86_64-linux/usr/lib/powerpc-linux.gcc-cross-intermediate/gcc/powerpc-linux/4.6.1/libgcc_eh.a -rw-r--r-- 1 wd wd 581070 Sep 10 14:22 tmp/work/i686-eldk-linux/gcc-crosssdk-initial-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/gcc/libgcc.a -rw-rw-r-- 1 wd wd 581070 Sep 10 14:22 tmp/work/i686-eldk-linux/gcc-crosssdk-initial-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/i686-eldk-linux/libgcc/libgcc.a -rw-r--r-- 1 wd wd 4786842 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/gcc/libgcc.a -rw-r--r-- 1 wd wd 125210 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/gcc/libgcc_eh.a lrwxrwxrwx 1 wd wd 13 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/gcc/libgcc_s.so -> libgcc_s.so.1 -rw-rw-r-- 1 wd wd 4786842 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/i686-eldk-linux/libgcc/libgcc.a -rw-rw-r-- 1 wd wd 125210 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/i686-eldk-linux/libgcc/libgcc_eh.a lrwxrwxrwx 1 wd wd 13 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.i686-eldk-linux/i686-eldk-linux/libgcc/libgcc_s.so -> libgcc_s.so.1 lrwxrwxrwx 1 wd wd 13 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/image/opt/eldk-5.1/powerpc/sysroots/i686-eldk-linux/lib/libgcc_s.so -> libgcc_s.so.1 -rw-r--r-- 1 wd wd 4786842 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/image/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/i686-eldk-linux.gcc-crosssdk-intermediate/gcc/i686-eldk-linux/4.6.1/libgcc.a -rw-r--r-- 1 wd wd 125210 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/image/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/i686-eldk-linux.gcc-crosssdk-intermediate/gcc/i686-eldk-linux/4.6.1/libgcc_eh.a lrwxrwxrwx 1 wd wd 13 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/sysroot-destdir/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/i686-nativesdk-eldk-linux/opt/eldk-5.1/powerpc/sysroots/i686-eldk-linux/lib/libgcc_s.so -> libgcc_s.so.1 -rw-r--r-- 1 wd wd 4786842 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/sysroot-destdir/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/i686-eldk-linux.gcc-crosssdk-intermediate/gcc/i686-eldk-linux/4.6.1/libgcc.a -rw-r--r-- 1 wd wd 125210 Sep 10 14:28 tmp/work/i686-eldk-linux/gcc-crosssdk-intermediate-4.6.1+svnr175454-r3/sysroot-destdir/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/i686-eldk-linux.gcc-crosssdk-intermediate/gcc/i686-eldk-linux/4.6.1/libgcc_eh.a -rw-r--r-- 1 wd wd 762464 Sep 10 14:22 tmp/work/powerpc-linux/gcc-cross-initial-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/gcc/libgcc.a -rw-rw-r-- 1 wd wd 762464 Sep 10 14:22 tmp/work/powerpc-linux/gcc-cross-initial-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/powerpc-linux/libgcc/libgcc.a -rw-r--r-- 1 wd wd 1971178 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/gcc/libgcc.a -rw-r--r-- 1 wd wd 213104 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/gcc/libgcc_eh.a -rw-r--r-- 1 wd wd 135 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/gcc/libgcc_s.so -rw-rw-r-- 1 wd wd 1971178 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/powerpc-linux/libgcc/libgcc.a -rw-rw-r-- 1 wd wd 213104 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/powerpc-linux/libgcc/libgcc_eh.a -rw-rw-r-- 1 wd wd 135 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/gcc-4_6-branch/build.x86_64-linux.powerpc-linux/powerpc-linux/libgcc/libgcc_s.so -rw-r--r-- 1 wd wd 135 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/image/lib/libgcc_s.so -rw-r--r-- 1 wd wd 1971178 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/image/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/powerpc-linux.gcc-cross-intermediate/gcc/powerpc-linux/4.6.1/libgcc.a -rw-r--r-- 1 wd wd 213104 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/image/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/powerpc-linux.gcc-cross-intermediate/gcc/powerpc-linux/4.6.1/libgcc_eh.a -rw-r--r-- 1 wd wd 135 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/sysroot-destdir/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/generic-powerpc/lib/libgcc_s.so -rw-r--r-- 1 wd wd 1971178 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/sysroot-destdir/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/powerpc-linux.gcc-cross-intermediate/gcc/powerpc-linux/4.6.1/libgcc.a -rw-r--r-- 1 wd wd 213104 Sep 10 14:28 tmp/work/powerpc-linux/gcc-cross-intermediate-4.6.1+svnr175454-r3/sysroot-destdir/opt/poky/build/eldk-5.1_M3-ppc-Os-test/tmp/sysroots/x86_64-linux/usr/lib/powerpc-linux.gcc-cross-intermediate/gcc/powerpc-linux/4.6.1/libgcc_eh.a
(In reply to comment #25) > (In reply to comment #24) > > looking at the testcase its the crtend.o object that has reference to this > > symbol > > and is specified last on the linker commandline. so if linker did not read in > > object from libgcc.a before then it wont reopen them again since thats the last > > object. I will try to reproduce it and see what can be done. > > Thanks. > > > btw enable-optspace only makes the runtime libraries like libgcc libstdc++ to > > be compiled with -Os it does not imply that gcc will by default optimize for > > size. > > Please keep in mind that GCC is not only used to compile user space > stuff like tools and libraries, but also bare metal code like the > Linux kernel or the U-Boot boot loader. For these, being able to use > "-Os" is very important - no matter how user space has been built. > > > While there is size reduction due to compiling the runtime with Os it > > diminishes in grand scheme of things so much unless you compile the complete > > root file system > > with -Os. > > Agreed, when we are talking about user space code. > > > Secondly just letting the runtime compile with default opts which is O2 and > > rest of root file system use -Os is best fit in given scenario IMO. > > > > is that you specifically want gcc rumtime objects and libraries to be optimized > > for size ? If yes how much difference in size do u see. > > We see 5...10% smaller code with -Os compared to -O2. Since I guess uboot only uses libgcc from gcc runtime is this shrinkage just because you used libgcc compiled with Os ? or is it complete size reduction when you use Os to compile complete u-boot I would be interested to know the size difference in these combinations libgcc/Os + uboot/Os libcc/O2 + uboot/Os What is > sometimes even more important is that we also see 5...10% faster > execution, especially on low-end systems (where any boost of > performance is twice welcome). > > [It may be a surprise that smaller code runs faster that code that has > been optimized for speed, but many low-end systems have just tiny > caches, and performance becomes frequently limited by the bus > bandwidth - and the smaller the code, the better the chances it fits > into the cache, and the less code has to be shuffled over the bus.] > Yes I understand that very well. > And for things like a boot loader the question is often simply like > "does the image fit in the allocated number of blocks in flash"?
(In reply to comment #26) > (In reply to comment #23) > > > > OK. Problem is that the functionality required by gcc for Os is put into > > libgcc but when we use Os to compile libgcc then gcc meets with this catch-22 > > situation thats what I remember was one case. > > > > Another case is where libgcc.so was not a linker script scrub but a symlink > > to libgcc.so.1 > > > > Can you make sure that libgcc.so in <sysroot>/usr/lib is a linker stub ? > > At the point where the build fails there is no libgcc.so anywhere in > the build tree. > ah I see. I have fixed similar thing in classic OE.dev in past but may be that fix is needed in oe-core too in some form. We use gcc-cross-intermediate to compile eglibc and problem lies in packaging/installing that.
(In reply to comment #27) > > > We see 5...10% smaller code with -Os compared to -O2. > > Since I guess uboot only uses libgcc from gcc runtime > is this shrinkage just because you used libgcc compiled with Os ? No. This is with the same version of GCC and libgcc, both built with standard options (-O2). The difference is only when compiling the U-Boot code itself with either "-Os" or "-O2", i. e. libgcc/O2 + uboot/Os vs. libgcc/O2 + uboot/O2 > I would be interested to know the size difference in these combinations > > libgcc/Os + uboot/Os > libcc/O2 + uboot/Os Sorry, I cannot provide this, as I don't have any libgcc/Os anywhere around.
(In reply to comment #29) > (In reply to comment #27) > > > > > We see 5...10% smaller code with -Os compared to -O2. > > > > Since I guess uboot only uses libgcc from gcc runtime > > is this shrinkage just because you used libgcc compiled with Os ? > > No. This is with the same version of GCC and libgcc, both built with > standard options (-O2). The difference is only when compiling the > U-Boot code itself with either "-Os" or "-O2", i. e. > > libgcc/O2 + uboot/Os > vs. > libgcc/O2 + uboot/O2 OK thats what I thought too. So using -Os to compile uboot is not tied to enable-target-optspace that option needs to go through CFLAGS > > > I would be interested to know the size difference in these combinations > > > > libgcc/Os + uboot/Os > > libcc/O2 + uboot/Os > > Sorry, I cannot provide this, as I don't have any libgcc/Os anywhere > around. You could use the compiler from failed build that you have and use that to compile uboot with -Os and check the size my intention was to convey that compiling libgcc itself with -Os may not save so much of space since its really small part of the application that said we still have a bug that we should fix in gcc install
> that said we still have a bug that we should fix in gcc install I looked into this a bit today and we are doing everything ok the libraries are installed and linked in too but the real problem is that their is this limitation which is explained very well here http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01103.html i dont see a cheap solution to it
(In reply to comment #31) > > that said we still have a bug that we should fix in gcc install > > I looked into this a bit today and we are doing everything ok > the libraries are installed and linked in too but the real problem > is that their is this limitation which is explained very well here > > http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01103.html > > i dont see a cheap solution to it Maybe we can find out how CodeSourcery solved this problems? Their recent PPC tool chains have working support for "-Os". I tried looking there myself, but I'm no gcc expert and I quickly got lost in their 25 MB patch which includes >2600 changes...
(In reply to comment #32) > (In reply to comment #31) > > > that said we still have a bug that we should fix in gcc install > > > > I looked into this a bit today and we are doing everything ok > > the libraries are installed and linked in too but the real problem > > is that their is this limitation which is explained very well here > > > > http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01103.html > > > > i dont see a cheap solution to it > > Maybe we can find out how CodeSourcery solved this problems? Their recent PPC > tool chains have working support for "-Os". I tried looking there myself, but > I'm no gcc expert and I quickly got lost in their 25 MB patch which includes > >2600 changes... Do you mean to say that codesourcery runtime ( i.e. libgcc and libstdc++ and friends) are compiled with Os and then you use that to compile eglibc with Os ? For OE toolchain the problem is surfaced because we try to optimize the runtime for size. If you dont do that then compiling eglibc with Os or any other software works
(In reply to comment #33) ... > > Maybe we can find out how CodeSourcery solved this problems? Their recent PPC > > tool chains have working support for "-Os". I tried looking there myself, but > > I'm no gcc expert and I quickly got lost in their 25 MB patch which includes > > >2600 changes... > > Do you mean to say that codesourcery runtime ( i.e. libgcc and libstdc++ and > friends) are compiled with Os and then you use that to compile eglibc with Os ? I don't think that they are. And actually I don't really care if they are. This may be a problem when building the tool chain, but I'm seeing myself more as an end user here, and for mne the only important thing is that the resulting tool chain supports optimization for space. My primary targets for this are when building u-Boot and the Linux kernel. If I can additionally build the user space code with -Os as well that's an added benefit. If the gcc runtime libs are not built with -Os then this may be not perfect, but I'd rather have a non-perfect, working solution instead of a version of GCC that does not support -Os at all, which is what we have now. > For OE toolchain the problem is surfaced because we try to optimize the runtime > for size. If you dont do that then compiling eglibc with Os or any other > software works So what has to be done to build everything except the GCC runtime libraries with -Os ? 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@denx.de "The trouble with doing something right the first time is that nobody appreciates how difficult it was." - Walt West
(In reply to comment #34) > (In reply to comment #33) > ... > > > Maybe we can find out how CodeSourcery solved this problems? Their recent PPC > > > tool chains have working support for "-Os". I tried looking there myself, but > > > I'm no gcc expert and I quickly got lost in their 25 MB patch which includes > > > >2600 changes... > > > > Do you mean to say that codesourcery runtime ( i.e. libgcc and libstdc++ and > > friends) are compiled with Os and then you use that to compile eglibc with Os ? > > I don't think that they are. And actually I don't really care if they > are. correct thats what it is. This may be a problem when building the tool chain, but I'm > seeing myself more as an end user here, and for mne the only important > thing is that the resulting tool chain supports optimization for > space. My primary targets for this are when building u-Boot and the > Linux kernel. should work just fine with current OE-core toolchains. If I can additionally build the user space code with > -Os as well that's an added benefit. it will work too. We have set the global optimizations to be -O2 but you can easily change that to be Os just change the SELECTED_OPTIMIZATION flag in your local.conf If the gcc runtime libs are not > built with -Os then this may be not perfect, but I'd rather have a > non-perfect, working solution instead of a version of GCC that does > not support -Os at all, which is what we have now. > who said -Os is not supported ? 4.5 had a related bug which was fixed with pr44618.patch and gcc 4.6 already has that patch in sources. So it should all be hunky dory > > For OE toolchain the problem is surfaced because we try to optimize the runtime > > for size. If you dont do that then compiling eglibc with Os or any other > > software works > > So what has to be done to build everything except the GCC runtime > libraries with -Os ? Change the O2 -> Os in FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" in bitbake.conf or override it in local.conf but I would not want to make it default. Hope that 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: wd@denx.de > "The trouble with doing something right the first time is that nobody > appreciates how difficult it was." - Walt West
(In reply to comment #35) > > > If the gcc runtime libs are not > > built with -Os then this may be not perfect, but I'd rather have a > > non-perfect, working solution instead of a version of GCC that does > > not support -Os at all, which is what we have now. > > > > who said -Os is not supported ? 4.5 had a related bug which was fixed with > pr44618.patch and gcc 4.6 already has that patch in sources. So it should > all be hunky dory Well, it does not work for me. A build of the 1.1_M3.final version for the quemuppc machine gives this: $ powerpc-linux-gcc -Os -c foo.c cc1: error: Do not use -Os option if --enable-target-optspace is not set. So I cannot use the "-Os" option for any compilations with this tool chain. And yes, this is gcc version 4.6.0 that comes with 1.1_M3.final > > So what has to be done to build everything except the GCC runtime > > libraries with -Os ? > > Change the O2 -> Os in FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" > in bitbake.conf or override it in local.conf > > but I would not want to make it default. I will try that. Thanks. 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@denx.de I know engineers. They love to change things. - Dr. McCoy
(In reply to comment #35) > > This may be a problem when building the tool chain, but I'm > > seeing myself more as an end user here, and for mne the only important > > thing is that the resulting tool chain supports optimization for > > space. My primary targets for this are when building u-Boot and the > > Linux kernel. > > should work just fine with current OE-core toolchains. No, it does not, because these disable "-Os" for Power Architecture systems. For some boards this is mandatory in U-Boot (for example due to flash size restrictions). > If I can additionally build the user space code with > > -Os as well that's an added benefit. > > it will work too. We have set the global optimizations to be -O2 > but you can easily change that to be Os just change the SELECTED_OPTIMIZATION > flag in your local.conf This does not work either because "--enable-target-optspace" is disabled for Power Architecture systems. And when I try to enable it, the builds will fail with the aforementioned errors. > who said -Os is not supported ? 4.5 had a related bug which was fixed with > pr44618.patch and gcc 4.6 already has that patch in sources. So it should > all be hunky dory Fact is that it does not work. > > > For OE toolchain the problem is surfaced because we try to optimize the runtime > > > for size. If you dont do that then compiling eglibc with Os or any other > > > software works > > > > So what has to be done to build everything except the GCC runtime > > libraries with -Os ? > > Change the O2 -> Os in FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" > in bitbake.conf or override it in local.conf I tried that, too. Building of core-image-sato-dev fails with "undefined reference to `_savegpr_31'" in package eglibc-2.13-r15+svnr14157. Same when trying to build meta-toolchain-sdk. I think I must have misunderstood you. What exactly is your proposal that allows to enable "--enable-target-optspace" and then build core-image-sato-dev or meta-toolchain-sdk? Thanks in advance. 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@denx.de Give a man a fish, and you feed him for a day. Teach a man to fish, and he'll invite himself over for dinner. - Calvin Keegan
(In reply to comment #37) > (In reply to comment #35) > > > > This may be a problem when building the tool chain, but I'm > > > seeing myself more as an end user here, and for mne the only important > > > thing is that the resulting tool chain supports optimization for > > > space. My primary targets for this are when building u-Boot and the > > > Linux kernel. > > > > should work just fine with current OE-core toolchains. > > No, it does not, because these disable "-Os" for Power Architecture > systems. For some boards this is mandatory in U-Boot (for example due > to flash size restrictions). > > > If I can additionally build the user space code with > > > -Os as well that's an added benefit. > > > > it will work too. We have set the global optimizations to be -O2 > > but you can easily change that to be Os just change the SELECTED_OPTIMIZATION > > flag in your local.conf > > This does not work either because "--enable-target-optspace" is > disabled for Power Architecture systems. > > And when I try to enable it, the builds will fail with the > aforementioned errors. > > > who said -Os is not supported ? 4.5 had a related bug which was fixed with > > pr44618.patch and gcc 4.6 already has that patch in sources. So it should > > all be hunky dory > > Fact is that it does not work. locally here I am able to build hello world compiled with -Os using the ppc sysroot and toolchain but I am using latest oe-core/master > > > > > For OE toolchain the problem is surfaced because we try to optimize the runtime > > > > for size. If you dont do that then compiling eglibc with Os or any other > > > > software works > > > > > > So what has to be done to build everything except the GCC runtime > > > libraries with -Os ? > > > > Change the O2 -> Os in FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" > > in bitbake.conf or override it in local.conf > > I tried that, too. Building of core-image-sato-dev fails with > "undefined reference to `_savegpr_31'" in package > eglibc-2.13-r15+svnr14157. Same when trying to build > meta-toolchain-sdk. > > > I think I must have misunderstood you. yes you have. What exactly is your proposal > that allows to enable "--enable-target-optspace" and then build > core-image-sato-dev or meta-toolchain-sdk? leave it as it is. Just change O2 -> Os in FULL_OPTIMIZATION this will build gcc-runtime with O2 and everything else will use Os.
(In reply to comment #38) > > leave it as it is. Just change O2 -> Os in FULL_OPTIMIZATION > this will build gcc-runtime with O2 and everything else will use > Os. Unfortunately with this modification the code does not build. This is what I get: ERROR: Function 'do_configure' failed (see /opt/poky/build/eldk-5.1_M3-Os/tmp/work/powerpc-linux/eglibc-2.13-r10+svnr14157/temp/log.do_configure.5430 for further information) configure.in:301: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2585: _AC_COMPILE_IFELSE is expanded from... ../../lib/autoconf/general.m4:2601: AC_COMPILE_IFELSE is expanded from... configure.in:301: the top level NOTE: Running /opt/poky/build/eldk-5.1_M3-Os/tmp/work/powerpc-linux/eglibc-2.13-r10+svnr14157/eglibc-2_13/libc/configure --build=x86_64-linux --host=powerpc-linux --target=powerpc-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --with-libtool-sysroot=/opt/poky/build/eldk-5.1_M3-Os/tmp/sysroots/generic-powerpc --enable-kernel=2.6.16 --without-cvs --disable-profile --disable-debug --without-gd --enable-clocale=gnu --enable-add-ons=ports,nptl,libidn,ports --with-headers=/opt/poky/build/eldk-5.1_M3-Os/tmp/sysroots/generic-powerpc/usr/include --without-selinux ... checking build system type... x86_64-pc-linux-gnu checking host system type... powerpc-unknown-linux-gnu checking for powerpc-linux-gcc... ccache powerpc-linux-gcc -m32 -mhard-float --sysroot=/opt/poky/build/eldk-5.1_M3-Os/tmp/sysroots/generic-powerpc-tcbootstrap checking for suffix of object files... configure: error: in `/opt/poky/build/eldk-5.1_M3-Os/tmp/work/powerpc-linux/eglibc-2.13-r10+svnr14157/build-powerpc-linux': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. ERROR: oe_runconf failed I get the same error both for the meta-toolchain-sdk and core-image-sato-dev images. 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@denx.de The years of peak mental activity are undoubtedly between the ages of four and eighteen. At four we know all the questions, at eighteen all the answers.
I talked to various people about this. I believe the --enable-target-optspace option is not used on the CSL compilers (can be confirmed with powerpc-linux-gnu-gcc -v) hence the reason they don't see the issue. You don't have to enable that option to use the -Os option when compiling applications, it just means the core compiler libraries will not have been compiled with the option. This bug is therefore two issues: a) Can the --enable-target-optspace be used on compiler libraries b) Can the -Os option be used at all Hopefully b) is fixed. a) is not and is probably unlikely to be any time soon for ppc :(
(In reply to comment #40) > I talked to various people about this. I believe the --enable-target-optspace > option is not used on the CSL compilers (can be confirmed with > powerpc-linux-gnu-gcc -v) hence the reason they don't see the issue. You don't > have to enable that option to use the -Os option when compiling applications, > it just means the core compiler libraries will not have been compiled with the > option. > > This bug is therefore two issues: > a) Can the --enable-target-optspace be used on compiler libraries > b) Can the -Os option be used at all > > Hopefully b) is fixed. a) is not and is probably unlikely to be any time soon > for ppc :( thanks for summarizing. Yes thats what I have been meaning all the time. On latest oe-core/master b.) is fixed I dont think fixing a.) can be fixed easily however the problem a.) is not limited to gcc runtime only. It can exhibit on other shared libraries too but so far we are good. Since I could build a complete sato-image with -Os and gcc runtime compiled with -O2 IOW --disable-target-optspace
(In reply to comment #40) > ... You don't > have to enable that option to use the -Os option when compiling applications, > it just means the core compiler libraries will not have been compiled with the > option. Could you please be so kind and let me know _how_ do do this? I'd appreciate if you could show me exactly which steps are needed to do that, because all my attempts fail: - When I try to add "--enable-target-optspace" to the options when buiilding the SDK, I will reliable get build errors (see reports above). - When I don't add "--enable-target-optspace", any attempt to use "-Os" witht he generated compiler will result in a "cc1: error: Do not use -Os option if --enable-target-optspace is not set." abort. Thanks in advance. 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@denx.de Voodoo Programming: Things programmers do that they know shouldn't work but they try anyway, and which sometimes actually work, such as recompiling everything. - Karl Lehenbauer
(In reply to comment #42) > (In reply to comment #40) > > ... You don't > > have to enable that option to use the -Os option when compiling applications, > > it just means the core compiler libraries will not have been compiled with the > > option. > > Could you please be so kind and let me know _how_ do do this? I'd > appreciate if you could show me exactly which steps are needed to do > that, because all my attempts fail: > > - When I try to add "--enable-target-optspace" to the options when > buiilding the SDK, I will reliable get build errors (see reports > above). let it be as it is > > - When I don't add "--enable-target-optspace", any attempt to use > "-Os" witht he generated compiler will result in a "cc1: error: Do > not use -Os option if --enable-target-optspace is not set." abort. > this was due to gcc-poison-parameters.patch which has been now dropped as it has been fixed for gcc 4.5.1 it was backported with the below commit commit fef385e37e82a0eec743fbd1da11021b9e7158b5 Author: Kumar Gala <galak@kernel.crashing.org> Date: Fri Aug 26 09:33:53 2011 -0500 gcc-4.5.1: Drop gcc-poison-parameters.patch, replace with bug fix patch The gcc-poison-parameters was added specifically to deal with an issue on ppc targets and a bug when we build with -Os -frename-registers. This bug below reports the issue and is fixed in gcc-4.6.x/mainline: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44618 Backport patch to gcc 4.5.1. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> commit 0fabe078a31591f41c3fdabe5aa9de1111ef82c7 Author: Kumar Gala <galak@kernel.crashing.org> Date: Wed Aug 24 00:08:50 2011 -0500 gcc-4.6: Drop gcc-poison-parameters.patch as its not need The gcc-poison-parameters was added specifically to deal with an issue on ppc targets and a bug when we build with -Os -frename-registers. This bug below reports the issue and is fixed in gcc-4.6.x: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44618 Signed-off-by: Kumar Gala <galak@kernel.crashing.org> I think you are using a gcc which is before this commit. In that case please use the lastest oe-core/master or backport those two patches to your branch
(In reply to comment #43) > > this was due to gcc-poison-parameters.patch which has been now dropped > as it has been fixed for gcc 4.5.1 it was backported with the below commit > > commit fef385e37e82a0eec743fbd1da11021b9e7158b5 > Author: Kumar Gala <galak@kernel.crashing.org> > Date: Fri Aug 26 09:33:53 2011 -0500 > > gcc-4.5.1: Drop gcc-poison-parameters.patch, replace with bug fix patch ... > commit 0fabe078a31591f41c3fdabe5aa9de1111ef82c7 > Author: Kumar Gala <galak@kernel.crashing.org> > Date: Wed Aug 24 00:08:50 2011 -0500 > > gcc-4.6: Drop gcc-poison-parameters.patch as its not need I confirm that these two patches solve the problem for me. > I think you are using a gcc which is before this commit. In that case > please use the lastest oe-core/master or backport those two patches > to your branch Yes - all my tests were based on the 1.1_M3.final version, which does not include these commites yet. Will they make it into the 1.1 release? Thanks a lot for your help and your patience. 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@denx.de Marriage is the triumph of imagination over intelligence. Second marriage is the triumph of hope over experience.
I can confirm these are on the edison branch so will be included in the 1.1 release.
As 1.1 is out with the commits, this bug can be closed now.