diff options
Diffstat (limited to 'patches/gcc-4.2.4/generic/gentoo')
16 files changed, 1700 insertions, 0 deletions
diff --git a/patches/gcc-4.2.4/generic/gentoo/00_all_gcc-trampolinewarn.patch b/patches/gcc-4.2.4/generic/gentoo/00_all_gcc-trampolinewarn.patch new file mode 100644 index 0000000..85d61f9 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/00_all_gcc-trampolinewarn.patch @@ -0,0 +1,41 @@ + This trivial patch causes gcc to emit a warning whenever + it generates a trampoline. These are otherwise hard to + locate. It is rigged to default ON - to have it default + to OFF remove the text 'Init(1)' from the common.opt + patch, leaving just 'Common Var(warn_trampolines)'. + Kevin F. Quinn <kevquinn@gentoo.org> 17 Jan 2006 + +--- + gcc/builtins.c | 3 +++ + gcc/common.opt | 4 ++++ + 2 files changed, 7 insertions(+) + +Index: gcc-4.2.3/gcc/common.opt +=================================================================== +--- gcc-4.2.3.orig/gcc/common.opt ++++ gcc-4.2.3/gcc/common.opt +@@ -156,6 +156,10 @@ Wsystem-headers + Common Var(warn_system_headers) + Do not suppress warnings from system headers + ++Wtrampolines ++Common Var(warn_trampolines) Init(1) ++Warn whenever a trampoline is generated ++ + Wuninitialized + Common Var(warn_uninitialized) + Warn about uninitialized automatic variables +Index: gcc-4.2.3/gcc/builtins.c +=================================================================== +--- gcc-4.2.3.orig/gcc/builtins.c ++++ gcc-4.2.3/gcc/builtins.c +@@ -5253,6 +5253,9 @@ expand_builtin_init_trampoline (tree arg + trampolines_created = 1; + INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain); + ++ if (warn_trampolines) ++ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)"); ++ + return const0_rtx; + } + diff --git a/patches/gcc-4.2.4/generic/gentoo/01_all_gcc4-ice-hack.patch b/patches/gcc-4.2.4/generic/gentoo/01_all_gcc4-ice-hack.patch new file mode 100644 index 0000000..8a09a71 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/01_all_gcc4-ice-hack.patch @@ -0,0 +1,304 @@ +2004-01-23 Jakub Jelinek <jakub@redhat.com> + + * gcc.c (execute): Don't free first string early, but at the end + of the function. Call retry_ice if compiler exited with + ICE_EXIT_CODE. + (retry_ice): New function. + * diagnostic.c (diagnostic_count_diagnostic, + diagnostic_action_after_output, error_recursion): Exit with + ICE_EXIT_CODE instead of FATAL_EXIT_CODE. + +--- + gcc/diagnostic.c | 2 + gcc/gcc.c | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 237 insertions(+), 2 deletions(-) + +Index: gcc-4.2.3/gcc/diagnostic.c +=================================================================== +--- gcc-4.2.3.orig/gcc/diagnostic.c ++++ gcc-4.2.3/gcc/diagnostic.c +@@ -269,7 +269,7 @@ diagnostic_action_after_output (diagnost + real_abort (); + + fnotice (stderr, "compilation terminated.\n"); +- exit (FATAL_EXIT_CODE); ++ exit (ICE_EXIT_CODE); + + default: + gcc_unreachable (); +Index: gcc-4.2.3/gcc/gcc.c +=================================================================== +--- gcc-4.2.3.orig/gcc/gcc.c ++++ gcc-4.2.3/gcc/gcc.c +@@ -348,6 +348,9 @@ static void init_gcc_specs (struct obsta + #if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX) + static const char *convert_filename (const char *, int, int); + #endif ++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) ++static void retry_ice (const char *prog, const char **argv); ++#endif + + static const char *if_exists_spec_function (int, const char **); + static const char *if_exists_else_spec_function (int, const char **); +@@ -2948,7 +2951,7 @@ execute (void) + } + } + +- if (string != commands[i].prog) ++ if (i && string != commands[i].prog) + free ((void *) string); + } + +@@ -3005,6 +3008,17 @@ See %s for instructions.", + else if (WIFEXITED (status) + && WEXITSTATUS (status) >= MIN_FATAL_STATUS) + { ++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) ++ /* For ICEs in cc1, cc1obj, cc1plus see if it is ++ reproducible or not. */ ++ char *p; ++ if (getenv("GCC_RETRY_ICE") == NULL ++ && WEXITSTATUS (status) == ICE_EXIT_CODE ++ && i == 0 ++ && (p = strrchr (commands[0].argv[0], DIR_SEPARATOR)) ++ && ! strncmp (p + 1, "cc1", 3)) ++ retry_ice (commands[0].prog, commands[0].argv); ++#endif + if (WEXITSTATUS (status) > greatest_status) + greatest_status = WEXITSTATUS (status); + ret_code = -1; +@@ -3025,6 +3039,9 @@ See %s for instructions.", + } + } + ++ if (commands[0].argv[0] != commands[0].prog) ++ free ((PTR) commands[0].argv[0]); ++ + return ret_code; + } + } +@@ -5969,6 +5986,224 @@ give_switch (int switchnum, int omit_fir + switches[switchnum].validated = 1; + } + ++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) ++#define RETRY_ICE_ATTEMPTS 2 ++ ++static void ++retry_ice (const char *prog, const char **argv) ++{ ++ int nargs, out_arg = -1, quiet = 0, attempt; ++ int pid, retries, sleep_interval; ++ const char **new_argv; ++ char *temp_filenames[RETRY_ICE_ATTEMPTS * 2 + 2]; ++ ++ if (input_filename == NULL || ! strcmp (input_filename, "-")) ++ return; ++ ++ for (nargs = 0; argv[nargs] != NULL; ++nargs) ++ /* Only retry compiler ICEs, not preprocessor ones. */ ++ if (! strcmp (argv[nargs], "-E")) ++ return; ++ else if (argv[nargs][0] == '-' && argv[nargs][1] == 'o') ++ { ++ if (out_arg == -1) ++ out_arg = nargs; ++ else ++ return; ++ } ++ /* If the compiler is going to output any time information, ++ it might vary between invocations. */ ++ else if (! strcmp (argv[nargs], "-quiet")) ++ quiet = 1; ++ else if (! strcmp (argv[nargs], "-ftime-report")) ++ return; ++ ++ if (out_arg == -1 || !quiet) ++ return; ++ ++ memset (temp_filenames, '\0', sizeof (temp_filenames)); ++ new_argv = alloca ((nargs + 3) * sizeof (const char *)); ++ memcpy (new_argv, argv, (nargs + 1) * sizeof (const char *)); ++ new_argv[nargs++] = "-frandom-seed=0"; ++ new_argv[nargs] = NULL; ++ if (new_argv[out_arg][2] == '\0') ++ new_argv[out_arg + 1] = "-"; ++ else ++ new_argv[out_arg] = "-o-"; ++ ++ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS + 1; ++attempt) ++ { ++ int fd = -1; ++ int status; ++ ++ temp_filenames[attempt * 2] = make_temp_file (".out"); ++ temp_filenames[attempt * 2 + 1] = make_temp_file (".err"); ++ ++ if (attempt == RETRY_ICE_ATTEMPTS) ++ { ++ int i; ++ int fd1, fd2; ++ struct stat st1, st2; ++ size_t n, len; ++ char *buf; ++ ++ buf = xmalloc (8192); ++ ++ for (i = 0; i < 2; ++i) ++ { ++ fd1 = open (temp_filenames[i], O_RDONLY); ++ fd2 = open (temp_filenames[2 + i], O_RDONLY); ++ ++ if (fd1 < 0 || fd2 < 0) ++ { ++ i = -1; ++ close (fd1); ++ close (fd2); ++ break; ++ } ++ ++ if (fstat (fd1, &st1) < 0 || fstat (fd2, &st2) < 0) ++ { ++ i = -1; ++ close (fd1); ++ close (fd2); ++ break; ++ } ++ ++ if (st1.st_size != st2.st_size) ++ { ++ close (fd1); ++ close (fd2); ++ break; ++ } ++ ++ len = 0; ++ for (n = st1.st_size; n; n -= len) ++ { ++ len = n; ++ if (len > 4096) ++ len = 4096; ++ ++ if (read (fd1, buf, len) != (int) len ++ || read (fd2, buf + 4096, len) != (int) len) ++ { ++ i = -1; ++ break; ++ } ++ ++ if (memcmp (buf, buf + 4096, len) != 0) ++ break; ++ } ++ ++ close (fd1); ++ close (fd2); ++ ++ if (n) ++ break; ++ } ++ ++ free (buf); ++ if (i == -1) ++ break; ++ ++ if (i != 2) ++ { ++ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n"); ++ break; ++ } ++ ++ fd = open (temp_filenames[attempt * 2], O_RDWR); ++ if (fd < 0) ++ break; ++ write (fd, "//", 2); ++ for (i = 0; i < nargs; i++) ++ { ++ write (fd, " ", 1); ++ write (fd, new_argv[i], strlen (new_argv[i])); ++ } ++ write (fd, "\n", 1); ++ new_argv[nargs] = "-E"; ++ new_argv[nargs + 1] = NULL; ++ } ++ ++ /* Fork a subprocess; wait and retry if it fails. */ ++ sleep_interval = 1; ++ pid = -1; ++ for (retries = 0; retries < 4; retries++) ++ { ++ pid = fork (); ++ if (pid >= 0) ++ break; ++ sleep (sleep_interval); ++ sleep_interval *= 2; ++ } ++ ++ if (pid < 0) ++ break; ++ else if (pid == 0) ++ { ++ if (attempt != RETRY_ICE_ATTEMPTS) ++ fd = open (temp_filenames[attempt * 2], O_RDWR); ++ if (fd < 0) ++ exit (-1); ++ if (fd != 1) ++ { ++ close (1); ++ dup (fd); ++ close (fd); ++ } ++ ++ fd = open (temp_filenames[attempt * 2 + 1], O_RDWR); ++ if (fd < 0) ++ exit (-1); ++ if (fd != 2) ++ { ++ close (2); ++ dup (fd); ++ close (fd); ++ } ++ ++ if (prog == new_argv[0]) ++ execvp (prog, (char *const *) new_argv); ++ else ++ execv (new_argv[0], (char *const *) new_argv); ++ exit (-1); ++ } ++ ++ if (waitpid (pid, &status, 0) < 0) ++ break; ++ ++ if (attempt < RETRY_ICE_ATTEMPTS ++ && (! WIFEXITED (status) || WEXITSTATUS (status) != ICE_EXIT_CODE)) ++ { ++ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n"); ++ break; ++ } ++ else if (attempt == RETRY_ICE_ATTEMPTS) ++ { ++ close (fd); ++ if (WIFEXITED (status) ++ && WEXITSTATUS (status) == SUCCESS_EXIT_CODE) ++ { ++ notice ("Preprocessed source stored into %s file, please attach this to your bugreport.\n", ++ temp_filenames[attempt * 2]); ++ /* Make sure it is not deleted. */ ++ free (temp_filenames[attempt * 2]); ++ temp_filenames[attempt * 2] = NULL; ++ break; ++ } ++ } ++ } ++ ++ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS * 2 + 2; attempt++) ++ if (temp_filenames[attempt]) ++ { ++ unlink (temp_filenames[attempt]); ++ free (temp_filenames[attempt]); ++ } ++} ++#endif ++ + /* Search for a file named NAME trying various prefixes including the + user's -B prefix and some standard ones. + Return the absolute file name found. If nothing is found, return NAME. */ diff --git a/patches/gcc-4.2.4/generic/gentoo/06_all_gcc4-slow-pthread-self.patch b/patches/gcc-4.2.4/generic/gentoo/06_all_gcc4-slow-pthread-self.patch new file mode 100644 index 0000000..0fbfeab --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/06_all_gcc4-slow-pthread-self.patch @@ -0,0 +1,21 @@ +2005-05-20 Jakub Jelinek <jakub@redhat.com> + + * configure.host (slow_pthread_self): Set to empty unconditionally + on Linux targets. + +--- + libjava/configure.host | 1 + + 1 file changed, 1 insertion(+) + +Index: gcc-4.2.3/libjava/configure.host +=================================================================== +--- gcc-4.2.3.orig/libjava/configure.host ++++ gcc-4.2.3/libjava/configure.host +@@ -192,6 +192,7 @@ case "${host}" in + sh-linux* | sh[34]*-linux*) + can_unwind_signal=yes + libgcj_ld_symbolic='-Wl,-Bsymbolic' ++ slow_pthread_self= + if test x$slow_pthread_self = xyes \ + && test x$cross_compiling != xyes; then + cat > conftest.c <<EOF diff --git a/patches/gcc-4.2.4/generic/gentoo/20_all_cris-dont-force-limits-header.patch b/patches/gcc-4.2.4/generic/gentoo/20_all_cris-dont-force-limits-header.patch new file mode 100644 index 0000000..b22e3c6 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/20_all_cris-dont-force-limits-header.patch @@ -0,0 +1,17 @@ +Remove assumption since it breaks building --without-headers + +--- + gcc/config/cris/t-linux | 4 ---- + 1 file changed, 4 deletions(-) + +Index: gcc-4.2.3/gcc/config/cris/t-linux +=================================================================== +--- gcc-4.2.3.orig/gcc/config/cris/t-linux ++++ gcc-4.2.3/gcc/config/cris/t-linux +@@ -1,6 +1,2 @@ + TARGET_LIBGCC2_CFLAGS += -fPIC + CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS) +- +-# We *know* we have a limits.h in the glibc library, with extra +-# definitions needed for e.g. libgfortran. +-LIMITS_H_TEST = : diff --git a/patches/gcc-4.2.4/generic/gentoo/35_all_gcc-arm-pragma-pack.patch b/patches/gcc-4.2.4/generic/gentoo/35_all_gcc-arm-pragma-pack.patch new file mode 100644 index 0000000..6cd5e4e --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/35_all_gcc-arm-pragma-pack.patch @@ -0,0 +1,76 @@ +http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01115.html + +From: Paul Brook <paul@codesourcery.com> +Sender: gcc-patches-owner@gcc.gnu.org +To: gcc-patches@gcc.gnu.org +Subject: [patch] #pragma pack vs. STRUCTURE_SIZE_BOUNDARY +Date: Sun, 22 Oct 2006 16:32:31 +0100 + +Currently STRUCTURE_SIZE_BOUNDARY is obeyed even when +#pragma pack(1) is in effect. By contrast __attribute__((packed)) overrides +STRUCTURE_SIZE_BOUNDARY. + +This matters when odd sized packed structs are nested inside each other. + +Given the purpose of #pragma pack is for compatibility with Win32, I think +#pragma pack(1) act the same as __attribute__((packed)). + +The patch below fixes this. +Tested with cross to arm-none-eabi. +Ok? + +Paul + +2006-10-22 Paul Brook <paul@codesourcery.com> + + gcc/ + * stor-layout.c (start_record_layout): maximum_field_alignment + overrides STRUCTURE_SIZE_BOUNDARY. + + gcc/testsuite/ + * gcc.dg/pragma-pack-4.c: New test. + +--- + gcc/stor-layout.c | 10 +++++++++- + gcc/testsuite/gcc.dg/pragma-pack-4.c | 10 ++++++++++ + 2 files changed, 19 insertions(+), 1 deletion(-) + +Index: gcc-4.2.3/gcc/stor-layout.c +=================================================================== +--- gcc-4.2.3.orig/gcc/stor-layout.c ++++ gcc-4.2.3/gcc/stor-layout.c +@@ -530,7 +530,15 @@ start_record_layout (tree t) + #ifdef STRUCTURE_SIZE_BOUNDARY + /* Packed structures don't need to have minimum size. */ + if (! TYPE_PACKED (t)) +- rli->record_align = MAX (rli->record_align, (unsigned) STRUCTURE_SIZE_BOUNDARY); ++ { ++ unsigned tmp; ++ ++ /* #pragma pack overrides STRUCTURE_SIZE_BOUNDARY. */ ++ tmp = (unsigned) STRUCTURE_SIZE_BOUNDARY; ++ if (maximum_field_alignment != 0) ++ tmp = MIN (tmp, maximum_field_alignment); ++ rli->record_align = MAX (rli->record_align, tmp); ++ } + #endif + + rli->offset = size_zero_node; +Index: gcc-4.2.3/gcc/testsuite/gcc.dg/pragma-pack-4.c +=================================================================== +--- gcc-4.2.3.orig/gcc/testsuite/gcc.dg/pragma-pack-4.c ++++ gcc-4.2.3/gcc/testsuite/gcc.dg/pragma-pack-4.c +@@ -1,3 +1,13 @@ ++/* Check that pragma pack overrides STRUCTURE_SIZE_BOUNDARY. */ ++/* { dg-do compile } */ ++ ++#pragma pack(1) ++struct S ++{ ++ char a; ++}; ++ ++int test[sizeof(struct S) == 1 ? 1: -1]; + /* PR c/28286 */ + /* { dg-do compile } */ + diff --git a/patches/gcc-4.2.4/generic/gentoo/36_all_gcc-arm-pr30486.patch b/patches/gcc-4.2.4/generic/gentoo/36_all_gcc-arm-pr30486.patch new file mode 100644 index 0000000..39f6eb6 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/36_all_gcc-arm-pr30486.patch @@ -0,0 +1,25 @@ +http://bugs.gentoo.org/194975 +http://gcc.gnu.org/PR30486 + +--- + gcc/fortran/trans-types.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +Index: gcc-4.2.3/gcc/fortran/trans-types.c +=================================================================== +--- gcc-4.2.3.orig/gcc/fortran/trans-types.c ++++ gcc-4.2.3/gcc/fortran/trans-types.c +@@ -1799,6 +1799,13 @@ gfc_type_for_size (unsigned bits, int un + if (type && bits == TYPE_PRECISION (type)) + return type; + } ++ ++ /* Handle TImode as a special case because it is used by some backends ++ (eg. ARM) even though it is not available for normal use. */ ++#if HOST_BITS_PER_WIDE_INT >= 64 ++ if (bits == TYPE_PRECISION (intTI_type_node)) ++ return intTI_type_node; ++#endif + } + else + { diff --git a/patches/gcc-4.2.4/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch b/patches/gcc-4.2.4/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch new file mode 100644 index 0000000..11d2cc0 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch @@ -0,0 +1,16 @@ +--- + libiberty/Makefile.in | 1 + + 1 file changed, 1 insertion(+) + +Index: gcc-4.2.3/libiberty/Makefile.in +=================================================================== +--- gcc-4.2.3.orig/libiberty/Makefile.in ++++ gcc-4.2.3/libiberty/Makefile.in +@@ -232,6 +232,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ + $(RANLIB) $(TARGETLIB); \ ++ cp $(TARGETLIB) ../ ; \ + cd ..; \ + else true; fi + diff --git a/patches/gcc-4.2.4/generic/gentoo/53_all_gcc4-superh-default-multilib.patch b/patches/gcc-4.2.4/generic/gentoo/53_all_gcc4-superh-default-multilib.patch new file mode 100644 index 0000000..102350b --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/53_all_gcc4-superh-default-multilib.patch @@ -0,0 +1,29 @@ +The gcc-3.x toolchains would contain all the targets by default. With gcc-4, +you have to actually list out the multilibs you want or you will end up with +just one when using targets like 'sh4-linux-gnu'. + +The resulting toolchain can't even build a kernel as the kernel needs to build +with the nofpu flag to be sure that no fpu ops are generated. + +Here we restore the gcc-3.x behavior; the additional overhead of building all +of these multilibs by default is negligible. + +http://bugs.gentoo.org/140205 + +--- + gcc/config.gcc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: gcc-4.2.3/gcc/config.gcc +=================================================================== +--- gcc-4.2.3.orig/gcc/config.gcc ++++ gcc-4.2.3/gcc/config.gcc +@@ -2103,7 +2103,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbian + if test x${sh_multilibs} = x ; then + case ${target} in + sh64-superh-linux* | \ +- sh[1234]*) sh_multilibs=${sh_cpu_target} ;; ++ sh[1234]*) sh_multilibs=`cd ${srcdir}/config/sh ; echo t-mlib-sh[1-4]* | sed 's:t-mlib-sh:,m:g;s: ::g'` ;; + sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; + sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; + sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;; diff --git a/patches/gcc-4.2.4/generic/gentoo/56_all_gcc-4-pr32177.patch b/patches/gcc-4.2.4/generic/gentoo/56_all_gcc-4-pr32177.patch new file mode 100644 index 0000000..fa2c7ff --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/56_all_gcc-4-pr32177.patch @@ -0,0 +1,58 @@ +http://gcc.gnu.org/PR32177 + +2007-06-08 Jakub Jelinek <jakub@redhat.com> + + PR c++/32177 + * semantics.c (finish_omp_for): Call fold_build_cleanup_point_expr + on init, the non-decl cond operand and increment value. + +--- + gcc/cp/semantics.c | 27 ++++++++++++++++++++++++++- + 1 file changed, 26 insertions(+), 1 deletion(-) + +Index: gcc-4.2.3/gcc/cp/semantics.c +=================================================================== +--- gcc-4.2.3.orig/gcc/cp/semantics.c ++++ gcc-4.2.3/gcc/cp/semantics.c +@@ -3780,6 +3780,8 @@ tree + finish_omp_for (location_t locus, tree decl, tree init, tree cond, + tree incr, tree body, tree pre_body) + { ++ tree omp_for; ++ + if (decl == NULL) + { + if (init != NULL) +@@ -3857,8 +3859,31 @@ finish_omp_for (location_t locus, tree d + add_stmt (pre_body); + pre_body = NULL; + } ++ ++ init = fold_build_cleanup_point_expr (TREE_TYPE (init), init); + init = build_modify_expr (decl, NOP_EXPR, init); +- return c_finish_omp_for (locus, decl, init, cond, incr, body, pre_body); ++ if (cond && TREE_SIDE_EFFECTS (cond) && COMPARISON_CLASS_P (cond)) ++ { ++ int n = TREE_SIDE_EFFECTS (TREE_OPERAND (cond, 1)) != 0; ++ tree t = TREE_OPERAND (cond, n); ++ ++ TREE_OPERAND (cond, n) ++ = fold_build_cleanup_point_expr (TREE_TYPE (t), t); ++ } ++ omp_for = c_finish_omp_for (locus, decl, init, cond, incr, body, pre_body); ++ if (omp_for != NULL ++ && TREE_CODE (OMP_FOR_INCR (omp_for)) == MODIFY_EXPR ++ && TREE_SIDE_EFFECTS (TREE_OPERAND (OMP_FOR_INCR (omp_for), 1)) ++ && BINARY_CLASS_P (TREE_OPERAND (OMP_FOR_INCR (omp_for), 1))) ++ { ++ tree t = TREE_OPERAND (OMP_FOR_INCR (omp_for), 1); ++ int n = TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1)) != 0; ++ ++ TREE_OPERAND (t, n) ++ = fold_build_cleanup_point_expr (TREE_TYPE (TREE_OPERAND (t, n)), ++ TREE_OPERAND (t, n)); ++ } ++ return omp_for; + } + + void diff --git a/patches/gcc-4.2.4/generic/gentoo/59_all_gcc-4-pr32893.patch b/patches/gcc-4.2.4/generic/gentoo/59_all_gcc-4-pr32893.patch new file mode 100644 index 0000000..e805f54 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/59_all_gcc-4-pr32893.patch @@ -0,0 +1,32 @@ +http://gcc.gnu.org/PR32893 + +2007-10-29 Dorit Nuzman <dorit@il.ibm.com> + + PR tree-optimization/32893 + * tree-vectorize.c (vect_can_force_dr_alignment_p): Check + STACK_BOUNDARY instead of PREFERRED_STACK_BOUNDARY. + +--- + gcc/tree-vectorizer.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +Index: gcc-4.2.3/gcc/tree-vectorizer.c +=================================================================== +--- gcc-4.2.3.orig/gcc/tree-vectorizer.c ++++ gcc-4.2.3/gcc/tree-vectorizer.c +@@ -1530,12 +1530,9 @@ vect_can_force_dr_alignment_p (tree decl + if (TREE_STATIC (decl)) + return (alignment <= MAX_OFILE_ALIGNMENT); + else +- /* This is not 100% correct. The absolute correct stack alignment +- is STACK_BOUNDARY. We're supposed to hope, but not assume, that +- PREFERRED_STACK_BOUNDARY is honored by all translation units. +- However, until someone implements forced stack alignment, SSE +- isn't really usable without this. */ +- return (alignment <= PREFERRED_STACK_BOUNDARY); ++ /* This used to be PREFERRED_STACK_BOUNDARY, however, that is not 100% ++ correct until someone implements forced stack alignment. */ ++ return (alignment <= STACK_BOUNDARY); + } + + diff --git a/patches/gcc-4.2.4/generic/gentoo/62_all_gcc4-noteGNUstack.patch b/patches/gcc-4.2.4/generic/gentoo/62_all_gcc4-noteGNUstack.patch new file mode 100644 index 0000000..62df34a --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/62_all_gcc4-noteGNUstack.patch @@ -0,0 +1,230 @@ +2005-02-08 Jakub Jelinek <jakub@redhat.com> + + * src/alpha/osf.S: Add .note.GNU-stack on Linux. + * src/s390/sysv.S: Likewise. + * src/powerpc/linux64.S: Likewise. + * src/powerpc/linux64_closure.S: Likewise. + * src/powerpc/ppc_closure.S: Likewise. + * src/powerpc/sysv.S: Likewise. + * src/x86/unix64.S: Likewise. + * src/x86/sysv.S: Likewise. + * src/sparc/v8.S: Likewise. + * src/sparc/v9.S: Likewise. + * src/m68k/sysv.S: Likewise. + * src/ia64/unix.S: Likewise. + * src/arm/sysv.S: Likewise. + + * ia64_save_regs_in_stack.s: Moved to... + * ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack + on Linux. + +--- + boehm-gc/ia64_save_regs_in_stack.S | 15 +++++++++++++++ + boehm-gc/ia64_save_regs_in_stack.s | 12 ------------ + libffi/src/alpha/osf.S | 4 ++++ + libffi/src/arm/sysv.S | 3 +++ + libffi/src/ia64/unix.S | 4 ++++ + libffi/src/m68k/sysv.S | 4 ++++ + libffi/src/powerpc/linux64.S | 4 ++++ + libffi/src/powerpc/linux64_closure.S | 4 ++++ + libffi/src/powerpc/ppc_closure.S | 4 ++++ + libffi/src/powerpc/sysv.S | 4 ++++ + libffi/src/s390/sysv.S | 3 +++ + libffi/src/sparc/v8.S | 4 ++++ + libffi/src/sparc/v9.S | 4 ++++ + libffi/src/x86/sysv.S | 4 ++++ + libffi/src/x86/unix64.S | 4 ++++ + 15 files changed, 65 insertions(+), 12 deletions(-) + +Index: gcc-4.2.3/boehm-gc/ia64_save_regs_in_stack.S +=================================================================== +--- /dev/null ++++ gcc-4.2.3/boehm-gc/ia64_save_regs_in_stack.S +@@ -0,0 +1,15 @@ ++ .text ++ .align 16 ++ .global GC_save_regs_in_stack ++ .proc GC_save_regs_in_stack ++GC_save_regs_in_stack: ++ .bodyfoo.mpg ++ flushrs ++ ;; ++ mov r8=ar.bsp ++ br.ret.sptk.few rp ++ .endp GC_save_regs_in_stack ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/boehm-gc/ia64_save_regs_in_stack.s +=================================================================== +--- gcc-4.2.3.orig/boehm-gc/ia64_save_regs_in_stack.s ++++ /dev/null +@@ -1,12 +0,0 @@ +- .text +- .align 16 +- .global GC_save_regs_in_stack +- .proc GC_save_regs_in_stack +-GC_save_regs_in_stack: +- .body +- flushrs +- ;; +- mov r8=ar.bsp +- br.ret.sptk.few rp +- .endp GC_save_regs_in_stack +- +Index: gcc-4.2.3/libffi/src/alpha/osf.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/alpha/osf.S ++++ gcc-4.2.3/libffi/src/alpha/osf.S +@@ -358,4 +358,8 @@ $LASFDE3: + .byte 16 # uleb128 offset 16*-8 + .align 3 + $LEFDE3: ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif + #endif +Index: gcc-4.2.3/libffi/src/arm/sysv.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/arm/sysv.S ++++ gcc-4.2.3/libffi/src/arm/sysv.S +@@ -207,3 +207,6 @@ LSYM(Lepilogue): + .ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",%progbits ++#endif +Index: gcc-4.2.3/libffi/src/ia64/unix.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/ia64/unix.S ++++ gcc-4.2.3/libffi/src/ia64/unix.S +@@ -553,3 +553,7 @@ ffi_closure_unix: + data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT + data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE + data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/m68k/sysv.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/m68k/sysv.S ++++ gcc-4.2.3/libffi/src/m68k/sysv.S +@@ -95,3 +95,7 @@ epilogue: + unlk %a6 + rts + .size ffi_call_SYSV,.-ffi_call_SYSV ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/powerpc/linux64.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/powerpc/linux64.S ++++ gcc-4.2.3/libffi/src/powerpc/linux64.S +@@ -175,3 +175,7 @@ ffi_call_LINUX64: + .align 3 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/powerpc/linux64_closure.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/powerpc/linux64_closure.S ++++ gcc-4.2.3/libffi/src/powerpc/linux64_closure.S +@@ -204,3 +204,7 @@ ffi_closure_LINUX64: + .align 3 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/powerpc/ppc_closure.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/powerpc/ppc_closure.S ++++ gcc-4.2.3/libffi/src/powerpc/ppc_closure.S +@@ -281,3 +281,7 @@ END(ffi_closure_SYSV) + .LEFDE1: + + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/powerpc/sysv.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/powerpc/sysv.S ++++ gcc-4.2.3/libffi/src/powerpc/sysv.S +@@ -217,3 +217,7 @@ END(ffi_call_SYSV) + .align 2 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/s390/sysv.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/s390/sysv.S ++++ gcc-4.2.3/libffi/src/s390/sysv.S +@@ -427,3 +427,6 @@ ffi_closure_SYSV: + + #endif + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/sparc/v8.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/sparc/v8.S ++++ gcc-4.2.3/libffi/src/sparc/v8.S +@@ -265,3 +265,7 @@ done2: + .byte 0x1f ! uleb128 0x1f + .align WS + .LLEFDE2: ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/sparc/v9.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/sparc/v9.S ++++ gcc-4.2.3/libffi/src/sparc/v9.S +@@ -300,3 +300,7 @@ longdouble1: + .align 8 + .LLEFDE2: + #endif ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/x86/sysv.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/x86/sysv.S ++++ gcc-4.2.3/libffi/src/x86/sysv.S +@@ -376,3 +376,7 @@ ffi_closure_raw_SYSV: + #endif + + #endif /* ifndef __x86_64__ */ ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +Index: gcc-4.2.3/libffi/src/x86/unix64.S +=================================================================== +--- gcc-4.2.3.orig/libffi/src/x86/unix64.S ++++ gcc-4.2.3/libffi/src/x86/unix64.S +@@ -410,3 +410,7 @@ ffi_closure_unix64: + .LEFDE3: + + #endif /* __x86_64__ */ ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif diff --git a/patches/gcc-4.2.4/generic/gentoo/74_all_sh-pr24836.patch b/patches/gcc-4.2.4/generic/gentoo/74_all_sh-pr24836.patch new file mode 100644 index 0000000..d752f99 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/74_all_sh-pr24836.patch @@ -0,0 +1,34 @@ +http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836 + +--- + gcc/configure | 2 +- + gcc/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Index: gcc-4.2.3/gcc/configure.ac +=================================================================== +--- gcc-4.2.3.orig/gcc/configure.ac ++++ gcc-4.2.3/gcc/configure.ac +@@ -2535,7 +2535,7 @@ foo: .long 25 + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 +Index: gcc-4.2.3/gcc/configure +=================================================================== +--- gcc-4.2.3.orig/gcc/configure ++++ gcc-4.2.3/gcc/configure +@@ -14562,7 +14562,7 @@ foo: .long 25 + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 diff --git a/patches/gcc-4.2.4/generic/gentoo/85_all_gcc-ca-translation-typo.patch b/patches/gcc-4.2.4/generic/gentoo/85_all_gcc-ca-translation-typo.patch new file mode 100644 index 0000000..c713ad6 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/85_all_gcc-ca-translation-typo.patch @@ -0,0 +1,23 @@ +http://bugs.gentoo.org/127190 + +2006-03-28 Harald van Dijk <truedfx@gentoo.org> + + * ca.po: Fix printf flag typo in negative value translation. + +--- + gcc/po/ca.po | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: gcc-4.2.3/gcc/po/ca.po +=================================================================== +--- gcc-4.2.3.orig/gcc/po/ca.po ++++ gcc-4.2.3/gcc/po/ca.po +@@ -34197,7 +34197,7 @@ msgstr "s'ignora l'atribut \"%s\"" + #~ msgstr "passant el valor negatiu `%E' per a %s %P de \"%D\"" + + #~ msgid "%s of negative value `%E' to `%T'" +-#~ msgstr "%s de valor negatiu `%I' a \"%T\"" ++#~ msgstr "%s de valor negatiu `%E' a \"%T\"" + + #~ msgid "initializing array with parameter list" + #~ msgstr "inicialitzant una matriu amb una llista de paràmetres" diff --git a/patches/gcc-4.2.4/generic/gentoo/90_all_mips-add-march-r10k.patch b/patches/gcc-4.2.4/generic/gentoo/90_all_mips-add-march-r10k.patch new file mode 100644 index 0000000..90ae394 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/90_all_mips-add-march-r10k.patch @@ -0,0 +1,405 @@ +--- + gcc/config/mips/10000.md | 248 +++++++++++++++++++++++++++++++++++++++++++++++ + gcc/config/mips/mips.c | 62 +++++++++++ + gcc/config/mips/mips.h | 12 ++ + gcc/config/mips/mips.md | 3 + 4 files changed, 324 insertions(+), 1 deletion(-) + +Index: gcc-4.2.3/gcc/config/mips/10000.md +=================================================================== +--- /dev/null ++++ gcc-4.2.3/gcc/config/mips/10000.md +@@ -0,0 +1,248 @@ ++;; VR1x000 pipeline description. ++;; Copyright (C) 2005, 2006 Free Software Foundation, Inc. ++;; ++;; This file is part of GCC. ++ ++;; GCC 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. ++ ++;; GCC 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. ++ ++ ++;; This file overrides parts of generic.md. It is derived from the ++;; old define_function_unit description. ++ ++ ++ ++;; R12K/R14K/R16K are derivatives of R10K, thus copy its description ++;; until specific tuning for each is added ++ ++ ++;; R10000 has int queue, fp queue, address queue ++(define_automaton "r10k_int, r10k_fp, r10k_addr") ++ ++;; R10000 has 2 integer ALUs, fp-adder and fp-multiplier, load/store ++(define_cpu_unit "r10k_alu1" "r10k_int") ++(define_cpu_unit "r10k_alu2" "r10k_int") ++(define_cpu_unit "r10k_fpadd" "r10k_fp") ++(define_cpu_unit "r10k_fpmpy" "r10k_fp") ++(define_cpu_unit "r10k_loadstore" "r10k_addr") ++ ++;; R10000 has separate fp-div and fp-sqrt units as well and these can ++;; execute in parallel, however their issue & completion logic is shared ++;; by the fp-multiplier ++(define_cpu_unit "r10k_fpdiv" "r10k_fp") ++(define_cpu_unit "r10k_fpsqrt" "r10k_fp") ++ ++ ++ ++ ++;; loader ++(define_insn_reservation "r10k_load" 2 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "load,prefetch,prefetchx")) ++ "r10k_loadstore") ++ ++(define_insn_reservation "r10k_store" 0 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "store,fpstore,fpidxstore")) ++ "r10k_loadstore") ++ ++(define_insn_reservation "r10k_fpload" 3 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "fpload,fpidxload")) ++ "r10k_loadstore") ++ ++ ++ ++ ++;; Integer add/sub + logic ops, and mf/mt hi/lo can be done by alu1 or alu2 ++;; Miscellaneous arith goes here too (this is a guess) ++(define_insn_reservation "r10k_arith" 1 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "arith,mfhilo,mthilo,slt,clz,const,nop,trap")) ++ "r10k_alu1 | r10k_alu2") ++ ++ ++ ++ ++;; ALU1 handles shifts, branch eval, and condmove ++;; ++;; Brancher is separate, but part of ALU1, but can only ++;; do one branch per cycle (needs implementing??) ++;; ++;; jump, call - unsure if brancher handles these too (added for now) ++(define_insn_reservation "r10k_shift" 1 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "shift,branch,jump,call")) ++ "r10k_alu1") ++ ++(define_insn_reservation "r10k_int_cmove" 1 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "condmove") ++ (eq_attr "mode" "SI,DI"))) ++ "r10k_alu1") ++ ++ ++ ++ ++;; Coprocessor Moves ++;; mtc1/dmtc1 are handled by ALU1 ++;; mfc1/dmfc1 are handled by the fp-multiplier ++(define_insn_reservation "r10k_mt_xfer" 3 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "xfer") ++ (not (match_operand 0 "fpr_operand")))) ++ "r10k_alu1") ++ ++(define_insn_reservation "r10k_mf_xfer" 2 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "xfer") ++ (match_operand 0 "fpr_operand"))) ++ "r10k_fpmpy") ++ ++ ++ ++ ++;; Only ALU2 does int multiplications and divisions ++;; R10K allows an int insn using register Lo to be issued ++;; one cycle earlier than an insn using register Hi for ++;; the insns below, however, we skip on doing this ++;; for now until correct usage of lo_operand() is figured ++;; out. ++;; ++;; Divides keep ALU2 busy, but this isn't expressed here (I think...?) ++(define_insn_reservation "r10k_imul_single" 6 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "imul,imul3,imadd") ++ (eq_attr "mode" "SI"))) ++ "r10k_alu2 * 6") ++ ++(define_insn_reservation "r10k_imul_double" 10 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "imul,imul3,imadd") ++ (eq_attr "mode" "DI"))) ++ "r10k_alu2 * 10") ++ ++(define_insn_reservation "r10k_idiv_single" 35 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "idiv") ++ (eq_attr "mode" "SI"))) ++ "r10k_alu2 * 35") ++ ++(define_insn_reservation "r10k_idiv_double" 67 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "idiv") ++ (eq_attr "mode" "DI"))) ++ "r10k_alu2 * 67") ++ ++ ++ ++ ++;; FP add/sub, mul, abs value, neg, comp, & moves ++(define_insn_reservation "r10k_fp_miscadd" 2 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "fadd,fabs,fneg,fcmp")) ++ "r10k_fpadd") ++ ++(define_insn_reservation "r10k_fp_miscmul" 2 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "fmul,fmove")) ++ "r10k_fpmpy") ++ ++(define_insn_reservation "r10k_fp_cmove" 2 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "condmove") ++ (eq_attr "mode" "SF,DF"))) ++ "r10k_fpmpy") ++ ++ ++ ++ ++;; fcvt.s.[wl] has latency 4, repeat 2 ++;; All other fcvt have latency 2, repeat 1 ++(define_insn_reservation "r10k_fcvt_single" 4 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "fcvt") ++ (eq_attr "cnv_mode" "I2S"))) ++ "r10k_fpadd * 2") ++ ++(define_insn_reservation "r10k_fcvt_other" 2 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "fcvt") ++ (eq_attr "cnv_mode" "!I2S"))) ++ "r10k_fpadd") ++ ++ ++ ++ ++;; fmadd - Runs through fp-adder first, then fp-multiplier ++;; ++;; The latency for fmadd is 2 cycles if the result is used ++;; by another fmadd instruction ++(define_insn_reservation "r10k_fmadd" 4 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "fmadd")) ++ "r10k_fpadd, r10k_fpmpy") ++ ++(define_bypass 2 "r10k_fmadd" "r10k_fmadd") ++ ++ ++ ++ ++;; fp Divisions & square roots ++(define_insn_reservation "r10k_fdiv_single" 12 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "fdiv,frdiv") ++ (eq_attr "mode" "SF"))) ++ "r10k_fpdiv * 14") ++ ++(define_insn_reservation "r10k_fdiv_double" 19 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "fdiv,frdiv") ++ (eq_attr "mode" "DF"))) ++ "r10k_fpdiv * 21") ++ ++(define_insn_reservation "r10k_fsqrt_single" 18 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "fsqrt") ++ (eq_attr "mode" "SF"))) ++ "r10k_fpsqrt * 20") ++ ++(define_insn_reservation "r10k_fsqrt_double" 33 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "fsqrt") ++ (eq_attr "mode" "DF"))) ++ "r10k_fpsqrt * 35") ++ ++(define_insn_reservation "r10k_frsqrt_single" 30 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "frsqrt") ++ (eq_attr "mode" "SF"))) ++ "r10k_fpsqrt * 20") ++ ++(define_insn_reservation "r10k_frsqrt_double" 52 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (and (eq_attr "type" "frsqrt") ++ (eq_attr "mode" "DF"))) ++ "r10k_fpsqrt * 35") ++ ++ ++ ++ ++;; Unknown/multi (this is a guess) ++(define_insn_reservation "r10k_unknown" 1 ++ (and (eq_attr "cpu" "r10000,r12000,r14000,r16000") ++ (eq_attr "type" "unknown,multi")) ++ "r10k_alu1 + r10k_alu2") ++ +Index: gcc-4.2.3/gcc/config/mips/mips.c +=================================================================== +--- gcc-4.2.3.orig/gcc/config/mips/mips.c ++++ gcc-4.2.3/gcc/config/mips/mips.c +@@ -734,6 +734,10 @@ const struct mips_cpu_info mips_cpu_info + + /* MIPS IV */ + { "r8000", PROCESSOR_R8000, 4 }, ++ { "r10000", PROCESSOR_R10000, 4 }, ++ { "r12000", PROCESSOR_R12000, 4 }, ++ { "r14000", PROCESSOR_R14000, 4 }, ++ { "r16000", PROCESSOR_R16000, 4 }, + { "vr5000", PROCESSOR_R5000, 4 }, + { "vr5400", PROCESSOR_R5400, 4 }, + { "vr5500", PROCESSOR_R5500, 4 }, +@@ -1014,6 +1018,58 @@ static struct mips_rtx_cost_data const m + 1, /* branch_cost */ + 4 /* memory_latency */ + }, ++ { /* R10000 */ ++ COSTS_N_INSNS (2), /* fp_add */ ++ COSTS_N_INSNS (2), /* fp_mult_sf */ ++ COSTS_N_INSNS (2), /* fp_mult_df */ ++ COSTS_N_INSNS (12), /* fp_div_sf */ ++ COSTS_N_INSNS (19), /* fp_div_df */ ++ COSTS_N_INSNS (6), /* int_mult_si */ ++ COSTS_N_INSNS (10), /* int_mult_di */ ++ COSTS_N_INSNS (35), /* int_div_si */ ++ COSTS_N_INSNS (67), /* int_div_di */ ++ 1, /* branch_cost */ ++ 4 /* memory_latency */ ++ }, ++ { /* R12000 */ ++ COSTS_N_INSNS (2), /* fp_add */ ++ COSTS_N_INSNS (2), /* fp_mult_sf */ ++ COSTS_N_INSNS (2), /* fp_mult_df */ ++ COSTS_N_INSNS (12), /* fp_div_sf */ ++ COSTS_N_INSNS (19), /* fp_div_df */ ++ COSTS_N_INSNS (6), /* int_mult_si */ ++ COSTS_N_INSNS (10), /* int_mult_di */ ++ COSTS_N_INSNS (35), /* int_div_si */ ++ COSTS_N_INSNS (67), /* int_div_di */ ++ 1, /* branch_cost */ ++ 4 /* memory_latency */ ++ }, ++ { /* R14000 */ ++ COSTS_N_INSNS (2), /* fp_add */ ++ COSTS_N_INSNS (2), /* fp_mult_sf */ ++ COSTS_N_INSNS (2), /* fp_mult_df */ ++ COSTS_N_INSNS (12), /* fp_div_sf */ ++ COSTS_N_INSNS (19), /* fp_div_df */ ++ COSTS_N_INSNS (6), /* int_mult_si */ ++ COSTS_N_INSNS (10), /* int_mult_di */ ++ COSTS_N_INSNS (35), /* int_div_si */ ++ COSTS_N_INSNS (67), /* int_div_di */ ++ 1, /* branch_cost */ ++ 4 /* memory_latency */ ++ }, ++ { /* R16000 */ ++ COSTS_N_INSNS (2), /* fp_add */ ++ COSTS_N_INSNS (2), /* fp_mult_sf */ ++ COSTS_N_INSNS (2), /* fp_mult_df */ ++ COSTS_N_INSNS (12), /* fp_div_sf */ ++ COSTS_N_INSNS (19), /* fp_div_df */ ++ COSTS_N_INSNS (6), /* int_mult_si */ ++ COSTS_N_INSNS (10), /* int_mult_di */ ++ COSTS_N_INSNS (35), /* int_div_si */ ++ COSTS_N_INSNS (67), /* int_div_di */ ++ 1, /* branch_cost */ ++ 4 /* memory_latency */ ++ }, + { /* SB1 */ + /* These costs are the same as the SB-1A below. */ + COSTS_N_INSNS (4), /* fp_add */ +@@ -10136,6 +10192,12 @@ mips_issue_rate (void) + { + switch (mips_tune) + { ++ case PROCESSOR_R10000: ++ case PROCESSOR_R12000: ++ case PROCESSOR_R14000: ++ case PROCESSOR_R16000: ++ return 4; ++ + case PROCESSOR_R4130: + case PROCESSOR_R5400: + case PROCESSOR_R5500: +Index: gcc-4.2.3/gcc/config/mips/mips.h +=================================================================== +--- gcc-4.2.3.orig/gcc/config/mips/mips.h ++++ gcc-4.2.3/gcc/config/mips/mips.h +@@ -56,6 +56,10 @@ enum processor_type { + PROCESSOR_R7000, + PROCESSOR_R8000, + PROCESSOR_R9000, ++ PROCESSOR_R10000, ++ PROCESSOR_R12000, ++ PROCESSOR_R14000, ++ PROCESSOR_R16000, + PROCESSOR_SB1, + PROCESSOR_SB1A, + PROCESSOR_SR71000, +@@ -208,6 +212,10 @@ extern const struct mips_rtx_cost_data * + #define TARGET_MIPS5500 (mips_arch == PROCESSOR_R5500) + #define TARGET_MIPS7000 (mips_arch == PROCESSOR_R7000) + #define TARGET_MIPS9000 (mips_arch == PROCESSOR_R9000) ++#define TARGET_MIPS10000 (mips_arch == PROCESSOR_R10000) ++#define TARGET_MIPS12000 (mips_arch == PROCESSOR_R12000) ++#define TARGET_MIPS14000 (mips_arch == PROCESSOR_R14000) ++#define TARGET_MIPS16000 (mips_arch == PROCESSOR_R16000) + #define TARGET_SB1 (mips_arch == PROCESSOR_SB1 \ + || mips_arch == PROCESSOR_SB1A) + #define TARGET_SR71K (mips_arch == PROCESSOR_SR71000) +@@ -224,6 +232,10 @@ extern const struct mips_rtx_cost_data * + #define TUNE_MIPS6000 (mips_tune == PROCESSOR_R6000) + #define TUNE_MIPS7000 (mips_tune == PROCESSOR_R7000) + #define TUNE_MIPS9000 (mips_tune == PROCESSOR_R9000) ++#define TUNE_MIPS10000 (mips_tune == PROCESSOR_R10000) ++#define TUNE_MIPS12000 (mips_tune == PROCESSOR_R12000) ++#define TUNE_MIPS14000 (mips_tune == PROCESSOR_R14000) ++#define TUNE_MIPS16000 (mips_tune == PROCESSOR_R16000) + #define TUNE_SB1 (mips_tune == PROCESSOR_SB1 \ + || mips_tune == PROCESSOR_SB1A) + +Index: gcc-4.2.3/gcc/config/mips/mips.md +=================================================================== +--- gcc-4.2.3.orig/gcc/config/mips/mips.md ++++ gcc-4.2.3/gcc/config/mips/mips.md +@@ -340,7 +340,7 @@ + ;; Attribute describing the processor. This attribute must match exactly + ;; with the processor_type enumeration in mips.h. + (define_attr "cpu" +- "r3000,4kc,4kp,5kc,5kf,20kc,24k,24kx,m4k,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,sb1,sb1a,sr71000" ++ "r3000,4kc,4kp,5kc,5kf,20kc,24k,24kx,m4k,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,r10000,r12000,r14000,r16000,sb1,sb1a,sr71000" + (const (symbol_ref "mips_tune"))) + + ;; The type of hardware hazard associated with this instruction. +@@ -600,6 +600,7 @@ + (include "6000.md") + (include "7000.md") + (include "9000.md") ++(include "10000.md") + (include "sb1.md") + (include "sr71k.md") + (include "generic.md") diff --git a/patches/gcc-4.2.4/generic/gentoo/91_all_mips-ip28_cache_barriers-v4.patch b/patches/gcc-4.2.4/generic/gentoo/91_all_mips-ip28_cache_barriers-v4.patch new file mode 100644 index 0000000..48d52f6 --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/91_all_mips-ip28_cache_barriers-v4.patch @@ -0,0 +1,352 @@ +--- + gcc/config/mips/mips.c | 7 + gcc/config/mips/mips.opt | 10 + + gcc/config/mips/r10k-cacheb.c | 298 ++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 315 insertions(+) + +Index: gcc-4.2.3/gcc/config/mips/mips.c +=================================================================== +--- gcc-4.2.3.orig/gcc/config/mips/mips.c ++++ gcc-4.2.3/gcc/config/mips/mips.c +@@ -255,6 +255,9 @@ static const char *const mips_fp_conditi + MIPS_FP_CONDITIONS (STRINGIFY) + }; + ++/* R10K Cache Barrier Functions */ ++#include "r10k-cacheb.c" ++ + /* A function to save or store a register. The first argument is the + register and the second is the stack slot. */ + typedef void (*mips_save_restore_fn) (rtx, rtx); +@@ -8908,6 +8911,10 @@ vr4130_avoid_branch_rt_conflict (rtx ins + XEXP (cond, 1) = tmp; + } + } ++ if (TARGET_R10K_SPECEX) ++ { ++ r10k_insert_cache_barriers (); ++ } + } + + /* Implement -mvr4130-align. Go through each basic block and simulate the +Index: gcc-4.2.3/gcc/config/mips/mips.opt +=================================================================== +--- gcc-4.2.3.orig/gcc/config/mips/mips.opt ++++ gcc-4.2.3/gcc/config/mips/mips.opt +@@ -219,3 +219,13 @@ Perform VR4130-specific alignment optimi + mxgot + Target Report Var(TARGET_XGOT) + Lift restrictions on GOT size ++ ++mr10k-cache-barrier= ++Target Report Joined UInteger Var(TARGET_R10K_SPECEX) ++-mr10k-cache-barrier[=1|2] Generate cache barriers for SGI Indigo2/O2 R10k ++ ++mr10k-cache-barrier ++Target Undocumented Var(TARGET_R10K_SPECEX) VarExists ++ ++mip28-cache-barrier ++Target Undocumented Var(TARGET_R10K_SPECEX) VarExists +Index: gcc-4.2.3/gcc/config/mips/r10k-cacheb.c +=================================================================== +--- /dev/null ++++ gcc-4.2.3/gcc/config/mips/r10k-cacheb.c +@@ -0,0 +1,298 @@ ++/* 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)" ++ ++static int is_stack_pointer (rtx *x, void *data); ++static int check_p_mem_expr (rtx *memx, void *data); ++static int check_p_pattern_for_store (rtx *body, void *data); ++static int strmatch (const char *txt, const char *match); ++static int check_insn_for_store (int state, rtx insn); ++static int bb_insert_store_cache_barrier (rtx head, rtx nxtb); ++static int scan_1_bb_for_store (rtx head, rtx end); ++static int r10k_insert_cache_barriers (void); ++ ++ ++/* 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; ++ gcc_assert (head); ++ gcc_assert (end); ++ ++ /* 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 (TARGET_R10K_SPECEX) ++ { ++ basic_block bb; ++ ++ FOR_EACH_BB (bb) ++ if (0 <= bb->index) ++ scan_1_bb_for_store (BB_HEAD (bb), BB_END (bb)); ++ } ++ return 0; ++} diff --git a/patches/gcc-4.2.4/generic/gentoo/92_all_mips-pthread-with-shared.patch b/patches/gcc-4.2.4/generic/gentoo/92_all_mips-pthread-with-shared.patch new file mode 100644 index 0000000..342daad --- /dev/null +++ b/patches/gcc-4.2.4/generic/gentoo/92_all_mips-pthread-with-shared.patch @@ -0,0 +1,37 @@ +just like this, but for mips: +http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00526.html + +--- + gcc/config/mips/linux.h | 4 ++-- + gcc/config/mips/linux64.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +Index: gcc-4.2.3/gcc/config/mips/linux.h +=================================================================== +--- gcc-4.2.3.orig/gcc/config/mips/linux.h ++++ gcc-4.2.3/gcc/config/mips/linux.h +@@ -174,7 +174,7 @@ along with GCC; see the file COPYING3. + #undef LIB_SPEC + #define LIB_SPEC "\ + %{shared: -lc} \ +-%{!shared: %{pthread:-lpthread} \ +- %{profile:-lc_p} %{!profile: -lc}}" ++%{pthread:-lpthread} \ ++%{!shared: %{profile:-lc_p} %{!profile: -lc}}" + + #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h" +Index: gcc-4.2.3/gcc/config/mips/linux64.h +=================================================================== +--- gcc-4.2.3.orig/gcc/config/mips/linux64.h ++++ gcc-4.2.3/gcc/config/mips/linux64.h +@@ -32,8 +32,8 @@ along with GCC; see the file COPYING3. + #undef LIB_SPEC + #define LIB_SPEC "\ + %{shared: -lc} \ +-%{!shared: %{pthread:-lpthread} \ +- %{profile:-lc_p} %{!profile: -lc}}" ++%{pthread:-lpthread} \ ++%{!shared: %{profile:-lc_p} %{!profile: -lc}}" + + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1" + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1" |