Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 326539 - sys-devel/gcc-4.4.4-r1 on HPPA needs STAGE1_CFLAGS=-O0
Summary: sys-devel/gcc-4.4.4-r1 on HPPA needs STAGE1_CFLAGS=-O0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: HPPA Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: STABLEREQ
Depends on:
Blocks: 262653 289326 312815 321943 331531
  Show dependency tree
 
Reported: 2010-07-02 03:16 UTC by Jeroen Roovers (RETIRED)
Modified: 2023-09-28 12:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
toolchain.eclass patch (toolchain.eclass-stage1_cflags.patch,584 bytes, patch)
2010-07-02 17:15 UTC, Jeroen Roovers (RETIRED)
Details | Diff
toolchain.eclass.diff (toolchain.eclass.diff,1.30 KB, text/plain)
2010-08-01 19:17 UTC, Ryan Hill (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Roovers (RETIRED) gentoo-dev 2010-07-02 03:16:53 UTC
After setting STAGE1_CFLAGS=-O0:

Index: gcc-4.4.4-r1.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.4.4-r1.ebuild,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -B -r1.1 -r1.2
--- gcc-4.4.4-r1.ebuild 19 Jun 2010 01:53:09 -0000      1.1
+++ gcc-4.4.4-r1.ebuild 28 Jun 2010 11:32:42 -0000      1.2
@@ -1,6 +1,6 @@
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.4.4-r1.ebuild,v 1.1 2010/06/19 01:53:09 zorry Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.4.4-r1.ebuild,v 1.2 2010/06/28 11:32:42 jer Exp $
 
 PATCH_VER="1.0"
 UCLIBC_VER="1.0"
@@ -24,7 +24,7 @@
 DESCRIPTION="The GNU Compiler Collection.  Includes C/C++, java compilers, pie+ssp extensions, Haj Ten Brugge runtime bounds checking"
 
 LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
-KEYWORDS="~alpha ~amd64 ~arm -hppa ~ia64 ~mips ~ppc ~ppc64 ~sh -sparc ~x86 ~x86-fbsd"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh -sparc ~x86 ~x86-fbsd"
 
 RDEPEND=">=sys-libs/zlib-1.1.4
        >=sys-devel/gcc-config-1.4
@@ -86,4 +86,6 @@
                ewarn "Graphite support is still experimental and unstable."
                ewarn "Any bugs resulting from the use of Graphite will not be fixed."
        fi
+
+       use hppa && STAGE1_CFLAGS="-O0"
 }

=sys-devel/gcc-4.4.4-r1 is behaving quite nicely so far. It should fix a lot of long standing bugs as well.
Comment 1 SpanKY gentoo-dev 2010-07-02 05:05:51 UTC
i would prefer something in toolchain.eclass for the STAGE flags issue.  and some real documentation as to why it is being used.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2010-07-02 17:15:00 UTC
Created attachment 237291 [details, diff]
toolchain.eclass patch

(In reply to comment #1)
> i would prefer something in toolchain.eclass for the STAGE flags issue.

Like that?

> and some real documentation as to why it is being used.

http://marc.info/?l=linux-parisc&m=127566828005125&w=4 and onward.
Comment 3 Ryan Hill (RETIRED) gentoo-dev 2010-07-07 17:07:41 UTC
Index: toolchain.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v
retrieving revision 1.434
diff -u -r1.434 toolchain.eclass
--- toolchain.eclass    5 Jul 2010 22:25:09 -0000       1.434
+++ toolchain.eclass    7 Jul 2010 17:07:06 -0000
@@ -1482,7 +1482,7 @@
                # See bug #79852
                STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
        else
-               STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O"}
+               STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O0"}
        fi
 
        if is_crosscompile; then
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2010-07-07 17:10:52 UTC
Maybe not seriously, but it does seem like it would fix a bunch of other problems.  Do you remember why we use -O1 in the first place?
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2010-07-07 20:07:20 UTC
(In reply to comment #4)
> Maybe not seriously, but it does seem like it would fix a bunch of other
> problems.

You propose to change it for all arches? I think that's something for gentoo-dev@ - please don't hijack this bug report. :)
Comment 6 Ryan Hill (RETIRED) gentoo-dev 2010-07-10 02:49:48 UTC
Sorry, I didn't mean to hijack anything.  I just think this is an example of the kind of bugs we sometimes run into when we don't follow upstream recommendations.  Maybe we should take the opportunity to prevent it in the future, for everyone - not just add more workarounds.

See also
http://gcc.gnu.org/PR13632
http://gcc.gnu.org/PR23158
http://gcc.gnu.org/PR42775
Comment 7 Mark Loeser (RETIRED) gentoo-dev 2010-07-21 17:42:13 UTC
(In reply to comment #6)
> Sorry, I didn't mean to hijack anything.  I just think this is an example of
> the kind of bugs we sometimes run into when we don't follow upstream
> recommendations.  Maybe we should take the opportunity to prevent it in the
> future, for everyone - not just add more workarounds.

I agree.  Anyone disagree on making the change in the eclass?  If not, I'll make that change and I want to have 4.4.4-r1 marked stable.
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2010-07-24 04:34:10 UTC
see bug #283041
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2010-07-29 16:37:18 UTC
May I suggest (you could refer to bug #283041 too, of course):

Index: toolchain.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v
retrieving revision 1.436
diff -u -B -r1.436 toolchain.eclass
--- toolchain.eclass    22 Jul 2010 01:26:33 -0000      1.436
+++ toolchain.eclass    29 Jul 2010 16:36:04 -0000
@@ -1489,7 +1489,8 @@
                # See bug #79852
                STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
        else
-               STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O"}
+               # See bug #326539
+               STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O0"}
        fi
 
        if is_crosscompile; then


And when is this going to happen?
Comment 10 Ryan Hill (RETIRED) gentoo-dev 2010-08-01 03:04:27 UTC
I'd rather just not set it at all.

http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/toolchain.eclass?r1=1.436&r2=1.437

I'll drop the workaround in 4.4.4-r1.
Comment 11 Guy Martin (RETIRED) gentoo-dev 2010-08-01 10:38:01 UTC
I'd like to state that the workaround is mandatory.
gcc-4.4.4-r1 fails to bootstrap without it ...


Can we at least keep it in the ebuild for just this version ?
Comment 12 Raúl Porcel (RETIRED) gentoo-dev 2010-08-01 10:41:24 UTC
(In reply to comment #11)
> I'd like to state that the workaround is mandatory.
> gcc-4.4.4-r1 fails to bootstrap without it ...
> 
> 
> Can we at least keep it in the ebuild for just this version ?
> 

What he means is that gcc-4.4 only works on hppa if STAGE1_CFLAGS="-O0". At the moment it will use ${CFLAGS}, and if ${CFLAGS} has something different than -O0, it will fail. 
Comment 13 Ryan Hill (RETIRED) gentoo-dev 2010-08-01 18:59:23 UTC
Ok, why is it using CFLAGS?
Comment 14 Ryan Hill (RETIRED) gentoo-dev 2010-08-01 19:17:27 UTC
Created attachment 240963 [details]
toolchain.eclass.diff

Let's go all the way then.  Please give this a try.
Comment 15 Raúl Porcel (RETIRED) gentoo-dev 2010-08-01 19:43:06 UTC
(In reply to comment #13)
> Ok, why is it using CFLAGS?
> 

Ok, i was wrong on my comment :) It doesn't use any CFLAGS at all.
Comment 16 Ryan Hill (RETIRED) gentoo-dev 2010-08-01 20:04:56 UTC
Then we don't need the second patch?

Guy, does it actually fail now (have you tried)?  Because as far as I can tell the only way it would is if you're building a cross-compiler on an hppa host.
Comment 17 Guy Martin (RETIRED) gentoo-dev 2010-08-01 20:15:44 UTC
Ok I think I've missunderstood what has been done on this bug.
As far as I understand from jer's explanation, now it's not being set at all and thus use gcc's default.


I'll give it a try. Please give me some time (a day or two) for testing and I'll back to you.
Comment 18 Guy Martin (RETIRED) gentoo-dev 2010-08-02 17:35:48 UTC
I've been able to build gcc and rebuild it with itself -> bug fixed !

Thanks
Comment 19 Guy Martin (RETIRED) gentoo-dev 2010-08-02 17:39:43 UTC
Err gcc isn't stable yet. Reopening.
Comment 20 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-09 19:33:19 UTC
  01 Aug 2010; Ryan Hill <dirtyepic@gentoo.org> gcc-4.4.4-r1.ebuild:
  Drop hppa STAGE1_CFLAGS hack (bug #326539).

It wasn't a hack as such (only if you think toolchain.eclass needed to be fixed instead) and we still need it. What is now in the tree:

Index: toolchain.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v
retrieving revision 1.437
retrieving revision 1.436
diff -u -B -r1.437 -r1.436
--- toolchain.eclass    1 Aug 2010 03:00:36 -0000       1.437
+++ toolchain.eclass    22 Jul 2010 01:26:33 -0000      1.436
@@ -1,6 +1,6 @@
 # Copyright 1999-2008 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.437 2010/08/01 03:00:36 dirtyepic Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.436 2010/07/22 01:26:33 dirtyepic Exp $
 #
 # Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
 
@@ -1488,6 +1488,8 @@
        elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
                # See bug #79852
                STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
+       else
+               STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O"}
        fi
 
        if is_crosscompile; then

still breaks on HPPA when someone erroneously sets STAGE1_CFLAGS optimisation to something other than -O0, which we cannot (easily) check (through `emerge --info') and which we probably now need to start warning against in big fat red capitals in the HPPA install guide.
Comment 21 Ryan Hill (RETIRED) gentoo-dev 2010-08-09 23:54:53 UTC
Why would they set STAGE1_CFLAGS in the first place?  And how is that different than every other env variable that can mess up their system, or every other arch that setting STAGE1_CFLAGS breaks?

We're not going to force STAGE1_CFLAGS, or any other variable that is covered in the upstream install documentation.  They're override-able by design.  And we're not adding special cases for HPPA.  That was the whole point of this exercise.

You can always check STAGE1_CFLAGS by looking at the build log.
Comment 22 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-10 02:12:33 UTC
Never mind.