diff -pruN ezx-crosstool-0.5_orig/all.sh ezx-crosstool-0.5_fixed/all.sh
--- ezx-crosstool-0.5_orig/all.sh	2005-11-21 03:45:52.000000000 +0100
+++ ezx-crosstool-0.5_fixed/all.sh	2006-04-04 19:43:17.000000000 +0200
@@ -114,13 +114,22 @@ if test "$opt_no_unpack" = ""; then
       export PTXDIST_DIR
    fi
    # Download and patch
-   rm -rf $BUILD_DIR; mkdir -p $BUILD_DIR
+   if test -d "$BUILD_DIR"; then
+	# Remove in background
+   	mv $BUILD_DIR $BUILD_DIR.del.$$
+   	rm -rf $BUILD_DIR.del.$$ &
+   fi
+   mkdir -p $BUILD_DIR
    sh getandpatch.sh
 fi
 
 if test "$opt_no_build" = ""; then
     # Build
-    rm  -rf  $PREFIX
+    if [ -d "$PREFIX" ]; then
+	# Remove in background for speed
+	mv "$PREFIX" "$PREFIX.del.$$"
+	rm  -rf  "$PREFIX.del.$$" &
+    fi
     mkdir -p $PREFIX
     mkdir -p $BUILD_DIR
     cd $BUILD_DIR
diff -pruN ezx-crosstool-0.5_orig/crosstool.sh ezx-crosstool-0.5_fixed/crosstool.sh
--- ezx-crosstool-0.5_orig/crosstool.sh	2005-11-21 03:46:46.000000000 +0100
+++ ezx-crosstool-0.5_fixed/crosstool.sh	2006-04-04 19:43:17.000000000 +0200
@@ -81,16 +81,34 @@ if test -z "${GLIBC_ADDON_OPTIONS}"; the
    test -z "${GLIBCCRYPT_FILENAME}"   || GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS}crypt,"
 fi
 
+# Add some default glibc config options if not given by user.  These used to be hardcoded.
+DEFAULT_GLIBC_EXTRA_CONFIG=""
+case "${GLIBC_EXTRA_CONFIG}" in
+*enable-kernel*) ;;
+*) DEFAULT_GLIBC_EXTRA_CONFIG="${DEFAULT_GLIBC_EXTRA_CONFIG} --enable-kernel=2.4.3"
+esac
+case "${GLIBC_EXTRA_CONFIG}" in
+*-tls*) ;;
+*) DEFAULT_GLIBC_EXTRA_CONFIG="${DEFAULT_GLIBC_EXTRA_CONFIG} --without-tls"
+esac
+case "${GLIBC_EXTRA_CONFIG}" in
+*-__thread*) ;;
+*) DEFAULT_GLIBC_EXTRA_CONFIG="${DEFAULT_GLIBC_EXTRA_CONFIG} --without-__thread"
+esac
+
 # One is forbidden
 test -z "${LD_LIBRARY_PATH}" || abort  "glibc refuses to build if LD_LIBRARY_PATH is set.  Please unset it before running this script."
 
-# And one is derived.
+# And one is derived if unset.
+test -z "${GLIBCTHREADS_FILENAME}" &&
 GLIBCTHREADS_FILENAME=`echo $GLIBC_DIR | sed 's/glibc-/glibc-linuxthreads-/'`
 
 # Check for a few prerequisites that have tripped people up.
 awk '/x/' < /dev/null  || abort "You need awk to build a toolchain."
 test -z "${CFLAGS}"    || abort "Don't set CFLAGS, it screws up the build"
 test -z "${CXXFLAGS}"  || abort "Don't set CXXFLAGS, it screws up the build"
+bison --version > /dev/null || abort "You don't have bison installed"
+flex --version > /dev/null || abort "You don't have flex installed"
 
 #---------------------------------------------------------
 
@@ -203,7 +221,7 @@ case $TARGET in
     arm*)     ARCH=arm ;;
     cris*)    ARCH=cris ;;
     hppa*)    ARCH=parisc ;;
-    i*86*)    ARCH=i386 ;;
+    i*86*|pentium*)    ARCH=i386 ;;
     i4004)    abort "ENOMEM" ;;
     ia64*)    ARCH=ia64 ;;
     mips*)    ARCH=mips ;;
@@ -436,11 +454,14 @@ if grep -q 'gcc-[34]' ${GCC_CORE_DIR}/Ch
     # having a copy of stdio_lim.h... see
     # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
     cp bits/stdio_lim.h $HEADERDIR/bits/stdio_lim.h
+
     # Following error building gcc-4.0.0's gcj:
     #  error: bits/syscall.h: No such file or directory
     # solved by following copy; see
     # http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
-    cp misc/syscall-list.h $HEADERDIR/bits/syscall.h
+    # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
+    # so uncomment this if you need it
+    #cp misc/syscall-list.h $HEADERDIR/bits/syscall.h
 
     cd ..
 fi
@@ -492,10 +513,7 @@ echo ${GLIBC_CONFIGPARMS} > configparms
 if test '!' -f Makefile; then
     # Configure with --prefix the way we want it on the target...
     # There are a whole lot of settings here.  You'll probably want
-    # to read up on what they all mean, and customize a bit.
-    # e.g. I picked --enable-kernel=2.4.3 here just because it's the kernel Bill 
-    # used in his example gcc2.95.3 script.  That means some backwards compatibility 
-    # stuff is turned on in glibc that you may not need if you're using a newer kernel.
+    # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG
     # Compare these options with the ones used when installing the glibc headers above - they're different.
     # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory" 
     # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html. 
@@ -506,10 +524,8 @@ if test '!' -f Makefile; then
     AR=${TARGET}-ar RANLIB=${TARGET}-ranlib \
         ${GLIBC_DIR}/configure --prefix=/usr \
         --build=$BUILD --host=$TARGET \
-        ${GLIBC_EXTRA_CONFIG} \
-        --enable-kernel=2.4.3 \
+        ${GLIBC_EXTRA_CONFIG} ${DEFAULT_GLIBC_EXTRA_CONFIG} \
         --without-cvs --disable-profile --disable-debug --without-gd \
-        --without-tls --without-__thread \
         $SHARED_MODE \
         --enable-add-ons${GLIBC_ADDON_OPTIONS} --with-headers=$HEADERDIR
 fi
@@ -549,22 +565,17 @@ make install_root=${SYSROOT} $GLIBC_SYSR
 # FIXME: test -h is not portable
 # FIXME: probably need to check more files than just these three...
 # Need to use sed instead of just assuming we know what's in libc.so because otherwise alpha breaks
-# But won't need to do this at all once we use --with-sysroot (available in gcc-3.3.3 and up)
 #
 # 2. Remove lines containing BUG per http://sources.redhat.com/ml/bug-glibc/2003-05/msg00055.html,
 # needed to fix gcc-3.2.3/glibc-2.3.2 targeting arm
 #
 # To make "strip *.so.*" not fail (ptxdist does this), rename to .so_orig rather than .so.orig
 for file in libc.so libpthread.so libgcc_s.so; do
-  for lib in lib lib64 usr/lib usr/lib64; do
-        if test -f ${SYSROOT}/$lib/$file && test ! -h ${SYSROOT}/$lib/$file; then
-                mv ${SYSROOT}/$lib/$file ${SYSROOT}/$lib/${file}_orig
-                if test -z "$USE_SYSROOT"; then
-                  sed 's,/usr/lib/,,g;s,/usr/lib64/,,g;s,/lib/,,g;s,/lib64/,,g;/BUG in libc.scripts.output-format.sed/d' < ${SYSROOT}/$lib/${file}_orig > ${SYSROOT}/$lib/$file
-                else
-                  sed '/BUG in libc.scripts.output-format.sed/d' < ${SYSROOT}/$lib/${file}_orig > ${SYSROOT}/$lib/$file
-                fi
-        fi
+    for lib in lib lib64 usr/lib usr/lib64; do
+      if test -f ${SYSROOT}/$lib/$file && test ! -h ${SYSROOT}/$lib/$file; then
+        mv ${SYSROOT}/$lib/$file ${SYSROOT}/$lib/${file}_orig
+        sed 's,/usr/lib/,,g;s,/usr/lib64/,,g;s,/lib/,,g;s,/lib64/,,g;/BUG in libc.scripts.output-format.sed/d' < ${SYSROOT}/$lib/${file}_orig > ${SYSROOT}/$lib/$file
+      fi
     done
 done
 cd ..
@@ -666,6 +677,12 @@ export EXEEXT
 cd $PREFIX
 sh $TOP_DIR/masq.sh
 
+# Make it easier to run apps built with new gcc on systems that don't
+# have the libgcc_s.so or libstdc++.so installed, by creating 
+# directories containing a copy of libgcc_s.so and libstdc++.so alone.
+cd $TOP_DIR
+sh mkoverride.sh
+
 # Build little program that lets user move resulting toolchain to different prefix
 cd $TOP_DIR
 gcc fix-embedded-paths.c -o $PREFIX/bin/fix-embedded-paths
diff -pruN ezx-crosstool-0.5_orig/crosstool.spec.in ezx-crosstool-0.5_fixed/crosstool.spec.in
--- ezx-crosstool-0.5_orig/crosstool.spec.in	2005-11-21 03:47:01.000000000 +0100
+++ ezx-crosstool-0.5_fixed/crosstool.spec.in	2006-04-04 19:43:17.000000000 +0200
@@ -376,8 +376,17 @@ __ENDFOR
 
 %changelog
 
+* Wed Mar 01 2006 Dan Kegel <dank at kegel.com> - 0:0.42-0.1
+- update to crosstool-0.42
+
+* Sat Feb 26 2006 Dan Kegel <dank at kegel.com> - 0:0.41-0.1
+- update to crosstool-0.41
+
+* Sat Feb 19 2006 Dan Kegel <dank at kegel.com> - 0:0.40-0.1
+- update to crosstool-0.40
+
 * Fri Jul 8 2005 Dan Kegel <dank at kegel.com> - 0:0.38-0.1
-- add hack for static libnss, and hack to always build gdb
+- add commented-out hack for static libnss
 
 * Sat May 14 2005 Dan Kegel <dank at kegel.com> - 0:0.34-0.1
 - fix how ldconfig is invoked to get rid of garbage files in /
diff -pruN ezx-crosstool-0.5_orig/getandpatch.sh ezx-crosstool-0.5_fixed/getandpatch.sh
--- ezx-crosstool-0.5_orig/getandpatch.sh	2005-11-21 03:48:04.000000000 +0100
+++ ezx-crosstool-0.5_fixed/getandpatch.sh	2006-04-04 19:43:17.000000000 +0200
@@ -32,7 +32,8 @@ if test "${CYGWIN_DIR}" = ""; then
   test -z "${GLIBC_DIR}"        && abort "Please set GLIBC_DIR to the bare filename of the glibc tarball or directory"
   test -z "${LINUX_SANITIZED_HEADER_DIR}" && echo "Not downloading linux-libc-headers. Set LINUX_SANITIZED_HEADER_DIR to do so"
   test -z "${LINUX_DIR}"        && echo "Not downloading kernel sources. Set LINUX_DIR if you want to do so"
-  # And one is derived.
+  # And one is derived if not set explicitly.
+  test -z "${GLIBCTHREADS_FILENAME}" &&
   GLIBCTHREADS_FILENAME=`echo $GLIBC_DIR | sed 's/glibc-/glibc-linuxthreads-/'`
 fi
 
@@ -48,6 +49,10 @@ if test -z "$QUIET_EXTRACTIONS"; then VE
 # Pattern in a patch log to indicate failure
 PATCHFAILMSGS="^No file to patch.  Skipping patch.|^Hunk .* FAILED at"
 
+# Get a well-defined sort order so patches always in same order
+LANG=C
+export LANG
+
 # Download the given file to $TARBALLS_DIR
 downloadFile()
 {
@@ -65,6 +70,7 @@ downloadFile()
 	case $1 in
 
 	*glibc-200*gz)
+		wget --tries=5 -P ${TARBALLS_DIR} -c $1 || wget --tries=5 --passive-ftp -P ${TARBALLS_DIR} -c $1 || \
 		(cd $TARBALLS_DIR; sh $TOP_DIR/glibc-get.sh $1; )
 		;; 
 	*)
@@ -195,15 +201,21 @@ fi
 
 # No glibc for cygwin.
 if test "${CYGWIN_DIR}" = ""; then
-  getUnpackAndPatch \
-       ftp://ftp.gnu.org/pub/gnu/glibc/$GLIBC_DIR.tar.bz2 \
-       ftp://ftp.gnu.org/pub/gnu/glibc/$GLIBC_DIR.tar.gz \
-       ftp://gcc.gnu.org/pub/glibc/releases/$GLIBC_DIR.tar.bz2 \
-       ftp://gcc.gnu.org/pub/glibc/releases/$GLIBC_DIR.tar.gz 
+   case $GLIBC_DIR in
+      glibc-200*) 
+  	  getUnpackAndPatch \
+		ftp://gcc.gnu.org/pub/glibc/snapshots/$GLIBC_DIR.tar.bz2 \
+		ftp://gcc.gnu.org/pub/glibc/snapshots/$GLIBC_DIR.tar.gz ;;
+      *)  
+  	  getUnpackAndPatch \
+		ftp://ftp.gnu.org/pub/gnu/glibc/$GLIBC_DIR.tar.bz2 \
+		ftp://ftp.gnu.org/pub/gnu/glibc/$GLIBC_DIR.tar.gz \
+		ftp://gcc.gnu.org/pub/glibc/releases/$GLIBC_DIR.tar.bz2 \
+		ftp://gcc.gnu.org/pub/glibc/releases/$GLIBC_DIR.tar.gz ;;
+   esac
 else
   getUnpackAndPatch ${CYGWIN_URL}/${CYGWIN_DIR}-src.tar.bz2
 fi
-
 if test x"$BINUTILS_URL" = x; then
    case $BINUTILS_DIR in
       binutils-2.*.9*.0*) 
@@ -223,12 +235,14 @@ for gcc in $GCC_DIR $GCC_CORE_DIR; do
    #   getUnpackAndPatch ftp://ftp.gnu.org/pub/gnu/gcc/releases/$gcc/$gcc.tar.bz2 ;;
    gcc-3.3.5)
       getUnpackAndPatch ftp://gcc.gnu.org/pub/gcc/releases/$gcc/$gcc.tar.bz2 ;;
-   gcc-4.0.[012345]-200*)
+   gcc-4.[01234].[012345]-200*)
       dir=`echo $gcc | sed s/gcc-/prerelease-/`
-      getUnpackAndPatch ftp://gcc.gnu.org/pub/gcc/$dir/$gcc.tar.bz2 ftp://gcc.gnu.org/pub/gcc/$dir/$gcc.tar.gz ;;
-   gcc-3.[345]-200*|gcc-4.0-200*|gcc-4.1-2005*)
+      getUnpackAndPatch	ftp://gcc.gnu.org/pub/gcc/$dir/$gcc.tar.bz2 \
+			ftp://gcc.gnu.org/pub/gcc/$dir/$gcc.tar.gz ;;
+   gcc-3.[3456]-200*|gcc-4.0-200*|gcc-4.1-200*)
       dir=`echo $gcc | sed 's/gcc-//'`
-      getUnpackAndPatch ftp://gcc.gnu.org/pub/gcc/snapshots/$dir/$gcc.tar.bz2 ;;
+      getUnpackAndPatch ftp://gcc.gnu.org/pub/gcc/snapshots/$dir/$gcc.tar.bz2 \
+			ftp://gcc.gnu.org/pub/gcc/snapshots/$dir/$gcc.tar.gz ;;
    *)
       getUnpackAndPatch ftp://ftp.gnu.org/pub/gnu/gcc/$gcc/$gcc.tar.bz2 \
 			ftp://ftp.gnu.org/pub/gnu/gcc/$gcc/$gcc.tar.gz \
@@ -246,7 +260,9 @@ if test "${CYGWIN_DIR}" = ""; then
     *) abort "unknown version $LINUX_DIR of linux, expected 2.4 or 2.6 in name?" ;;
   esac
   # Fetch linux-libc-headers, if requested
-  test -n "${LINUX_SANITIZED_HEADER_DIR}" && getUnpackAndPatch    http://ep09.pld-linux.org/~mmazur/linux-libc-headers/${LINUX_SANITIZED_HEADER_DIR}.tar.bz2
+  test -n "${LINUX_SANITIZED_HEADER_DIR}" && getUnpackAndPatch \
+	http://ep09.pld-linux.org/~mmazur/linux-libc-headers/${LINUX_SANITIZED_HEADER_DIR}.tar.bz2 \
+	ftp://ftp.lfs-matrix.net/pub/linux-libc-headers/${LINUX_SANITIZED_HEADER_DIR}.tar.bz2
   # Glibc addons must come after glibc
   getUnpackAndPatch     \
        ftp://ftp.gnu.org/pub/gnu/glibc/$GLIBCTHREADS_FILENAME.tar.bz2 \
diff -pruN ezx-crosstool-0.5_orig/patches/gcc-3.3.6/fix-fixincl.patch ezx-crosstool-0.5_fixed/patches/gcc-3.3.6/fix-fixincl.patch
--- ezx-crosstool-0.5_orig/patches/gcc-3.3.6/fix-fixincl.patch	1970-01-01 01:00:00.000000000 +0100
+++ ezx-crosstool-0.5_fixed/patches/gcc-3.3.6/fix-fixincl.patch	2006-04-04 19:43:17.000000000 +0200
@@ -0,0 +1,70 @@
+See http://gcc.gnu.org/PR22541
+
+From: Dan Kegel
+
+When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX
+(the only two I've tried like this), the configure script happily copies
+the glibc include files from include to sys-include; here's the line
+from the log file (with $PREFIX instead of the real prefix):
+
+Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include
+
+But later, when running fixincludes, it gives the error message
+ The directory that should contain system headers does not exist:
+  $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include
+
+Nevertheless, it continues building; the header files it installs in
+ $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include
+do not include the boilerplate that would cause it to #include_next the
+glibc headers in the system header directory.
+Thus the resulting toolchain can't compile the following program:
+#include <limits.h>
+int x = PATH_MAX;
+because its limits.h doesn't include the glibc header.
+
+That's not nice.  I suspect the problem is that gcc/Makefile.in assumes that
+it can refer to $PREFIX/i686-unknown-linux-gnu  with the path 
+                $PREFIX/lib/../i686-unknown-linux-gnu, but
+that fails because the directory $PREFIX/lib doesn't exist during 'make all';
+it is only created later, during 'make install'.  (Which makes this problem
+confusing, since one only notices the breakage well after 'make install',
+at which point the path configure complained about does exist, and has the
+right stuff in it.)
+
+A possible fix is to replace the line in gcc/Makefile.in that says
+    SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
+with a version that gets rid of extra ..'s, e.g.
+    SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"`
+(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq
+for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.)
+
+
+--- gcc-3.4.3/gcc/Makefile.in.foo	2005-05-20 11:41:39.000000000 -0700
++++ gcc-3.4.3/gcc/Makefile.in	2005-05-20 12:08:46.000000000 -0700
+@@ -350,7 +350,10 @@
+ CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
++# Purge it of unneccessary internal relative paths
++# to directories that might not exist yet.
++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta.
++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`
+ 
+ # Control whether to run fixproto and fixincludes.
+ STMP_FIXPROTO = @STMP_FIXPROTO@
+@@ -2532,11 +2535,13 @@
+ 	$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir)
+ 
+ # Build fixed copies of system files.
++# Abort if no system headers available, unless building a crosscompiler.
++# FIXME: abort unless building --without-headers would be more accurate and less ugly
+ stmp-fixinc: fixinc.sh gsyslimits.h
+ 	@if test ! -d ${SYSTEM_HEADER_DIR}; then \
+ 	  echo The directory that should contain system headers does not exist: >&2 ; \
+ 	  echo "  ${SYSTEM_HEADER_DIR}" >&2 ; \
+-	  if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \
++	  if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \
+ 	  then sleep 1; else exit 1; fi; \
+ 	fi
+ 	rm -rf include; mkdir include
