Index: config/os/mingw32/os_defines.h
===================================================================
--- config/os/mingw32/os_defines.h	(Revision 194655)
+++ config/os/mingw32/os_defines.h	(Arbeitskopie)
@@ -72,4 +72,8 @@
 #define _GLIBCXX_CDTOR_CALLABI __thiscall
 #endif

+#ifdef __x86_64__
+#define _GLIBCXX_LLP64 1
 #endif
+
+#endif
Index: config/os/mingw32-w64/os_defines.h
===================================================================
--- config/os/mingw32-w64/os_defines.h	(Revision 194655)
+++ config/os/mingw32-w64/os_defines.h	(Arbeitskopie)
@@ -74,4 +74,8 @@
 #define _GLIBCXX_CDTOR_CALLABI __thiscall
 #endif

+#ifdef __x86_64__
+#define _GLIBCXX_LLP64 1
 #endif
+
+#endif
Index: libsupc++/cxxabi.h
===================================================================
--- libsupc++/cxxabi.h	(Revision 194655)
+++ libsupc++/cxxabi.h	(Arbeitskopie)
@@ -356,7 +356,11 @@ namespace __cxxabiv1
   {
   public:
     const __class_type_info* 	__base_type;  // Base class type.
+#ifdef _GLIBCXX_LLP64
+    long long			__offset_flags;  // Offset and info.
+#else
     long 			__offset_flags;  // Offset and info.
+#endif

     enum __offset_flags_masks
       {
Index: libsupc++/eh_alloc.cc
===================================================================
--- libsupc++/eh_alloc.cc	(Revision 194655)
+++ libsupc++/eh_alloc.cc	(Arbeitskopie)
@@ -60,7 +60,7 @@ using namespace __cxxabiv1;
 #if INT_MAX == 32767
 # define EMERGENCY_OBJ_SIZE	128
 # define EMERGENCY_OBJ_COUNT	16
-#elif LONG_MAX == 2147483647
+#elif !defined (_GLIBCXX_LLP64) && LONG_MAX == 2147483647
 # define EMERGENCY_OBJ_SIZE	512
 # define EMERGENCY_OBJ_COUNT	32
 #else
@@ -76,8 +76,12 @@ using namespace __cxxabiv1;
 #if INT_MAX == 32767 || EMERGENCY_OBJ_COUNT <= 32
 typedef unsigned int bitmask_type;
 #else
+#if defined (_GLIBCXX_LLP64)
+typedef unsigned long long bitmask_type;
+#else
 typedef unsigned long bitmask_type;
 #endif
+#endif


 typedef char one_buffer[EMERGENCY_OBJ_SIZE] __attribute__((aligned));
Index: libsupc++/hash_bytes.cc
===================================================================
--- libsupc++/hash_bytes.cc	(Revision 194655)
+++ libsupc++/hash_bytes.cc	(Arbeitskopie)
@@ -128,7 +128,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   size_t
   _Hash_bytes(const void* ptr, size_t len, size_t seed)
   {
-    static const size_t mul = (0xc6a4a793UL << 32UL) + 0x5bd1e995UL;
+    static const size_t mul = (((size_t) 0xc6a4a793UL) << 32UL)
+			      + (size_t) 0x5bd1e995UL;
     const char* const buf = static_cast<const char*>(ptr);

     // Remove the bytes not divisible by the sizeof(size_t).  This
Index: testsuite/18_support/50594.cc
===================================================================
--- testsuite/18_support/50594.cc	(Revision 194655)
+++ testsuite/18_support/50594.cc	(Arbeitskopie)
@@ -1,4 +1,5 @@
 // { dg-options "-fwhole-program" }
+// { dg-options "-fwhole-program -static-libstdc++" { target *-*-mingw* } }

 // Copyright (C) 2011 Free Software Foundation
 //
Index: testsuite/19_diagnostics/error_code/cons/1.cc
===================================================================
--- testsuite/19_diagnostics/error_code/cons/1.cc	(Revision 194655)
+++ testsuite/19_diagnostics/error_code/cons/1.cc	(Arbeitskopie)
@@ -1,4 +1,5 @@
 // { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } }
 // 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>

 // Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
Index: testsuite/19_diagnostics/error_code/operators/bool.cc
===================================================================
--- testsuite/19_diagnostics/error_code/operators/bool.cc	(Revision 194655)
+++ testsuite/19_diagnostics/error_code/operators/bool.cc	(Arbeitskopie)
@@ -1,4 +1,5 @@
 // { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } }
 // 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>

 // Copyright (C) 2007, 2009 Free Software Foundation, Inc.
Index: testsuite/19_diagnostics/error_code/operators/equal.cc
===================================================================
--- testsuite/19_diagnostics/error_code/operators/equal.cc	(Revision 194655)
+++ testsuite/19_diagnostics/error_code/operators/equal.cc	(Arbeitskopie)
@@ -1,4 +1,5 @@
 // { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } }
 // 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>

 // Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
Index: testsuite/19_diagnostics/error_code/operators/not_equal.cc
===================================================================
--- testsuite/19_diagnostics/error_code/operators/not_equal.cc	(Revision 194655)
+++ testsuite/19_diagnostics/error_code/operators/not_equal.cc	(Arbeitskopie)
@@ -1,4 +1,5 @@
 // { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } }
 // 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>

 // Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
Index: testsuite/19_diagnostics/error_condition/cons/1.cc
===================================================================
--- testsuite/19_diagnostics/error_condition/cons/1.cc	(Revision 194655)
+++ testsuite/19_diagnostics/error_condition/cons/1.cc	(Arbeitskopie)
@@ -1,4 +1,5 @@
 // { dg-options "-std=gnu++0x" }
+// { dg-additional-options "-static-libstdc++" { target *-*-mingw* } }

 // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 //
Index: testsuite/19_diagnostics/error_condition/operators/bool.cc
===================================================================
--- testsuite/19_diagnostics/error_condition/operators/bool.cc	(Revision 194655)
+++ testsuite/19_diagnostics/error_condition/operators/bool.cc	(Arbeitskopie)
@@ -1,4 +1,5 @@
 // { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } }

 // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 //
