[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] v2 crosscompiler mit binutils 2.21 und gcc 4.5.2



---
 patches/binutils/2.18/binutils-2.18.patch |  357 ----------------------
 patches/binutils/2.18/oldbinutils.patch   |  278 -----------------
 patches/binutils/2.21/binutils-2.21.patch |  336 +++++++++++++++++++++
 patches/gcc/4.2.2/gcc-4.2.2.patch         |  454 ----------------------------
 patches/gcc/4.5.2/gcc-4.5.2.patch         |  463 +++++++++++++++++++++++++++++
 scripts/build_crosstools                  |  198 +++++++++++--
 6 files changed, 974 insertions(+), 1112 deletions(-)
 delete mode 100644 patches/binutils/2.18/binutils-2.18.patch
 delete mode 100644 patches/binutils/2.18/oldbinutils.patch
 create mode 100644 patches/binutils/2.21/binutils-2.21.patch
 delete mode 100644 patches/gcc/4.2.2/gcc-4.2.2.patch
 create mode 100644 patches/gcc/4.5.2/gcc-4.5.2.patch

diff --git a/patches/binutils/2.18/binutils-2.18.patch b/patches/binutils/2.18/binutils-2.18.patch
deleted file mode 100644
index 24157bd..0000000
--- a/patches/binutils/2.18/binutils-2.18.patch
+++ /dev/null
@@ -1,357 +0,0 @@
-diff -uNr ../binutils-2.18/bfd/config.bfd ./bfd/config.bfd
---- ../binutils-2.18/bfd/config.bfd	2007-08-28 19:19:33.000000000 +0200
-+++ ./bfd/config.bfd	2008-01-21 15:22:03.000000000 +0100
-@@ -575,6 +575,11 @@
-     targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
-     targ64_selvecs=bfd_elf64_x86_64_vec
-     ;;
-+  i[3-7]86-*-tyndur)
-+    targ_defvec=bfd_elf32_i386_vec
-+    targ_selvecs=bfd_elf32_i386_vec
-+    targ64_selvecs=bfd_elf64_x86_64_vec
-+    ;;
- #ifdef BFD64
-   x86_64-*-elf*)
-     targ_defvec=bfd_elf64_x86_64_vec
-diff -uNr ../binutils-2.18/config.sub ./config.sub
---- ../binutils-2.18/config.sub	2007-08-06 22:00:30.000000000 +0200
-+++ ./config.sub	2008-01-21 15:22:03.000000000 +0100
-@@ -121,8 +121,8 @@
- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
- case $maybe_os in
-   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
--  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
--  storm-chaos* | os2-emx* | rtmk-nova*)
-+  tyndur | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | \
-+  netbsd*-gnu* |  storm-chaos* | os2-emx* | rtmk-nova*)
-     os=-$maybe_os
-     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-     ;;
-@@ -1256,6 +1256,9 @@
- 	-linux*)
- 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
- 		;;
-+    -tyndur*)
-+        os=-tyndur
-+        ;;
- 	-sunos5*)
- 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
- 		;;
-diff -uNr ../binutils-2.18/gas/configure.tgt ./gas/configure.tgt
---- ../binutils-2.18/gas/configure.tgt	2007-08-28 19:19:36.000000000 +0200
-+++ ./gas/configure.tgt	2008-01-21 15:22:03.000000000 +0100
-@@ -192,6 +192,7 @@
-   i386-*-linux*oldld)			fmt=aout em=linux ;;
-   i386-*-linux*coff*)			fmt=coff em=linux ;;
-   i386-*-linux-*)			fmt=elf em=linux ;;
-+  i386-*-tyndur)              fmt=elf ;;
-   i386-*-lynxos*)			fmt=elf em=lynx ;;
-   i386-*-sysv[45]*)			fmt=elf ;;
-   i386-*-solaris*)			fmt=elf ;;
-diff -uNr ../binutils-2.18/ld/configure.tgt ./ld/configure.tgt
---- ../binutils-2.18/ld/configure.tgt	2007-08-28 19:19:42.000000000 +0200
-+++ ./ld/configure.tgt	2008-02-08 17:55:11.000000000 +0100
-@@ -201,6 +201,10 @@
- 			targ_extra_libpath=elf_i386
- 			tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
- 			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
-+i[3-7]86-*-tyndur*)
-+                        targ_emul=elf_i386_tyndur
-+                        targ_extra_emuls="elf_i386"
-+                        ;;
- i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
- i[3-7]86-*-solaris2*)	targ_emul=elf_i386_ldso
-                         targ_extra_emuls="elf_i386 elf_x86_64"
-@@ -680,6 +684,9 @@
- *-*-linux*)
-   ;;
- 
-+*-*-tyndur*)
-+  NATIVE_LIB_DIRS='/system/links/lib'
-+  ;;
- *-*-freebsd* | *-*-dragonfly*)
-   ;;
- 
-diff -uNr ../binutils-2.18/ld/emulparams/elf_i386_tyndur.sh ./ld/emulparams/elf_i386_tyndur.sh
---- ../binutils-2.18/ld/emulparams/elf_i386_tyndur.sh	1970-01-01 01:00:00.000000000 +0100
-+++ ./ld/emulparams/elf_i386_tyndur.sh	2008-02-04 08:05:57.000000000 +0100
-@@ -0,0 +1,17 @@
-+SCRIPT_NAME=elf
-+OUTPUT_FORMAT="elf32-i386"
-+TEXT_START_ADDR=0x40000000
-+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
-+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
-+ARCH=i386
-+MACHINE=
-+NOP=0x90909090
-+TEMPLATE_NAME=elf32
-+GENERATE_SHLIB_SCRIPT=yes
-+GENERATE_PIE_SCRIPT=yes
-+NO_SMALL_DATA=yes
-+SEPARATE_GOTPLT=12
-+CTOR_START="__ctor_start__ = .;"
-+CTOR_END="__ctor_end__ = .;"
-+DTOR_START="__dtor_start__ = .;"
-+DTOR_END="__dtor_end__ = .;"
-diff -uNr ../binutils-2.18/ld/Makefile.am ./ld/Makefile.am
---- ../binutils-2.18/ld/Makefile.am	2007-08-06 22:00:17.000000000 +0200
-+++ ./ld/Makefile.am	2008-02-04 08:17:43.000000000 +0100
-@@ -1001,6 +1001,9 @@
- eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
-   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
-+eelf_i386_tyndur.c: $(srcdir)/emulparams/elf_i386_tyndur.sh \
-+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} elf_i386_tyndur "$(tdir_elf_i386_tyndur)"
- eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
-   $(srcdir)/emulparams/vxworks.sh $(srcdir)/emultempl/vxworks.em \
-   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-diff -uNr ../binutils-2.18/ld/Makefile.in ./ld/Makefile.in
---- ../binutils-2.18/ld/Makefile.in	2007-08-06 22:29:54.000000000 +0200
-+++ ./ld/Makefile.in	2008-02-04 08:17:13.000000000 +0100
-@@ -452,6 +452,7 @@
- 	eelf_i386_chaos.o \
- 	eelf_i386_fbsd.o \
- 	eelf_i386_ldso.o \
-+	eelf_i386_tyndur.o \
- 	eelf_i386_vxworks.o \
- 	eelf_s390.o \
- 	egld960.o \
-@@ -1827,6 +1828,10 @@
- eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
-   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
-+eelf_i386_tyndur.c: $(srcdir)/emulparams/elf_i386_tyndur.sh \
-+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} elf_i386_tyndur "$(tdir_elf_i386_tyndur)"
-+
- eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
-   $(srcdir)/emulparams/vxworks.sh $(srcdir)/emultempl/vxworks.em \
-   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-diff -uNr ../binutils-2.18/libiberty/configure ./libiberty/configure
---- ../binutils-2.18/libiberty/configure	2007-08-06 21:59:45.000000000 +0200
-+++ ./libiberty/configure	2008-01-21 15:22:03.000000000 +0100
-@@ -8520,6 +8520,7 @@
-      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
-      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
-      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
-+     *-*-tyndur*)     pexecute=./pex-tyndur.o   ;;
-      *)				pexecute=./pex-unix.o   ;;
- esac
- 
-diff -uNr ../binutils-2.18/libiberty/configure.ac ./libiberty/configure.ac
---- ../binutils-2.18/libiberty/configure.ac	2007-08-06 21:59:45.000000000 +0200
-+++ ./libiberty/configure.ac	2008-01-21 15:22:03.000000000 +0100
-@@ -682,6 +682,7 @@
-      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
-      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
-      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
-+     *-*-tyndur*)         pexecute=./pex-tyndur.o   ;;
-      *)				pexecute=./pex-unix.o   ;;
- esac
- AC_SUBST(pexecute)
-diff -uNr ../binutils-2.18/libiberty/Makefile.in ./libiberty/Makefile.in
---- ../binutils-2.18/libiberty/Makefile.in	2007-08-06 21:59:45.000000000 +0200
-+++ ./libiberty/Makefile.in	2008-01-21 15:22:03.000000000 +0100
-@@ -140,7 +140,7 @@
- 	objalloc.c obstack.c						\
- 	partition.c pexecute.c						\
- 	 pex-common.c pex-djgpp.c pex-msdos.c pex-one.c			\
--	 pex-unix.c pex-win32.c						\
-+	 pex-unix.c pex-win32.c	pex-tyndur.c					\
-          physmem.c putenv.c						\
- 	random.c regex.c rename.c rindex.c				\
- 	safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c	\
-@@ -857,6 +857,13 @@
- 	else true; fi
- 	$(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION)
- 
-+./pex-tyndur.o: $(srcdir)/pex-tyndur.c stamp-h $(INCDIR)/ansidecl.h \
-+	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
-+	if [ x"$(PICFLAG)" != x ]; then \
-+	  $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-tyndur.c -o pic/$@; \
-+	else true; fi
-+	$(COMPILE.c) $(srcdir)/pex-tyndur.c $(OUTPUT_OPTION)
-+
- ./pex-msdos.o: $(srcdir)/pex-msdos.c stamp-h $(INCDIR)/ansidecl.h \
- 	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h \
- 	$(INCDIR)/safe-ctype.h
-diff -uNr ../binutils-2.18/libiberty/pex-tyndur.c ./libiberty/pex-tyndur.c
---- ../binutils-2.18/libiberty/pex-tyndur.c	1970-01-01 01:00:00.000000000 +0100
-+++ ./libiberty/pex-tyndur.c	2008-01-21 15:22:03.000000000 +0100
-@@ -0,0 +1,154 @@
-+/* Utilities to execute a program in a subprocess (possibly linked by pipes
-+   with other subprocesses), and wait for it.  Generic Unix version
-+   (also used for UWIN and VMS).
-+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
-+   Free Software Foundation, Inc.
-+
-+This file is part of the libiberty library.
-+Libiberty is free software; you can redistribute it and/or
-+modify it under the terms of the GNU Library General Public
-+License as published by the Free Software Foundation; either
-+version 2 of the License, or (at your option) any later version.
-+
-+Libiberty 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Library General Public
-+License along with libiberty; see the file COPYING.LIB.  If not,
-+write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-+Boston, MA 02110-1301, USA.  */
-+
-+#include "config.h"
-+#include "libiberty.h"
-+#include "pex-common.h"
-+
-+#include <stdio.h>
-+#include <signal.h>
-+#include <errno.h>
-+#include <init.h>
-+#ifdef NEED_DECLARATION_ERRNO
-+extern int errno;
-+#endif
-+#ifdef HAVE_STDLIB_H
-+#include <stdlib.h>
-+#endif
-+#ifdef HAVE_STRING_H
-+#include <string.h>
-+#endif
-+#ifdef HAVE_UNISTD_H
-+#include <unistd.h>
-+#endif
-+
-+#include <sys/types.h>
-+
-+#ifdef HAVE_FCNTL_H
-+#include <fcntl.h>
-+#endif
-+#ifdef HAVE_SYS_WAIT_H
-+#include <sys/wait.h>
-+#endif
-+#ifdef HAVE_GETRUSAGE
-+#include <sys/time.h>
-+#include <sys/resource.h>
-+#endif
-+#ifdef HAVE_SYS_STAT_H
-+#include <sys/stat.h>
-+#endif
-+
-+
-+static int pex_tyndur_open_read (struct pex_obj *, const char *, int);
-+static int pex_tyndur_open_write (struct pex_obj *, const char *, int);
-+static long pex_tyndur_exec_child (struct pex_obj *, int, const char *,
-+				 char * const *, char * const *,
-+				 int, int, int, int,
-+				 const char **, int *);
-+static int pex_tyndur_close (struct pex_obj *, int);
-+static int pex_tyndur_wait (struct pex_obj *, long, int *, struct pex_time *,
-+			  int, const char **, int *);
-+static int pex_tyndur_pipe (struct pex_obj *, int *, int);
-+static FILE *pex_tyndur_fdopenr (struct pex_obj *, int, int);
-+static FILE *pex_tyndur_fdopenw (struct pex_obj *, int, int);
-+static void pex_tyndur_cleanup (struct pex_obj *);
-+
-+/* The list of functions we pass to the common routines.  */
-+
-+const struct pex_funcs funcs =
-+{
-+  pex_tyndur_open_read,
-+  pex_tyndur_open_write,
-+  pex_tyndur_exec_child,
-+  pex_tyndur_close,
-+  pex_tyndur_wait,
-+  NULL,
-+  NULL,
-+  NULL,
-+  NULL
-+};
-+
-+/* Return a newly initialized pex_obj structure.  */
-+
-+struct pex_obj *
-+pex_init (int flags, const char *pname, const char *tempbase)
-+{
-+  return pex_init_common (flags, pname, tempbase, &funcs);
-+}
-+
-+/* Open a file for reading.  */
-+
-+static int
-+pex_tyndur_open_read (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
-+		    int binary ATTRIBUTE_UNUSED)
-+{
-+  return open (name, O_RDONLY);
-+}
-+
-+/* Open a file for writing.  */
-+
-+static int
-+pex_tyndur_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
-+		     int binary ATTRIBUTE_UNUSED)
-+{
-+  /* Note that we can't use O_EXCL here because gcc may have already
-+     created the temporary file via make_temp_file.  */
-+  return open (name, O_WRONLY | O_CREAT | O_TRUNC);
-+}
-+
-+/* Close a file.  */
-+
-+static int
-+pex_tyndur_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd)
-+{
-+  return close (fd);
-+}
-+
-+/* Execute a child.  */
-+static long
-+pex_tyndur_exec_child (struct pex_obj *obj, int flags, const char *executable,
-+		     char * const * argv, char * const * env,
-+                     int in, int out, int errdes,
-+		     int toclose, const char **errmsg, int *err)
-+{
-+  // FIXME
-+  return -1;
-+}
-+
-+/* Wait for a child process to complete.  */
-+
-+static int
-+pex_tyndur_wait (struct pex_obj *obj, long pid, int *status,
-+	       struct pex_time *time, int done, const char **errmsg,
-+	       int *err)
-+{
-+  /* If we are cleaning up when the caller didn't retrieve process
-+     status for some reason, encourage the process to go away.  */
-+  if (done)
-+    kill (pid, SIGTERM);
-+  
-+  // FIXME
-+  while (get_parent_pid(pid) != 0);
-+  *status = 0;
-+  return 0;
-+}
-+
---- ../binutils-2.18/configure	2007-08-06 22:29:40.000000000 +0200
-+++ ../binutils-2.18-new/configure	2008-06-05 19:40:52.000000000 +0200
-@@ -6127,12 +6127,12 @@
- 
-     # For an installed makeinfo, we require it to be from texinfo 4.4 or
-     # higher, else we use the "missing" dummy.
--    if ${MAKEINFO} --version \
--       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
--      :
--    else
--      MAKEINFO="$MISSING makeinfo"
--    fi
-+    #if ${MAKEINFO} --version \
-+    #   | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
-+    #  :
-+    #else
-+    #  MAKEINFO="$MISSING makeinfo"
-+    #fi
-     ;;
- 
- esac
diff --git a/patches/binutils/2.18/oldbinutils.patch b/patches/binutils/2.18/oldbinutils.patch
deleted file mode 100644
index 0448401..0000000
--- a/patches/binutils/2.18/oldbinutils.patch
+++ /dev/null
@@ -1,278 +0,0 @@
-diff -r -u -N ../binutils-2.18/bfd/config.bfd ./bfd/config.bfd
---- ../binutils-2.18/bfd/config.bfd	2007-08-28 19:19:33.000000000 +0200
-+++ ./bfd/config.bfd	2007-12-31 12:04:35.000000000 +0100
-@@ -575,6 +575,11 @@
-     targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
-     targ64_selvecs=bfd_elf64_x86_64_vec
-     ;;
-+  i[3-7]86-*-lost)
-+    targ_defvec=bfd_elf32_i386_vec
-+    targ_selvecs=bfd_elf32_i386_vec
-+    targ64_selvecs=bfd_elf64_x86_64_vec
-+    ;;
- #ifdef BFD64
-   x86_64-*-elf*)
-     targ_defvec=bfd_elf64_x86_64_vec
-diff -r -u -N ../binutils-2.18/config.sub ./config.sub
---- ../binutils-2.18/config.sub	2007-08-06 22:00:30.000000000 +0200
-+++ ./config.sub	2007-12-31 12:04:46.000000000 +0100
-@@ -121,8 +121,8 @@
- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
- case $maybe_os in
-   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
--  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
--  storm-chaos* | os2-emx* | rtmk-nova*)
-+  lost | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | \
-+  netbsd*-gnu* |  storm-chaos* | os2-emx* | rtmk-nova*)
-     os=-$maybe_os
-     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-     ;;
-@@ -1256,6 +1256,9 @@
- 	-linux*)
- 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
- 		;;
-+    -lost*)
-+        os=-lost
-+        ;;
- 	-sunos5*)
- 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
- 		;;
-diff -r -u -N ../binutils-2.18/gas/configure.tgt ./gas/configure.tgt
---- ../binutils-2.18/gas/configure.tgt	2007-08-28 19:19:36.000000000 +0200
-+++ ./gas/configure.tgt	2007-12-31 12:11:03.000000000 +0100
-@@ -192,6 +192,7 @@
-   i386-*-linux*oldld)			fmt=aout em=linux ;;
-   i386-*-linux*coff*)			fmt=coff em=linux ;;
-   i386-*-linux-*)			fmt=elf em=linux ;;
-+  i386-*-lost)              fmt=elf ;;
-   i386-*-lynxos*)			fmt=elf em=lynx ;;
-   i386-*-sysv[45]*)			fmt=elf ;;
-   i386-*-solaris*)			fmt=elf ;;
-diff -r -u -N ../binutils-2.18/ld/configure.tgt ./ld/configure.tgt
---- ../binutils-2.18/ld/configure.tgt	2007-08-28 19:19:42.000000000 +0200
-+++ ./ld/configure.tgt	2008-01-05 22:16:40.000000000 +0100
-@@ -201,6 +201,7 @@
- 			targ_extra_libpath=elf_i386
- 			tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
- 			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
-+i[3-7]86-*-lost)        targ_emul=elf_i386 ;;
- i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
- i[3-7]86-*-solaris2*)	targ_emul=elf_i386_ldso
-                         targ_extra_emuls="elf_i386 elf_x86_64"
-@@ -680,6 +680,9 @@
- *-*-linux*)
-   ;;
- 
-+*-*-lost*)
-+  NATIVE_LIB_DIRS='/system/links/lib'
-+  ;;
- *-*-freebsd* | *-*-dragonfly*)
-   ;;
- 
-Dateien ../binutils-2.18/ld/emultempl/spu_ovl.o und ./ld/emultempl/spu_ovl.o sind verschieden.
-diff -r -u -N ../binutils-2.18/libiberty/configure ./libiberty/configure
---- ../binutils-2.18/libiberty/configure	2007-08-06 21:59:45.000000000 +0200
-+++ ./libiberty/configure	2008-01-06 12:19:47.000000000 +0100
-@@ -8520,6 +8520,7 @@
-      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
-      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
-      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
-+     *-*-lost*)     pexecute=./pex-lost.o   ;;
-      *)				pexecute=./pex-unix.o   ;;
- esac
- 
-diff -r -u -N ../binutils-2.18/libiberty/configure.ac ./libiberty/configure.ac
---- ../binutils-2.18/libiberty/configure.ac	2007-08-06 21:59:45.000000000 +0200
-+++ ./libiberty/configure.ac	2008-01-06 12:02:13.000000000 +0100
-@@ -682,6 +682,7 @@
-      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
-      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
-      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
-+     *-*-lost*)         pexecute=./pex-lost.o   ;;
-      *)				pexecute=./pex-unix.o   ;;
- esac
- AC_SUBST(pexecute)
-diff -r -u -N ../binutils-2.18/libiberty/Makefile.in ./libiberty/Makefile.in
---- ../binutils-2.18/libiberty/Makefile.in	2007-08-06 21:59:45.000000000 +0200
-+++ ./libiberty/Makefile.in	2008-01-06 12:26:05.000000000 +0100
-@@ -140,7 +140,7 @@
- 	objalloc.c obstack.c						\
- 	partition.c pexecute.c						\
- 	 pex-common.c pex-djgpp.c pex-msdos.c pex-one.c			\
--	 pex-unix.c pex-win32.c						\
-+	 pex-unix.c pex-win32.c	pex-lost.c					\
-          physmem.c putenv.c						\
- 	random.c regex.c rename.c rindex.c				\
- 	safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c	\
-@@ -857,6 +857,13 @@
- 	else true; fi
- 	$(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION)
- 
-+./pex-lost.o: $(srcdir)/pex-lost.c stamp-h $(INCDIR)/ansidecl.h \
-+	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
-+	if [ x"$(PICFLAG)" != x ]; then \
-+	  $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-lost.c -o pic/$@; \
-+	else true; fi
-+	$(COMPILE.c) $(srcdir)/pex-lost.c $(OUTPUT_OPTION)
-+
- ./pex-msdos.o: $(srcdir)/pex-msdos.c stamp-h $(INCDIR)/ansidecl.h \
- 	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h \
- 	$(INCDIR)/safe-ctype.h
-diff -r -u -N ../binutils-2.18/libiberty/pex-lost.c ./libiberty/pex-lost.c
---- ../binutils-2.18/libiberty/pex-lost.c	1970-01-01 01:00:00.000000000 +0100
-+++ ./libiberty/pex-lost.c	2008-01-06 12:27:33.000000000 +0100
-@@ -0,0 +1,154 @@
-+/* Utilities to execute a program in a subprocess (possibly linked by pipes
-+   with other subprocesses), and wait for it.  Generic Unix version
-+   (also used for UWIN and VMS).
-+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
-+   Free Software Foundation, Inc.
-+
-+This file is part of the libiberty library.
-+Libiberty is free software; you can redistribute it and/or
-+modify it under the terms of the GNU Library General Public
-+License as published by the Free Software Foundation; either
-+version 2 of the License, or (at your option) any later version.
-+
-+Libiberty 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Library General Public
-+License along with libiberty; see the file COPYING.LIB.  If not,
-+write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-+Boston, MA 02110-1301, USA.  */
-+
-+#include "config.h"
-+#include "libiberty.h"
-+#include "pex-common.h"
-+
-+#include <stdio.h>
-+#include <signal.h>
-+#include <errno.h>
-+#include <init.h>
-+#ifdef NEED_DECLARATION_ERRNO
-+extern int errno;
-+#endif
-+#ifdef HAVE_STDLIB_H
-+#include <stdlib.h>
-+#endif
-+#ifdef HAVE_STRING_H
-+#include <string.h>
-+#endif
-+#ifdef HAVE_UNISTD_H
-+#include <unistd.h>
-+#endif
-+
-+#include <sys/types.h>
-+
-+#ifdef HAVE_FCNTL_H
-+#include <fcntl.h>
-+#endif
-+#ifdef HAVE_SYS_WAIT_H
-+#include <sys/wait.h>
-+#endif
-+#ifdef HAVE_GETRUSAGE
-+#include <sys/time.h>
-+#include <sys/resource.h>
-+#endif
-+#ifdef HAVE_SYS_STAT_H
-+#include <sys/stat.h>
-+#endif
-+
-+
-+static int pex_lost_open_read (struct pex_obj *, const char *, int);
-+static int pex_lost_open_write (struct pex_obj *, const char *, int);
-+static long pex_lost_exec_child (struct pex_obj *, int, const char *,
-+				 char * const *, char * const *,
-+				 int, int, int, int,
-+				 const char **, int *);
-+static int pex_lost_close (struct pex_obj *, int);
-+static int pex_lost_wait (struct pex_obj *, long, int *, struct pex_time *,
-+			  int, const char **, int *);
-+static int pex_lost_pipe (struct pex_obj *, int *, int);
-+static FILE *pex_lost_fdopenr (struct pex_obj *, int, int);
-+static FILE *pex_lost_fdopenw (struct pex_obj *, int, int);
-+static void pex_lost_cleanup (struct pex_obj *);
-+
-+/* The list of functions we pass to the common routines.  */
-+
-+const struct pex_funcs funcs =
-+{
-+  pex_lost_open_read,
-+  pex_lost_open_write,
-+  pex_lost_exec_child,
-+  pex_lost_close,
-+  pex_lost_wait,
-+  NULL,
-+  NULL,
-+  NULL,
-+  NULL
-+};
-+
-+/* Return a newly initialized pex_obj structure.  */
-+
-+struct pex_obj *
-+pex_init (int flags, const char *pname, const char *tempbase)
-+{
-+  return pex_init_common (flags, pname, tempbase, &funcs);
-+}
-+
-+/* Open a file for reading.  */
-+
-+static int
-+pex_lost_open_read (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
-+		    int binary ATTRIBUTE_UNUSED)
-+{
-+  return open (name, O_RDONLY);
-+}
-+
-+/* Open a file for writing.  */
-+
-+static int
-+pex_lost_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
-+		     int binary ATTRIBUTE_UNUSED)
-+{
-+  /* Note that we can't use O_EXCL here because gcc may have already
-+     created the temporary file via make_temp_file.  */
-+  return open (name, O_WRONLY | O_CREAT | O_TRUNC);
-+}
-+
-+/* Close a file.  */
-+
-+static int
-+pex_lost_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd)
-+{
-+  return close (fd);
-+}
-+
-+/* Execute a child.  */
-+static long
-+pex_lost_exec_child (struct pex_obj *obj, int flags, const char *executable,
-+		     char * const * argv, char * const * env,
-+                     int in, int out, int errdes,
-+		     int toclose, const char **errmsg, int *err)
-+{
-+  // FIXME
-+  return -1;
-+}
-+
-+/* Wait for a child process to complete.  */
-+
-+static int
-+pex_lost_wait (struct pex_obj *obj, long pid, int *status,
-+	       struct pex_time *time, int done, const char **errmsg,
-+	       int *err)
-+{
-+  /* If we are cleaning up when the caller didn't retrieve process
-+     status for some reason, encourage the process to go away.  */
-+  if (done)
-+    kill (pid, SIGTERM);
-+  
-+  // FIXME
-+  while (get_parent_pid(pid) != 0);
-+  *status = 0;
-+  return 0;
-+}
-+
diff --git a/patches/binutils/2.21/binutils-2.21.patch b/patches/binutils/2.21/binutils-2.21.patch
new file mode 100644
index 0000000..4e02ef3
--- /dev/null
+++ b/patches/binutils/2.21/binutils-2.21.patch
@@ -0,0 +1,336 @@
+diff -uNr ../binutils-2.21/bfd/config.bfd ./bfd/config.bfd
+--- ../binutils-2.21/bfd/config.bfd	2007-08-28 19:19:33.000000000 +0200
++++ ./bfd/config.bfd	2008-01-21 15:22:03.000000000 +0100
+@@ -600,6 +600,11 @@
+     targ_selvecs="i386linux_vec i386pei_vec"
+     targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf64_l1om_vec"
+     ;;
++  i[3-7]86-*-tyndur)
++    targ_defvec=bfd_elf32_i386_vec
++    targ_selvecs=bfd_elf32_i386_vec
++    targ64_selvecs=bfd_elf64_x86_64_vec
++    ;;
+ #ifdef BFD64
+   x86_64-*-darwin*)
+     targ_defvec=mach_o_x86_64_vec
+diff -uNr ../binutils-2.21/config.sub ./config.sub
+--- ../binutils-2.21/config.sub	2007-08-06 22:00:30.000000000 +0200
++++ ./config.sub	2008-01-21 15:22:03.000000000 +0100
+@@ -127,8 +127,8 @@
+   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+   linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+   knetbsd*-gnu* | netbsd*-gnu* | \
+-  kopensolaris*-gnu* | \
+-  storm-chaos* | os2-emx* | rtmk-nova*)
++  tyndur | kopensolaris*-gnu* | \
++  netbsd*-gnu* |  storm-chaos* | os2-emx* | rtmk-nova*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+@@ -1347,6 +1347,9 @@
+ 	-linux*)
+ 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ 		;;
++    -tyndur*)
++        os=-tyndur
++        ;;
+ 	-sunos5*)
+ 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ 		;;
+diff -uNr ../binutils-2.21/gas/configure.tgt ./gas/configure.tgt
+--- ../binutils-2.21/gas/configure.tgt	2007-08-28 19:19:36.000000000 +0200
++++ ./gas/configure.tgt	2008-01-21 15:22:03.000000000 +0100
+@@ -199,6 +199,7 @@
+   i386-*-linux*oldld)			fmt=aout em=linux ;;
+   i386-*-linux*coff*)			fmt=coff em=linux ;;
+   i386-*-linux-*)			fmt=elf em=linux ;;
++  i386-*-tyndur)              fmt=elf ;;
+   i386-*-lynxos*)			fmt=elf em=lynx ;;
+   i386-*-sysv[45]*)			fmt=elf ;;
+   i386-*-solaris*)			fmt=elf em=solaris ;;
+diff -uNr ../binutils-2.21/ld/configure.tgt ./ld/configure.tgt
+--- ../binutils-2.21/ld/configure.tgt	2007-08-28 19:19:42.000000000 +0200
++++ ./ld/configure.tgt	2008-02-08 17:55:11.000000000 +0100
+@@ -207,6 +207,10 @@
+ 			targ_extra_libpath=elf_i386
+ 			tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
+ 			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
++i[3-7]86-*-tyndur*)
++                        targ_emul=elf_i386_tyndur
++                        targ_extra_emuls="elf_i386"
++                        ;;
+ i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
+ i[3-7]86-*-solaris2*)	targ_emul=elf_i386_sol2
+                         targ_extra_emuls="elf_i386_ldso elf_i386 elf_x86_64_sol2 elf_x86_64 elf_l1om"
+@@ -706,6 +706,9 @@
+ *-*-linux*)
+   ;;
+ 
++*-*-tyndur*)
++  NATIVE_LIB_DIRS='/system/links/lib'
++  ;;
+ *-*-freebsd* | *-*-dragonfly*)
+   ;;
+ 
+diff -uNr ../binutils-2.21/ld/emulparams/elf_i386_tyndur.sh ./ld/emulparams/elf_i386_tyndur.sh
+--- ../binutils-2.21/ld/emulparams/elf_i386_tyndur.sh	1970-01-01 01:00:00.000000000 +0100
++++ ./ld/emulparams/elf_i386_tyndur.sh	2008-02-04 08:05:57.000000000 +0100
+@@ -0,0 +1,17 @@
++SCRIPT_NAME=elf
++OUTPUT_FORMAT="elf32-i386"
++TEXT_START_ADDR=0x40000000
++MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
++COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
++ARCH=i386
++MACHINE=
++NOP=0x90909090
++TEMPLATE_NAME=elf32
++GENERATE_SHLIB_SCRIPT=yes
++GENERATE_PIE_SCRIPT=yes
++NO_SMALL_DATA=yes
++SEPARATE_GOTPLT=12
++CTOR_START="__ctor_start__ = .;"
++CTOR_END="__ctor_end__ = .;"
++DTOR_START="__dtor_start__ = .;"
++DTOR_END="__dtor_end__ = .;"
+diff -uNr ../binutils-2.21/ld/Makefile.am ./ld/Makefile.am
+--- ../binutils-2.21/ld/Makefile.am	2007-08-06 22:00:17.000000000 +0200
++++ ./ld/Makefile.am	2008-02-04 08:17:43.000000000 +0100
+@@ -1196,6 +1196,9 @@
+ eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
+   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
++eelf_i386_tyndur.c: $(srcdir)/emulparams/elf_i386_tyndur.sh \
++  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} elf_i386_tyndur "$(tdir_elf_i386_tyndur)"
+ eelf_i386_sol2.c: $(srcdir)/emulparams/elf_i386_sol2.sh \
+   $(srcdir)/emulparams/solaris2.sh \
+   $(srcdir)/emultempl/solaris2.em \
+diff -uNr ../binutils-2.21/ld/Makefile.in ./ld/Makefile.in
+--- ../binutils-2.21/ld/Makefile.in	2007-08-06 22:29:54.000000000 +0200
++++ ./ld/Makefile.in	2008-02-04 08:17:13.000000000 +0100
+@@ -538,6 +538,7 @@
+ 	eelf_i386_chaos.c \
+ 	eelf_i386_fbsd.c \
+ 	eelf_i386_ldso.c \
++	eelf_i386_tyndur.o \
+ 	eelf_i386_sol2.c \
+ 	eelf_i386_vxworks.c \
+ 	eelf_s390.c \
+@@ -2619,6 +2619,10 @@
+ eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
+   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
++eelf_i386_tyndur.c: $(srcdir)/emulparams/elf_i386_tyndur.sh \
++  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} elf_i386_tyndur "$(tdir_elf_i386_tyndur)"
++
+ eelf_i386_sol2.c: $(srcdir)/emulparams/elf_i386_sol2.sh \
+   $(srcdir)/emulparams/solaris2.sh \
+   $(srcdir)/emultempl/solaris2.em \
+diff -uNr ../binutils-2.21/libiberty/configure ./libiberty/configure
+--- ../binutils-2.21/libiberty/configure	2007-08-06 21:59:45.000000000 +0200
++++ ./libiberty/configure	2008-01-21 15:22:03.000000000 +0100
+@@ -6579,6 +6579,7 @@
+      *-*-mingw* | *-*-winnt*)	pexecute=pex-win32  ;;
+      *-*-msdosdjgpp*)		pexecute=pex-djgpp  ;;
+      *-*-msdos*)		pexecute=pex-msdos  ;;
++     *-*-tyndur*)     pexecute=./pex-tyndur.o   ;;
+      *)				pexecute=pex-unix   ;;
+ esac
+ 
+diff -uNr ../binutils-2.21/libiberty/configure.ac ./libiberty/configure.ac
+--- ../binutils-2.21/libiberty/configure.ac	2007-08-06 21:59:45.000000000 +0200
++++ ./libiberty/configure.ac	2008-01-21 15:22:03.000000000 +0100
+@@ -689,6 +689,7 @@
+      *-*-mingw* | *-*-winnt*)	pexecute=pex-win32  ;;
+      *-*-msdosdjgpp*)		pexecute=pex-djgpp  ;;
+      *-*-msdos*)		pexecute=pex-msdos  ;;
++     *-*-tyndur*)         pexecute=./pex-tyndur.o   ;;
+      *)				pexecute=pex-unix   ;;
+ esac
+ AC_SUBST(pexecute)
+diff -uNr ../binutils-2.21/libiberty/Makefile.in ./libiberty/Makefile.in
+--- ../binutils-2.21/libiberty/Makefile.in	2007-08-06 21:59:45.000000000 +0200
++++ ./libiberty/Makefile.in	2008-01-21 15:22:03.000000000 +0100
+@@ -141,7 +141,7 @@
+ 	objalloc.c obstack.c						\
+ 	partition.c pexecute.c						\
+ 	 pex-common.c pex-djgpp.c pex-msdos.c pex-one.c			\
+-	 pex-unix.c pex-win32.c						\
++	 pex-unix.c pex-win32.c	pex-tyndur.c					\
+          physmem.c putenv.c						\
+ 	random.c regex.c rename.c rindex.c				\
+ 	safe-ctype.c setenv.c setproctitle.c sha1.c sigsetmask.c        \
+@@ -866,6 +866,13 @@
+ 	else true; fi
+ 	$(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION)
+ 
++./pex-tyndur.o: $(srcdir)/pex-tyndur.c stamp-h $(INCDIR)/ansidecl.h \
++	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
++	if [ x"$(PICFLAG)" != x ]; then \
++	  $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-tyndur.c -o pic/$@; \
++	else true; fi
++	$(COMPILE.c) $(srcdir)/pex-tyndur.c $(OUTPUT_OPTION)
++
+ ./pex-msdos.$(objext): $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \
+ 	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h \
+ 	$(INCDIR)/safe-ctype.h
+diff -uNr ../binutils-2.21/libiberty/pex-tyndur.c ./libiberty/pex-tyndur.c
+--- ../binutils-2.21/libiberty/pex-tyndur.c	1970-01-01 01:00:00.000000000 +0100
++++ ./libiberty/pex-tyndur.c	2008-01-21 15:22:03.000000000 +0100
+@@ -0,0 +1,154 @@
++/* Utilities to execute a program in a subprocess (possibly linked by pipes
++   with other subprocesses), and wait for it.  Generic Unix version
++   (also used for UWIN and VMS).
++   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
++   Free Software Foundation, Inc.
++
++This file is part of the libiberty library.
++Libiberty is free software; you can redistribute it and/or
++modify it under the terms of the GNU Library General Public
++License as published by the Free Software Foundation; either
++version 2 of the License, or (at your option) any later version.
++
++Libiberty 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
++Library General Public License for more details.
++
++You should have received a copy of the GNU Library General Public
++License along with libiberty; see the file COPYING.LIB.  If not,
++write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
++Boston, MA 02110-1301, USA.  */
++
++#include "config.h"
++#include "libiberty.h"
++#include "pex-common.h"
++
++#include <stdio.h>
++#include <signal.h>
++#include <errno.h>
++#include <init.h>
++#ifdef NEED_DECLARATION_ERRNO
++extern int errno;
++#endif
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
++#ifdef HAVE_STRING_H
++#include <string.h>
++#endif
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include <sys/types.h>
++
++#ifdef HAVE_FCNTL_H
++#include <fcntl.h>
++#endif
++#ifdef HAVE_SYS_WAIT_H
++#include <sys/wait.h>
++#endif
++#ifdef HAVE_GETRUSAGE
++#include <sys/time.h>
++#include <sys/resource.h>
++#endif
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++
++
++static int pex_tyndur_open_read (struct pex_obj *, const char *, int);
++static int pex_tyndur_open_write (struct pex_obj *, const char *, int);
++static long pex_tyndur_exec_child (struct pex_obj *, int, const char *,
++				 char * const *, char * const *,
++				 int, int, int, int,
++				 const char **, int *);
++static int pex_tyndur_close (struct pex_obj *, int);
++static int pex_tyndur_wait (struct pex_obj *, long, int *, struct pex_time *,
++			  int, const char **, int *);
++static int pex_tyndur_pipe (struct pex_obj *, int *, int);
++static FILE *pex_tyndur_fdopenr (struct pex_obj *, int, int);
++static FILE *pex_tyndur_fdopenw (struct pex_obj *, int, int);
++static void pex_tyndur_cleanup (struct pex_obj *);
++
++/* The list of functions we pass to the common routines.  */
++
++const struct pex_funcs funcs =
++{
++  pex_tyndur_open_read,
++  pex_tyndur_open_write,
++  pex_tyndur_exec_child,
++  pex_tyndur_close,
++  pex_tyndur_wait,
++  NULL,
++  NULL,
++  NULL,
++  NULL
++};
++
++/* Return a newly initialized pex_obj structure.  */
++
++struct pex_obj *
++pex_init (int flags, const char *pname, const char *tempbase)
++{
++  return pex_init_common (flags, pname, tempbase, &funcs);
++}
++
++/* Open a file for reading.  */
++
++static int
++pex_tyndur_open_read (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
++		    int binary ATTRIBUTE_UNUSED)
++{
++  return open (name, O_RDONLY);
++}
++
++/* Open a file for writing.  */
++
++static int
++pex_tyndur_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
++		     int binary ATTRIBUTE_UNUSED)
++{
++  /* Note that we can't use O_EXCL here because gcc may have already
++     created the temporary file via make_temp_file.  */
++  return open (name, O_WRONLY | O_CREAT | O_TRUNC);
++}
++
++/* Close a file.  */
++
++static int
++pex_tyndur_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd)
++{
++  return close (fd);
++}
++
++/* Execute a child.  */
++static long
++pex_tyndur_exec_child (struct pex_obj *obj, int flags, const char *executable,
++		     char * const * argv, char * const * env,
++                     int in, int out, int errdes,
++		     int toclose, const char **errmsg, int *err)
++{
++  // FIXME
++  return -1;
++}
++
++/* Wait for a child process to complete.  */
++
++static int
++pex_tyndur_wait (struct pex_obj *obj, long pid, int *status,
++	       struct pex_time *time, int done, const char **errmsg,
++	       int *err)
++{
++  /* If we are cleaning up when the caller didn't retrieve process
++     status for some reason, encourage the process to go away.  */
++  if (done)
++    kill (pid, SIGTERM);
++  
++  // FIXME
++  while (get_parent_pid(pid) != 0);
++  *status = 0;
++  return 0;
++}
++
diff --git a/patches/gcc/4.2.2/gcc-4.2.2.patch b/patches/gcc/4.2.2/gcc-4.2.2.patch
deleted file mode 100644
index 94a337a..0000000
--- a/patches/gcc/4.2.2/gcc-4.2.2.patch
+++ /dev/null
@@ -1,454 +0,0 @@
-diff -urN ../gcc-4.2.2/config.sub ./config.sub
---- ../gcc-4.2.2/config.sub	2006-10-16 05:27:17.000000000 +0200
-+++ ./config.sub	2008-01-27 09:42:49.000000000 +0100
-@@ -121,8 +121,8 @@
- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
- case $maybe_os in
-   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
--  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
--  storm-chaos* | os2-emx* | rtmk-nova*)
-+  tyndur* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | \
-+  netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
-     os=-$maybe_os
-     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-     ;;
-@@ -1249,6 +1249,9 @@
- 	-linux*)
- 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
- 		;;
-+    -tyndur*)
-+        os=-tyndur
-+        ;;
- 	-sunos5*)
- 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
- 		;;
-diff -urN ../gcc-4.2.2/gcc/config/i386/tyndur.h ./gcc/config/i386/tyndur.h
---- ../gcc-4.2.2/gcc/config/i386/tyndur.h	1970-01-01 01:00:00.000000000 +0100
-+++ ./gcc/config/i386/tyndur.h	2008-01-27 09:42:49.000000000 +0100
-@@ -0,0 +1,56 @@
-+/* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
-+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2005,
-+   2006, 2007 Free Software Foundation, Inc.
-+   Contributed by Eric Youngdale.
-+   Modified for stabs-in-ELF by H.J. Lu.
-+   Adapted from linux.h by Antoine Kaufmann
-+
-+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 3, 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 COPYING3.  If not see
-+<http://www.gnu.org/licenses/>.  */
-+
-+/* Output at beginning of assembler file.  */
-+/* The .file command should always begin the output.  */
-+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
-+
-+#define TARGET_VERSION fprintf (stderr, " (i386 TYNDUR/ELF)");
-+
-+/* The svr4 ABI for the i386 says that records and unions are returned
-+   in memory.  */
-+#undef DEFAULT_PCC_STRUCT_RETURN
-+#define DEFAULT_PCC_STRUCT_RETURN 1
-+
-+#undef ASM_COMMENT_START
-+#define ASM_COMMENT_START "#"
-+
-+#undef SIZE_TYPE
-+#define SIZE_TYPE "unsigned int"
-+ 
-+#undef PTRDIFF_TYPE
-+#define PTRDIFF_TYPE "int"
-+  
-+#undef WCHAR_TYPE
-+#define WCHAR_TYPE "long int"
-+   
-+#undef WCHAR_TYPE_SIZE
-+#define WCHAR_TYPE_SIZE BITS_PER_WORD
-+    
-+#define TARGET_OS_CPP_BUILTINS()		\
-+  do						\
-+    {						\
-+	TYNDUR_TARGET_OS_CPP_BUILTINS();		\
-+    }						\
-+  while (0)
-+
-diff -urN ../gcc-4.2.2/gcc/config/tyndur.h ./gcc/config/tyndur.h
---- ../gcc-4.2.2/gcc/config/tyndur.h	1970-01-01 01:00:00.000000000 +0100
-+++ ./gcc/config/tyndur.h	2008-02-10 17:17:37.000000000 +0100
-@@ -0,0 +1,59 @@
-+/* Definitions for Linux-based GNU systems with ELF format
-+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006,
-+   2007 Free Software Foundation, Inc.
-+   Contributed by Eric Youngdale.
-+   Modified for stabs-in-ELF by H.J. Lu (hjl@xxxxxxxxx).
-+   Adapted from linux.h by Antoine Kaufmann
-+
-+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 3, 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 COPYING3.  If not see
-+<http://www.gnu.org/licenses/>.  */
-+
-+/* Don't assume anything about the header files.  */
-+#define NO_IMPLICIT_EXTERN_C
-+
-+/* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
-+   the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
-+   provides part of the support for getting C++ file-scope static
-+   object constructed before entering `main'.  */
-+   
-+#undef	STARTFILE_SPEC
-+#define STARTFILE_SPEC \
-+  "crtbegin.o%s -l:crttyndur.o"
-+
-+/* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
-+   the GNU/Linux magical crtend.o file (see crtstuff.c) which
-+   provides part of the support for getting C++ file-scope static
-+   object constructed before entering `main', followed by a normal
-+   GNU/Linux "finalizer" file, `crtn.o'.  */
-+
-+#undef	ENDFILE_SPEC
-+#define ENDFILE_SPEC \
-+  "crtend.o%s"
-+
-+#define TYNDUR_TARGET_OS_CPP_BUILTINS()			\
-+    do {					    	    	    \
-+	builtin_define ("__TYNDUR__");    			\
-+	builtin_define_std ("TYNDUR");				\
-+	builtin_assert ("system=TYNDUR");			    \
-+    } while (0)
-+
-+#define LINK_GCC_C_SEQUENCE_SPEC \
-+  "--start-group %G %L --end-group"
-+
-+#undef	LINK_SPEC
-+#define LINK_SPEC " %D %{shared:-shared}"
-+
-+
-diff -urN ../gcc-4.2.2/gcc/config/t-tyndur ./gcc/config/t-tyndur
---- ../gcc-4.2.2/gcc/config/t-tyndur	1970-01-01 01:00:00.000000000 +0100
-+++ ./gcc/config/t-tyndur	2008-02-07 23:15:57.000000000 +0100
-@@ -0,0 +1,9 @@
-+# Compile crtbeginS.o and crtendS.o with pic.
-+CRTSTUFF_T_CFLAGS_S = -fPIC
-+
-+# Compile libgcc.a with pic.
-+TARGET_LIBGCC2_CFLAGS += -fPIC
-+
-+SYSTEM_HEADER_DIR = $(prefix)/system/links/include
-+CROSS_SYSTEM_HEADER_DIR = $(prefix)/system/links/include
-+inhibit_libc='true'
-diff -urN ../gcc-4.2.2/gcc/config.gcc ./gcc/config.gcc
---- ../gcc-4.2.2/gcc/config.gcc	2007-09-01 17:28:30.000000000 +0200
-+++ ./gcc/config.gcc	2008-02-03 14:38:18.000000000 +0100
-@@ -500,6 +500,13 @@
-   # Assume that glibc is being used and so __cxa_atexit is provided.
-   default_use_cxa_atexit=yes
-   ;;
-+*-*-tyndur*)
-+  gas=yes
-+  gnu_ld=yes
-+  extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
-+  tmake_file="t-slibgcc-elf-ver t-tyndur"
-+  ;;
-+
- *-*-netbsd*)
-   tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic"
-   gas=yes
-@@ -1116,6 +1123,12 @@
- 	gnu_ld=yes
- 	gas=yes
- 	;;
-+i[34567]86-*-tyndur*)
-+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h tyndur.h \
-+        i386/tyndur.h"
-+    tmake_file="i386/t-i386elf i386/t-crtstuff t-tyndur"
-+	;;
-+
- i[34567]86-*-lynxos*)
- 	xm_defines=POSIX
- 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/lynx.h lynx.h"
-diff -urN ../gcc-4.2.2/gcc/c-opts.c ./gcc/c-opts.c
---- ../gcc-4.2.2/gcc/c-opts.c	2007-09-01 17:28:30.000000000 +0200
-+++ ./gcc/c-opts.c	2008-01-27 09:42:49.000000000 +0100
-@@ -326,7 +326,7 @@
- 	    error ("-I- specified twice");
- 	  quote_chain_split = true;
- 	  split_quote_chain ();
--	  inform ("obsolete option -I- used, please use -iquote instead");
-+	  // inform ("obsolete option -I- used, please use -iquote instead");
- 	}
-       break;
- 
-diff -urN ../gcc-4.2.2/libiberty/configure ./libiberty/configure
---- ../gcc-4.2.2/libiberty/configure	2006-08-30 15:46:50.000000000 +0200
-+++ ./libiberty/configure	2008-01-27 09:42:50.000000000 +0100
-@@ -8403,6 +8403,7 @@
-      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
-      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
-      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
-+     *-*-tyndur*)         pexecute=./pex-tyndur.o ;;
-      *)				pexecute=./pex-unix.o   ;;
- esac
- 
-diff -urN ../gcc-4.2.2/libiberty/configure.ac ./libiberty/configure.ac
---- ../gcc-4.2.2/libiberty/configure.ac	2006-08-30 15:46:50.000000000 +0200
-+++ ./libiberty/configure.ac	2008-01-27 09:42:50.000000000 +0100
-@@ -663,6 +663,7 @@
-      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
-      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
-      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
-+     *-*-tyndur*)         pexecute=./pex-tyndur.o ;;
-      *)				pexecute=./pex-unix.o   ;;
- esac
- AC_SUBST(pexecute)
-diff -urN ../gcc-4.2.2/libiberty/Makefile.in ./libiberty/Makefile.in
---- ../gcc-4.2.2/libiberty/Makefile.in	2007-03-03 20:29:51.000000000 +0100
-+++ ./libiberty/Makefile.in	2008-01-27 09:42:50.000000000 +0100
-@@ -145,7 +145,7 @@
- 	objalloc.c obstack.c						\
- 	partition.c pexecute.c						\
- 	 pex-common.c pex-djgpp.c pex-msdos.c pex-one.c			\
--	 pex-unix.c pex-win32.c						\
-+	 pex-unix.c pex-win32.c	pex-tyndur.c			\
-          physmem.c putenv.c						\
- 	random.c regex.c rename.c rindex.c				\
- 	safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c	\
-@@ -843,6 +843,13 @@
- 	else true; fi
- 	$(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION)
- 
-+./pex-tyndur.o: $(srcdir)/pex-tyndur.c config.h $(INCDIR)/ansidecl.h \
-+	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
-+	if [ x"$(PICFLAG)" != x ]; then \
-+	  $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-tyndur.c -o pic/$@; \
-+	else true; fi
-+	$(COMPILE.c) $(srcdir)/pex-tyndur.c $(OUTPUT_OPTION)
-+
- ./pex-msdos.o: $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \
- 	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h \
- 	$(INCDIR)/safe-ctype.h
-diff -urN ../gcc-4.2.2/libiberty/pex-tyndur.c ./libiberty/pex-tyndur.c
---- ../gcc-4.2.2/libiberty/pex-tyndur.c	1970-01-01 01:00:00.000000000 +0100
-+++ ./libiberty/pex-tyndur.c	2008-02-10 16:39:24.000000000 +0100
-@@ -0,0 +1,200 @@
-+/* Utilities to execute a program in a subprocess (possibly linked by pipes
-+   with other subprocesses), and wait for it.  Generic Unix version
-+   (also used for UWIN and VMS).
-+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
-+   Free Software Foundation, Inc.
-+
-+This file is part of the libiberty library.
-+Libiberty is free software; you can redistribute it and/or
-+modify it under the terms of the GNU Library General Public
-+License as published by the Free Software Foundation; either
-+version 2 of the License, or (at your option) any later version.
-+
-+Libiberty 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Library General Public
-+License along with libiberty; see the file COPYING.LIB.  If not,
-+write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-+Boston, MA 02110-1301, USA.  */
-+
-+#include "config.h"
-+#include "libiberty.h"
-+#include "pex-common.h"
-+
-+#include <stdio.h>
-+#include <signal.h>
-+#include <errno.h>
-+#include <init.h>
-+#ifdef NEED_DECLARATION_ERRNO
-+extern int errno;
-+#endif
-+#ifdef HAVE_STDLIB_H
-+#include <stdlib.h>
-+#endif
-+#ifdef HAVE_STRING_H
-+#include <string.h>
-+#endif
-+#ifdef HAVE_UNISTD_H
-+#include <unistd.h>
-+#endif
-+
-+#include <sys/types.h>
-+
-+#ifdef HAVE_FCNTL_H
-+#include <fcntl.h>
-+#endif
-+#ifdef HAVE_SYS_WAIT_H
-+#include <sys/wait.h>
-+#endif
-+#ifdef HAVE_GETRUSAGE
-+#include <sys/time.h>
-+#include <sys/resource.h>
-+#endif
-+#ifdef HAVE_SYS_STAT_H
-+#include <sys/stat.h>
-+#endif
-+
-+
-+static int pex_tyndur_open_read (struct pex_obj *, const char *, int);
-+static int pex_tyndur_open_write (struct pex_obj *, const char *, int);
-+static long pex_tyndur_exec_child (struct pex_obj *, int, const char *,
-+				 char * const *, char * const *,
-+				 int, int, int, int,
-+				 const char **, int *);
-+static int pex_tyndur_close (struct pex_obj *, int);
-+static int pex_tyndur_wait (struct pex_obj *, long, int *, struct pex_time *,
-+			  int, const char **, int *);
-+static int pex_tyndur_pipe (struct pex_obj *, int *, int);
-+static FILE *pex_tyndur_fdopenr (struct pex_obj *, int, int);
-+static FILE *pex_tyndur_fdopenw (struct pex_obj *, int, int);
-+static void pex_tyndur_cleanup (struct pex_obj *);
-+
-+/* The list of functions we pass to the common routines.  */
-+
-+const struct pex_funcs funcs =
-+{
-+  pex_tyndur_open_read,
-+  pex_tyndur_open_write,
-+  pex_tyndur_exec_child,
-+  pex_tyndur_close,
-+  pex_tyndur_wait,
-+  NULL,
-+  NULL,
-+  NULL,
-+  NULL
-+};
-+
-+/* Return a newly initialized pex_obj structure.  */
-+
-+struct pex_obj *
-+pex_init (int flags, const char *pname, const char *tempbase)
-+{
-+  return pex_init_common (flags, pname, tempbase, &funcs);
-+}
-+
-+/* Open a file for reading.  */
-+
-+static int
-+pex_tyndur_open_read (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
-+		    int binary ATTRIBUTE_UNUSED)
-+{
-+  return open (name, O_RDONLY);
-+}
-+
-+/* Open a file for writing.  */
-+
-+static int
-+pex_tyndur_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
-+		     int binary ATTRIBUTE_UNUSED)
-+{
-+  /* Note that we can't use O_EXCL here because gcc may have already
-+     created the temporary file via make_temp_file.  */
-+  return open (name, O_WRONLY | O_CREAT | O_TRUNC);
-+}
-+
-+/* Close a file.  */
-+
-+static int
-+pex_tyndur_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd)
-+{
-+  return close (fd);
-+}
-+
-+/* Execute a child.  */
-+static long
-+pex_tyndur_exec_child (struct pex_obj *obj, int flags, const char *executable,
-+		     char * const * argv, char * const * env,
-+                     int in, int out, int errdes,
-+		     int toclose, const char **errmsg, int *err)
-+{
-+  size_t len;
-+  int i;
-+  long pid = 0;
-+  /* TODO: We need to find some way to get the env vars to the
-+     child, use the pipes and in/out/errdes.  */
-+  
-+  /* We are going to copy the path to the executable and all the
-+     arguments into one string because there is no other possibility
-+     at the moment for TYNDUR.  */
-+  
-+  /* Calculate the total length of the commandline.  */
-+  len = strlen (executable);
-+  for (i = 1; argv[i] != NULL; i++) {
-+      /* Argument + space  */
-+    len += strlen (argv[i]) + 1;
-+  }
-+  
-+  /* We need a new block because of the dynamically sized array.  */
-+  do {
-+    char cmd[len];
-+    int pos = 0;
-+    pos = strlen (executable);
-+    strcpy (cmd, executable);
-+    
-+    for (i = 1; argv[i] != NULL; i++) {
-+      cmd[pos++] = ' ';
-+      strcpy (cmd + pos, argv[i]);
-+      pos += strlen (argv[i]);
-+    }
-+
-+    /* Now that we have the command string the hard part is done.  */
-+    pid = init_execute(cmd);
-+  } while (0);
-+
-+  if (pid == 0) {
-+    *err = errno;
-+    *errmsg = "pex_tyndur_exec_child";
-+    return -1;
-+  } else {
-+    return pid;
-+  }
-+}
-+
-+/* Wait for a child process to complete.  */
-+
-+static int
-+pex_tyndur_wait (struct pex_obj *obj, long pid, int *status,
-+	       struct pex_time *time, int done, const char **errmsg,
-+	       int *err)
-+{
-+  /* If we are cleaning up when the caller didn't retrieve process
-+     status for some reason, encourage the process to go away.  */
-+  if (done)
-+    kill (pid, SIGTERM);
-+
-+  /* Without wait4 or getrusage we can't get any information about
-+     the resource usage. So we fill it up with zero.  */
-+  if (time != NULL)
-+    memset (time, 0, sizeof (struct pex_time));
-+
-+  if (waitpid (pid, status, 0) < 0) {
-+    *err = errno;
-+    *errmsg = "pex_tyndur_wait";
-+    return -1;
-+  }
-+  return 0;
-+}
-+
diff --git a/patches/gcc/4.5.2/gcc-4.5.2.patch b/patches/gcc/4.5.2/gcc-4.5.2.patch
new file mode 100644
index 0000000..5053246
--- /dev/null
+++ b/patches/gcc/4.5.2/gcc-4.5.2.patch
@@ -0,0 +1,463 @@
+diff -urN ../gcc-4.5.2/config.sub ./config.sub
+--- ../gcc-4.5.2/config.sub	2006-10-16 05:27:17.000000000 +0200
++++ ./config.sub	2008-01-27 09:42:49.000000000 +0100
+@@ -127,7 +127,7 @@
+   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+   kopensolaris*-gnu* | \
+-  storm-chaos* | os2-emx* | rtmk-nova*)
++  tyndur* | storm-chaos* | os2-emx* | rtmk-nova*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+@@ -1345,6 +1345,9 @@
+ 	-linux*)
+ 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ 		;;
++    -tyndur*)
++        os=-tyndur
++        ;;
+ 	-sunos5*)
+ 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ 		;;
+diff -urN ../gcc-4.5.2/gcc/config/i386/tyndur.h ./gcc/config/i386/tyndur.h
+--- ../gcc-4.5.2/gcc/config/i386/tyndur.h	1970-01-01 01:00:00.000000000 +0100
++++ ./gcc/config/i386/tyndur.h	2008-01-27 09:42:49.000000000 +0100
+@@ -0,0 +1,56 @@
++/* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
++   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2005,
++   2006, 2007 Free Software Foundation, Inc.
++   Contributed by Eric Youngdale.
++   Modified for stabs-in-ELF by H.J. Lu.
++   Adapted from linux.h by Antoine Kaufmann
++
++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 3, 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 COPYING3.  If not see
++<http://www.gnu.org/licenses/>.  */
++
++/* Output at beginning of assembler file.  */
++/* The .file command should always begin the output.  */
++#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
++
++#define TARGET_VERSION fprintf (stderr, " (i386 TYNDUR/ELF)");
++
++/* The svr4 ABI for the i386 says that records and unions are returned
++   in memory.  */
++#undef DEFAULT_PCC_STRUCT_RETURN
++#define DEFAULT_PCC_STRUCT_RETURN 1
++
++#undef ASM_COMMENT_START
++#define ASM_COMMENT_START "#"
++
++#undef SIZE_TYPE
++#define SIZE_TYPE "unsigned int"
++ 
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "int"
++  
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "long int"
++   
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE BITS_PER_WORD
++    
++#define TARGET_OS_CPP_BUILTINS()		\
++  do						\
++    {						\
++	TYNDUR_TARGET_OS_CPP_BUILTINS();		\
++    }						\
++  while (0)
++
+diff -urN ../gcc-4.5.2/gcc/config/tyndur.h ./gcc/config/tyndur.h
+--- ../gcc-4.5.2/gcc/config/tyndur.h	1970-01-01 01:00:00.000000000 +0100
++++ ./gcc/config/tyndur.h	2008-02-10 17:17:37.000000000 +0100
+@@ -0,0 +1,59 @@
++/* Definitions for Linux-based GNU systems with ELF format
++   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006,
++   2007 Free Software Foundation, Inc.
++   Contributed by Eric Youngdale.
++   Modified for stabs-in-ELF by H.J. Lu (hjl@xxxxxxxxx).
++   Adapted from linux.h by Antoine Kaufmann
++
++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 3, 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 COPYING3.  If not see
++<http://www.gnu.org/licenses/>.  */
++
++/* Don't assume anything about the header files.  */
++#define NO_IMPLICIT_EXTERN_C
++
++/* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
++   the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
++   provides part of the support for getting C++ file-scope static
++   object constructed before entering `main'.  */
++   
++#undef	STARTFILE_SPEC
++#define STARTFILE_SPEC \
++  "crtbegin.o%s -l:crttyndur.o"
++
++/* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
++   the GNU/Linux magical crtend.o file (see crtstuff.c) which
++   provides part of the support for getting C++ file-scope static
++   object constructed before entering `main', followed by a normal
++   GNU/Linux "finalizer" file, `crtn.o'.  */
++
++#undef	ENDFILE_SPEC
++#define ENDFILE_SPEC \
++  "crtend.o%s"
++
++#define TYNDUR_TARGET_OS_CPP_BUILTINS()			\
++    do {					    	    	    \
++	builtin_define ("__TYNDUR__");    			\
++	builtin_define_std ("TYNDUR");				\
++	builtin_assert ("system=TYNDUR");			    \
++    } while (0)
++
++#define LINK_GCC_C_SEQUENCE_SPEC \
++  "--start-group %G %L --end-group"
++
++#undef	LINK_SPEC
++#define LINK_SPEC " %D %{shared:-shared}"
++
++
+diff -urN ../gcc-4.5.2/gcc/config/t-tyndur ./gcc/config/t-tyndur
+--- ../gcc-4.5.2/gcc/config/t-tyndur	1970-01-01 01:00:00.000000000 +0100
++++ ./gcc/config/t-tyndur	2008-02-07 23:15:57.000000000 +0100
+@@ -0,0 +1,9 @@
++# Compile crtbeginS.o and crtendS.o with pic.
++CRTSTUFF_T_CFLAGS_S = -fPIC
++
++# Compile libgcc.a with pic.
++TARGET_LIBGCC2_CFLAGS += -fPIC
++
++SYSTEM_HEADER_DIR = $(prefix)/system/links/include
++CROSS_SYSTEM_HEADER_DIR = $(prefix)/system/links/include
++inhibit_libc='true'
+diff -urN ../gcc-4.5.2/gcc/config.gcc ./gcc/config.gcc
+--- ../gcc-4.5.2/gcc/config.gcc	2007-09-01 17:28:30.000000000 +0200
++++ ./gcc/config.gcc	2008-02-03 14:38:18.000000000 +0100
+@@ -534,6 +534,12 @@
+   use_gcc_tgmath=no
+   use_gcc_stdint=wrap
+   ;;
++*-*-tyndur*)
++  gas=yes
++  gnu_ld=yes
++  extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
++  tmake_file="t-slibgcc-elf-ver t-tyndur"
++  ;;
+ *-*-netbsd*)
+   tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic"
+   gas=yes
+@@ -1198,6 +1198,12 @@
+ 	gas=yes
+ 	use_gcc_stdint=wrap
+ 	;;
++i[34567]86-*-tyndur*)
++	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h tyndur.h \
++        i386/tyndur.h"
++    tmake_file="i386/t-i386elf i386/t-crtstuff t-tyndur"
++	;;
++
+ i[34567]86-*-lynxos*)
+ 	xm_defines=POSIX
+ 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/lynx.h lynx.h"
+diff -urN ../gcc-4.5.2/gcc/c-opts.c ./gcc/c-opts.c
+--- ../gcc-4.5.2/gcc/c-opts.c	2007-09-01 17:28:30.000000000 +0200
++++ ./gcc/c-opts.c	2008-01-27 09:42:49.000000000 +0100
+@@ -326,7 +326,7 @@
+ 	    error ("-I- specified twice");
+ 	  quote_chain_split = true;
+ 	  split_quote_chain ();
+-	  inform (input_location, "obsolete option -I- used, please use -iquote instead");
++	  // inform (input_location, "obsolete option -I- used, please use -iquote instead");
+ 	}
+       break;
+ 
+diff -urN ../gcc-4.5.2/libiberty/configure ./libiberty/configure
+--- ../gcc-4.5.2/libiberty/configure	2006-08-30 15:46:50.000000000 +0200
++++ ./libiberty/configure	2008-01-27 09:42:50.000000000 +0100
+@@ -6536,6 +6536,7 @@
+      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
+      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
+      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
++     *-*-tyndur*)         pexecute=./pex-tyndur.o ;;
+      *)				pexecute=./pex-unix.o   ;;
+ esac
+ 
+diff -urN ../gcc-4.5.2/libiberty/configure.ac ./libiberty/configure.ac
+--- ../gcc-4.5.2/libiberty/configure.ac	2006-08-30 15:46:50.000000000 +0200
++++ ./libiberty/configure.ac	2008-01-27 09:42:50.000000000 +0100
+@@ -674,6 +674,7 @@
+      *-*-mingw* | *-*-winnt*)	pexecute=./pex-win32.o  ;;
+      *-*-msdosdjgpp*)		pexecute=./pex-djgpp.o  ;;
+      *-*-msdos*)		pexecute=./pex-msdos.o  ;;
++     *-*-tyndur*)         pexecute=./pex-tyndur.o ;;
+      *)				pexecute=./pex-unix.o   ;;
+ esac
+ AC_SUBST(pexecute)
+diff -urN ../gcc-4.5.2/libiberty/Makefile.in ./libiberty/Makefile.in
+--- ../gcc-4.5.2/libiberty/Makefile.in	2007-03-03 20:29:51.000000000 +0100
++++ ./libiberty/Makefile.in	2008-01-27 09:42:50.000000000 +0100
+@@ -140,7 +140,7 @@
+ 	objalloc.c obstack.c						\
+ 	partition.c pexecute.c						\
+ 	 pex-common.c pex-djgpp.c pex-msdos.c pex-one.c			\
+-	 pex-unix.c pex-win32.c						\
++	 pex-unix.c pex-win32.c	pex-tyndur.c			\
+          physmem.c putenv.c						\
+ 	random.c regex.c rename.c rindex.c				\
+ 	safe-ctype.c setenv.c sha1.c sigsetmask.c snprintf.c sort.c	\
+@@ -845,6 +845,13 @@
+ 	else true; fi
+ 	$(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION)
+ 
++./pex-tyndur.o: $(srcdir)/pex-tyndur.c config.h $(INCDIR)/ansidecl.h \
++	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h
++	if [ x"$(PICFLAG)" != x ]; then \
++	  $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-tyndur.c -o pic/$@; \
++	else true; fi
++	$(COMPILE.c) $(srcdir)/pex-tyndur.c $(OUTPUT_OPTION)
++
+ ./pex-msdos.o: $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \
+ 	$(INCDIR)/libiberty.h $(srcdir)/pex-common.h \
+ 	$(INCDIR)/safe-ctype.h
+diff -urN ../gcc-4.5.2/libiberty/pex-tyndur.c ./libiberty/pex-tyndur.c
+--- ../gcc-4.5.2/libiberty/pex-tyndur.c	1970-01-01 01:00:00.000000000 +0100
++++ ./libiberty/pex-tyndur.c	2008-02-10 16:39:24.000000000 +0100
+@@ -0,0 +1,200 @@
++/* Utilities to execute a program in a subprocess (possibly linked by pipes
++   with other subprocesses), and wait for it.  Generic Unix version
++   (also used for UWIN and VMS).
++   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
++   Free Software Foundation, Inc.
++
++This file is part of the libiberty library.
++Libiberty is free software; you can redistribute it and/or
++modify it under the terms of the GNU Library General Public
++License as published by the Free Software Foundation; either
++version 2 of the License, or (at your option) any later version.
++
++Libiberty 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
++Library General Public License for more details.
++
++You should have received a copy of the GNU Library General Public
++License along with libiberty; see the file COPYING.LIB.  If not,
++write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
++Boston, MA 02110-1301, USA.  */
++
++#include "config.h"
++#include "libiberty.h"
++#include "pex-common.h"
++
++#include <stdio.h>
++#include <signal.h>
++#include <errno.h>
++#include <init.h>
++#ifdef NEED_DECLARATION_ERRNO
++extern int errno;
++#endif
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
++#ifdef HAVE_STRING_H
++#include <string.h>
++#endif
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include <sys/types.h>
++
++#ifdef HAVE_FCNTL_H
++#include <fcntl.h>
++#endif
++#ifdef HAVE_SYS_WAIT_H
++#include <sys/wait.h>
++#endif
++#ifdef HAVE_GETRUSAGE
++#include <sys/time.h>
++#include <sys/resource.h>
++#endif
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++
++
++static int pex_tyndur_open_read (struct pex_obj *, const char *, int);
++static int pex_tyndur_open_write (struct pex_obj *, const char *, int);
++static long pex_tyndur_exec_child (struct pex_obj *, int, const char *,
++				 char * const *, char * const *,
++				 int, int, int, int,
++				 const char **, int *);
++static int pex_tyndur_close (struct pex_obj *, int);
++static int pex_tyndur_wait (struct pex_obj *, long, int *, struct pex_time *,
++			  int, const char **, int *);
++static int pex_tyndur_pipe (struct pex_obj *, int *, int);
++static FILE *pex_tyndur_fdopenr (struct pex_obj *, int, int);
++static FILE *pex_tyndur_fdopenw (struct pex_obj *, int, int);
++static void pex_tyndur_cleanup (struct pex_obj *);
++
++/* The list of functions we pass to the common routines.  */
++
++const struct pex_funcs funcs =
++{
++  pex_tyndur_open_read,
++  pex_tyndur_open_write,
++  pex_tyndur_exec_child,
++  pex_tyndur_close,
++  pex_tyndur_wait,
++  NULL,
++  NULL,
++  NULL,
++  NULL
++};
++
++/* Return a newly initialized pex_obj structure.  */
++
++struct pex_obj *
++pex_init (int flags, const char *pname, const char *tempbase)
++{
++  return pex_init_common (flags, pname, tempbase, &funcs);
++}
++
++/* Open a file for reading.  */
++
++static int
++pex_tyndur_open_read (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
++		    int binary ATTRIBUTE_UNUSED)
++{
++  return open (name, O_RDONLY);
++}
++
++/* Open a file for writing.  */
++
++static int
++pex_tyndur_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
++		     int binary ATTRIBUTE_UNUSED)
++{
++  /* Note that we can't use O_EXCL here because gcc may have already
++     created the temporary file via make_temp_file.  */
++  return open (name, O_WRONLY | O_CREAT | O_TRUNC);
++}
++
++/* Close a file.  */
++
++static int
++pex_tyndur_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd)
++{
++  return close (fd);
++}
++
++/* Execute a child.  */
++static long
++pex_tyndur_exec_child (struct pex_obj *obj, int flags, const char *executable,
++		     char * const * argv, char * const * env,
++                     int in, int out, int errdes,
++		     int toclose, const char **errmsg, int *err)
++{
++  size_t len;
++  int i;
++  long pid = 0;
++  /* TODO: We need to find some way to get the env vars to the
++     child, use the pipes and in/out/errdes.  */
++  
++  /* We are going to copy the path to the executable and all the
++     arguments into one string because there is no other possibility
++     at the moment for TYNDUR.  */
++  
++  /* Calculate the total length of the commandline.  */
++  len = strlen (executable);
++  for (i = 1; argv[i] != NULL; i++) {
++      /* Argument + space  */
++    len += strlen (argv[i]) + 1;
++  }
++  
++  /* We need a new block because of the dynamically sized array.  */
++  do {
++    char cmd[len];
++    int pos = 0;
++    pos = strlen (executable);
++    strcpy (cmd, executable);
++    
++    for (i = 1; argv[i] != NULL; i++) {
++      cmd[pos++] = ' ';
++      strcpy (cmd + pos, argv[i]);
++      pos += strlen (argv[i]);
++    }
++
++    /* Now that we have the command string the hard part is done.  */
++    pid = init_execute(cmd);
++  } while (0);
++
++  if (pid == 0) {
++    *err = errno;
++    *errmsg = "pex_tyndur_exec_child";
++    return -1;
++  } else {
++    return pid;
++  }
++}
++
++/* Wait for a child process to complete.  */
++
++static int
++pex_tyndur_wait (struct pex_obj *obj, long pid, int *status,
++	       struct pex_time *time, int done, const char **errmsg,
++	       int *err)
++{
++  /* If we are cleaning up when the caller didn't retrieve process
++     status for some reason, encourage the process to go away.  */
++  if (done)
++    kill (pid, SIGTERM);
++
++  /* Without wait4 or getrusage we can't get any information about
++     the resource usage. So we fill it up with zero.  */
++  if (time != NULL)
++    memset (time, 0, sizeof (struct pex_time));
++
++  if (waitpid (pid, status, 0) < 0) {
++    *err = errno;
++    *errmsg = "pex_tyndur_wait";
++    return -1;
++  }
++  return 0;
++}
++
+diff -urN ../gcc-4.5.2/libgcc/config.host ../gcc-4.5.2/libgcc/config.host.new
+--- ../gcc-4.5.2/libgcc/config.host  2011-01-07 18:58:35.599648002 +0100
++++ ../gcc-4.5.2/libgcc/config.host  2011-01-07 18:58:43.229648001 +0100
+@@ -292,6 +292,8 @@
+ 	;;
+ i[34567]86-*-openbsd*)
+ 	;;
++*-*-tyndur*)
++	;;
+ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*)
+ 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
diff --git a/scripts/build_crosstools b/scripts/build_crosstools
index abd8f82..a32bdbc 100755
--- a/scripts/build_crosstools
+++ b/scripts/build_crosstools
@@ -1,4 +1,23 @@
 #!/bin/bash
+
+# Versionen der Tools
+BINUTILS_VERSION=2.21
+GCC_VERSION=4.5.2
+NEEDS_GMP_MAJOR=4
+NEEDS_GMP_MINOR=3
+NEEDS_GMP_PATCHLEVEL=2
+NEEDS_MPFR_MAJOR=2
+NEEDS_MPFR_MINOR=4
+NEEDS_MPFR_PATCHLEVEL=2
+NEEDS_MPC_MAJOR=0
+NEEDS_MPC_MINOR=8
+NEEDS_MPC_PATCHLEVEL=1
+GMP_VERSION=5.0.1
+MPFR_VERSION=3.0.0
+MPC_VERSION=0.8.2
+FPC_VERSION=2.4.0
+FASM_VERSION=1.69.09
+
 PREFIX=`pwd`/env
 TARGET=i386-pc-tyndur
 PATCHES=`pwd`/patches
@@ -6,6 +25,12 @@ TMP=`pwd`/tmp
 LOGS=${TMP}
 MAKEOPTS=-j3
 
+# interne Variablen
+GCC_CONFIGURE_PARAMS=
+BUILD_GMP=
+BUILD_MPFR=
+BUILD_MPC=
+
 die() {
     echo -e "$1"
     exit -1
@@ -20,18 +45,97 @@ mkdir -p ${TMP}/cross-gcc/build
 mkdir -p ${TMP}/cross-fpc
 mkdir -p ${TMP}/cross-fasm
 
+#
+# User nerven
+#
+
+# Überprüfen ob GMP in richtiger Version installiert
+cat <<EOF > libgmp-test.c
+#include <gmp.h>
+#if __GNU_MP_VERSION < ${NEEDS_GMP_MAJOR} || (__GNU_MP_VERSION == ${NEEDS_GMP_MAJOR} && (__GNU_MP_VERSION_MINOR < ${NEEDS_GMP_MINOR} || (__GNU_MP_VERSION_MINOR == ${NEEDS_GMP_MINOR} && __GNU_MP_VERSION_PATCHLEVEL < ${NEEDS_GMP_PATCHLEVEL})))
+#error unsupported version
+#endif
+int main(){}
+EOF
+
+gcc libgmp-test.c -lgmp -o libgmp-test &> /dev/null
+gcc_state=$?
+rm -f libgmp-test libgmp-test.c
+if [ $gcc_state != 0 ]; then
+  echo "Entweder die Entwicklerpakete für GMP sind nicht installiert oder in einer veralteten Version (< ${NEEDS_GMP_MAJOR}.${NEEDS_GMP_MINOR}.${NEEDS_GMP_PATCHLEVEL})."\
+       "Wollen sie die Pakete von Hand nachinstallieren bzw. updaten ('j' eingeben)? Falls ihre Distribution keine so aktuellen Pakete zur Verfügung stellt,"\
+       "geben Sie bitte 'n' ein und der GMP Quellcode wird automatisch heruntergeladen und installiert (ohne eine vorhandene Installation von GMP zu beeinträchtigen)"
+
+  read should_die
+  [ "$should_die" == "n" ] || die "Fehler: GMP Bibliothek in Version >= ${NEEDS_GMP_MAJOR}.${NEEDS_GMP_MINOR}.${NEEDS_GMP_PATCHLEVEL} (inklusive -dev Paket) benötigt";
+
+  BUILD_GMP=1
+  GCC_CONFIGURE_PARAMS+="--with-gmp-include=${TMP}/cross-gcc/build/gmp --with-gmp-lib=${TMP}/cross-gcc/build/gmp/.libs"
+fi
+
+# Überprüfen ob MPFR in richtiger Version installiert
+cat <<EOF > libmpfr-test.c
+#include <mpfr.h>
+#if MPFR_VERSION_MAJOR < ${NEEDS_MPFR_MAJOR} || (MPFR_VERSION_MAJOR == ${NEEDS_MPFR_MAJOR} && (MPFR_VERSION_MINOR < ${NEEDS_MPFR_MINOR} || (MPFR_VERSION_MINOR == ${NEEDS_MPFR_MINOR} && MPFR_VERSION_PATCHLEVEL < ${NEEDS_MPFR_PATCHLEVEL})))
+#error unsupported version
+#endif
+int main(){}
+EOF
+
+gcc libmpfr-test.c -lgmp -o libmpfr-test &> /dev/null
+gcc_state=$?
+rm -f libmpfr-test libmpfr-test.c
+if [ $gcc_state != 0 ]; then
+  echo "Entweder die Entwicklerpakete für MPFR sind nicht installiert oder in einer veralteten Version (< ${NEEDS_MPFR_MAJOR}.${NEEDS_MPFR_MINOR}.${NEEDS_MPFR_PATCHLEVEL})."\
+       "Wollen sie die Pakete von Hand nachinstallieren bzw. updaten ('j' eingeben)? Falls ihre Distribution keine so aktuellen Pakete zur Verfügung stellt,"\
+       "geben Sie bitte 'n' ein und der MPFR Quellcode wird automatisch heruntergeladen und installiert (ohne eine vorhandene Installation von MPFR zu beeinträchtigen)"
+
+  read should_die
+  [ "$should_die" == "n" ] || die "Fehler: MPFR Bibliothek in Version >= ${NEEDS_MPFR_MAJOR}.${NEEDS_MPFR_MINOR}.${NEEDS_MPFR_PATCHLEVEL} (inklusive -dev Paket) benötigt";
+
+  BUILD_MPFR=1
+fi
+
+# Überprüfen ob MPC in richtiger Version installiert
+cat <<EOF > libmpc-test.c
+#include <mpc.h>
+#if MPC_VERSION_MAJOR < ${NEEDS_MPC_MAJOR} || (MPC_VERSION_MAJOR == ${NEEDS_MPC_MAJOR} && (MPC_VERSION_MINOR < ${NEEDS_MPC_MINOR} || (MPC_VERSION_MINOR == ${NEEDS_MPC_MINOR} && MPC_VERSION_PATCHLEVEL < ${NEEDS_MPC_PATCHLEVEL})))
+#error unsupported version
+#endif
+int main(){}
+EOF
+
+gcc libmpc-test.c -lgmp -o libmpc-test &> /dev/null
+gcc_state=$?
+rm -f libmpc-test.c libmpc-test
+if [ $gcc_state != 0 ]; then
+  echo "Entweder die Entwicklerpakete für MPC sind nicht installiert oder in einer veralteten Version (< ${NEEDS_MPC_MAJOR}.${NEEDS_MPC_MINOR}.${NEEDS_MPC_PATCHLEVEL})."\
+       "Wollen sie die Pakete von Hand nachinstallieren bzw. updaten ('j' eingeben)? Falls ihre Distribution keine so aktuellen Pakete zur Verfügung stellt,"\
+       "geben Sie bitte 'n' ein und der MPC Quellcode wird automatisch heruntergeladen und installiert (ohne eine vorhandene Installation von MPC zu beeinträchtigen)"
+
+  read should_die
+  [ "$should_die" == "n" ] || die "Fehler: MPC Bibliothek in Version >= ${NEEDS_MPC_MAJOR}.${NEEDS_MPC_MINOR}.${NEEDS_MPC_PATCHLEVEL} (inklusive -dev Paket) benötigt";
+
+  BUILD_MPC=1
+fi
+
+
+#
+# Binutils
+#
 if [ ! -f $PREFIX/bin/i386-pc-tyndur-ld ]; then
-rm -rf ${TMP}/cross-binutils/binutils-2.18/
+rm -rf ${TMP}/cross-binutils/binutils-${BINUTILS_VERSION}/
 cd ${TMP}/cross-binutils
+echo "[binutils] Version " ${BINUTILS_VERSION}
 echo "[binutils] Herunterladen..."
-[ -f binutils-2.18.tar.bz2 ] || wget -q http://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.bz2 || die "Fehler beim Herunterladen.\nSiehe tmp/binutils.log für Details."
+[ -f binutils-${BINUTILS_VERSION}.tar.bz2 ] || wget -q http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.bz2 || die "Fehler beim Herunterladen."
 echo "[binutils] Entpacken..."
-tar -xjf binutils-2.18.tar.bz2 || die "Fehler beim Entpacken.\nSiehe tmp/binutils.log für Details."
+tar -xjf binutils-${BINUTILS_VERSION}.tar.bz2 || die "Fehler beim Entpacken."
 echo "[binutils] Patch anwenden..."
-patch -p0 -d binutils-2.18/ < ${PATCHES}/binutils/2.18/binutils-2.18.patch >${LOGS}/binutils.log || die "Fehler beim Anwenden des Patches.\nSiehe tmp/binutils.log für Details."
+patch -p0 -d binutils-${BINUTILS_VERSION}/ < ${PATCHES}/binutils/${BINUTILS_VERSION}/binutils-${BINUTILS_VERSION}.patch >${LOGS}/binutils.log || die "Fehler beim Anwenden des Patches.\nSiehe tmp/binutils.log für Details."
 cd build
 echo "[binutils] Konfigurieren..."
-../binutils-2.18/configure --prefix="${PREFIX}" --with-sysroot=${PREFIX} --target=${TARGET} --disable-nls --disable-werror >>${LOGS}/binutils.log || die "Fehler beim Konfigurieren.\nSiehe tmp/binutils.log für Details."
+../binutils-${BINUTILS_VERSION}/configure --prefix="${PREFIX}" --with-sysroot=${PREFIX} --target=${TARGET} --disable-nls --disable-werror >>${LOGS}/binutils.log || die "Fehler beim Konfigurieren.\nSiehe tmp/binutils.log für Details."
 echo "[binutils] Kompilieren..."
 make ${MAKEOPTS} >>${LOGS}/binutils.log 2>>${LOGS}/binutils.log || die "Fehler beim Kompilieren.\nSiehe tmp/binutils.log für Details."
 echo "[binutils] Installieren..."
@@ -39,42 +143,86 @@ make install ${MAKEOPTS} >>${LOGS}/binutils.log 2>>${LOGS}/binutils.log || die "
 echo -e "[binutils] Abgeschlossen\n"
 fi
 
-if [ ! -f $PREFIX/bin/i386-pc-tyndur-gcc ]; then
-rm -rf ${TMP}/cross-gcc/gcc-4.2.2/
+#
+# GCC
+#
+if [ ! -f $PREFIX/bin/i386-pc-tyndur-gcc ]; then
+
+# HACK: Ansonsten wird libgcc nicht kompiliert
+rm -f env/include/limits.h
+
+# GCC herunterladen & entpacken
+rm -rf ${TMP}/cross-gcc/build ${TMP}/cross-gcc/gcc-${GCC_VERSION}/
 cd ${TMP}/cross-gcc
+mkdir build
+echo "[gcc] Version " ${GCC_VERSION}
 echo "[gcc] Herunterladen..."
-[ -f gcc-core-4.2.2.tar.bz2 ] || wget -q http://ftp.gnu.org/gnu/gcc/gcc-4.2.2/gcc-core-4.2.2.tar.bz2 || die "Fehler beim Herunterladen von gcc-core.\nSiehe tmp/gcc.log für Details."
-[ -f gcc-g++-4.2.2.tar.bz2 ] || wget -q http://ftp.gnu.org/gnu/gcc/gcc-4.2.2/gcc-g++-4.2.2.tar.bz2 || die "Fehler beim Herunterladen von gcc-g++.\nSiehe tmp/gcc.log für Details."
+[ -f gcc-core-${GCC_VERSION}.tar.bz2 ] || wget -q http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-core-${GCC_VERSION}.tar.bz2 || die "Fehler beim Herunterladen von gcc-core."
+[ -f gcc-g++-${GCC_VERSION}.tar.bz2 ] || wget -q http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-g++-${GCC_VERSION}.tar.bz2 || die "Fehler beim Herunterladen von gcc-g++."
 echo "[gcc] Entpacken..."
-tar -xjf gcc-core-4.2.2.tar.bz2
-tar -xjf gcc-g++-4.2.2.tar.bz2
+tar -xjf gcc-core-${GCC_VERSION}.tar.bz2 || die "Fehler beim Entpacken von gcc-core."
+tar -xjf gcc-g++-${GCC_VERSION}.tar.bz2 || die "Fehler beim Entpacken von gcc-g++."
+
+if ! [ -z ${BUILD_GMP} ]; then
+  echo "[gmp] Version " ${GMP_VERSION}
+  echo "[gmp] Herunterladen..."
+  [ -f gmp-${GMP_VERSION}.tar.bz2 ] || wget -q ftp://ftp.gmplib.org/pub/gmp-${GMP_VERSION}/gmp-${GMP_VERSION}.tar.bz2 || die "Fehler beim Herunterladen."
+  echo "[gmp] Entpacken..."
+  (tar -xjf gmp-${GMP_VERSION}.tar.bz2 && mv gmp-${GMP_VERSION} ${TMP}/cross-gcc/gcc-${GCC_VERSION}/gmp ) || die "Fehler beim Entpacken."
+fi
+
+if ! [ -z ${BUILD_MPFR} ]; then
+  echo "[mpfr] Version " ${MPFR_VERSION}
+  echo "[mpfr] Herunterladen..."
+  [ -f mpfr-${MPFR_VERSION}.tar.bz2 ] || wget -q http://www.mpfr.org/mpfr-current/mpfr-${MPFR_VERSION}.tar.bz2 || die "Fehler beim Herunterladen."
+  echo "[mpfr] Entpacken..."
+  (tar -xjf mpfr-${MPFR_VERSION}.tar.bz2 && mv mpfr-${MPFR_VERSION} ${TMP}/cross-gcc/gcc-${GCC_VERSION}/mpfr ) || die "Fehler beim Entpacken."
+fi
+
+if ! [ -z ${BUILD_MPC} ]; then
+  echo "[mpc] Version " ${MPC_VERSION}
+  echo "[mpc] Herunterladen..."
+  [ -f mpc-${MPC_VERSION}.tar.gz ] || wget -q http://www.multiprecision.org/mpc/download/mpc-${MPC_VERSION}.tar.gz || die "Fehler beim Herunterladen."
+  echo "[mpc] Entpacken..."
+  (tar -xf mpc-${MPC_VERSION}.tar.gz && mv mpc-${MPC_VERSION} ${TMP}/cross-gcc/gcc-${GCC_VERSION}/mpc ) || die "Fehler beim Entpacken."
+fi
+
+# GCC patchen & bauen
 echo "[gcc] Patch anwenden..."
-patch -p0 -d gcc-4.2.2/ < ${PATCHES}/gcc/4.2.2/gcc-4.2.2.patch >${LOGS}/gcc.log || die "Fehler beim Anwenden des Patches.\nSiehe tmp/gcc.log für Details."
+patch -p0 -d gcc-${GCC_VERSION}/ < ${PATCHES}/gcc/${GCC_VERSION}/gcc-${GCC_VERSION}.patch >${LOGS}/gcc.log || die "Fehler beim Anwenden des Patches.\nSiehe tmp/gcc.log für Details."
 cd build
 echo "[gcc] Konfigurieren..."
-../gcc-4.2.2/configure --prefix="${PREFIX}" --target=${TARGET} --disable-nls --enable-languages=c,c++ --disable-shared --disable-libssp >>${LOGS}/gcc.log 2>>${LOGS}/gcc.log|| die "Fehler beim Konfigurieren.\nSiehe tmp/gcc.log für Details."
+../gcc-${GCC_VERSION}/configure --prefix="${PREFIX}" --target=${TARGET} --disable-nls --enable-languages=c,c++ --disable-shared --disable-libssp ${GCC_CONFIGURE_PARAMS} >>${LOGS}/gcc.log 2>>${LOGS}/gcc.log|| die "Fehler beim Konfigurieren.\nSiehe tmp/gcc.log für Details."
 echo "[gcc] Kompilieren..."
 make all-gcc ${MAKEOPTS} >>${LOGS}/gcc.log 2>>${LOGS}/gcc.log || die "Fehler beim Kompilieren.\nSiehe tmp/gcc.log für Details."
 echo "[gcc] Installieren..."
-make install-gcc ${MAKEOPTS} >>${LOGS}/gcc.log 2>>${LOGS}/gcc.log || die "Fehler beim Installieren.\nSiehe tmp/gcc.log für Details."
+make install-gcc ${MAKEOPTS} >>${LOGS}/gcc.log 2>>${LOGS}/gcc.log || die "Fehler beim Installieren\nSiehe tmp/gcc.log für Details."
+echo "[gcc] Kompilieren (libgcc)..."
+make all-target-libgcc ${MAKEOPTS} >>${LOGS}/gcc.log 2>>${LOGS}/gcc.log || die "Fehler beim Kompilieren der libgcc.\nSiehe tmp/gcc.log für Details."
+echo "[gcc] Installieren (libgcc)..."
+make install-target-libgcc ${MAKEOPTS} >>${LOGS}/gcc.log 2>>${LOGS}/gcc.log || die "Fehler beim Installieren der libgcc.\nSiehe tmp/gcc.log für Details."
 echo -e "[gcc] Abgeschlossen\n"
-fi
+fi
 
+#
+# FPC
+#
 if [ ! -f $PREFIX/bin/fpc ]; then
 
-rm -rf ${TMP}/cross-fpc/fpc-2.4.0/
+rm -rf ${TMP}/cross-fpc/fpc-${FPC_VERSION}/
 cd ${TMP}/cross-fpc
+echo "[fpc] Version " ${FPC_VERSION}
 echo "[fpc] Herunterladen..."
 # [ -f fpc-2.2.2.source.tar.gz ] || wget -q http://gd.tuwien.ac.at/languages/pascal/fpc/dist/source-2.2.2/fpc-2.2.2.source.tar.gz || exit -1
 #[ -f fpc.zip ] || wget -q ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/source/fpc.zip || exit -1
-[ -f fpc-2.4.0.source.tar.gz ] || wget -q ftp://gd.tuwien.ac.at/languages/pascal/fpc/dist/2.4.0/source/fpc-2.4.0.source.tar.gz || die "Fehler beim Herunterladen.\nSiehe tmp/fpc.log für Details."
+[ -f fpc-${FPC_VERSION}.source.tar.gz ] || wget -q ftp://gd.tuwien.ac.at/languages/pascal/fpc/dist/${FPC_VERSION}/source/fpc-${FPC_VERSION}.source.tar.gz || die "Fehler beim Herunterladen."
 
 echo "[fpc] Entpacken..."
 #tar -xzf fpc-2.2.2.source.tar.gz || exit -1
 #unzip -qo fpc.zip || exit -1
-tar -xzf fpc-2.4.0.source.tar.gz || die "Fehler beim Entpacken.\nSiehe tmp/fpc.log für Details."
+tar -xzf fpc-${FPC_VERSION}.source.tar.gz || die "Fehler beim Entpacken."
 echo "[fpc] Patch anwenden..."
-patch -p0 < ${PATCHES}/fpc/2.4.0/fpc-2.4.0.patch >${LOGS}/fpc.log || die "Fehler beim Anwenden des Patches.\nSiehe tmp/fpc.log für Details."
+patch -p0 < ${PATCHES}/fpc/${FPC_VERSION}/fpc-${FPC_VERSION}.patch >${LOGS}/fpc.log || die "Fehler beim Anwenden des Patches.\nSiehe tmp/fpc.log für Details."
 #echo "[fpc] fpcmake bauen"
 #cd fpcbuild_2.0.4_exp/fpcsrc/utils/fpcm
 #make >>${LOGS}/fpc.log || exit -1
@@ -82,7 +230,7 @@ patch -p0 < ${PATCHES}/fpc/2.4.0/fpc-2.4.0.patch >${LOGS}/fpc.log || die "Fehler
 #cd ..
 
 echo "[fpc] Erzeuge Hilfsskripte..."
-cd fpc-2.4.0
+cd fpc-${FPC_VERSION}
 
 cat >> i386-linux-ld <<"EOF"
 #!/bin/sh
@@ -108,18 +256,22 @@ cp utils/fpcm/fpcmake ${PREFIX}/bin/fpcmake
 echo -e "[fpc] Abgeschlossen\n"
 fi
 
+#
+# FASM
+#
 if [ ! -f $PREFIX/bin/fasm ]; then
 rm -rf ${TMP}/cross-fasm/fasm/
 cd ${TMP}/cross-fasm
+echo "[fasm] Version " ${FASM_VERSION}
 echo "[fasm] Herunterladen..."
-[ -f fasm-1.69.09.tar.gz ] || wget -q http://flatassembler.net/fasm-1.69.09.tar.gz || die "Fehler beim Herunterladen."
+[ -f fasm-${FASM_VERSION}.tar.gz ] || wget -q http://flatassembler.net/fasm-${FASM_VERSION}.tar.gz || die "Fehler beim Herunterladen."
 echo "[fasm] Entpacken..."
-tar -xzf fasm-1.69.09.tar.gz || die "Fehler beim Entpacken."
+tar -xzf fasm-${FASM_VERSION}.tar.gz || die "Fehler beim Entpacken."
 echo "[fasm] Linux-FASM linken..."
 cd fasm
 gcc -m32 fasm.o -o fasm || die "Fehler beim Linken des Linux-FASM."
 echo "[fasm] Patch anwenden..."
-patch source/formats.inc ${PATCHES}/fasm/1.69.09/formats.patch || die "Fehler beim Anwenden des Patches."
+patch source/formats.inc ${PATCHES}/fasm/${FASM_VERSION}/formats.patch || die "Fehler beim Anwenden des Patches."
 echo "[fasm] Assemblieren..."
 ./fasm source/libc/fasm.asm fasm.o || die "Fehler beim Assemblieren."
 echo "[fasm] Týndur-FASM linken..."
-- 
1.7.1