aboutsummaryrefslogtreecommitdiff
path: root/4.0.4
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-02-05 00:46:15 +0000
committerMike Frysinger <vapier@gentoo.org>2007-02-05 00:46:15 +0000
commit1c16356b3fa5158b5f9327b933ae2f8b5061609b (patch)
tree3ad3cf09e2e6b26afaaf7f4040d6a135b6e76450 /4.0.4
parentgrab patch from redhat which is a backport from trunk to gcc-4.1 branch #163623 (diff)
downloadgcc-patches-1c16356b3fa5158b5f9327b933ae2f8b5061609b.tar.gz
gcc-patches-1c16356b3fa5158b5f9327b933ae2f8b5061609b.tar.bz2
gcc-patches-1c16356b3fa5158b5f9327b933ae2f8b5061609b.zip
initial 4.0.4 patchset based on last 4.0.3 patchset
Diffstat (limited to '4.0.4')
-rw-r--r--4.0.4/gentoo/00_all_gcc-3.4-alpha-mieee-default.patch29
-rw-r--r--4.0.4/gentoo/00_all_gcc-trampolinewarn.patch68
-rw-r--r--4.0.4/gentoo/00_all_gcc_unlink_if_ordinary.patch62
-rw-r--r--4.0.4/gentoo/01_all_gcc4-ice-hack.patch319
-rw-r--r--4.0.4/gentoo/02_all_gcc4-ppc64-m32-m64-multilib-only.patch22
-rw-r--r--4.0.4/gentoo/03_all_gcc4-java-nomulti.patch25
-rw-r--r--4.0.4/gentoo/04_all_gcc4-libgcc-cross-multilib.patch49
-rw-r--r--4.0.4/gentoo/05_all_gcc4-bitfield-ref-vec.patch36
-rw-r--r--4.0.4/gentoo/06_all_gcc4-slow-pthread-self.patch15
-rw-r--r--4.0.4/gentoo/08_all_gcc4-pr17965.patch116
-rw-r--r--4.0.4/gentoo/09_all_gcc4-vsb-stack.patch301
-rw-r--r--4.0.4/gentoo/10_all_gcc4-libltdl-multilib.patch191
-rw-r--r--4.0.4/gentoo/11_all_gcc-netbsd-symbolic.patch12
-rw-r--r--4.0.4/gentoo/11_all_gcc4-java-rh163099.patch58
-rw-r--r--4.0.4/gentoo/13_all_gcc4-libjava-ia64-backtrace.patch29
-rw-r--r--4.0.4/gentoo/15_all_gcc4-libffi-x86.patch684
-rw-r--r--4.0.4/gentoo/16_all_gcc4-ppc32-msecure-plt.patch766
-rw-r--r--4.0.4/gentoo/17_all_gcc4-dwarf2-usefbreg.patch143
-rw-r--r--4.0.4/gentoo/18_all_gcc4-dwarf2-prefer-1elt-vartracking.patch47
-rw-r--r--4.0.4/gentoo/19_all_gcc4-dwarf2-pr20268.patch102
-rw-r--r--4.0.4/gentoo/29_all_gcc4-pr19664.patch1984
-rw-r--r--4.0.4/gentoo/32_all_gcc4-pr20815.patch97
-rw-r--r--4.0.4/gentoo/34_all_arm-bigendian.patch67
-rw-r--r--4.0.4/gentoo/34_all_gcc4-pr22889.patch49
-rw-r--r--4.0.4/gentoo/36_all_gcc41-pr19664.patch23
-rw-r--r--4.0.4/gentoo/37_all_gcc42-boehmgc-include.patch142
-rw-r--r--4.0.4/gentoo/51_all_gcc-3.4-libiberty-pic.patch10
-rw-r--r--4.0.4/gentoo/54_all_300-libstdc++-pic.patch53
-rw-r--r--4.0.4/gentoo/61_all_gcc4-ia64-noteGNUstack.patch88
-rw-r--r--4.0.4/gentoo/62_all_gcc4-noteGNUstack.patch182
-rw-r--r--4.0.4/gentoo/74_all_sh-pr24836.patch16
-rw-r--r--4.0.4/gentoo/85_all_gcc-ca-translation-typo.patch17
-rw-r--r--4.0.4/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch11
-rw-r--r--4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-no.patch14
-rw-r--r--4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-yes.patch14
-rw-r--r--4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default.patch360
-rw-r--r--4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch28
-rw-r--r--4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch27
-rw-r--r--4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch28
-rw-r--r--4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch99
-rw-r--r--4.0.4/pie/def/02_all_gcc-4.0-v8.7.6.7-pie-sparc-default.patch100
-rw-r--r--4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch22
-rw-r--r--4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch22
-rw-r--r--4.0.4/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch11
-rw-r--r--4.0.4/pie/upstream/00_all_gcc-4.0-cvs-start_endfile.patch210
-rw-r--r--4.0.4/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch16
-rw-r--r--4.0.4/uclibc/90_all_100-uclibc-conf.patch518
-rw-r--r--4.0.4/uclibc/91_all_200-uclibc-locale.patch3237
-rw-r--r--4.0.4/uclibc/92_all_301-missing-execinfo_h.patch11
-rw-r--r--4.0.4/uclibc/92_all_302-c99-snprintf.patch11
-rw-r--r--4.0.4/uclibc/92_all_303-c99-complex-ugly-hack.patch12
51 files changed, 10553 insertions, 0 deletions
diff --git a/4.0.4/gentoo/00_all_gcc-3.4-alpha-mieee-default.patch b/4.0.4/gentoo/00_all_gcc-3.4-alpha-mieee-default.patch
new file mode 100644
index 0000000..1ab166f
--- /dev/null
+++ b/4.0.4/gentoo/00_all_gcc-3.4-alpha-mieee-default.patch
@@ -0,0 +1,29 @@
+Set the default behavior on alpha to use -mieee since the large majority of
+time we want this (bad/weird things can happen with packages built without
+-mieee).
+
+To satisfy those people who may not want -mieee forced on them all the time,
+we also provide -mno-ieee.
+
+Patch by Mike Frysinger <vapier@gentoo.org>
+
+--- gcc/config/alpha/alpha.h
++++ gcc/config/alpha/alpha.h
+@@ -96,7 +96,7 @@
+ while (0)
+ #endif
+
+-#define CPP_SPEC "%(cpp_subtarget)"
++#define CPP_SPEC "%(cpp_subtarget) %{!no-ieee:-mieee}"
+
+ #ifndef CPP_SUBTARGET_SPEC
+ #define CPP_SUBTARGET_SPEC ""
+@@ -301,6 +301,8 @@
+ N_("Request IEEE-conformant math library routines (OSF/1)")}, \
+ {"ieee", MASK_IEEE|MASK_IEEE_CONFORMANT, \
+ N_("Emit IEEE-conformant code, without inexact exceptions")}, \
++ {"no-ieee", - (MASK_IEEE|MASK_IEEE_CONFORMANT), \
++ N_("Do not emit IEEE-conformant code, without inexact exceptions")}, \
+ {"ieee-with-inexact", MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT, \
+ N_("Emit IEEE-conformant code, with inexact exceptions")}, \
+ {"build-constants", MASK_BUILD_CONSTANTS, \
diff --git a/4.0.4/gentoo/00_all_gcc-trampolinewarn.patch b/4.0.4/gentoo/00_all_gcc-trampolinewarn.patch
new file mode 100644
index 0000000..96db820
--- /dev/null
+++ b/4.0.4/gentoo/00_all_gcc-trampolinewarn.patch
@@ -0,0 +1,68 @@
+ This trivial patch causes gcc to emit a warning whenever
+ it generates a trampoline. These are otherwise hard to
+ locate.
+ Kevin F. Quinn <kevquinn@gentoo.org> 21 Dec 2005
+
+--- gcc/gcc/c.opt
++++ gcc/gcc/c.opt
+@@ -406,6 +406,10 @@
+ C ObjC Var(warn_traditional)
+ Warn about features not present in traditional C
+
++Wtrampolines
++C ObjC C++ ObjC++
++Warn whenever the compiler generates a trampoline
++
+ Wtrigraphs
+ C ObjC C++ ObjC++
+ Warn if trigraphs are encountered that might affect the meaning of the program
+--- gcc/gcc/c-opts.c
++++ gcc/gcc/c-opts.c
+@@ -476,6 +476,10 @@
+ cpp_opts->warn_traditional = value;
+ break;
+
++ case OPT_Wtrampolines:
++ warn_trampolines = value;
++ break;
++
+ case OPT_Wtrigraphs:
+ cpp_opts->warn_trigraphs = value;
+ break;
+--- gcc/gcc/flags.h
++++ gcc/gcc/flags.h
+@@ -118,6 +118,10 @@
+
+ extern int warn_strict_aliasing;
+
++/* Warn whenever a trampoline is generated. */
++
++extern bool warn_trampolines;
++
+ /* Temporarily suppress certain warnings.
+ This is set while reading code from a system header file. */
+
+--- gcc/gcc/varasm.c
++++ gcc/gcc/varasm.c
+@@ -5428,6 +5428,9 @@
+
+ int trampolines_created;
+
++/* Warn when a trampoline is generated. */
++bool warn_trampolines = 1;
++
+ void
+ file_end_indicate_exec_stack (void)
+ {
+--- gcc/gcc/builtins.c
++++ gcc/gcc/builtins.c
+@@ -5014,6 +5014,9 @@
+ #endif
+ trampolines_created = 1;
+ INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain);
++
++ if (warn_trampolines)
++ warning ("generating trampoline in object (requires executable stack)");
+
+ return const0_rtx;
+ }
diff --git a/4.0.4/gentoo/00_all_gcc_unlink_if_ordinary.patch b/4.0.4/gentoo/00_all_gcc_unlink_if_ordinary.patch
new file mode 100644
index 0000000..4bd25f2
--- /dev/null
+++ b/4.0.4/gentoo/00_all_gcc_unlink_if_ordinary.patch
@@ -0,0 +1,62 @@
+Following the logic of the binutils change upstream (the addition of the
+new unlink_if_ordinary() function), we update collect2 so that it will
+only unlink files if they are 'ordinary' (in other words, a regular file
+or a symlink).
+
+This allows us to do fun things like `gcc test.c -o /dev/null` and not
+have to worry about the toolchain doing unlink(/dev/null) on us (cause
+that sucks huge wang). For example, this is common on a parisc/mips
+machine:
+# gcc test.c -o /dev/null
+/usr/hppa2.0-unknown-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output
+collect2: ld returned 1 exit status
+# ls /dev/null
+ls: /dev/null: No such file or directory
+
+http://bugs.gentoo.org/show_bug.cgi?id=79836
+
+--- gcc/gcc/collect2.c
++++ gcc/gcc/collect2.c
+@@ -34,6 +34,12 @@
+ #if ! defined( SIGCHLD ) && defined( SIGCLD )
+ # define SIGCHLD SIGCLD
+ #endif
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
+
+ #ifdef vfork /* Autoconf may define this to fork for us. */
+ # define VFORK_STRING "fork"
+@@ -1574,14 +1603,24 @@
+ do_wait (prog);
+ }
+
+-/* Unlink a file unless we are debugging. */
+-
++/* Unlink a file unless we are debugging or file is not normal. */
++#ifndef S_ISLNK
++#ifdef S_IFLNK
++#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
++#else
++#define S_ISLNK(m) 0
++#define lstat stat
++#endif
++#endif
+ static void
+ maybe_unlink (const char *file)
+ {
+- if (!debug)
+- unlink (file);
+- else
++ if (!debug) {
++ struct stat st;
++ if (lstat (file, &st) == 0
++ && (S_ISREG (st.st_mode) || S_ISLNK (st.st_mode)))
++ unlink (file);
++ } else
+ notice ("[Leaving %s]\n", file);
+ }
+
diff --git a/4.0.4/gentoo/01_all_gcc4-ice-hack.patch b/4.0.4/gentoo/01_all_gcc4-ice-hack.patch
new file mode 100644
index 0000000..953ea59
--- /dev/null
+++ b/4.0.4/gentoo/01_all_gcc4-ice-hack.patch
@@ -0,0 +1,319 @@
+2004-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ * system.h (ICE_EXIT_CODE): Define.
+ * 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/system.h.jj 2004-01-19 17:29:30.000000000 +0100
++++ gcc/system.h 2004-01-21 11:53:41.000000000 +0100
+@@ -153,6 +153,10 @@ extern int errno;
+ # endif
+ #endif
+
++#ifndef ICE_EXIT_CODE
++# define ICE_EXIT_CODE 27
++#endif
++
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+--- gcc/gcc.c.jj 2004-01-21 11:45:20.000000000 +0100
++++ gcc/gcc.c 2004-01-21 11:56:46.000000000 +0100
+@@ -352,6 +352,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 **);
+@@ -2753,7 +2756,7 @@ execute (void)
+ if (commands[i].pid == -1)
+ pfatal_pexecute (errmsg_fmt, errmsg_arg);
+
+- if (string != commands[i].prog)
++ if (i && string != commands[i].prog)
+ free ((void *) string);
+ }
+
+@@ -2831,6 +2834,18 @@ 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
++ && j == 0
++ && (p = strrchr (commands[j].argv[0], DIR_SEPARATOR))
++ && ! strncmp (p + 1, "cc1", 3))
++ retry_ice (commands[j].prog, commands[j].argv);
++#endif
++
+ if (WEXITSTATUS (status) > greatest_status)
+ greatest_status = WEXITSTATUS (status);
+ ret_code = -1;
+@@ -2842,6 +2856,10 @@ See %s for instructions.",
+ break;
+ }
+ }
++
++ if (commands[0].argv[0] != commands[0].prog)
++ free ((PTR) commands[0].argv[0]);
++
+ return ret_code;
+ }
+ }
+@@ -5809,6 +5827,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 varry 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;
++ 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. */
+--- gcc/diagnostic.c.jj 2003-10-01 12:09:21.000000000 +0200
++++ gcc/diagnostic.c 2004-01-21 11:54:47.000000000 +0100
+@@ -237,14 +237,14 @@ diagnostic_action_after_output (diagnost
+ fnotice (stderr, "Please submit a full bug report,\n"
+ "with preprocessed source if appropriate.\n"
+ "See %s for instructions.\n", bug_report_url);
+- exit (FATAL_EXIT_CODE);
++ exit (ICE_EXIT_CODE);
+
+ case DK_FATAL:
+ if (context->abort_on_error)
+ real_abort ();
+
+ fnotice (stderr, "compilation terminated.\n");
+- exit (FATAL_EXIT_CODE);
++ exit (ICE_EXIT_CODE);
+
+ default:
+ gcc_unreachable ();
diff --git a/4.0.4/gentoo/02_all_gcc4-ppc64-m32-m64-multilib-only.patch b/4.0.4/gentoo/02_all_gcc4-ppc64-m32-m64-multilib-only.patch
new file mode 100644
index 0000000..00dbeac
--- /dev/null
+++ b/4.0.4/gentoo/02_all_gcc4-ppc64-m32-m64-multilib-only.patch
@@ -0,0 +1,22 @@
+--- gcc/config/rs6000/t-linux64 2003-06-03 05:11:45.000000000 -0400
++++ gcc/config/rs6000/t-linux64 2003-06-11 17:07:16.000000000 -0400
+@@ -4,13 +4,13 @@ LIB2FUNCS_EXTRA = tramp.S $(srcdir)/conf
+ # Modify the shared lib version file
+ SHLIB_MKMAP_OPTS = -v dotsyms=1
+
+-MULTILIB_OPTIONS = m64/m32 msoft-float
+-MULTILIB_DIRNAMES = 64 32 nof
++MULTILIB_OPTIONS = m64/m32
++MULTILIB_DIRNAMES = 64 32
+ MULTILIB_EXTRA_OPTS = fPIC mstrict-align
+-MULTILIB_EXCEPTIONS = m64/msoft-float
+-MULTILIB_EXCLUSIONS = m64/!m32/msoft-float
+-MULTILIB_OSDIRNAMES = ../lib64 ../lib nof
+-MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT)
++MULTILIB_EXCEPTIONS =
++MULTILIB_EXCLUSIONS =
++MULTILIB_OSDIRNAMES = ../lib64 ../lib
++MULTILIB_MATCHES =
+
+ TARGET_LIBGCC2_CFLAGS = -mno-minimal-toc -fPIC
+
diff --git a/4.0.4/gentoo/03_all_gcc4-java-nomulti.patch b/4.0.4/gentoo/03_all_gcc4-java-nomulti.patch
new file mode 100644
index 0000000..3a6554d
--- /dev/null
+++ b/4.0.4/gentoo/03_all_gcc4-java-nomulti.patch
@@ -0,0 +1,25 @@
+--- libjava/configure.ac.jj 2004-08-16 21:13:29.000000000 +0200
++++ libjava/configure.ac 2004-08-21 11:44:59.020755542 +0200
+@@ -367,6 +367,10 @@ use_gtk_awt=""
+ TOOLKIT=
+ AC_SUBST(TOOLKIT)
+
++if test -n "${with_multisubdir}"; then
++ peerlibs=no
++fi
++
+ for peer in $peerlibs ; do
+ case $peer in
+ xlib)
+--- libjava/configure.jj 2004-08-16 21:22:14.000000000 +0200
++++ libjava/configure 2004-08-21 11:45:16.260738060 +0200
+@@ -4118,6 +4118,9 @@ use_gtk_awt=""
+ # The default toolkit to use is the first one specified.
+ TOOLKIT=
+
++if test -n "${with_multisubdir}"; then
++ peerlibs=no
++fi
+
+ for peer in $peerlibs ; do
+ case $peer in
diff --git a/4.0.4/gentoo/04_all_gcc4-libgcc-cross-multilib.patch b/4.0.4/gentoo/04_all_gcc4-libgcc-cross-multilib.patch
new file mode 100644
index 0000000..5c14a5e
--- /dev/null
+++ b/4.0.4/gentoo/04_all_gcc4-libgcc-cross-multilib.patch
@@ -0,0 +1,49 @@
+Backport from gcc-4.1
+
+2005-04-19 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile.in (libgcc.mk): Pass GCC_FOR_TARGET.
+ * mklibgcc.in: Use $GCC_FOR_TARGET instead of ./xgcc.
+
+Index: gcc-4_1-branch/gcc/Makefile.in
+===================================================================
+--- gcc-4_1-branch/gcc/Makefile.in (revision 98419)
++++ gcc-4_1-branch/gcc/Makefile.in (revision 98420)
+@@ -1262,6 +1262,7 @@
+ SHLIB_NM_FLAGS='$(SHLIB_NM_FLAGS)' \
+ MULTILIB_OSDIRNAMES='$(MULTILIB_OSDIRNAMES)' \
+ ASM_HIDDEN_OP='$(ASM_HIDDEN_OP)' \
++ GCC_FOR_TARGET='$(GCC_FOR_TARGET)' \
+ mkinstalldirs='$(mkinstalldirs)' \
+ $(SHELL) mklibgcc > tmp-libgcc.mk
+ mv tmp-libgcc.mk libgcc.mk
+Index: gcc-4_1-branch/gcc/mklibgcc.in
+===================================================================
+--- gcc-4_1-branch/gcc/mklibgcc.in (revision 98419)
++++ gcc-4_1-branch/gcc/mklibgcc.in (revision 98420)
+@@ -40,6 +40,7 @@
+ # SHLIB_INSTALL
+ # MULTILIB_OSDIRNAMES
+ # ASM_HIDDEN_OP
++# GCC_FOR_TARGET
+
+ # Make needs VPATH to be literal.
+ echo 'srcdir = @srcdir@'
+@@ -178,7 +179,7 @@
+ if [ "$LIBUNWIND" ]; then
+ libunwind_so=$dir/libunwind${SHLIB_EXT}
+ fi
+- os_multilib_dir=`./xgcc -B./ $flags --print-multi-os-directory`
++ os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
+ if [ "$os_multilib_dir" != . ]; then
+ shlib_slibdir_qual="/$os_multilib_dir"
+ fi
+@@ -804,7 +805,7 @@
+ echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
+
+ shlib_slibdir_qual=
+- os_multilib_dir=`./xgcc -B./ $flags --print-multi-os-directory`
++ os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
+ if [ "$os_multilib_dir" != . ]; then
+ shlib_slibdir_qual="/$os_multilib_dir"
+ fi
diff --git a/4.0.4/gentoo/05_all_gcc4-bitfield-ref-vec.patch b/4.0.4/gentoo/05_all_gcc4-bitfield-ref-vec.patch
new file mode 100644
index 0000000..c9375a3
--- /dev/null
+++ b/4.0.4/gentoo/05_all_gcc4-bitfield-ref-vec.patch
@@ -0,0 +1,36 @@
+2005-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ * fold-const.c (fold): Optimize BIT_FIELD_REF of VECTOR_CST.
+
+--- gcc/fold-const.c.jj 2005-05-16 23:31:03.000000000 +0200
++++ gcc/fold-const.c 2005-05-31 19:11:51.000000000 +0200
+@@ -9860,6 +9860,29 @@ fold (tree expr)
+ }
+ return t;
+
++ case BIT_FIELD_REF:
++ if (TREE_CODE (arg0) == VECTOR_CST
++ && type == TREE_TYPE (TREE_TYPE (arg0))
++ && host_integerp (arg1, 1)
++ && host_integerp (TREE_OPERAND (t, 2), 1))
++ {
++ unsigned HOST_WIDE_INT width = tree_low_cst (arg1, 1);
++ unsigned HOST_WIDE_INT idx = tree_low_cst (TREE_OPERAND (t, 2), 1);
++
++ if (width != 0
++ && simple_cst_equal (arg1, TYPE_SIZE (type)) == 1
++ && (idx % width) == 0
++ && (idx = idx / width)
++ < TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)))
++ {
++ tree elements = TREE_VECTOR_CST_ELTS (arg0);
++ while (idx-- > 0)
++ elements = TREE_CHAIN (elements);
++ return TREE_VALUE (elements);
++ }
++ }
++ return t;
++
+ default:
+ return t;
+ } /* switch (code) */
diff --git a/4.0.4/gentoo/06_all_gcc4-slow-pthread-self.patch b/4.0.4/gentoo/06_all_gcc4-slow-pthread-self.patch
new file mode 100644
index 0000000..f8f5012
--- /dev/null
+++ b/4.0.4/gentoo/06_all_gcc4-slow-pthread-self.patch
@@ -0,0 +1,15 @@
+2005-05-20 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.host (slow_pthread_self): Set to empty unconditionally
+ on Linux targets.
+
+--- libjava/configure.host 2005-03-15 18:05:24.000000000 +0100
++++ libjava/configure.host 2005-05-20 07:47:13.000000000 +0200
+@@ -174,6 +174,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/4.0.4/gentoo/08_all_gcc4-pr17965.patch b/4.0.4/gentoo/08_all_gcc4-pr17965.patch
new file mode 100644
index 0000000..279ca06
--- /dev/null
+++ b/4.0.4/gentoo/08_all_gcc4-pr17965.patch
@@ -0,0 +1,116 @@
+2005-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/17965
+ * calls.c (expand_call, emit_library_call_value_1): Use xmalloc/free
+ instead of alloca for really big argument sizes.
+
+ * gcc.c-torture/compile/20050622-1.c: New test.
+
+--- gcc/calls.c.jj 2005-05-16 09:44:21.000000000 +0200
++++ gcc/calls.c 2005-06-22 11:16:28.000000000 +0200
+@@ -1864,6 +1864,7 @@ expand_call (tree exp, rtx target, int i
+
+ int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
+ char *initial_stack_usage_map = stack_usage_map;
++ char *stack_usage_map_buf = NULL;
+
+ int old_stack_allocated;
+
+@@ -2360,7 +2361,16 @@ expand_call (tree exp, rtx target, int i
+ highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
+ needed);
+ #endif
+- stack_usage_map = alloca (highest_outgoing_arg_in_use);
++ if (highest_outgoing_arg_in_use >= 262144)
++ {
++ if (stack_usage_map_buf)
++ free (stack_usage_map_buf);
++ stack_usage_map_buf
++ = xmalloc (highest_outgoing_arg_in_use);
++ stack_usage_map = stack_usage_map_buf;
++ }
++ else
++ stack_usage_map = alloca (highest_outgoing_arg_in_use);
+
+ if (initial_highest_arg_in_use)
+ memcpy (stack_usage_map, initial_stack_usage_map,
+@@ -2465,7 +2475,16 @@ expand_call (tree exp, rtx target, int i
+ = stack_arg_under_construction;
+ stack_arg_under_construction = 0;
+ /* Make a new map for the new argument list. */
+- stack_usage_map = alloca (highest_outgoing_arg_in_use);
++ if (highest_outgoing_arg_in_use >= 262144)
++ {
++ if (stack_usage_map_buf)
++ free (stack_usage_map_buf);
++ stack_usage_map_buf
++ = xmalloc (highest_outgoing_arg_in_use);
++ stack_usage_map = stack_usage_map_buf;
++ }
++ else
++ stack_usage_map = alloca (highest_outgoing_arg_in_use);
+ memset (stack_usage_map, 0, highest_outgoing_arg_in_use);
+ highest_outgoing_arg_in_use = 0;
+ }
+@@ -3019,6 +3038,9 @@ expand_call (tree exp, rtx target, int i
+ emit_move_insn (virtual_stack_dynamic_rtx, stack_pointer_rtx);
+ }
+
++ if (stack_usage_map_buf)
++ free (stack_usage_map_buf);
++
+ return target;
+ }
+
+@@ -3213,6 +3235,7 @@ emit_library_call_value_1 (int retval, r
+ /* Size of the stack reserved for parameter registers. */
+ int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
+ char *initial_stack_usage_map = stack_usage_map;
++ char *stack_usage_map_buf = NULL;
+
+ rtx struct_value = targetm.calls.struct_value_rtx (0, 0);
+
+@@ -3491,7 +3514,13 @@ emit_library_call_value_1 (int retval, r
+ highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
+ needed);
+ #endif
+- stack_usage_map = alloca (highest_outgoing_arg_in_use);
++ if (highest_outgoing_arg_in_use >= 262144)
++ {
++ stack_usage_map_buf = xmalloc (highest_outgoing_arg_in_use);
++ stack_usage_map = stack_usage_map_buf;
++ }
++ else
++ stack_usage_map = alloca (highest_outgoing_arg_in_use);
+
+ if (initial_highest_arg_in_use)
+ memcpy (stack_usage_map, initial_stack_usage_map,
+@@ -3845,6 +3874,9 @@ emit_library_call_value_1 (int retval, r
+ stack_usage_map = initial_stack_usage_map;
+ }
+
++ if (stack_usage_map_buf)
++ free (stack_usage_map_buf);
++
+ return value;
+
+ }
+--- gcc/testsuite/gcc.c-torture/compile/20050622-1.c.jj 2005-06-22 11:18:01.000000000 +0200
++++ gcc/testsuite/gcc.c-torture/compile/20050622-1.c 2005-06-22 11:23:02.000000000 +0200
+@@ -0,0 +1,16 @@
++#if __SCHAR_MAX__ == 127 && __INT_MAX__ >= 2147483647
++struct S { char buf[72*1024*1024]; };
++#else
++struct S { char buf[64]; };
++#endif
++
++extern void bar (struct S);
++
++struct S s;
++
++int
++foo (void)
++{
++ bar (s);
++ return 0;
++}
diff --git a/4.0.4/gentoo/09_all_gcc4-vsb-stack.patch b/4.0.4/gentoo/09_all_gcc4-vsb-stack.patch
new file mode 100644
index 0000000..d5116e7
--- /dev/null
+++ b/4.0.4/gentoo/09_all_gcc4-vsb-stack.patch
@@ -0,0 +1,301 @@
+2005-05-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/20303
+ * c-pragma.c: Include "vec.h".
+ (handle_pragma_visibility): Use VEC.
+
+ * doc/invoke.texi: Remove the nested visibility push limit.
+
+2005-07-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/20303
+ * gcc.dg/visibility-d.c: New test.
+
+--- gcc/c-pragma.c.jj 2004-11-29 15:47:36.000000000 -0800
++++ gcc/c-pragma.c 2005-05-18 09:14:46.000000000 -0700
+@@ -34,6 +34,7 @@ Software Foundation, 59 Temple Place - S
+ #include "c-common.h"
+ #include "output.h"
+ #include "tm_p.h"
++#include "vec.h"
+ #include "target.h"
+
+ #define GCC_BAD(msgid) do { warning (msgid); return; } while (0)
+@@ -583,15 +584,19 @@ maybe_apply_renaming_pragma (tree decl,
+ #ifdef HANDLE_PRAGMA_VISIBILITY
+ static void handle_pragma_visibility (cpp_reader *);
+
++typedef enum symbol_visibility visibility;
++DEF_VEC_MALLOC_P (visibility);
++
+ /* Sets the default visibility for symbols to something other than that
+ specified on the command line. */
+ static void
+ handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
+-{ /* Form is #pragma GCC visibility push(hidden)|pop */
+- static int visstack [16], visidx;
++{
++ /* Form is #pragma GCC visibility push(hidden)|pop */
+ tree x;
+ enum cpp_ttype token;
+ enum { bad, push, pop } action = bad;
++ static VEC (visibility) *visstack;
+
+ token = c_lex (&x);
+ if (token == CPP_NAME)
+@@ -608,14 +613,15 @@ handle_pragma_visibility (cpp_reader *du
+ {
+ if (pop == action)
+ {
+- if (!visidx)
++ if (!VEC_length (visibility, visstack))
+ {
+ GCC_BAD ("No matching push for %<#pragma GCC visibility pop%>");
+ }
+ else
+ {
+- default_visibility = visstack[--visidx];
+- visibility_options.inpragma = (visidx>0);
++ default_visibility = VEC_pop (visibility, visstack);
++ visibility_options.inpragma
++ = VEC_length (visibility, visstack) != 0;
+ }
+ }
+ else
+@@ -627,14 +633,10 @@ handle_pragma_visibility (cpp_reader *du
+ {
+ GCC_BAD ("malformed #pragma GCC visibility push");
+ }
+- else if (visidx >= 16)
+- {
+- GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once");
+- }
+ else
+ {
+ const char *str = IDENTIFIER_POINTER (x);
+- visstack[visidx++] = default_visibility;
++ VEC_safe_push (visibility, visstack, default_visibility);
+ if (!strcmp (str, "default"))
+ default_visibility = VISIBILITY_DEFAULT;
+ else if (!strcmp (str, "internal"))
+--- gcc/doc/invoke.texi.jj 2005-05-18 09:09:40.000000000 -0700
++++ gcc/doc/invoke.texi 2005-05-18 09:09:40.000000000 -0700
+@@ -12445,8 +12445,8 @@ For those adding visibility support to e
+ @samp{#pragma GCC visibility} of use. This works by you enclosing
+ the declarations you wish to set visibility for with (for example)
+ @samp{#pragma GCC visibility push(hidden)} and
+-@samp{#pragma GCC visibility pop}. These can be nested up to sixteen
+-times. Bear in mind that symbol visibility should be viewed @strong{as
++@samp{#pragma GCC visibility pop}.
++Bear in mind that symbol visibility should be viewed @strong{as
+ part of the API interface contract} and thus all new code should
+ always specify visibility when it is not the default ie; declarations
+ only for use within the local DSO should @strong{always} be marked explicitly
+--- gcc/testsuite/gcc.dg/visibility-d.c.jj 2005-07-22 11:58:19.000000000 +0200
++++ gcc/testsuite/gcc.dg/visibility-d.c 2005-07-22 11:59:20.000000000 +0200
+@@ -0,0 +1,205 @@
++/* PR middle-end/20303 */
++/* Test nesting of #pragma GCC visibility. */
++/* { dg-do compile } */
++/* { dg-require-visibility "" } */
++/* { dg-final { scan-not-hidden "foo00" } } */
++/* { dg-final { scan-hidden "foo01" } } */
++/* { dg-final { scan-not-hidden "foo02" } } */
++/* { dg-final { scan-hidden "foo03" } } */
++/* { dg-final { scan-not-hidden "foo04" } } */
++/* { dg-final { scan-not-hidden "foo05" } } */
++/* { dg-final { scan-not-hidden "foo06" } } */
++/* { dg-final { scan-hidden "foo07" } } */
++/* { dg-final { scan-not-hidden "foo08" } } */
++/* { dg-final { scan-hidden "foo09" } } */
++/* { dg-final { scan-not-hidden "foo10" } } */
++/* { dg-final { scan-hidden "foo11" } } */
++/* { dg-final { scan-hidden "foo12" } } */
++/* { dg-final { scan-hidden "foo13" } } */
++/* { dg-final { scan-not-hidden "foo14" } } */
++/* { dg-final { scan-hidden "foo15" } } */
++/* { dg-final { scan-not-hidden "foo16" } } */
++/* { dg-final { scan-hidden "foo17" } } */
++/* { dg-final { scan-not-hidden "foo18" } } */
++/* { dg-final { scan-hidden "foo19" } } */
++/* { dg-final { scan-not-hidden "foo20" } } */
++/* { dg-final { scan-hidden "foo21" } } */
++/* { dg-final { scan-not-hidden "foo22" } } */
++/* { dg-final { scan-hidden "foo23" } } */
++/* { dg-final { scan-not-hidden "foo24" } } */
++/* { dg-final { scan-hidden "foo25" } } */
++/* { dg-final { scan-not-hidden "foo26" } } */
++/* { dg-final { scan-hidden "foo27" } } */
++/* { dg-final { scan-not-hidden "foo28" } } */
++/* { dg-final { scan-hidden "foo29" } } */
++/* { dg-final { scan-not-hidden "foo30" } } */
++/* { dg-final { scan-hidden "foo31" } } */
++/* { dg-final { scan-not-hidden "foo32" } } */
++/* { dg-final { scan-hidden "foo33" } } */
++/* { dg-final { scan-not-hidden "foo34" } } */
++/* { dg-final { scan-hidden "foo35" } } */
++/* { dg-final { scan-not-hidden "foo36" } } */
++/* { dg-final { scan-hidden "foo37" } } */
++/* { dg-final { scan-not-hidden "foo38" } } */
++/* { dg-final { scan-hidden "foo39" } } */
++/* { dg-final { scan-not-hidden "foo40" } } */
++/* { dg-final { scan-hidden "foo41" } } */
++/* { dg-final { scan-not-hidden "foo42" } } */
++/* { dg-final { scan-hidden "foo43" } } */
++/* { dg-final { scan-not-hidden "foo44" } } */
++/* { dg-final { scan-hidden "foo45" } } */
++/* { dg-final { scan-hidden "foo46" } } */
++/* { dg-final { scan-hidden "foo47" } } */
++/* { dg-final { scan-not-hidden "foo48" } } */
++/* { dg-final { scan-hidden "foo49" } } */
++/* { dg-final { scan-not-hidden "foo50" } } */
++/* { dg-final { scan-hidden "foo51" } } */
++/* { dg-final { scan-not-hidden "foo52" } } */
++/* { dg-final { scan-not-hidden "foo53" } } */
++/* { dg-final { scan-not-hidden "foo54" } } */
++/* { dg-final { scan-hidden "foo55" } } */
++/* { dg-final { scan-not-hidden "foo56" } } */
++/* { dg-final { scan-hidden "foo57" } } */
++/* { dg-final { scan-not-hidden "foo58" } } */
++/* { dg-final { scan-hidden "foo59" } } */
++
++#pragma GCC visibility push(default)
++void foo00();
++#pragma GCC visibility push(hidden)
++void foo01();
++#pragma GCC visibility push(default)
++void foo02();
++#pragma GCC visibility push(hidden)
++void foo03();
++#pragma GCC visibility push(default)
++void foo04();
++#pragma GCC visibility push(default)
++void foo05();
++#pragma GCC visibility push(default)
++void foo06();
++#pragma GCC visibility push(hidden)
++void foo07();
++#pragma GCC visibility push(default)
++void foo08();
++#pragma GCC visibility push(hidden)
++void foo09();
++#pragma GCC visibility push(default)
++void foo10();
++#pragma GCC visibility push(hidden)
++void foo11();
++#pragma GCC visibility push(hidden)
++void foo12();
++#pragma GCC visibility push(hidden)
++void foo13();
++#pragma GCC visibility push(default)
++void foo14();
++#pragma GCC visibility push(hidden)
++void foo15();
++#pragma GCC visibility push(default)
++void foo16();
++#pragma GCC visibility push(hidden)
++void foo17();
++#pragma GCC visibility push(default)
++void foo18();
++#pragma GCC visibility push(hidden)
++void foo19();
++#pragma GCC visibility push(default)
++void foo20();
++#pragma GCC visibility push(hidden)
++void foo21();
++#pragma GCC visibility push(default)
++void foo22();
++#pragma GCC visibility push(hidden)
++void foo23();
++#pragma GCC visibility push(default)
++void foo24();
++#pragma GCC visibility push(hidden)
++void foo25();
++#pragma GCC visibility push(default)
++void foo26();
++#pragma GCC visibility push(hidden)
++void foo27();
++#pragma GCC visibility push(default)
++void foo28();
++#pragma GCC visibility push(hidden)
++void foo29();
++#pragma GCC visibility pop
++void foo30();
++#pragma GCC visibility pop
++void foo31();
++#pragma GCC visibility pop
++void foo32();
++#pragma GCC visibility pop
++void foo33();
++#pragma GCC visibility pop
++void foo34();
++#pragma GCC visibility pop
++void foo35();
++#pragma GCC visibility pop
++void foo36();
++#pragma GCC visibility pop
++void foo37();
++#pragma GCC visibility pop
++void foo38();
++#pragma GCC visibility pop
++void foo39();
++#pragma GCC visibility pop
++void foo40();
++#pragma GCC visibility pop
++void foo41();
++#pragma GCC visibility pop
++void foo42();
++#pragma GCC visibility pop
++void foo43();
++#pragma GCC visibility pop
++void foo44();
++#pragma GCC visibility pop
++void foo45();
++#pragma GCC visibility pop
++void foo46();
++#pragma GCC visibility pop
++void foo47();
++#pragma GCC visibility pop
++void foo48();
++#pragma GCC visibility pop
++void foo49();
++#pragma GCC visibility pop
++void foo50();
++#pragma GCC visibility pop
++void foo51();
++#pragma GCC visibility pop
++void foo52();
++#pragma GCC visibility pop
++void foo53();
++#pragma GCC visibility pop
++void foo54();
++#pragma GCC visibility pop
++void foo55();
++#pragma GCC visibility pop
++void foo56();
++#pragma GCC visibility pop
++void foo57();
++#pragma GCC visibility pop
++void foo58();
++#pragma GCC visibility push (hidden)
++void foo59();
++#pragma GCC visibility pop
++#pragma GCC visibility pop
++
++#define D(N) \
++void foo##N##0() { } \
++void foo##N##1() { } \
++void foo##N##2() { } \
++void foo##N##3() { } \
++void foo##N##4() { } \
++void foo##N##5() { } \
++void foo##N##6() { } \
++void foo##N##7() { } \
++void foo##N##8() { } \
++void foo##N##9() { }
++D(0)
++D(1)
++D(2)
++D(3)
++D(4)
++D(5)
diff --git a/4.0.4/gentoo/10_all_gcc4-libltdl-multilib.patch b/4.0.4/gentoo/10_all_gcc4-libltdl-multilib.patch
new file mode 100644
index 0000000..7b94f57
--- /dev/null
+++ b/4.0.4/gentoo/10_all_gcc4-libltdl-multilib.patch
@@ -0,0 +1,191 @@
+2005-06-17 Jakub Jelinek <jakub@redhat.com>
+
+ * acinclude.m4 (AC_LIBTOOL_SYS_DYNAMIC_LINKER): Set
+ sys_lib_dlsearch_path_spec on bi-arch linux architectures
+ for 64-bit builds.
+ * configure: Rebuilt.
+
+--- libjava/libltdl/acinclude.m4.jj 2005-03-11 14:02:06.000000000 +0100
++++ libjava/libltdl/acinclude.m4 2005-06-17 14:37:06.000000000 +0200
+@@ -1434,6 +1434,24 @@ linux*)
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
++
++ # Find out which ABI we are using.
++ case "$host_cpu" in
++ x86_64*|s390*|sparc*|ppc*|powerpc*)
++ AC_LANG_PUSH(C)
++ lt_linux_biarch_save_CC="$CC"
++ CC="${LTCC-$CC}"
++ echo 'int i;' > conftest.$ac_ext
++ if AC_TRY_EVAL(ac_compile); then
++ case "`/usr/bin/file conftest.o`" in
++ *64-bit*) sys_lib_dlsearch_path_spec="/lib64 /usr/lib64";;
++ esac
++ fi
++ rm -rf conftest*
++ CC="$lt_linux_biarch_save_CC"
++ AC_LANG_POP
++ ;;
++ esac
+ ;;
+
+ netbsd*)
+--- libjava/libltdl/configure.jj 2005-03-11 14:02:07.000000000 +0100
++++ libjava/libltdl/configure 2005-06-17 14:37:11.000000000 +0200
+@@ -8421,6 +8421,38 @@ linux*)
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
++
++ # Find out which ABI we are using.
++ case "$host_cpu" in
++ x86_64*|s390*|sparc*|ppc*|powerpc*)
++ ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++ lt_linux_biarch_save_CC="$CC"
++ CC="${LTCC-$CC}"
++ echo 'int i;' > conftest.$ac_ext
++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; then
++ case "`/usr/bin/file conftest.o`" in
++ *64-bit*) sys_lib_dlsearch_path_spec="/lib64 /usr/lib64";;
++ esac
++ fi
++ rm -rf conftest*
++ CC="$lt_linux_biarch_save_CC"
++ ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++ ;;
++ esac
+ ;;
+
+ netbsd*)
+@@ -12071,6 +12103,38 @@ linux*)
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
++
++ # Find out which ABI we are using.
++ case "$host_cpu" in
++ x86_64*|s390*|sparc*|ppc*|powerpc*)
++ ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++ lt_linux_biarch_save_CC="$CC"
++ CC="${LTCC-$CC}"
++ echo 'int i;' > conftest.$ac_ext
++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; then
++ case "`/usr/bin/file conftest.o`" in
++ *64-bit*) sys_lib_dlsearch_path_spec="/lib64 /usr/lib64";;
++ esac
++ fi
++ rm -rf conftest*
++ CC="$lt_linux_biarch_save_CC"
++ ac_ext=cc
++ac_cpp='$CXXCPP $CPPFLAGS'
++ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
++
++ ;;
++ esac
+ ;;
+
+ netbsd*)
+@@ -15156,6 +15220,37 @@ linux*)
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
++
++ # Find out which ABI we are using.
++ case "$host_cpu" in
++ x86_64*|s390*|sparc*|ppc*|powerpc*)
++ ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++ lt_linux_biarch_save_CC="$CC"
++ CC="${LTCC-$CC}"
++ echo 'int i;' > conftest.$ac_ext
++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; then
++ case "`/usr/bin/file conftest.o`" in
++ *64-bit*) sys_lib_dlsearch_path_spec="/lib64 /usr/lib64";;
++ esac
++ fi
++ rm -rf conftest*
++ CC="$lt_linux_biarch_save_CC"
++ ac_ext=f
++ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
++ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_f77_compiler_gnu
++
++ ;;
++ esac
+ ;;
+
+ netbsd*)
+@@ -17441,6 +17536,38 @@ linux*)
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
++
++ # Find out which ABI we are using.
++ case "$host_cpu" in
++ x86_64*|s390*|sparc*|ppc*|powerpc*)
++ ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++ lt_linux_biarch_save_CC="$CC"
++ CC="${LTCC-$CC}"
++ echo 'int i;' > conftest.$ac_ext
++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; then
++ case "`/usr/bin/file conftest.o`" in
++ *64-bit*) sys_lib_dlsearch_path_spec="/lib64 /usr/lib64";;
++ esac
++ fi
++ rm -rf conftest*
++ CC="$lt_linux_biarch_save_CC"
++ ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++ ;;
++ esac
+ ;;
+
+ netbsd*)
diff --git a/4.0.4/gentoo/11_all_gcc-netbsd-symbolic.patch b/4.0.4/gentoo/11_all_gcc-netbsd-symbolic.patch
new file mode 100644
index 0000000..3b86491
--- /dev/null
+++ b/4.0.4/gentoo/11_all_gcc-netbsd-symbolic.patch
@@ -0,0 +1,12 @@
+http://bugs.gentoo.org/122698
+
+--- gcc/config/netbsd-elf.h
++++ gcc/config/netbsd-elf.h
+@@ -83,6 +83,7 @@
+ #define NETBSD_LINK_SPEC_ELF \
+ "%{assert*} %{R*} %{rpath*} \
+ %{shared:-shared} \
++ %{symbolic:-Bsymbolic} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib: \
diff --git a/4.0.4/gentoo/11_all_gcc4-java-rh163099.patch b/4.0.4/gentoo/11_all_gcc4-java-rh163099.patch
new file mode 100644
index 0000000..7133fb6
--- /dev/null
+++ b/4.0.4/gentoo/11_all_gcc4-java-rh163099.patch
@@ -0,0 +1,58 @@
+2005-07-13 Tom Tromey <tromey@redhat.com>
+
+ * jvspec.c (lang_specific_driver): Put filelist_filename first on
+ command line.
+
+--- gcc/java/jvspec.c 12 Jul 2005 22:35:48 -0000 1.72
++++ gcc/java/jvspec.c 13 Jul 2005 15:21:33 -0000
+@@ -458,7 +458,7 @@
+ if (filelist_file == NULL)
+ pfatal_with_name (filelist_filename);
+ num_args -= java_files_count + class_files_count + zip_files_count;
+- num_args += 2; /* for the combined arg and "-xjava" */
++ num_args += 3; /* for the combined arg "-xjava", and "-xnone" */
+ }
+ /* If we know we don't have to do anything, bail now. */
+ #if 0
+@@ -493,11 +493,23 @@
+ arglist = xmalloc ((num_args + 1) * sizeof (char *));
+ j = 0;
+
+- for (i = 0; i < argc; i++, j++)
++ arglist[j++] = argv[0];
++
++ if (combine_inputs || indirect_files_count > 0)
++ arglist[j++] = "-ffilelist-file";
++
++ if (combine_inputs)
++ {
++ arglist[j++] = "-xjava";
++ arglist[j++] = filelist_filename;
++ arglist[j++] = "-xnone";
++ }
++
++ for (i = 1; i < argc; i++, j++)
+ {
+ arglist[j] = argv[i];
+
+- if ((args[i] & PARAM_ARG) || i == 0)
++ if ((args[i] & PARAM_ARG))
+ continue;
+
+ if ((args[i] & RESOURCE_FILE_ARG) != 0)
+@@ -559,15 +571,10 @@
+ }
+ }
+
+- if (combine_inputs || indirect_files_count > 0)
+- arglist[j++] = "-ffilelist-file";
+-
+ if (combine_inputs)
+ {
+ if (fclose (filelist_file))
+ pfatal_with_name (filelist_filename);
+- arglist[j++] = "-xjava";
+- arglist[j++] = filelist_filename;
+ }
+
+ /* If we saw no -O or -g option, default to -g1, for javac compatibility. */
diff --git a/4.0.4/gentoo/13_all_gcc4-libjava-ia64-backtrace.patch b/4.0.4/gentoo/13_all_gcc4-libjava-ia64-backtrace.patch
new file mode 100644
index 0000000..0315b43
--- /dev/null
+++ b/4.0.4/gentoo/13_all_gcc4-libjava-ia64-backtrace.patch
@@ -0,0 +1,29 @@
+2005-07-14 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.ac (HAVE_BACKTRACE): Define even on ia64.
+ * configure: Rebuilt.
+
+--- libjava/configure.ac.jj 2005-04-12 22:28:45.000000000 +0200
++++ libjava/configure.ac 2005-07-14 18:09:23.000000000 +0200
+@@ -769,9 +769,6 @@ else
+ AC_CHECK_HEADERS(execinfo.h unistd.h dlfcn.h)
+ AC_CHECK_FUNC(backtrace, [
+ case "$host" in
+- ia64-*-linux*)
+- # Has broken backtrace()
+- ;;
+ mips*-*-linux*)
+ # Has broken backtrace(), but we supply our own.
+ if test -d sysdep; then true; else mkdir -p sysdep; fi
+--- libjava/configure.jj 2005-04-12 22:28:34.000000000 +0200
++++ libjava/configure 2005-07-14 18:11:07.000000000 +0200
+@@ -9303,9 +9303,6 @@ echo "${ECHO_T}$ac_cv_func_backtrace" >&
+ if test $ac_cv_func_backtrace = yes; then
+
+ case "$host" in
+- ia64-*-linux*)
+- # Has broken backtrace()
+- ;;
+ mips*-*-linux*)
+ # Has broken backtrace(), but we supply our own.
+ if test -d sysdep; then true; else mkdir -p sysdep; fi
diff --git a/4.0.4/gentoo/15_all_gcc4-libffi-x86.patch b/4.0.4/gentoo/15_all_gcc4-libffi-x86.patch
new file mode 100644
index 0000000..713ce15
--- /dev/null
+++ b/4.0.4/gentoo/15_all_gcc4-libffi-x86.patch
@@ -0,0 +1,684 @@
+2005-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.ac (HAVE_HIDDEN_VISIBILITY_ATTRIBUTE): New test.
+ (AH_BOTTOM): Add FFI_HIDDEN definition.
+ * configure: Rebuilt.
+ * fficonfig.h.in: Rebuilt.
+ * src/powerpc/ffi.c (hidden): Remove.
+ (ffi_closure_LINUX64, ffi_prep_args64, ffi_call_LINUX64,
+ ffi_closure_helper_LINUX64): Use FFI_HIDDEN instead of hidden.
+ * src/powerpc/linux64_closure.S (ffi_closure_LINUX64,
+ .ffi_closure_LINUX64): Use FFI_HIDDEN instead of .hidden.
+ * src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): Remove,
+ add FFI_HIDDEN to its prototype.
+ (ffi_closure_SYSV_inner): New.
+ * src/x86/sysv.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.
+ * src/x86/win32.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.
+
+--- libffi/configure.ac.jj 2004-12-02 12:04:21.000000000 +0100
++++ libffi/configure.ac 2005-08-10 20:34:16.000000000 +0200
+@@ -181,6 +181,38 @@ else
+ [Define to the flags needed for the .section .eh_frame directive.])
+ fi
+
++AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
++ libffi_cv_hidden_visibility_attribute, [
++ echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
++ libffi_cv_hidden_visibility_attribute=no
++ if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
++ if grep '\.hidden.*foo' conftest.s >/dev/null; then
++ libffi_cv_hidden_visibility_attribute=yes
++ fi
++ fi
++ rm -f conftest.*
++ ])
++if test $libffi_cv_hidden_visibility_attribute = yes; then
++ AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
++ [Define if __attribute__((visibility("hidden"))) is supported.])
++fi
++
++AH_BOTTOM([
++#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
++#ifdef LIBFFI_ASM
++#define FFI_HIDDEN(name) .hidden name
++#else
++#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
++#endif
++#else
++#ifdef LIBFFI_ASM
++#define FFI_HIDDEN(name)
++#else
++#define FFI_HIDDEN
++#endif
++#endif
++])
++
+ AC_SUBST(TARGET)
+ AC_SUBST(TARGETDIR)
+
+--- libffi/configure.jj 2004-12-02 12:04:21.000000000 +0100
++++ libffi/configure 2005-08-10 20:34:19.000000000 +0200
+@@ -6726,6 +6726,40 @@ _ACEOF
+
+ fi
+
++echo "$as_me:$LINENO: checking for __attribute__((visibility(\"hidden\")))" >&5
++echo $ECHO_N "checking for __attribute__((visibility(\"hidden\")))... $ECHO_C" >&6
++if test "${libffi_cv_hidden_visibility_attribute+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++
++ echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
++ libffi_cv_hidden_visibility_attribute=no
++ if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ if grep '\.hidden.*foo' conftest.s >/dev/null; then
++ libffi_cv_hidden_visibility_attribute=yes
++ fi
++ fi
++ rm -f conftest.*
++
++fi
++echo "$as_me:$LINENO: result: $libffi_cv_hidden_visibility_attribute" >&5
++echo "${ECHO_T}$libffi_cv_hidden_visibility_attribute" >&6
++if test $libffi_cv_hidden_visibility_attribute = yes; then
++
++cat >>confdefs.h <<\_ACEOF
++#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1
++_ACEOF
++
++fi
++
++
++
++
+
+
+
+--- libffi/fficonfig.h.in.jj 2004-06-15 16:47:54.000000000 +0200
++++ libffi/fficonfig.h.in 2005-08-10 20:34:40.000000000 +0200
+@@ -37,6 +37,9 @@
+ */
+ #undef HAVE_AS_SPARC_UA_PCREL
+
++/* Define if __attribute__((visibility("hidden"))) is supported. */
++#undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
++
+ /* Define to 1 if you have the <inttypes.h> header file. */
+ #undef HAVE_INTTYPES_H
+
+@@ -139,3 +142,19 @@
+
+ /* whether byteorder is bigendian */
+ #undef WORDS_BIGENDIAN
++
++
++#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
++#ifdef LIBFFI_ASM
++#define FFI_HIDDEN(name) .hidden name
++#else
++#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
++#endif
++#else
++#ifdef LIBFFI_ASM
++#define FFI_HIDDEN(name)
++#else
++#define FFI_HIDDEN
++#endif
++#endif
++
+--- libffi/src/powerpc/ffi.c.jj 2005-02-23 15:05:12.000000000 +0100
++++ libffi/src/powerpc/ffi.c 2005-08-10 20:16:54.000000000 +0200
+@@ -29,15 +29,9 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+
+-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 1)
+-# define hidden __attribute__ ((visibility ("hidden")))
+-#else
+-# define hidden
+-#endif
+-
+
+ extern void ffi_closure_SYSV(void);
+-extern void hidden ffi_closure_LINUX64(void);
++extern void FFI_HIDDEN ffi_closure_LINUX64(void);
+
+ enum {
+ /* The assembly depends on these exact flags. */
+@@ -300,7 +294,7 @@ enum { ASM_NEEDS_REGISTERS64 = 4 };
+ */
+
+ /*@-exportheader@*/
+-void hidden ffi_prep_args64(extended_cif *ecif, unsigned long *const stack)
++void FFI_HIDDEN ffi_prep_args64(extended_cif *ecif, unsigned long *const stack)
+ /*@=exportheader@*/
+ {
+ const unsigned long bytes = ecif->cif->bytes;
+@@ -680,10 +674,10 @@ extern void ffi_call_SYSV(/*@out@*/ exte
+ unsigned, unsigned,
+ /*@out@*/ unsigned *,
+ void (*fn)());
+-extern void hidden ffi_call_LINUX64(/*@out@*/ extended_cif *,
+- unsigned long, unsigned long,
+- /*@out@*/ unsigned long *,
+- void (*fn)());
++extern void FFI_HIDDEN ffi_call_LINUX64(/*@out@*/ extended_cif *,
++ unsigned long, unsigned long,
++ /*@out@*/ unsigned long *,
++ void (*fn)());
+ /*@=declundef@*/
+ /*@=exportheader@*/
+
+@@ -991,10 +985,10 @@ ffi_closure_helper_SYSV (ffi_closure* cl
+
+ }
+
+-int hidden ffi_closure_helper_LINUX64 (ffi_closure*, void*, unsigned long*,
+- ffi_dblfl*);
++int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure*, void*, unsigned long*,
++ ffi_dblfl*);
+
+-int hidden
++int FFI_HIDDEN
+ ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
+ unsigned long *pst, ffi_dblfl *pfr)
+ {
+--- libffi/src/powerpc/linux64_closure.S.jj 2005-02-28 13:23:28.000000000 +0100
++++ libffi/src/powerpc/linux64_closure.S 2005-08-10 20:17:24.000000000 +0200
+@@ -5,7 +5,8 @@
+ .file "linux64_closure.S"
+
+ #ifdef __powerpc64__
+- .hidden ffi_closure_LINUX64, .ffi_closure_LINUX64
++ FFI_HIDDEN (ffi_closure_LINUX64)
++ FFI_HIDDEN (.ffi_closure_LINUX64)
+ .globl ffi_closure_LINUX64, .ffi_closure_LINUX64
+ .section ".opd","aw"
+ .align 3
+--- libffi/src/x86/ffi.c.jj 2004-03-16 20:17:33.000000000 +0100
++++ libffi/src/x86/ffi.c 2005-08-10 20:15:24.000000000 +0200
+@@ -241,26 +241,24 @@ void ffi_call(/*@dependent@*/ ffi_cif *c
+
+ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
+ void** args, ffi_cif* cif);
+-static void ffi_closure_SYSV (ffi_closure *)
++void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *)
+ __attribute__ ((regparm(1)));
+-static void ffi_closure_raw_SYSV (ffi_raw_closure *)
++unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *)
++ __attribute__ ((regparm(1)));
++void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
+ __attribute__ ((regparm(1)));
+
+ /* This function is jumped to by the trampoline */
+
+-static void
+-ffi_closure_SYSV (closure)
++unsigned int FFI_HIDDEN
++ffi_closure_SYSV_inner (closure, respp, args)
+ ffi_closure *closure;
++ void **respp;
++ void *args;
+ {
+- // this is our return value storage
+- long double res;
+-
+ // our various things...
+ ffi_cif *cif;
+ void **arg_area;
+- unsigned short rtype;
+- void *resp = (void*)&res;
+- void *args = __builtin_dwarf_cfa ();
+
+ cif = closure->cif;
+ arg_area = (void**) alloca (cif->nargs * sizeof (void*));
+@@ -271,46 +269,11 @@ ffi_closure_SYSV (closure)
+ * a structure, it will re-set RESP to point to the
+ * structure return address. */
+
+- ffi_prep_incoming_args_SYSV(args, (void**)&resp, arg_area, cif);
+-
+- (closure->fun) (cif, resp, arg_area, closure->user_data);
++ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif);
+
+- rtype = cif->flags;
++ (closure->fun) (cif, *respp, arg_area, closure->user_data);
+
+- /* now, do a generic return based on the value of rtype */
+- if (rtype == FFI_TYPE_INT)
+- {
+- asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
+- }
+- else if (rtype == FFI_TYPE_FLOAT)
+- {
+- asm ("flds (%0)" : : "r" (resp) : "st" );
+- }
+- else if (rtype == FFI_TYPE_DOUBLE)
+- {
+- asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
+- }
+- else if (rtype == FFI_TYPE_LONGDOUBLE)
+- {
+- asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
+- }
+- else if (rtype == FFI_TYPE_SINT64)
+- {
+- asm ("movl 0(%0),%%eax;"
+- "movl 4(%0),%%edx"
+- : : "r"(resp)
+- : "eax", "edx");
+- }
+-#ifdef X86_WIN32
+- else if (rtype == FFI_TYPE_SINT8) /* 1-byte struct */
+- {
+- asm ("movsbl (%0),%%eax" : : "r" (resp) : "eax");
+- }
+- else if (rtype == FFI_TYPE_SINT16) /* 2-bytes struct */
+- {
+- asm ("movswl (%0),%%eax" : : "r" (resp) : "eax");
+- }
+-#endif
++ return cif->flags;
+ }
+
+ /*@-exportheader@*/
+@@ -394,57 +357,6 @@ ffi_prep_closure (ffi_closure* closure,
+
+ #if !FFI_NO_RAW_API
+
+-static void
+-ffi_closure_raw_SYSV (closure)
+- ffi_raw_closure *closure;
+-{
+- // this is our return value storage
+- long double res;
+-
+- // our various things...
+- ffi_raw *raw_args;
+- ffi_cif *cif;
+- unsigned short rtype;
+- void *resp = (void*)&res;
+-
+- /* get the cif */
+- cif = closure->cif;
+-
+- /* the SYSV/X86 abi matches the RAW API exactly, well.. almost */
+- raw_args = (ffi_raw*) __builtin_dwarf_cfa ();
+-
+- (closure->fun) (cif, resp, raw_args, closure->user_data);
+-
+- rtype = cif->flags;
+-
+- /* now, do a generic return based on the value of rtype */
+- if (rtype == FFI_TYPE_INT)
+- {
+- asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
+- }
+- else if (rtype == FFI_TYPE_FLOAT)
+- {
+- asm ("flds (%0)" : : "r" (resp) : "st" );
+- }
+- else if (rtype == FFI_TYPE_DOUBLE)
+- {
+- asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
+- }
+- else if (rtype == FFI_TYPE_LONGDOUBLE)
+- {
+- asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
+- }
+- else if (rtype == FFI_TYPE_SINT64)
+- {
+- asm ("movl 0(%0),%%eax; movl 4(%0),%%edx"
+- : : "r"(resp)
+- : "eax", "edx");
+- }
+-}
+-
+-
+-
+-
+ ffi_status
+ ffi_prep_raw_closure (ffi_raw_closure* closure,
+ ffi_cif* cif,
+--- libffi/src/x86/sysv.S.jj 2005-02-28 13:23:32.000000000 +0100
++++ libffi/src/x86/sysv.S 2005-08-10 20:16:01.000000000 +0200
+@@ -1,5 +1,5 @@
+ /* -----------------------------------------------------------------------
+- sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003 Red Hat, Inc.
++ sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc.
+
+ X86 Foreign Function Interface
+
+@@ -130,6 +130,135 @@ epilogue:
+ .ffi_call_SYSV_end:
+ .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
+
++ .align 4
++FFI_HIDDEN (ffi_closure_SYSV)
++.globl ffi_closure_SYSV
++ .type ffi_closure_SYSV, @function
++
++ffi_closure_SYSV:
++.LFB2:
++ pushl %ebp
++.LCFI2:
++ movl %esp, %ebp
++.LCFI3:
++ subl $40, %esp
++ leal -24(%ebp), %edx
++ movl %edx, -12(%ebp) /* resp */
++ leal 8(%ebp), %edx
++ movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */
++ leal -12(%ebp), %edx
++ movl %edx, (%esp) /* &resp */
++#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__
++ call ffi_closure_SYSV_inner
++#else
++ movl %ebx, 8(%esp)
++.LCFI7:
++ call 1f
++1: popl %ebx
++ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
++ call ffi_closure_SYSV_inner@PLT
++ movl 8(%esp), %ebx
++#endif
++ movl -12(%ebp), %ecx
++ cmpl $FFI_TYPE_INT, %eax
++ je .Lcls_retint
++ cmpl $FFI_TYPE_FLOAT, %eax
++ je .Lcls_retfloat
++ cmpl $FFI_TYPE_DOUBLE, %eax
++ je .Lcls_retdouble
++ cmpl $FFI_TYPE_LONGDOUBLE, %eax
++ je .Lcls_retldouble
++ cmpl $FFI_TYPE_SINT64, %eax
++ je .Lcls_retllong
++.Lcls_epilogue:
++ movl %ebp, %esp
++ popl %ebp
++ ret
++.Lcls_retint:
++ movl (%ecx), %eax
++ jmp .Lcls_epilogue
++.Lcls_retfloat:
++ flds (%ecx)
++ jmp .Lcls_epilogue
++.Lcls_retdouble:
++ fldl (%ecx)
++ jmp .Lcls_epilogue
++.Lcls_retldouble:
++ fldt (%ecx)
++ jmp .Lcls_epilogue
++.Lcls_retllong:
++ movl (%ecx), %eax
++ movl 4(%ecx), %edx
++ jmp .Lcls_epilogue
++.LFE2:
++ .size ffi_closure_SYSV, .-ffi_closure_SYSV
++
++#if !FFI_NO_RAW_API
++
++#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
++#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
++#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
++#define CIF_FLAGS_OFFSET 20
++
++ .align 4
++FFI_HIDDEN (ffi_closure_raw_SYSV)
++.globl ffi_closure_raw_SYSV
++ .type ffi_closure_raw_SYSV, @function
++
++ffi_closure_raw_SYSV:
++.LFB3:
++ pushl %ebp
++.LCFI4:
++ movl %esp, %ebp
++.LCFI5:
++ pushl %esi
++.LCFI6:
++ subl $36, %esp
++ movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */
++ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
++ movl %edx, 12(%esp) /* user_data */
++ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */
++ movl %edx, 8(%esp) /* raw_args */
++ leal -24(%ebp), %edx
++ movl %edx, 4(%esp) /* &res */
++ movl %esi, (%esp) /* cif */
++ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */
++ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */
++ cmpl $FFI_TYPE_INT, %eax
++ je .Lrcls_retint
++ cmpl $FFI_TYPE_FLOAT, %eax
++ je .Lrcls_retfloat
++ cmpl $FFI_TYPE_DOUBLE, %eax
++ je .Lrcls_retdouble
++ cmpl $FFI_TYPE_LONGDOUBLE, %eax
++ je .Lrcls_retldouble
++ cmpl $FFI_TYPE_SINT64, %eax
++ je .Lrcls_retllong
++.Lrcls_epilogue:
++ addl $36, %esp
++ popl %esi
++ popl %ebp
++ ret
++.Lrcls_retint:
++ movl -24(%ebp), %eax
++ jmp .Lrcls_epilogue
++.Lrcls_retfloat:
++ flds -24(%ebp)
++ jmp .Lrcls_epilogue
++.Lrcls_retdouble:
++ fldl -24(%ebp)
++ jmp .Lrcls_epilogue
++.Lrcls_retldouble:
++ fldt -24(%ebp)
++ jmp .Lrcls_epilogue
++.Lrcls_retllong:
++ movl -24(%ebp), %eax
++ movl -20(%ebp), %edx
++ jmp .Lrcls_epilogue
++.LFE3:
++ .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV
++#endif
++
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
+ .Lframe1:
+ .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */
+@@ -180,6 +309,71 @@ epilogue:
+ .byte 0x5 /* .uleb128 0x5 */
+ .align 4
+ .LEFDE1:
++.LSFDE2:
++ .long .LEFDE2-.LASFDE2 /* FDE Length */
++.LASFDE2:
++ .long .LASFDE2-.Lframe1 /* FDE CIE offset */
++#ifdef __PIC__
++ .long .LFB2-. /* FDE initial location */
++#else
++ .long .LFB2
++#endif
++ .long .LFE2-.LFB2 /* FDE address range */
++#ifdef __PIC__
++ .byte 0x0 /* .uleb128 0x0; Augmentation size */
++#endif
++ .byte 0x4 /* DW_CFA_advance_loc4 */
++ .long .LCFI2-.LFB2
++ .byte 0xe /* DW_CFA_def_cfa_offset */
++ .byte 0x8 /* .uleb128 0x8 */
++ .byte 0x85 /* DW_CFA_offset, column 0x5 */
++ .byte 0x2 /* .uleb128 0x2 */
++ .byte 0x4 /* DW_CFA_advance_loc4 */
++ .long .LCFI3-.LCFI2
++ .byte 0xd /* DW_CFA_def_cfa_register */
++ .byte 0x5 /* .uleb128 0x5 */
++#if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__
++ .byte 0x4 /* DW_CFA_advance_loc4 */
++ .long .LCFI7-.LCFI3
++ .byte 0x83 /* DW_CFA_offset, column 0x3 */
++ .byte 0xa /* .uleb128 0xa */
++#endif
++ .align 4
++.LEFDE2:
++
++#if !FFI_NO_RAW_API
++
++.LSFDE3:
++ .long .LEFDE3-.LASFDE3 /* FDE Length */
++.LASFDE3:
++ .long .LASFDE3-.Lframe1 /* FDE CIE offset */
++#ifdef __PIC__
++ .long .LFB3-. /* FDE initial location */
++#else
++ .long .LFB3
++#endif
++ .long .LFE3-.LFB3 /* FDE address range */
++#ifdef __PIC__
++ .byte 0x0 /* .uleb128 0x0; Augmentation size */
++#endif
++ .byte 0x4 /* DW_CFA_advance_loc4 */
++ .long .LCFI4-.LFB3
++ .byte 0xe /* DW_CFA_def_cfa_offset */
++ .byte 0x8 /* .uleb128 0x8 */
++ .byte 0x85 /* DW_CFA_offset, column 0x5 */
++ .byte 0x2 /* .uleb128 0x2 */
++ .byte 0x4 /* DW_CFA_advance_loc4 */
++ .long .LCFI5-.LCFI4
++ .byte 0xd /* DW_CFA_def_cfa_register */
++ .byte 0x5 /* .uleb128 0x5 */
++ .byte 0x4 /* DW_CFA_advance_loc4 */
++ .long .LCFI6-.LCFI5
++ .byte 0x86 /* DW_CFA_offset, column 0x6 */
++ .byte 0x3 /* .uleb128 0x3 */
++ .align 4
++.LEFDE3:
++
++#endif
+
+ #endif /* ifndef __x86_64__ */
+
+--- libffi/src/x86/win32.S.jj 2004-03-16 20:17:33.000000000 +0100
++++ libffi/src/x86/win32.S 2005-08-10 11:55:10.000000000 +0200
+@@ -257,3 +257,117 @@ sc_epilogue:
+ ret
+
+ .ffi_call_STDCALL_end:
++
++ .globl _ffi_closure_SYSV
++_ffi_closure_SYSV:
++ pushl %ebp
++ movl %esp, %ebp
++ subl $40, %esp
++ leal -24(%ebp), %edx
++ movl %edx, -12(%ebp) /* resp */
++ leal 8(%ebp), %edx
++ movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */
++ leal -12(%ebp), %edx
++ movl %edx, (%esp) /* &resp */
++ call _ffi_closure_SYSV_inner
++ movl -12(%ebp), %ecx
++ cmpl $FFI_TYPE_INT, %eax
++ je .Lcls_retint
++ cmpl $FFI_TYPE_FLOAT, %eax
++ je .Lcls_retfloat
++ cmpl $FFI_TYPE_DOUBLE, %eax
++ je .Lcls_retdouble
++ cmpl $FFI_TYPE_LONGDOUBLE, %eax
++ je .Lcls_retldouble
++ cmpl $FFI_TYPE_SINT64, %eax
++ je .Lcls_retllong
++ cmpl $FFI_TYPE_SINT8, %eax /* 1-byte struct */
++ je .Lcls_retstruct1
++ cmpl $FFI_TYPE_SINT16, %eax /* 2-bytes struct */
++ je .Lcls_retstruct2
++.Lcls_epilogue:
++ movl %ebp, %esp
++ popl %ebp
++ ret
++.Lcls_retint:
++ movl (%ecx), %eax
++ jmp .Lcls_epilogue
++.Lcls_retfloat:
++ flds (%ecx)
++ jmp .Lcls_epilogue
++.Lcls_retdouble:
++ fldl (%ecx)
++ jmp .Lcls_epilogue
++.Lcls_retldouble:
++ fldt (%ecx)
++ jmp .Lcls_epilogue
++.Lcls_retllong:
++ movl (%ecx), %eax
++ movl 4(%ecx), %edx
++ jmp .Lcls_epilogue
++.Lcls_retstruct1:
++ movsbl (%ecx), %eax
++ jmp .Lcls_epilogue
++.Lcls_retstruct2:
++ movswl (%ecx), %eax
++ jmp .Lcls_epilogue
++.ffi_closure_SYSV_end:
++
++#if !FFI_NO_RAW_API
++
++#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
++#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
++#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
++#define CIF_FLAGS_OFFSET 20
++
++ .balign 16
++ .globl _ffi_closure_raw_SYSV
++_ffi_closure_raw_SYSV:
++ pushl %ebp
++ movl %esp, %ebp
++ pushl %esi
++ subl $36, %esp
++ movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */
++ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
++ movl %edx, 12(%esp) /* user_data */
++ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */
++ movl %edx, 8(%esp) /* raw_args */
++ leal -24(%ebp), %edx
++ movl %edx, 4(%esp) /* &res */
++ movl %esi, (%esp) /* cif */
++ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */
++ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */
++ cmpl $FFI_TYPE_INT, %eax
++ je .Lrcls_retint
++ cmpl $FFI_TYPE_FLOAT, %eax
++ je .Lrcls_retfloat
++ cmpl $FFI_TYPE_DOUBLE, %eax
++ je .Lrcls_retdouble
++ cmpl $FFI_TYPE_LONGDOUBLE, %eax
++ je .Lrcls_retldouble
++ cmpl $FFI_TYPE_SINT64, %eax
++ je .Lrcls_retllong
++.Lrcls_epilogue:
++ addl $36, %esp
++ popl %esi
++ popl %ebp
++ ret
++.Lrcls_retint:
++ movl -24(%ebp), %eax
++ jmp .Lrcls_epilogue
++.Lrcls_retfloat:
++ flds -24(%ebp)
++ jmp .Lrcls_epilogue
++.Lrcls_retdouble:
++ fldl -24(%ebp)
++ jmp .Lrcls_epilogue
++.Lrcls_retldouble:
++ fldt -24(%ebp)
++ jmp .Lrcls_epilogue
++.Lrcls_retllong:
++ movl -24(%ebp), %eax
++ movl -20(%ebp), %edx
++ jmp .Lrcls_epilogue
++.ffi_closure_raw_SYSV_end:
++
++#endif
diff --git a/4.0.4/gentoo/16_all_gcc4-ppc32-msecure-plt.patch b/4.0.4/gentoo/16_all_gcc4-ppc32-msecure-plt.patch
new file mode 100644
index 0000000..acfb8b1
--- /dev/null
+++ b/4.0.4/gentoo/16_all_gcc4-ppc32-msecure-plt.patch
@@ -0,0 +1,766 @@
+2005-06-02 Alan Modra <amodra@bigpond.net.au>
+
+ * configure.ac: Add --enable-secureplt.
+ (HAVE_AS_REL16): Test for R_PPC_REL16 relocs.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * config.gcc (powerpc64-*-linux*, powerpc-*-linux*): Add
+ rs6000/secureplt.h to tm_file when enable_secureplt.
+ * doc/invoke.texi (msecure-plt, mbss-plt): Document.
+ * doc/install.texi: Document --enable-targets and --enable-secureplt.
+ Correct xrefs to "Using the GNU Compiler Collection (GCC)".
+ * config/rs6000/secureplt.h: New file.
+ * config/rs6000/sysv4.h (MASK_SECURE_PLT): Define.
+ (SUBTARGET_SWITCHES): Add "secure-plt" and "bss-plt". Move "newlib".
+ (SUBTARGET_OVERRIDE_OPTIONS): Error if -msecure-plt given without
+ assembler support.
+ (CC1_SECURE_PLT_DEFAULT_SPEC): Define.
+ (CC1_SPEC): Delete duplicate mno-sdata. Invoke cc1_secure_plt_default.
+ (SUBTARGET_EXTRA_SPECS): Add cc1_secure_plt_default.
+ * config/rs6000/rs6000.h: Update target_flags free bits comment.
+ (TARGET_SECURE_PLT): Define.
+ * config/rs6000/rs6000.c (rs6000_emit_load_toc_table): Handle
+ TARGET_SECURE_PLT got register load sequence.
+ (rs6000_emit_prologue): Call rs6000_emit_load_toc_table when
+ TARGET_SECURE_PLT.
+ (rs6000_elf_declare_function_name): Don't emit toc address offset
+ word when TARGET_SECURE_PLT.
+ * config/rs6000/rs6000.md (elf_high, elf_low): Move past load_toc_*.
+ (load_toc_v4_PIC_1) Enable for TARGET_SECURE_PLT.
+ (load_toc_v4_PIC_3b, load_toc_v4_PIC_3c): New insns.
+ (call, call_value): Mark pic_offset_table_rtx used for sysv pic and
+ TARGET_SECURE_PLT.
+ (call_nonlocal_sysv, call_value_nonlocal_sysv, sibcall_nonlocal_sysv,
+ sibcall_value_nonlocal_sysv): Add 32768 offset when TARGET_SECURE_PLT
+ and -fPIC.
+ * config/rs6000/tramp.asm (trampoline_initial): Use "bcl 20,31".
+ (__trampoline_setup): Likewise. Init r30 before plt call.
+
+ * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't use JUMPTARGET
+ to call ffi_closure_helper_SYSV. Append @local instead.
+ * src/powerpc/sysv.S (ffi_call_SYSV): Likewise for ffi_prep_args_SYSV.
+
+--- gcc/configure.ac 2005-05-11 18:20:56.000000000 +0930
++++ gcc/configure.ac 2005-06-01 21:52:52.000000000 +0930
+@@ -1429,6 +1429,10 @@ case "$LIBINTL" in *$LIBICONV*)
+ LIBICONV= ;;
+ esac
+
++AC_ARG_ENABLE(secureplt,
++[ --enable-secureplt enable -msecure-plt by default for PowerPC],
++[], [])
++
+ # Windows32 Registry support for specifying GCC installation paths.
+ AC_ARG_ENABLE(win32-registry,
+ [ --disable-win32-registry
+@@ -2762,6 +2766,25 @@ foo: nop
+ [$conftest_s],,
+ [AC_DEFINE(HAVE_AS_MFCRF, 1,
+ [Define if your assembler supports mfcr field.])])
++
++ case $target in
++ *-*-aix*) conftest_s=' .csect .text[[PR]]
++LCF..0:
++ addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
++ *-*-darwin*)
++ conftest_s=' .text
++LCF0:
++ addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
++ *) conftest_s=' .text
++.LCF0:
++ addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
++ esac
++
++ gcc_GAS_CHECK_FEATURE([rel16 relocs],
++ gcc_cv_as_powerpc_rel16, [2,17,0], -a32,
++ [$conftest_s],,
++ [AC_DEFINE(HAVE_AS_REL16, 1,
++ [Define if your assembler supports R_PPC_REL16 relocs.])])
+ ;;
+
+ mips*-*-*)
+--- gcc/configure 2005-06-06 17:00:55.000000000 +0200
++++ gcc/configure 2005-07-27 11:17:45.000000000 +0200
+@@ -890,6 +890,7 @@ Optional Features:
+ --enable-initfini-array use .init_array/.fini_array sections
+ --enable-sjlj-exceptions
+ arrange to use setjmp/longjmp exception handling
++ --enable-secureplt enable -msecure-plt by default for PowerPC
+ --disable-win32-registry
+ disable lookup of installation paths in the
+ Registry on Windows hosts
+@@ -12330,6 +12331,12 @@ case "$LIBINTL" in *$LIBICONV*)
+ LIBICONV= ;;
+ esac
+
++# Check whether --enable-secureplt or --disable-secureplt was given.
++if test "${enable_secureplt+set}" = set; then
++ enableval="$enable_secureplt"
++
++fi;
++
+ # Windows32 Registry support for specifying GCC installation paths.
+ # Check whether --enable-win32-registry or --disable-win32-registry was given.
+ if test "${enable_win32_registry+set}" = set; then
+@@ -14664,6 +14671,56 @@ cat >>confdefs.h <<\_ACEOF
+ _ACEOF
+
+ fi
++
++ case $target in
++ *-*-aix*) conftest_s=' .csect .text[PR]
++LCF..0:
++ addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
++ *-*-darwin*)
++ conftest_s=' .text
++LCF0:
++ addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
++ *) conftest_s=' .text
++.LCF0:
++ addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
++ esac
++
++ echo "$as_me:$LINENO: checking assembler for rel16 relocs" >&5
++echo $ECHO_N "checking assembler for rel16 relocs... $ECHO_C" >&6
++if test "${gcc_cv_as_powerpc_rel16+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ gcc_cv_as_powerpc_rel16=no
++ if test $in_tree_gas = yes; then
++ if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 17 \) \* 1000 + 0`
++ then gcc_cv_as_powerpc_rel16=yes
++fi
++ elif test x$gcc_cv_as != x; then
++ echo "$conftest_s" > conftest.s
++ if { ac_try='$gcc_cv_as -a32 -o conftest.o conftest.s >&5'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }
++ then
++ gcc_cv_as_powerpc_rel16=yes
++ else
++ echo "configure: failed program was" >&5
++ cat conftest.s >&5
++ fi
++ rm -f conftest.o conftest.s
++ fi
++fi
++echo "$as_me:$LINENO: result: $gcc_cv_as_powerpc_rel16" >&5
++echo "${ECHO_T}$gcc_cv_as_powerpc_rel16" >&6
++if test $gcc_cv_as_powerpc_rel16 = yes; then
++
++cat >>confdefs.h <<\_ACEOF
++#define HAVE_AS_REL16 1
++_ACEOF
++
++fi
+ ;;
+
+ mips*-*-*)
+--- gcc/config.in 2005-06-06 17:00:53.000000000 +0200
++++ gcc/config.in 2005-07-27 11:19:13.000000000 +0200
+@@ -122,6 +122,9 @@
+ /* Define if your assembler supports .register. */
+ #undef HAVE_AS_REGISTER_PSEUDO_OP
+
++/* Define if your assembler supports R_PPC_REL16 relocs. */
++#undef HAVE_AS_REL16
++
+ /* Define if your assembler supports -relax option. */
+ #undef HAVE_AS_RELAX_OPTION
+
+--- gcc/config.gcc 2005-05-06 23:50:09.000000000 +0930
++++ gcc/config.gcc 2005-05-30 10:29:30.000000000 +0930
+@@ -1559,6 +1559,9 @@ powerpc64-*-linux*)
+ test x$with_cpu != x || cpu_is_64bit=yes
+ test x$cpu_is_64bit != xyes || tm_file="${tm_file} rs6000/default64.h"
+ tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h"
++ if test x${enable_secureplt} = xyes; then
++ tm_file="rs6000/secureplt.h ${tm_file}"
++ fi
+ tmake_file="rs6000/t-fprules ${tmake_file} rs6000/t-ppccomm rs6000/t-linux64"
+ ;;
+ powerpc64-*-gnu*)
+@@ -1651,6 +1654,9 @@ powerpc-*-linux*)
+ tm_file="${tm_file} rs6000/linux.h"
+ ;;
+ esac
++ if test x${enable_secureplt} = xyes; then
++ tm_file="rs6000/secureplt.h ${tm_file}"
++ fi
+ ;;
+ powerpc-*-gnu-gnualtivec*)
+ tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h rs6000/gnu.h"
+--- gcc/doc/install.texi 2005-05-02 08:26:07.000000000 +0930
++++ gcc/doc/install.texi 2005-06-01 21:44:56.000000000 +0930
+@@ -1071,6 +1071,27 @@ do a @samp{make -C gcc gnatlib_and_tools
+ Specify that the compiler should
+ use DWARF 2 debugging information as the default.
+
++@item --enable-targets=all
++@itemx --enable-targets=@var{target_list}
++Some GCC targets, e.g.@: powerpc64-linux, build bi-arch compilers.
++These are compilers that are able to generate either 64-bit or 32-bit
++code. Typicially, the corresponding 32-bit target, e.g.@:
++powerpc-linux for powerpc64-linux, only generates 32-bit code. This
++option enables the 32-bit target to be a bi-arch compiler, which is
++useful when you want a bi-arch compiler that defaults to 32-bit, and
++you are building a bi-arch or multi-arch binutils in a combined tree.
++Currently, this option only affects powerpc-linux.
++
++@item --enable-secureplt
++This option enables @option{-msecure-plt} by default for powerpc-linux.
++@ifnothtml
++@xref{RS/6000 and PowerPC Options,, RS/6000 and PowerPC Options, gcc,
++Using the GNU Compiler Collection (GCC)},
++@end ifnothtml
++@ifhtml
++See ``RS/6000 and PowerPC Options'' in the main manual
++@end ifhtml
++
+ @item --enable-win32-registry
+ @itemx --enable-win32-registry=@var{key}
+ @itemx --disable-win32-registry
+@@ -2464,7 +2485,7 @@ ARM-family processors. These targets su
+ ATMEL AVR-family micro controllers. These are used in embedded
+ applications. There are no standard Unix configurations.
+ @ifnothtml
+-@xref{AVR Options,, AVR Options, gcc, Using and Porting the GNU Compiler
++@xref{AVR Options,, AVR Options, gcc, Using the GNU Compiler
+ Collection (GCC)},
+ @end ifnothtml
+ @ifhtml
+@@ -2502,8 +2523,8 @@ indicates that you should upgrade to a n
+
+ The Blackfin processor, an Analog Devices DSP.
+ @ifnothtml
+-@xref{Blackfin Options,, Blackfin Options, gcc, Using and Porting the GNU
+-Compiler Collection (GCC)},
++@xref{Blackfin Options,, Blackfin Options, gcc, Using the GNU Compiler
++Collection (GCC)},
+ @end ifnothtml
+ @ifhtml
+ See ``Blackfin Options'' in the main manual
+@@ -2521,8 +2542,8 @@ Texas Instruments TMS320C3x and TMS320C4
+ Processors. These are used in embedded applications. There are no
+ standard Unix configurations.
+ @ifnothtml
+-@xref{TMS320C3x/C4x Options,, TMS320C3x/C4x Options, gcc, Using and
+-Porting the GNU Compiler Collection (GCC)},
++@xref{TMS320C3x/C4x Options,, TMS320C3x/C4x Options, gcc, Using the
++GNU Compiler Collection (GCC)},
+ @end ifnothtml
+ @ifhtml
+ See ``TMS320C3x/C4x Options'' in the main manual
+@@ -2551,7 +2572,7 @@ CRIS is the CPU architecture in Axis Com
+ series. These are used in embedded applications.
+
+ @ifnothtml
+-@xref{CRIS Options,, CRIS Options, gcc, Using and Porting the GNU Compiler
++@xref{CRIS Options,, CRIS Options, gcc, Using the GNU Compiler
+ Collection (GCC)},
+ @end ifnothtml
+ @ifhtml
+--- gcc/doc/invoke.texi 2005-05-19 18:44:04.000000000 +0930
++++ gcc/doc/invoke.texi 2005-06-01 21:43:42.000000000 +0930
+@@ -625,6 +625,7 @@ See RS/6000 and PowerPC Options.
+ -maix-struct-return -msvr4-struct-return @gol
+ -mabi=altivec -mabi=no-altivec @gol
+ -mabi=spe -mabi=no-spe @gol
++-msecure-plt -mbss-plt @gol
+ -misel=yes -misel=no @gol
+ -mspe=yes -mspe=no @gol
+ -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
+@@ -10515,6 +10516,18 @@ ABI@.
+ @opindex mabi=no-spe
+ Disable Booke SPE ABI extensions for the current ABI@.
+
++@item -msecure-plt
++@opindex msecure-plt
++Generate code that allows ld and ld.so to build executables and shared
++libraries with non-exec .plt and .got sections. This is a PowerPC
++32-bit SYSV ABI option.
++
++@item -mbss-plt
++@opindex mbss-plt
++Generate code that uses a BSS .plt section that ld.so fills in, and
++requires .plt and .got sections that are both writable and executable.
++This is a PowerPC 32-bit SYSV ABI option.
++
+ @item -misel=@var{yes/no}
+ @itemx -misel
+ @opindex misel
+--- gcc/config/rs6000/secureplt.h 1970-01-01 09:30:00.000000000 +0930
++++ gcc/config/rs6000/secureplt.h 2005-05-30 10:29:30.000000000 +0930
+@@ -0,0 +1,21 @@
++/* Default to -msecure-plt.
++ Copyright (C) 2005 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, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
+--- gcc/config/rs6000/sysv4.h 2005-02-16 09:06:57.000000000 +1030
++++ gcc/config/rs6000/sysv4.h 2005-05-30 10:52:01.000000000 +0930
+@@ -55,6 +55,7 @@ extern enum rs6000_sdata_type rs6000_sda
+ #define MASK_REGNAMES 0x02000000 /* Use alternate register names. */
+ #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */
+ #define MASK_NO_BITFIELD_WORD 0x00800000 /* Bitfields cannot cross word boundaries */
++#define MASK_SECURE_PLT 0x00400000 /* Use non-exec PLT/GOT. */
+
+ #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
+ #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
+@@ -149,12 +150,16 @@ extern const char *rs6000_tls_size_strin
+ N_("Set the PPC_EMB bit in the ELF flags header") }, \
+ { "windiss", 0, N_("Use the WindISS simulator") }, \
+ { "shlib", 0, N_("no description yet") }, \
++ { "newlib", 0, N_("no description yet") }, \
+ { "64", MASK_64BIT | MASK_POWERPC64 | MASK_POWERPC, \
+ N_("Generate 64-bit code") }, \
+ { "32", - (MASK_64BIT | MASK_POWERPC64), \
+ N_("Generate 32-bit code") }, \
+- EXTRA_SUBTARGET_SWITCHES \
+- { "newlib", 0, N_("no description yet") },
++ { "secure-plt", MASK_SECURE_PLT, \
++ N_("Generate code for non-exec PLT and GOT") },\
++ { "bss-plt", -MASK_SECURE_PLT, \
++ N_("Generate code for exec BSS PLT") }, \
++ EXTRA_SUBTARGET_SWITCHES
+
+ /* This is meant to be redefined in the host dependent files. */
+ #define EXTRA_SUBTARGET_SWITCHES
+@@ -299,6 +304,11 @@ do { \
+ error ("-mcall-aixdesc must be big endian"); \
+ } \
+ \
++ if (TARGET_SECURE_PLT != (target_flags & MASK_SECURE_PLT)) \
++ { \
++ error ("-msecure-plt not supported by your assembler"); \
++ } \
++ \
+ /* Treat -fPIC the same as -mrelocatable. */ \
+ if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
+ target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
+@@ -844,6 +854,10 @@ extern int fixuplabelno;
+
+ #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
+
++#ifndef CC1_SECURE_PLT_DEFAULT_SPEC
++#define CC1_SECURE_PLT_DEFAULT_SPEC ""
++#endif
++
+ /* Pass -G xxx to the compiler and set correct endian mode. */
+ #define CC1_SPEC "%{G*} \
+ %{mlittle|mlittle-endian: %(cc1_endian_little); \
+@@ -856,7 +870,6 @@ extern int fixuplabelno;
+ mcall-gnu : -mbig %(cc1_endian_big); \
+ mcall-i960-old : -mlittle %(cc1_endian_little); \
+ : %(cc1_endian_default)} \
+-%{mno-sdata: -msdata=none } \
+ %{meabi: %{!mcall-*: -mcall-sysv }} \
+ %{!meabi: %{!mno-eabi: \
+ %{mrelocatable: -meabi } \
+@@ -868,6 +881,7 @@ extern int fixuplabelno;
+ %{mcall-openbsd: -mno-eabi }}} \
+ %{msdata: -msdata=default} \
+ %{mno-sdata: -msdata=none} \
++%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
+ %{profile: -p}"
+
+ /* Don't put -Y P,<path> for cross compilers. */
+@@ -1308,6 +1322,7 @@ ncrtn.o%s"
+ { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
+ { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
+ { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
++ { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
+ { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
+ { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
+ { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
+--- gcc/config/rs6000/rs6000.h 2005-03-03 08:34:37.000000000 +1030
++++ gcc/config/rs6000/rs6000.h 2005-05-30 10:52:00.000000000 +0930
+@@ -201,8 +201,8 @@ extern int target_flags;
+ /* Use single field mfcr instruction. */
+ #define MASK_MFCRF 0x00080000
+
+-/* The only remaining free bits are 0x00600000. linux64.h uses
+- 0x00100000, and sysv4.h uses 0x00800000 -> 0x40000000.
++/* The only remaining free bit is 0x00200000. linux64.h uses
++ 0x00100000, and sysv4.h uses 0x00400000 -> 0x40000000.
+ 0x80000000 is not available because target_flags is signed. */
+
+ #define TARGET_POWER (target_flags & MASK_POWER)
+@@ -234,6 +234,11 @@ extern int target_flags;
+ #define TARGET_MFCRF 0
+ #endif
+
++#ifdef HAVE_AS_REL16
++#define TARGET_SECURE_PLT (target_flags & MASK_SECURE_PLT)
++#else
++#define TARGET_SECURE_PLT 0
++#endif
+
+ #define TARGET_32BIT (! TARGET_64BIT)
+ #define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
+--- gcc/config/rs6000/rs6000.c 2005-05-11 18:23:48.000000000 +0930
++++ gcc/config/rs6000/rs6000.c 2005-05-30 10:29:30.000000000 +0930
+@@ -13466,15 +13520,49 @@ rs6000_emit_load_toc_table (int fromprol
+ rtx dest, insn;
+ dest = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
+
+- if (TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 1)
++ if (TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic)
+ {
+- rtx temp = (fromprolog
+- ? gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
+- : gen_reg_rtx (Pmode));
+- insn = emit_insn (gen_load_toc_v4_pic_si (temp));
++ char buf[30];
++ rtx lab, tmp1, tmp2, got, tempLR;
++
++ ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);
++ lab = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
++ if (flag_pic == 2)
++ got = gen_rtx_SYMBOL_REF (Pmode, toc_label_name);
++ else
++ got = rs6000_got_sym ();
++ tmp1 = tmp2 = dest;
++ if (!fromprolog)
++ {
++ tmp1 = gen_reg_rtx (Pmode);
++ tmp2 = gen_reg_rtx (Pmode);
++ }
++ tempLR = (fromprolog
++ ? gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
++ : gen_reg_rtx (Pmode));
++ insn = emit_insn (gen_load_toc_v4_PIC_1 (tempLR, lab));
++ if (fromprolog)
++ rs6000_maybe_dead (insn);
++ insn = emit_move_insn (tmp1, tempLR);
++ if (fromprolog)
++ rs6000_maybe_dead (insn);
++ insn = emit_insn (gen_load_toc_v4_PIC_3b (tmp2, tmp1, got, lab));
++ if (fromprolog)
++ rs6000_maybe_dead (insn);
++ insn = emit_insn (gen_load_toc_v4_PIC_3c (dest, tmp2, got, lab));
++ if (fromprolog)
++ rs6000_maybe_dead (insn);
++ }
++ else if (TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 1)
++ {
++ rtx tempLR = (fromprolog
++ ? gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
++ : gen_reg_rtx (Pmode));
++
++ insn = emit_insn (gen_load_toc_v4_pic_si (tempLR));
+ if (fromprolog)
+ rs6000_maybe_dead (insn);
+- insn = emit_move_insn (dest, temp);
++ insn = emit_move_insn (dest, tempLR);
+ if (fromprolog)
+ rs6000_maybe_dead (insn);
+ }
+@@ -14565,7 +14653,8 @@ rs6000_emit_prologue (void)
+
+ /* If we are using RS6000_PIC_OFFSET_TABLE_REGNUM, we need to set it up. */
+ if ((TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
+- || (DEFAULT_ABI == ABI_V4 && flag_pic == 1
++ || (DEFAULT_ABI == ABI_V4
++ && (flag_pic == 1 || (flag_pic && TARGET_SECURE_PLT))
+ && regs_ever_live[RS6000_PIC_OFFSET_TABLE_REGNUM]))
+ {
+ /* If emit_load_toc_table will use the link register, we need to save
+@@ -18082,6 +18171,7 @@ rs6000_elf_declare_function_name (FILE *
+ }
+
+ if (TARGET_RELOCATABLE
++ && !TARGET_SECURE_PLT
+ && (get_pool_size () != 0 || current_function_profile)
+ && uses_TOC ())
+ {
+--- gcc/config/rs6000/rs6000.md 2005-03-31 21:02:13.000000000 +0930
++++ gcc/config/rs6000/rs6000.md 2005-05-30 10:29:30.000000000 +0930
+@@ -7653,26 +7653,6 @@
+
+ ;; Now define ways of moving data around.
+
+-;; Elf specific ways of loading addresses for non-PIC code.
+-;; The output of this could be r0, but we make a very strong
+-;; preference for a base register because it will usually
+-;; be needed there.
+-(define_insn "elf_high"
+- [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
+- (high:SI (match_operand 1 "" "")))]
+- "TARGET_ELF && ! TARGET_64BIT"
+- "{liu|lis} %0,%1@ha")
+-
+-(define_insn "elf_low"
+- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
+- (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
+- (match_operand 2 "" "")))]
+- "TARGET_ELF && ! TARGET_64BIT"
+- "@
+- {cal|la} %0,%2@l(%1)
+- {ai|addic} %0,%1,%K2")
+-
+-
+ ;; Set up a register with a value from the GOT table
+
+ (define_expand "movsi_got"
+@@ -10133,7 +10111,8 @@
+ [(set (match_operand:SI 0 "register_operand" "=l")
+ (match_operand:SI 1 "immediate_operand" "s"))
+ (use (unspec [(match_dup 1)] UNSPEC_TOC))]
+- "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
++ "TARGET_ELF && DEFAULT_ABI != ABI_AIX
++ && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
+ "bcl 20,31,%1\\n%1:"
+ [(set_attr "type" "branch")
+ (set_attr "length" "4")])
+@@ -10156,6 +10135,23 @@
+ "{l|lwz} %0,%2-%3(%1)"
+ [(set_attr "type" "load")])
+
++(define_insn "load_toc_v4_PIC_3b"
++ [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
++ (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
++ (high:SI
++ (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
++ (match_operand:SI 3 "symbol_ref_operand" "s")))))]
++ "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
++ "{cau|addis} %0,%1,%2-%3@ha")
++
++(define_insn "load_toc_v4_PIC_3c"
++ [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
++ (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
++ (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
++ (match_operand:SI 3 "symbol_ref_operand" "s"))))]
++ "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
++ "{cal|addi} %0,%1,%2-%3@l")
++
+
+ ;; If the TOC is shared over a translation unit, as happens with all
+ ;; the kinds of PIC that we support, we need to restore the TOC
+@@ -10190,6 +10186,26 @@
+ rs6000_emit_load_toc_table (FALSE);
+ DONE;
+ }")
++
++;; Elf specific ways of loading addresses for non-PIC code.
++;; The output of this could be r0, but we make a very strong
++;; preference for a base register because it will usually
++;; be needed there.
++(define_insn "elf_high"
++ [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
++ (high:SI (match_operand 1 "" "")))]
++ "TARGET_ELF && ! TARGET_64BIT"
++ "{liu|lis} %0,%1@ha")
++
++(define_insn "elf_low"
++ [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
++ (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
++ (match_operand 2 "" "")))]
++ "TARGET_ELF && ! TARGET_64BIT"
++ "@
++ {cal|la} %0,%2@l(%1)
++ {ai|addic} %0,%1,%K2")
++
+
+ ;; A function pointer under AIX is a pointer to a data area whose first word
+ ;; contains the actual address of the function, whose second word contains a
+@@ -10306,6 +10322,25 @@
+
+ operands[0] = XEXP (operands[0], 0);
+
++ if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
++ && flag_pic
++ && GET_CODE (operands[0]) == SYMBOL_REF
++ && !SYMBOL_REF_LOCAL_P (operands[0]))
++ {
++ rtx call;
++ rtvec tmp;
++
++ tmp = gen_rtvec (3,
++ gen_rtx_CALL (VOIDmode,
++ gen_rtx_MEM (SImode, operands[0]),
++ operands[1]),
++ gen_rtx_USE (VOIDmode, operands[2]),
++ gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
++ call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
++ use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
++ DONE;
++ }
++
+ if (GET_CODE (operands[0]) != SYMBOL_REF
+ || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
+ || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
+@@ -10354,6 +10389,28 @@
+
+ operands[1] = XEXP (operands[1], 0);
+
++ if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
++ && flag_pic
++ && GET_CODE (operands[1]) == SYMBOL_REF
++ && !SYMBOL_REF_LOCAL_P (operands[1]))
++ {
++ rtx call;
++ rtvec tmp;
++
++ tmp = gen_rtvec (3,
++ gen_rtx_SET (VOIDmode,
++ operands[0],
++ gen_rtx_CALL (VOIDmode,
++ gen_rtx_MEM (SImode,
++ operands[1]),
++ operands[2])),
++ gen_rtx_USE (VOIDmode, operands[3]),
++ gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
++ call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
++ use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
++ DONE;
++ }
++
+ if (GET_CODE (operands[1]) != SYMBOL_REF
+ || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
+ || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
+@@ -10624,7 +10681,18 @@
+ #if TARGET_MACHO
+ return output_call(insn, operands, 0, 2);
+ #else
+- return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
++ if (DEFAULT_ABI == ABI_V4 && flag_pic)
++ {
++ if (TARGET_SECURE_PLT && flag_pic == 2)
++ /* The magic 32768 offset here and in the other sysv call insns
++ corresponds to the offset of r30 in .got2, as given by LCTOC1.
++ See sysv4.h:toc_section. */
++ return "bl %z0+32768@plt";
++ else
++ return "bl %z0@plt";
++ }
++ else
++ return "bl %z0";
+ #endif
+ }
+ [(set_attr "type" "branch,branch")
+@@ -10669,7 +10737,15 @@
+ #if TARGET_MACHO
+ return output_call(insn, operands, 1, 3);
+ #else
+- return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
++ if (DEFAULT_ABI == ABI_V4 && flag_pic)
++ {
++ if (TARGET_SECURE_PLT && flag_pic == 2)
++ return "bl %z1+32768@plt";
++ else
++ return "bl %z1@plt";
++ }
++ else
++ return "bl %z1";
+ #endif
+ }
+ [(set_attr "type" "branch,branch")
+@@ -10884,7 +10960,15 @@
+ else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
+ output_asm_insn (\"creqv 6,6,6\", operands);
+
+- return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
++ if (DEFAULT_ABI == ABI_V4 && flag_pic)
++ {
++ if (TARGET_SECURE_PLT && flag_pic == 2)
++ return \"b %z0+32768@plt\";
++ else
++ return \"b %z0@plt\";
++ }
++ else
++ return \"b %z0\";
+ }"
+ [(set_attr "type" "branch,branch")
+ (set_attr "length" "4,8")])
+@@ -10930,7 +11014,15 @@
+ else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
+ output_asm_insn (\"creqv 6,6,6\", operands);
+
+- return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
++ if (DEFAULT_ABI == ABI_V4 && flag_pic)
++ {
++ if (TARGET_SECURE_PLT && flag_pic == 2)
++ return \"b %z1+32768@plt\";
++ else
++ return \"b %z1@plt\";
++ }
++ else
++ return \"b %z1\";
+ }"
+ [(set_attr "type" "branch,branch")
+ (set_attr "length" "4,8")])
+--- gcc/config/rs6000/tramp.asm 2003-06-06 14:41:22.000000000 +0930
++++ gcc/config/rs6000/tramp.asm 2005-05-24 10:52:09.000000000 +0930
+@@ -44,7 +44,7 @@
+ .align 2
+ trampoline_initial:
+ mflr r0
+- bl 1f
++ bcl 20,31,1f
+ .Lfunc = .-trampoline_initial
+ .long 0 /* will be replaced with function address */
+ .Lchain = .-trampoline_initial
+@@ -67,7 +67,7 @@ trampoline_size = .-trampoline_initial
+
+ FUNC_START(__trampoline_setup)
+ mflr r0 /* save return address */
+- bl .LCF0 /* load up __trampoline_initial into r7 */
++ bcl 20,31,.LCF0 /* load up __trampoline_initial into r7 */
+ .LCF0:
+ mflr r11
+ addi r7,r11,trampoline_initial-4-.LCF0 /* trampoline address -4 */
+@@ -105,6 +105,12 @@ FUNC_START(__trampoline_setup)
+ blr
+
+ .Labort:
++#if defined SHARED && defined HAVE_AS_REL16
++ bcl 20,31,1f
++1: mflr r30
++ addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha
++ addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l
++#endif
+ bl JUMP_TARGET(abort)
+ FUNC_END(__trampoline_setup)
+
+--- libffi/src/powerpc/ppc_closure.S 2004-09-03 22:42:23.000000000 +0930
++++ libffi/src/powerpc/ppc_closure.S 2005-05-24 10:25:49.000000000 +0930
+@@ -57,7 +57,7 @@ ENTRY(ffi_closure_SYSV)
+ addi %r7,%r1,152
+
+ # make the call
+- bl JUMPTARGET(ffi_closure_helper_SYSV)
++ bl ffi_closure_helper_SYSV@local
+
+ # now r3 contains the return type
+ # so use it to look up in a table
+--- libffi/src/powerpc/sysv.S 2004-09-03 22:42:23.000000000 +0930
++++ libffi/src/powerpc/sysv.S 2005-05-24 10:25:47.000000000 +0930
+@@ -60,7 +60,7 @@ ENTRY(ffi_call_SYSV)
+
+ /* Call ffi_prep_args_SYSV. */
+ mr %r4,%r1
+- bl JUMPTARGET(ffi_prep_args_SYSV)
++ bl ffi_prep_args_SYSV@local
+
+ /* Now do the call. */
+ /* Set up cr1 with bits 4-7 of the flags. */
diff --git a/4.0.4/gentoo/17_all_gcc4-dwarf2-usefbreg.patch b/4.0.4/gentoo/17_all_gcc4-dwarf2-usefbreg.patch
new file mode 100644
index 0000000..cc5e180
--- /dev/null
+++ b/4.0.4/gentoo/17_all_gcc4-dwarf2-usefbreg.patch
@@ -0,0 +1,143 @@
+2005-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (concat_loc_descriptor): Add can_use_fbreg argument,
+ pass it down to loc_descriptor.
+ (loc_descriptor): Pass can_use_fbreg to concat_loc_descriptor.
+ (containing_function_has_frame_base): Move earlier in the file.
+ (loc_descriptor_from_tree_1): Use containing_function_has_frame_base
+ instead of always assuming fbreg can't be used.
+
+--- gcc/dwarf2out.c.jj 2005-08-06 10:39:55.000000000 +0200
++++ gcc/dwarf2out.c 2005-08-10 10:23:26.000000000 +0200
+@@ -3982,7 +3982,7 @@ static dw_loc_descr_ref int_loc_descript
+ static dw_loc_descr_ref based_loc_descr (unsigned, HOST_WIDE_INT, bool);
+ static int is_based_loc (rtx);
+ static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode, bool);
+-static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx);
++static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx, bool);
+ static dw_loc_descr_ref loc_descriptor (rtx, bool);
+ static dw_loc_descr_ref loc_descriptor_from_tree_1 (tree, int);
+ static dw_loc_descr_ref loc_descriptor_from_tree (tree);
+@@ -8806,11 +8806,11 @@ mem_loc_descriptor (rtx rtl, enum machin
+ This is typically a complex variable. */
+
+ static dw_loc_descr_ref
+-concat_loc_descriptor (rtx x0, rtx x1)
++concat_loc_descriptor (rtx x0, rtx x1, bool can_use_fbreg)
+ {
+ dw_loc_descr_ref cc_loc_result = NULL;
+- dw_loc_descr_ref x0_ref = loc_descriptor (x0, false);
+- dw_loc_descr_ref x1_ref = loc_descriptor (x1, false);
++ dw_loc_descr_ref x0_ref = loc_descriptor (x0, can_use_fbreg);
++ dw_loc_descr_ref x1_ref = loc_descriptor (x1, can_use_fbreg);
+
+ if (x0_ref == 0 || x1_ref == 0)
+ return 0;
+@@ -8824,6 +8824,29 @@ concat_loc_descriptor (rtx x0, rtx x1)
+ return cc_loc_result;
+ }
+
++/* Return true if DECL's containing function has a frame base attribute.
++ Return false otherwise. */
++
++static bool
++containing_function_has_frame_base (tree decl)
++{
++ tree declcontext = decl_function_context (decl);
++ dw_die_ref context;
++ dw_attr_ref attr;
++
++ if (!declcontext)
++ return false;
++
++ context = lookup_decl_die (declcontext);
++ if (!context)
++ return false;
++
++ for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
++ if (attr->dw_attr == DW_AT_frame_base)
++ return true;
++ return false;
++}
++
+ /* Output a proper Dwarf location descriptor for a variable or parameter
+ which is either allocated in a register or in a memory location. For a
+ register, we just generate an OP_REG and the register number. For a
+@@ -8859,7 +8882,8 @@ loc_descriptor (rtx rtl, bool can_use_fb
+ break;
+
+ case CONCAT:
+- loc_result = concat_loc_descriptor (XEXP (rtl, 0), XEXP (rtl, 1));
++ loc_result = concat_loc_descriptor (XEXP (rtl, 0), XEXP (rtl, 1),
++ can_use_fbreg);
+ break;
+
+ case VAR_LOCATION:
+@@ -9019,10 +9043,11 @@ loc_descriptor_from_tree_1 (tree loc, in
+ else
+ {
+ enum machine_mode mode;
++ bool can_use_fb = containing_function_has_frame_base (loc);
+
+ /* Certain constructs can only be represented at top-level. */
+ if (want_address == 2)
+- return loc_descriptor (rtl, false);
++ return loc_descriptor (rtl, can_use_fb);
+
+ mode = GET_MODE (rtl);
+ if (MEM_P (rtl))
+@@ -9030,7 +9055,7 @@ loc_descriptor_from_tree_1 (tree loc, in
+ rtl = XEXP (rtl, 0);
+ have_address = 1;
+ }
+- ret = mem_loc_descriptor (rtl, mode, false);
++ ret = mem_loc_descriptor (rtl, mode, can_use_fb);
+ }
+ }
+ break;
+@@ -9104,12 +9129,14 @@ loc_descriptor_from_tree_1 (tree loc, in
+ /* Get an RTL for this, if something has been emitted. */
+ rtx rtl = lookup_constant_def (loc);
+ enum machine_mode mode;
++ bool can_use_fb;
+
+ if (!rtl || !MEM_P (rtl))
+ return 0;
++ can_use_fb = containing_function_has_frame_base (loc);
+ mode = GET_MODE (rtl);
+ rtl = XEXP (rtl, 0);
+- ret = mem_loc_descriptor (rtl, mode, false);
++ ret = mem_loc_descriptor (rtl, mode, can_use_fb);
+ have_address = 1;
+ break;
+ }
+@@ -10073,29 +10100,6 @@ rtl_for_decl_location (tree decl)
+ return rtl;
+ }
+
+-/* Return true if DECL's containing function has a frame base attribute.
+- Return false otherwise. */
+-
+-static bool
+-containing_function_has_frame_base (tree decl)
+-{
+- tree declcontext = decl_function_context (decl);
+- dw_die_ref context;
+- dw_attr_ref attr;
+-
+- if (!declcontext)
+- return false;
+-
+- context = lookup_decl_die (declcontext);
+- if (!context)
+- return false;
+-
+- for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
+- if (attr->dw_attr == DW_AT_frame_base)
+- return true;
+- return false;
+-}
+-
+ /* Generate *either* a DW_AT_location attribute or else a DW_AT_const_value
+ data attribute for a variable or a parameter. We generate the
+ DW_AT_const_value attribute only in those cases where the given variable
diff --git a/4.0.4/gentoo/18_all_gcc4-dwarf2-prefer-1elt-vartracking.patch b/4.0.4/gentoo/18_all_gcc4-dwarf2-prefer-1elt-vartracking.patch
new file mode 100644
index 0000000..38c4a64
--- /dev/null
+++ b/4.0.4/gentoo/18_all_gcc4-dwarf2-prefer-1elt-vartracking.patch
@@ -0,0 +1,47 @@
+2005-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (add_location_or_const_value_attribute): Prefer
+ locations gathered by var-tracking in single entry loc_list
+ over loc_descriptor_from_tree.
+
+--- gcc/dwarf2out.c.jj 2005-08-10 10:23:26.000000000 +0200
++++ gcc/dwarf2out.c 2005-08-10 17:33:35.000000000 +0200
+@@ -10235,16 +10235,7 @@ add_location_or_const_value_attribute (d
+ return;
+ }
+
+- /* We couldn't get any rtl, and we had no >1 element location list, so try
+- directly generating the location description from the tree. */
+- descr = loc_descriptor_from_tree (decl);
+- if (descr)
+- {
+- add_AT_location_description (die, attr, descr);
+- return;
+- }
+-
+- /* Lastly, if we have tried to generate the location otherwise, and it
++ /* If we have tried to generate the location otherwise, and it
+ didn't work out (we wouldn't be here if we did), and we have a one entry
+ location list, try generating a location from that. */
+ if (loc_list && loc_list->first)
+@@ -10253,7 +10244,19 @@ add_location_or_const_value_attribute (d
+ descr = loc_descriptor (NOTE_VAR_LOCATION (node->var_loc_note),
+ can_use_fb);
+ if (descr)
+- add_AT_location_description (die, attr, descr);
++ {
++ add_AT_location_description (die, attr, descr);
++ return;
++ }
++ }
++
++ /* We couldn't get any rtl, so try directly generating the location
++ description from the tree. */
++ descr = loc_descriptor_from_tree (decl);
++ if (descr)
++ {
++ add_AT_location_description (die, attr, descr);
++ return;
+ }
+ }
+
diff --git a/4.0.4/gentoo/19_all_gcc4-dwarf2-pr20268.patch b/4.0.4/gentoo/19_all_gcc4-dwarf2-pr20268.patch
new file mode 100644
index 0000000..c8f7ef4
--- /dev/null
+++ b/4.0.4/gentoo/19_all_gcc4-dwarf2-pr20268.patch
@@ -0,0 +1,102 @@
+2005-03-30 James E. Wilson <wilson@specifixinc.com>
+
+ PR debug/20268
+ * dwarf2out.c (add_high_low_attributes): New function, extracted from
+ gen_lexical_block_die.
+ (gen_lexical_block_die, gen_inlined_subroutine_die): Call it.
+
+--- gcc/dwarf2out.c 30 Mar 2005 21:34:23 -0000 1.575
++++ gcc/dwarf2out.c 30 Mar 2005 23:08:17 -0000 1.576
+@@ -11578,41 +11578,49 @@ gen_label_die (tree decl, dw_die_ref con
+ }
+ }
+
+-/* Generate a DIE for a lexical block. */
++/* A helper function for gen_lexical_block_die and gen_inlined_subroutine_die.
++ Add low_pc and high_pc attributes to the DIE for a block STMT. */
+
+-static void
+-gen_lexical_block_die (tree stmt, dw_die_ref context_die, int depth)
++static inline void
++add_high_low_attributes (tree stmt, dw_die_ref die)
+ {
+- dw_die_ref stmt_die = new_die (DW_TAG_lexical_block, context_die, stmt);
+ char label[MAX_ARTIFICIAL_LABEL_BYTES];
+
+- if (! BLOCK_ABSTRACT (stmt))
++ if (BLOCK_FRAGMENT_CHAIN (stmt))
+ {
+- if (BLOCK_FRAGMENT_CHAIN (stmt))
+- {
+- tree chain;
++ tree chain;
+
+- add_AT_range_list (stmt_die, DW_AT_ranges, add_ranges (stmt));
++ add_AT_range_list (die, DW_AT_ranges, add_ranges (stmt));
+
+- chain = BLOCK_FRAGMENT_CHAIN (stmt);
+- do
+- {
+- add_ranges (chain);
+- chain = BLOCK_FRAGMENT_CHAIN (chain);
+- }
+- while (chain);
+- add_ranges (NULL);
+- }
+- else
++ chain = BLOCK_FRAGMENT_CHAIN (stmt);
++ do
+ {
+- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
+- BLOCK_NUMBER (stmt));
+- add_AT_lbl_id (stmt_die, DW_AT_low_pc, label);
+- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
+- BLOCK_NUMBER (stmt));
+- add_AT_lbl_id (stmt_die, DW_AT_high_pc, label);
++ add_ranges (chain);
++ chain = BLOCK_FRAGMENT_CHAIN (chain);
+ }
++ while (chain);
++ add_ranges (NULL);
++ }
++ else
++ {
++ ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
++ BLOCK_NUMBER (stmt));
++ add_AT_lbl_id (die, DW_AT_low_pc, label);
++ ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
++ BLOCK_NUMBER (stmt));
++ add_AT_lbl_id (die, DW_AT_high_pc, label);
+ }
++}
++
++/* Generate a DIE for a lexical block. */
++
++static void
++gen_lexical_block_die (tree stmt, dw_die_ref context_die, int depth)
++{
++ dw_die_ref stmt_die = new_die (DW_TAG_lexical_block, context_die, stmt);
++
++ if (! BLOCK_ABSTRACT (stmt))
++ add_high_low_attributes (stmt, stmt_die);
+
+ decls_for_scope (stmt, stmt_die, depth);
+ }
+@@ -11634,15 +11642,10 @@ gen_inlined_subroutine_die (tree stmt, d
+ {
+ dw_die_ref subr_die
+ = new_die (DW_TAG_inlined_subroutine, context_die, stmt);
+- char label[MAX_ARTIFICIAL_LABEL_BYTES];
+
+ add_abstract_origin_attribute (subr_die, decl);
+- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
+- BLOCK_NUMBER (stmt));
+- add_AT_lbl_id (subr_die, DW_AT_low_pc, label);
+- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
+- BLOCK_NUMBER (stmt));
+- add_AT_lbl_id (subr_die, DW_AT_high_pc, label);
++ add_high_low_attributes (stmt, subr_die);
++
+ decls_for_scope (stmt, subr_die, depth);
+ current_function_has_inlines = 1;
+ }
diff --git a/4.0.4/gentoo/29_all_gcc4-pr19664.patch b/4.0.4/gentoo/29_all_gcc4-pr19664.patch
new file mode 100644
index 0000000..ef7cf28
--- /dev/null
+++ b/4.0.4/gentoo/29_all_gcc4-pr19664.patch
@@ -0,0 +1,1984 @@
+diff -urN libstdc++-v3-orig/include/c_std/std_cassert.h libstdc++-v3/include/c_std/std_cassert.h
+--- libstdc++-v3-orig/include/c_std/std_cassert.h 2003-12-09 04:44:35.000000000 +0100
++++ libstdc++-v3/include/c_std/std_cassert.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -44,5 +44,8 @@
+ // No include guards on this header...
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <assert.h>
++
++#pragma GCC visibility pop
+diff -urN libstdc++-v3-orig/include/c_std/std_cctype.h libstdc++-v3/include/c_std/std_cctype.h
+--- libstdc++-v3-orig/include/c_std/std_cctype.h 2003-12-09 04:44:35.000000000 +0100
++++ libstdc++-v3/include/c_std/std_cctype.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,7 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -44,6 +45,7 @@
+ #define _GLIBCXX_CCTYPE 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <ctype.h>
+@@ -80,4 +82,6 @@
+ using ::toupper;
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cerrno.h libstdc++-v3/include/c_std/std_cerrno.h
+--- libstdc++-v3-orig/include/c_std/std_cerrno.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_cerrno.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,7 @@
+ // The -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -44,6 +45,7 @@
+ #define _GLIBCXX_CERRNO 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <errno.h>
+
+@@ -52,4 +54,6 @@
+ #define errno errno
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cfloat.h libstdc++-v3/include/c_std/std_cfloat.h
+--- libstdc++-v3-orig/include/c_std/std_cfloat.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_cfloat.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,7 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -44,7 +45,10 @@
+ #define _GLIBCXX_CFLOAT 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <float.h>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_climits.h libstdc++-v3/include/c_std/std_climits.h
+--- libstdc++-v3-orig/include/c_std/std_climits.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_climits.h 2005-05-20 11:29:55.000000000 +0200
+@@ -45,7 +45,9 @@
+ #define _GLIBCXX_CLIMITS 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <limits.h>
+
++#pragma GCC visibility pop
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_clocale.h libstdc++-v3/include/c_std/std_clocale.h
+--- libstdc++-v3-orig/include/c_std/std_clocale.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_clocale.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CLOCALE 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <locale.h>
+
+@@ -59,4 +60,6 @@
+ using ::localeconv;
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cmath.h libstdc++-v3/include/c_std/std_cmath.h
+--- libstdc++-v3-orig/include/c_std/std_cmath.h 2005-02-13 11:25:02.000000000 +0100
++++ libstdc++-v3/include/c_std/std_cmath.h 2005-05-20 11:29:55.000000000 +0200
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CMATH 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <bits/cpp_type_traits.h>
+@@ -574,4 +575,6 @@
+ # include <bits/cmath.tcc>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_csetjmp.h libstdc++-v3/include/c_std/std_csetjmp.h
+--- libstdc++-v3-orig/include/c_std/std_csetjmp.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_csetjmp.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CSETJMP 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <setjmp.h>
+
+@@ -62,4 +63,6 @@
+ using ::longjmp;
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_csignal.h libstdc++-v3/include/c_std/std_csignal.h
+--- libstdc++-v3-orig/include/c_std/std_csignal.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_csignal.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CSIGNAL 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <signal.h>
+
+@@ -58,4 +59,6 @@
+ using ::raise;
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cstdarg.h libstdc++-v3/include/c_std/std_cstdarg.h
+--- libstdc++-v3-orig/include/c_std/std_cstdarg.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_cstdarg.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,7 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -44,6 +45,7 @@
+ #define _GLIBCXX_CSTDARG 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <stdarg.h>
+
+@@ -57,4 +59,6 @@
+ using ::va_list;
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cstddef.h libstdc++-v3/include/c_std/std_cstddef.h
+--- libstdc++-v3-orig/include/c_std/std_cstddef.h 2003-12-09 04:44:35.000000000 +0100
++++ libstdc++-v3/include/c_std/std_cstddef.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,7 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -44,6 +45,7 @@
+ #define _GLIBCXX_CSTDDEF 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <stddef.h>
+
+@@ -53,4 +55,6 @@
+ using ::size_t;
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cstdio.h libstdc++-v3/include/c_std/std_cstdio.h
+--- libstdc++-v3-orig/include/c_std/std_cstdio.h 2005-03-24 06:45:44.000000000 +0100
++++ libstdc++-v3/include/c_std/std_cstdio.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CSTDIO 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <cstddef>
+@@ -183,4 +184,6 @@
+ }
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cstdlib.h libstdc++-v3/include/c_std/std_cstdlib.h
+--- libstdc++-v3-orig/include/c_std/std_cstdlib.h 2004-08-02 22:28:21.000000000 +0200
++++ libstdc++-v3/include/c_std/std_cstdlib.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CSTDLIB 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <cstddef>
+@@ -217,4 +218,6 @@
+ }
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cstring.h libstdc++-v3/include/c_std/std_cstring.h
+--- libstdc++-v3-orig/include/c_std/std_cstring.h 2003-12-09 04:44:35.000000000 +0100
++++ libstdc++-v3/include/c_std/std_cstring.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CSTRING 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <cstddef>
+
+@@ -125,4 +126,6 @@
+ { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_ctime.h libstdc++-v3/include/c_std/std_ctime.h
+--- libstdc++-v3-orig/include/c_std/std_ctime.h 2003-07-23 17:28:44.000000000 +0200
++++ libstdc++-v3/include/c_std/std_ctime.h 2005-05-20 11:29:55.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*- forwarding header.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CTIME 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <cstddef>
+
+@@ -78,4 +79,6 @@
+ using ::strftime;
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cwchar.h libstdc++-v3/include/c_std/std_cwchar.h
+--- libstdc++-v3-orig/include/c_std/std_cwchar.h 2004-07-20 10:47:42.000000000 +0200
++++ libstdc++-v3/include/c_std/std_cwchar.h 2005-05-20 11:29:55.000000000 +0200
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CWCHAR 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <cstddef>
+@@ -270,4 +271,6 @@
+
+ #endif //_GLIBCXX_USE_WCHAR_T
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/c_std/std_cwctype.h libstdc++-v3/include/c_std/std_cwctype.h
+--- libstdc++-v3-orig/include/c_std/std_cwctype.h 2005-03-24 06:45:45.000000000 +0100
++++ libstdc++-v3/include/c_std/std_cwctype.h 2005-05-20 11:31:40.000000000 +0200
+@@ -45,6 +45,7 @@
+ #define _GLIBCXX_CWCTYPE 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+
+@@ -105,4 +106,6 @@
+ }
+ #endif //_GLIBCXX_USE_WCHAR_T
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/bitset libstdc++-v3/include/debug/bitset
+--- libstdc++-v3-orig/include/debug/bitset 2005-05-09 14:45:05.000000000 +0200
++++ libstdc++-v3/include/debug/bitset 2005-05-20 11:30:03.000000000 +0200
+@@ -31,6 +31,8 @@
+ #ifndef _GLIBCXX_DEBUG_BITSET
+ #define _GLIBCXX_DEBUG_BITSET
+
++#pragma GCC visibility push(default)
++
+ #include <bitset>
+ #include <debug/safe_sequence.h>
+ #include <debug/safe_iterator.h>
+@@ -318,4 +320,6 @@
+ { return __os << __x._M_base(); }
+ } // namespace __gnu_debug_def
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/deque libstdc++-v3/include/debug/deque
+--- libstdc++-v3-orig/include/debug/deque 2004-04-16 21:04:04.000000000 +0200
++++ libstdc++-v3/include/debug/deque 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Debugging deque implementation -*- C++ -*-
+
+-// Copyright (C) 2003, 2004
++// Copyright (C) 2003, 2004, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -31,6 +31,8 @@
+ #ifndef _GLIBCXX_DEBUG_DEQUE
+ #define _GLIBCXX_DEBUG_DEQUE 1
+
++#pragma GCC visibility push(default)
++
+ #include <deque>
+ #include <debug/safe_sequence.h>
+ #include <debug/safe_iterator.h>
+@@ -383,4 +385,6 @@
+ { __lhs.swap(__rhs); }
+ } // namespace __gnu_debug_def
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/hash_map libstdc++-v3/include/debug/hash_map
+--- libstdc++-v3-orig/include/debug/hash_map 2003-11-11 21:09:09.000000000 +0100
++++ libstdc++-v3/include/debug/hash_map 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Debugging hash_map/hash_multimap implementation -*- C++ -*-
+
+-// Copyright (C) 2003
++// Copyright (C) 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -31,8 +31,12 @@
+ #ifndef _GLIBCXX_DEBUG_HASH_MAP
+ #define _GLIBCXX_DEBUG_HASH_MAP 1
+
++#pragma GCC visibility push(default)
++
+ #include <hash_map>
+ #include <debug/dbg_hash_map.h>
+ #include <debug/dbg_hash_multimap.h>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/hash_set libstdc++-v3/include/debug/hash_set
+--- libstdc++-v3-orig/include/debug/hash_set 2003-12-09 05:26:28.000000000 +0100
++++ libstdc++-v3/include/debug/hash_set 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Debugging hash_set/hash_multiset implementation -*- C++ -*-
+
+-// Copyright (C) 2003
++// Copyright (C) 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -31,8 +31,12 @@
+ #ifndef _GLIBCXX_DEBUG_HASH_SET
+ #define _GLIBCXX_DEBUG_HASH_SET 1
+
++#pragma GCC visibility push(default)
++
+ #include <hash_set>
+ #include <debug/dbg_hash_set.h>
+ #include <debug/dbg_hash_multiset.h>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/list libstdc++-v3/include/debug/list
+--- libstdc++-v3-orig/include/debug/list 2004-04-16 21:04:04.000000000 +0200
++++ libstdc++-v3/include/debug/list 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Debugging list implementation -*- C++ -*-
+
+-// Copyright (C) 2003, 2004
++// Copyright (C) 2003, 2004, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -31,6 +31,8 @@
+ #ifndef _GLIBCXX_DEBUG_LIST
+ #define _GLIBCXX_DEBUG_LIST 1
+
++#pragma GCC visibility push(default)
++
+ #include <list>
+ #include <bits/stl_algo.h>
+ #include <debug/safe_sequence.h>
+@@ -502,4 +504,6 @@
+ { __lhs.swap(__rhs); }
+ } // namespace __gnu_debug_def
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/map libstdc++-v3/include/debug/map
+--- libstdc++-v3-orig/include/debug/map 2003-11-11 21:09:09.000000000 +0100
++++ libstdc++-v3/include/debug/map 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Debugging map/multimap implementation -*- C++ -*-
+
+-// Copyright (C) 2003
++// Copyright (C) 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -31,8 +31,12 @@
+ #ifndef _GLIBCXX_DEBUG_MAP
+ #define _GLIBCXX_DEBUG_MAP 1
+
++#pragma GCC visibility push(default)
++
+ #include <map>
+ #include <debug/map.h>
+ #include <debug/multimap.h>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/set libstdc++-v3/include/debug/set
+--- libstdc++-v3-orig/include/debug/set 2003-11-11 21:09:09.000000000 +0100
++++ libstdc++-v3/include/debug/set 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Debugging set/multiset implementation -*- C++ -*-
+
+-// Copyright (C) 2003
++// Copyright (C) 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -31,8 +31,12 @@
+ #ifndef _GLIBCXX_DEBUG_SET
+ #define _GLIBCXX_DEBUG_SET 1
+
++#pragma GCC visibility push(default)
++
+ #include <set>
+ #include <debug/set.h>
+ #include <debug/multiset.h>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/string libstdc++-v3/include/debug/string
+--- libstdc++-v3-orig/include/debug/string 2003-12-09 05:26:28.000000000 +0100
++++ libstdc++-v3/include/debug/string 2005-05-20 11:30:03.000000000 +0200
+@@ -31,6 +31,8 @@
+ #ifndef _GLIBCXX_DEBUG_STRING
+ #define _GLIBCXX_DEBUG_STRING 1
+
++#pragma GCC visibility push(default)
++
+ #include <string>
+ #include <debug/safe_sequence.h>
+ #include <debug/safe_iterator.h>
+@@ -998,4 +1000,6 @@
+ }
+ } // namespace __gnu_debug
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/debug/vector libstdc++-v3/include/debug/vector
+--- libstdc++-v3-orig/include/debug/vector 2004-04-16 21:04:04.000000000 +0200
++++ libstdc++-v3/include/debug/vector 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Debugging vector implementation -*- C++ -*-
+
+-// Copyright (C) 2003, 2004
++// Copyright (C) 2003, 2004, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -31,6 +31,8 @@
+ #ifndef _GLIBCXX_DEBUG_VECTOR
+ #define _GLIBCXX_DEBUG_VECTOR 1
+
++#pragma GCC visibility push(default)
++
+ #include <vector>
+ #include <debug/safe_sequence.h>
+ #include <debug/safe_iterator.h>
+@@ -409,4 +411,6 @@
+ { __lhs.swap(__rhs); }
+ } // namespace __gnu_debug_def
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/algorithm libstdc++-v3/include/ext/algorithm
+--- libstdc++-v3-orig/include/ext/algorithm 2004-11-24 05:11:11.000000000 +0100
++++ libstdc++-v3/include/ext/algorithm 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Algorithm extensions -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -62,6 +62,7 @@
+ #define _EXT_ALGORITHM 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <algorithm>
+
+@@ -523,4 +524,6 @@
+ }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif /* _EXT_ALGORITHM */
+diff -urN libstdc++-v3-orig/include/ext/array_allocator.h libstdc++-v3/include/ext/array_allocator.h
+--- libstdc++-v3-orig/include/ext/array_allocator.h 2005-05-18 19:42:24.000000000 +0200
++++ libstdc++-v3/include/ext/array_allocator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef _ARRAY_ALLOCATOR_H
+ #define _ARRAY_ALLOCATOR_H 1
+
++#pragma GCC visibility push(default)
++
+ #include <cstddef>
+ #include <new>
+ #include <bits/functexcept.h>
+@@ -143,4 +145,6 @@
+ { return false; }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/bitmap_allocator.h libstdc++-v3/include/ext/bitmap_allocator.h
+--- libstdc++-v3-orig/include/ext/bitmap_allocator.h 2005-04-15 06:07:45.000000000 +0200
++++ libstdc++-v3/include/ext/bitmap_allocator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef _BITMAP_ALLOCATOR_H
+ #define _BITMAP_ALLOCATOR_H 1
+
++#pragma GCC visibility push(default)
++
+ // For std::size_t, and ptrdiff_t.
+ #include <cstddef>
+
+@@ -1287,6 +1289,8 @@
+
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+
+ // LocalWords: namespace GTHREADS bool const gthread endif Mutex mutex
+diff -urN libstdc++-v3-orig/include/ext/debug_allocator.h libstdc++-v3/include/ext/debug_allocator.h
+--- libstdc++-v3-orig/include/ext/debug_allocator.h 2004-11-05 20:58:02.000000000 +0100
++++ libstdc++-v3/include/ext/debug_allocator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -48,6 +48,8 @@
+ #ifndef _DEBUG_ALLOCATOR_H
+ #define _DEBUG_ALLOCATOR_H 1
+
++#pragma GCC visibility push(default)
++
+ #include <stdexcept>
+
+ namespace __gnu_cxx
+@@ -122,4 +124,6 @@
+ };
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/functional libstdc++-v3/include/ext/functional
+--- libstdc++-v3-orig/include/ext/functional 2004-11-24 05:11:11.000000000 +0100
++++ libstdc++-v3/include/ext/functional 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Functional extensions -*- C++ -*-
+
+-// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -62,6 +62,7 @@
+ #define _EXT_FUNCTIONAL 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <functional>
+
+@@ -421,5 +422,8 @@
+ mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
+ { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+ } // namespace __gnu_cxx
++
++#pragma GCC visibility pop
++
+ #endif
+
+diff -urN libstdc++-v3-orig/include/ext/hash_map libstdc++-v3/include/ext/hash_map
+--- libstdc++-v3-orig/include/ext/hash_map 2004-11-24 05:11:11.000000000 +0100
++++ libstdc++-v3/include/ext/hash_map 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Hashing map implementation -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,8 @@
+ #ifndef _HASH_MAP
+ #define _HASH_MAP 1
+
++#pragma GCC visibility push(default)
++
+ #include <ext/hashtable.h>
+ #include <bits/concept_check.h>
+
+@@ -617,4 +619,7 @@
+ { return *this; }
+ };
+ } // namespace std
++
++#pragma GCC visibility push(default)
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/hash_set libstdc++-v3/include/ext/hash_set
+--- libstdc++-v3-orig/include/ext/hash_set 2004-11-24 05:11:11.000000000 +0100
++++ libstdc++-v3/include/ext/hash_set 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Hashing set implementation -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,8 @@
+ #ifndef _HASH_SET
+ #define _HASH_SET 1
+
++#pragma GCC visibility push(default)
++
+ #include <ext/hashtable.h>
+ #include <bits/concept_check.h>
+
+@@ -583,4 +585,7 @@
+ operator++(int) { return *this; }
+ };
+ } // namespace std
++
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/iterator libstdc++-v3/include/ext/iterator
+--- libstdc++-v3-orig/include/ext/iterator 2004-11-24 05:11:13.000000000 +0100
++++ libstdc++-v3/include/ext/iterator 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // HP/SGI iterator extensions -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -62,6 +62,7 @@
+ #define _EXT_ITERATOR 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/concept_check.h>
+ #include <iterator>
+@@ -113,5 +114,7 @@
+ }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+
+diff -urN libstdc++-v3-orig/include/ext/malloc_allocator.h libstdc++-v3/include/ext/malloc_allocator.h
+--- libstdc++-v3-orig/include/ext/malloc_allocator.h 2004-12-05 01:25:18.000000000 +0100
++++ libstdc++-v3/include/ext/malloc_allocator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,7 @@
+ // Allocator that wraps "C" malloc -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2004, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -34,6 +35,8 @@
+ #ifndef _MALLOC_ALLOCATOR_H
+ #define _MALLOC_ALLOCATOR_H 1
+
++#pragma GCC visibility push(default)
++
+ #include <cstdlib>
+ #include <new>
+ #include <bits/functexcept.h>
+@@ -122,4 +125,6 @@
+ { return false; }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/memory libstdc++-v3/include/ext/memory
+--- libstdc++-v3-orig/include/ext/memory 2004-11-24 05:11:13.000000000 +0100
++++ libstdc++-v3/include/ext/memory 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Memory extensions -*- C++ -*-
+
+-// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -62,6 +62,7 @@
+ #define _EXT_MEMORY 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <memory>
+ #include <bits/stl_tempbuf.h>
+@@ -194,5 +195,7 @@
+ };
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+
+diff -urN libstdc++-v3-orig/include/ext/mt_allocator.h libstdc++-v3/include/ext/mt_allocator.h
+--- libstdc++-v3-orig/include/ext/mt_allocator.h 2005-04-28 09:50:46.000000000 +0200
++++ libstdc++-v3/include/ext/mt_allocator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef _MT_ALLOCATOR_H
+ #define _MT_ALLOCATOR_H 1
+
++#pragma GCC visibility push(default)
++
+ #include <new>
+ #include <cstdlib>
+ #include <bits/functexcept.h>
+@@ -760,4 +762,6 @@
+ #undef __thread_default
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/new_allocator.h libstdc++-v3/include/ext/new_allocator.h
+--- libstdc++-v3-orig/include/ext/new_allocator.h 2004-11-24 05:11:13.000000000 +0100
++++ libstdc++-v3/include/ext/new_allocator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Allocator that wraps operator new -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -34,6 +34,8 @@
+ #ifndef _NEW_ALLOCATOR_H
+ #define _NEW_ALLOCATOR_H 1
+
++#pragma GCC visibility push(default)
++
+ #include <new>
+ #include <bits/functexcept.h>
+
+@@ -118,4 +120,6 @@
+ { return false; }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/numeric libstdc++-v3/include/ext/numeric
+--- libstdc++-v3-orig/include/ext/numeric 2004-11-24 05:11:13.000000000 +0100
++++ libstdc++-v3/include/ext/numeric 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Numeric extensions -*- C++ -*-
+
+-// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -62,6 +62,7 @@
+ #define _EXT_NUMERIC 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/concept_check.h>
+ #include <numeric>
+@@ -146,5 +147,7 @@
+ }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+
+diff -urN libstdc++-v3-orig/include/ext/pod_char_traits.h libstdc++-v3/include/ext/pod_char_traits.h
+--- libstdc++-v3-orig/include/ext/pod_char_traits.h 2005-04-15 04:06:21.000000000 +0200
++++ libstdc++-v3/include/ext/pod_char_traits.h 2005-05-20 11:30:03.000000000 +0200
+@@ -37,6 +37,8 @@
+ #ifndef _POD_CHAR_TRAITS_H
+ #define _POD_CHAR_TRAITS_H 1
+
++#pragma GCC visibility push(default)
++
+ #include <string>
+
+ namespace __gnu_cxx
+@@ -182,4 +184,6 @@
+ };
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/pool_allocator.h libstdc++-v3/include/ext/pool_allocator.h
+--- libstdc++-v3-orig/include/ext/pool_allocator.h 2005-04-28 09:50:47.000000000 +0200
++++ libstdc++-v3/include/ext/pool_allocator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Allocators -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -47,6 +47,8 @@
+ #ifndef _POOL_ALLOCATOR_H
+ #define _POOL_ALLOCATOR_H 1
+
++#pragma GCC visibility push(default)
++
+ #include <bits/c++config.h>
+ #include <cstdlib>
+ #include <new>
+@@ -252,4 +254,6 @@
+ }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/rb_tree libstdc++-v3/include/ext/rb_tree
+--- libstdc++-v3-orig/include/ext/rb_tree 2004-11-24 05:11:13.000000000 +0100
++++ libstdc++-v3/include/ext/rb_tree 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // rb_tree extension -*- C++ -*-
+
+-// Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -62,6 +62,7 @@
+ #define _RB_TREE 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/stl_tree.h>
+
+@@ -94,4 +95,6 @@
+ };
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/rope libstdc++-v3/include/ext/rope
+--- libstdc++-v3-orig/include/ext/rope 2005-04-28 09:50:47.000000000 +0200
++++ libstdc++-v3/include/ext/rope 2005-05-20 11:30:03.000000000 +0200
+@@ -48,6 +48,8 @@
+ #ifndef _ROPE
+ #define _ROPE 1
+
++#pragma GCC visibility push(default)
++
+ #include <bits/stl_algobase.h>
+ #include <bits/stl_construct.h>
+ #include <bits/stl_uninitialized.h>
+@@ -2898,4 +2900,6 @@
+
+ # include <ext/ropeimpl.h>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/slist libstdc++-v3/include/ext/slist
+--- libstdc++-v3-orig/include/ext/slist 2005-01-31 17:21:50.000000000 +0100
++++ libstdc++-v3/include/ext/slist 2005-05-20 11:30:03.000000000 +0200
+@@ -49,6 +49,8 @@
+ #ifndef _SLIST
+ #define _SLIST 1
+
++#pragma GCC visibility push(default)
++
+ #include <bits/stl_algobase.h>
+ #include <bits/allocator.h>
+ #include <bits/stl_construct.h>
+@@ -1069,4 +1071,7 @@
+ };
+
+ } // namespace std
++
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/stdio_filebuf.h libstdc++-v3/include/ext/stdio_filebuf.h
+--- libstdc++-v3-orig/include/ext/stdio_filebuf.h 2004-11-23 10:18:39.000000000 +0100
++++ libstdc++-v3/include/ext/stdio_filebuf.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // File descriptor layer for filebuf -*- C++ -*-
+
+-// Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -35,6 +35,7 @@
+ #define _STDIO_FILEBUF_H 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <fstream>
+
+@@ -158,4 +159,6 @@
+ }
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/ext/stdio_sync_filebuf.h libstdc++-v3/include/ext/stdio_sync_filebuf.h
+--- libstdc++-v3-orig/include/ext/stdio_sync_filebuf.h 2004-11-23 10:18:39.000000000 +0100
++++ libstdc++-v3/include/ext/stdio_sync_filebuf.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Iostreams wrapper for stdio FILE* -*- C++ -*-
+
+-// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -35,6 +35,7 @@
+ #define _STDIO_SYNC_FILEBUF_H 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <streambuf>
+ #include <unistd.h>
+@@ -279,4 +280,6 @@
+ #endif
+ } // namespace __gnu_cxx
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/std/std_algorithm.h libstdc++-v3/include/std/std_algorithm.h
+--- libstdc++-v3-orig/include/std/std_algorithm.h 2004-11-24 05:11:14.000000000 +0100
++++ libstdc++-v3/include/std/std_algorithm.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <algorithm> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,10 +61,13 @@
+ #define _GLIBCXX_ALGORITHM 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/stl_algobase.h>
+ #include <bits/stl_construct.h>
+ #include <bits/stl_uninitialized.h>
+ #include <bits/stl_algo.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_ALGORITHM */
+diff -urN libstdc++-v3-orig/include/std/std_bitset.h libstdc++-v3/include/std/std_bitset.h
+--- libstdc++-v3-orig/include/std/std_bitset.h 2005-05-10 03:58:11.000000000 +0200
++++ libstdc++-v3/include/std/std_bitset.h 2005-05-20 11:30:03.000000000 +0200
+@@ -48,6 +48,7 @@
+ #define _GLIBCXX_BITSET 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <cstddef> // For size_t
+ #include <cstring> // For memset
+@@ -1300,4 +1301,6 @@
+ # include <debug/bitset>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_BITSET */
+diff -urN libstdc++-v3-orig/include/std/std_complex.h libstdc++-v3/include/std/std_complex.h
+--- libstdc++-v3-orig/include/std/std_complex.h 2005-03-16 00:38:54.000000000 +0100
++++ libstdc++-v3/include/std/std_complex.h 2005-05-20 11:30:03.000000000 +0200
+@@ -43,6 +43,7 @@
+ #define _GLIBCXX_COMPLEX 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <bits/cpp_type_traits.h>
+@@ -1483,4 +1484,6 @@
+ : _M_value(__z.__rep()) { }
+ } // namespace std
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_COMPLEX */
+diff -urN libstdc++-v3-orig/include/std/std_deque.h libstdc++-v3/include/std/std_deque.h
+--- libstdc++-v3-orig/include/std/std_deque.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_deque.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <deque> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_DEQUE 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/functexcept.h>
+ #include <bits/stl_algobase.h>
+@@ -77,4 +78,6 @@
+ # include <debug/deque>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_DEQUE */
+diff -urN libstdc++-v3-orig/include/std/std_fstream.h libstdc++-v3/include/std/std_fstream.h
+--- libstdc++-v3-orig/include/std/std_fstream.h 2005-03-07 17:58:41.000000000 +0100
++++ libstdc++-v3/include/std/std_fstream.h 2005-05-20 11:30:03.000000000 +0200
+@@ -40,6 +40,7 @@
+ #define _GLIBCXX_FSTREAM 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <istream>
+ #include <ostream>
+@@ -782,4 +783,6 @@
+ # include <bits/fstream.tcc>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_FSTREAM */
+diff -urN libstdc++-v3-orig/include/std/std_functional.h libstdc++-v3/include/std/std_functional.h
+--- libstdc++-v3-orig/include/std/std_functional.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_functional.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <functional> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -49,9 +49,12 @@
+ #define _GLIBCXX_FUNCTIONAL 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <cstddef>
+ #include <bits/stl_function.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_FUNCTIONAL */
+diff -urN libstdc++-v3-orig/include/std/std_iomanip.h libstdc++-v3/include/std/std_iomanip.h
+--- libstdc++-v3-orig/include/std/std_iomanip.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_iomanip.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Standard stream manipulators -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003
++// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -40,6 +40,7 @@
+ #define _GLIBCXX_IOMANIP 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <istream>
+@@ -296,4 +297,6 @@
+ #endif
+ } // namespace std
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_IOMANIP */
+diff -urN libstdc++-v3-orig/include/std/std_ios.h libstdc++-v3/include/std/std_ios.h
+--- libstdc++-v3-orig/include/std/std_ios.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_ios.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,7 @@
+ // Iostreams base classes -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -39,6 +40,7 @@
+ #define _GLIBCXX_IOS 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <iosfwd>
+ #include <exception> // For ios_base::failure
+@@ -49,4 +51,6 @@
+ #include <streambuf>
+ #include <bits/basic_ios.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_IOS */
+diff -urN libstdc++-v3-orig/include/std/std_iosfwd.h libstdc++-v3/include/std/std_iosfwd.h
+--- libstdc++-v3-orig/include/std/std_iosfwd.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_iosfwd.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Forwarding declarations -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003
++// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -40,6 +40,7 @@
+ #define _GLIBCXX_IOSFWD 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <bits/c++locale.h>
+@@ -164,4 +165,6 @@
+ /** @} */
+ } // namespace std
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_IOSFWD */
+diff -urN libstdc++-v3-orig/include/std/std_iostream.h libstdc++-v3/include/std/std_iostream.h
+--- libstdc++-v3-orig/include/std/std_iostream.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_iostream.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,7 @@
+ // Standard iostream objects -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -39,6 +40,7 @@
+ #define _GLIBCXX_IOSTREAM 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <ostream>
+@@ -76,4 +78,6 @@
+ static ios_base::Init __ioinit;
+ } // namespace std
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_IOSTREAM */
+diff -urN libstdc++-v3-orig/include/std/std_istream.h libstdc++-v3/include/std/std_istream.h
+--- libstdc++-v3-orig/include/std/std_istream.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_istream.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Input streams -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004
++// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -40,6 +40,7 @@
+ #define _GLIBCXX_ISTREAM 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <ios>
+ #include <limits> // For numeric_limits
+@@ -814,4 +815,6 @@
+ # include <bits/istream.tcc>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_ISTREAM */
+diff -urN libstdc++-v3-orig/include/std/std_iterator.h libstdc++-v3/include/std/std_iterator.h
+--- libstdc++-v3-orig/include/std/std_iterator.h 2004-11-24 05:11:15.000000000 +0100
++++ libstdc++-v3/include/std/std_iterator.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <iterator> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_ITERATOR 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <cstddef>
+@@ -72,4 +73,6 @@
+ #include <bits/stream_iterator.h>
+ #include <bits/streambuf_iterator.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_ITERATOR */
+diff -urN libstdc++-v3-orig/include/std/std_limits.h libstdc++-v3/include/std/std_limits.h
+--- libstdc++-v3-orig/include/std/std_limits.h 2005-02-01 02:00:39.000000000 +0100
++++ libstdc++-v3/include/std/std_limits.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,7 @@
+ // The template and inlines for the -*- C++ -*- numeric_limits classes.
+
+-// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -43,6 +44,7 @@
+ #define _GLIBCXX_NUMERIC_LIMITS 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+
+@@ -1156,4 +1158,6 @@
+ #undef __glibcxx_digits
+ #undef __glibcxx_digits10
+
++#pragma GCC visibility pop
++
+ #endif // _GLIBCXX_NUMERIC_LIMITS
+diff -urN libstdc++-v3-orig/include/std/std_list.h libstdc++-v3/include/std/std_list.h
+--- libstdc++-v3-orig/include/std/std_list.h 2004-11-24 05:11:16.000000000 +0100
++++ libstdc++-v3/include/std/std_list.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <list> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_LIST 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/functexcept.h>
+ #include <bits/stl_algobase.h>
+@@ -77,5 +78,7 @@
+ # include <debug/list>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_LIST */
+
+diff -urN libstdc++-v3-orig/include/std/std_locale.h libstdc++-v3/include/std/std_locale.h
+--- libstdc++-v3-orig/include/std/std_locale.h 2004-11-24 05:11:16.000000000 +0100
++++ libstdc++-v3/include/std/std_locale.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,7 @@
+ // Locale support -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
++// Copyright (C) 1997, 1998, 1999, 2002, 2003, 2005
++// Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -39,10 +40,13 @@
+ #define _GLIBCXX_LOCALE 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/localefwd.h>
+ #include <bits/locale_classes.h>
+ #include <bits/locale_facets.h>
+ #include <bits/locale_facets.tcc>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_LOCALE */
+diff -urN libstdc++-v3-orig/include/std/std_map.h libstdc++-v3/include/std/std_map.h
+--- libstdc++-v3-orig/include/std/std_map.h 2004-11-24 05:11:16.000000000 +0100
++++ libstdc++-v3/include/std/std_map.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <map> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_MAP 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/stl_tree.h>
+ #include <bits/stl_map.h>
+@@ -70,4 +71,6 @@
+ # include <debug/map>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_MAP */
+diff -urN libstdc++-v3-orig/include/std/std_memory.h libstdc++-v3/include/std/std_memory.h
+--- libstdc++-v3-orig/include/std/std_memory.h 2004-11-24 05:11:16.000000000 +0100
++++ libstdc++-v3/include/std/std_memory.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <memory> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -49,6 +49,7 @@
+ #define _GLIBCXX_MEMORY 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/stl_algobase.h>
+ #include <bits/allocator.h>
+@@ -370,4 +371,6 @@
+ };
+ } // namespace std
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_MEMORY */
+diff -urN libstdc++-v3-orig/include/std/std_numeric.h libstdc++-v3/include/std/std_numeric.h
+--- libstdc++-v3-orig/include/std/std_numeric.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_numeric.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <numeric> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_NUMERIC 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <cstddef>
+@@ -68,4 +69,6 @@
+ #include <bits/stl_function.h>
+ #include <bits/stl_numeric.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_NUMERIC */
+diff -urN libstdc++-v3-orig/include/std/std_ostream.h libstdc++-v3/include/std/std_ostream.h
+--- libstdc++-v3-orig/include/std/std_ostream.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_ostream.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Output streams -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -40,6 +40,7 @@
+ #define _GLIBCXX_OSTREAM 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <ios>
+
+@@ -544,4 +545,6 @@
+ # include <bits/ostream.tcc>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_OSTREAM */
+diff -urN libstdc++-v3-orig/include/std/std_queue.h libstdc++-v3/include/std/std_queue.h
+--- libstdc++-v3-orig/include/std/std_queue.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_queue.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <queue> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_QUEUE 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <bits/functexcept.h>
+@@ -74,4 +75,6 @@
+ #include <vector>
+ #include <bits/stl_queue.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_QUEUE */
+diff -urN libstdc++-v3-orig/include/std/std_set.h libstdc++-v3/include/std/std_set.h
+--- libstdc++-v3-orig/include/std/std_set.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_set.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <set> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,7 +61,8 @@
+ #define _GLIBCXX_SET 1
+
+ #pragma GCC system_header
+-
++#pragma GCC visibility push(default)
++
+ #include <bits/stl_tree.h>
+ #include <bits/stl_set.h>
+ #include <bits/stl_multiset.h>
+@@ -70,4 +71,6 @@
+ # include <debug/set>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_SET */
+diff -urN libstdc++-v3-orig/include/std/std_sstream.h libstdc++-v3/include/std/std_sstream.h
+--- libstdc++-v3-orig/include/std/std_sstream.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_sstream.h 2005-05-20 11:30:03.000000000 +0200
+@@ -40,6 +40,7 @@
+ #define _GLIBCXX_SSTREAM 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <istream>
+ #include <ostream>
+@@ -602,4 +603,6 @@
+ # include <bits/sstream.tcc>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_SSTREAM */
+diff -urN libstdc++-v3-orig/include/std/std_stack.h libstdc++-v3/include/std/std_stack.h
+--- libstdc++-v3-orig/include/std/std_stack.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_stack.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <stack> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_STACK 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/stl_algobase.h>
+ #include <bits/allocator.h>
+@@ -69,4 +70,6 @@
+ #include <deque>
+ #include <bits/stl_stack.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_STACK */
+diff -urN libstdc++-v3-orig/include/std/std_stdexcept.h libstdc++-v3/include/std/std_stdexcept.h
+--- libstdc++-v3-orig/include/std/std_stdexcept.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_stdexcept.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Standard exception classes -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -39,6 +39,7 @@
+ #define _GLIBCXX_STDEXCEPT 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <exception>
+ #include <string>
+@@ -144,4 +145,6 @@
+ };
+ } // namespace std
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_STDEXCEPT */
+diff -urN libstdc++-v3-orig/include/std/std_streambuf.h libstdc++-v3/include/std/std_streambuf.h
+--- libstdc++-v3-orig/include/std/std_streambuf.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_streambuf.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // Stream buffer classes -*- C++ -*-
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -40,6 +40,7 @@
+ #define _GLIBXX_STREAMBUF 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <iosfwd>
+@@ -797,4 +798,6 @@
+ # include <bits/streambuf.tcc>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_STREAMBUF */
+diff -urN libstdc++-v3-orig/include/std/std_string.h libstdc++-v3/include/std/std_string.h
+--- libstdc++-v3-orig/include/std/std_string.h 2005-01-31 17:21:52.000000000 +0100
++++ libstdc++-v3/include/std/std_string.h 2005-05-20 11:30:03.000000000 +0200
+@@ -40,6 +40,7 @@
+ #define _GLIBCXX_STRING 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <bits/stringfwd.h>
+@@ -56,4 +57,6 @@
+ # include <bits/basic_string.tcc>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_STRING */
+diff -urN libstdc++-v3-orig/include/std/std_utility.h libstdc++-v3/include/std/std_utility.h
+--- libstdc++-v3-orig/include/std/std_utility.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_utility.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <utility> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,9 +61,12 @@
+ #define _GLIBCXX_UTILITY 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <bits/stl_relops.h>
+ #include <bits/stl_pair.h>
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_UTILITY */
+diff -urN libstdc++-v3-orig/include/std/std_valarray.h libstdc++-v3/include/std/std_valarray.h
+--- libstdc++-v3-orig/include/std/std_valarray.h 2004-11-24 05:11:21.000000000 +0100
++++ libstdc++-v3/include/std/std_valarray.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // The template and inlines for the -*- C++ -*- valarray class.
+
+-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005
+ // Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+@@ -38,6 +38,7 @@
+ #define _GLIBCXX_VALARRAY 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/c++config.h>
+ #include <cstddef>
+@@ -1007,4 +1008,6 @@
+
+ } // namespace std
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_VALARRAY */
+diff -urN libstdc++-v3-orig/include/std/std_vector.h libstdc++-v3/include/std/std_vector.h
+--- libstdc++-v3-orig/include/std/std_vector.h 2004-11-24 05:11:22.000000000 +0100
++++ libstdc++-v3/include/std/std_vector.h 2005-05-20 11:30:03.000000000 +0200
+@@ -1,6 +1,6 @@
+ // <vector> -*- C++ -*-
+
+-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+@@ -61,6 +61,7 @@
+ #define _GLIBCXX_VECTOR 1
+
+ #pragma GCC system_header
++#pragma GCC visibility push(default)
+
+ #include <bits/functexcept.h>
+ #include <bits/stl_algobase.h>
+@@ -78,5 +79,7 @@
+ # include <debug/vector>
+ #endif
+
++#pragma GCC visibility pop
++
+ #endif /* _GLIBCXX_VECTOR */
+
+diff -urN libstdc++-v3-orig/include/tr1/array libstdc++-v3/include/tr1/array
+--- libstdc++-v3-orig/include/tr1/array 2004-11-23 10:18:41.000000000 +0100
++++ libstdc++-v3/include/tr1/array 2005-05-20 11:30:03.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef _ARRAY
+ #define _ARRAY 1
+
++#pragma GCC visibility push(default)
++
+ #include <new>
+ #include <iterator>
+ #include <algorithm>
+@@ -202,4 +204,6 @@
+ } // namespace std::tr1
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/tr1/functional libstdc++-v3/include/tr1/functional
+--- libstdc++-v3-orig/include/tr1/functional 2005-04-02 04:02:28.000000000 +0200
++++ libstdc++-v3/include/tr1/functional 2005-05-20 11:30:03.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef _TR1_FUNCTIONAL
+ #define _TR1_FUNCTIONAL 1
+
++#pragma GCC visibility push(default)
++
+ #include "../functional"
+ #include <typeinfo>
+ #include <tr1/type_traits>
+@@ -1161,4 +1163,6 @@
+ }
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/tr1/memory libstdc++-v3/include/tr1/memory
+--- libstdc++-v3-orig/include/tr1/memory 2005-04-05 13:08:53.000000000 +0200
++++ libstdc++-v3/include/tr1/memory 2005-05-20 11:34:03.000000000 +0200
+@@ -30,6 +30,8 @@
+ #ifndef _TR1_MEMORY
+ #define _TR1_MEMORY 1
+
++#pragma GCC visibility push(default)
++
+ #include "../memory"
+ #include <functional> // std::less
+ #include <exception> // std::exception
+@@ -48,4 +50,6 @@
+
+ #include <tr1/boost_shared_ptr.h>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/tr1/tuple libstdc++-v3/include/tr1/tuple
+--- libstdc++-v3-orig/include/tr1/tuple 2005-04-01 05:35:58.000000000 +0200
++++ libstdc++-v3/include/tr1/tuple 2005-05-20 11:30:03.000000000 +0200
+@@ -36,6 +36,8 @@
+ #ifndef _TUPLE
+ #define _TUPLE 1
+
++#pragma GCC visibility push(default)
++
+ #include <tr1/utility>
+ #include <tr1/ref_fwd.h>
+
+@@ -272,4 +274,6 @@
+
+ #include <tr1/functional>
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/tr1/type_traits libstdc++-v3/include/tr1/type_traits
+--- libstdc++-v3-orig/include/tr1/type_traits 2005-04-29 00:35:09.000000000 +0200
++++ libstdc++-v3/include/tr1/type_traits 2005-05-20 11:30:03.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef _TYPE_TRAITS
+ #define _TYPE_TRAITS 1
+
++#pragma GCC visibility push(default)
++
+ #include <bits/c++config.h>
+ #include <tr1/type_traits_fwd.h>
+
+@@ -703,4 +705,6 @@
+ }
+ }
+
++#pragma GCC visibility pop
++
+ #endif
+diff -urN libstdc++-v3-orig/include/tr1/unordered_map libstdc++-v3/include/tr1/unordered_map
+--- libstdc++-v3-orig/include/tr1/unordered_map 2005-02-22 18:07:07.000000000 +0100
++++ libstdc++-v3/include/tr1/unordered_map 2005-05-20 11:34:50.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef GNU_LIBSTDCXX_TR1_UNORDERED_MAP_
+ #define GNU_LIBSTDCXX_TR1_UNORDERED_MAP_
+
++#pragma GCC visibility push(default)
++
+ #include <tr1/hashtable>
+ #include <tr1/functional>
+ #include <tr1/functional>
+@@ -163,4 +165,6 @@
+
+ } }
+
++#pragma GCC visibility pop
++
+ #endif /* GNU_LIBSTDCXX_TR1_UNORDERED_MAP_ */
+diff -urN libstdc++-v3-orig/include/tr1/unordered_set libstdc++-v3/include/tr1/unordered_set
+--- libstdc++-v3-orig/include/tr1/unordered_set 2005-02-22 18:07:07.000000000 +0100
++++ libstdc++-v3/include/tr1/unordered_set 2005-05-20 11:35:14.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef GNU_LIBSTDCXX_TR1_UNORDERED_SET_
+ #define GNU_LIBSTDCXX_TR1_UNORDERED_SET_
+
++#pragma GCC visibility push(default)
++
+ #include <tr1/hashtable>
+ #include <tr1/functional>
+ #include <memory>
+@@ -157,4 +159,6 @@
+
+ } }
+
++#pragma GCC visibility pop
++
+ #endif /* GNU_LIBSTDCXX_TR1_UNORDERED_SET_ */
+diff -urN libstdc++-v3-orig/include/tr1/utility libstdc++-v3/include/tr1/utility
+--- libstdc++-v3-orig/include/tr1/utility 2005-02-22 18:07:07.000000000 +0100
++++ libstdc++-v3/include/tr1/utility 2005-05-20 11:30:03.000000000 +0200
+@@ -34,6 +34,8 @@
+ #ifndef _TR1_UTILITY
+ #define _TR1_UTILITY 1
+
++#pragma GCC visibility push(default)
++
+ #include "../utility"
+
+ namespace std
+@@ -93,6 +95,8 @@
+ get(const pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__const_get(__in); }
+ }
+-}
++}
++
++#pragma GCC visibility pop
+
+ #endif
+diff -urN libstdc++-v3-orig/testsuite/20_util/memory/auto_ptr/assign_neg.cc libstdc++-v3/testsuite/20_util/memory/auto_ptr/assign_neg.cc
+--- libstdc++-v3-orig/testsuite/20_util/memory/auto_ptr/assign_neg.cc 2004-11-24 05:11:23.000000000 +0100
++++ libstdc++-v3/testsuite/20_util/memory/auto_ptr/assign_neg.cc 2005-05-20 11:48:10.000000000 +0200
+@@ -46,5 +46,5 @@
+ test01();
+ return 0;
+ }
+-// { dg-error "candidates" "" { target *-*-* } 223 }
+-// { dg-error "std::auto_ptr" "" { target *-*-* } 353 }
++// { dg-error "candidates" "" { target *-*-* } 224 }
++// { dg-error "std::auto_ptr" "" { target *-*-* } 354 }
diff --git a/4.0.4/gentoo/32_all_gcc4-pr20815.patch b/4.0.4/gentoo/32_all_gcc4-pr20815.patch
new file mode 100644
index 0000000..2753d8e
--- /dev/null
+++ b/4.0.4/gentoo/32_all_gcc4-pr20815.patch
@@ -0,0 +1,97 @@
+From: Jan Hubicka <jh at suse dot cz>
+To: gcc-patches at gcc dot gnu dot org
+Date: Sun, 30 Oct 2005 17:47:39 +0100
+Subject: PR profile/28015 (invalid checksum wrt random seed)
+
+Hi,
+the problem in testcase is checksum differ because of random seed.
+coverage.c already has some logic to strip down random sseds but
+obviously it is not enought for C++. This patch improve it somewhat. I
+am still unsure if it works enought, but fixes testcase (that uses io so
+it is not bet for testsuite), so I will commit it if there are no
+complains till tomorrow.
+
+profiledbootstrapped i686-pc-gnu-linux, bootstrapped/regtested
+x86_64-linux
+Honza
+
+2005-10-30 Jan Hubicka <jh@suse.cz>
+ PR profile/20815
+ * coverage.c (coverage_checksum_string): Fix code to stip random seeds
+ from symbol names while computing checkup.
+
+Index: coverage.c
+===================================================================
+--- gcc/coverage.c (revision 106013)
++++ gcc/coverage.c (working copy)
+@@ -445,36 +445,42 @@ coverage_checksum_string (unsigned chksu
+ as the checksums are used only for sanity checking. */
+ for (i = 0; string[i]; i++)
+ {
++ int offset = 0;
++ if (!strncmp (string + i, "_GLOBAL__N_", 11))
++ offset = 11;
+ if (!strncmp (string + i, "_GLOBAL__", 9))
+- for (i = i + 9; string[i]; i++)
+- if (string[i]=='_')
+- {
+- int y;
+- unsigned seed;
+- int scan;
++ offset = 9;
+
+- for (y = 1; y < 9; y++)
+- if (!(string[i + y] >= '0' && string[i + y] <= '9')
+- && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
+- break;
+- if (y != 9 || string[i + 9] != '_')
+- continue;
+- for (y = 10; y < 18; y++)
+- if (!(string[i + y] >= '0' && string[i + y] <= '9')
+- && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
+- break;
+- if (y != 18)
+- continue;
+- scan = sscanf (string + i + 10, "%X", &seed);
+- gcc_assert (scan);
+- if (seed != crc32_string (0, flag_random_seed))
+- continue;
+- string = dup = xstrdup (string);
+- for (y = 10; y < 18; y++)
+- dup[i + y] = '0';
+- break;
+- }
+- break;
++ /* C++ namespaces do have scheme:
++ _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname
++ since filename might contain extra underscores there seems
++ to be no better chance then walk all possible offsets looking
++ for magicnuber. */
++ if (offset)
++ for (;string[offset]; offset++)
++ for (i = i + offset; string[i]; i++)
++ if (string[i]=='_')
++ {
++ int y;
++
++ for (y = 1; y < 9; y++)
++ if (!(string[i + y] >= '0' && string[i + y] <= '9')
++ && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
++ break;
++ if (y != 9 || string[i + 9] != '_')
++ continue;
++ for (y = 10; y < 18; y++)
++ if (!(string[i + y] >= '0' && string[i + y] <= '9')
++ && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
++ break;
++ if (y != 18)
++ continue;
++ if (!dup)
++ string = dup = xstrdup (string);
++ for (y = 10; y < 18; y++)
++ dup[i + y] = '0';
++ }
++ break;
+ }
+
+ chksum = crc32_string (chksum, string);
diff --git a/4.0.4/gentoo/34_all_arm-bigendian.patch b/4.0.4/gentoo/34_all_arm-bigendian.patch
new file mode 100644
index 0000000..307aea3
--- /dev/null
+++ b/4.0.4/gentoo/34_all_arm-bigendian.patch
@@ -0,0 +1,67 @@
+By Lennert Buytenhek <buytenh@wantstofly.org>
+Adds support for arm*b-linux* big-endian ARM targets
+
+See http://gcc.gnu.org/PR16350
+
+--- gcc-4.0.3/gcc/config/arm/linux-elf.h
++++ gcc-4.0.3/gcc/config/arm/linux-elf.h
+@@ -31,19 +31,33 @@
+ /* Do not assume anything about header files. */
+ #define NO_IMPLICIT_EXTERN_C
+
++/*
++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
++ * (big endian) configurations.
++ */
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
++#define TARGET_ENDIAN_OPTION "mbig-endian"
++#define TARGET_LINKER_EMULATION "armelfb_linux"
++#else
++#define TARGET_ENDIAN_DEFAULT 0
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#define TARGET_LINKER_EMULATION "armelf_linux"
++#endif
++
+ #undef TARGET_DEFAULT_FLOAT_ABI
+ #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
+
+ #undef TARGET_DEFAULT
+-#define TARGET_DEFAULT (0)
++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
+
+ #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
+
+-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
+
+ #undef MULTILIB_DEFAULTS
+ #define MULTILIB_DEFAULTS \
+- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
+
+ /* The GNU C++ standard library requires that these macros be defined. */
+ #undef CPLUSPLUS_CPP_SPEC
+@@ -90,7 +104,7 @@
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
+ -X \
+- %{mbig-endian:-EB}" \
++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
+ SUBTARGET_EXTRA_LINK_SPEC
+
+ #define TARGET_OS_CPP_BUILTINS() \
+--- gcc-4.0.3/gcc/config.gcc
++++ gcc-4.0.3/gcc/config.gcc
+@@ -672,6 +672,11 @@
+ ;;
+ arm*-*-linux*) # ARM GNU/Linux with ELF
+ tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
++ case $target in
++ arm*b-*)
++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
++ ;;
++ esac
+ tmake_file="${tmake_file} arm/t-arm arm/t-linux"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ gnu_ld=yes
diff --git a/4.0.4/gentoo/34_all_gcc4-pr22889.patch b/4.0.4/gentoo/34_all_gcc4-pr22889.patch
new file mode 100644
index 0000000..7de3228
--- /dev/null
+++ b/4.0.4/gentoo/34_all_gcc4-pr22889.patch
@@ -0,0 +1,49 @@
+GTK code in gcj requires pango even in non-cairo code
+
+http://bugs.gentoo.org/110002
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22889
+
+--- libjava/configure.ac
++++ libjava/configure.ac
+@@ -550,10 +550,10 @@
+ if test "x${enable_gtk_cairo}" = xyes
+ then
+ PKG_CHECK_MODULES(CAIRO, cairo)
+- PKG_CHECK_MODULES(PANGOFT2, pangoft2)
+ fi
+ AC_SUBST(CAIRO_LIBS)
+ AC_SUBST(CAIRO_CFLAGS)
++PKG_CHECK_MODULES(PANGOFT2, pangoft2)
+ AC_SUBST(PANGOFT2_LIBS)
+ AC_SUBST(PANGOFT2_CFLAGS)
+
+--- libjava/configure
++++ libjava/configure
+@@ -8095,10 +8096,13 @@
+ { { echo "$as_me:$LINENO: error: Library requirements (cairo) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+ echo "$as_me: error: Library requirements (cairo) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
++fi
++
++
+
+ succeeded=no
+
+ if test -z "$PKG_CONFIG"; then
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+@@ -8193,13 +8197,10 @@
+ { { echo "$as_me:$LINENO: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+ echo "$as_me: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+-fi
+-
+-
+
+
+
+ # FIXME: this should be _libs on some hosts.
+ libsubdir=.libs
diff --git a/4.0.4/gentoo/36_all_gcc41-pr19664.patch b/4.0.4/gentoo/36_all_gcc41-pr19664.patch
new file mode 100644
index 0000000..93fe49e
--- /dev/null
+++ b/4.0.4/gentoo/36_all_gcc41-pr19664.patch
@@ -0,0 +1,23 @@
+2005-05-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR C++/19664
+ * decl2.c (determine_visibility): Don't set visibility to
+ hidden if it has been set explicitly by user.
+
+--- gcc/cp/decl2.c 2005-12-16 21:16:25.000000000 -0500
++++ gcc/cp/decl2.c 2005-12-16 21:21:07.000000000 -0500
+@@ -1650,8 +1650,12 @@
+ && DECL_DECLARED_INLINE_P (decl)
+ && visibility_options.inlines_hidden)
+ {
+- DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
+- DECL_VISIBILITY_SPECIFIED (decl) = 1;
++ /* Don't change it if it has been set explicitly by user. */
++ if (!DECL_VISIBILITY_SPECIFIED (decl))
++ {
++ DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
++ DECL_VISIBILITY_SPECIFIED (decl) = 1;
++ }
+ }
+ else if (CLASSTYPE_VISIBILITY_SPECIFIED (class_type))
+ {
diff --git a/4.0.4/gentoo/37_all_gcc42-boehmgc-include.patch b/4.0.4/gentoo/37_all_gcc42-boehmgc-include.patch
new file mode 100644
index 0000000..2b1839c
--- /dev/null
+++ b/4.0.4/gentoo/37_all_gcc42-boehmgc-include.patch
@@ -0,0 +1,142 @@
+--- libobjc/configure 2006-03-14 00:51:43.000000000 -0500
++++ libobjc/configure 2006-03-14 00:56:08.000000000 -0500
+@@ -309,7 +309,7 @@
+ # include <unistd.h>
+ #endif"
+
+-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION OBJC_BOEHM_GC toplevel_srcdir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical glibcpp_srcdir gcc_version_trigger gcc_version_full gcc_version toolexecdir toolexeclibdir includedirname libext CC ac_ct_CC EXEEXT OBJEXT CFLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LN_S STRIP ac_ct_STRIP LIBTOOL SET_MAKE CPP CPPFLAGS EGREP GTHREAD_FLAGS LIBOBJS LTLIBOBJS'
++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION OBJC_BOEHM_GC OBJC_BOEHM_GC_INCLUDES toplevel_srcdir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical glibcpp_srcdir gcc_version_trigger gcc_version_full gcc_version toolexecdir toolexeclibdir includedirname libext CC ac_ct_CC EXEEXT OBJEXT CFLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LN_S STRIP ac_ct_STRIP LIBTOOL SET_MAKE CPP CPPFLAGS EGREP GTHREAD_FLAGS LIBOBJS LTLIBOBJS'
+ ac_subst_files=''
+
+ # Initialize some variables set by options.
+@@ -719,13 +719,13 @@
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+- if test ! -r $srcdir/$ac_unique_file; then
++ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+ else
+ ac_srcdir_defaulted=no
+ fi
+-if test ! -r $srcdir/$ac_unique_file; then
++if test ! -r "$srcdir/$ac_unique_file"; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+@@ -734,7 +734,7 @@
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
++(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+ srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+@@ -1383,14 +1383,21 @@
+ if test "${enable_objc_gc+set}" = set; then
+ enableval="$enable_objc_gc"
+ case $enable_objc_gc in
+- no) OBJC_BOEHM_GC='' ;;
+- *) OBJC_BOEHM_GC=libobjc_gc.la ;;
++ no)
++ OBJC_BOEHM_GC=''
++ OBJC_BOEHM_GC_INCLUDES=''
++ ;;
++ *)
++ OBJC_BOEHM_GC=libobjc_gc.la
++ OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
++ ;;
+ esac
+ else
+- OBJC_BOEHM_GC=''
++ OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''
+ fi;
+
+
++
+ # -----------
+ # Directories
+ # -----------
+@@ -3675,7 +3682,7 @@
+ case $host in
+ *-*-irix6*)
+ # Find out which ABI we are using.
+- echo '#line 3678 "configure"' > conftest.$ac_ext
++ echo '#line 3685 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+@@ -5110,7 +5117,7 @@
+ :
+ else
+ cat > conftest.$ac_ext << EOF
+-#line 5113 "configure"
++#line 5120 "configure"
+ @interface Frob
+ @end
+ @implementation Frob
+@@ -5816,6 +5823,7 @@
+ s,@LIBS@,$LIBS,;t t
+ s,@VERSION@,$VERSION,;t t
+ s,@OBJC_BOEHM_GC@,$OBJC_BOEHM_GC,;t t
++s,@OBJC_BOEHM_GC_INCLUDES@,$OBJC_BOEHM_GC_INCLUDES,;t t
+ s,@toplevel_srcdir@,$toplevel_srcdir,;t t
+ s,@build@,$build,;t t
+ s,@build_cpu@,$build_cpu,;t t
+--- libobjc/configure.ac 2006-03-14 00:51:43.000000000 -0500
++++ libobjc/configure.ac 2006-03-14 00:56:02.000000000 -0500
+@@ -1,6 +1,6 @@
+ # Process this file with autoconf to produce a configure script.
+ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
+-# Free Software Foundation, Inc.
++# 2005, 2006 Free Software Foundation, Inc.
+ # Originally contributed by Dave Love (d.love@dl.ac.uk).
+ #
+ #This file is part of GCC.
+@@ -72,11 +72,18 @@
+ [ --enable-objc-gc enable the use of Boehm's garbage collector with
+ the GNU Objective-C runtime.],
+ [case $enable_objc_gc in
+- no) OBJC_BOEHM_GC='' ;;
+- *) OBJC_BOEHM_GC=libobjc_gc.la ;;
++ no)
++ OBJC_BOEHM_GC=''
++ OBJC_BOEHM_GC_INCLUDES=''
++ ;;
++ *)
++ OBJC_BOEHM_GC=libobjc_gc.la
++ OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
++ ;;
+ esac],
+-[OBJC_BOEHM_GC=''])
++[OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
+ AC_SUBST(OBJC_BOEHM_GC)
++AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
+
+ # -----------
+ # Directories
+--- libobjc/Makefile.in 2006-03-14 00:51:43.000000000 -0500
++++ libobjc/Makefile.in 2006-03-14 00:56:02.000000000 -0500
+@@ -89,13 +89,16 @@
+ LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean
+ #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
+
+-INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
+- -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
+- -I$(srcdir)/$(MULTISRCTOP)../include
+-
+ OBJC_GCFLAGS=-DOBJC_WITH_GC=1
+ OBJC_THREAD_FILE=thr-objc
+ OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
++OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
++
++INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
++ -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
++ -I$(srcdir)/$(MULTISRCTOP)../include \
++ $(OBJC_BOEHM_GC_INCLUDES)
++
+
+ .SUFFIXES:
+ .SUFFIXES: .c .m .lo
diff --git a/4.0.4/gentoo/51_all_gcc-3.4-libiberty-pic.patch b/4.0.4/gentoo/51_all_gcc-3.4-libiberty-pic.patch
new file mode 100644
index 0000000..c210b7c
--- /dev/null
+++ b/4.0.4/gentoo/51_all_gcc-3.4-libiberty-pic.patch
@@ -0,0 +1,10 @@
+--- libiberty/Makefile.in
++++ libiberty/Makefile.in
+@@ -225,6 +225,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/4.0.4/gentoo/54_all_300-libstdc++-pic.patch b/4.0.4/gentoo/54_all_300-libstdc++-pic.patch
new file mode 100644
index 0000000..3b3c56d
--- /dev/null
+++ b/4.0.4/gentoo/54_all_300-libstdc++-pic.patch
@@ -0,0 +1,53 @@
+# DP: Build and install libstdc++_pic.a library.
+
+--- gcc/libstdc++-v3/src/Makefile.am
++++ gcc/libstdc++-v3/src/Makefile.am
+@@ -214,6 +214,13 @@
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+
+
++install-exec-local:
++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \
++ if [ x"$$pic_objs" != x ]; then \
++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \
++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \
++ fi
++
+ # Added bits to build debug library.
+ if GLIBCXX_BUILD_DEBUG
+ all-local: build_debug
+--- gcc/libstdc++-v3/src/Makefile.in
++++ gcc/libstdc++-v3/src/Makefile.in
+@@ -625,7 +625,7 @@
+
+ install-data-am: install-data-local
+
+-install-exec-am: install-toolexeclibLTLIBRARIES
++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
+
+ install-info: install-info-am
+
+@@ -664,7 +664,7 @@
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+- uninstall-toolexeclibLTLIBRARIES
++ uninstall-toolexeclibLTLIBRARIES install-exec-local
+
+ @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
+ @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
+@@ -743,6 +743,14 @@
+ install_debug:
+ (cd ${debugdir} && $(MAKE) \
+ toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
++
++install-exec-local:
++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \
++ if [ x"$$pic_objs" != x ]; then \
++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \
++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \
++ fi
++
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
diff --git a/4.0.4/gentoo/61_all_gcc4-ia64-noteGNUstack.patch b/4.0.4/gentoo/61_all_gcc4-ia64-noteGNUstack.patch
new file mode 100644
index 0000000..17cc7ef
--- /dev/null
+++ b/4.0.4/gentoo/61_all_gcc4-ia64-noteGNUstack.patch
@@ -0,0 +1,88 @@
+2004-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
+ on ppc64-linux.
+
+ * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on
+ ia64-linux.
+ * config/ia64/crtbegin.asm: Likewise.
+ * config/ia64/crtend.asm: Likewise.
+ * config/ia64/crti.asm: Likewise.
+ * config/ia64/crtn.asm: Likewise.
+
+2004-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ * config/ia64/linux.h (TARGET_ASM_FILE_END): Define.
+
+--- gcc/config/ia64/linux.h.jj 2004-05-14 07:21:27.000000000 -0400
++++ gcc/config/ia64/linux.h 2004-05-14 09:21:09.000000000 -0400
+@@ -5,6 +5,8 @@
+
+ #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux");
+
++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #undef CC1_SPEC
+ #define CC1_SPEC "%{profile:-p} %{G*}"
+--- gcc/config/rs6000/ppc-asm.h.jj 2003-06-04 18:40:59.000000000 +0200
++++ gcc/config/rs6000/ppc-asm.h 2004-09-20 14:17:47.259396058 +0200
+@@ -158,7 +158,7 @@ GLUE(.L,name): \
+ .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
+ #endif
+
+-#if defined __linux__ && !defined __powerpc64__
++#if defined __linux__
+ .section .note.GNU-stack
+ .previous
+ #endif
+--- gcc/config/ia64/lib1funcs.asm.jj 2003-10-27 11:45:17.000000000 +0100
++++ gcc/config/ia64/lib1funcs.asm 2004-09-20 14:26:28.094132706 +0200
+@@ -741,3 +741,7 @@ __floattitf:
+ .endp __floattitf
+
+ #endif
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- gcc/config/ia64/crtend.asm.jj 2004-05-20 14:36:14.000000000 +0200
++++ gcc/config/ia64/crtend.asm 2004-09-20 14:25:57.329580329 +0200
+@@ -113,3 +113,7 @@ __do_global_ctors_aux:
+
+ br.ret.sptk.many rp
+ .endp __do_global_ctors_aux
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- gcc/config/ia64/crti.asm.jj 2003-04-02 17:14:15.000000000 +0200
++++ gcc/config/ia64/crti.asm 2004-09-20 14:26:06.852894092 +0200
+@@ -64,3 +64,7 @@ _fini:
+ .body
+
+ # end of crti.asm
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- gcc/config/ia64/crtbegin.asm.jj 2004-05-20 14:36:14.000000000 +0200
++++ gcc/config/ia64/crtbegin.asm 2004-09-20 14:25:47.105390566 +0200
+@@ -246,3 +246,7 @@ __do_jv_register_classes:
+ .weak __cxa_finalize
+ #endif
+ .weak _Jv_RegisterClasses
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- gcc/config/ia64/crtn.asm.jj 2003-04-02 17:14:15.000000000 +0200
++++ gcc/config/ia64/crtn.asm 2004-09-20 14:26:16.381206878 +0200
+@@ -54,3 +54,7 @@
+ br.ret.sptk.many b0
+
+ # end of crtn.asm
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
diff --git a/4.0.4/gentoo/62_all_gcc4-noteGNUstack.patch b/4.0.4/gentoo/62_all_gcc4-noteGNUstack.patch
new file mode 100644
index 0000000..bbc38b9
--- /dev/null
+++ b/4.0.4/gentoo/62_all_gcc4-noteGNUstack.patch
@@ -0,0 +1,182 @@
+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.
+
+--- libffi/src/alpha/osf.S.jj 2003-10-23 09:55:21.000000000 +0200
++++ libffi/src/alpha/osf.S 2005-02-08 16:12:40.215425842 +0100
+@@ -352,4 +352,8 @@ $LASFDE3:
+ .byte 0x12 # uleb128 0x12
+ .align 3
+ $LEFDE3:
++
++#ifdef __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+ #endif
+--- libffi/src/s390/sysv.S.jj 2003-10-23 09:55:21.000000000 +0200
++++ libffi/src/s390/sysv.S 2005-02-08 16:22:30.810943388 +0100
+@@ -427,3 +427,6 @@ ffi_closure_SYSV:
+
+ #endif
+
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/powerpc/linux64.S.jj 2004-09-03 12:35:54.000000000 +0200
++++ libffi/src/powerpc/linux64.S 2005-02-08 16:18:41.998808639 +0100
+@@ -174,3 +174,7 @@ ffi_call_LINUX64:
+ .align 3
+ .LEFDE1:
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/powerpc/linux64_closure.S.jj 2004-09-03 12:35:54.000000000 +0200
++++ libffi/src/powerpc/linux64_closure.S 2005-02-08 16:18:53.821697060 +0100
+@@ -203,3 +203,7 @@ ffi_closure_LINUX64:
+ .align 3
+ .LEFDE1:
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/powerpc/ppc_closure.S.jj 2004-09-03 12:35:54.000000000 +0200
++++ libffi/src/powerpc/ppc_closure.S 2005-02-08 16:18:25.734713428 +0100
+@@ -248,3 +248,7 @@ END(ffi_closure_SYSV)
+ .LEFDE1:
+
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/powerpc/sysv.S.jj 2004-09-03 12:35:54.000000000 +0200
++++ libffi/src/powerpc/sysv.S 2005-02-08 16:18:13.673867518 +0100
+@@ -187,3 +187,7 @@ END(ffi_call_SYSV)
+ .align 2
+ .LEFDE1:
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/x86/unix64.S.jj 2004-12-27 13:01:37.000000000 +0100
++++ libffi/src/x86/unix64.S 2005-02-08 16:25:38.656395947 +0100
+@@ -373,3 +373,7 @@ ffi_closure_unix64:
+ .LEFDE3:
+
+ #endif /* __x86_64__ */
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/x86/sysv.S.jj 2003-10-23 09:55:21.000000000 +0200
++++ libffi/src/x86/sysv.S 2005-02-08 16:25:28.197263821 +0100
+@@ -182,3 +182,7 @@ epilogue:
+ .LEFDE1:
+
+ #endif /* ifndef __x86_64__ */
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/sparc/v8.S.jj 2004-11-24 22:02:00.000000000 +0100
++++ libffi/src/sparc/v8.S 2005-02-08 16:22:55.220583988 +0100
+@@ -265,3 +265,7 @@ done2:
+ .byte 0x1f ! uleb128 0x1f
+ .align WS
+ .LLEFDE2:
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/sparc/v9.S.jj 2004-01-26 11:34:57.000000000 +0100
++++ libffi/src/sparc/v9.S 2005-02-08 16:25:12.153129117 +0100
+@@ -300,3 +300,7 @@ longdouble1:
+ .align 8
+ .LLEFDE2:
+ #endif
++
++#ifdef __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- libffi/src/m68k/sysv.S.jj 2003-10-23 09:55:21.000000000 +0200
++++ libffi/src/m68k/sysv.S 2005-02-08 16:16:18.341466343 +0100
+@@ -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
+--- libffi/src/ia64/unix.S.jj 2005-01-04 15:42:01.000000000 +0100
++++ libffi/src/ia64/unix.S 2005-02-08 16:16:01.253518356 +0100
+@@ -572,3 +572,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
+--- libffi/src/arm/sysv.S.jj 2004-10-28 15:10:11.000000000 +0200
++++ libffi/src/arm/sysv.S 2005-02-08 16:14:02.282767581 +0100
+@@ -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
+--- boehm-gc/ia64_save_regs_in_stack.S.jj 2005-02-08 16:32:57.368040486 +0100
++++ boehm-gc/ia64_save_regs_in_stack.S 2005-02-08 16:33:36.243096641 +0100
+@@ -0,0 +1,15 @@
++ .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
++
++#ifdef __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+--- boehm-gc/ia64_save_regs_in_stack.s.jj 2004-06-30 09:32:52.000000000 +0200
++++ boehm-gc/ia64_save_regs_in_stack.s 2005-02-08 16:32:51.555078799 +0100
+@@ -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
+-
diff --git a/4.0.4/gentoo/74_all_sh-pr24836.patch b/4.0.4/gentoo/74_all_sh-pr24836.patch
new file mode 100644
index 0000000..871c520
--- /dev/null
+++ b/4.0.4/gentoo/74_all_sh-pr24836.patch
@@ -0,0 +1,16 @@
+http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
+
+Index: gcc-4_0-branch/gcc/configure.ac
+===================================================================
+--- gcc/configure.ac (revision 106699)
++++ gcc/configure.ac (working copy)
+@@ -2446,7 +2446,7 @@
+ 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/4.0.4/gentoo/85_all_gcc-ca-translation-typo.patch b/4.0.4/gentoo/85_all_gcc-ca-translation-typo.patch
new file mode 100644
index 0000000..d226799
--- /dev/null
+++ b/4.0.4/gentoo/85_all_gcc-ca-translation-typo.patch
@@ -0,0 +1,17 @@
+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-4_0-branch/gcc/po/ca.po
++++ gcc-4_0-branch/gcc/po/ca.po
+@@ -16697,7 +16697,7 @@ msgstr "passant el valor negatiu `%E' pe
+ #: cp/call.c:4189
+ #, fuzzy, gcc-internal-format
+ msgid "converting negative value %qE to %qT"
+-msgstr "%s de valor negatiu `%I' a \"%T\""
++msgstr "%s de valor negatiu `%E' a \"%T\""
+
+ #: cp/call.c:4331
+ #, fuzzy, gcc-internal-format
diff --git a/4.0.4/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch b/4.0.4/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch
new file mode 100644
index 0000000..9ac5239
--- /dev/null
+++ b/4.0.4/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch
@@ -0,0 +1,11 @@
+--- gcc-3.4.3/gcc/gcc.c.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/gcc.c Mon Nov 22 21:18:06 2004
+@@ -768,7 +768,7 @@
+ /* NB: This is shared amongst all front-ends. */
+ static const char *cc1_options =
+ "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
+- %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}}\
++ %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic|nopie:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic|nopie are incompatible}}\
+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}\
+ %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
+ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
diff --git a/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-no.patch b/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-no.patch
new file mode 100644
index 0000000..c54a3a0
--- /dev/null
+++ b/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-no.patch
@@ -0,0 +1,14 @@
+--- gcc/gcc/gcc.c.piedef~ 2005-03-01 17:18:15 +0100
++++ gcc/gcc/gcc.c 2005-03-01 17:19:59 +0100
+@@ -724,7 +733,11 @@
+
+ static const char *asm_debug;
+ static const char *cpp_spec = CPP_SPEC;
++#ifdef HARDENED_CC1_SPEC_SUFFIX
++static const char *cc1_spec = CC1_SPEC " " HARDENED_CC1_SPEC_SUFFIX;
++#else
+ static const char *cc1_spec = CC1_SPEC;
++#endif
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *asm_spec = ASM_SPEC;
diff --git a/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-yes.patch b/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-yes.patch
new file mode 100644
index 0000000..02fb874
--- /dev/null
+++ b/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default-boundschecking-yes.patch
@@ -0,0 +1,14 @@
+--- gcc/gcc/gcc.c.piedef~ 2005-03-01 17:18:15 +0100
++++ gcc/gcc/gcc.c 2005-03-01 17:19:59 +0100
+@@ -724,7 +733,11 @@
+
+ static const char *asm_debug;
+ static const char *cpp_spec = CPP_SPEC BOUNDS_CPP_SPEC;
++#ifdef HARDENED_CC1_SPEC_SUFFIX
++static const char *cc1_spec = CC1_SPEC " " HARDENED_CC1_SPEC_SUFFIX;
++#else
+ static const char *cc1_spec = CC1_SPEC;
++#endif
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *asm_spec = ASM_SPEC;
diff --git a/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default.patch b/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default.patch
new file mode 100644
index 0000000..931b621
--- /dev/null
+++ b/4.0.4/pie/def/01_all_gcc-4.0-v8.7.8-pie-generic-default.patch
@@ -0,0 +1,360 @@
+--- gcc/gcc/config/linux.h.piedef~ 2005-03-01 17:18:15 +0100
++++ gcc/gcc/config/linux.h 2005-03-01 17:21:52 +0100
+@@ -38,8 +38,12 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+-#if defined HAVE_LD_PIE
++#ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}} \
++ crti.o%s %{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -55,8 +59,11 @@
+ object constructed before entering `main', followed by a normal
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+ #else
+--- gcc/gcc/gcc.c.piedef~ 2005-03-01 17:18:15 +0100
++++ gcc/gcc/gcc.c 2005-03-01 17:19:59 +0100
+@@ -86,6 +86,15 @@
+ #include "gcc.h"
+ #include "flags.h"
+
++#include "pie-ssp-setup.h"
++#include "pie-ssp-modus.h"
++#include "pie-ssp-chain.h"
++
++#if !( defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP) )
++#undef HARDENED_STARTFILE_SPEC
++#undef HARDENED_ENDFILE_SPEC
++#endif
++
+ #ifdef HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+@@ -734,8 +747,16 @@
+ static const char *mfwrap_spec = MFWRAP_SPEC;
+ static const char *mflib_spec = MFLIB_SPEC;
+ static const char *libgcc_spec = LIBGCC_SPEC;
++#ifdef HARDENED_ENDFILE_SPEC
++static const char *endfile_spec = HARDENED_ENDFILE_SPEC;
++#else
+ static const char *endfile_spec = ENDFILE_SPEC;
++#endif
++#ifdef HARDENED_STARTFILE_SPEC
++static const char *startfile_spec = HARDENED_STARTFILE_SPEC;
++#else
+ static const char *startfile_spec = STARTFILE_SPEC;
++#endif
+ static const char *switches_need_spaces = SWITCHES_NEED_SPACES;
+ static const char *linker_name_spec = LINKER_NAME;
+ static const char *link_command_spec = LINK_COMMAND_SPEC;
+--- gcc/gcc/pie-ssp-chain.h.piedef~ 2005-03-01 17:19:59 +0100
++++ gcc/gcc/pie-ssp-chain.h 2005-03-01 17:19:59 +0100
+@@ -0,0 +1,77 @@
++#ifndef LINUX_PIE_SSP_CHAIN_H
++#define LINUX_PIE_SSP_CHAIN_H
++
++/*
++ * cc1:
++ ****************************************************************************
++ * C compiler generating code - for nonintel arches fpic/fPIC is not the same
++ * Thu Feb 5 22:32:02 CET 2004 -fpie is causing TEXT relocations in binaries
++ *
++ * -fPIE/-fpie may not be used, it produces unusable objects for shared libs
++ * if it becomes usable, then -fPIE should be used instead of -fpie (arch dep)
++ *
++ * we take care now not using -fPIE on shared libs, by checking for -fPIC/fpic
++ ****************************************************************************
++ */
++
++#define CC1_PIE "%{!fPIC:%{!fpic:-fPIE}}"
++
++#define CC1_SSP "-fstack-protector"
++#define CC1_SSP_ALL "%{!fno-stack-protector-all:-fstack-protector-all}"
++#define CC1_SSP_DUMMY "%{fstack-protector:} %{fno-stack-protector:} %{fstack-protector-all:} %{fno-stack-protector-all:}"
++
++#if ! ( defined ( __hppa__ ) || defined ( USE_HTB ) )
++#define HARDENED_SSP_SPEC_SUFFIX SSP_CHAIN_EXCLUDE( STD_SSP_TRIGGER( CC1_SSP " " SSP_LIBC_EXCLUDE(CC1_SSP_ALL) ) )
++#else
++#define HARDENED_SSP_SPEC_SUFFIX CC1_SSP_DUMMY
++#endif
++
++#define HARDENED_CC1_SPEC_SUFFIX STD_CHAIN_EXCLUDE( CC1_CHAIN_EXCLUDE( STD_PIE_TRIGGER(CC1_PIE) ) " " HARDENED_SSP_SPEC_SUFFIX )
++
++/*
++ * startfile:
++ * we have 4 types of archs:
++ * default: x86[_64]/mips/parisc
++ * not using profile: alpha/rs6000/sparc[64]
++ * not using crtbeginT.o for static: arm/ia64
++ * having some addon: rs6000(mnewlib)
++ */
++
++/*
++ * endfile:
++ * we have 3 types of archs:
++ * default: x86[_64]/mips/parisc
++ * fastmath addon: alpha/ia64/sparc[64]
++ * having some other addon: rs6000(mnewlib)
++ */
++
++/* special cases: rs6000 uses STARTFILE_LINUX_SPEC/ENDFILE_LINUX_SPEC */
++
++/* the above variety explains why the startfile/endfile sections are moved directly to gcc */
++
++/*
++ * link:
++ *****************************************************************************
++ * building of position independent executables is enabled by binutils:ld -pie
++ * use the x86 Redhat branch update provided support for LINK_PIE_SPEC section
++ *****************************************************************************
++ */
++
++#define LINKSEC_PIE_LNK "-pie"
++
++#define LINKSEC_RELRO_LNK "-z relro"
++
++#define LINKSEC_NOW_LNK "-z now"
++
++/* disable default */
++#ifdef LINK_PIE_SPEC
++#undef LINK_PIE_SPEC
++#endif
++
++#ifdef HAVE_LD_PIE
++#define LINK_PIE_SPEC STD_PIE_TRIGGER( LNK_CHAIN_EXCLUDE( PIE_CHAIN_EXCLUDE(LINKSEC_PIE_LNK) ) ) " " OPP_PIE_TRIGGER() " " STD_RELRO_TRIGGER(LINKSEC_RELRO_LNK) " " OPP_RELRO_TRIGGER() " " STD_NOW_TRIGGER(LINKSEC_NOW_LNK) " " OPP_NOW_TRIGGER()
++#else
++#error we need ld w/ -pie support
++#endif
++
++#endif /* LINUX_PIE_SSP_CHAIN_H */
+--- gcc/gcc/pie-ssp-modus.h.piedef~ 2005-03-01 17:19:59 +0100
++++ gcc/gcc/pie-ssp-modus.h 2005-03-01 17:19:59 +0100
+@@ -0,0 +1,127 @@
++#ifndef LINUX_PIE_SSP_MODUS_H
++#define LINUX_PIE_SSP_MODUS_H
++
++/*
++ * The enabler and inverse is used for the proper inclusion of the
++ * startfile and endfile chaining of the crt1, crtbegin and crtend
++ * to use caution not issuing zero or double occurrences of object
++ * in the respective sections of the currently utilized definition
++ */
++
++/*
++ ****************************************************************
++ * set up the trigger logic for stack smashing protector with CC1
++ ****************************************************************
++ */
++
++#if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
++
++#define STD_SSP_TRIGGER(flag) \
++ NSPEC("fno-stack-protector", \
++ flag \
++ )
++
++#else /* defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) */
++
++#define STD_SSP_TRIGGER(flag) \
++ PSPEC("fstack-protector", \
++ flag \
++ )
++
++#endif /* defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) */
++
++/*
++ ****************************************************************
++ * define the trigger logic for setting up position independence
++ ****************************************************************
++ */
++
++#if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
++
++#define STD_PIE_TRIGGER(flag) \
++ NSPEC("nopie", \
++ flag \
++ )
++
++#define INV_PIE_TRIGGER(flag) \
++ PSPEC("nopie", \
++ flag \
++ )
++
++#define OPP_PIE_TRIGGER(flag) \
++ PSPEC("pie", \
++ flag \
++ )
++
++#else /* defined ( DEFAULT_PIE ) || defined ( EFAULT_PIE_SSP) */
++
++#define STD_PIE_TRIGGER(flag) \
++ PSPEC("pie", \
++ flag \
++ )
++
++#define INV_PIE_TRIGGER(flag) \
++ NSPEC("pie", \
++ flag \
++ )
++
++#define OPP_PIE_TRIGGER(flag) \
++ PSPEC("nopie", \
++ flag \
++ )
++
++#endif /* defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) */
++
++#if defined ( EFAULT_RELRO )
++
++#define STD_RELRO_TRIGGER(flag) \
++ NSPEC("norelro", \
++ flag \
++ )
++
++#define OPP_RELRO_TRIGGER(flag) \
++ PSPEC("relro", \
++ flag \
++ )
++
++#else /* defined ( EFAULT_RELRO ) */
++
++#define STD_RELRO_TRIGGER(flag) \
++ PSPEC("relro", \
++ flag \
++ )
++
++#define OPP_RELRO_TRIGGER(flag) \
++ PSPEC("norelro", \
++ flag \
++ )
++
++#endif /* defined ( EFAULT_RELRO ) */
++
++#if defined ( EFAULT_BIND_NOW )
++
++#define STD_NOW_TRIGGER(flag) \
++ NSPEC("nonow", \
++ flag \
++ )
++
++#define OPP_NOW_TRIGGER(flag) \
++ PSPEC("now", \
++ flag \
++ )
++
++#else /* EFAULT_BIND_NOW */
++
++#define STD_NOW_TRIGGER(flag) \
++ PSPEC("now", \
++ flag \
++ )
++
++#define OPP_NOW_TRIGGER(flag) \
++ PSPEC("nonow", \
++ flag \
++ )
++
++#endif /* EFAULT_BIND_NOW */
++
++#endif /* LINUX_PIE_SSP_MODUS_H */
+--- gcc/gcc/pie-ssp-setup.h.piedef~ 2005-03-01 17:19:59 +0100
++++ gcc/gcc/pie-ssp-setup.h 2005-03-01 17:19:59 +0100
+@@ -0,0 +1,84 @@
++#ifndef LINUX_PIE_SSP_SETUP_H
++#define LINUX_PIE_SSP_SETUP_H
++
++/* ********************************************************************************** */
++/* definition of macros and functions needed for constructing the specs file sections */
++/* ********************************************************************************** */
++
++#define PSPEC(a,b) "%{"a": "b"} "
++
++#define NSPEC(a,b) "%{!"a": "b"} "
++
++/*
++ * standard exclusion
++ * disables -fPIE
++ * disables SSP
++ * applies to cc1
++ */
++#define STD_CHAIN_EXCLUDE(flag) \
++ NSPEC("D__KERNEL__", \
++ flag \
++ )
++
++/*
++ * link section exclusion
++ * disables -fPIE
++ * ibcs not added (yet)
++ * applies to cc1 and link_command
++ */
++#define PIE_LNK_CHAIN_EXCLUDE(flag) \
++ NSPEC("static", \
++ flag \
++ )
++
++/* pic exclusion, applies to cc1 */
++#define PIC_CHAIN_EXCLUDE(flag) \
++ NSPEC("fno-PIC", \
++ NSPEC("fno-pic", \
++ flag \
++ ))
++
++/*
++ * pie exclusion
++ * disables -fPIE and -pie
++ * applies to cc1 and link_command
++ */
++#define PIE_CHAIN_EXCLUDE(flag) \
++ NSPEC("shared", \
++ NSPEC("nostdlib", \
++ NSPEC("nostartfiles", \
++ NSPEC("fno-PIE", \
++ NSPEC("fno-pie", \
++ flag \
++ )))))
++
++/*
++ * pie exclusion
++ * disables -pie
++ * applies to link_command
++ */
++#define LNK_GEN_CHAIN_EXCLUDE(flag) \
++ NSPEC("A", \
++ flag \
++ )
++
++#define CC1_CHAIN_EXCLUDE(flag) PIE_LNK_CHAIN_EXCLUDE( PIC_CHAIN_EXCLUDE( PIE_CHAIN_EXCLUDE(flag) ) )
++#define LNK_CHAIN_EXCLUDE(flag) PIE_LNK_CHAIN_EXCLUDE( LNK_GEN_CHAIN_EXCLUDE(flag) )
++
++/*
++ * ssp exclusion
++ * disables SSP
++ * applies to cc1
++ */
++#define SSP_CHAIN_EXCLUDE(flag) \
++ NSPEC("nostdlib", \
++ flag \
++ )
++
++#define SSP_LIBC_EXCLUDE(flag) \
++ NSPEC("D_LIBC", \
++ NSPEC("D_LIBC_REENTRANT", \
++ flag \
++ ))
++
++#endif /* LINUX_PIE_SSP_SETUP_H */
diff --git a/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch
new file mode 100644
index 0000000..3240e5b
--- /dev/null
+++ b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch
@@ -0,0 +1,28 @@
+--- gcc-3.4.3/gcc/config/alpha/elf.h.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/config/alpha/elf.h Mon Nov 22 17:59:09 2004
+@@ -391,8 +391,12 @@
+ support for getting C++ file-scope static object constructed
+ before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -407,8 +411,12 @@
+ getting C++ file-scope static object constructed before entering
+ `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
diff --git a/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch
new file mode 100644
index 0000000..4245517
--- /dev/null
+++ b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch
@@ -0,0 +1,27 @@
+--- gcc-3.4.3/gcc/config/arm/linux-elf.h.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/config/arm/linux-elf.h Mon Nov 22 18:01:11 2004
+@@ -93,8 +93,12 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}} \
++ crti.o%s %{static|nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -110,8 +114,11 @@
+ object constructed before entering `main', followed by a normal
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+ #else
diff --git a/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch
new file mode 100644
index 0000000..fa66483
--- /dev/null
+++ b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch
@@ -0,0 +1,28 @@
+--- gcc-3.4.3/gcc/config/ia64/linux.h.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/config/ia64/linux.h Mon Nov 22 18:04:33 2004
+@@ -17,8 +17,12 @@
+ } while (0)
+
+ /* Need to override linux.h STARTFILE_SPEC, since it has crtbeginT.o in. */
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static|nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -29,8 +33,12 @@
+ #endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
diff --git a/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch
new file mode 100644
index 0000000..cea8453
--- /dev/null
+++ b/4.0.4/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch
@@ -0,0 +1,99 @@
+--- gcc-3.4.3/gcc/config/rs6000/sysv4.h.def~ Mon Nov 22 18:42:04 2004
++++ gcc-3.4.3/gcc/config/rs6000/sysv4.h Mon Nov 22 21:11:22 2004
+@@ -824,6 +824,28 @@
+ mcall-gnu :-mbig; \
+ mcall-i960-old :-mlittle}"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC "%(asm_cpu) \
++%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
++%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
++%{mrelocatable} %{mrelocatable-lib} \
++%{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++%{memb|msdata|msdata=eabi: -memb} \
++%{mlittle|mlittle-endian:-mlittle; \
++ mbig|mbig-endian :-mbig; \
++ mcall-aixdesc | \
++ mcall-freebsd | \
++ mcall-netbsd | \
++ mcall-openbsd | \
++ mcall-linux | \
++ mcall-gnu :-mbig; \
++ mcall-i960-old :-mlittle}"
++#undef ASM_SPEC
++#define ASM_SPEC HARDENED_ASM_SPEC
++#endif
++#endif
++
+ #define CC1_ENDIAN_BIG_SPEC ""
+
+ #define CC1_ENDIAN_LITTLE_SPEC "\
+@@ -1104,7 +1126,12 @@
+ %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
+ %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
+
++#undef HARDENED_STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_LINUX_SPEC "\
++%{!shared: %{pg|p:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}} \
++%{mnewlib:ecrti.o%s;:crti.o%s} \
++%{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_LINUX_SPEC "\
+ %{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+@@ -1116,7 +1143,11 @@
+ %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
++#undef HARDENED_ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_LINUX_SPEC "\
++%{static|nopie:crtend.o%s;:crtendS.o%s} \
++%{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
+ #define ENDFILE_LINUX_SPEC "\
+ %{shared|pie:crtendS.o%s;:crtend.o%s} \
+ %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
+@@ -1126,6 +1157,15 @@
+ %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
+ #endif
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#undef STARTFILE_LINUX_SPEC
++#define STARTFILE_LINUX_SPEC HARDENED_STARTFILE_LINUX_SPEC
++#undef ENDFILE_LINUX_SPEC
++#define ENDFILE_LINUX_SPEC HARDENED_ENDFILE_LINUX_SPEC
++#endif
++#endif
++
+ #define LINK_START_LINUX_SPEC ""
+
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+--- gcc-3.4.3/gcc/config/rs6000/linux64.h.def~ Mon Nov 22 18:42:18 2004
++++ gcc-3.4.3/gcc/config/rs6000/linux64.h Mon Nov 22 21:12:01 2004
+@@ -149,6 +149,24 @@
+ %{mcall-netbsd: -mbig} \
+ }}}}"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
++%{mrelocatable} %{mrelocatable-lib} \
++%{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
++%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
++ %{mcall-freebsd: -mbig} \
++ %{mcall-i960-old: -mlittle} \
++ %{mcall-linux: -mbig} \
++ %{mcall-gnu: -mbig} \
++ %{mcall-netbsd: -mbig} \
++}}}}"
++#undef ASM_SPEC32
++#define ASM_SPEC32 HARDENED_ASM_SPEC32
++#endif
++#endif
++
+ #define ASM_SPEC64 "-a64"
+
+ #define ASM_SPEC_COMMON "%(asm_cpu) \
diff --git a/4.0.4/pie/def/02_all_gcc-4.0-v8.7.6.7-pie-sparc-default.patch b/4.0.4/pie/def/02_all_gcc-4.0-v8.7.6.7-pie-sparc-default.patch
new file mode 100644
index 0000000..5e32c02
--- /dev/null
+++ b/4.0.4/pie/def/02_all_gcc-4.0-v8.7.6.7-pie-sparc-default.patch
@@ -0,0 +1,100 @@
+--- gcc/gcc/config/sparc/linux.h.piesparcdef~ 2005-03-01 17:18:15 +0100
++++ gcc/gcc/config/sparc/linux.h 2005-03-01 17:25:51 +0100
+@@ -48,8 +48,12 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p:gcrt1.o%s;nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -65,8 +69,12 @@
+ object constructed before entering `main', followed by a normal
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+@@ -153,6 +161,17 @@
+ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
+ %{fpic|fPIC|fpie|fPIE|pie:-K PIC} %(asm_cpu) %(asm_relax)"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC \
++ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
++ %{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++ %(asm_cpu) %(asm_relax)"
++#undef ASM_SPEC
++#define ASM_SPEC HARDENED_ASM_SPEC
++#endif
++#endif
++
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+ #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
+--- gcc/gcc/config/sparc/linux64.h.piesparcdef~ 2005-03-01 17:18:15 +0100
++++ gcc/gcc/config/sparc/linux64.h 2005-03-01 17:24:45 +0100
+@@ -71,9 +71,13 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared:%{pg|p:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
+@@ -89,8 +93,12 @@
+ object constructed before entering `main', followed by a normal
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s\
++ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
+ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+@@ -290,6 +298,24 @@
+ %{mlittle-endian:-EL} \
+ %(asm_cpu) %(asm_arch) %(asm_relax)"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC "\
++%{V} \
++%{v:%{!V:-V}} \
++%{!Qn:-Qy} \
++%{n} \
++%{T} \
++%{Ym,*} \
++%{Wa,*:%*} \
++-s %{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++%{mlittle-endian:-EL} \
++%(asm_cpu) %(asm_arch) %(asm_relax)"
++#undef ASM_SPEC
++#define ASM_SPEC HARDENED_ASM_SPEC
++#endif
++#endif
++
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+ #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
diff --git a/4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch b/4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch
new file mode 100644
index 0000000..725f81d
--- /dev/null
+++ b/4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch
@@ -0,0 +1,22 @@
+--- gcc-3.4.0/gcc/config/rs6000/sysv4.h.nondef Tue May 11 12:12:34 2004
++++ gcc-3.4.0/gcc/config/rs6000/sysv4.h Tue May 11 12:41:19 2004
+@@ -817,7 +817,7 @@
+ #define ASM_SPEC "%(asm_cpu) \
+ %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
+ %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE|pie:-K PIC} \
+ %{memb|msdata|msdata=eabi: -memb} \
+ %{mlittle|mlittle-endian:-mlittle; \
+ mbig|mbig-endian :-mbig; \
+--- gcc-3.4.0/gcc/config/rs6000/linux64.h.nondef Thu Mar 11 04:25:06 2004
++++ gcc-3.4.0/gcc/config/rs6000/linux64.h Tue May 11 12:44:26 2004
+@@ -134,7 +134,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE|pie:-K PIC} \
+ %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-freebsd: -mbig} \
diff --git a/4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch b/4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch
new file mode 100644
index 0000000..60cee67
--- /dev/null
+++ b/4.0.4/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch
@@ -0,0 +1,22 @@
+--- gcc-3.4.3/gcc/config/sparc/linux.h.mps Mon Nov 22 15:28:32 2004
++++ gcc-3.4.3/gcc/config/sparc/linux.h Mon Nov 22 15:28:51 2004
+@@ -177,7 +177,7 @@
+ #undef ASM_SPEC
+ #define ASM_SPEC \
+ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
+- %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)"
++ %{fpic|fPIC|fpie|fPIE|pie:-K PIC} %(asm_cpu) %(asm_relax)"
+
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+--- gcc-3.4.3/gcc/config/sparc/linux64.h.mps Mon Nov 22 15:28:40 2004
++++ gcc-3.4.3/gcc/config/sparc/linux64.h Mon Nov 22 15:29:09 2004
+@@ -281,7 +281,7 @@
+ %{T} \
+ %{Ym,*} \
+ %{Wa,*:%*} \
+--s %{fpic|fPIC|fpie|fPIE:-K PIC} \
++-s %{fpic|fPIC|fpie|fPIE|pie:-K PIC} \
+ %{mlittle-endian:-EL} \
+ %(asm_cpu) %(asm_arch) %(asm_relax)"
+
diff --git a/4.0.4/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch b/4.0.4/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch
new file mode 100644
index 0000000..e5bc302
--- /dev/null
+++ b/4.0.4/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch
@@ -0,0 +1,11 @@
+--- gcc-4.0.old/gcc/gcc.c.mps Sun Nov 14 21:10:35 2004
++++ gcc-4.0/gcc/gcc.c Sun Nov 14 21:43:17 2004
+@@ -794,6 +794,8 @@
+ /* NB: This is shared amongst all front-ends. */
+ static const char *cc1_options =
+ "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
++ %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}}\
++ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}\
+ %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
+ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
+ %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi}\
diff --git a/4.0.4/pie/upstream/00_all_gcc-4.0-cvs-start_endfile.patch b/4.0.4/pie/upstream/00_all_gcc-4.0-cvs-start_endfile.patch
new file mode 100644
index 0000000..1fdc434
--- /dev/null
+++ b/4.0.4/pie/upstream/00_all_gcc-4.0-cvs-start_endfile.patch
@@ -0,0 +1,210 @@
+--- gcc/gcc/config/alpha/elf.h.startend~ 2003-12-25 16:17:34 +0100
++++ gcc/gcc/config/alpha/elf.h 2005-03-01 17:06:40 +0100
+@@ -399,7 +399,7 @@
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
+@@ -408,9 +408,15 @@
+ `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* We support #pragma. */
+ #define HANDLE_SYSV_PRAGMA 1
+--- gcc/gcc/config/arm/linux-elf.h.startend~ 2005-03-01 17:02:02 +0100
++++ gcc/gcc/config/arm/linux-elf.h 2005-03-01 17:06:40 +0100
+@@ -63,12 +63,15 @@
+ object constructed before entering `main'. */
+
+ #undef STARTFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: \
+- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+- %{!p:%{profile:gcrt1.o%s} \
+- %{!profile:crt1.o%s}}}} \
+- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++#else
++#define STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}"
++#endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+ the GNU/Linux magical crtend.o file (see crtstuff.c) which
+@@ -77,8 +80,13 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
++ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ #undef LINK_SPEC
+ #ifdef USE_UCLIBC
+--- gcc/gcc/config/ia64/linux.h.startend~ 2004-09-08 02:17:14 +0200
++++ gcc/gcc/config/ia64/linux.h 2005-03-01 17:06:40 +0100
+@@ -25,14 +25,20 @@
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* Define this for shared library support because it isn't in the main
+ linux.h file. */
+--- gcc/gcc/config/rs6000/linux64.h.startend~ 2004-12-02 03:21:28 +0100
++++ gcc/gcc/config/rs6000/linux64.h 2005-03-01 17:06:40 +0100
+@@ -152,7 +152,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
+ %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-freebsd: -mbig} \
+--- gcc/gcc/config/rs6000/sysv4.h.startend~ 2005-03-01 17:02:02 +0100
++++ gcc/gcc/config/rs6000/sysv4.h 2005-03-01 17:09:23 +0100
+@@ -1122,12 +1122,18 @@
+ #define STARTFILE_LINUX_SPEC "\
+ %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++%{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_LINUX_SPEC "\
+ %{shared|pie:crtendS.o%s;:crtend.o%s} \
+ %{mnewlib:ecrtn.o%s;:crtn.o%s}"
++#else
++#define ENDFILE_LINUX_SPEC "\
++%{shared:crtendS.o%s;:crtend.o%s} \
++%{mnewlib:ecrtn.o%s;:crtn.o%s}"
++#endif
+
+ #define LINK_START_LINUX_SPEC ""
+
+--- gcc/gcc/config/sparc/linux.h.startend~ 2005-01-20 21:39:42 +0100
++++ gcc/gcc/config/sparc/linux.h 2005-03-01 17:06:40 +0100
+@@ -49,14 +49,14 @@
+ object constructed before entering `main'. */
+
+ #undef STARTFILE_SPEC
+-#if defined HAVE_LD_PIE
++#ifdef HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -66,9 +66,15 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #undef CC1_SPEC
+--- gcc/gcc/config/sparc/linux64.h.startend~ 2005-01-21 11:15:56 +0100
++++ gcc/gcc/config/sparc/linux64.h 2005-03-01 17:06:40 +0100
+@@ -80,7 +80,7 @@
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbeginS.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -90,10 +90,15 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
+-
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
+ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
++#else
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s\
++ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
++#endif
+
+ /* The GNU C++ standard library requires that these macros be defined. */
+ #undef CPLUSPLUS_CPP_SPEC
+--- gcc/gcc/config/linux.h.startend~ 2004-08-05 11:12:11 +0200
++++ gcc/gcc/config/linux.h 2005-03-01 17:06:40 +0100
+@@ -46,7 +46,7 @@
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -56,8 +56,13 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #ifndef CC1_SPEC
diff --git a/4.0.4/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch b/4.0.4/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch
new file mode 100644
index 0000000..b97a772
--- /dev/null
+++ b/4.0.4/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch
@@ -0,0 +1,16 @@
+--- gcc-3.4.0/gcc/config/arm/linux-elf.h.mps Thu May 20 09:11:17 2004
++++ gcc-3.4.0/gcc/config/arm/linux-elf.h Thu May 20 09:12:28 2004
+@@ -91,10 +91,11 @@
+ #define LINK_SPEC "%{h*} %{version:-v} \
+ %{b} %{Wl,*:%*} \
+- %{static:-Bstatic} \
+ %{shared:-shared} \
+ %{symbolic:-Bsymbolic} \
++ %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
++ %{static:-Bstatic}} \
+ -X \
+ %{mbig-endian:-EB}" \
+ SUBTARGET_EXTRA_LINK_SPEC
diff --git a/4.0.4/uclibc/90_all_100-uclibc-conf.patch b/4.0.4/uclibc/90_all_100-uclibc-conf.patch
new file mode 100644
index 0000000..acc2111
--- /dev/null
+++ b/4.0.4/uclibc/90_all_100-uclibc-conf.patch
@@ -0,0 +1,518 @@
+--- gcc-4.0.2/gcc/config/t-linux-uclibc
++++ gcc-4.0.2/gcc/config/t-linux-uclibc
+@@ -0,0 +1,5 @@
++# Remove glibc specific files added in t-linux
++SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES))
++
++# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc
++LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH))
+--- gcc-4.0.2/gcc/config.gcc
++++ gcc-4.0.2/gcc/config.gcc
+@@ -1778,7 +1778,7 @@
+ ;;
+ sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
+ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
+- sh-*-linux* | sh[346lbe]*-*-linux* | \
++ sh*-*-linux* | sh[346lbe]*-*-linux* | \
+ sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+ sh64-*-netbsd* | sh64l*-*-netbsd*)
+ tmake_file="${tmake_file} sh/t-sh sh/t-elf"
+@@ -2234,10 +2234,16 @@
+ *)
+ echo "*** Configuration ${target} not supported" 1>&2
+ exit 1
+ ;;
+ esac
++
++# Rather than hook into each target, just do it after all the linux
++# targets have been processed
++case ${target} in
++*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc"
++esac
+
+ case ${target} in
+ i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1)
+ tmake_file="${tmake_file} i386/t-gmm_malloc"
+ ;;
+--- gcc-4.0.2/gcc/config/alpha/linux-elf.h
++++ gcc-4.0.2/gcc/config/alpha/linux-elf.h
+@@ -27,7 +27,11 @@
+ #define SUBTARGET_EXTRA_SPECS \
+ { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
+
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
+ #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#endif
+
+ #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+ %{O*:-O3} %{!O*:-O1} \
+--- gcc-4.0.2/gcc/config/arm/linux-elf.h
++++ gcc-4.0.2/gcc/config/arm/linux-elf.h
+@@ -81,14 +81,19 @@
+ #define ENDFILE_SPEC \
+ "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#endif
+ #undef LINK_SPEC
+ #define LINK_SPEC "%{h*} %{version:-v} \
+ %{b} %{Wl,*:%*} \
+ %{static:-Bstatic} \
+ %{shared:-shared} \
+ %{symbolic:-Bsymbolic} \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \
+ -X \
+ %{mbig-endian:-EB}" \
+ SUBTARGET_EXTRA_LINK_SPEC
+--- gcc-4.0.2/gcc/config/cris/linux.h
++++ gcc-4.0.2/gcc/config/cris/linux.h
+@@ -79,6 +79,25 @@
+ #undef CRIS_DEFAULT_CPU_VERSION
+ #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
+
++#ifdef USE_UCLIBC
++
++#undef CRIS_SUBTARGET_VERSION
++#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
++
++#undef CRIS_LINK_SUBTARGET_SPEC
++#define CRIS_LINK_SUBTARGET_SPEC \
++ "-mcrislinux\
++ -rpath-link include/asm/../..%s\
++ %{shared} %{static}\
++ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
++ %{!shared: \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
++ %{!r:%{O2|O3: --gc-sections}}"
++
++#else /* USE_UCLIBC */
++
+ #undef CRIS_SUBTARGET_VERSION
+ #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
+
+@@ -93,6 +112,8 @@
+ %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
+ %{!r:%{O2|O3: --gc-sections}}"
+
++#endif /* USE_UCLIBC */
++
+
+ /* Node: Run-time Target */
+
+--- gcc-4.0.2/gcc/config/i386/linux.h
++++ gcc-4.0.2/gcc/config/i386/linux.h
+@@ -107,6 +107,11 @@
+ #define LINK_EMULATION "elf_i386"
+ #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
++#ifdef USE_UCLIBC
++#undef DYNAMIC_LINKER
++#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#endif
++
+ #undef SUBTARGET_EXTRA_SPECS
+ #define SUBTARGET_EXTRA_SPECS \
+ { "link_emulation", LINK_EMULATION },\
+--- gcc-4.0.2/gcc/config/i386/linux64.h
++++ gcc-4.0.2/gcc/config/i386/linux64.h
+@@ -54,14 +54,21 @@
+ When the -shared link option is used a final link is not being
+ done. */
+
++#ifdef USE_UCLIBC
++#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
++#else
++#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2"
++#endif
+ #undef LINK_SPEC
+ #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
+ %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
++ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \
++ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \
+ %{static:-static}}"
+
+ #define MULTILIB_DEFAULTS { "m64" }
+--- gcc-4.0.2/gcc/config/ia64/linux.h
++++ gcc-4.0.2/gcc/config/ia64/linux.h
+@@ -37,13 +37,18 @@
+ /* Define this for shared library support because it isn't in the main
+ linux.h file. */
+
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
++#endif
+ #undef LINK_SPEC
+ #define LINK_SPEC "\
+ %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
+ %{static:-static}}"
+
+
+--- gcc-4.0.2/gcc/config/m68k/linux.h
++++ gcc-4.0.2/gcc/config/m68k/linux.h
+@@ -127,12 +127,17 @@
+
+ /* If ELF is the default format, we should not use /lib/elf. */
+
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
++#endif
+ #undef LINK_SPEC
+ #define LINK_SPEC "-m m68kelf %{shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
++ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
+ %{static}}"
+
+ /* For compatibility with linux/a.out */
+--- gcc-4.0.2/gcc/config/mips/linux.h
++++ gcc-4.0.2/gcc/config/mips/linux.h
+@@ -108,14 +108,19 @@
+
+ /* Borrowed from sparc/linux.h */
+ #undef LINK_SPEC
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
++#endif
+ #define LINK_SPEC \
+ "%(endian_spec) \
+ %{shared:-shared} \
+ %{!shared: \
+ %{!ibcs: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
+ %{static:-static}}}"
+
+ #undef SUBTARGET_ASM_SPEC
+--- gcc-4.0.2/gcc/config/pa/pa-linux.h
++++ gcc-4.0.2/gcc/config/pa/pa-linux.h
+@@ -82,13 +82,18 @@
+ /* Define this for shared library support because it isn't in the main
+ linux.h file. */
+
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
++#endif
+ #undef LINK_SPEC
+ #define LINK_SPEC "\
+ %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
+ %{static:-static}}"
+
+ /* glibc's profiling functions don't need gcc to allocate counters. */
+--- gcc-4.0.2/gcc/config/rs6000/linux.h
++++ gcc-4.0.2/gcc/config/rs6000/linux.h
+@@ -69,7 +69,11 @@
+ #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
+
+ #undef LINK_OS_DEFAULT_SPEC
++#ifdef USE_UCLIBC
++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
++#else
+ #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
++#endif
+
+ #define LINK_GCC_C_SEQUENCE_SPEC \
+ "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
+--- gcc-4.0.2/gcc/config/rs6000/sysv4.h
++++ gcc-4.0.2/gcc/config/rs6000/sysv4.h
+@@ -949,6 +949,7 @@
+ mcall-linux : %(link_os_linux) ; \
+ mcall-gnu : %(link_os_gnu) ; \
+ mcall-netbsd : %(link_os_netbsd) ; \
++ mcall-linux-uclibc : %(link_os_linux_uclibc); \
+ mcall-openbsd: %(link_os_openbsd) ; \
+ : %(link_os_default) }"
+
+@@ -1127,6 +1128,10 @@
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
+
++#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
++
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+ # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+ #endif
+@@ -1293,6 +1298,7 @@
+ { "link_os_sim", LINK_OS_SIM_SPEC }, \
+ { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
+ { "link_os_linux", LINK_OS_LINUX_SPEC }, \
++ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
+ { "link_os_gnu", LINK_OS_GNU_SPEC }, \
+ { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
+ { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
+--- gcc-4.0.2/gcc/config/s390/linux.h
++++ gcc-4.0.2/gcc/config/s390/linux.h
+@@ -77,6 +77,13 @@
+ #define MULTILIB_DEFAULTS { "m31" }
+ #endif
+
++#ifdef USE_UCLIBC
++#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
++#else
++#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1"
++#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1"
++#endif
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+@@ -86,8 +93,8 @@
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker: \
+- %{m31:-dynamic-linker /lib/ld.so.1} \
+- %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
++ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \
++ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}"
+
+
+ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+--- gcc-4.0.2/gcc/config/sh/linux.h
++++ gcc-4.0.2/gcc/config/sh/linux.h
+@@ -67,11 +67,16 @@
+ #undef SUBTARGET_LINK_EMUL_SUFFIX
+ #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
+ #undef SUBTARGET_LINK_SPEC
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#endif
+ #define SUBTARGET_LINK_SPEC \
+ "%{shared:-shared} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
+ %{static:-static}"
+
+ #undef LIB_SPEC
+--- gcc-4.0.2/gcc/config/sparc/linux.h
++++ gcc-4.0.2/gcc/config/sparc/linux.h
+@@ -130,14 +130,19 @@
+
+ /* If ELF is the default format, we should not use /lib/elf. */
+
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#endif
+ #undef LINK_SPEC
+ #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+ %{!mno-relax:%{!r:-relax}} \
+ %{!shared: \
+ %{!ibcs: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
+ %{static:-static}}}"
+
+ /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
+--- gcc-4.0.2/gcc/config/sparc/linux64.h
++++ gcc-4.0.2/gcc/config/sparc/linux64.h
+@@ -167,12 +166,17 @@
+ { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
+ { "link_arch", LINK_ARCH_SPEC },
+
++#ifdef USE_UCLIBC
++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#else
++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#endif
+ #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+ %{!shared: \
+ %{!ibcs: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
+ %{static:-static}}} \
+ "
+
+--- gcc-4.0.2/libtool.m4
++++ gcc-4.0.2/libtool.m4
+@@ -682,6 +682,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+--- gcc-4.0.2/ltconfig
++++ gcc-4.0.2/ltconfig
+@@ -603,6 +603,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
++linux-uclibc*) ;;
+ linux-gnu*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+@@ -1274,6 +1275,23 @@
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
++linux-uclibc*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ # This implies no fast_install, which is unacceptable.
++ # Some rework will be needed to allow for fast_install
++ # before this can be enabled.
++ hardcode_into_libs=yes
++ # Assume using the uClibc dynamic linker.
++ dynamic_linker="uClibc ld.so"
++ ;;
++
+ netbsd*)
+ need_lib_prefix=no
+ need_version=no
+--- gcc-4.0.2/libffi/configure
++++ gcc-4.0.2/libffi/configure
+@@ -3457,6 +3457,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- gcc-4.0.2/libgfortran/configure
++++ gcc-4.0.2/libgfortran/configure
+@@ -3681,6 +3681,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- gcc-4.0.2/libjava/configure
++++ gcc-4.0.2/libjava/configure
+@@ -4351,6 +4351,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- gcc-4.0.2/libmudflap/configure
++++ gcc-4.0.2/libmudflap/configure
+@@ -5380,6 +5380,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- gcc-4.0.2/libobjc/configure
++++ gcc-4.0.2/libobjc/configure
+@@ -3283,6 +3283,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- gcc-4.0.2/boehm-gc/configure
++++ gcc-4.0.2/boehm-gc/configure
+@@ -4320,6 +4320,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- gcc-4.0.2/zlib/configure
++++ gcc-4.0.2/zlib/configure
+@@ -3426,6 +3426,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff --git a/4.0.4/uclibc/91_all_200-uclibc-locale.patch b/4.0.4/uclibc/91_all_200-uclibc-locale.patch
new file mode 100644
index 0000000..ac4cf97
--- /dev/null
+++ b/4.0.4/uclibc/91_all_200-uclibc-locale.patch
@@ -0,0 +1,3237 @@
+diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4
+--- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500
++++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500
+@@ -1104,7 +1104,7 @@
+ AC_MSG_CHECKING([for C locale to use])
+ GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
+ [use MODEL for target locale package],
+- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
+
+ # If they didn't use this option switch, or if they specified --enable
+ # with no specific model, we'll have to look for one. If they
+@@ -1120,6 +1120,9 @@
+ # Default to "generic".
+ if test $enable_clocale_flag = auto; then
+ case ${target_os} in
++ *-uclibc*)
++ enable_clocale_flag=uclibc
++ ;;
+ linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
+ AC_EGREP_CPP([_GLIBCXX_ok], [
+ #include <features.h>
+@@ -1263,6 +1266,40 @@
+ CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+ ;;
++ uclibc)
++ AC_MSG_RESULT(uclibc)
++
++ # Declare intention to use gettext, and add support for specific
++ # languages.
++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
++ ALL_LINGUAS="de fr"
++
++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
++ USE_NLS=yes
++ fi
++ # Export the build objects.
++ for ling in $ALL_LINGUAS; do \
++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
++ done
++ AC_SUBST(glibcxx_MOFILES)
++ AC_SUBST(glibcxx_POFILES)
++
++ CLOCALE_H=config/locale/uclibc/c_locale.h
++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
++ CMESSAGES_H=config/locale/uclibc/messages_members.h
++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
++ CTIME_H=config/locale/uclibc/time_members.h
++ CTIME_CC=config/locale/uclibc/time_members.cc
++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
++ ;;
+ esac
+
+ # This is where the testsuite looks for locale catalogs, using the
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,59 @@
++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
++
++// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++// Written by Jakub Jelinek <jakub@redhat.com>
++
++#include <clocale>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning clean this up
++#endif
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++
++extern "C" __typeof(iswctype_l) __iswctype_l;
++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
++extern "C" __typeof(strcoll_l) __strcoll_l;
++extern "C" __typeof(strftime_l) __strftime_l;
++extern "C" __typeof(strtod_l) __strtod_l;
++extern "C" __typeof(strtof_l) __strtof_l;
++extern "C" __typeof(strtold_l) __strtold_l;
++extern "C" __typeof(strxfrm_l) __strxfrm_l;
++extern "C" __typeof(towlower_l) __towlower_l;
++extern "C" __typeof(towupper_l) __towupper_l;
++extern "C" __typeof(wcscoll_l) __wcscoll_l;
++extern "C" __typeof(wcsftime_l) __wcsftime_l;
++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
++extern "C" __typeof(wctype_l) __wctype_l;
++extern "C" __typeof(newlocale) __newlocale;
++extern "C" __typeof(freelocale) __freelocale;
++extern "C" __typeof(duplocale) __duplocale;
++extern "C" __typeof(uselocale) __uselocale;
++
++#endif // GLIBC 2.3 and later
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,160 @@
++// Wrapper for underlying C-language localization -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.8 Standard locale categories.
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <cerrno> // For errno
++#include <locale>
++#include <stdexcept>
++#include <langinfo.h>
++#include <bits/c++locale_internal.h>
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
++#define __strtof_l(S, E, L) strtof((S), (E))
++#define __strtod_l(S, E, L) strtod((S), (E))
++#define __strtold_l(S, E, L) strtold((S), (E))
++#warning should dummy __newlocale check for C|POSIX ?
++#define __newlocale(a, b, c) NULL
++#define __freelocale(a) ((void)0)
++#define __duplocale(a) __c_locale()
++#endif
++
++namespace std
++{
++ template<>
++ void
++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
++ const __c_locale& __cloc)
++ {
++ if (!(__err & ios_base::failbit))
++ {
++ char* __sanity;
++ errno = 0;
++ float __f = __strtof_l(__s, &__sanity, __cloc);
++ if (__sanity != __s && errno != ERANGE)
++ __v = __f;
++ else
++ __err |= ios_base::failbit;
++ }
++ }
++
++ template<>
++ void
++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
++ const __c_locale& __cloc)
++ {
++ if (!(__err & ios_base::failbit))
++ {
++ char* __sanity;
++ errno = 0;
++ double __d = __strtod_l(__s, &__sanity, __cloc);
++ if (__sanity != __s && errno != ERANGE)
++ __v = __d;
++ else
++ __err |= ios_base::failbit;
++ }
++ }
++
++ template<>
++ void
++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
++ const __c_locale& __cloc)
++ {
++ if (!(__err & ios_base::failbit))
++ {
++ char* __sanity;
++ errno = 0;
++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
++ if (__sanity != __s && errno != ERANGE)
++ __v = __ld;
++ else
++ __err |= ios_base::failbit;
++ }
++ }
++
++ void
++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
++ __c_locale __old)
++ {
++ __cloc = __newlocale(1 << LC_ALL, __s, __old);
++#ifdef __UCLIBC_HAS_XLOCALE__
++ if (!__cloc)
++ {
++ // This named locale is not supported by the underlying OS.
++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
++ "name not valid"));
++ }
++#endif
++ }
++
++ void
++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
++ {
++ if (_S_get_c_locale() != __cloc)
++ __freelocale(__cloc);
++ }
++
++ __c_locale
++ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
++ { return __duplocale(__cloc); }
++} // namespace std
++
++namespace __gnu_cxx
++{
++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
++ {
++ "LC_CTYPE",
++ "LC_NUMERIC",
++ "LC_TIME",
++ "LC_COLLATE",
++ "LC_MONETARY",
++ "LC_MESSAGES",
++#if _GLIBCXX_NUM_CATEGORIES != 0
++ "LC_PAPER",
++ "LC_NAME",
++ "LC_ADDRESS",
++ "LC_TELEPHONE",
++ "LC_MEASUREMENT",
++ "LC_IDENTIFICATION"
++#endif
++ };
++}
++
++namespace std
++{
++ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
++} // namespace std
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,115 @@
++// Wrapper for underlying C-language localization -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.8 Standard locale categories.
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#ifndef _C_LOCALE_H
++#define _C_LOCALE_H 1
++
++#pragma GCC system_header
++
++#include <cstring> // get std::strlen
++#include <cstdio> // get std::snprintf or std::sprintf
++#include <clocale>
++#include <langinfo.h> // For codecvt
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this
++#endif
++#ifdef __UCLIBC_HAS_LOCALE__
++#include <iconv.h> // For codecvt using iconv, iconv_t
++#endif
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++#include <libintl.h> // For messages
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning what is _GLIBCXX_C_LOCALE_GNU for
++#endif
++#define _GLIBCXX_C_LOCALE_GNU 1
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix categories
++#endif
++// #define _GLIBCXX_NUM_CATEGORIES 6
++#define _GLIBCXX_NUM_CATEGORIES 0
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++namespace __gnu_cxx
++{
++ extern "C" __typeof(uselocale) __uselocale;
++}
++#endif
++
++namespace std
++{
++#ifdef __UCLIBC_HAS_XLOCALE__
++ typedef __locale_t __c_locale;
++#else
++ typedef int* __c_locale;
++#endif
++
++ // Convert numeric value of type _Tv to string and return length of
++ // string. If snprintf is available use it, otherwise fall back to
++ // the unsafe sprintf which, in general, can be dangerous and should
++ // be avoided.
++ template<typename _Tv>
++ int
++ __convert_from_v(char* __out, const int __size, const char* __fmt,
++#ifdef __UCLIBC_HAS_XLOCALE__
++ _Tv __v, const __c_locale& __cloc, int __prec)
++ {
++ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
++#else
++ _Tv __v, const __c_locale&, int __prec)
++ {
++# ifdef __UCLIBC_HAS_LOCALE__
++ char* __old = std::setlocale(LC_ALL, NULL);
++ char* __sav = new char[std::strlen(__old) + 1];
++ std::strcpy(__sav, __old);
++ std::setlocale(LC_ALL, "C");
++# endif
++#endif
++
++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __gnu_cxx::__uselocale(__old);
++#elif defined __UCLIBC_HAS_LOCALE__
++ std::setlocale(LC_ALL, __sav);
++ delete [] __sav;
++#endif
++ return __ret;
++ }
++}
++
++#endif
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,306 @@
++// std::codecvt implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++namespace std
++{
++ // Specializations.
++#ifdef _GLIBCXX_USE_WCHAR_T
++ codecvt_base::result
++ codecvt<wchar_t, char, mbstate_t>::
++ do_out(state_type& __state, const intern_type* __from,
++ const intern_type* __from_end, const intern_type*& __from_next,
++ extern_type* __to, extern_type* __to_end,
++ extern_type*& __to_next) const
++ {
++ result __ret = ok;
++ state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
++ // in case we fall back to wcrtomb and then continue, in a loop.
++ // NB: wcsnrtombs is a GNU extension
++ for (__from_next = __from, __to_next = __to;
++ __from_next < __from_end && __to_next < __to_end
++ && __ret == ok;)
++ {
++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
++ __from_end - __from_next);
++ if (!__from_chunk_end)
++ __from_chunk_end = __from_end;
++
++ __from = __from_next;
++ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
++ __from_chunk_end - __from_next,
++ __to_end - __to_next, &__state);
++ if (__conv == static_cast<size_t>(-1))
++ {
++ // In case of error, in order to stop at the exact place we
++ // have to start again from the beginning with a series of
++ // wcrtomb.
++ for (; __from < __from_next; ++__from)
++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
++ __state = __tmp_state;
++ __ret = error;
++ }
++ else if (__from_next && __from_next < __from_chunk_end)
++ {
++ __to_next += __conv;
++ __ret = partial;
++ }
++ else
++ {
++ __from_next = __from_chunk_end;
++ __to_next += __conv;
++ }
++
++ if (__from_next < __from_end && __ret == ok)
++ {
++ extern_type __buf[MB_LEN_MAX];
++ __tmp_state = __state;
++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
++ if (__conv > static_cast<size_t>(__to_end - __to_next))
++ __ret = partial;
++ else
++ {
++ memcpy(__to_next, __buf, __conv);
++ __state = __tmp_state;
++ __to_next += __conv;
++ ++__from_next;
++ }
++ }
++ }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++
++ return __ret;
++ }
++
++ codecvt_base::result
++ codecvt<wchar_t, char, mbstate_t>::
++ do_in(state_type& __state, const extern_type* __from,
++ const extern_type* __from_end, const extern_type*& __from_next,
++ intern_type* __to, intern_type* __to_end,
++ intern_type*& __to_next) const
++ {
++ result __ret = ok;
++ state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
++ // in case we store a L'\0' and then continue, in a loop.
++ // NB: mbsnrtowcs is a GNU extension
++ for (__from_next = __from, __to_next = __to;
++ __from_next < __from_end && __to_next < __to_end
++ && __ret == ok;)
++ {
++ const extern_type* __from_chunk_end;
++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
++ __from_end
++ - __from_next));
++ if (!__from_chunk_end)
++ __from_chunk_end = __from_end;
++
++ __from = __from_next;
++ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
++ __from_chunk_end - __from_next,
++ __to_end - __to_next, &__state);
++ if (__conv == static_cast<size_t>(-1))
++ {
++ // In case of error, in order to stop at the exact place we
++ // have to start again from the beginning with a series of
++ // mbrtowc.
++ for (;; ++__to_next, __from += __conv)
++ {
++ __conv = mbrtowc(__to_next, __from, __from_end - __from,
++ &__tmp_state);
++ if (__conv == static_cast<size_t>(-1)
++ || __conv == static_cast<size_t>(-2))
++ break;
++ }
++ __from_next = __from;
++ __state = __tmp_state;
++ __ret = error;
++ }
++ else if (__from_next && __from_next < __from_chunk_end)
++ {
++ // It is unclear what to return in this case (see DR 382).
++ __to_next += __conv;
++ __ret = partial;
++ }
++ else
++ {
++ __from_next = __from_chunk_end;
++ __to_next += __conv;
++ }
++
++ if (__from_next < __from_end && __ret == ok)
++ {
++ if (__to_next < __to_end)
++ {
++ // XXX Probably wrong for stateful encodings
++ __tmp_state = __state;
++ ++__from_next;
++ *__to_next++ = L'\0';
++ }
++ else
++ __ret = partial;
++ }
++ }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++
++ return __ret;
++ }
++
++ int
++ codecvt<wchar_t, char, mbstate_t>::
++ do_encoding() const throw()
++ {
++ // XXX This implementation assumes that the encoding is
++ // stateless and is either single-byte or variable-width.
++ int __ret = 0;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++ if (MB_CUR_MAX == 1)
++ __ret = 1;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return __ret;
++ }
++
++ int
++ codecvt<wchar_t, char, mbstate_t>::
++ do_max_length() const throw()
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++ // XXX Probably wrong for stateful encodings.
++ int __ret = MB_CUR_MAX;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return __ret;
++ }
++
++ int
++ codecvt<wchar_t, char, mbstate_t>::
++ do_length(state_type& __state, const extern_type* __from,
++ const extern_type* __end, size_t __max) const
++ {
++ int __ret = 0;
++ state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
++ // in case we advance past it and then continue, in a loop.
++ // NB: mbsnrtowcs is a GNU extension
++
++ // A dummy internal buffer is needed in order for mbsnrtocws to consider
++ // its fourth parameter (it wouldn't with NULL as first parameter).
++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
++ * __max));
++ while (__from < __end && __max)
++ {
++ const extern_type* __from_chunk_end;
++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
++ __end
++ - __from));
++ if (!__from_chunk_end)
++ __from_chunk_end = __end;
++
++ const extern_type* __tmp_from = __from;
++ size_t __conv = mbsnrtowcs(__to, &__from,
++ __from_chunk_end - __from,
++ __max, &__state);
++ if (__conv == static_cast<size_t>(-1))
++ {
++ // In case of error, in order to stop at the exact place we
++ // have to start again from the beginning with a series of
++ // mbrtowc.
++ for (__from = __tmp_from;; __from += __conv)
++ {
++ __conv = mbrtowc(NULL, __from, __end - __from,
++ &__tmp_state);
++ if (__conv == static_cast<size_t>(-1)
++ || __conv == static_cast<size_t>(-2))
++ break;
++ }
++ __state = __tmp_state;
++ __ret += __from - __tmp_from;
++ break;
++ }
++ if (!__from)
++ __from = __from_chunk_end;
++
++ __ret += __from - __tmp_from;
++ __max -= __conv;
++
++ if (__from < __end && __max)
++ {
++ // XXX Probably wrong for stateful encodings
++ __tmp_state = __state;
++ ++__from;
++ ++__ret;
++ --__max;
++ }
++ }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++
++ return __ret;
++ }
++#endif
++}
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,80 @@
++// std::collate implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
++#endif
++
++namespace std
++{
++ // These are basically extensions to char_traits, and perhaps should
++ // be put there instead of here.
++ template<>
++ int
++ collate<char>::_M_compare(const char* __one, const char* __two) const
++ {
++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
++ }
++
++ template<>
++ size_t
++ collate<char>::_M_transform(char* __to, const char* __from,
++ size_t __n) const
++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ int
++ collate<wchar_t>::_M_compare(const wchar_t* __one,
++ const wchar_t* __two) const
++ {
++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
++ }
++
++ template<>
++ size_t
++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
++ size_t __n) const
++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
++#endif
++}
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,300 @@
++// std::ctype implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __wctype_l(S, L) wctype((S))
++#define __towupper_l(C, L) towupper((C))
++#define __towlower_l(C, L) towlower((C))
++#define __iswctype_l(C, M, L) iswctype((C), (M))
++#endif
++
++namespace std
++{
++ // NB: The other ctype<char> specializations are in src/locale.cc and
++ // various /config/os/* files.
++ template<>
++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
++ : ctype<char>(0, false, __refs)
++ {
++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
++ {
++ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
++#ifdef __UCLIBC_HAS_XLOCALE__
++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
++ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
++#endif
++ }
++ }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ ctype<wchar_t>::__wmask_type
++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
++ {
++ __wmask_type __ret;
++ switch (__m)
++ {
++ case space:
++ __ret = __wctype_l("space", _M_c_locale_ctype);
++ break;
++ case print:
++ __ret = __wctype_l("print", _M_c_locale_ctype);
++ break;
++ case cntrl:
++ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
++ break;
++ case upper:
++ __ret = __wctype_l("upper", _M_c_locale_ctype);
++ break;
++ case lower:
++ __ret = __wctype_l("lower", _M_c_locale_ctype);
++ break;
++ case alpha:
++ __ret = __wctype_l("alpha", _M_c_locale_ctype);
++ break;
++ case digit:
++ __ret = __wctype_l("digit", _M_c_locale_ctype);
++ break;
++ case punct:
++ __ret = __wctype_l("punct", _M_c_locale_ctype);
++ break;
++ case xdigit:
++ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
++ break;
++ case alnum:
++ __ret = __wctype_l("alnum", _M_c_locale_ctype);
++ break;
++ case graph:
++ __ret = __wctype_l("graph", _M_c_locale_ctype);
++ break;
++ default:
++ __ret = __wmask_type();
++ }
++ return __ret;
++ }
++
++ wchar_t
++ ctype<wchar_t>::do_toupper(wchar_t __c) const
++ { return __towupper_l(__c, _M_c_locale_ctype); }
++
++ const wchar_t*
++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi)
++ {
++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
++ ++__lo;
++ }
++ return __hi;
++ }
++
++ wchar_t
++ ctype<wchar_t>::do_tolower(wchar_t __c) const
++ { return __towlower_l(__c, _M_c_locale_ctype); }
++
++ const wchar_t*
++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi)
++ {
++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
++ ++__lo;
++ }
++ return __hi;
++ }
++
++ bool
++ ctype<wchar_t>::
++ do_is(mask __m, wchar_t __c) const
++ {
++ // Highest bitmask in ctype_base == 10, but extra in "C"
++ // library for blank.
++ bool __ret = false;
++ const size_t __bitmasksize = 11;
++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
++ if (__m & _M_bit[__bitcur]
++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
++ {
++ __ret = true;
++ break;
++ }
++ return __ret;
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
++ {
++ for (; __lo < __hi; ++__vec, ++__lo)
++ {
++ // Highest bitmask in ctype_base == 10, but extra in "C"
++ // library for blank.
++ const size_t __bitmasksize = 11;
++ mask __m = 0;
++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
++ __m |= _M_bit[__bitcur];
++ *__vec = __m;
++ }
++ return __hi;
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi && !this->do_is(__m, *__lo))
++ ++__lo;
++ return __lo;
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
++ {
++ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
++ ++__lo;
++ return __lo;
++ }
++
++ wchar_t
++ ctype<wchar_t>::
++ do_widen(char __c) const
++ { return _M_widen[static_cast<unsigned char>(__c)]; }
++
++ const char*
++ ctype<wchar_t>::
++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
++ {
++ while (__lo < __hi)
++ {
++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
++ ++__lo;
++ ++__dest;
++ }
++ return __hi;
++ }
++
++ char
++ ctype<wchar_t>::
++ do_narrow(wchar_t __wc, char __dfault) const
++ {
++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
++ return _M_narrow[__wc];
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++ const int __c = wctob(__wc);
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return (__c == EOF ? __dfault : static_cast<char>(__c));
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
++ char* __dest) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++ if (_M_narrow_ok)
++ while (__lo < __hi)
++ {
++ if (*__lo >= 0 && *__lo < 128)
++ *__dest = _M_narrow[*__lo];
++ else
++ {
++ const int __c = wctob(*__lo);
++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++ }
++ ++__lo;
++ ++__dest;
++ }
++ else
++ while (__lo < __hi)
++ {
++ const int __c = wctob(*__lo);
++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++ ++__lo;
++ ++__dest;
++ }
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return __hi;
++ }
++
++ void
++ ctype<wchar_t>::_M_initialize_ctype()
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++ wint_t __i;
++ for (__i = 0; __i < 128; ++__i)
++ {
++ const int __c = wctob(__i);
++ if (__c == EOF)
++ break;
++ else
++ _M_narrow[__i] = static_cast<char>(__c);
++ }
++ if (__i == 128)
++ _M_narrow_ok = true;
++ else
++ _M_narrow_ok = false;
++ for (size_t __j = 0;
++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
++ _M_widen[__j] = btowc(__j);
++
++ for (size_t __k = 0; __k <= 11; ++__k)
++ {
++ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
++ }
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ }
++#endif // _GLIBCXX_USE_WCHAR_T
++}
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,100 @@
++// std::messages implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix gettext stuff
++#endif
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++extern "C" char *__dcgettext(const char *domainname,
++ const char *msgid, int category);
++#undef gettext
++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
++#else
++#undef gettext
++#define gettext(msgid) (msgid)
++#endif
++
++namespace std
++{
++ // Specializations.
++ template<>
++ string
++ messages<char>::do_get(catalog, int, int, const string& __dfault) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_messages);
++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
++ __uselocale(__old);
++ return string(__msg);
++#elif defined __UCLIBC_HAS_LOCALE__
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_messages);
++ const char* __msg = gettext(__dfault.c_str());
++ setlocale(LC_ALL, __old);
++ free(__old);
++ return string(__msg);
++#else
++ const char* __msg = gettext(__dfault.c_str());
++ return string(__msg);
++#endif
++ }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ wstring
++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
++ {
++# ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_messages);
++ char* __msg = gettext(_M_convert_to_char(__dfault));
++ __uselocale(__old);
++ return _M_convert_from_char(__msg);
++# elif defined __UCLIBC_HAS_LOCALE__
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_messages);
++ char* __msg = gettext(_M_convert_to_char(__dfault));
++ setlocale(LC_ALL, __old);
++ free(__old);
++ return _M_convert_from_char(__msg);
++# else
++ char* __msg = gettext(_M_convert_to_char(__dfault));
++ return _M_convert_from_char(__msg);
++# endif
++ }
++#endif
++}
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,118 @@
++// std::messages implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.7.1.2 messages functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix prototypes for *textdomain funcs
++#endif
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++extern "C" char *__textdomain(const char *domainname);
++extern "C" char *__bindtextdomain(const char *domainname,
++ const char *dirname);
++#else
++#undef __textdomain
++#undef __bindtextdomain
++#define __textdomain(D) ((void)0)
++#define __bindtextdomain(D,P) ((void)0)
++#endif
++
++ // Non-virtual member functions.
++ template<typename _CharT>
++ messages<_CharT>::messages(size_t __refs)
++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
++ _M_name_messages(_S_get_c_name())
++ { }
++
++ template<typename _CharT>
++ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
++ size_t __refs)
++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
++ _M_name_messages(__s)
++ {
++ char* __tmp = new char[std::strlen(__s) + 1];
++ std::strcpy(__tmp, __s);
++ _M_name_messages = __tmp;
++ }
++
++ template<typename _CharT>
++ typename messages<_CharT>::catalog
++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
++ const char* __dir) const
++ {
++ __bindtextdomain(__s.c_str(), __dir);
++ return this->do_open(__s, __loc);
++ }
++
++ // Virtual member functions.
++ template<typename _CharT>
++ messages<_CharT>::~messages()
++ {
++ if (_M_name_messages != _S_get_c_name())
++ delete [] _M_name_messages;
++ _S_destroy_c_locale(_M_c_locale_messages);
++ }
++
++ template<typename _CharT>
++ typename messages<_CharT>::catalog
++ messages<_CharT>::do_open(const basic_string<char>& __s,
++ const locale&) const
++ {
++ // No error checking is done, assume the catalog exists and can
++ // be used.
++ __textdomain(__s.c_str());
++ return 0;
++ }
++
++ template<typename _CharT>
++ void
++ messages<_CharT>::do_close(catalog) const
++ { }
++
++ // messages_byname
++ template<typename _CharT>
++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
++ : messages<_CharT>(__refs)
++ {
++ if (this->_M_name_messages != locale::facet::_S_get_c_name())
++ delete [] this->_M_name_messages;
++ char* __tmp = new char[std::strlen(__s) + 1];
++ std::strcpy(__tmp, __s);
++ this->_M_name_messages = __tmp;
++
++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
++ {
++ this->_S_destroy_c_locale(this->_M_c_locale_messages);
++ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
++ }
++ }
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500
+@@ -0,0 +1,692 @@
++// std::moneypunct implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning optimize this for uclibc
++#warning tailor for stub locale support
++#endif
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __nl_langinfo_l(N, L) nl_langinfo((N))
++#endif
++
++namespace std
++{
++ // Construct and return valid pattern consisting of some combination of:
++ // space none symbol sign value
++ money_base::pattern
++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
++ {
++ pattern __ret;
++
++ // This insanely complicated routine attempts to construct a valid
++ // pattern for use with monyepunct. A couple of invariants:
++
++ // if (__precedes) symbol -> value
++ // else value -> symbol
++
++ // if (__space) space
++ // else none
++
++ // none == never first
++ // space never first or last
++
++ // Any elegant implementations of this are welcome.
++ switch (__posn)
++ {
++ case 0:
++ case 1:
++ // 1 The sign precedes the value and symbol.
++ __ret.field[0] = sign;
++ if (__space)
++ {
++ // Pattern starts with sign.
++ if (__precedes)
++ {
++ __ret.field[1] = symbol;
++ __ret.field[3] = value;
++ }
++ else
++ {
++ __ret.field[1] = value;
++ __ret.field[3] = symbol;
++ }
++ __ret.field[2] = space;
++ }
++ else
++ {
++ // Pattern starts with sign and ends with none.
++ if (__precedes)
++ {
++ __ret.field[1] = symbol;
++ __ret.field[2] = value;
++ }
++ else
++ {
++ __ret.field[1] = value;
++ __ret.field[2] = symbol;
++ }
++ __ret.field[3] = none;
++ }
++ break;
++ case 2:
++ // 2 The sign follows the value and symbol.
++ if (__space)
++ {
++ // Pattern either ends with sign.
++ if (__precedes)
++ {
++ __ret.field[0] = symbol;
++ __ret.field[2] = value;
++ }
++ else
++ {
++ __ret.field[0] = value;
++ __ret.field[2] = symbol;
++ }
++ __ret.field[1] = space;
++ __ret.field[3] = sign;
++ }
++ else
++ {
++ // Pattern ends with sign then none.
++ if (__precedes)
++ {
++ __ret.field[0] = symbol;
++ __ret.field[1] = value;
++ }
++ else
++ {
++ __ret.field[0] = value;
++ __ret.field[1] = symbol;
++ }
++ __ret.field[2] = sign;
++ __ret.field[3] = none;
++ }
++ break;
++ case 3:
++ // 3 The sign immediately precedes the symbol.
++ if (__precedes)
++ {
++ __ret.field[0] = sign;
++ __ret.field[1] = symbol;
++ if (__space)
++ {
++ __ret.field[2] = space;
++ __ret.field[3] = value;
++ }
++ else
++ {
++ __ret.field[2] = value;
++ __ret.field[3] = none;
++ }
++ }
++ else
++ {
++ __ret.field[0] = value;
++ if (__space)
++ {
++ __ret.field[1] = space;
++ __ret.field[2] = sign;
++ __ret.field[3] = symbol;
++ }
++ else
++ {
++ __ret.field[1] = sign;
++ __ret.field[2] = symbol;
++ __ret.field[3] = none;
++ }
++ }
++ break;
++ case 4:
++ // 4 The sign immediately follows the symbol.
++ if (__precedes)
++ {
++ __ret.field[0] = symbol;
++ __ret.field[1] = sign;
++ if (__space)
++ {
++ __ret.field[2] = space;
++ __ret.field[3] = value;
++ }
++ else
++ {
++ __ret.field[2] = value;
++ __ret.field[3] = none;
++ }
++ }
++ else
++ {
++ __ret.field[0] = value;
++ if (__space)
++ {
++ __ret.field[1] = space;
++ __ret.field[2] = symbol;
++ __ret.field[3] = sign;
++ }
++ else
++ {
++ __ret.field[1] = symbol;
++ __ret.field[2] = sign;
++ __ret.field[3] = none;
++ }
++ }
++ break;
++ default:
++ __ret = pattern();
++ }
++ return __ret;
++ }
++
++ template<>
++ void
++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
++ const char*)
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<char, true>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = '.';
++ _M_data->_M_thousands_sep = ',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = "";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = "";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = "";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
++ }
++ else
++ {
++ // Named locale.
++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
++ __cloc));
++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
++ __cloc));
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
++
++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
++ if (!__nposn)
++ _M_data->_M_negative_sign = "()";
++ else
++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
++ __cloc);
++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
++
++ // _Intl == true
++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
++ __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++ }
++ }
++
++ template<>
++ void
++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
++ const char*)
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<char, false>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = '.';
++ _M_data->_M_thousands_sep = ',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = "";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = "";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = "";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
++ }
++ else
++ {
++ // Named locale.
++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
++ __cloc));
++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
++ __cloc));
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
++
++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
++ if (!__nposn)
++ _M_data->_M_negative_sign = "()";
++ else
++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
++ __cloc);
++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
++
++ // _Intl == false
++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++ }
++ }
++
++ template<>
++ moneypunct<char, true>::~moneypunct()
++ { delete _M_data; }
++
++ template<>
++ moneypunct<char, false>::~moneypunct()
++ { delete _M_data; }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ void
++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
++#ifdef __UCLIBC_HAS_XLOCALE__
++ const char*)
++#else
++ const char* __name)
++#endif
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<wchar_t, true>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = L'.';
++ _M_data->_M_thousands_sep = L',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ // Use ctype::widen code without the facet...
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] =
++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
++ }
++ else
++ {
++ // Named locale.
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(__cloc);
++#else
++ // Switch to named locale so that mbsrtowcs will work.
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, __name);
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this... should be monetary
++#endif
++#ifdef __UCLIBC__
++# ifdef __UCLIBC_HAS_XLOCALE__
++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
++# else
++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
++# endif
++#else
++ union { char *__s; wchar_t __w; } __u;
++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
++ _M_data->_M_decimal_point = __u.__w;
++
++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
++ _M_data->_M_thousands_sep = __u.__w;
++#endif
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++
++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
++
++ wchar_t* __wcs_ps = 0;
++ wchar_t* __wcs_ns = 0;
++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
++ try
++ {
++ mbstate_t __state;
++ size_t __len = strlen(__cpossign);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ps = new wchar_t[__len];
++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
++ _M_data->_M_positive_sign = __wcs_ps;
++ }
++ else
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
++
++ __len = strlen(__cnegsign);
++ if (!__nposn)
++ _M_data->_M_negative_sign = L"()";
++ else if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ns = new wchar_t[__len];
++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
++ _M_data->_M_negative_sign = __wcs_ns;
++ }
++ else
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
++
++ // _Intl == true.
++ __len = strlen(__ccurr);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ wchar_t* __wcs = new wchar_t[__len];
++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
++ _M_data->_M_curr_symbol = __wcs;
++ }
++ else
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
++ }
++ catch (...)
++ {
++ delete _M_data;
++ _M_data = 0;
++ delete __wcs_ps;
++ delete __wcs_ns;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ __throw_exception_again;
++ }
++
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
++ __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ }
++ }
++
++ template<>
++ void
++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
++#ifdef __UCLIBC_HAS_XLOCALE__
++ const char*)
++#else
++ const char* __name)
++#endif
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<wchar_t, false>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = L'.';
++ _M_data->_M_thousands_sep = L',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ // Use ctype::widen code without the facet...
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] =
++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
++ }
++ else
++ {
++ // Named locale.
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(__cloc);
++#else
++ // Switch to named locale so that mbsrtowcs will work.
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, __name);
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this... should be monetary
++#endif
++#ifdef __UCLIBC__
++# ifdef __UCLIBC_HAS_XLOCALE__
++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
++# else
++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
++# endif
++#else
++ union { char *__s; wchar_t __w; } __u;
++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
++ _M_data->_M_decimal_point = __u.__w;
++
++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
++ _M_data->_M_thousands_sep = __u.__w;
++#endif
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++
++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
++
++ wchar_t* __wcs_ps = 0;
++ wchar_t* __wcs_ns = 0;
++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
++ try
++ {
++ mbstate_t __state;
++ size_t __len;
++ __len = strlen(__cpossign);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ps = new wchar_t[__len];
++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
++ _M_data->_M_positive_sign = __wcs_ps;
++ }
++ else
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
++
++ __len = strlen(__cnegsign);
++ if (!__nposn)
++ _M_data->_M_negative_sign = L"()";
++ else if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ns = new wchar_t[__len];
++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
++ _M_data->_M_negative_sign = __wcs_ns;
++ }
++ else
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
++
++ // _Intl == true.
++ __len = strlen(__ccurr);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ wchar_t* __wcs = new wchar_t[__len];
++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
++ _M_data->_M_curr_symbol = __wcs;
++ }
++ else
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
++ }
++ catch (...)
++ {
++ delete _M_data;
++ _M_data = 0;
++ delete __wcs_ps;
++ delete __wcs_ns;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ __throw_exception_again;
++ }
++
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ }
++ }
++
++ template<>
++ moneypunct<wchar_t, true>::~moneypunct()
++ {
++ if (_M_data->_M_positive_sign_size)
++ delete [] _M_data->_M_positive_sign;
++ if (_M_data->_M_negative_sign_size
++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
++ delete [] _M_data->_M_negative_sign;
++ if (_M_data->_M_curr_symbol_size)
++ delete [] _M_data->_M_curr_symbol;
++ delete _M_data;
++ }
++
++ template<>
++ moneypunct<wchar_t, false>::~moneypunct()
++ {
++ if (_M_data->_M_positive_sign_size)
++ delete [] _M_data->_M_positive_sign;
++ if (_M_data->_M_negative_sign_size
++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
++ delete [] _M_data->_M_negative_sign;
++ if (_M_data->_M_curr_symbol_size)
++ delete [] _M_data->_M_curr_symbol;
++ delete _M_data;
++ }
++#endif
++}
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500
+@@ -0,0 +1,173 @@
++// std::numpunct implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning tailor for stub locale support
++#endif
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __nl_langinfo_l(N, L) nl_langinfo((N))
++#endif
++
++namespace std
++{
++ template<>
++ void
++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __numpunct_cache<char>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_use_grouping = false;
++
++ _M_data->_M_decimal_point = '.';
++ _M_data->_M_thousands_sep = ',';
++
++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
++
++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
++ }
++ else
++ {
++ // Named locale.
++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
++ __cloc));
++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
++ __cloc));
++
++ // Check for NULL, which implies no grouping.
++ if (_M_data->_M_thousands_sep == '\0')
++ _M_data->_M_grouping = "";
++ else
++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ }
++
++ // NB: There is no way to extact this info from posix locales.
++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
++ _M_data->_M_truename = "true";
++ _M_data->_M_truename_size = 4;
++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
++ _M_data->_M_falsename = "false";
++ _M_data->_M_falsename_size = 5;
++ }
++
++ template<>
++ numpunct<char>::~numpunct()
++ { delete _M_data; }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ void
++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __numpunct_cache<wchar_t>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_use_grouping = false;
++
++ _M_data->_M_decimal_point = L'.';
++ _M_data->_M_thousands_sep = L',';
++
++ // Use ctype::widen code without the facet...
++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
++ _M_data->_M_atoms_out[__i] =
++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
++
++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
++ _M_data->_M_atoms_in[__j] =
++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
++ }
++ else
++ {
++ // Named locale.
++ // NB: In the GNU model wchar_t is always 32 bit wide.
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this
++#endif
++#ifdef __UCLIBC__
++# ifdef __UCLIBC_HAS_XLOCALE__
++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
++# else
++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
++# endif
++#else
++ union { char *__s; wchar_t __w; } __u;
++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
++ _M_data->_M_decimal_point = __u.__w;
++
++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
++ _M_data->_M_thousands_sep = __u.__w;
++#endif
++
++ if (_M_data->_M_thousands_sep == L'\0')
++ _M_data->_M_grouping = "";
++ else
++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ }
++
++ // NB: There is no way to extact this info from posix locales.
++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
++ _M_data->_M_truename = L"true";
++ _M_data->_M_truename_size = 4;
++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
++ _M_data->_M_falsename = L"false";
++ _M_data->_M_falsename_size = 5;
++ }
++
++ template<>
++ numpunct<wchar_t>::~numpunct()
++ { delete _M_data; }
++ #endif
++}
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500
+@@ -0,0 +1,406 @@
++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning tailor for stub locale support
++#endif
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __nl_langinfo_l(N, L) nl_langinfo((N))
++#endif
++
++namespace std
++{
++ template<>
++ void
++ __timepunct<char>::
++ _M_put(char* __s, size_t __maxlen, const char* __format,
++ const tm* __tm) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
++ _M_c_locale_timepunct);
++#else
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_timepunct);
++ const size_t __len = strftime(__s, __maxlen, __format, __tm);
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ // Make sure __s is null terminated.
++ if (__len == 0)
++ __s[0] = '\0';
++ }
++
++ template<>
++ void
++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __timepunct_cache<char>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_c_locale_timepunct = _S_get_c_locale();
++
++ _M_data->_M_date_format = "%m/%d/%y";
++ _M_data->_M_date_era_format = "%m/%d/%y";
++ _M_data->_M_time_format = "%H:%M:%S";
++ _M_data->_M_time_era_format = "%H:%M:%S";
++ _M_data->_M_date_time_format = "";
++ _M_data->_M_date_time_era_format = "";
++ _M_data->_M_am = "AM";
++ _M_data->_M_pm = "PM";
++ _M_data->_M_am_pm_format = "";
++
++ // Day names, starting with "C"'s Sunday.
++ _M_data->_M_day1 = "Sunday";
++ _M_data->_M_day2 = "Monday";
++ _M_data->_M_day3 = "Tuesday";
++ _M_data->_M_day4 = "Wednesday";
++ _M_data->_M_day5 = "Thursday";
++ _M_data->_M_day6 = "Friday";
++ _M_data->_M_day7 = "Saturday";
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ _M_data->_M_aday1 = "Sun";
++ _M_data->_M_aday2 = "Mon";
++ _M_data->_M_aday3 = "Tue";
++ _M_data->_M_aday4 = "Wed";
++ _M_data->_M_aday5 = "Thu";
++ _M_data->_M_aday6 = "Fri";
++ _M_data->_M_aday7 = "Sat";
++
++ // Month names, starting with "C"'s January.
++ _M_data->_M_month01 = "January";
++ _M_data->_M_month02 = "February";
++ _M_data->_M_month03 = "March";
++ _M_data->_M_month04 = "April";
++ _M_data->_M_month05 = "May";
++ _M_data->_M_month06 = "June";
++ _M_data->_M_month07 = "July";
++ _M_data->_M_month08 = "August";
++ _M_data->_M_month09 = "September";
++ _M_data->_M_month10 = "October";
++ _M_data->_M_month11 = "November";
++ _M_data->_M_month12 = "December";
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ _M_data->_M_amonth01 = "Jan";
++ _M_data->_M_amonth02 = "Feb";
++ _M_data->_M_amonth03 = "Mar";
++ _M_data->_M_amonth04 = "Apr";
++ _M_data->_M_amonth05 = "May";
++ _M_data->_M_amonth06 = "Jun";
++ _M_data->_M_amonth07 = "Jul";
++ _M_data->_M_amonth08 = "Aug";
++ _M_data->_M_amonth09 = "Sep";
++ _M_data->_M_amonth10 = "Oct";
++ _M_data->_M_amonth11 = "Nov";
++ _M_data->_M_amonth12 = "Dec";
++ }
++ else
++ {
++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
++
++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
++ __cloc);
++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
++
++ // Day names, starting with "C"'s Sunday.
++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
++
++ // Month names, starting with "C"'s January.
++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
++ }
++ }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ void
++ __timepunct<wchar_t>::
++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
++ const tm* __tm) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
++ _M_c_locale_timepunct);
++#else
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_timepunct);
++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ // Make sure __s is null terminated.
++ if (__len == 0)
++ __s[0] = L'\0';
++ }
++
++ template<>
++ void
++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __timepunct_cache<wchar_t>;
++
++#warning wide time stuff
++// if (!__cloc)
++ {
++ // "C" locale
++ _M_c_locale_timepunct = _S_get_c_locale();
++
++ _M_data->_M_date_format = L"%m/%d/%y";
++ _M_data->_M_date_era_format = L"%m/%d/%y";
++ _M_data->_M_time_format = L"%H:%M:%S";
++ _M_data->_M_time_era_format = L"%H:%M:%S";
++ _M_data->_M_date_time_format = L"";
++ _M_data->_M_date_time_era_format = L"";
++ _M_data->_M_am = L"AM";
++ _M_data->_M_pm = L"PM";
++ _M_data->_M_am_pm_format = L"";
++
++ // Day names, starting with "C"'s Sunday.
++ _M_data->_M_day1 = L"Sunday";
++ _M_data->_M_day2 = L"Monday";
++ _M_data->_M_day3 = L"Tuesday";
++ _M_data->_M_day4 = L"Wednesday";
++ _M_data->_M_day5 = L"Thursday";
++ _M_data->_M_day6 = L"Friday";
++ _M_data->_M_day7 = L"Saturday";
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ _M_data->_M_aday1 = L"Sun";
++ _M_data->_M_aday2 = L"Mon";
++ _M_data->_M_aday3 = L"Tue";
++ _M_data->_M_aday4 = L"Wed";
++ _M_data->_M_aday5 = L"Thu";
++ _M_data->_M_aday6 = L"Fri";
++ _M_data->_M_aday7 = L"Sat";
++
++ // Month names, starting with "C"'s January.
++ _M_data->_M_month01 = L"January";
++ _M_data->_M_month02 = L"February";
++ _M_data->_M_month03 = L"March";
++ _M_data->_M_month04 = L"April";
++ _M_data->_M_month05 = L"May";
++ _M_data->_M_month06 = L"June";
++ _M_data->_M_month07 = L"July";
++ _M_data->_M_month08 = L"August";
++ _M_data->_M_month09 = L"September";
++ _M_data->_M_month10 = L"October";
++ _M_data->_M_month11 = L"November";
++ _M_data->_M_month12 = L"December";
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ _M_data->_M_amonth01 = L"Jan";
++ _M_data->_M_amonth02 = L"Feb";
++ _M_data->_M_amonth03 = L"Mar";
++ _M_data->_M_amonth04 = L"Apr";
++ _M_data->_M_amonth05 = L"May";
++ _M_data->_M_amonth06 = L"Jun";
++ _M_data->_M_amonth07 = L"Jul";
++ _M_data->_M_amonth08 = L"Aug";
++ _M_data->_M_amonth09 = L"Sep";
++ _M_data->_M_amonth10 = L"Oct";
++ _M_data->_M_amonth11 = L"Nov";
++ _M_data->_M_amonth12 = L"Dec";
++ }
++#if 0
++ else
++ {
++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
++
++ union { char *__s; wchar_t *__w; } __u;
++
++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
++ _M_data->_M_date_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
++ _M_data->_M_date_era_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
++ _M_data->_M_time_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
++ _M_data->_M_time_era_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
++ _M_data->_M_date_time_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
++ _M_data->_M_date_time_era_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
++ _M_data->_M_am = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
++ _M_data->_M_pm = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
++ _M_data->_M_am_pm_format = __u.__w;
++
++ // Day names, starting with "C"'s Sunday.
++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
++ _M_data->_M_day1 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
++ _M_data->_M_day2 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
++ _M_data->_M_day3 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
++ _M_data->_M_day4 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
++ _M_data->_M_day5 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
++ _M_data->_M_day6 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
++ _M_data->_M_day7 = __u.__w;
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
++ _M_data->_M_aday1 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
++ _M_data->_M_aday2 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
++ _M_data->_M_aday3 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
++ _M_data->_M_aday4 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
++ _M_data->_M_aday5 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
++ _M_data->_M_aday6 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
++ _M_data->_M_aday7 = __u.__w;
++
++ // Month names, starting with "C"'s January.
++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
++ _M_data->_M_month01 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
++ _M_data->_M_month02 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
++ _M_data->_M_month03 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
++ _M_data->_M_month04 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
++ _M_data->_M_month05 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
++ _M_data->_M_month06 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
++ _M_data->_M_month07 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
++ _M_data->_M_month08 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
++ _M_data->_M_month09 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
++ _M_data->_M_month10 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
++ _M_data->_M_month11 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
++ _M_data->_M_month12 = __u.__w;
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
++ _M_data->_M_amonth01 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
++ _M_data->_M_amonth02 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
++ _M_data->_M_amonth03 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
++ _M_data->_M_amonth04 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
++ _M_data->_M_amonth05 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
++ _M_data->_M_amonth06 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
++ _M_data->_M_amonth07 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
++ _M_data->_M_amonth08 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
++ _M_data->_M_amonth09 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
++ _M_data->_M_amonth10 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
++ _M_data->_M_amonth11 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
++ _M_data->_M_amonth12 = __u.__w;
++ }
++#endif // 0
++ }
++#endif
++}
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h
+--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500
+@@ -0,0 +1,68 @@
++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++ template<typename _CharT>
++ __timepunct<_CharT>::__timepunct(size_t __refs)
++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
++ _M_name_timepunct(_S_get_c_name())
++ { _M_initialize_timepunct(); }
++
++ template<typename _CharT>
++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
++ _M_name_timepunct(_S_get_c_name())
++ { _M_initialize_timepunct(); }
++
++ template<typename _CharT>
++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
++ size_t __refs)
++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
++ _M_name_timepunct(__s)
++ {
++ char* __tmp = new char[std::strlen(__s) + 1];
++ std::strcpy(__tmp, __s);
++ _M_name_timepunct = __tmp;
++ _M_initialize_timepunct(__cloc);
++ }
++
++ template<typename _CharT>
++ __timepunct<_CharT>::~__timepunct()
++ {
++ if (_M_name_timepunct != _S_get_c_name())
++ delete [] _M_name_timepunct;
++ delete _M_data;
++ _S_destroy_c_locale(_M_c_locale_timepunct);
++ }
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h
+--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500
+@@ -0,0 +1,64 @@
++// Locale support -*- C++ -*-
++
++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
++// Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.1 Locales
++//
++
++/** @file ctype_base.h
++ * This is an internal header file, included by other library headers.
++ * You should not attempt to use it directly.
++ */
++
++// Information as gleaned from /usr/include/ctype.h
++
++ /// @brief Base class for ctype.
++ struct ctype_base
++ {
++ // Note: In uClibc, the following two types depend on configuration.
++
++ // Non-standard typedefs.
++ typedef const __ctype_touplow_t* __to_type;
++
++ // NB: Offsets into ctype<char>::_M_table force a particular size
++ // on the mask type. Because of this, we don't use an enum.
++ typedef __ctype_mask_t mask;
++ static const mask upper = _ISupper;
++ static const mask lower = _ISlower;
++ static const mask alpha = _ISalpha;
++ static const mask digit = _ISdigit;
++ static const mask xdigit = _ISxdigit;
++ static const mask space = _ISspace;
++ static const mask print = _ISprint;
++ static const mask graph = _ISalpha | _ISdigit | _ISpunct;
++ static const mask cntrl = _IScntrl;
++ static const mask punct = _ISpunct;
++ static const mask alnum = _ISalpha | _ISdigit;
++ };
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h
+--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500
+@@ -0,0 +1,69 @@
++// Locale support -*- C++ -*-
++
++// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.1 Locales
++//
++
++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
++// functions go in ctype.cc
++
++ bool
++ ctype<char>::
++ is(mask __m, char __c) const
++ { return _M_table[static_cast<unsigned char>(__c)] & __m; }
++
++ const char*
++ ctype<char>::
++ is(const char* __low, const char* __high, mask* __vec) const
++ {
++ while (__low < __high)
++ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
++ return __high;
++ }
++
++ const char*
++ ctype<char>::
++ scan_is(mask __m, const char* __low, const char* __high) const
++ {
++ while (__low < __high
++ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
++ ++__low;
++ return __low;
++ }
++
++ const char*
++ ctype<char>::
++ scan_not(mask __m, const char* __low, const char* __high) const
++ {
++ while (__low < __high
++ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
++ ++__low;
++ return __low;
++ }
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h
+--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500
+@@ -0,0 +1,92 @@
++// Locale support -*- C++ -*-
++
++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
++// Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.1 Locales
++//
++
++// Information as gleaned from /usr/include/ctype.h
++
++ const ctype_base::mask*
++ ctype<char>::classic_table() throw()
++ { return __C_ctype_b; }
++
++ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
++ size_t __refs)
++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
++ {
++ _M_toupper = __C_ctype_toupper;
++ _M_tolower = __C_ctype_tolower;
++ _M_table = __table ? __table : __C_ctype_b;
++ memset(_M_widen, 0, sizeof(_M_widen));
++ memset(_M_narrow, 0, sizeof(_M_narrow));
++ }
++
++ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
++ {
++ _M_toupper = __C_ctype_toupper;
++ _M_tolower = __C_ctype_tolower;
++ _M_table = __table ? __table : __C_ctype_b;
++ memset(_M_widen, 0, sizeof(_M_widen));
++ memset(_M_narrow, 0, sizeof(_M_narrow));
++ }
++
++ char
++ ctype<char>::do_toupper(char __c) const
++ { return _M_toupper[static_cast<unsigned char>(__c)]; }
++
++ const char*
++ ctype<char>::do_toupper(char* __low, const char* __high) const
++ {
++ while (__low < __high)
++ {
++ *__low = _M_toupper[static_cast<unsigned char>(*__low)];
++ ++__low;
++ }
++ return __high;
++ }
++
++ char
++ ctype<char>::do_tolower(char __c) const
++ { return _M_tolower[static_cast<unsigned char>(__c)]; }
++
++ const char*
++ ctype<char>::do_tolower(char* __low, const char* __high) const
++ {
++ while (__low < __high)
++ {
++ *__low = _M_tolower[static_cast<unsigned char>(*__low)];
++ ++__low;
++ }
++ return __high;
++ }
+diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h
+--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500
+@@ -0,0 +1,44 @@
++// Specific definitions for GNU/Linux -*- C++ -*-
++
++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++#ifndef _GLIBCXX_OS_DEFINES
++#define _GLIBCXX_OS_DEFINES 1
++
++// System-specific #define, typedefs, corrections, etc, go here. This
++// file will come before all others.
++
++// This keeps isanum, et al from being propagated as macros.
++#define __NO_CTYPE 1
++
++#include <features.h>
++
++// We must not see the optimized string functions GNU libc defines.
++#define __NO_STRING_INLINES
++
++#endif
+diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure
+--- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500
++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500
+@@ -3998,6 +3998,11 @@
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -5672,7 +5677,7 @@
+ enableval="$enable_clocale"
+
+ case "$enableval" in
+- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
+ *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
+ echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
+ { (exit 1); exit 1; }; } ;;
+@@ -5697,6 +5702,9 @@
+ # Default to "generic".
+ if test $enable_clocale_flag = auto; then
+ case ${target_os} in
++ linux-uclibc*)
++ enable_clocale_flag=uclibc
++ ;;
+ linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+@@ -5927,6 +5935,76 @@
+ CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+ ;;
++ uclibc)
++ echo "$as_me:$LINENO: result: uclibc" >&5
++echo "${ECHO_T}uclibc" >&6
++
++ # Declare intention to use gettext, and add support for specific
++ # languages.
++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
++ ALL_LINGUAS="de fr"
++
++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
++ # Extract the first word of "msgfmt", so it can be a program name with args.
++set dummy msgfmt; ac_word=$2
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_check_msgfmt+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ if test -n "$check_msgfmt"; then
++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ ac_cv_prog_check_msgfmt="yes"
++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++done
++
++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
++fi
++fi
++check_msgfmt=$ac_cv_prog_check_msgfmt
++if test -n "$check_msgfmt"; then
++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
++echo "${ECHO_T}$check_msgfmt" >&6
++else
++ echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++fi
++
++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
++ USE_NLS=yes
++ fi
++ # Export the build objects.
++ for ling in $ALL_LINGUAS; do \
++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
++ done
++
++
++
++ CLOCALE_H=config/locale/uclibc/c_locale.h
++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
++ CMESSAGES_H=config/locale/uclibc/messages_members.h
++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
++ CTIME_H=config/locale/uclibc/time_members.h
++ CTIME_CC=config/locale/uclibc/time_members.cc
++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
++ ;;
+ esac
+
+ # This is where the testsuite looks for locale catalogs, using the
+diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host
+--- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500
++++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500
+@@ -249,6 +249,12 @@
+ ;;
+ esac
+
++# Override for uClibc since linux-uclibc gets mishandled above.
++case "${host_os}" in
++ *-uclibc*)
++ os_include_dir="os/uclibc"
++ ;;
++esac
+
+ # Set any OS-dependent and CPU-dependent bits.
+ # THIS TABLE IS SORTED. KEEP IT THAT WAY.
+diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4
+--- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500
++++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500
+@@ -142,6 +142,98 @@
+ ;;
+ esac
+ ;;
++ *-uclibc*)
++# Temporary hack until we implement the float versions of the libm funcs
++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
++ machine/endian.h machine/param.h sys/machine.h sys/types.h \
++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
++ SECTION_FLAGS='-ffunction-sections -fdata-sections'
++ AC_SUBST(SECTION_FLAGS)
++ GLIBCXX_CHECK_LINKER_FEATURES
++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
++ GLIBCXX_CHECK_WCHAR_T_SUPPORT
++
++ # For LFS.
++ AC_DEFINE(HAVE_INT64_T)
++ case "$target" in
++ *-uclinux*)
++ # Don't enable LFS with uClinux
++ ;;
++ *)
++ AC_DEFINE(_GLIBCXX_USE_LFS)
++ esac
++
++ # For showmanyc_helper().
++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
++ GLIBCXX_CHECK_POLL
++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
++
++ # For xsputn_2().
++ AC_CHECK_HEADERS(sys/uio.h)
++ GLIBCXX_CHECK_WRITEV
++
++# AC_DEFINE(HAVE_ACOSF)
++# AC_DEFINE(HAVE_ASINF)
++# AC_DEFINE(HAVE_ATANF)
++# AC_DEFINE(HAVE_ATAN2F)
++ AC_DEFINE(HAVE_CEILF)
++ AC_DEFINE(HAVE_COPYSIGN)
++# AC_DEFINE(HAVE_COPYSIGNF)
++# AC_DEFINE(HAVE_COSF)
++# AC_DEFINE(HAVE_COSHF)
++# AC_DEFINE(HAVE_EXPF)
++# AC_DEFINE(HAVE_FABSF)
++ AC_DEFINE(HAVE_FINITE)
++ AC_DEFINE(HAVE_FINITEF)
++ AC_DEFINE(HAVE_FLOORF)
++# AC_DEFINE(HAVE_FMODF)
++# AC_DEFINE(HAVE_FREXPF)
++ AC_DEFINE(HAVE_HYPOT)
++# AC_DEFINE(HAVE_HYPOTF)
++ AC_DEFINE(HAVE_ISINF)
++ AC_DEFINE(HAVE_ISINFF)
++ AC_DEFINE(HAVE_ISNAN)
++ AC_DEFINE(HAVE_ISNANF)
++# AC_DEFINE(HAVE_LOGF)
++# AC_DEFINE(HAVE_LOG10F)
++# AC_DEFINE(HAVE_MODFF)
++# AC_DEFINE(HAVE_SINF)
++# AC_DEFINE(HAVE_SINHF)
++# AC_DEFINE(HAVE_SINCOS)
++# AC_DEFINE(HAVE_SINCOSF)
++ AC_DEFINE(HAVE_SQRTF)
++# AC_DEFINE(HAVE_TANF)
++# AC_DEFINE(HAVE_TANHF)
++ if test x"long_double_math_on_this_cpu" = x"yes"; then
++# AC_DEFINE(HAVE_ACOSL)
++# AC_DEFINE(HAVE_ASINL)
++# AC_DEFINE(HAVE_ATANL)
++# AC_DEFINE(HAVE_ATAN2L)
++# AC_DEFINE(HAVE_CEILL)
++# AC_DEFINE(HAVE_COPYSIGNL)
++# AC_DEFINE(HAVE_COSL)
++# AC_DEFINE(HAVE_COSHL)
++# AC_DEFINE(HAVE_EXPL)
++# AC_DEFINE(HAVE_FABSL)
++# AC_DEFINE(HAVE_FINITEL)
++# AC_DEFINE(HAVE_FLOORL)
++# AC_DEFINE(HAVE_FMODL)
++# AC_DEFINE(HAVE_FREXPL)
++# AC_DEFINE(HAVE_HYPOTL)
++# AC_DEFINE(HAVE_ISINFL)
++# AC_DEFINE(HAVE_ISNANL)
++# AC_DEFINE(HAVE_LOGL)
++# AC_DEFINE(HAVE_LOG10L)
++# AC_DEFINE(HAVE_MODFL)
++# AC_DEFINE(HAVE_POWL)
++# AC_DEFINE(HAVE_SINL)
++# AC_DEFINE(HAVE_SINHL)
++# AC_DEFINE(HAVE_SINCOSL)
++# AC_DEFINE(HAVE_SQRTL)
++# AC_DEFINE(HAVE_TANL)
++# AC_DEFINE(HAVE_TANHL)
++ fi
++ ;;
+ *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
+@@ -156,7 +248,7 @@
+ AC_DEFINE(HAVE_INT64_T)
+ case "$target" in
+ *-uclinux*)
+- # Don't enable LFS with uClibc
++ # Don't enable LFS with uClinux
+ ;;
+ *)
+ AC_DEFINE(_GLIBCXX_USE_LFS)
+diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h
+--- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500
++++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500
+@@ -101,7 +101,9 @@
+ using std::wmemcpy;
+ using std::wmemmove;
+ using std::wmemset;
++#if _GLIBCXX_HAVE_WCSFTIME
+ using std::wcsftime;
++#endif
+
+ #if _GLIBCXX_USE_C99
+ using std::wcstold;
+diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h
+--- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500
++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500
+@@ -179,7 +179,9 @@
+ using ::wcscoll;
+ using ::wcscpy;
+ using ::wcscspn;
++#if _GLIBCXX_HAVE_WCSFTIME
+ using ::wcsftime;
++#endif
+ using ::wcslen;
+ using ::wcsncat;
+ using ::wcsncmp;
diff --git a/4.0.4/uclibc/92_all_301-missing-execinfo_h.patch b/4.0.4/uclibc/92_all_301-missing-execinfo_h.patch
new file mode 100644
index 0000000..0e2092f
--- /dev/null
+++ b/4.0.4/uclibc/92_all_301-missing-execinfo_h.patch
@@ -0,0 +1,11 @@
+--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500
++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500
+@@ -500,7 +500,7 @@
+ #ifdef __linux__
+ # include <features.h>
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
+- && !defined(__ia64__)
++ && !defined(__ia64__) && !defined(__UCLIBC__)
+ # ifndef GC_HAVE_BUILTIN_BACKTRACE
+ # define GC_HAVE_BUILTIN_BACKTRACE
+ # endif
diff --git a/4.0.4/uclibc/92_all_302-c99-snprintf.patch b/4.0.4/uclibc/92_all_302-c99-snprintf.patch
new file mode 100644
index 0000000..dfb22d6
--- /dev/null
+++ b/4.0.4/uclibc/92_all_302-c99-snprintf.patch
@@ -0,0 +1,11 @@
+--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500
++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500
+@@ -142,7 +142,7 @@
+ using ::vsprintf;
+ }
+
+-#if _GLIBCXX_USE_C99
++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
+
+ #undef snprintf
+ #undef vfscanf
diff --git a/4.0.4/uclibc/92_all_303-c99-complex-ugly-hack.patch b/4.0.4/uclibc/92_all_303-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000..2ccc80d
--- /dev/null
+++ b/4.0.4/uclibc/92_all_303-c99-complex-ugly-hack.patch
@@ -0,0 +1,12 @@
+--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500
++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500
+@@ -7194,6 +7194,9 @@
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+ #include <complex.h>
++#ifdef __UCLIBC__
++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
++#endif
+ int
+ main ()
+ {