diff options
Diffstat (limited to 'sys-devel/gcc/files')
19 files changed, 2095 insertions, 0 deletions
diff --git a/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch b/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch new file mode 100644 index 0000000..507d42f --- /dev/null +++ b/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch @@ -0,0 +1,22 @@ +--- configure.in.old 2004-06-26 07:01:06.000000000 +0200 ++++ configure.in 2004-06-26 07:02:55.000000000 +0200 +@@ -52,8 +52,7 @@ + host_tools="texinfo byacc flex bison binutils ld gas gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator libtool gettext zip fastjar" + + # libgcj represents the runtime libraries only used by gcj. +-libgcj="target-libffi \ +- target-boehm-gc \ ++libgcj="target-boehm-gc \ + target-zlib \ + target-qthreads \ + target-libjava" +@@ -66,7 +65,8 @@ + target-newlib \ + ${libstdcxx_version} \ + target-libf2c \ +- ${libgcj} ++ ${libgcj} \ ++ target-libffi \ + target-libobjc" + + # these tools are built using the target libs, and are intended to run only diff --git a/sys-devel/gcc/files/3.4.1/gcc-3.4.1-mips-n32only.patch b/sys-devel/gcc/files/3.4.1/gcc-3.4.1-mips-n32only.patch new file mode 100644 index 0000000..6fba12b --- /dev/null +++ b/sys-devel/gcc/files/3.4.1/gcc-3.4.1-mips-n32only.patch @@ -0,0 +1,17 @@ +Index: gcc/config/mips/t-linux64 +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/config/mips/t-linux64,v +retrieving revision 1.3 +diff -u -r1.3 t-linux64 +--- gcc/config/mips/t-linux64 4 Jun 2003 05:35:15 -0000 1.3 ++++ gcc/config/mips/t-linux64 10 Aug 2004 18:26:26 -0000 +@@ -1,6 +1,6 @@ +-MULTILIB_OPTIONS = mabi=32/mabi=n32/mabi=64 +-MULTILIB_DIRNAMES = o32 32 64 +-MULTILIB_OSDIRNAMES = ../lib ../lib32 ../lib64 ++MULTILIB_OPTIONS = mabi=n32 ++MULTILIB_DIRNAMES = ++MULTILIB_OSDIRNAMES = + + EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o + diff --git a/sys-devel/gcc/files/3.4.1/gcc-3.4.1-mips-n64only.patch b/sys-devel/gcc/files/3.4.1/gcc-3.4.1-mips-n64only.patch new file mode 100644 index 0000000..81baf62 --- /dev/null +++ b/sys-devel/gcc/files/3.4.1/gcc-3.4.1-mips-n64only.patch @@ -0,0 +1,17 @@ +Index: gcc/config/mips/t-linux64 +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/config/mips/t-linux64,v +retrieving revision 1.3 +diff -u -r1.3 t-linux64 +--- gcc/config/mips/t-linux64 4 Jun 2003 05:35:15 -0000 1.3 ++++ gcc/config/mips/t-linux64 10 Aug 2004 18:26:53 -0000 +@@ -1,6 +1,6 @@ +-MULTILIB_OPTIONS = mabi=32/mabi=n32/mabi=64 +-MULTILIB_DIRNAMES = o32 32 64 +-MULTILIB_OSDIRNAMES = ../lib ../lib32 ../lib64 ++MULTILIB_OPTIONS = mabi=n64 ++MULTILIB_DIRNAMES = ++MULTILIB_OSDIRNAMES = + + EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o + diff --git a/sys-devel/gcc/files/3.4.2/gcc-3.4.2-mips-ip28_cache_barriers-v4.patch b/sys-devel/gcc/files/3.4.2/gcc-3.4.2-mips-ip28_cache_barriers-v4.patch new file mode 100644 index 0000000..02edc37 --- /dev/null +++ b/sys-devel/gcc/files/3.4.2/gcc-3.4.2-mips-ip28_cache_barriers-v4.patch @@ -0,0 +1,366 @@ +diff -Naurp gcc-3.4.6.orig/gcc/config/mips/mips.c gcc-3.4.6/gcc/config/mips/mips.c +--- gcc-3.4.6.orig/gcc/config/mips/mips.c 2005-07-31 04:35:15.000000000 -0400 ++++ gcc-3.4.6/gcc/config/mips/mips.c 2006-04-08 17:41:44.000000000 -0400 +@@ -8801,6 +8801,11 @@ mips_reorg (void) + dbr_schedule (get_insns (), rtl_dump_file); + mips_avoid_hazards (); + } ++ if (mips_r10k_cache_barrier) ++ { ++ static int r10k_insert_cache_barriers (void); ++ r10k_insert_cache_barriers (); ++ } + } + + /* We need to use a special set of functions to handle hard floating +@@ -9661,5 +9666,5 @@ irix_section_type_flags (tree decl, cons + } + + #endif /* TARGET_IRIX */ +- ++#include "r10k-cacheb.c" + #include "gt-mips.h" +diff -Naurp gcc-3.4.6.orig/gcc/config/mips/mips.h gcc-3.4.6/gcc/config/mips/mips.h +--- gcc-3.4.6.orig/gcc/config/mips/mips.h 2004-07-14 20:42:49.000000000 -0400 ++++ gcc-3.4.6/gcc/config/mips/mips.h 2006-04-08 17:41:01.000000000 -0400 +@@ -122,6 +122,7 @@ extern const char *mips_tune_string; + extern const char *mips_isa_string; /* for -mips{1,2,3,4} */ + extern const char *mips_abi_string; /* for -mabi={32,n32,64} */ + extern const char *mips_cache_flush_func;/* for -mflush-func= and -mno-flush-func */ ++extern const char *mips_r10k_cache_barrier;/* for -mr10k-cache-barrier[={1,2}] */ + extern int mips_string_length; /* length of strings for mips16 */ + extern const struct mips_cpu_info mips_cpu_info_table[]; + extern const struct mips_cpu_info *mips_arch_info; +@@ -752,6 +753,10 @@ extern const struct mips_cpu_info *mips_ + N_("Don't call any cache flush functions"), 0}, \ + { "flush-func=", &mips_cache_flush_func, \ + N_("Specify cache flush function"), 0}, \ ++ { "r10k-cache-barrier", &mips_r10k_cache_barrier, \ ++ N_("[=1|2]\tGenerate cache barriers for SGI Indigo2/O2 R10k"), 0}, \ ++ { "ip28-cache-barrier", &mips_r10k_cache_barrier, \ ++ N_(""), 0}, \ + } + + /* This is meant to be redefined in the host dependent files. */ +diff -Naurp gcc-3.4.6.orig/gcc/config/mips/r10k-cacheb.c gcc-3.4.6/gcc/config/mips/r10k-cacheb.c +--- gcc-3.4.6.orig/gcc/config/mips/r10k-cacheb.c 1969-12-31 19:00:00.000000000 -0500 ++++ gcc-3.4.6/gcc/config/mips/r10k-cacheb.c 2006-04-08 17:41:22.000000000 -0400 +@@ -0,0 +1,318 @@ ++/* Subroutines used for MIPS code generation: generate cache-barriers ++ for SiliconGraphics IP28 and IP32/R10000 kernel-code. ++ Copyright (C) 2005,2006 peter fuerst, pf@net.alphadv.de. ++ ++This file is intended to become part of GCC. ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published ++by the Free Software Foundation; either version 2, or (at your ++option) any later version. ++ ++This file is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING. If not, write to the ++Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, ++MA 02110-1301 USA. */ ++ ++ ++#define ASM_R10K_CACHE_BARRIER "cache 0x14,0($sp)" ++ ++/* Some macros, ported back from 4.x ... */ ++ ++#define CALL_P(X) (GET_CODE (X) == CALL_INSN) ++#define MEM_P(X) (GET_CODE (X) == MEM) ++#define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN) ++ ++#define SEQ_BEGIN(insn) \ ++ (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE \ ++ ? XVECEXP (PATTERN (insn), 0, 0) \ ++ : (insn)) ++ ++#define SEQ_END(insn) \ ++ (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE \ ++ ? XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1) \ ++ : (insn)) ++ ++#define FOR_EACH_SUBINSN(subinsn, insn) \ ++ for ((subinsn) = SEQ_BEGIN (insn); \ ++ (subinsn) != NEXT_INSN (SEQ_END (insn)); \ ++ (subinsn) = NEXT_INSN (subinsn)) ++ ++ ++/* Nonzero means generate special cache barriers to inhibit speculative ++ stores which might endanger cache coherency or reference invalid ++ addresses (especially on SGI's Indigo2 R10k (IP28)). */ ++const char *mips_r10k_cache_barrier; ++static int TARGET_R10K_SPECEX; ++ ++/* Check, whether an instruction is a possibly harmful store instruction, ++ i.e. a store which might cause damage, if speculatively executed. */ ++ ++/* Return truth value whether the expression `*memx' instantiates ++ (mem:M (not (stackpointer_address or constant))). */ ++ ++static int ++is_stack_pointer (rtx *x, void *data) ++{ ++ return (*x == stack_pointer_rtx); ++} ++ ++static int ++check_p_mem_expr (rtx *memx, void *data) ++{ ++ if (!MEM_P (*memx) || for_each_rtx (memx, is_stack_pointer, 0)) ++ return 0; ++ ++ /* Stores/Loads to/from constant addresses can be considered ++ harmless, since: ++ 1) the address is always valid, even when taken speculatively. ++ 2a) the location is (hopefully) never used as a dma-target, thus ++ there is no danger of cache-inconsistency. ++ 2b) uncached loads/stores are guaranteed to be non-speculative. */ ++ if ( CONSTANT_P(XEXP (*memx, 0)) ) ++ return 0; ++ ++ return 1; ++} ++ ++/* Return truth value whether we find (set (mem:M (non_stackpointer_address) ++ ...)) in instruction-pattern `body'. ++ Here we assume, that addressing with the stackpointer accesses neither ++ uncached-aliased nor invalid memory. ++ (May be, this applies to the global pointer and frame pointer also, ++ but its saver not to assume it. And probably it's not worthwile to ++ regard these registers) ++ ++ Speculative loads from invalid addresses also cause bus errors... ++ So check for (set (reg:M ...) (mem:M (non_stackpointer_address))) ++ too, unless there is an enhanced bus-error handler. */ ++ ++static int ++check_p_pattern_for_store (rtx *body, void *data) ++{ ++ if (*body && GET_CODE (*body) == SET) ++ { ++ /* Cache-barriers for SET_SRC may be requested as well. */ ++ if (!(TARGET_R10K_SPECEX & 2)) ++ body = &SET_DEST(*body); ++ ++ if (for_each_rtx (body, check_p_mem_expr, 0)) ++ return 1; ++ ++ /* Don't traverse sub-expressions again. */ ++ return -1; ++ } ++ return 0; ++} ++ ++static int ++strmatch (const char *txt, const char *match) ++{ ++ return !strncmp(txt, match, strlen (match)); ++} ++ ++/* Check for (ins (set (mem:M (dangerous_address)) ...)) or end of the ++ current basic block in instruction `insn'. ++ `state': (internal) recursion-counter and delayslot-flag ++ Criteria to recognize end-of/next basic-block are reduplicated here ++ from final_scan_insn. ++ return >0: `insn' is critical. ++ return <0: `insn' is at end of current basic-block. ++ return 0: `insn' can be ignored. */ ++ ++static int ++check_insn_for_store (int state, rtx insn) ++{ ++ rtx body; ++ ++ if (INSN_DELETED_P (insn)) ++ return 0; ++ ++ if (LABEL_P (insn)) ++ return -1; ++ ++ if (CALL_P (insn) || JUMP_P (insn) || NONJUMP_INSN_P (insn)) ++ { ++ body = PATTERN (insn); ++ if (GET_CODE (body) == SEQUENCE) ++ { ++ /* A delayed-branch sequence. */ ++ rtx insq; ++ FOR_EACH_SUBINSN(insq, insn) ++ if (! INSN_DELETED_P (insq)) ++ { ++ /* |1: delay-slot completely contained in sequence. */ ++ if (check_insn_for_store (8+state|1, insq) > 0) ++ return 1; ++ } ++ /* Following a (conditional) branch sequence, we have a new ++ basic block. */ ++ if (JUMP_P (SEQ_BEGIN(insn))) ++ return -1; ++ /* Handle a call sequence like a conditional branch sequence. */ ++ if (CALL_P (SEQ_BEGIN(insn))) ++ return -1; ++ } ++ if (GET_CODE (body) == PARALLEL) ++ if (for_each_rtx (&body, check_p_pattern_for_store, 0)) ++ return 1; ++ ++ /* Now, only a `simple' INSN or JUMP_INSN remains to be checked. */ ++ if (NONJUMP_INSN_P (insn)) ++ { ++ /* Since we don't know what's inside, we must take inline ++ assembly to be dangerous. */ ++ if (GET_CODE (body) == ASM_INPUT) ++ { ++ const char *t = XSTR (body, 0); ++ if (t && !strmatch(t, ASM_R10K_CACHE_BARRIER)) ++ return 1; ++ } ++ ++ if (check_p_pattern_for_store (&body, 0) > 0) ++ return 1; ++ } ++ /* Handle a CALL_INSN instruction like a conditional branch. */ ++ if (JUMP_P (insn) || CALL_P (insn)) ++ { ++ /* Following a (conditional) branch, we have a new basic block. */ ++ /* But check insn(s) in delay-slot first. If we could know in ++ advance that this jump is in `.reorder' mode, where gas will ++ insert a `nop' into the delay-slot, we could skip this test. ++ Since we don't know, always assume `.noreorder', sometimes ++ emitting a cache-barrier, that isn't needed. */ ++ /* But if we are here recursively, already checking a (pseudo-) ++ delay-slot, we are done. */ ++ if ( !(state & 1) ) ++ for (insn = NEXT_INSN (insn); insn; insn = NEXT_INSN (insn)) ++ { ++ if (LABEL_P (insn) || CALL_P (insn) || JUMP_P (insn)) ++ /* Not in delay-slot at all. */ ++ break; ++ ++ if (NONJUMP_INSN_P (insn)) ++ { ++ if (GET_CODE (PATTERN (insn)) == SEQUENCE) ++ /* Not in delay-slot at all. */ ++ break; ++ ++ if (check_insn_for_store (8+state|1, insn) > 0) ++ return 1; ++ /* We're done anyway. */ ++ break; ++ } ++ /* skip NOTE,... */; ++ } ++ return -1; ++ } ++ } ++ return 0; ++} ++ ++ ++/* Scan a basic block, starting with `insn', for a possibly harmful store ++ instruction. If found, output a cache barrier at the start of this ++ block. */ ++ ++static int ++bb_insert_store_cache_barrier (rtx head, rtx nxtb) ++{ ++ rtx insn = head; ++ ++ if (!insn || insn == nxtb) ++ return 0; ++ ++ while ((insn = NEXT_INSN (insn)) && insn != nxtb) ++ { ++ int found; ++ ++ if (NOTE_INSN_BASIC_BLOCK_P(insn)) /* See scan_1_bb_for_store() */ ++ break; ++ ++ found = check_insn_for_store (0, insn); ++ if (found < 0) ++ break; ++ if (found > 0) ++ { ++ /* found critical store instruction */ ++ insn = gen_rtx_ASM_INPUT (VOIDmode, ++ ASM_R10K_CACHE_BARRIER "\t" ++ ASM_COMMENT_START " Cache Barrier"); ++ /* Here we rely on the assumption, that an explicit delay-slot ++ - if any - is already embedded (in a sequence) in 'head'! */ ++ insn = emit_insn_after (insn, head); ++ return 1; ++ } ++ } ++ return 0; ++} ++ ++ ++/* Scan one basic block for a possibly harmful store instruction. ++ If found, insert a cache barrier at the start of this block, ++ return number of inserted cache_barriers. */ ++ ++static int ++scan_1_bb_for_store (rtx head, rtx end) ++{ ++ rtx nxtb; ++ int count; ++ ++ /* Note: 'end' is not necessarily reached from 'head' (hidden in ++ SEQUENCE, PARALLEL), but 'nxtb' is. */ ++ nxtb = NEXT_INSN (end); ++ ++ /* Each basic block starts with zero or more CODE_LABEL(s), followed ++ by one NOTE_INSN_BASIC_BLOCK. ++ Note: bb_head may equal next_insn(bb_end) already ! */ ++ while (head && head != nxtb && LABEL_P (head)) ++ head = NEXT_INSN (head); ++ ++ if (!head || head == nxtb) ++ return 0; ++ ++ /* Handle the basic block itself, at most up to next CALL_INSN. */ ++ count = bb_insert_store_cache_barrier (head, nxtb); ++ ++ /* 1) Handle any CALL_INSN instruction like a conditional branch. ++ 2) There may be "basic blocks" in the list, which are no basic blocks ++ at all. (containing CODE_LABELs in the body or gathering several ++ other basic blocks (e.g. bb5 containing bb6,bb7,bb8)). */ ++ ++ while ((head = NEXT_INSN (head)) && head != nxtb) ++ { ++ if (INSN_DELETED_P (head)) ++ continue; ++ ++ /* Later we'll be called again for this bb on its own. */ ++ if (NOTE_INSN_BASIC_BLOCK_P(head)) ++ break; ++ ++ if (CALL_P (SEQ_BEGIN (head)) || LABEL_P (head)) ++ count += bb_insert_store_cache_barrier (head, nxtb); ++ } ++ return count; ++} ++ ++static int ++r10k_insert_cache_barriers (void) ++{ ++ if (mips_r10k_cache_barrier) ++ { ++ basic_block bb; ++ ++ const char *s = mips_r10k_cache_barrier; ++ /* Default is to protect stores (only). */ ++ TARGET_R10K_SPECEX = 1 | strtol(*s != '=' ? s:s+1, (char**)0, 0); ++ ++ FOR_EACH_BB (bb) ++ if (0 <= bb->index) ++ scan_1_bb_for_store (BB_HEAD (bb), BB_END (bb)); ++ } ++ return 0; ++} diff --git a/sys-devel/gcc/files/3.4.2/gcc-3.4.x-mips-add-march-r10k.patch b/sys-devel/gcc/files/3.4.2/gcc-3.4.x-mips-add-march-r10k.patch new file mode 100644 index 0000000..d02a5e9 --- /dev/null +++ b/sys-devel/gcc/files/3.4.2/gcc-3.4.x-mips-add-march-r10k.patch @@ -0,0 +1,460 @@ +diff -Naurp gcc-3.4.1.orig/gcc/config/mips/mips.c gcc-3.4.1/gcc/config/mips/mips.c +--- gcc-3.4.1.orig/gcc/config/mips/mips.c 2004-06-28 09:58:42.000000000 -0400 ++++ gcc-3.4.1/gcc/config/mips/mips.c 2004-08-09 22:37:21.983939192 -0400 +@@ -707,6 +707,7 @@ const struct mips_cpu_info mips_cpu_info + + /* MIPS IV */ + { "r8000", PROCESSOR_R8000, 4 }, ++ { "r10000", PROCESSOR_R10000, 4 }, + { "vr5000", PROCESSOR_R5000, 4 }, + { "vr5400", PROCESSOR_R5400, 4 }, + { "vr5500", PROCESSOR_R5500, 4 }, +@@ -9401,6 +9402,9 @@ mips_issue_rate (void) + { + switch (mips_tune) + { ++ case PROCESSOR_R10000: ++ return 4; ++ + case PROCESSOR_R5400: + case PROCESSOR_R5500: + case PROCESSOR_R7000: +diff -Naurp gcc-3.4.1.orig/gcc/config/mips/mips.h gcc-3.4.1/gcc/config/mips/mips.h +--- gcc-3.4.1.orig/gcc/config/mips/mips.h 2004-03-11 16:52:33.000000000 -0500 ++++ gcc-3.4.1/gcc/config/mips/mips.h 2004-08-09 01:02:35.042149496 -0400 +@@ -66,6 +66,7 @@ enum processor_type { + PROCESSOR_R7000, + PROCESSOR_R8000, + PROCESSOR_R9000, ++ PROCESSOR_R10000, + PROCESSOR_SB1, + PROCESSOR_SR71000 + }; +diff -Naurp gcc-3.4.1.orig/gcc/config/mips/mips.md gcc-3.4.1/gcc/config/mips/mips.md +--- gcc-3.4.1.orig/gcc/config/mips/mips.md 2004-06-25 03:35:30.000000000 -0400 ++++ gcc-3.4.1/gcc/config/mips/mips.md 2004-08-09 04:55:10.158649320 -0400 +@@ -103,6 +103,7 @@ + ;; arith integer arithmetic instruction + ;; darith double precision integer arithmetic instructions + ;; const load constant ++;; shift integer shift + ;; imul integer multiply + ;; imadd integer multiply-add + ;; idiv integer divide +@@ -120,7 +121,7 @@ + ;; multi multiword sequence (or user asm statements) + ;; nop no operation + (define_attr "type" +- "unknown,branch,jump,call,load,store,prefetch,prefetchx,move,condmove,xfer,hilo,const,arith,darith,imul,imadd,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,multi,nop" ++ "unknown,branch,jump,call,load,store,prefetch,prefetchx,move,condmove,xfer,hilo,const,arith,darith,shift,imul,imadd,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,multi,nop" + (cond [(eq_attr "jal" "!unset") (const_string "call") + (eq_attr "got" "load") (const_string "load")] + (const_string "unknown"))) +@@ -214,7 +215,7 @@ + ;; Attribute describing the processor. This attribute must match exactly + ;; with the processor_type enumeration in mips.h. + (define_attr "cpu" +- "default,4kc,5kc,20kc,m4k,r3000,r3900,r6000,r4000,r4100,r4111,r4120,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,sb1,sr71000" ++ "default,4kc,5kc,20kc,m4k,r3000,r3900,r6000,r4000,r4100,r4111,r4120,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,r10000,sb1,sr71000" + (const (symbol_ref "mips_tune"))) + + ;; The type of hardware hazard associated with this instruction. +@@ -305,12 +306,12 @@ + + (define_function_unit "memory" 1 0 + (and (eq_attr "type" "load") +- (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000")) ++ (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000,r10000")) + 3 0) + + (define_function_unit "memory" 1 0 + (and (eq_attr "type" "load") +- (eq_attr "cpu" "r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000")) ++ (eq_attr "cpu" "r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000,r10000")) + 2 0) + + (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0) +@@ -323,7 +324,7 @@ + + (define_function_unit "imuldiv" 1 0 + (and (eq_attr "type" "imul,imadd") +- (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000")) ++ (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000,r10000")) + 17 17) + + ;; On them mips16, we want to stronly discourage a mult from appearing +@@ -375,7 +376,7 @@ + + (define_function_unit "imuldiv" 1 0 + (and (eq_attr "type" "idiv") +- (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000")) ++ (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000,r10000")) + 38 38) + + (define_function_unit "imuldiv" 1 0 +@@ -424,6 +425,40 @@ + (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000"))) + 68 68) + ++;; R10000 has 2 integer ALUs ++(define_function_unit "alu" 2 0 ++ (and (eq_attr "type" "arith,darith,shift") ++ (eq_attr "cpu" "r10000")) ++ 1 0) ++ ++;; Only ALU1 can do shifts. We model shifts as an additional unit ++(define_function_unit "alu1" 1 0 ++ (and (eq_attr "type" "shift") ++ (eq_attr "cpu" "r10000")) ++ 1 0) ++ ++;; only ALU2 does multiplications and divisions ++(define_function_unit "alu2" 1 0 ++ (and (eq_attr "type" "imul") ++ (and (eq_attr "mode" "SI") (eq_attr "cpu" "r10000"))) ++ 6 6) ++ ++(define_function_unit "alu2" 1 0 ++ (and (eq_attr "type" "imul") ++ (and (eq_attr "mode" "DI") (eq_attr "cpu" "r10000"))) ++ 10 10) ++ ++(define_function_unit "alu2" 1 0 ++ (and (eq_attr "type" "idiv") ++ (and (eq_attr "mode" "SI") (eq_attr "cpu" "r10000"))) ++ 35 35) ++ ++(define_function_unit "alu2" 1 0 ++ (and (eq_attr "type" "idiv") ++ (and (eq_attr "mode" "DI") (eq_attr "cpu" "r10000"))) ++ 67 67) ++ ++ + ;; The R4300 does *NOT* have a separate Floating Point Unit, instead + ;; the FP hardware is part of the normal ALU circuitry. This means FP + ;; instructions affect the pipe-line, and no functional unit +@@ -432,11 +467,11 @@ + ;; instructions to be processed in the "imuldiv" unit. + + (define_function_unit "adder" 1 1 +- (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000")) ++ (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000,r10000")) + 3 0) + + (define_function_unit "adder" 1 1 +- (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r3900,r6000")) ++ (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r3900,r6000,r10000")) + 2 0) + + (define_function_unit "adder" 1 1 +@@ -444,7 +479,7 @@ + 1 0) + + (define_function_unit "adder" 1 1 +- (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r3900,r6000,r4300")) ++ (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r10000")) + 4 0) + + (define_function_unit "adder" 1 1 +@@ -456,6 +491,10 @@ + 3 0) + + (define_function_unit "adder" 1 1 ++ (and (eq_attr "type" "fadd,fmadd") (eq_attr "cpu" "r10000")) ++ 2 0) ++ ++(define_function_unit "adder" 1 1 + (and (eq_attr "type" "fabs,fneg") + (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4300,r5000")) + 2 0) +@@ -467,7 +506,7 @@ + (define_function_unit "mult" 1 1 + (and (eq_attr "type" "fmul") + (and (eq_attr "mode" "SF") +- (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000"))) ++ (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000,r10000"))) + 7 0) + + (define_function_unit "mult" 1 1 +@@ -487,7 +526,7 @@ + + (define_function_unit "mult" 1 1 + (and (eq_attr "type" "fmul") +- (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000"))) ++ (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000,r10000"))) + 8 0) + + (define_function_unit "mult" 1 1 +@@ -500,10 +539,14 @@ + (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000"))) + 6 0) + ++(define_function_unit "mult" 1 1 ++ (and (eq_attr "type" "fmul,fmadd") (eq_attr "cpu" "r10000")) ++ 2 0) ++ + (define_function_unit "divide" 1 1 + (and (eq_attr "type" "fdiv") + (and (eq_attr "mode" "SF") +- (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000"))) ++ (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000,r10000"))) + 23 0) + + (define_function_unit "divide" 1 1 +@@ -529,7 +572,7 @@ + (define_function_unit "divide" 1 1 + (and (eq_attr "type" "fdiv") + (and (eq_attr "mode" "DF") +- (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300"))) ++ (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r10000"))) + 36 0) + + (define_function_unit "divide" 1 1 +@@ -547,10 +590,21 @@ + (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650"))) + 61 0) + ++;; divisions keep multiplier busy on R10000 ++(define_function_unit "mult" 1 1 ++ (and (eq_attr "type" "fdiv") ++ (and (eq_attr "mode" "SF") (eq_attr "cpu" "r10000"))) ++ 12 14) ++ ++(define_function_unit "mult" 1 1 ++ (and (eq_attr "type" "fdiv") ++ (and (eq_attr "mode" "DF") (eq_attr "cpu" "r10000"))) ++ 19 21) ++ + ;;; ??? Is this number right? + (define_function_unit "divide" 1 1 + (and (eq_attr "type" "fsqrt,frsqrt") +- (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000"))) ++ (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000,r10000"))) + 54 0) + + (define_function_unit "divide" 1 1 +@@ -566,7 +620,7 @@ + ;;; ??? Is this number right? + (define_function_unit "divide" 1 1 + (and (eq_attr "type" "fsqrt,frsqrt") +- (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000"))) ++ (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000,r10000"))) + 112 0) + + (define_function_unit "divide" 1 1 +@@ -579,6 +633,17 @@ + (and (eq_attr "mode" "DF") (eq_attr "cpu" "r5000"))) + 36 0) + ++;; sqrt is executed by multiplier on R10000 ++(define_function_unit "mult" 1 1 ++ (and (eq_attr "type" "fsqrt") ++ (and (eq_attr "mode" "SF") (eq_attr "cpu" "r10000"))) ++ 18 20) ++ ++(define_function_unit "mult" 1 1 ++ (and (eq_attr "type" "fsqrt") ++ (and (eq_attr "mode" "DF") (eq_attr "cpu" "r10000"))) ++ 33 35) ++ + ;; R4300 FP instruction classes treated as part of the "imuldiv" + ;; functional unit: + +@@ -3157,7 +3222,7 @@ dsrl\t%3,%3,1\n\ + "@ + sll\t%0,%1,0 + sw\t%1,%0" +- [(set_attr "type" "darith,store") ++ [(set_attr "type" "shift,store") + (set_attr "mode" "SI") + (set_attr "extended_mips16" "yes,*")]) + +@@ -3191,7 +3256,7 @@ dsrl\t%3,%3,1\n\ + (match_operand:DI 2 "small_int" "I"))))] + "TARGET_64BIT && !TARGET_MIPS16 && INTVAL (operands[2]) >= 32" + "dsra\t%0,%1,%2" +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI")]) + + (define_insn "" +@@ -3200,7 +3265,7 @@ dsrl\t%3,%3,1\n\ + (const_int 32))))] + "TARGET_64BIT && !TARGET_MIPS16" + "dsra\t%0,%1,32" +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI")]) + + +@@ -5241,7 +5306,7 @@ dsrl\t%3,%3,1\n\ + + return "sll\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI")]) + + (define_insn "ashlsi3_internal1_extend" +@@ -5255,7 +5320,7 @@ dsrl\t%3,%3,1\n\ + + return "sll\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI")]) + + +@@ -5273,7 +5338,7 @@ dsrl\t%3,%3,1\n\ + + return "sll\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI") + (set_attr_alternative "length" + [(const_int 4) +@@ -5374,7 +5439,7 @@ sll\t%L0,%L1,%2\n\ + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); + return "sll\t%M0,%L1,%2\;move\t%L0,%."; + } +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr "length" "8")]) + +@@ -5429,7 +5494,7 @@ sll\t%L0,%L1,%2\n\ + + return "sll\t%M0,%M1,%2\;srl\t%3,%L1,%4\;or\t%M0,%M0,%3\;sll\t%L0,%L1,%2"; + } +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr "length" "16")]) + +@@ -5513,7 +5578,7 @@ sll\t%L0,%L1,%2\n\ + + return "dsll\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI")]) + + (define_insn "" +@@ -5530,7 +5595,7 @@ sll\t%L0,%L1,%2\n\ + + return "dsll\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr_alternative "length" + [(const_int 4) +@@ -5591,7 +5656,7 @@ sll\t%L0,%L1,%2\n\ + + return "sra\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI")]) + + (define_insn "ashrsi3_internal2" +@@ -5608,7 +5673,7 @@ sll\t%L0,%L1,%2\n\ + + return "sra\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI") + (set_attr_alternative "length" + [(const_int 4) +@@ -5705,7 +5770,7 @@ sra\t%M0,%M1,%2\n\ + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); + return "sra\t%L0,%M1,%2\;sra\t%M0,%M1,31"; + } +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr "length" "8")]) + +@@ -5760,7 +5825,7 @@ sra\t%M0,%M1,%2\n\ + + return "srl\t%L0,%L1,%2\;sll\t%3,%M1,%4\;or\t%L0,%L0,%3\;sra\t%M0,%M1,%2"; + } +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr "length" "16")]) + +@@ -5844,7 +5909,7 @@ sra\t%M0,%M1,%2\n\ + + return "dsra\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI")]) + + (define_insn "" +@@ -5858,7 +5923,7 @@ sra\t%M0,%M1,%2\n\ + + return "dsra\t%0,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr_alternative "length" + [(const_int 4) +@@ -5918,7 +5983,7 @@ sra\t%M0,%M1,%2\n\ + + return "srl\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI")]) + + (define_insn "lshrsi3_internal2" +@@ -5935,7 +6000,7 @@ sra\t%M0,%M1,%2\n\ + + return "srl\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "SI") + (set_attr_alternative "length" + [(const_int 4) +@@ -6056,7 +6121,7 @@ srl\t%M0,%M1,%2\n\ + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); + return "srl\t%L0,%M1,%2\;move\t%M0,%."; + } +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr "length" "8")]) + +@@ -6111,7 +6176,7 @@ srl\t%M0,%M1,%2\n\ + + return "srl\t%L0,%L1,%2\;sll\t%3,%M1,%4\;or\t%L0,%L0,%3\;srl\t%M0,%M1,%2"; + } +- [(set_attr "type" "darith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr "length" "16")]) + +@@ -6195,7 +6260,7 @@ srl\t%M0,%M1,%2\n\ + + return "dsrl\t%0,%1,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI")]) + + (define_insn "" +@@ -6209,7 +6274,7 @@ srl\t%M0,%M1,%2\n\ + + return "dsrl\t%0,%2"; + } +- [(set_attr "type" "arith") ++ [(set_attr "type" "shift") + (set_attr "mode" "DI") + (set_attr_alternative "length" + [(const_int 4) diff --git a/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch b/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch new file mode 100644 index 0000000..b5195e4 --- /dev/null +++ b/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch @@ -0,0 +1,40 @@ +diff -ur gcc-3.4.3/libffi/Makefile.in gcc-3.4.3-ffi-fixes/libffi/Makefile.in +--- gcc-3.4.3/libffi/Makefile.in 2003-11-22 08:41:32.000000000 -0500 ++++ gcc-3.4.3-ffi-fixes/libffi/Makefile.in 2004-11-28 17:31:50.000000000 -0500 +@@ -89,7 +89,7 @@ + libffi_basedir = @libffi_basedir@ + tool_include_dir = @tool_include_dir@ + toolexecdir = @toolexecdir@ +-toolexeclibdir = @toolexeclibdir@ ++toolexeclibdir = @toolexeclibdir@/@gcc_version@ + + AUTOMAKE_OPTIONS = cygnus + +diff -ur gcc-3.4.3/libffi/configure gcc-3.4.3-ffi-fixes/libffi/configure +--- gcc-3.4.3/libffi/configure 2004-05-18 05:08:39.000000000 -0400 ++++ gcc-3.4.3-ffi-fixes/libffi/configure 2004-11-28 17:48:19.000000000 -0500 +@@ -3800,8 +3800,8 @@ + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else +- toolexecdir='$(libdir)/gcc-lib/$(target_alias)' +- toolexeclibdir='$(libdir)' ++ toolexecdir='$(libdir)/gcc/$(target_alias)' ++ toolexeclibdir='$(libdir)/gcc/$(target_alias)/$(gcc-version)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in +diff -ur gcc-3.4.3/libffi/configure.in gcc-3.4.3-ffi-fixes/libffi/configure.in +--- gcc-3.4.3/libffi/configure.in 2004-04-27 01:10:19.000000000 -0400 ++++ gcc-3.4.3-ffi-fixes/libffi/configure.in 2004-11-28 17:40:30.000000000 -0500 +@@ -225,8 +225,8 @@ + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else +- toolexecdir='$(libdir)/gcc-lib/$(target_alias)' +- toolexeclibdir='$(libdir)' ++ toolexecdir='$(libdir)/gcc/$(target_alias)' ++ toolexeclibdir='$(libdir)/gcc/$(target_alias)/$(gcc_version)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in diff --git a/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch b/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch new file mode 100644 index 0000000..b270a06 --- /dev/null +++ b/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch @@ -0,0 +1,40 @@ +--- configure.in.orig 2004-08-03 00:53:36.000000000 +0200 ++++ configure.in 2004-08-03 00:52:35.000000000 +0200 +@@ -136,8 +136,7 @@ + host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar" + + # libgcj represents the runtime libraries only used by gcj. +-libgcj="target-libffi \ +- target-boehm-gc \ ++libgcj="target-boehm-gc \ + target-zlib \ + target-qthreads \ + target-libjava" +@@ -150,6 +150,7 @@ + target-libstdc++-v3 \ + target-libf2c \ + ${libgcj} \ ++ target-libffi \ + target-libobjc" + + # these tools are built using the target libraries, and are intended to +--- configure~ 2004-08-28 02:31:04.000000000 +0200 ++++ configure 2004-08-28 10:55:28.000000000 +0200 +@@ -876,8 +876,7 @@ + host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar" + + # libgcj represents the runtime libraries only used by gcj. +-libgcj="target-libffi \ +- target-boehm-gc \ ++libgcj="target-boehm-gc \ + target-zlib \ + target-qthreads \ + target-libjava" +@@ -891,6 +890,7 @@ + target-libstdc++-v3 \ + target-libf2c \ + ${libgcj} \ ++ target-libffi \ + target-libobjc" + + # these tools are built using the target libraries, and are intended to diff --git a/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch b/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch new file mode 100644 index 0000000..0389543 --- /dev/null +++ b/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch @@ -0,0 +1,63 @@ +Some notes on the 'bootstrap with or without libc headers' debate: +http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html +http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html + +--- gcc/config/sh/linux.h ++++ gcc/config/sh/linux.h +@@ -145,6 +145,7 @@ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++#ifndef inhibit_libc + #ifdef IN_LIBGCC2 + #include <signal.h> + #include <sys/ucontext.h> +@@ -295,6 +296,7 @@ + + #endif /* defined (__SH5__) */ + #endif /* IN_LIBGCC2 */ ++#endif /* inhibit_libc */ + + /* For SH3 and SH4, we use a slot of the unwind frame which correspond + to a fake register number 16 as a placeholder for the return address +--- gcc/config/i386/linux.h ++++ gcc/config/i386/linux.h +@@ -208,6 +208,7 @@ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++#ifndef inhibit_libc + #ifdef IN_LIBGCC2 + /* There's no sys/ucontext.h for some (all?) libc1, so no + signal-turned-exceptions for them. There's also no configure-run for +@@ -272,3 +273,4 @@ + } while (0) + #endif /* not USE_GNULIBC_1 */ + #endif /* IN_LIBGCC2 */ ++#endif /* inhibit_libc */ +--- gcc/config/alpha/linux.h ++++ gcc/config/alpha/linux.h +@@ -73,6 +73,7 @@ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++#ifndef inhibit_libc + #ifdef IN_LIBGCC2 + #include <signal.h> + #include <sys/ucontext.h> +@@ -122,3 +123,4 @@ + (FS)->retaddr_column = 64; \ + goto SUCCESS; \ + } while (0) ++#endif /* inhibit_libc */ +--- gcc/config.gcc ++++ gcc/config.gcc +@@ -321,7 +321,7 @@ + need_64bit_hwint=yes + ;; + # Note the 'l'; we need to be able to match e.g. "shle" or "shl". +-sh[123456789l]*-*-*) ++sh[123456789lbe]*-*-*) + cpu_type=sh + need_64bit_hwint=yes + ;; diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch new file mode 100644 index 0000000..523caa4 --- /dev/null +++ b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch @@ -0,0 +1,40 @@ +Some notes on the 'bootstrap with or without libc headers' debate: +http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html +http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html + +--- gcc/unwind-dw2.c ++++ gcc/unwind-dw2.c +@@ -253,9 +253,11 @@ + } + #endif + ++#ifndef inhibit_libc + #ifdef MD_UNWIND_SUPPORT + #include MD_UNWIND_SUPPORT + #endif ++#endif + + /* Extract any interesting information from the CIE for the translation + unit F belongs to. Return a pointer to the byte after the augmentation, +--- gcc/configure ++++ gcc/configure +@@ -12857,7 +12857,7 @@ then + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + +--- gcc/configure.ac ++++ gcc/configure.ac +@@ -1717,7 +1717,7 @@ then + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch new file mode 100644 index 0000000..6090d66 --- /dev/null +++ b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch @@ -0,0 +1,64 @@ +workaround for lame stack packing on i386 ... + + - build gcc with -Os (crtfastmath.o to be specific) + - crtfastmath.o is installed into gcc libdir + - run gcc with -ffast-math and get crtfastmath.o linked in + - resulting compiled app segfaults due to init code in + crtfastmath.o that has mis-aligned structure on stack + +http://bugs.gentoo.org/147020 +http://gcc.gnu.org/PR28621 + +this is supposed to be fixed in current 4.1 branch, but i'm unable to get +the fix to work so until i can figure out what i'm doing wrong, we'll use +this workaround for now. + +--- gcc-4.1.1/gcc/config/i386/crtfastmath.c ++++ gcc-4.1.1/gcc/config/i386/crtfastmath.c +@@ -37,6 +37,23 @@ + #define FXSAVE (1 << 24) + #define SSE (1 << 25) + ++struct ++{ ++ unsigned short int cwd; ++ unsigned short int swd; ++ unsigned short int twd; ++ unsigned short int fop; ++ long int fip; ++ long int fcs; ++ long int foo; ++ long int fos; ++ long int mxcsr; ++ long int mxcsr_mask; ++ long int st_space[32]; ++ long int xmm_space[32]; ++ long int padding[56]; ++} __attribute__ ((aligned (16))) fxsave; ++ + static void __attribute__((constructor)) + set_fast_math (void) + { +@@ -75,22 +92,6 @@ + if (edx & FXSAVE) + { + /* Check if DAZ is available. */ +- struct +- { +- unsigned short int cwd; +- unsigned short int swd; +- unsigned short int twd; +- unsigned short int fop; +- long int fip; +- long int fcs; +- long int foo; +- long int fos; +- long int mxcsr; +- long int mxcsr_mask; +- long int st_space[32]; +- long int xmm_space[32]; +- long int padding[56]; +- } __attribute__ ((aligned (16))) fxsave; + + __builtin_memset (&fxsave, 0, sizeof (fxsave)); + diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk b/sys-devel/gcc/files/awk/fixlafiles.awk new file mode 100644 index 0000000..ffade96 --- /dev/null +++ b/sys-devel/gcc/files/awk/fixlafiles.awk @@ -0,0 +1,314 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk,v 1.15 2008/02/19 05:47:29 vapier Exp $ + +# +# Helper functions +# +function printn(string) { + printf("%s", string) +} +function einfo(string) { + printf(" \033[32;01m*\033[0m %s\n", string) +} +function einfon(string) { + printf(" \033[32;01m*\033[0m %s", string) +} +function ewarn(string) { + printf(" \033[33;01m*\033[0m %s\n", string) +} +function ewarnn(string) { + printf(" \033[33;01m*\033[0m %s", string) +} +function eerror(string) { + printf(" \033[31;01m*\033[0m %s\n", string) +} + +# +# assert(condition, errmsg) +# assert that a condition is true. Otherwise exit. +# +function assert(condition, string) { + if (! condition) { + printf("%s:%d: assertion failed: %s\n", + FILENAME, FNR, string) > "/dev/stderr" + _assert_exit = 1 + exit 1 + } +} + +# +# system(command, return) +# wrapper that normalizes return codes ... +# +function dosystem(command, ret) { + ret = 0 + ret = system(command) + if (ret == 0) + return 1 + else + return 0 +} + +BEGIN { + # + # Get our variables from environment + # + OLDVER = ENVIRON["OLDVER"] + OLDCHOST = ENVIRON["OLDCHOST"] + + if (OLDVER == "") { + eerror("Could not get OLDVER!"); + exit 1 + } + + # Setup some sane defaults + LIBCOUNT = 2 + HAVE_GCC34 = 0 + DIRLIST[1] = "/lib" + DIRLIST[2] = "/usr/lib" + + # + # Walk /etc/ld.so.conf to discover all our library paths + # + pipe = "cat /etc/ld.so.conf | sort 2>/dev/null" + while(((pipe) | getline ldsoconf_data) > 0) { + if (ldsoconf_data !~ /^[[:space:]]*#/) { + if (ldsoconf_data == "") continue + + # Remove any trailing comments + sub(/#.*$/, "", ldsoconf_data) + # Remove any trailing spaces + sub(/[[:space:]]+$/, "", ldsoconf_data) + + # If there's more than one path per line, split + # it up as if they were sep lines + split(ldsoconf_data, nodes, /[:,[:space:]]/) + + # Now add the rest from ld.so.conf + for (x in nodes) { + # wtf does this line do ? + sub(/=.*/, "", nodes[x]) + # Prune trailing / + sub(/\/$/, "", nodes[x]) + + if (nodes[x] == "") continue + + # + # Drop the directory if its a child directory of + # one that was already added ... + # For example, if we have: + # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss + # We really just want to save /usr/lib /usr/libexec + # + CHILD = 0 + for (y in DIRLIST) { + if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") { + CHILD = 1 + break + } + } + if (CHILD) continue + + DIRLIST[++LIBCOUNT] = nodes[x] + } + } + } + close(pipe) + + # + # Get line from gcc's output containing CHOST + # + pipe = "gcc -print-file-name=libgcc.a 2>/dev/null" + if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) { + close(pipe) + + # If we fail to get the CHOST, see if we can get the CHOST + # portage thinks we are using ... + pipe = "/usr/bin/portageq envvar 'CHOST'" + assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST") + } else { + # Check pre gcc-3.4.x versions + CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST) + + if (CHOST == TMP_CHOST || CHOST == "") { + # Check gcc-3.4.x or later + CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST); + + if (CHOST == TMP_CHOST || CHOST == "") + CHOST = "" + else + HAVE_GCC34 = 1 + } + } + close(pipe) + + if (CHOST == "") { + eerror("Could not get gcc's CHOST!") + exit 1 + } + + if (OLDCHOST != "") + if (OLDCHOST == CHOST) + OLDCHOST = "" + + GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/" + GCCLIBPREFIX_NEW = "/usr/lib/gcc/" + + if (HAVE_GCC34) + GCCLIBPREFIX = GCCLIBPREFIX_NEW + else + GCCLIBPREFIX = GCCLIBPREFIX_OLD + + GCCLIB = GCCLIBPREFIX CHOST + + if (OLDCHOST != "") { + OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST + OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST + } + + # Get current gcc's version + pipe = "gcc -dumpversion" + assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)") + close(pipe) + + if (NEWVER == "") { + eerror("Could not get gcc's version!") + exit 1 + } + + # Nothing to do ? + if ((OLDVER == NEWVER) && (OLDCHOST == "")) + exit 0 + + # + # Ok, now let's scan for the .la files and actually fix them up + # + for (x = 1; x <= LIBCOUNT; x++) { + # Do nothing if the target dir is gcc's internal library path + if (DIRLIST[x] ~ GCCLIBPREFIX_OLD || + DIRLIST[x] ~ GCCLIBPREFIX_NEW) + continue + + einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...") + + pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null" + while (((pipe) | getline la_files) > 0) { + + # Do nothing if the .la file is located in gcc's internal lib path + if (la_files ~ GCCLIBPREFIX_OLD || + la_files ~ GCCLIBPREFIX_NEW) + continue + + CHANGED = 0 + CHOST_CHANGED = 0 + + # See if we need to fix the .la file + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + if ((gsub(OLDGCCLIB1 "[/[:space:]]+", + GCCLIB, la_data) > 0) || + (gsub(OLDGCCLIB2 "[/[:space:]]+", + GCCLIB, la_data) > 0)) { + CHANGED = 1 + CHOST_CHANGED = 1 + } + } + if (OLDVER != NEWVER) { + if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0) || + (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0)) + CHANGED = 1 + } + } + close(la_files) + + # Do the actual changes in a second loop, as we can then + # verify that CHOST_CHANGED among things is correct ... + if (CHANGED) { + ewarnn(" FIXING: " la_files " ...") + + if (CHANGED) + printn("[") + + # Clear the temp file (removing rather than '>foo' is better + # out of a security point of view?) + dosystem("rm -f " la_files ".new") + + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)", + GCCLIB "\\1", "g", la_data) + tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)", + GCCLIB "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + printn("c") + la_data = tmpstr + } + + if (CHOST_CHANGED > 0) { + # We try to be careful about CHOST changes outside + # the gcc library path (meaning we cannot match it + # via /GCCLIBPREFIX CHOST/) ... + + # Catch: + # + # dependency_libs=' -L/usr/CHOST/{bin,lib}' + # + gsub("-L/usr/" OLDCHOST "/", + "-L/usr/" CHOST "/", la_data) + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib' + # + la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/", + "\\1/" CHOST "/", "g", la_data) + } + } + + if (OLDVER != NEWVER) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc/CHOST/VER' + # + tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", la_data) + tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib' + # + # in cases where we have gcc34 + tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + printn("v") + la_data = tmpstr + } + } + + print la_data >> (la_files ".new") + } + + if (CHANGED) + print "]" + + close(la_files) + close(la_files ".new") + + assert(dosystem("mv -f " la_files ".new " la_files), + "dosystem(\"mv -f " la_files ".new " la_files "\")") + } + } + + close(pipe) + } +} + +# vim:ts=4 diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la new file mode 100644 index 0000000..346bd16 --- /dev/null +++ b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la @@ -0,0 +1,335 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la,v 1.4 2010/03/19 23:53:07 vapier Exp $ + +# +# Helper functions +# +function printn(string) { + printf("%s", string) +} +function einfo(string) { + printf(" \033[32;01m*\033[0m %s\n", string) +} +function einfon(string) { + printf(" \033[32;01m*\033[0m %s", string) +} +function ewarn(string) { + printf(" \033[33;01m*\033[0m %s\n", string) +} +function ewarnn(string) { + printf(" \033[33;01m*\033[0m %s", string) +} +function eerror(string) { + printf(" \033[31;01m*\033[0m %s\n", string) +} + +# +# assert(condition, errmsg) +# assert that a condition is true. Otherwise exit. +# +function assert(condition, string) { + if (! condition) { + printf("%s:%d: assertion failed: %s\n", + FILENAME, FNR, string) > "/dev/stderr" + _assert_exit = 1 + exit 1 + } +} + +# +# system(command, return) +# wrapper that normalizes return codes ... +# +function dosystem(command, ret) { + ret = 0 + ret = system(command) + if (ret == 0) + return 1 + else + return 0 +} + +# +# parse_ld_conf(config_file) +# +function parse_ld_conf(conf, pipe, ldsoconf_data, CHILD, y) { + pipe = "cd /etc; cat " conf " | sort 2>/dev/null" + while(((pipe) | getline ldsoconf_data) > 0) { + if (ldsoconf_data ~ /^[[:space:]]*#/) + continue + if (ldsoconf_data == "") + continue + + # Handle the "include" keyword + if (ldsoconf_data ~ /^include /) { + sub(/^include /, "", ldsoconf_data) + parse_ld_conf(ldsoconf_data) + continue + } + + # Remove any trailing comments + sub(/#.*$/, "", ldsoconf_data) + # Remove any trailing spaces + sub(/[[:space:]]+$/, "", ldsoconf_data) + # Eat duplicate slashes + sub(/\/\//, "/", ldsoconf_data) + # Prune trailing / + sub(/\/$/, "", ldsoconf_data) + + # + # Drop the directory if its a child directory of + # one that was already added ... + # For example, if we have: + # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss + # We really just want to save /usr/lib /usr/libexec + # + CHILD = 0 + for (y in DIRLIST) { + if (ldsoconf_data ~ "^" DIRLIST[y] "(/|$)") { + CHILD = 1 + break + } + } + if (CHILD) continue + + DIRLIST[++LIBCOUNT] = ldsoconf_data + } + close(pipe) +} + +BEGIN { + # + # Get our variables from environment + # + OLDVER = ENVIRON["OLDVER"] + OLDCHOST = ENVIRON["OLDCHOST"] + + if (OLDVER == "") { + eerror("Could not get OLDVER!"); + exit 1 + } + + # Setup some sane defaults + LIBCOUNT = 2 + HAVE_GCC34 = 0 + DIRLIST[1] = "/lib" + DIRLIST[2] = "/usr/lib" + + # + # Walk /etc/ld.so.conf to discover all our library paths + # + parse_ld_conf("/etc/ld.so.conf") + + # + # Get line from gcc's output containing CHOST + # + pipe = "gcc -print-file-name=libgcc.a 2>/dev/null" + if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) { + close(pipe) + + # If we fail to get the CHOST, see if we can get the CHOST + # portage thinks we are using ... + pipe = "/usr/bin/portageq envvar 'CHOST'" + assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST") + } else { + # Check pre gcc-3.4.x versions + CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST) + + if (CHOST == TMP_CHOST || CHOST == "") { + # Check gcc-3.4.x or later + CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST); + + if (CHOST == TMP_CHOST || CHOST == "") + CHOST = "" + else + HAVE_GCC34 = 1 + } + } + close(pipe) + + if (CHOST == "") { + eerror("Could not get gcc's CHOST!") + exit 1 + } + + if (OLDCHOST != "") + if (OLDCHOST == CHOST) + OLDCHOST = "" + + GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/" + GCCLIBPREFIX_NEW = "/usr/lib/gcc/" + + if (HAVE_GCC34) + GCCLIBPREFIX = GCCLIBPREFIX_NEW + else + GCCLIBPREFIX = GCCLIBPREFIX_OLD + + GCCLIB = GCCLIBPREFIX CHOST + + if (OLDCHOST != "") { + OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST + OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST + } + + # Get current gcc's version + pipe = "gcc -dumpversion" + assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)") + close(pipe) + + if (NEWVER == "") { + eerror("Could not get gcc's version!") + exit 1 + } + + # Nothing to do ? + # NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to + # replace libstdc++.la .... + if ((OLDVER == "") && (OLDCHOST == "")) + exit 0 + + # + # Ok, now let's scan for the .la files and actually fix them up + # + for (x = 1; x <= LIBCOUNT; x++) { + # Do nothing if the target dir is gcc's internal library path + if (DIRLIST[x] ~ GCCLIBPREFIX_OLD || + DIRLIST[x] ~ GCCLIBPREFIX_NEW) + continue + + einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...") + + pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null" + while (((pipe) | getline la_files) > 0) { + + # Do nothing if the .la file is located in gcc's internal lib path + if (la_files ~ GCCLIBPREFIX_OLD || + la_files ~ GCCLIBPREFIX_NEW) + continue + + CHANGED = 0 + CHOST_CHANGED = 0 + + # See if we need to fix the .la file + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + if ((gsub(OLDGCCLIB1 "[/[:space:]]+", + GCCLIB, la_data) > 0) || + (gsub(OLDGCCLIB2 "[/[:space:]]+", + GCCLIB, la_data) > 0)) { + CHANGED = 1 + CHOST_CHANGED = 1 + } + } + if (OLDVER != NEWVER) { + if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0) || + (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0)) + CHANGED = 1 + } + # We now check if we have libstdc++.la, as we remove the + # libtool linker scripts for gcc ... + # We do this last, as we only match the new paths + if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", + "-lstdc++", la_data) > 0) + CHANGED = 1 + } + close(la_files) + + # Do the actual changes in a second loop, as we can then + # verify that CHOST_CHANGED among things is correct ... + if (CHANGED) { + ewarnn(" FIXING: " la_files " ...[") + + # Clear the temp file (removing rather than '>foo' is better + # out of a security point of view?) + dosystem("rm -f " la_files ".new") + + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)", + GCCLIB "\\1", "g", la_data) + tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)", + GCCLIB "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + printn("c") + la_data = tmpstr + } + + if (CHOST_CHANGED > 0) { + # We try to be careful about CHOST changes outside + # the gcc library path (meaning we cannot match it + # via /GCCLIBPREFIX CHOST/) ... + + # Catch: + # + # dependency_libs=' -L/usr/CHOST/{bin,lib}' + # + gsub("-L/usr/" OLDCHOST "/", + "-L/usr/" CHOST "/", la_data) + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib' + # + la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/", + "\\1/" CHOST "/", "g", la_data) + } + } + + if (OLDVER != NEWVER) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc/CHOST/VER' + # + tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", la_data) + tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib' + # + # in cases where we have gcc34 + tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + printn("v") + la_data = tmpstr + } + } + + # We now check if we have libstdc++.la, as we remove the + # libtool linker scripts for gcc and any referencese in any + # libtool linker scripts. + # We do this last, as we only match the new paths + tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", + "-lstdc++", "g", la_data); + if (la_data != tmpstr) { + printn("l") + la_data = tmpstr + } + + print la_data >> (la_files ".new") + } + + if (CHANGED) + print "]" + + close(la_files) + close(la_files ".new") + + assert(dosystem("mv -f " la_files ".new " la_files), + "dosystem(\"mv -f " la_files ".new " la_files "\")") + } + } + + close(pipe) + } +} + +# vim:ts=4 diff --git a/sys-devel/gcc/files/c89 b/sys-devel/gcc/files/c89 new file mode 100755 index 0000000..cee0325 --- /dev/null +++ b/sys-devel/gcc/files/c89 @@ -0,0 +1,20 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-2.95): +# -ansi +# -std=c89 +# -std=iso9899:1990 + +for i; do + case "$i" in + -ansi|-std=c89|-std=iso9899:1990) + ;; + -std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@" diff --git a/sys-devel/gcc/files/c99 b/sys-devel/gcc/files/c99 new file mode 100755 index 0000000..c954209 --- /dev/null +++ b/sys-devel/gcc/files/c99 @@ -0,0 +1,21 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-3.3): +# -std=c99 +# -std=c9x +# -std=iso9899:1999 +# -std=iso9899:199x + +for i; do + case "$i" in + -std=c9[9x]|-std=iso9899:199[9x]) + ;; + -ansi|-std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"} diff --git a/sys-devel/gcc/files/fix_libtool_files.sh b/sys-devel/gcc/files/fix_libtool_files.sh new file mode 100644 index 0000000..0c8a42b --- /dev/null +++ b/sys-devel/gcc/files/fix_libtool_files.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.17 2014/05/20 08:00:40 rhill Exp $ + +usage() { +cat << "USAGE_END" +Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>] + + Where <old-gcc-version> is the version number of the + previous gcc version. For example, if you updated to + gcc-3.2.1, and you had gcc-3.2 installed, run: + + # fix_libtool_files.sh 3.2 + + If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu + but you now have CHOST as i686-pc-linux-gnu, run: + + # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu + + Note that if only the CHOST and not the version changed, you can run + it with the current version and the '--oldarch <old-CHOST>' arguments, + and it will do the expected: + + # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu + +USAGE_END + exit 1 +} + +case $2 in +--oldarch) [ $# -ne 3 ] && usage ;; +*) [ $# -ne 1 ] && usage ;; +esac + +ARGV1=$1 +ARGV2=$2 +ARGV3=$3 + +. /etc/profile || exit 1 + +if [ ${EUID:-0} -ne 0 ] ; then + echo "${0##*/}: Must be root." + exit 1 +fi + +# make sure the files come out sane +umask 0022 + +OLDCHOST= +[ "${ARGV2}" = "--oldarch" ] && OLDCHOST=${ARGV3} + +AWKDIR="/usr/share/gcc-data" + +if [ ! -r "${AWKDIR}/fixlafiles.awk" ] ; then + echo "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!" + exit 1 +fi + +OLDVER=${ARGV1} + +export OLDVER OLDCHOST + +echo "Scanning libtool files for hardcoded gcc library paths..." +exec gawk -f "${AWKDIR}/fixlafiles.awk" + +# vim:ts=4 diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch new file mode 100644 index 0000000..d1b1b03 --- /dev/null +++ b/sys-devel/gcc/files/gcc-configure-LANG.patch @@ -0,0 +1,64 @@ +The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in +option parsing, it may break. + +http://bugs.gentoo.org/103483 + +--- configure ++++ configure +@@ -54,6 +54,19 @@ + infodir='${prefix}/info' + mandir='${prefix}/man' + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ unset $as_var ++ fi ++done ++ + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= +@@ -452,16 +463,6 @@ + esac + done + +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +- + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. +@@ -1850,6 +1850,19 @@ + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then ++ eval \$as_var=C; export \$as_var ++ else ++ unset \$as_var ++ fi ++done ++ + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch new file mode 100644 index 0000000..ddc098d --- /dev/null +++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch @@ -0,0 +1,16 @@ +Chances are quite good that the installed makeinfo is sufficient. +So ignore false positives where the makeinfo installed is so new +that it violates the cheesy version grep. + +http://bugs.gentoo.org/198182 + +--- configure ++++ configure +@@ -3573,6 +3573,6 @@ + : + else +- MAKEINFO="$MISSING makeinfo" ++ : + fi + ;; + diff --git a/sys-devel/gcc/files/gcc-spec-env-r1.patch b/sys-devel/gcc/files/gcc-spec-env-r1.patch new file mode 100644 index 0000000..a589268 --- /dev/null +++ b/sys-devel/gcc/files/gcc-spec-env-r1.patch @@ -0,0 +1,87 @@ +2013-08-22 Magnus Granberg <zorry@gentoo.org> + + * gcc/gcc.c (main): Add support for external spec file via the GCC_SPECS env var + and move the process of the user specifed specs. + + This allows us to easily control pie/ssp defaults with gcc-config profiles. + Original patch by Rob Holland + Extended to support multiple entries separated by ':' by Kevin F. Quinn + Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill + Modified to process the GCC_SPECS env var befor DRIVER_SELF_SPECS by Magnus Granberg + +--- gcc-4.8-20130210/gcc/gcc.c 2013-02-05 16:55:31.000000000 +0100 ++++ gcc-4.8-20130210-work/gcc/gcc.c 2013-07-26 02:32:14.625089864 +0200 +@@ -6427,6 +6428,48 @@ main (int argc, char **argv) + do_option_spec (option_default_specs[i].name, + option_default_specs[i].spec); + ++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) ++ /* Add specs listed in GCC_SPECS. Note; in the process of separating ++ * each spec listed, the string is overwritten at token boundaries ++ * (':') with '\0', an effect of strtok_r(). ++ */ ++ specs_file = getenv ("GCC_SPECS"); ++ if (specs_file && (strlen(specs_file) > 0)) ++ { ++ char *spec, *saveptr; ++ for (spec=strtok_r(specs_file,":",&saveptr); ++ spec!=NULL; ++ spec=strtok_r(NULL,":",&saveptr)) ++ { ++ struct user_specs *user = (struct user_specs *) ++ xmalloc (sizeof (struct user_specs)); ++ user->next = (struct user_specs *) 0; ++ user->filename = spec; ++ if (user_specs_tail) ++ user_specs_tail->next = user; ++ else ++ user_specs_head = user; ++ user_specs_tail = user; ++ } ++ } ++#endif ++ /* Process any user specified specs in the order given on the command ++ * line. */ ++ for (uptr = user_specs_head; uptr; uptr = uptr->next) ++ { ++ char *filename = find_a_file (&startfile_prefixes, uptr->filename, ++ R_OK, true); ++ read_specs (filename ? filename : uptr->filename, false, true); ++ } ++ /* Process any user self specs. */ ++ { ++ struct spec_list *sl; ++ for (sl = specs; sl; sl = sl->next) ++ if (sl->name_len == sizeof "self_spec" - 1 ++ && !strcmp (sl->name, "self_spec")) ++ do_self_spec (*sl->ptr_spec); ++ } ++ + /* Process DRIVER_SELF_SPECS, adding any new options to the end + of the command line. */ + +@@ -6535,24 +6578,6 @@ main (int argc, char **argv) + PREFIX_PRIORITY_LAST, 0, 1); + } + +- /* Process any user specified specs in the order given on the command +- line. */ +- for (uptr = user_specs_head; uptr; uptr = uptr->next) +- { +- char *filename = find_a_file (&startfile_prefixes, uptr->filename, +- R_OK, true); +- read_specs (filename ? filename : uptr->filename, false, true); +- } +- +- /* Process any user self specs. */ +- { +- struct spec_list *sl; +- for (sl = specs; sl; sl = sl->next) +- if (sl->name_len == sizeof "self_spec" - 1 +- && !strcmp (sl->name, "self_spec")) +- do_self_spec (*sl->ptr_spec); +- } +- + if (compare_debug) + { + enum save_temps save; diff --git a/sys-devel/gcc/files/gcc-spec-env.patch b/sys-devel/gcc/files/gcc-spec-env.patch new file mode 100644 index 0000000..57e7567 --- /dev/null +++ b/sys-devel/gcc/files/gcc-spec-env.patch @@ -0,0 +1,42 @@ + Add support for external spec file via the GCC_SPECS env var. This + allows us to easily control pie/ssp defaults with gcc-config profiles. + + Original patch by Rob Holland + Extended to support multiple entries separated by ':' by Kevin F. Quinn + Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill + +--- gcc-4/gcc/gcc.c ++++ gcc-4/gcc/gcc.c +@@ -6482,6 +6482,32 @@ + + /* Process any user specified specs in the order given on the command + line. */ ++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) ++ /* Add specs listed in GCC_SPECS. Note; in the process of separating ++ * each spec listed, the string is overwritten at token boundaries ++ * (':') with '\0', an effect of strtok_r(). ++ */ ++ specs_file = getenv ("GCC_SPECS"); ++ if (specs_file && (strlen(specs_file) > 0)) ++ { ++ char *spec, *saveptr; ++ for (spec=strtok_r(specs_file,":",&saveptr); ++ spec!=NULL; ++ spec=strtok_r(NULL,":",&saveptr)) ++ { ++ struct user_specs *user = (struct user_specs *) ++ xmalloc (sizeof (struct user_specs)); ++ ++ user->next = (struct user_specs *) 0; ++ user->filename = spec; ++ if (user_specs_tail) ++ user_specs_tail->next = user; ++ else ++ user_specs_head = user; ++ user_specs_tail = user; ++ } ++ } ++#endif + for (uptr = user_specs_head; uptr; uptr = uptr->next) + { + char *filename = find_a_file (&startfile_prefixes, uptr->filename, |