#
# patch for gcc-4.7.3 with libstdc++ from gcc-4.4.6
#
diff -ru gcc-4.7.3-old/libstdc++-v3/configure gcc-4.7.3/libstdc++-v3/configure
--- gcc-4.7.3-old/libstdc++-v3/configure	2009-08-26 22:04:11.000000000 +0300
+++ gcc-4.7.3/libstdc++-v3/configure	2014-02-23 23:31:13.000000000 +0200
@@ -4180,8 +4180,8 @@
 
 
 
-macro_version='2.2.6'
-macro_revision='1.3012'
+macro_version='2.2.7a'
+macro_revision='1.3134'
 
 
 
@@ -118346,8 +118346,8 @@
 
   # Stuff in the actual top level.  Currently only used by libsupc++ to
   # get unwind* headers from the gcc dir.
   #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
-  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
+  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc'
 
   # Now, export this to all the little Makefiles....
 
diff -ru gcc-4.7.3-old/libstdc++-v3/include/Makefile.in gcc-4.7.3/libstdc++-v3/include/Makefile.in
--- gcc-4.7.3-old/libstdc++-v3/include/Makefile.in	2009-05-13 03:24:16.000000000 +0300
+++ gcc-4.7.3/libstdc++-v3/include/Makefile.in	2014-02-23 23:24:47.000000000 +0200
@@ -101,7 +101,7 @@
 CSTDIO_H = @CSTDIO_H@
 CTIME_CC = @CTIME_CC@
 CTIME_H = @CTIME_H@
-CXX = @CXX@
+CXX = @CXX@ -fpermissive
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -1069,7 +1069,6 @@
 	${host_builddir}/gthr.h \
 	${host_builddir}/gthr-single.h \
 	${host_builddir}/gthr-posix.h \
-	${host_builddir}/gthr-tpf.h \
 	${host_builddir}/gthr-default.h
 
 pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
@@ -1460,43 +1459,43 @@
 	echo "" >> $@ ;\
 	echo "#endif // _GLIBCXX_CXX_CONFIG_H" >> $@
 
-${host_builddir}/gthr.h: ${toplevel_srcdir}/gcc/gthr.h stamp-${host_alias}
+${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias}
 	sed -e '/^#pragma/b' \
 	    -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
 	    -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
 	    -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
-	    < ${toplevel_srcdir}/gcc/gthr.h > $@
+	    < ${toplevel_srcdir}/libgcc/gthr.h > $@
 
-${host_builddir}/gthr-single.h: ${toplevel_srcdir}/gcc/gthr-single.h \
+${host_builddir}/gthr-single.h: ${toplevel_srcdir}/libgcc/gthr-single.h \
 				  stamp-${host_alias}
 	sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
 	    -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
-	    < ${toplevel_srcdir}/gcc/gthr-single.h > $@
+	    < ${toplevel_srcdir}/libgcc/gthr-single.h > $@
 
-${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/gcc/gthr-posix.h \
+${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/libgcc/gthr-posix.h \
 				   stamp-${host_alias}
 	sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
 	    -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
 	    -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
 	    -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
-	    < ${toplevel_srcdir}/gcc/gthr-posix.h > $@
+	    < ${toplevel_srcdir}/libgcc/gthr-posix.h > $@
 
-${host_builddir}/gthr-tpf.h: ${toplevel_srcdir}/gcc/gthr-tpf.h \
+${host_builddir}/gthr-tpf.h: ${toplevel_srcdir}/libgcc/gthr-tpf.h \
 				   stamp-${host_alias}
 	sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
 	    -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
 	    -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
 	    -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
-	    < ${toplevel_srcdir}/gcc/gthr-tpf.h > $@
+	    < ${toplevel_srcdir}/libgcc/gthr-tpf.h > $@
 
-${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \
+${host_builddir}/gthr-default.h: ${toplevel_srcdir}/libgcc/${glibcxx_thread_h} \
 				   stamp-${host_alias}
 	sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
 	    -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
 	    -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
 	    -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
 	    -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
-	    < ${toplevel_srcdir}/gcc/${glibcxx_thread_h} > $@
+	    < ${toplevel_srcdir}/libgcc/${glibcxx_thread_h} > $@
 
 # Build two precompiled C++ includes, stdc++.h.gch/*.gch
 ${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
diff -ru gcc-4.7.3-old/lto-plugin/Makefile.in gcc-4.7.3/lto-plugin/Makefile.in
--- gcc-4.7.3-old/lto-plugin/Makefile.in	2011-08-10 11:48:37.000000000 +0300
+++ gcc-4.7.3/lto-plugin/Makefile.in	2014-02-23 11:41:35.000000000 +0200
@@ -232,7 +232,7 @@
 AM_CFLAGS = @ac_lto_plugin_warn_cflags@
 AM_LIBTOOLFLAGS = --tag=disable-static
 libexecsub_LTLIBRARIES = liblto_plugin.la
-gcc_build_dir = ../$(host_subdir)/gcc
+gcc_build_dir = ../../$(host_subdir)/gcc
 in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
 
 # Can be removed when libiberty becomes a normal convenience library
