* why do we poison -Os?
@ 2011-08-24 0:52 Kumar Gala
2011-08-24 1:16 ` Xu, Dongxiao
0 siblings, 1 reply; 10+ messages in thread
From: Kumar Gala @ 2011-08-24 0:52 UTC (permalink / raw)
To: dongxiao.xu; +Cc: Patches and discussions about the oe-core layer
Dongxiao,
Can you explain why this was needed:
commit ce456306dad3fdf42494830011dacae213c48edf
Author: Dongxiao Xu <dongxiao.xu@intel.com>
Date: Sat Sep 25 10:16:26 2010 +0800
gcc: enable poison parameters detection
If not configured with --enable-target-optspace, gcc will report
errors if there is '-Os' optimization in parameters.
This fixes [BUGID #342]
Also add "--enable-target-optspace" option to arm gcc configuration.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
- k
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: why do we poison -Os? 2011-08-24 0:52 why do we poison -Os? Kumar Gala @ 2011-08-24 1:16 ` Xu, Dongxiao 2011-08-24 1:31 ` Kumar Gala 2011-08-24 1:32 ` Kumar Gala 0 siblings, 2 replies; 10+ messages in thread From: Xu, Dongxiao @ 2011-08-24 1:16 UTC (permalink / raw) To: Kumar Gala; +Cc: Patches and discussions about the oe-core layer Hi Kumar, The background of this commit is, when I upgraded PowerPC gcc to 4.5, tinylogin would crash with certain GCC build parameters. The root cause for that bug is, if enabled both "-frename-registers" and "-Os" options to build tinylogin in powerpc architecture, the tinylogin/getty application will encounter segmentation fault. Other combinations like "-frename-registers and -O2" or only "-Os" will not trigger this issue. Poky cross environment provides the "-frename-registers" parameter, however it does not provide -Os option since "--enable-target-optspace" option is disabled for powerpc gcc. The "-Os" option in tinylogin is added by its own Makefile. This commit is to prevent the above case. If --enable-target-optspace is disabled for GCC, "-Os" should not be added by recipe. Thanks, Dongxiao > -----Original Message----- > From: Kumar Gala [mailto:galak@kernel.crashing.org] > Sent: Wednesday, August 24, 2011 8:53 AM > To: Xu, Dongxiao > Cc: Patches and discussions about the oe-core layer; Khem Raj > Subject: why do we poison -Os? > > Dongxiao, > > Can you explain why this was needed: > > commit ce456306dad3fdf42494830011dacae213c48edf > Author: Dongxiao Xu <dongxiao.xu@intel.com> > Date: Sat Sep 25 10:16:26 2010 +0800 > > gcc: enable poison parameters detection > > If not configured with --enable-target-optspace, gcc will report > errors if there is '-Os' optimization in parameters. > > This fixes [BUGID #342] > > Also add "--enable-target-optspace" option to arm gcc configuration. > > Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> > > > - k ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 1:16 ` Xu, Dongxiao @ 2011-08-24 1:31 ` Kumar Gala 2011-08-24 1:32 ` Kumar Gala 1 sibling, 0 replies; 10+ messages in thread From: Kumar Gala @ 2011-08-24 1:31 UTC (permalink / raw) To: Xu, Dongxiao; +Cc: Patches and discussions about the oe-core layer I don't see how what you are describing maps to --enable-target-optspace being required. - k On Aug 23, 2011, at 8:16 PM, Xu, Dongxiao wrote: > Hi Kumar, > > The background of this commit is, when I upgraded PowerPC gcc to 4.5, tinylogin would crash with certain GCC build parameters. > > The root cause for that bug is, if enabled both "-frename-registers" and "-Os" options to build tinylogin in powerpc architecture, the tinylogin/getty application will encounter segmentation fault. Other combinations like "-frename-registers and -O2" or only "-Os" will not trigger this issue. > > Poky cross environment provides the "-frename-registers" parameter, however it does not provide -Os option since "--enable-target-optspace" option is disabled for powerpc gcc. The "-Os" option in tinylogin is added by its own Makefile. > > This commit is to prevent the above case. If --enable-target-optspace is disabled for GCC, "-Os" should not be added by recipe. > > Thanks, > Dongxiao > >> -----Original Message----- >> From: Kumar Gala [mailto:galak@kernel.crashing.org] >> Sent: Wednesday, August 24, 2011 8:53 AM >> To: Xu, Dongxiao >> Cc: Patches and discussions about the oe-core layer; Khem Raj >> Subject: why do we poison -Os? >> >> Dongxiao, >> >> Can you explain why this was needed: >> >> commit ce456306dad3fdf42494830011dacae213c48edf >> Author: Dongxiao Xu <dongxiao.xu@intel.com> >> Date: Sat Sep 25 10:16:26 2010 +0800 >> >> gcc: enable poison parameters detection >> >> If not configured with --enable-target-optspace, gcc will report >> errors if there is '-Os' optimization in parameters. >> >> This fixes [BUGID #342] >> >> Also add "--enable-target-optspace" option to arm gcc configuration. >> >> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> >> >> >> - k ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 1:16 ` Xu, Dongxiao 2011-08-24 1:31 ` Kumar Gala @ 2011-08-24 1:32 ` Kumar Gala 2011-08-24 1:45 ` Richard Purdie 2011-08-24 1:47 ` Xu, Dongxiao 1 sibling, 2 replies; 10+ messages in thread From: Kumar Gala @ 2011-08-24 1:32 UTC (permalink / raw) To: Xu, Dongxiao; +Cc: Patches and discussions about the oe-core layer If tinylogin is the only issue why modify/patch gcc? I see we have meta/recipes-core/tinylogin/tinylogin-1.4/use_O2_option.patch to deal with this? Not allowing -Os at all, which is our current situation on PPC is problematic. So trying to see if this issue is really limited to gcc 4.5 or not. How can I reproduce it with current poky.git? - k On Aug 23, 2011, at 8:16 PM, Xu, Dongxiao wrote: > Hi Kumar, > > The background of this commit is, when I upgraded PowerPC gcc to 4.5, tinylogin would crash with certain GCC build parameters. > > The root cause for that bug is, if enabled both "-frename-registers" and "-Os" options to build tinylogin in powerpc architecture, the tinylogin/getty application will encounter segmentation fault. Other combinations like "-frename-registers and -O2" or only "-Os" will not trigger this issue. > > Poky cross environment provides the "-frename-registers" parameter, however it does not provide -Os option since "--enable-target-optspace" option is disabled for powerpc gcc. The "-Os" option in tinylogin is added by its own Makefile. > > This commit is to prevent the above case. If --enable-target-optspace is disabled for GCC, "-Os" should not be added by recipe. > > Thanks, > Dongxiao > >> -----Original Message----- >> From: Kumar Gala [mailto:galak@kernel.crashing.org] >> Sent: Wednesday, August 24, 2011 8:53 AM >> To: Xu, Dongxiao >> Cc: Patches and discussions about the oe-core layer; Khem Raj >> Subject: why do we poison -Os? >> >> Dongxiao, >> >> Can you explain why this was needed: >> >> commit ce456306dad3fdf42494830011dacae213c48edf >> Author: Dongxiao Xu <dongxiao.xu@intel.com> >> Date: Sat Sep 25 10:16:26 2010 +0800 >> >> gcc: enable poison parameters detection >> >> If not configured with --enable-target-optspace, gcc will report >> errors if there is '-Os' optimization in parameters. >> >> This fixes [BUGID #342] >> >> Also add "--enable-target-optspace" option to arm gcc configuration. >> >> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> >> >> >> - k ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 1:32 ` Kumar Gala @ 2011-08-24 1:45 ` Richard Purdie 2011-08-24 4:02 ` Kumar Gala 2011-08-24 1:47 ` Xu, Dongxiao 1 sibling, 1 reply; 10+ messages in thread From: Richard Purdie @ 2011-08-24 1:45 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On Tue, 2011-08-23 at 20:32 -0500, Kumar Gala wrote: > If tinylogin is the only issue why modify/patch gcc? I see we have > meta/recipes-core/tinylogin/tinylogin-1.4/use_O2_option.patch to deal > with this? > > Not allowing -Os at all, which is our current situation on PPC is > problematic. So trying to see if this issue is really limited to gcc > 4.5 or not. How can I reproduce it with current poky.git? We were seeing problems when makefiles were putting -Os into compiler flags without our knowledge. In some cases -Os was silently corrupting binaries. We therefore ended up adding the poison so if anything was using the option we knew to generate buggy code, we'd know about it. If we know gcc to be safe using that option we can drop the patch and users can enable it where it makes sense to them. I still don't like makefiles changing compiler optimisations from under us though. Last I heard, -Os was still very badly supported and not recommended by the gcc community. Cheers, Richard ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 1:45 ` Richard Purdie @ 2011-08-24 4:02 ` Kumar Gala 0 siblings, 0 replies; 10+ messages in thread From: Kumar Gala @ 2011-08-24 4:02 UTC (permalink / raw) To: Patches and discussions about the oe-core layer, Richard Purdie On Aug 23, 2011, at 8:45 PM, Richard Purdie wrote: > On Tue, 2011-08-23 at 20:32 -0500, Kumar Gala wrote: >> If tinylogin is the only issue why modify/patch gcc? I see we have >> meta/recipes-core/tinylogin/tinylogin-1.4/use_O2_option.patch to deal >> with this? >> >> Not allowing -Os at all, which is our current situation on PPC is >> problematic. So trying to see if this issue is really limited to gcc >> 4.5 or not. How can I reproduce it with current poky.git? > > We were seeing problems when makefiles were putting -Os into compiler > flags without our knowledge. In some cases -Os was silently corrupting > binaries. We therefore ended up adding the poison so if anything was > using the option we knew to generate buggy code, we'd know about it. So, I'm trying to figure out if it was just tinylogin or more that had issues. > If we know gcc to be safe using that option we can drop the patch and > users can enable it where it makes sense to them. I still don't like > makefiles changing compiler optimisations from under us though. Last I > heard, -Os was still very badly supported and not recommended by the gcc > community. That's a different issue altogether. I think its bad that we dont allow -Os at all which is what I'm trying address and the fact that its pretty necessary to build u-boot because it has size limitations. - k ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 1:32 ` Kumar Gala 2011-08-24 1:45 ` Richard Purdie @ 2011-08-24 1:47 ` Xu, Dongxiao 2011-08-24 4:06 ` Kumar Gala 2011-08-24 10:52 ` Phil Blundell 1 sibling, 2 replies; 10+ messages in thread From: Xu, Dongxiao @ 2011-08-24 1:47 UTC (permalink / raw) To: Kumar Gala; +Cc: Patches and discussions about the oe-core layer > -----Original Message----- > From: Kumar Gala [mailto:galak@kernel.crashing.org] > > If tinylogin is the only issue why modify/patch gcc? I see we have > meta/recipes-core/tinylogin/tinylogin-1.4/use_O2_option.patch to deal with > this? Yes, patch for tinylogin is to deal with the issue. Besides that, we added this poison detection mechanism and suppose it should not affect functionality. My understanding is that, if GCC is not configured with the ability of code space optimization, target recipes will not have code size benefit even if adding "-Os" option. > > Not allowing -Os at all, which is our current situation on PPC is problematic. > So trying to see if this issue is really limited to gcc 4.5 or not. How can I > reproduce it with current poky.git? Not allowing -Os for PPC is because --enable-target-optspace is not enabled for PPC GCC. This is a known issue for PPC GCC 4.5.x. I wonder if GCC 4.6.x has fixed this issue. If so, we should add "--enable-target-optspace" for PPC GCC again, thus -Os will be allowed for recipes. Thanks, Dongxiao > > - k > > On Aug 23, 2011, at 8:16 PM, Xu, Dongxiao wrote: > > > Hi Kumar, > > > > The background of this commit is, when I upgraded PowerPC gcc to 4.5, > tinylogin would crash with certain GCC build parameters. > > > > The root cause for that bug is, if enabled both "-frename-registers" and "-Os" > options to build tinylogin in powerpc architecture, the tinylogin/getty > application will encounter segmentation fault. Other combinations like > "-frename-registers and -O2" or only "-Os" will not trigger this issue. > > > > Poky cross environment provides the "-frename-registers" parameter, > however it does not provide -Os option since "--enable-target-optspace" option > is disabled for powerpc gcc. The "-Os" option in tinylogin is added by its own > Makefile. > > > > This commit is to prevent the above case. If --enable-target-optspace is > disabled for GCC, "-Os" should not be added by recipe. > > > > Thanks, > > Dongxiao > > > >> -----Original Message----- > >> From: Kumar Gala [mailto:galak@kernel.crashing.org] > >> Sent: Wednesday, August 24, 2011 8:53 AM > >> To: Xu, Dongxiao > >> Cc: Patches and discussions about the oe-core layer; Khem Raj > >> Subject: why do we poison -Os? > >> > >> Dongxiao, > >> > >> Can you explain why this was needed: > >> > >> commit ce456306dad3fdf42494830011dacae213c48edf > >> Author: Dongxiao Xu <dongxiao.xu@intel.com> > >> Date: Sat Sep 25 10:16:26 2010 +0800 > >> > >> gcc: enable poison parameters detection > >> > >> If not configured with --enable-target-optspace, gcc will report > >> errors if there is '-Os' optimization in parameters. > >> > >> This fixes [BUGID #342] > >> > >> Also add "--enable-target-optspace" option to arm gcc configuration. > >> > >> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> > >> > >> > >> - k ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 1:47 ` Xu, Dongxiao @ 2011-08-24 4:06 ` Kumar Gala 2011-08-24 10:52 ` Phil Blundell 1 sibling, 0 replies; 10+ messages in thread From: Kumar Gala @ 2011-08-24 4:06 UTC (permalink / raw) To: Xu, Dongxiao; +Cc: Patches and discussions about the oe-core layer On Aug 23, 2011, at 8:47 PM, Xu, Dongxiao wrote: >> -----Original Message----- >> From: Kumar Gala [mailto:galak@kernel.crashing.org] >> >> If tinylogin is the only issue why modify/patch gcc? I see we have >> meta/recipes-core/tinylogin/tinylogin-1.4/use_O2_option.patch to deal with >> this? > > Yes, patch for tinylogin is to deal with the issue. > Besides that, we added this poison detection mechanism and suppose it should not affect functionality. > My understanding is that, if GCC is not configured with the ability of code space optimization, target recipes will not have code size benefit even if adding "-Os" option. > >> >> Not allowing -Os at all, which is our current situation on PPC is problematic. >> So trying to see if this issue is really limited to gcc 4.5 or not. How can I >> reproduce it with current poky.git? > > Not allowing -Os for PPC is because --enable-target-optspace is not enabled for PPC GCC. This is a known issue for PPC GCC 4.5.x. > > I wonder if GCC 4.6.x has fixed this issue. If so, we should add "--enable-target-optspace" for PPC GCC again, thus -Os will be allowed for recipes. Thus my query on how to verify this and if it was limited to tinylogin. - k > > Thanks, > Dongxiao > >> >> - k >> >> On Aug 23, 2011, at 8:16 PM, Xu, Dongxiao wrote: >> >>> Hi Kumar, >>> >>> The background of this commit is, when I upgraded PowerPC gcc to 4.5, >> tinylogin would crash with certain GCC build parameters. >>> >>> The root cause for that bug is, if enabled both "-frename-registers" and "-Os" >> options to build tinylogin in powerpc architecture, the tinylogin/getty >> application will encounter segmentation fault. Other combinations like >> "-frename-registers and -O2" or only "-Os" will not trigger this issue. >>> >>> Poky cross environment provides the "-frename-registers" parameter, >> however it does not provide -Os option since "--enable-target-optspace" option >> is disabled for powerpc gcc. The "-Os" option in tinylogin is added by its own >> Makefile. >>> >>> This commit is to prevent the above case. If --enable-target-optspace is >> disabled for GCC, "-Os" should not be added by recipe. >>> >>> Thanks, >>> Dongxiao >>> >>>> -----Original Message----- >>>> From: Kumar Gala [mailto:galak@kernel.crashing.org] >>>> Sent: Wednesday, August 24, 2011 8:53 AM >>>> To: Xu, Dongxiao >>>> Cc: Patches and discussions about the oe-core layer; Khem Raj >>>> Subject: why do we poison -Os? >>>> >>>> Dongxiao, >>>> >>>> Can you explain why this was needed: >>>> >>>> commit ce456306dad3fdf42494830011dacae213c48edf >>>> Author: Dongxiao Xu <dongxiao.xu@intel.com> >>>> Date: Sat Sep 25 10:16:26 2010 +0800 >>>> >>>> gcc: enable poison parameters detection >>>> >>>> If not configured with --enable-target-optspace, gcc will report >>>> errors if there is '-Os' optimization in parameters. >>>> >>>> This fixes [BUGID #342] >>>> >>>> Also add "--enable-target-optspace" option to arm gcc configuration. >>>> >>>> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> >>>> >>>> >>>> - k ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 1:47 ` Xu, Dongxiao 2011-08-24 4:06 ` Kumar Gala @ 2011-08-24 10:52 ` Phil Blundell 2011-08-24 16:14 ` Khem Raj 1 sibling, 1 reply; 10+ messages in thread From: Phil Blundell @ 2011-08-24 10:52 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On Wed, 2011-08-24 at 09:47 +0800, Xu, Dongxiao wrote: > My understanding is that, if GCC is not configured with the ability of code space optimization, target recipes will not have code size benefit even if adding "-Os" option. No, that's incorrect. All that --enable-target-optspace does is change the definition of CFLAGS_FOR_TARGET, which causes the GCC support libraries (i.e. libgcc, libstdc++, etc) to be built with -Os rather than -O2. It has no effect on the functionality of the compiler itself. p. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why do we poison -Os? 2011-08-24 10:52 ` Phil Blundell @ 2011-08-24 16:14 ` Khem Raj 0 siblings, 0 replies; 10+ messages in thread From: Khem Raj @ 2011-08-24 16:14 UTC (permalink / raw) To: openembedded-core On 8/24/2011 3:52 AM, Phil Blundell wrote: > On Wed, 2011-08-24 at 09:47 +0800, Xu, Dongxiao wrote: >> My understanding is that, if GCC is not configured with the ability of code space optimization, target recipes will not have code size benefit even if adding "-Os" option. > > No, that's incorrect. All that --enable-target-optspace does is change > the definition of CFLAGS_FOR_TARGET, which causes the GCC support > libraries (i.e. libgcc, libstdc++, etc) to be built with -Os rather than > -O2. It has no effect on the functionality of the compiler itself. > thats correct. this options is only for making gcc runtime to be built with Os. It does not make gcc to use -Os by default. The problem for ppc however is that if you built with Os then gcc depends upon functions from libgcc.a which needs libgcc.so to be a linker script stub rather than a symlink as it used to be but this has been fixed > p. > > > > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-08-24 16:19 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-08-24 0:52 why do we poison -Os? Kumar Gala 2011-08-24 1:16 ` Xu, Dongxiao 2011-08-24 1:31 ` Kumar Gala 2011-08-24 1:32 ` Kumar Gala 2011-08-24 1:45 ` Richard Purdie 2011-08-24 4:02 ` Kumar Gala 2011-08-24 1:47 ` Xu, Dongxiao 2011-08-24 4:06 ` Kumar Gala 2011-08-24 10:52 ` Phil Blundell 2011-08-24 16:14 ` Khem Raj
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox