summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2003-03-23 15:40:10 +0000
committerMartin Schlemmer <azarah@gentoo.org>2003-03-23 15:40:10 +0000
commit1c582f8ea6922e7aa4285acc004ed530585be6e5 (patch)
tree080fb0a48805204f413f4ce0a411711203e5aa50 /sys-devel
parentseems fine for x86 (diff)
downloadhistorical-1c582f8ea6922e7aa4285acc004ed530585be6e5.tar.gz
historical-1c582f8ea6922e7aa4285acc004ed530585be6e5.tar.bz2
historical-1c582f8ea6922e7aa4285acc004ed530585be6e5.zip
New version that will fix a few problems hopefully
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/gcc/ChangeLog21
-rw-r--r--sys-devel/gcc/files/3.2.2/gcc32-pr7768.patch65
-rw-r--r--sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch69
-rw-r--r--sys-devel/gcc/files/3.2.2/gcc32-pr9732.patch159
-rw-r--r--sys-devel/gcc/files/3.2.2/gcc322-ggc_page-speedup.patch17
-rw-r--r--sys-devel/gcc/files/3.2.2/gcc322-pr8746.patch73
-rw-r--r--sys-devel/gcc/files/3.2.2/gcc322-pr9888.patch293
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.2-r23
-rw-r--r--sys-devel/gcc/gcc-3.2.2-r2.ebuild522
9 files changed, 1221 insertions, 1 deletions
diff --git a/sys-devel/gcc/ChangeLog b/sys-devel/gcc/ChangeLog
index 8a3a169a93e4..df3588c8c4cb 100644
--- a/sys-devel/gcc/ChangeLog
+++ b/sys-devel/gcc/ChangeLog
@@ -1,6 +1,25 @@
# ChangeLog for sys-devel/gcc
# Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/ChangeLog,v 1.78 2003/03/09 03:23:08 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/ChangeLog,v 1.79 2003/03/23 15:40:10 azarah Exp $
+
+*gcc-3.2.2-r2 (21 Mar 2003)
+
+ 21 Mar 2003; Martin Schlemmer <azarah@gentoo.org> gcc-3.2.2-r2.ebuild,
+ gcc32-pr7768.patch, gcc32-pr8213.patch, gcc32-pr9732.patch,
+ gcc322-pr8746.patch, gcc322-pr9888.patch, gcc322-ggc_page-speedup.patch,
+ gcc-3.2.2-branch-update-20030322.patch, gcc-3.2.2-tls-update2.patch :
+
+ - Update to gcc-3_2 branch 2003-03-22 (gcc-3.2.2-branch-update-20030322.patch)
+ - Update TLS patch (gcc-3.2.2-tls-update2.patch) for 2003-03-22 CVS branch.
+ - Add gcc322-pr9888.patch to fix a out of range 'loop' instructions for the
+ K6 family of processors. Many thanks to Jim Bray <jb@as220.org> for his
+ work in getting this resolved with the gcc devs, and bringing it to my
+ attention (included in branch-update).
+ - Add gcc322-pr8746.patch to fix corner cases of miscompilation on K6 arch.
+ - Get gcc to decreases the number of times the collector has to be run
+ by increasing its memory workspace, bug #16548, thanks to
+ Garen <garen@garen.net>, patch gcc322-ggc_page-speedup.patch.
+ - Also added some other PR bugfixes.
09 Mar 2003; Martin Schlemmer <azarah@gentoo.org> gcc-3.2.2*.ebuild :
Fix handling of fix_libtool_files.sh to be more $FILESDIR independant.
diff --git a/sys-devel/gcc/files/3.2.2/gcc32-pr7768.patch b/sys-devel/gcc/files/3.2.2/gcc32-pr7768.patch
new file mode 100644
index 000000000000..72b4910c869a
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.2/gcc32-pr7768.patch
@@ -0,0 +1,65 @@
+2002-09-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7768
+ * pt.c (build_template_decl): Copy DECL_DESTRUCTOR_P.
+
+2002-09-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/template/pretty1.C: New test.
+
+--- gcc-3.2.1/gcc/cp/pt.c.pr7768 2003-01-20 14:14:15.000000000 +0100
++++ gcc-3.2.1/gcc/cp/pt.c 2003-02-08 14:42:15.000000000 +0100
+@@ -2108,6 +2108,7 @@ build_template_decl (decl, parms)
+ DECL_VIRTUAL_CONTEXT (tmpl) = DECL_VIRTUAL_CONTEXT (decl);
+ DECL_STATIC_FUNCTION_P (tmpl) = DECL_STATIC_FUNCTION_P (decl);
+ DECL_CONSTRUCTOR_P (tmpl) = DECL_CONSTRUCTOR_P (decl);
++ DECL_DESTRUCTOR_P (tmpl) = DECL_DESTRUCTOR_P (decl);
+ DECL_NONCONVERTING_P (tmpl) = DECL_NONCONVERTING_P (decl);
+ DECL_ASSIGNMENT_OPERATOR_P (tmpl) = DECL_ASSIGNMENT_OPERATOR_P (decl);
+ if (DECL_OVERLOADED_OPERATOR_P (decl))
+--- gcc-3.2.1/gcc/testsuite/g++.dg/template/pretty1.C.pr7768 2003-02-08 14:42:03.000000000 +0100
++++ gcc-3.2.1/gcc/testsuite/g++.dg/template/pretty1.C 2003-02-08 14:41:52.000000000 +0100
+@@ -0,0 +1,43 @@
++// { dg-do run }
++
++// Copyright (C) 2002 Free Software Foundation, Inc.
++// Contributed by Nathan Sidwell 14 Sep 2002 <nathan@codesourcery.com>
++
++// PR 7768 template dtor pretty function wrong
++
++#include <string.h>
++
++static size_t current = 0;
++static bool error = false;
++
++static char const *names[] =
++{
++ "X<T>::X() [with T = void]",
++ "X<T>::~X() [with T = void]",
++ 0
++};
++
++void Verify (char const *ptr)
++{
++ error = strcmp (ptr, names[current++]);
++}
++
++template <typename T>
++struct X
++{
++ X() { Verify (__PRETTY_FUNCTION__); }
++ ~X() { Verify (__PRETTY_FUNCTION__); }
++};
++
++int main()
++{
++ {
++ X<void> x;
++
++ if (error)
++ return current;
++ }
++ if (error)
++ return current;
++ return 0;
++}
diff --git a/sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch b/sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch
new file mode 100644
index 000000000000..762d198f4cfd
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch
@@ -0,0 +1,69 @@
+2002-10-30 Jan Hubicka <jh@suse.cz>
+
+ PR target/8213
+ * config/i386/i386.c (ix86_expand_int_movcc): Fix RTL sharing problem.
+
+2002-11-04 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
+
+ * testsuite/gcc.c-torture/execute/20021104.c: New test.
+
+--- gcc-3.2/gcc/config/i386/i386.c.pr8213 2002-11-04 12:56:37.000000000 -0500
++++ gcc-3.2/gcc/config/i386/i386.c 2002-11-04 13:21:22.000000000 -0500
+@@ -8274,11 +8274,11 @@ ix86_expand_int_movcc (operands)
+ /* On x86_64 the lea instruction operates on Pmode, so we need to get arithmetics
+ done in proper mode to match. */
+ if (diff == 1)
+- tmp = out;
++ tmp = copy_rtx (out);
+ else
+ {
+ rtx out1;
+- out1 = out;
++ out1 = copy_rtx (out);
+ tmp = gen_rtx_MULT (mode, out1, GEN_INT (diff & ~1));
+ nops++;
+ if (diff & 1)
+@@ -8302,12 +8302,12 @@ ix86_expand_int_movcc (operands)
+ clob = gen_rtx_REG (CCmode, FLAGS_REG);
+ clob = gen_rtx_CLOBBER (VOIDmode, clob);
+
+- tmp = gen_rtx_SET (VOIDmode, out, tmp);
++ tmp = gen_rtx_SET (VOIDmode, copy_rtx (out), tmp);
+ tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, copy_rtx (tmp), clob));
+ emit_insn (tmp);
+ }
+ else
+- emit_insn (gen_rtx_SET (VOIDmode, out, tmp));
++ emit_insn (gen_rtx_SET (VOIDmode, copy_rtx (out), tmp));
+ }
+ if (out != operands[0])
+ emit_move_insn (operands[0], copy_rtx (out));
+--- gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20021104.c.pr8213 2002-11-04 13:22:33.000000000 -0500
++++ gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20021104.c 2002-11-04 13:24:12.000000000 -0500
+@@ -0,0 +1,26 @@
++/* PR target/8213
++ This testcase, distilled from GNU gmp 4.1, was miscompiled on x86-64
++ because of RTL sharing problems. */
++
++int f(long x, long y)
++{
++ if ((x < 0) == (y < 0))
++ {
++ if (x == 0)
++ return -(y != 0);
++ if (y == 0)
++ return x != 0;
++ }
++ else
++ {
++ return x >= 0 ? 1 : -1;
++ }
++}
++
++int main(void)
++{
++ if (f(-1, 1) != -1)
++ abort();
++
++ return 0;
++}
diff --git a/sys-devel/gcc/files/3.2.2/gcc32-pr9732.patch b/sys-devel/gcc/files/3.2.2/gcc32-pr9732.patch
new file mode 100644
index 000000000000..6bc1a3531da1
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.2/gcc32-pr9732.patch
@@ -0,0 +1,159 @@
+2003-02-25 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ PR target/9732
+ * config/rs6000/rs6000.c (first_reg_to_save): Handle
+ PIC_OFFSET_TABLE_REGNUM for -fPIC too.
+ (rs6000_emit_prologue): Likewise.
+ (rs6000_emit_epilogue): Likewise.
+ * config/rs6000/rs6000.h (CONDITIONAL_REGISTER_USAGE): Make
+ PIC_OFFSET_TABLE_REGNUM a fixed register for -fPIC.
+ * testsuite/gcc.dg/20030225-2.c: New test.
+
+--- gcc-3.2.2/gcc/config/rs6000/rs6000.c.pr9732 2003-01-29 20:56:16.000000000 +0100
++++ gcc-3.2.2/gcc/config/rs6000/rs6000.c 2003-02-28 10:52:09.000000000 +0100
+@@ -7412,7 +7412,7 @@ first_reg_to_save ()
+ if (regs_ever_live[first_reg]
+ && (! call_used_regs[first_reg]
+ || (first_reg == RS6000_PIC_OFFSET_TABLE_REGNUM
+- && ((DEFAULT_ABI == ABI_V4 && flag_pic == 1)
++ && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
+ || (DEFAULT_ABI == ABI_DARWIN && flag_pic)))))
+ break;
+
+@@ -8804,7 +8804,7 @@ rs6000_emit_prologue ()
+ if ((regs_ever_live[info->first_gp_reg_save+i]
+ && ! call_used_regs[info->first_gp_reg_save+i])
+ || (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM
+- && ((DEFAULT_ABI == ABI_V4 && flag_pic == 1)
++ && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
+ || (DEFAULT_ABI == ABI_DARWIN && flag_pic))))
+ {
+ rtx addr, reg, mem;
+@@ -9190,7 +9190,7 @@ rs6000_emit_epilogue (sibcall)
+ if ((regs_ever_live[info->first_gp_reg_save+i]
+ && ! call_used_regs[info->first_gp_reg_save+i])
+ || (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM
+- && ((DEFAULT_ABI == ABI_V4 && flag_pic == 1)
++ && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
+ || (DEFAULT_ABI == ABI_DARWIN && flag_pic))))
+ {
+ rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
+--- gcc-3.2.2/gcc/config/rs6000/rs6000.h.pr9732 2002-08-08 19:52:40.000000000 +0200
++++ gcc-3.2.2/gcc/config/rs6000/rs6000.h 2003-02-28 10:52:10.000000000 +0100
+@@ -962,6 +962,10 @@ extern int rs6000_altivec_abi;
+ = call_really_used_regs[i] = 1; \
+ if (DEFAULT_ABI == ABI_V4 \
+ && PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM \
++ && flag_pic == 2) \
++ fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1; \
++ if (DEFAULT_ABI == ABI_V4 \
++ && PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM \
+ && flag_pic == 1) \
+ fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
+ = call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
+--- gcc-3.2.2/gcc/testsuite/gcc.dg/20030225-2.c.pr9732 2003-02-28 10:55:14.000000000 +0100
++++ gcc-3.2.2/gcc/testsuite/gcc.dg/20030225-2.c 2003-02-28 10:55:03.000000000 +0100
+@@ -0,0 +1,103 @@
++/* PR target/9732
++ This testcase segfaulted on PPC because PIC_OFFSET_TABLE_REGNUM was no
++ fixed register.
++ Distilled from the xvid sources by Guillaume Morin <guillaume@morinfr.org>
++ and Benjamin Herrenschmidt <benh@kernel.crashing.org>. */
++/* { dg-do run } */
++/* { dg-options "-O2 -fPIC" } */
++/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */
++
++
++extern void exit (int);
++
++#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
++#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
++#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
++#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
++#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
++#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
++
++
++/* private data */
++static short iclip[1024]; /* clipping table */
++static short *iclp;
++
++void
++idct_int32(short *const block)
++{
++ static short *blk;
++ static long i;
++ static long X0, X1, X2, X3, X4, X5, X6, X7, X8;
++
++ for (i = 0; i < 8; i++) /* idct columns */
++ {
++ blk = block + i;
++ /* shortcut */
++ if (! ((X1 = (blk[8 * 4] << 8)) | (X2 = blk[8 * 6])
++ | (X3 = blk[8 * 2]) | (X4 = blk[8 * 1]) | (X5 = blk[8 * 7])
++ | (X6 = blk[8 * 5]) | (X7 = blk[8 * 3])))
++ {
++ blk[8 * 0] = blk[8 * 1] = blk[8 * 2] =
++ blk[8 * 3] = blk[8 * 4] =
++ blk[8 * 5] = blk[8 * 6] = blk[8 * 7] =
++ iclp[(blk[8 * 0] + 32) >> 6];
++ continue;
++ }
++ X0 = (blk[8 * 0] << 8) + 8192;
++
++ /* first stage */
++ X8 = W7 * (X4 + X5) + 4;
++ X4 = (X8 + (W1 - W7) * X4) >> 3;
++ X5 = (X8 - (W1 + W7) * X5) >> 3;
++ X8 = W3 * (X6 + X7) + 4;
++ X6 = (X8 - (W3 - W5) * X6) >> 3;
++ X7 = (X8 - (W3 + W5) * X7) >> 3;
++
++ /* second stage */
++ X8 = X0 + X1;
++ X0 -= X1;
++ X1 = W6 * (X3 + X2) + 4;
++ X2 = (X1 - (W2 + W6) * X2) >> 3;
++ X3 = (X1 + (W2 - W6) * X3) >> 3;
++ X1 = X4 + X6;
++ X4 -= X6;
++ X6 = X5 + X7;
++ X5 -= X7;
++
++ /* third stage */
++ X7 = X8 + X3;
++ X8 -= X3;
++ X3 = X0 + X2;
++ X0 -= X2;
++ X2 = (181 * (X4 + X5) + 128) >> 8;
++ X4 = (181 * (X4 - X5) + 128) >> 8;
++
++ /* fourth stage */
++ blk[8 * 0] = iclp[(X7 + X1) >> 14];
++ blk[8 * 1] = iclp[(X3 + X2) >> 14];
++ blk[8 * 2] = iclp[(X0 + X4) >> 14];
++ blk[8 * 3] = iclp[(X8 + X6) >> 14];
++ blk[8 * 4] = iclp[(X8 - X6) >> 14];
++ blk[8 * 5] = iclp[(X0 - X4) >> 14];
++ blk[8 * 6] = iclp[(X3 - X2) >> 14];
++ blk[8 * 7] = iclp[(X7 - X1) >> 14];
++ }
++} /* end function idct_int32(block) */
++
++
++int main(void) {
++ int i;
++ unsigned short tab[64];
++
++ for (i = 0 ; i < 64 ; ++i)
++ {
++ tab[i] = (1+(int) (65535)*8000/(2147483647+1.0));
++ }
++
++ iclp = iclip + 512;
++ for (i = -512; i < 512; i++)
++ iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
++
++ idct_int32((short *) tab);
++ exit (0);
++}
diff --git a/sys-devel/gcc/files/3.2.2/gcc322-ggc_page-speedup.patch b/sys-devel/gcc/files/3.2.2/gcc322-ggc_page-speedup.patch
new file mode 100644
index 000000000000..564433ddd952
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.2/gcc322-ggc_page-speedup.patch
@@ -0,0 +1,17 @@
+--- gcc-3.2.2/gcc/ggc-page.c.orig 2003-03-22 03:52:54.000000000 +0200
++++ gcc-3.2.2/gcc/ggc-page.c 2003-03-22 03:54:17.000000000 +0200
+@@ -344,11 +344,11 @@
+ this factor times the allocation at the end of the last collection.
+ In other words, total allocation must expand by (this factor minus
+ one) before collection is performed. */
+-#define GGC_MIN_EXPAND_FOR_GC (1.3)
++#define GGC_MIN_EXPAND_FOR_GC (2.0)
+
+-/* Bound `allocated_last_gc' to 16MB, to prevent the memory expansion
++/* Bound `allocated_last_gc' to 32MB, to prevent the memory expansion
+ test from triggering too often when the heap is small. */
+-#define GGC_MIN_LAST_ALLOCATED (16 * 1024 * 1024)
++#define GGC_MIN_LAST_ALLOCATED (32 * 1024 * 1024)
+
+ /* Allocate pages in chunks of this size, to throttle calls to memory
+ allocation routines. The first page is used, the rest go onto the
diff --git a/sys-devel/gcc/files/3.2.2/gcc322-pr8746.patch b/sys-devel/gcc/files/3.2.2/gcc322-pr8746.patch
new file mode 100644
index 000000000000..aa4a8cd26dd3
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.2/gcc322-pr8746.patch
@@ -0,0 +1,73 @@
+2003-03-20 Eric Botcazou <ebotcazou at libertysurf dot fr>
+
+ PR optimization/8746
+ * i386.md (and promoting splitters): Further disable QI to SImode
+ promoting, as well as HI to SImode promoting, when doing so
+ changes immediate to be 32bit.
+
+
+2003-03-20 Eric Botcazou <ebotcazou at libertysurf dot fr>
+
+ * gcc.dg/i386-signbit-2.c: New test.
+ * gcc.dg/i386-signbit-3.c: New test.
+
+Index: config/i386/i386.md
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
+retrieving revision 1.404.2.11
+diff -u -r1.404.2.11 i386.md
+--- gcc/config/i386/i386.md 13 Mar 2003 00:47:26 -0000 1.404.2.11
++++ gcc/config/i386/i386.md 20 Mar 2003 16:15:17 -0000
+@@ -16845,20 +16845,20 @@
+ operands[2] = gen_lowpart (SImode, operands[2]);
+ PUT_MODE (operands[3], SImode);")
+
++; Don't promote the QImode tests, as i386 doesn't have encoding
++; of test instructions with 32-bit sign-extended immediate so the
++; code grows.
+ (define_split
+ [(set (reg 17)
+- (compare (and (match_operand 1 "aligned_operand" "")
+- (match_operand 2 "const_int_operand" ""))
++ (compare (and (match_operand:HI 1 "aligned_operand" "")
++ (match_operand:HI 2 "const_int_operand" ""))
+ (const_int 0)))
+ (set (match_operand 0 "register_operand" "")
+ (and (match_dup 1) (match_dup 2)))]
+ "! TARGET_PARTIAL_REG_STALL && reload_completed
+ && ix86_match_ccmode (insn, CCNOmode)
+- && (GET_MODE (operands[0]) == HImode
+- || (GET_MODE (operands[0]) == QImode
+- /* Ensure that the operand will remain sign extended immediate. */
+- && INTVAL (operands[2]) >= 0
+- && (TARGET_PROMOTE_QImode || optimize_size)))"
++ /* Ensure that the operand will remain sign-extended immediate. */
++ && INTVAL (operands[2]) >= 0"
+ [(parallel [(set (reg:CCNO 17)
+ (compare:CCNO (and:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))
+@@ -16871,9 +16871,9 @@
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[1] = gen_lowpart (SImode, operands[1]);")
+
+-; Don't promote the QImode tests, as i386 don't have encoding of
+-; the test instruction with 32bit sign extended immediate and thus
+-; the code grows.
++; Don't promote the QImode tests, as i386 doesn't have encoding
++; of test instructions with 32-bit sign-extended immediate so the
++; code grows.
+ (define_split
+ [(set (reg 17)
+ (compare (and (match_operand:HI 0 "aligned_operand" "")
+@@ -16881,7 +16881,8 @@
+ (const_int 0)))]
+ "! TARGET_PARTIAL_REG_STALL && reload_completed
+ && ix86_match_ccmode (insn, CCNOmode)
+- && GET_MODE (operands[0]) == HImode"
++ /* Ensure that the operand will remain sign-extended immediate. */
++ && INTVAL (operands[1]) >= 0"
+ [(set (reg:CCNO 17)
+ (compare:CCNO (and:SI (match_dup 0) (match_dup 1))
+ (const_int 0)))]
+
+
diff --git a/sys-devel/gcc/files/3.2.2/gcc322-pr9888.patch b/sys-devel/gcc/files/3.2.2/gcc322-pr9888.patch
new file mode 100644
index 000000000000..cca60f87ad4d
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.2/gcc322-pr9888.patch
@@ -0,0 +1,293 @@
+Index:. gcc/config/i386/i386.md
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
+retrieving revision 1.339.2.13.2.2
+diff -u -p -r1.339.2.13.2.2 i386.md
+--- gcc/config/i386/i386.md 24 Oct 2002 17:11:54 -0000 1.339.2.13.2.2
++++ gcc/config/i386/i386.md 10 Mar 2003 20:24:35 -0000
+@@ -131,7 +131,7 @@
+
+ ;; The (bounding maximum) length of an instruction immediate.
+ (define_attr "length_immediate" ""
+- (cond [(eq_attr "type" "incdec,setcc,icmov,ibr,str,cld,lea,other,multi,idiv,sse,mmx")
++ (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv,sse,mmx")
+ (const_int 0)
+ (eq_attr "i387" "1")
+ (const_int 0)
+@@ -147,13 +147,10 @@
+ (if_then_else (match_operand 1 "constant_call_address_operand" "")
+ (const_int 4)
+ (const_int 0))
++ ;; We don't know the size before shorten_branches. Expect
++ ;; the instruction to fit for better scheduling.
+ (eq_attr "type" "ibr")
+- (if_then_else (and (ge (minus (match_dup 0) (pc))
+- (const_int -128))
+- (lt (minus (match_dup 0) (pc))
+- (const_int 124)))
+- (const_int 1)
+- (const_int 4))
++ (const_int 1)
+ ]
+ (symbol_ref "/* Update immediate_length and other attributes! */ abort(),1")))
+
+@@ -162,7 +159,7 @@
+ (cond [(eq_attr "type" "str,cld,other,multi,fxch")
+ (const_int 0)
+ (and (eq_attr "type" "call")
+- (match_operand 1 "constant_call_address_operand" ""))
++ (match_operand 0 "constant_call_address_operand" ""))
+ (const_int 0)
+ (and (eq_attr "type" "callv")
+ (match_operand 1 "constant_call_address_operand" ""))
+@@ -205,6 +202,12 @@
+ (and (match_operand 0 "register_operand" "")
+ (match_operand 1 "immediate_operand" "")))
+ (const_int 0)
++ (and (eq_attr "type" "call")
++ (match_operand 0 "constant_call_address_operand" ""))
++ (const_int 0)
++ (and (eq_attr "type" "callv")
++ (match_operand 1 "constant_call_address_operand" ""))
++ (const_int 0)
+ ]
+ (const_int 1)))
+
+@@ -1733,14 +1736,9 @@
+ (set_attr "mode" "SI")
+ (set_attr "length_immediate" "1")])
+
+-; The first alternative is used only to compute proper length of instruction.
+-; Reload's algorithm does not take into account the cost of spill instructions
+-; needed to free register in given class, so avoid it from choosing the first
+-; alternative when eax is not available.
+-
+ (define_insn "*movsi_1"
+- [(set (match_operand:SI 0 "nonimmediate_operand" "=*?a,r,*?a,m,!*y,!rm,!*y,!*Y,!rm,!*Y")
+- (match_operand:SI 1 "general_operand" "im,rinm,rinm,rin,rm,*y,*y,rm,*Y,*Y"))]
++ [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,!*y,!rm,!*y,!*Y,!rm,!*Y")
++ (match_operand:SI 1 "general_operand" "rinm,rin,rm,*y,*y,rm,*Y,*Y"))]
+ "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
+ {
+ switch (get_attr_type (insn))
+@@ -1765,17 +1763,16 @@
+ }
+ }
+ [(set (attr "type")
+- (cond [(eq_attr "alternative" "4,5,6")
++ (cond [(eq_attr "alternative" "2,3,4")
+ (const_string "mmx")
+- (eq_attr "alternative" "7,8,9")
++ (eq_attr "alternative" "5,6,7")
+ (const_string "sse")
+ (and (ne (symbol_ref "flag_pic") (const_int 0))
+ (match_operand:SI 1 "symbolic_operand" ""))
+ (const_string "lea")
+ ]
+ (const_string "imov")))
+- (set_attr "modrm" "0,*,0,*,*,*,*,*,*,*")
+- (set_attr "mode" "SI,SI,SI,SI,SI,SI,DI,TI,SI,SI")])
++ (set_attr "mode" "SI,SI,SI,SI,DI,TI,SI,SI")])
+
+ ;; Stores and loads of ax to arbitary constant address.
+ ;; We fake an second form of instruction to force reload to load address
+@@ -1848,14 +1845,9 @@
+ [(set_attr "type" "push")
+ (set_attr "mode" "QI")])
+
+-; The first alternative is used only to compute proper length of instruction.
+-; Reload's algorithm does not take into account the cost of spill instructions
+-; needed to free register in given class, so avoid it from choosing the first
+-; alternative when eax is not available.
+-
+ (define_insn "*movhi_1"
+- [(set (match_operand:HI 0 "nonimmediate_operand" "=*?a,r,r,*?a,r,m")
+- (match_operand:HI 1 "general_operand" "i,r,rn,rm,rm,rn"))]
++ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
++ (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
+ "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
+ {
+ switch (get_attr_type (insn))
+@@ -1872,36 +1864,35 @@
+ }
+ }
+ [(set (attr "type")
+- (cond [(and (eq_attr "alternative" "0,1")
++ (cond [(and (eq_attr "alternative" "0")
+ (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
+ (const_int 0))
+ (eq (symbol_ref "TARGET_HIMODE_MATH")
+ (const_int 0))))
+ (const_string "imov")
+- (and (eq_attr "alternative" "2,3,4")
++ (and (eq_attr "alternative" "1,2")
+ (match_operand:HI 1 "aligned_operand" ""))
+ (const_string "imov")
+ (and (ne (symbol_ref "TARGET_MOVX")
+ (const_int 0))
+- (eq_attr "alternative" "0,1,3,4"))
++ (eq_attr "alternative" "0,2"))
+ (const_string "imovx")
+ ]
+ (const_string "imov")))
+ (set (attr "mode")
+ (cond [(eq_attr "type" "imovx")
+ (const_string "SI")
+- (and (eq_attr "alternative" "2,3,4")
++ (and (eq_attr "alternative" "1,2")
+ (match_operand:HI 1 "aligned_operand" ""))
+ (const_string "SI")
+- (and (eq_attr "alternative" "0,1")
++ (and (eq_attr "alternative" "0")
+ (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
+ (const_int 0))
+ (eq (symbol_ref "TARGET_HIMODE_MATH")
+ (const_int 0))))
+ (const_string "SI")
+ ]
+- (const_string "HI")))
+- (set_attr "modrm" "0,*,*,0,*,*")])
++ (const_string "HI")))])
+
+ ;; Stores and loads of ax to arbitary constant address.
+ ;; We fake an second form of instruction to force reload to load address
+@@ -12961,13 +12952,14 @@
+ ""
+ "%+j%C1\t%l0"
+ [(set_attr "type" "ibr")
+- (set (attr "prefix_0f")
++ (set_attr "modrm" "0")
++ (set (attr "length")
+ (if_then_else (and (ge (minus (match_dup 0) (pc))
+- (const_int -128))
++ (const_int -126))
+ (lt (minus (match_dup 0) (pc))
+- (const_int 124)))
+- (const_int 0)
+- (const_int 1)))])
++ (const_int 128)))
++ (const_int 2)
++ (const_int 6)))])
+
+ (define_insn "*jcc_2"
+ [(set (pc)
+@@ -12978,13 +12970,14 @@
+ ""
+ "%+j%c1\t%l0"
+ [(set_attr "type" "ibr")
+- (set (attr "prefix_0f")
++ (set_attr "modrm" "0")
++ (set (attr "length")
+ (if_then_else (and (ge (minus (match_dup 0) (pc))
+- (const_int -128))
++ (const_int -126))
+ (lt (minus (match_dup 0) (pc))
+- (const_int 124)))
+- (const_int 0)
+- (const_int 1)))])
++ (const_int 128)))
++ (const_int 2)
++ (const_int 6)))])
+
+ ;; In general it is not safe to assume too much about CCmode registers,
+ ;; so simplify-rtx stops when it sees a second one. Under certain
+@@ -13244,7 +13237,15 @@
+ (label_ref (match_operand 0 "" "")))]
+ ""
+ "jmp\t%l0"
+- [(set_attr "type" "ibr")])
++ [(set_attr "type" "ibr")
++ (set (attr "length")
++ (if_then_else (and (ge (minus (match_dup 0) (pc))
++ (const_int -126))
++ (lt (minus (match_dup 0) (pc))
++ (const_int 128)))
++ (const_int 2)
++ (const_int 5)))
++ (set_attr "modrm" "0")])
+
+ (define_expand "indirect_jump"
+ [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))]
+@@ -13357,14 +13358,17 @@
+ return "dec{l}\t%1\;%+jne\t%l0";
+ }
+ [(set_attr "ppro_uops" "many")
+- (set (attr "type")
++ (set (attr "length")
+ (if_then_else (and (eq_attr "alternative" "0")
+ (and (ge (minus (match_dup 0) (pc))
+- (const_int -128))
++ (const_int -126))
+ (lt (minus (match_dup 0) (pc))
+- (const_int 124))))
+- (const_string "ibr")
+- (const_string "multi")))])
++ (const_int 128))))
++ (const_int 2)
++ (const_int 16)))
++ ;; We don't know the type before shorten branches. Optimistically expect
++ ;; the loop instruction to match.
++ (set (attr "type") (const_string "ibr"))])
+
+ (define_split
+ [(set (pc)
+@@ -13879,7 +13883,6 @@
+ [(set_attr "length_immediate" "0")
+ (set_attr "length" "1")
+ (set_attr "modrm" "0")
+- (set_attr "modrm" "0")
+ (set_attr "athlon_decode" "vector")
+ (set_attr "ppro_uops" "few")])
+
+@@ -13891,7 +13894,6 @@
+ "leave"
+ [(set_attr "length_immediate" "0")
+ (set_attr "length" "1")
+- (set_attr "modrm" "0")
+ (set_attr "modrm" "0")
+ (set_attr "athlon_decode" "vector")
+ (set_attr "ppro_uops" "few")])
+Index:. gcc/config/i386/i386.c
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
+retrieving revision 1.368.2.19.2.11
+diff -u -p -r1.368.2.19.2.11 i386.c
+--- gcc/config/i386/i386.c 28 Feb 2003 17:31:34 -0000 1.368.2.19.2.11
++++ gcc/config/i386/i386.c 10 Mar 2003 20:26:37 -0000
+@@ -9939,7 +9939,8 @@ memory_address_length (addr)
+ if (disp)
+ {
+ if (GET_CODE (disp) == CONST_INT
+- && CONST_OK_FOR_LETTER_P (INTVAL (disp), 'K'))
++ && CONST_OK_FOR_LETTER_P (INTVAL (disp), 'K')
++ && base)
+ len = 1;
+ else
+ len = 4;
+@@ -10002,6 +10003,26 @@ ix86_attr_length_address_default (insn)
+ rtx insn;
+ {
+ int i;
++
++ if (get_attr_type (insn) == TYPE_LEA)
++ {
++ rtx set = PATTERN (insn);
++ if (GET_CODE (set) == SET)
++ ;
++ else if (GET_CODE (set) == PARALLEL
++ && GET_CODE (XVECEXP (set, 0, 0)) == SET)
++ set = XVECEXP (set, 0, 0);
++ else
++ {
++#ifdef ENABLE_CHECKING
++ abort ();
++#endif
++ return 0;
++ }
++
++ return memory_address_length (SET_SRC (set));
++ }
++
+ extract_insn_cached (insn);
+ for (i = recog_data.n_operands - 1; i >= 0; --i)
+ if (GET_CODE (recog_data.operand[i]) == MEM)
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.2-r2 b/sys-devel/gcc/files/digest-gcc-3.2.2-r2
new file mode 100644
index 000000000000..7d38323148b9
--- /dev/null
+++ b/sys-devel/gcc/files/digest-gcc-3.2.2-r2
@@ -0,0 +1,3 @@
+MD5 962a2057a2572226bc99aaeba4255e9b gcc-3.2.2.tar.bz2 20311217
+MD5 c71dd70b642cde15c96adaf87a429e3a gcc-3.2.2-branch-update-20030322.patch.bz2 72073
+MD5 232534e6fbe25667b95c7f668f0d11ef gcc-3.2.2-tls-update2.patch.bz2 595649
diff --git a/sys-devel/gcc/gcc-3.2.2-r2.ebuild b/sys-devel/gcc/gcc-3.2.2-r2.ebuild
new file mode 100644
index 000000000000..b40ab40396d2
--- /dev/null
+++ b/sys-devel/gcc/gcc-3.2.2-r2.ebuild
@@ -0,0 +1,522 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.2-r2.ebuild,v 1.1 2003/03/23 15:40:10 azarah Exp $
+
+IUSE="static nls bootstrap java build"
+
+inherit eutils flag-o-matic libtool
+
+# Compile problems with these (bug #6641 among others)...
+filter-flags "-fno-exceptions -fomit-frame-pointer"
+
+# Recently there has been a lot of stability problem in Gentoo-land. Many
+# things can be the cause to this, but I believe that it is due to gcc3
+# still having issues with optimizations, or with it not filtering bad
+# combinations (protecting the user maybe from himeself) yet.
+#
+# This can clearly be seen in large builds like glibc, where too aggressive
+# CFLAGS cause the tests to fail miserbly.
+#
+# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
+# knows what he is talking about:
+#
+# People really shouldn't force code-specific options on... It's a
+# bad idea. The -march options aren't just to look pretty. They enable
+# options that are sensible (and include sse,mmx,3dnow when apropriate).
+#
+# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
+# you do not like it, comment it, but do not bugreport if you run into
+# problems.
+#
+# <azarah@gentoo.org> (13 Oct 2002)
+strip-flags
+
+# Theoretical cross compiler support
+[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
+
+LOC="/usr"
+MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
+MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
+
+LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
+BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
+DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
+# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
+# We will handle /usr/include/g++-v3/ with gcc-config ...
+STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
+
+# Patch tarball support ...
+#PATCH_VER="1.0"
+PATCH_VER=""
+
+# Snapshot support ...
+#SNAPSHOT="2002-08-12"
+SNAPSHOT=""
+
+# Branch update support ...
+MAIN_BRANCH="${PV}" # Tarball, etc used ...
+#BRANCH_UPDATE="20021208"
+BRANCH_UPDATE="20030322"
+
+if [ -z "${SNAPSHOT}" ]
+then
+ S="${WORKDIR}/${PN}-${MAIN_BRANCH}"
+ SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${PN}-${MAIN_BRANCH}.tar.bz2"
+
+ if [ -n "${PATCH_VER}" ]
+ then
+ SRC_URI="${SRC_URI}
+ mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
+ fi
+
+ if [ -n "${BRANCH_UPDATE}" ]
+ then
+ SRC_URI="${SRC_URI}
+ mirror://gentoo/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2"
+ fi
+else
+ S="${WORKDIR}/gcc-${SNAPSHOT//-}"
+ SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
+fi
+#SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
+SRC_URI="${SRC_URI} mirror://gentoo/${P}-tls-update2.patch.bz2"
+
+DESCRIPTION="The GNU Compiler Collection. Includes C/C++ and java compilers"
+HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
+
+LICENSE="GPL-2 LGPL-2.1"
+KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips"
+
+# Ok, this is a hairy one again, but lets assume that we
+# are not cross compiling, than we want SLOT to only contain
+# $PV, as people upgrading to new gcc layout will not have
+# their old gcc unmerged ...
+if [ "${CHOST}" == "${CCHOST}" ]
+then
+ SLOT="${MY_PV}"
+else
+ SLOT="${CCHOST}-${MY_PV}"
+fi
+
+DEPEND="virtual/glibc
+ mips? >=sys-devel/binutils-2.13.90.0.16 : >=sys-devel/binutils-2.13.90.0.18
+ >=sys-devel/gcc-config-1.3.1
+ !build? ( >=sys-libs/ncurses-5.2-r2
+ nls? ( sys-devel/gettext ) )"
+
+RDEPEND="virtual/glibc
+ >=sys-devel/gcc-config-1.3.1
+ >=sys-libs/zlib-1.1.4
+ >=sys-apps/texinfo-4.2-r4
+ !build? ( >=sys-libs/ncurses-5.2-r2 )"
+
+PDEPEND="sys-devel/gcc-config"
+
+
+# Hack used to patch Makefiles to install into the build dir
+FAKE_ROOT=""
+
+chk_gcc_version() {
+ # This next bit is for updating libtool linker scripts ...
+ OLD_GCC_VERSION="`gcc -dumpversion`"
+
+ if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
+ then
+ echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
+ fi
+
+ # Did we check the version ?
+ touch ${WORKDIR}/.chkgccversion
+}
+
+src_unpack() {
+ if [ -z "${SNAPSHOT}" ]
+ then
+ unpack ${PN}-${MAIN_BRANCH}.tar.bz2
+
+ if [ -n "${PATCH_VER}" ]
+ then
+ unpack ${P}-patches-${PATCH_VER}.tar.bz2
+ fi
+ else
+ unpack gcc-${SNAPSHOT//-}.tar.bz2
+ fi
+
+ cd ${S}
+ # Fixup libtool to correctly generate .la files with portage
+ elibtoolize --portage --shallow
+
+ echo
+
+ # Branch update ...
+ if [ -n "${BRANCH_UPDATE}" ]
+ then
+ epatch ${DISTDIR}/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2
+ fi
+
+ # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
+ if [ -n "${PATCH_VER}" ]
+ then
+ epatch ${WORKDIR}/patch
+ fi
+
+ # Update to support TLS and __thread
+ epatch ${DISTDIR}/${P}-tls-update2.patch.bz2
+
+ # Patches from Redhat ...
+# epatch ${FILESDIR}/3.2.1/gcc32-ada-make.patch
+# epatch ${FILESDIR}/3.2.1/gcc32-shared-pthread.patch
+ use sparc && epatch ${FILESDIR}/3.2.1/gcc32-sparc32-hack.patch
+
+ # Patches from Mandrake/Suse ...
+ epatch ${FILESDIR}/3.2.1/gcc31-loop-load-final-value.patch
+ epatch ${FILESDIR}/3.2.1/gcc32-strip-dotdot.patch
+ epatch ${FILESDIR}/3.2.1/gcc32-athlon-alignment.patch
+
+ # GCC bugfixes ...
+ epatch ${FILESDIR}/3.2.2/gcc32-pr7768.patch
+ epatch ${FILESDIR}/3.2.2/gcc32-pr8213.patch
+# epatch ${FILESDIR}/3.2.2/gcc32-pr9732.patch
+# epatch ${FILESDIR}/3.2.2/gcc322-pr9888.patch
+ epatch ${FILESDIR}/3.2.2/gcc322-pr8746.patch
+
+ # Patches from debian-arm
+ if [ "${ARCH}" = "arm" ]
+ then
+ epatch ${FILESDIR}/3.2.1/gcc32-arm-disable-mathf.patch
+ epatch ${FILESDIR}/3.2.1/gcc32-arm-reload1-fix.patch
+ fi
+
+ # Get gcc to decreases the number of times the collector has to be run
+ # by increasing its memory workspace, bug #16548.
+ epatch ${FILESDIR}/3.2.2/gcc322-ggc_page-speedup.patch
+
+ # Install our pre generated manpages if we do not have perl ...
+# if [ ! -x /usr/bin/perl ]
+# then
+# cd ${S}; unpack ${P}-manpages.tar.bz2
+# fi
+
+ # Currently if any path is changed via the configure script, it breaks
+ # installing into ${D}. We should not patch it in src_install() with
+ # absolute paths, as some modules then gets rebuild with the wrong
+ # paths. Thus we use $FAKE_ROOT.
+ einfo "Fixing Makefiles..."
+ cd ${S}
+ for x in $(find . -name Makefile.in)
+ do
+ # Fix --datadir=
+ cp ${x} ${x}.orig
+ sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
+ ${x}.orig > ${x}
+
+ # Fix --bindir=
+ cp ${x} ${x}.orig
+ sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
+ ${x}.orig > ${x}
+
+ # Fix --includedir=
+ cp ${x} ${x}.orig
+ sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
+ ${x}.orig > ${x}
+
+ # Fix --with-gxx-include-dir=
+ cp ${x} ${x}.orig
+ sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
+ -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
+ ${x}.orig > ${x}
+
+ # Where java security stuff should be installed
+ cp ${x} ${x}.orig
+ sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
+ ${x}.orig > ${x}
+
+ rm -f ${x}.orig
+ done
+}
+
+src_compile() {
+ local myconf=""
+ local gcc_lang=""
+
+ if [ -z "`use build`" ]
+ then
+ myconf="${myconf} --enable-shared"
+ gcc_lang="c,c++,ada,f77,objc"
+ else
+ gcc_lang="c"
+ fi
+ if [ -z "`use nls`" ] || [ "`use build`" ]
+ then
+ myconf="${myconf} --disable-nls"
+ else
+ myconf="${myconf} --enable-nls --without-included-gettext"
+ fi
+ if [ -n "`use java`" ] && [ -z "`use build`" ]
+ then
+ gcc_lang="${gcc_lang},java"
+ fi
+
+ # In general gcc does not like optimization, and add -O2 where
+ # it is safe.
+ export CFLAGS="${CFLAGS//-O?}"
+ export CXXFLAGS="${CXXFLAGS//-O?}"
+
+ # Build in a separate build tree
+ mkdir -p ${WORKDIR}/build
+ cd ${WORKDIR}/build
+
+ einfo "Configuring GCC..."
+ addwrite "/dev/zero"
+ ${S}/configure --prefix=${LOC} \
+ --bindir=${BINPATH} \
+ --includedir=${LIBPATH}/include \
+ --datadir=${DATAPATH} \
+ --mandir=${DATAPATH}/man \
+ --infodir=${DATAPATH}/info \
+ --enable-shared \
+ --host=${CHOST} \
+ --target=${CCHOST} \
+ --with-system-zlib \
+ --enable-languages=${gcc_lang} \
+ --enable-threads=posix \
+ --enable-long-long \
+ --disable-checking \
+ --enable-cstdio=stdio \
+ --enable-clocale=generic \
+ --enable-__cxa_atexit \
+ --enable-version-specific-runtime-libs \
+ --with-gxx-include-dir=${STDCXX_INCDIR} \
+ --with-local-prefix=${LOC}/local \
+ ${myconf} || die
+
+ touch ${S}/gcc/c-gperf.h
+
+ # Do not make manpages if we do not have perl ...
+ if [ ! -x /usr/bin/perl ]
+ then
+ find ${S} -name '*.[17]' -exec touch {} \; || :
+ fi
+
+ # Setup -j in MAKEOPTS
+ get_number_of_jobs
+
+ einfo "Building GCC..."
+ if [ -z "`use static`" ]
+ then
+ # Fix for our libtool-portage.patch
+ S="${WORKDIR}/build" \
+ emake bootstrap-lean \
+ LIBPATH="${LIBPATH}" \
+ BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
+ # Above FLAGS optimize and speedup build, thanks
+ # to Jeff Garzik <jgarzik@mandrakesoft.com>
+ else
+ S="${WORKDIR}/build" \
+ emake LDFLAGS=-static bootstrap \
+ LIBPATH="${LIBPATH}" \
+ BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
+ fi
+}
+
+src_install() {
+ # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
+ # this can break the build.
+ for x in cd ${WORKDIR}/build/gcc/include/*
+ do
+ if [ -L ${x} ]
+ then
+ rm -f ${x}
+ fi
+ done
+
+ einfo "Installing GCC..."
+ # Do the 'make install' from the build directory
+ cd ${WORKDIR}/build
+ S="${WORKDIR}/build" \
+ make prefix=${D}${LOC} \
+ bindir=${D}${BINPATH} \
+ includedir=${D}${LIBPATH}/include \
+ datadir=${D}${DATAPATH} \
+ mandir=${D}${DATAPATH}/man \
+ infodir=${D}${DATAPATH}/info \
+ LIBPATH="${LIBPATH}" \
+ FAKE_ROOT="${D}" \
+ install || die
+
+ [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
+
+ dodir /lib /usr/bin
+ dodir /etc/env.d/gcc
+ echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ # Also set CC and CXX
+ echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+
+ # Install wrappers
+# Handled by gcc-config now ...
+# exeinto /lib
+# doexe ${FILESDIR}/cpp
+# exeinto /usr/bin
+# doexe ${FILESDIR}/cc
+
+ # Make sure we dont have stuff lying around that
+ # can nuke multiple versions of gcc
+ if [ -z "`use build`" ]
+ then
+ cd ${D}${LIBPATH}
+
+ # Tell libtool files where real libraries are
+ for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
+ do
+ if [ -f ${LA} ]
+ then
+ sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
+ mv ${LA}.hacked ${LA}
+ mv ${LA} ${D}${LIBPATH}
+ fi
+ done
+
+ # Move all the libraries to version specific libdir.
+ for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
+ do
+ [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
+ done
+
+ # Move Java headers to compiler-specific dir
+ for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
+ do
+ [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
+ done
+ for x in gcj gnu java javax org
+ do
+ if [ -d ${D}${LOC}/include/${x} ]
+ then
+ dodir /${LIBPATH}/include/${x}
+ mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
+ rm -rf ${D}${LOC}/include/${x}
+ fi
+ done
+
+ # Move libgcj.spec to compiler-specific directories
+ [ -f ${D}${LOC}/lib/libgcj.spec ] && \
+ mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
+
+ # Rename jar because it could clash with Kaffe's jar if this gcc is
+ # primary compiler (aka don't have the -<version> extension)
+ cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
+ [ -f jar ] && mv -f jar gcj-jar
+
+ # Move <cxxabi.h> to compiler-specific directories
+ [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
+ mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
+
+ # These should be symlinks
+ cd ${D}${BINPATH}
+ rm -f ${CCHOST}-{gcc,g++,c++,g77}
+ [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
+ [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
+ [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
+ [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
+ fi
+
+ # This one comes with binutils
+ if [ -f ${D}${LOC}/lib/libiberty.a ]
+ then
+ rm -f ${D}${LOC}/lib/libiberty.a
+ fi
+
+ cd ${S}
+ if [ -z "`use build`" ]
+ then
+ cd ${S}
+ docinto /${CCHOST}
+ dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
+ docinto ${CCHOST}/html
+ dohtml *.html
+ cd ${S}/boehm-gc
+ docinto ${CCHOST}/boehm-gc
+ dodoc ChangeLog doc/{README*,barrett_diagram}
+ docinto ${CCHOST}/boehm-gc/html
+ dohtml doc/*.html
+ cd ${S}/gcc
+ docinto ${CCHOST}/gcc
+ dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
+ cd ${S}/libf2c
+ docinto ${CCHOST}/libf2c
+ dodoc ChangeLog README TODO *.netlib
+ cd ${S}/libffi
+ docinto ${CCHOST}/libffi
+ dodoc ChangeLog* LICENSE README
+ cd ${S}/libiberty
+ docinto ${CCHOST}/libiberty
+ dodoc ChangeLog COPYING.LIB README
+ cd ${S}/libobjc
+ docinto ${CCHOST}/libobjc
+ dodoc ChangeLog README* THREADS*
+ cd ${S}/libstdc++-v3
+ docinto ${CCHOST}/libstdc++-v3
+ dodoc ChangeLog* README
+ docinto ${CCHOST}/libstdc++-v3/html
+ dohtml -r -a css,diff,html,txt,xml docs/html/*
+ cp -f docs/html/17_intro/[A-Z]* \
+ ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
+
+ if [ -n "`use java`" ]
+ then
+ cd ${S}/fastjar
+ docinto ${CCHOST}/fastjar
+ dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
+ cd ${S}/libjava
+ docinto ${CCHOST}/libjava
+ dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
+ fi
+ else
+ rm -rf ${D}/usr/share/{man,info}
+ fi
+
+ # Rather install the script, else portage with changing $FILESDIR
+ # between binary and source package borks things ....
+ insinto /lib/rcscripts/awk
+ doins ${FILESDIR}/awk/fixlafiles.awk
+ exeinto /sbin
+ doexe ${FILESDIR}/fix_libtool_files.sh
+
+ # Fix ncurses b0rking
+ find ${D}/ -name '*curses.h' -exec rm -f {} \;
+}
+
+pkg_preinst() {
+
+ if [ ! -f "${WORKDIR}/.chkgccversion" ]
+ then
+ chk_gcc_version
+ fi
+}
+
+pkg_postinst() {
+
+ export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}"
+
+ if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" = "${CCHOST}" ]
+ then
+ gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
+ fi
+
+ # Update libtool linker scripts to reference new gcc version ...
+ if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
+ then
+ OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
+
+ /sbin/fix_libtool_files.sh ${OLD_GCC_VERSION}
+ fi
+
+ # Fix ncurses b0rking (if r5 isn't unmerged)
+ find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
+}
+