Index: config.guess
--- config.guess.orig	2011-06-06 12:34:35.000000000 +0200
+++ config.guess	2012-07-21 09:15:05.000000000 +0200
@@ -194,7 +194,7 @@
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
Index: gcc/config/i386/sol2.h
--- gcc/config/i386/sol2.h.orig	2011-08-01 14:14:21.000000000 +0200
+++ gcc/config/i386/sol2.h	2012-07-21 09:15:05.000000000 +0200
@@ -100,6 +100,9 @@
 #undef ASM_QUAD
 #endif
 
+#undef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 1
+
 /* The Solaris assembler wants a .local for non-exported aliases.  */
 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)	\
   do {							\
Index: gcc/config/sol2-bi.h
--- gcc/config/sol2-bi.h.orig	2011-07-07 11:24:16.000000000 +0200
+++ gcc/config/sol2-bi.h	2012-07-21 09:31:52.000000000 +0200
@@ -75,7 +75,7 @@
    %{YP,*} \
    %{R*} \
    %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}	\
-	   %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}"
+	   %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}} -rpath-link %R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}"
 
 #undef LINK_ARCH64_SPEC
 #ifndef USE_GLD
Index: gcc/config/sol2.h
--- gcc/config/sol2.h.orig	2011-08-18 16:47:46.000000000 +0200
+++ gcc/config/sol2.h	2012-07-21 09:15:05.000000000 +0200
@@ -171,8 +171,8 @@
   "%{h*} %{v:-V} \
    %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
    %{static:-dn -Bstatic} \
-   %{shared:-G -dy %{!mimpure-text:-z text}} \
-   %{symbolic:-Bsymbolic -G -dy -z text} \
+   %{shared:-G -dy} \
+   %{symbolic:-Bsymbolic -G -dy} \
    %{pthreads|pthread|fprofile-generate*:" LIB_THREAD_LDFLAGS_SPEC "} \
    %(link_arch) \
    %{Qy:} %{!Qn:-Qy}"
Index: gcc/system.h
--- gcc/system.h.orig	2012-02-17 00:16:28.000000000 +0100
+++ gcc/system.h	2012-07-21 09:15:05.000000000 +0200
@@ -455,10 +455,6 @@
 }
 #endif
 
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
Index: libcpp/charset.c
--- libcpp/charset.c.orig	2011-01-03 21:52:22.000000000 +0100
+++ libcpp/charset.c	2012-07-21 09:15:05.000000000 +0200
@@ -75,6 +75,7 @@
 #define iconv_open(x, y) (errno = EINVAL, (iconv_t)-1)
 #define iconv(a,b,c,d,e) (errno = EINVAL, (size_t)-1)
 #define iconv_close(x)   (void)0
+#undef ICONV_CONST
 #define ICONV_CONST
 #endif
 
Index: libcpp/internal.h
--- libcpp/internal.h.orig	2012-01-09 09:48:43.000000000 +0100
+++ libcpp/internal.h	2012-07-21 09:15:05.000000000 +0200
@@ -29,6 +29,7 @@
 #if HAVE_ICONV
 #include <iconv.h>
 #else
+#undef  HAVE_ICONV
 #define HAVE_ICONV 0
 typedef int iconv_t;  /* dummy */
 #endif
