# HG changeset patch
# User John D
# Date 1501534401 14400
#      Mon Jul 31 16:53:21 2017 -0400
# Node ID d618b728985fe4603859895f1c1283d6b8483e4d
# Parent  cdd39c428e5061d8a99c64b2ed408e1403bb28df
gcc: update to 7.1 with tools

* src/build-gcc.mk: update version 7.1.0

* src/cloog.mk: update 0.18.4

* src/gmp.mk: update 6.1.2

* src/isl.mk: update 0.16.1, add no-undefined flag

* src/mpfr.mk: update 3.1.6

* src/native-gcc.mk: update 7.1.0

* src/isl-1-fixes.patch: removed file

* dist-files.mk: remove reference to patch files, add mingw-w64 patch

* src/build-gcc-1-mingw-float.patch: removed patch

* src/native-gcc-1-mingw-float.patch: removed patch

* src/build-gcc-2-intrinsics.patch: removed patch

* src/native-gcc-2-intrinsics.patch: removed patch

* src/mingw-w64.mk: update to 5.0.2

* src/gcc-1-mingw-float.patch: remove patch

* src/gcc-2-darwin-no-pie.patch: remove patch

* src/mingw-w64-2-pthreads.patch: new file

* src/pthreads.mk: apply mingw patches to mingw sources before running configure

diff -r cdd39c428e50 -r d618b728985f dist-files.mk
--- a/dist-files.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/dist-files.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -26,8 +26,6 @@
   build-cmake.mk \
   build-flex.mk \
   build-gawk.mk \
-  build-gcc-1-mingw-float.patch \
-  build-gcc-2-intrinsics.patch \
   build-gcc.mk \
   build-gettext.mk \
   build-gperf.mk \
@@ -99,8 +97,6 @@
   ftgl.mk \
   gc.mk \
   gcab.mk \
-  gcc-1-mingw-float.patch \
-  gcc-2-darwin-no-pie.patch \
   gcc-cloog.mk \
   gcc-gmp.mk \
   gcc-isl.mk \
@@ -183,7 +179,6 @@
   imagemagick.mk \
   inputproto.mk \
   intltool.mk \
-  isl-1-fixes.patch \
   isl.mk \
   itsol.mk \
   itstool.mk \
@@ -326,6 +321,7 @@
   mingw-texinfo-1-fixes.patch \
   mingw-utils-1-portability-fix.patch \
   mingw-w64-1-float-h.patch \
+  mingw-w64-2-pthreads.patch \
   mingw-w64.mk \
   mingwrt.mk \
   mman-win32-1-include_name_change.patch \
@@ -419,8 +415,6 @@
   mxml-test.c \
   mxml.mk \
   native-binutils.mk \
-  native-gcc-1-float.patch \
-  native-gcc-2-intrinsics.patch \
   native-gcc.mk \
   ncurses-1-gcc-5-fix.patch \
   ncurses.mk \
diff -r cdd39c428e50 -r d618b728985f src/build-gcc-1-mingw-float.patch
--- a/src/build-gcc-1-mingw-float.patch	Wed Jul 26 08:36:12 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-This file is part of MXE.
-See index.html for further information.
-
-This patch has been taken from:
-http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00387.html
-http://sourceforge.net/p/mingw/bugs/1809
-
-diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h
-index a8e05bf..23fbb3d 100644
---- a/gcc/ginclude/float.h
-+++ b/gcc/ginclude/float.h
-@@ -275,3 +275,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
- #endif /* __STDC_WANT_DEC_FP__ */
- 
- #endif /* _FLOAT_H___ */
-+
-+#ifdef __MINGW32__
-+ /*
-+  * the MinGW-supplied header, which is guarded by the
-+  * _MINGW_FLOAT_H_ macro, may be found first, thus...
-+  */
-+#ifndef _MINGW_FLOAT_H_
-+ /*
-+  * ...when we didn't find the MinGW-supplied header first, we
-+  * want to pull it in now; include_next should achieve this
-+  */
-+# include_next <float.h>
-+#endif
-+#endif
--- 
-1.8.4.5
-
diff -r cdd39c428e50 -r d618b728985f src/build-gcc-2-intrinsics.patch
--- a/src/build-gcc-2-intrinsics.patch	Wed Jul 26 08:36:12 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,846 +0,0 @@
-# This file is part of MXE.
-# See index.html for further information.
-
-This patch has been taken from:
-http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56038
-
-diff --git a/gcc/config/i386/adxintrin.h b/gcc/config/i386/adxintrin.h
-index 6118900..a83410d 100644
---- a/gcc/config/i386/adxintrin.h
-+++ b/gcc/config/i386/adxintrin.h
-@@ -28,6 +28,10 @@
- #ifndef _ADXINTRIN_H_INCLUDED
- #define _ADXINTRIN_H_INCLUDED
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned char
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _addcarryx_u32 (unsigned char __CF, unsigned int __X,
-@@ -46,4 +50,8 @@ _addcarryx_u64 (unsigned char __CF, unsigned long __X,
- }
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _ADXINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/ammintrin.h b/gcc/config/i386/ammintrin.h
-index a89b204..a370eb0 100644
---- a/gcc/config/i386/ammintrin.h
-+++ b/gcc/config/i386/ammintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSE4A__
- #endif /* __SSE4A__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_stream_sd (double * __P, __m128d __Y)
- {
-@@ -85,6 +89,10 @@ _mm_inserti_si64(__m128i __X, __m128i __Y, unsigned const int __I, unsigned cons
- 				      (unsigned int)(I), (unsigned int)(L)))
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_SSE4A__
- #undef __DISABLE_SSE4A__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/avx2intrin.h b/gcc/config/i386/avx2intrin.h
-index d04c972..2c0d6e7 100644
---- a/gcc/config/i386/avx2intrin.h
-+++ b/gcc/config/i386/avx2intrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_AVX2__
- #endif /* __AVX2__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Sum absolute 8-bit integer difference of adjacent groups of 4
-    byte integers in the first 2 operands.  Starting offsets within
-    operands are determined by the 3rd mask operand.  */
-@@ -1886,4 +1890,8 @@ _mm256_mask_i64gather_epi32 (__m128i src, int const *base,
- #pragma GCC pop_options
- #endif /* __DISABLE_AVX2__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _AVX2INTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/avxintrin.h b/gcc/config/i386/avxintrin.h
-index 2ea327c..f61d850 100644
---- a/gcc/config/i386/avxintrin.h
-+++ b/gcc/config/i386/avxintrin.h
-@@ -37,6 +37,10 @@
- #define __DISABLE_AVX__
- #endif /* __AVX__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Internal data types for implementing the intrinsics.  */
- typedef double __v4df __attribute__ ((__vector_size__ (32)));
- typedef float __v8sf __attribute__ ((__vector_size__ (32)));
-@@ -1460,4 +1464,8 @@ _mm256_castsi128_si256 (__m128i __A)
- #pragma GCC pop_options
- #endif /* __DISABLE_AVX__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _AVXINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/bmi2intrin.h b/gcc/config/i386/bmi2intrin.h
-index ff96296..b01e1e1 100644
---- a/gcc/config/i386/bmi2intrin.h
-+++ b/gcc/config/i386/bmi2intrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_BMI2__
- #endif /* __BMI2__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _bzhi_u32 (unsigned int __X, unsigned int __Y)
-@@ -106,4 +110,8 @@ _mulx_u32 (unsigned int __X, unsigned int __Y, unsigned int *__P)
- #pragma GCC pop_options
- #endif /* __DISABLE_BMI2__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _BMI2INTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/bmiintrin.h b/gcc/config/i386/bmiintrin.h
-index b2d7c60..c8ad38a 100644
---- a/gcc/config/i386/bmiintrin.h
-+++ b/gcc/config/i386/bmiintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_BMI__
- #endif /* __BMI__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __tzcnt_u16 (unsigned short __X)
- {
-@@ -181,4 +185,8 @@ _tzcnt_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif /* __DISABLE_BMI__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _BMIINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
-index 8c323ae..52047e3 100644
---- a/gcc/config/i386/cpuid.h
-+++ b/gcc/config/i386/cpuid.h
-@@ -21,6 +21,10 @@
-  * <http://www.gnu.org/licenses/>.
-  */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* %ecx */
- #define bit_SSE3	(1 << 0)
- #define bit_PCLMUL	(1 << 1)
-@@ -275,3 +279,8 @@ __get_cpuid (unsigned int __level,
-   __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
-   return 1;
- }
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
-index a2bdf0e..2c4af53 100644
---- a/gcc/config/i386/emmintrin.h
-+++ b/gcc/config/i386/emmintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSE2__
- #endif /* __SSE2__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* SSE2 */
- typedef double __v2df __attribute__ ((__vector_size__ (16)));
- typedef long long __v2di __attribute__ ((__vector_size__ (16)));
-@@ -1515,6 +1519,10 @@ _mm_castps_pd(__m128 __A)
-   return (__m128d) __A;
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_castps_si128(__m128 __A)
- {
-diff --git a/gcc/config/i386/f16cintrin.h b/gcc/config/i386/f16cintrin.h
-index 1181f8b..5cc37dd 100644
---- a/gcc/config/i386/f16cintrin.h
-+++ b/gcc/config/i386/f16cintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_F16C__
- #endif /* __F16C__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _cvtsh_ss (unsigned short __S)
- {
-@@ -95,4 +99,8 @@ _mm256_cvtps_ph (__m256 __A, const int __I)
- #pragma GCC pop_options
- #endif /* __DISABLE_F16C__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _F16CINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/fma4intrin.h b/gcc/config/i386/fma4intrin.h
-index e1bdef7..0ee2bf8 100644
---- a/gcc/config/i386/fma4intrin.h
-+++ b/gcc/config/i386/fma4intrin.h
-@@ -37,6 +37,10 @@
- #define __DISABLE_FMA4__
- #endif /* __FMA4__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* 128b Floating point multiply/add type instructions.  */
- extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_macc_ps (__m128 __A, __m128 __B, __m128 __C)
-@@ -233,6 +237,10 @@ _mm256_msubadd_pd (__m256d __A, __m256d __B, __m256d __C)
-   return (__m256d) __builtin_ia32_vfmaddsubpd256 ((__v4df)__A, (__v4df)__B, -(__v4df)__C);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_FMA4__
- #undef __DISABLE_FMA4__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/fmaintrin.h b/gcc/config/i386/fmaintrin.h
-index bfbb75d..806ff8e 100644
---- a/gcc/config/i386/fmaintrin.h
-+++ b/gcc/config/i386/fmaintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_FMA__
- #endif /* __FMA__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline __m128d
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
-@@ -294,6 +298,10 @@ _mm256_fmsubadd_ps (__m256 __A, __m256 __B, __m256 __C)
-                                                 -(__v8sf)__C);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_FMA__
- #undef __DISABLE_FMA__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/fxsrintrin.h b/gcc/config/i386/fxsrintrin.h
-index 98e73ee..34cc3cb 100644
---- a/gcc/config/i386/fxsrintrin.h
-+++ b/gcc/config/i386/fxsrintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_FXSR__
- #endif /* __FXSR__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _fxsave (void *__P)
-@@ -70,4 +74,8 @@ _fxrstor64 (void *__P)
- #endif /* __DISABLE_FXSR__ */
- 
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _FXSRINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
-index 516b13b..c55db44 100644
---- a/gcc/config/i386/gmm_malloc.h
-+++ b/gcc/config/i386/gmm_malloc.h
-@@ -27,6 +27,10 @@
- #include <stdlib.h>
- #include <errno.h>
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- static __inline__ void* 
- _mm_malloc (size_t size, size_t align)
- {
-@@ -71,4 +75,8 @@ _mm_free (void * aligned_ptr)
-     free (((void **) aligned_ptr) [-1]);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _MM_MALLOC_H_INCLUDED */
-diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h
-index 614b0fa..d8e474e 100644
---- a/gcc/config/i386/ia32intrin.h
-+++ b/gcc/config/i386/ia32intrin.h
-@@ -25,6 +25,10 @@
- # error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
- #endif
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* 32bit bsf */
- extern __inline int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-@@ -297,3 +301,7 @@ __writeeflags (unsigned int X)
- #define _rotwr(a,b)		__rorw((a), (b))
- #define _rotl(a,b)		__rold((a), (b))
- #define _rotr(a,b)		__rord((a), (b))
-+
-+#ifdef __cplusplus
-+}
-+#endif
-diff --git a/gcc/config/i386/immintrin.h b/gcc/config/i386/immintrin.h
-index 73b4859..49a03e4 100644
---- a/gcc/config/i386/immintrin.h
-+++ b/gcc/config/i386/immintrin.h
-@@ -78,6 +78,10 @@ _rdrand16_step (unsigned short *__P)
-   return __builtin_ia32_rdrand16_step (__P);
- }
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _rdrand32_step (unsigned int *__P)
-@@ -174,4 +178,8 @@ _rdrand64_step (unsigned long long *__P)
- 
- #endif /* __x86_64__  */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _IMMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/lwpintrin.h b/gcc/config/i386/lwpintrin.h
-index 1cd046a..26d65f1 100644
---- a/gcc/config/i386/lwpintrin.h
-+++ b/gcc/config/i386/lwpintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_LWP__
- #endif /* __LWP__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __llwpcb (void *pcbAddress)
- {
-@@ -71,6 +75,9 @@ __lwpval64 (unsigned long long data2, unsigned int data1, unsigned int flags)
- #endif
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
- 
- #ifdef __OPTIMIZE__
- extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-diff --git a/gcc/config/i386/lzcntintrin.h b/gcc/config/i386/lzcntintrin.h
-index b680a35..d292f24 100644
---- a/gcc/config/i386/lzcntintrin.h
-+++ b/gcc/config/i386/lzcntintrin.h
-@@ -35,6 +35,10 @@
- #define __DISABLE_LZCNT__
- #endif /* __LZCNT__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __lzcnt16 (unsigned short __X)
- {
-@@ -72,4 +76,8 @@ _lzcnt_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif /* __DISABLE_LZCNT__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _LZCNTINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/mm3dnow.h b/gcc/config/i386/mm3dnow.h
-index bf847f9..464e98f 100644
---- a/gcc/config/i386/mm3dnow.h
-+++ b/gcc/config/i386/mm3dnow.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_3dNOW__
- #endif /* __3dNOW__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _m_femms (void)
- {
-@@ -210,6 +214,10 @@ _m_pswapd (__m64 __A)
- 
- #endif /* __3dNOW_A__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_3dNOW__
- #undef __DISABLE_3dNOW__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/mmintrin.h b/gcc/config/i386/mmintrin.h
-index b351200..eaee690 100644
---- a/gcc/config/i386/mmintrin.h
-+++ b/gcc/config/i386/mmintrin.h
-@@ -33,6 +33,10 @@
- #define __DISABLE_MMX__
- #endif /* __MMX__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* The Intel API is flexible enough that we must allow aliasing with other
-    vector types, and their scalar components.  */
- typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
-@@ -939,4 +943,8 @@ _mm_set1_pi8 (char __b)
- #pragma GCC pop_options
- #endif /* __DISABLE_MMX__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _MMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
-index 3be2f35..f8c99c7 100644
---- a/gcc/config/i386/pmm_malloc.h
-+++ b/gcc/config/i386/pmm_malloc.h
-@@ -34,6 +34,10 @@ extern int posix_memalign (void **, size_t, size_t);
- extern "C" int posix_memalign (void **, size_t, size_t) throw ();
- #endif
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- static __inline void *
- _mm_malloc (size_t size, size_t alignment)
- {
-@@ -54,4 +58,8 @@ _mm_free (void * ptr)
-   free (ptr);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _MM_MALLOC_H_INCLUDED */
-diff --git a/gcc/config/i386/pmmintrin.h b/gcc/config/i386/pmmintrin.h
-index 6a79500..2c98a85 100644
---- a/gcc/config/i386/pmmintrin.h
-+++ b/gcc/config/i386/pmmintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSE3__
- #endif /* __SSE3__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Additional bits in the MXCSR.  */
- #define _MM_DENORMALS_ZERO_MASK		0x0040
- #define _MM_DENORMALS_ZERO_ON		0x0040
-@@ -124,6 +128,10 @@ _mm_mwait (unsigned int __E, unsigned int __H)
-   __builtin_ia32_mwait (__E, __H);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_SSE3__
- #undef __DISABLE_SSE3__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/popcntintrin.h b/gcc/config/i386/popcntintrin.h
-index 41845d8..285e96a 100644
---- a/gcc/config/i386/popcntintrin.h
-+++ b/gcc/config/i386/popcntintrin.h
-@@ -30,6 +30,10 @@
- #define __DISABLE_POPCNT__
- #endif /* __POPCNT__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Calculate a number of bits set to 1.  */
- extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_popcnt_u32 (unsigned int __X)
-@@ -50,4 +54,8 @@ _mm_popcnt_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif  /* __DISABLE_POPCNT__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _POPCNTINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/prfchwintrin.h b/gcc/config/i386/prfchwintrin.h
-index b2f5772..f779a28 100644
---- a/gcc/config/i386/prfchwintrin.h
-+++ b/gcc/config/i386/prfchwintrin.h
-@@ -28,10 +28,18 @@
- #ifndef _PRFCHWINTRIN_H_INCLUDED
- #define _PRFCHWINTRIN_H_INCLUDED
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _m_prefetchw (void *__P)
- {
-   __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _PRFCHWINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/rdseedintrin.h b/gcc/config/i386/rdseedintrin.h
-index 0ab18e5..98eb318 100644
---- a/gcc/config/i386/rdseedintrin.h
-+++ b/gcc/config/i386/rdseedintrin.h
-@@ -35,6 +35,10 @@
- #endif /* __RDSEED__ */
- 
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _rdseed16_step (unsigned short *p)
-@@ -63,4 +67,8 @@ _rdseed64_step (unsigned long long *p)
- #pragma GCC pop_options
- #endif /* __DISABLE_RDSEED__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _RDSEEDINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/rtmintrin.h b/gcc/config/i386/rtmintrin.h
-index ac40d22..3aa8246 100644
---- a/gcc/config/i386/rtmintrin.h
-+++ b/gcc/config/i386/rtmintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_RTM__
- #endif /* __RTM__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- #define _XBEGIN_STARTED		(~0u)
- #define _XABORT_EXPLICIT	(1 << 0)
- #define _XABORT_RETRY		(1 << 1)
-@@ -81,4 +85,8 @@ _xabort (const unsigned int imm)
- #pragma GCC pop_options
- #endif /* __DISABLE_RTM__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _RTMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
-index 886ace4..0922b45 100644
---- a/gcc/config/i386/smmintrin.h
-+++ b/gcc/config/i386/smmintrin.h
-@@ -37,6 +37,10 @@
- #define __DISABLE_SSE4_1__
- #endif /* __SSE4_1__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Rounding mode macros. */
- #define _MM_FROUND_TO_NEAREST_INT	0x00
- #define _MM_FROUND_TO_NEG_INF		0x01
-@@ -822,6 +826,10 @@ _mm_cmpgt_epi64 (__m128i __X, __m128i __Y)
- #define __DISABLE_SSE4_2__
- #endif /* __SSE4_1__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- /* Accumulate CRC32 (polynomial 0x11EDC6F41) value.  */
- extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_crc32_u8 (unsigned int __C, unsigned char __V)
-diff --git a/gcc/config/i386/tbmintrin.h b/gcc/config/i386/tbmintrin.h
-index 871f532..744b9ca 100644
---- a/gcc/config/i386/tbmintrin.h
-+++ b/gcc/config/i386/tbmintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_TBM__
- #endif /* __TBM__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- #ifdef __OPTIMIZE__
- extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __bextri_u32 (unsigned int __X, const unsigned int __I)
-@@ -177,4 +181,8 @@ __tzmsk_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif /* __DISABLE_TBM__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _TBMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/tmmintrin.h b/gcc/config/i386/tmmintrin.h
-index 89556d2..f89e33c 100644
---- a/gcc/config/i386/tmmintrin.h
-+++ b/gcc/config/i386/tmmintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSSE3__
- #endif /* __SSSE3__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_hadd_epi16 (__m128i __X, __m128i __Y)
- {
-@@ -241,6 +245,10 @@ _mm_abs_pi32 (__m64 __X)
-   return (__m64) __builtin_ia32_pabsd ((__v2si)__X);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_SSSE3__
- #undef __DISABLE_SSSE3__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/wmmintrin.h b/gcc/config/i386/wmmintrin.h
-index 2002375..a22bb07 100644
---- a/gcc/config/i386/wmmintrin.h
-+++ b/gcc/config/i386/wmmintrin.h
-@@ -30,6 +30,10 @@
- /* We need definitions from the SSE2 header file.  */
- #include <emmintrin.h>
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* AES */
- 
- #ifndef __AES__
-@@ -124,6 +128,10 @@ _mm_clmulepi64_si128 (__m128i __X, __m128i __Y, const int __I)
- 					  (__v2di)(__m128i)(Y), (int)(I)))
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_PCLMUL__
- #undef __DISABLE_PCLMUL__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/xmmintrin.h b/gcc/config/i386/xmmintrin.h
-index a3824e7..ee1a1fc 100644
---- a/gcc/config/i386/xmmintrin.h
-+++ b/gcc/config/i386/xmmintrin.h
-@@ -64,6 +64,10 @@ _mm_prefetch (const void *__P, enum _mm_hint __I)
- #define __DISABLE_SSE__
- #endif /* __SSE__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* The Intel API is flexible enough that we must allow aliasing with other
-    vector types, and their scalar components.  */
- typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
-@@ -1254,6 +1258,10 @@ do {									\
-   (row3) = __builtin_ia32_movhlps (__t3, __t2);				\
- } while (0)
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- /* For backward source compatibility.  */
- # include <emmintrin.h>
- 
-diff --git a/gcc/config/i386/xopintrin.h b/gcc/config/i386/xopintrin.h
-index cc82bc5..d567a98 100644
---- a/gcc/config/i386/xopintrin.h
-+++ b/gcc/config/i386/xopintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_XOP__
- #endif /* __XOP__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Integer multiply/add intructions. */
- extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
-@@ -836,6 +840,10 @@ _mm256_permute2_ps (__m256 __X, __m256 __Y, __m256i __C, const int __I)
-  					  (int)(I)))
- #endif /* __OPTIMIZE__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_XOP__
- #undef __DISABLE_XOP__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/xsaveintrin.h b/gcc/config/i386/xsaveintrin.h
-index 47be25f..be2caea 100644
---- a/gcc/config/i386/xsaveintrin.h
-+++ b/gcc/config/i386/xsaveintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_XSAVE__
- #endif /* __XSAVE__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _xsave (void *__P, long long __M)
-@@ -69,4 +73,8 @@ _xrstor64 (void *__P, long long __M)
- #pragma GCC pop_options
- #endif /* __DISABLE_XSAVE__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _XSAVEINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/xsaveoptintrin.h b/gcc/config/i386/xsaveoptintrin.h
-index d7534b4..90eeb45 100644
---- a/gcc/config/i386/xsaveoptintrin.h
-+++ b/gcc/config/i386/xsaveoptintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_XSAVEOPT__
- #endif /* __XSAVEOPT__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _xsaveopt (void *__P, long long __M)
-@@ -55,4 +59,8 @@ _xsaveopt64 (void *__P, long long __M)
- #pragma GCC pop_options
- #endif /* __DISABLE_XSAVEOPT__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _XSAVEOPTINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/xtestintrin.h b/gcc/config/i386/xtestintrin.h
-index ba79e5c..864b727 100644
---- a/gcc/config/i386/xtestintrin.h
-+++ b/gcc/config/i386/xtestintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_RTM__
- #endif /* __RTM__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Return non-zero if the instruction executes inside an RTM or HLE code
-    region.  Return zero otherwise.   */
- extern __inline int
-@@ -48,4 +52,8 @@ _xtest (void)
- #pragma GCC pop_options
- #endif /* __DISABLE_RTM__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _XTESTINTRIN_H_INCLUDED */
--- 
-1.8.4.5
-
diff -r cdd39c428e50 -r d618b728985f src/build-gcc.mk
--- a/src/build-gcc.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/build-gcc.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -3,10 +3,10 @@
 
 PKG             := build-gcc
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 4.9.4
-$(PKG)_CHECKSUM := 5bb0b783a57a62b11f1f9bd2aa37145da221d3d0
+$(PKG)_VERSION  := 7.1.0
+$(PKG)_CHECKSUM := a6dca81b25a97416211218f725b26f01e8063e05
 $(PKG)_SUBDIR   := gcc-$($(PKG)_VERSION)
-$(PKG)_FILE     := gcc-$($(PKG)_VERSION).tar.bz2
+$(PKG)_FILE     := gcc-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
 $(PKG)_URL_2    := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
 
diff -r cdd39c428e50 -r d618b728985f src/cloog.mk
--- a/src/cloog.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/cloog.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -3,8 +3,8 @@
 
 PKG             := cloog
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 0.18.1
-$(PKG)_CHECKSUM := 2dc70313e8e2c6610b856d627bce9c9c3f848077
+$(PKG)_VERSION  := 0.18.4
+$(PKG)_CHECKSUM := 8f7568ca1873f8d55bb694c8b9b83f7f4c6c1aa5
 $(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
 $(PKG)_FILE     := $(PKG)-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := ftp://gcc.gnu.org/pub/gcc/infrastructure/$($(PKG)_FILE)
diff -r cdd39c428e50 -r d618b728985f src/gcc-1-mingw-float.patch
--- a/src/gcc-1-mingw-float.patch	Wed Jul 26 08:36:12 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-This file is part of MXE.
-See index.html for further information.
-
-This patch has been taken from:
-http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00387.html
-http://sourceforge.net/tracker/?func=detail&atid=302435&aid=3011968&group_id=2435
-
-diff -urN a/gcc/ginclude/float.h b/gcc/ginclude/float.h
---- a/gcc/ginclude/float.h	2009-04-09 17:00:19.000000000 +0200
-+++ b/gcc/ginclude/float.h	2010-06-05 12:03:41.887724045 +0200
-@@ -275,3 +275,7 @@
- #endif /* __STDC_WANT_DEC_FP__ */
- 
- #endif /* _FLOAT_H___ */
-+
-+#ifdef __MINGW32__
-+#include_next<float.h>
-+#endif
diff -r cdd39c428e50 -r d618b728985f src/gcc-2-darwin-no-pie.patch
--- a/src/gcc-2-darwin-no-pie.patch	Wed Jul 26 08:36:12 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-This file is part of MXE.
-See index.html for further information.
-
-MXE specific workaround for OSX Lion's new ASLR
-causing problems with pre-compiled headers.
-
-1. more recent native compilers don't solve the problem
-2. there isn't an equivalent sysctl for "kernel.randomize_va_space"
-3. there isn't an equivalent command for "setarch -R"
-4. Apple's version of gcc (based on 4.2) uses custom Makefiles that set "-fno-pic"
-
-Patch below achieves a similar result to 4, without drifting
-too far from standard gcc.
-
---- a/configure
-+++ b/configure
-@@ -30,6 +30,11 @@ else
- esac
- fi
- 
-+case `uname -sr` in
-+  Darwin*11*)
-+    LDFLAGS="$LDFLAGS -Wl,-no_pie"
-+  ;;
-+esac
- 
- as_nl='
- '
diff -r cdd39c428e50 -r d618b728985f src/gmp.mk
--- a/src/gmp.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/gmp.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -3,8 +3,8 @@
 
 PKG             := gmp
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 6.1.1
-$(PKG)_CHECKSUM := 757d672e66d8e0afe60ca04735ab11c00d9346e4
+$(PKG)_VERSION  := 6.1.2
+$(PKG)_CHECKSUM := 366ded6a44cd108ba6b3f5b9a252eab3f3a95cdf
 $(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
 $(PKG)_FILE     := $(PKG)-$($(PKG)_VERSION).tar.bz2
 $(PKG)_URL      := https://gmplib.org/download/gmp/$($(PKG)_FILE)
diff -r cdd39c428e50 -r d618b728985f src/isl-1-fixes.patch
--- a/src/isl-1-fixes.patch	Wed Jul 26 08:36:12 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-diff -ur a/include/isl/int.h b/include/isl/int.h
---- a/include/isl/int.h	2012-11-29 03:47:32.000000000 -0500
-+++ b/include/isl/int.h	2014-02-19 02:44:04.311137242 -0500
-@@ -14,7 +14,7 @@
- #include <string.h>
- #include <gmp.h>
- #if defined(__cplusplus)
--#include <iostream>
-+#include <ostream>
- #endif
- 
- #if defined(__cplusplus)
-diff -u isl-0.12.2.orig/Makefile.am isl-0.12.2/Makefile.am
---- isl-0.12.2.orig/Makefile.am	2014-04-25 14:38:30.985118233 -0400
-+++ isl-0.12.2/Makefile.am	2014-04-25 14:39:56.860765352 -0400
-@@ -154,7 +154,7 @@
- 	isl_sample_piplib.h \
- 	isl_piplib.c
- libisl_la_LIBADD = @PIPLIB_LIBS@ @GMP_LIBS@
--libisl_la_LDFLAGS = -version-info @versioninfo@ \
-+libisl_la_LDFLAGS = -no-undefined -version-info @versioninfo@ \
- 	@PIPLIB_LDFLAGS@ @GMP_LDFLAGS@
- libisl_la_CPPFLAGS = $(INCLUDES) @PIPLIB_CPPFLAGS@ @GMP_CPPFLAGS@
- 
-diff -u isl-0.12.2.orig/Makefile.in isl-0.12.2/Makefile.in
---- isl-0.12.2.orig/Makefile.in	2014-04-25 14:38:30.972117984 -0400
-+++ isl-0.12.2/Makefile.in	2014-04-25 14:40:36.809531647 -0400
-@@ -645,7 +645,7 @@
- 	isl_piplib.c
- 
- libisl_la_LIBADD = @PIPLIB_LIBS@ @GMP_LIBS@
--libisl_la_LDFLAGS = -version-info @versioninfo@ \
-+libisl_la_LDFLAGS = -no-undefined -version-info @versioninfo@ \
- 	@PIPLIB_LDFLAGS@ @GMP_LDFLAGS@
- 
- libisl_la_CPPFLAGS = $(INCLUDES) @PIPLIB_CPPFLAGS@ @GMP_CPPFLAGS@
diff -r cdd39c428e50 -r d618b728985f src/isl.mk
--- a/src/isl.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/isl.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -3,13 +3,15 @@
 
 PKG             := isl
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 0.12.2
-$(PKG)_CHECKSUM := ca98a91e35fb3ded10d080342065919764d6f928
+$(PKG)_VERSION  := 0.16.1
+$(PKG)_CHECKSUM := c5a2b201bf05229647e73203c0bf2d9679d4d21f
 $(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
 $(PKG)_FILE     := $(PKG)-$($(PKG)_VERSION).tar.bz2
 $(PKG)_URL      := ftp://gcc.gnu.org/pub/gcc/infrastructure/$($(PKG)_FILE)
 $(PKG)_DEPS     := build-gcc gmp
 
+$(PKG)_EXTRA_MAKE_FLAGS := LDFLAGS='-no-undefined'
+
 # stick to tested versions from gcc
 define $(PKG)_UPDATE
     $(WGET) -q -O- 'ftp://gcc.gnu.org/pub/gcc/infrastructure/' | \
diff -r cdd39c428e50 -r d618b728985f src/mingw-w64-2-pthreads.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mingw-w64-2-pthreads.patch	Mon Jul 31 16:53:21 2017 -0400
@@ -0,0 +1,45 @@
+based on https://sourceforge.net/p/mingw-w64/mailman/message/35828127/
+
+diff -ur mingw-w64-v5.0.2.orig/mingw-w64-libraries/winpthreads/src/libgcc/dll_math.c mingw-w64-v5.0.2/mingw-w64-libraries/winpthreads/src/libgcc/dll_math.c
+--- mingw-w64-v5.0.2.orig/mingw-w64-libraries/winpthreads/src/libgcc/dll_math.c	2017-07-31 16:10:12.189758140 -0400
++++ mingw-w64-v5.0.2/mingw-w64-libraries/winpthreads/src/libgcc/dll_math.c	2017-07-31 16:16:42.332643290 -0400
+@@ -120,6 +120,7 @@
+ u_quad_t	__udivdi3(u_quad_t a, u_quad_t b);
+ u_quad_t	__umoddi3(u_quad_t a, u_quad_t b);
+ int		__ucmpdi2(u_quad_t a, u_quad_t b);
++quad_t		__divmoddi4(quad_t a, quad_t b, quad_t *rem);
+ 
+ #endif /* !_LIBKERN_QUAD_H_ */
+ 
+@@ -546,6 +547,31 @@
+ 	(void)__qdivrem(a, b, &r);
+ 	return (r);
+ }
++
++/*
++ * Divide two signed quads.
++ * This function is new in GCC 7.
++ */
++quad_t
++__divmoddi4(a, b, rem)
++	quad_t a, b, *rem;
++{
++	u_quad_t ua, ub, uq, ur;
++	int negq, negr;
++
++	if (a < 0)
++		ua = -(u_quad_t)a, negq = 1, negr = 1;
++	else
++		ua = a, negq = 0, negr = 0;
++	if (b < 0)
++		ub = -(u_quad_t)b, negq ^= 1;
++	else
++		ub = b;
++	uq = __qdivrem(ua, ub, &ur);
++	if (rem)
++		*rem = (negr ? -ur : ur);
++	return (negq ? -uq : uq);
++}
+ #else
+ static int __attribute__((unused)) dummy;
+ #endif /*deined (_X86_) && !defined (__x86_64__)*/
diff -r cdd39c428e50 -r d618b728985f src/mingw-w64.mk
--- a/src/mingw-w64.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/mingw-w64.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -3,8 +3,8 @@
 
 PKG             := mingw-w64
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 4.0.6
-$(PKG)_CHECKSUM := cc9ef3be9bb31ee3fdc4731d214034be5483270d
+$(PKG)_VERSION  := 5.0.2
+$(PKG)_CHECKSUM := bb5409f034abb7c021b3e1c14db433fd253cbb59
 $(PKG)_SUBDIR   := $(PKG)-v$($(PKG)_VERSION)
 $(PKG)_FILE     := $(PKG)-v$($(PKG)_VERSION).tar.bz2
 $(PKG)_URL      := http://$(SOURCEFORGE_MIRROR)/project/$(PKG)/$(PKG)/$(PKG)-release/$($(PKG)_FILE)
diff -r cdd39c428e50 -r d618b728985f src/mpfr.mk
--- a/src/mpfr.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/mpfr.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -3,8 +3,8 @@
 
 PKG             := mpfr
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 3.1.4
-$(PKG)_CHECKSUM := cedc0055d55b6ee4cd17e1e6119ed412520ff81a
+$(PKG)_VERSION  := 3.1.5
+$(PKG)_CHECKSUM := c0fab77c6da4cb710c81cc04092fb9bea11a9403
 $(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
 $(PKG)_FILE     := $(PKG)-$($(PKG)_VERSION).tar.xz
 $(PKG)_URL      := ftp://ftp.gnu.org/pub/gnu/$(PKG)/$($(PKG)_FILE)
diff -r cdd39c428e50 -r d618b728985f src/native-gcc-1-float.patch
--- a/src/native-gcc-1-float.patch	Wed Jul 26 08:36:12 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-This file is part of MXE.
-See index.html for further information.
-
-This patch has been taken from:
-http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00387.html
-http://sourceforge.net/p/mingw/bugs/1809
-
-diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h
-index a8e05bf..23fbb3d 100644
---- a/gcc/ginclude/float.h
-+++ b/gcc/ginclude/float.h
-@@ -275,3 +275,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
- #endif /* __STDC_WANT_DEC_FP__ */
- 
- #endif /* _FLOAT_H___ */
-+
-+#ifdef __MINGW32__
-+ /*
-+  * the MinGW-supplied header, which is guarded by the
-+  * _MINGW_FLOAT_H_ macro, may be found first, thus...
-+  */
-+#ifndef _MINGW_FLOAT_H_
-+ /*
-+  * ...when we didn't find the MinGW-supplied header first, we
-+  * want to pull it in now; include_next should achieve this
-+  */
-+# include_next <float.h>
-+#endif
-+#endif
--- 
-1.8.4.5
-
diff -r cdd39c428e50 -r d618b728985f src/native-gcc-2-intrinsics.patch
--- a/src/native-gcc-2-intrinsics.patch	Wed Jul 26 08:36:12 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,846 +0,0 @@
-# This file is part of MXE.
-# See index.html for further information.
-
-This patch has been taken from:
-http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56038
-
-diff --git a/gcc/config/i386/adxintrin.h b/gcc/config/i386/adxintrin.h
-index 6118900..a83410d 100644
---- a/gcc/config/i386/adxintrin.h
-+++ b/gcc/config/i386/adxintrin.h
-@@ -28,6 +28,10 @@
- #ifndef _ADXINTRIN_H_INCLUDED
- #define _ADXINTRIN_H_INCLUDED
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned char
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _addcarryx_u32 (unsigned char __CF, unsigned int __X,
-@@ -46,4 +50,8 @@ _addcarryx_u64 (unsigned char __CF, unsigned long __X,
- }
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _ADXINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/ammintrin.h b/gcc/config/i386/ammintrin.h
-index a89b204..a370eb0 100644
---- a/gcc/config/i386/ammintrin.h
-+++ b/gcc/config/i386/ammintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSE4A__
- #endif /* __SSE4A__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_stream_sd (double * __P, __m128d __Y)
- {
-@@ -85,6 +89,10 @@ _mm_inserti_si64(__m128i __X, __m128i __Y, unsigned const int __I, unsigned cons
- 				      (unsigned int)(I), (unsigned int)(L)))
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_SSE4A__
- #undef __DISABLE_SSE4A__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/avx2intrin.h b/gcc/config/i386/avx2intrin.h
-index d04c972..2c0d6e7 100644
---- a/gcc/config/i386/avx2intrin.h
-+++ b/gcc/config/i386/avx2intrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_AVX2__
- #endif /* __AVX2__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Sum absolute 8-bit integer difference of adjacent groups of 4
-    byte integers in the first 2 operands.  Starting offsets within
-    operands are determined by the 3rd mask operand.  */
-@@ -1886,4 +1890,8 @@ _mm256_mask_i64gather_epi32 (__m128i src, int const *base,
- #pragma GCC pop_options
- #endif /* __DISABLE_AVX2__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _AVX2INTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/avxintrin.h b/gcc/config/i386/avxintrin.h
-index 2ea327c..f61d850 100644
---- a/gcc/config/i386/avxintrin.h
-+++ b/gcc/config/i386/avxintrin.h
-@@ -37,6 +37,10 @@
- #define __DISABLE_AVX__
- #endif /* __AVX__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Internal data types for implementing the intrinsics.  */
- typedef double __v4df __attribute__ ((__vector_size__ (32)));
- typedef float __v8sf __attribute__ ((__vector_size__ (32)));
-@@ -1460,4 +1464,8 @@ _mm256_castsi128_si256 (__m128i __A)
- #pragma GCC pop_options
- #endif /* __DISABLE_AVX__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _AVXINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/bmi2intrin.h b/gcc/config/i386/bmi2intrin.h
-index ff96296..b01e1e1 100644
---- a/gcc/config/i386/bmi2intrin.h
-+++ b/gcc/config/i386/bmi2intrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_BMI2__
- #endif /* __BMI2__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _bzhi_u32 (unsigned int __X, unsigned int __Y)
-@@ -106,4 +110,8 @@ _mulx_u32 (unsigned int __X, unsigned int __Y, unsigned int *__P)
- #pragma GCC pop_options
- #endif /* __DISABLE_BMI2__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _BMI2INTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/bmiintrin.h b/gcc/config/i386/bmiintrin.h
-index b2d7c60..c8ad38a 100644
---- a/gcc/config/i386/bmiintrin.h
-+++ b/gcc/config/i386/bmiintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_BMI__
- #endif /* __BMI__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __tzcnt_u16 (unsigned short __X)
- {
-@@ -181,4 +185,8 @@ _tzcnt_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif /* __DISABLE_BMI__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _BMIINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
-index 8c323ae..52047e3 100644
---- a/gcc/config/i386/cpuid.h
-+++ b/gcc/config/i386/cpuid.h
-@@ -21,6 +21,10 @@
-  * <http://www.gnu.org/licenses/>.
-  */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* %ecx */
- #define bit_SSE3	(1 << 0)
- #define bit_PCLMUL	(1 << 1)
-@@ -275,3 +279,8 @@ __get_cpuid (unsigned int __level,
-   __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
-   return 1;
- }
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
-index a2bdf0e..2c4af53 100644
---- a/gcc/config/i386/emmintrin.h
-+++ b/gcc/config/i386/emmintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSE2__
- #endif /* __SSE2__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* SSE2 */
- typedef double __v2df __attribute__ ((__vector_size__ (16)));
- typedef long long __v2di __attribute__ ((__vector_size__ (16)));
-@@ -1515,6 +1519,10 @@ _mm_castps_pd(__m128 __A)
-   return (__m128d) __A;
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_castps_si128(__m128 __A)
- {
-diff --git a/gcc/config/i386/f16cintrin.h b/gcc/config/i386/f16cintrin.h
-index 1181f8b..5cc37dd 100644
---- a/gcc/config/i386/f16cintrin.h
-+++ b/gcc/config/i386/f16cintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_F16C__
- #endif /* __F16C__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _cvtsh_ss (unsigned short __S)
- {
-@@ -95,4 +99,8 @@ _mm256_cvtps_ph (__m256 __A, const int __I)
- #pragma GCC pop_options
- #endif /* __DISABLE_F16C__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _F16CINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/fma4intrin.h b/gcc/config/i386/fma4intrin.h
-index e1bdef7..0ee2bf8 100644
---- a/gcc/config/i386/fma4intrin.h
-+++ b/gcc/config/i386/fma4intrin.h
-@@ -37,6 +37,10 @@
- #define __DISABLE_FMA4__
- #endif /* __FMA4__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* 128b Floating point multiply/add type instructions.  */
- extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_macc_ps (__m128 __A, __m128 __B, __m128 __C)
-@@ -233,6 +237,10 @@ _mm256_msubadd_pd (__m256d __A, __m256d __B, __m256d __C)
-   return (__m256d) __builtin_ia32_vfmaddsubpd256 ((__v4df)__A, (__v4df)__B, -(__v4df)__C);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_FMA4__
- #undef __DISABLE_FMA4__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/fmaintrin.h b/gcc/config/i386/fmaintrin.h
-index bfbb75d..806ff8e 100644
---- a/gcc/config/i386/fmaintrin.h
-+++ b/gcc/config/i386/fmaintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_FMA__
- #endif /* __FMA__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline __m128d
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
-@@ -294,6 +298,10 @@ _mm256_fmsubadd_ps (__m256 __A, __m256 __B, __m256 __C)
-                                                 -(__v8sf)__C);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_FMA__
- #undef __DISABLE_FMA__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/fxsrintrin.h b/gcc/config/i386/fxsrintrin.h
-index 98e73ee..34cc3cb 100644
---- a/gcc/config/i386/fxsrintrin.h
-+++ b/gcc/config/i386/fxsrintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_FXSR__
- #endif /* __FXSR__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _fxsave (void *__P)
-@@ -70,4 +74,8 @@ _fxrstor64 (void *__P)
- #endif /* __DISABLE_FXSR__ */
- 
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _FXSRINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
-index 516b13b..c55db44 100644
---- a/gcc/config/i386/gmm_malloc.h
-+++ b/gcc/config/i386/gmm_malloc.h
-@@ -27,6 +27,10 @@
- #include <stdlib.h>
- #include <errno.h>
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- static __inline__ void* 
- _mm_malloc (size_t size, size_t align)
- {
-@@ -71,4 +75,8 @@ _mm_free (void * aligned_ptr)
-     free (((void **) aligned_ptr) [-1]);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _MM_MALLOC_H_INCLUDED */
-diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h
-index 614b0fa..d8e474e 100644
---- a/gcc/config/i386/ia32intrin.h
-+++ b/gcc/config/i386/ia32intrin.h
-@@ -25,6 +25,10 @@
- # error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
- #endif
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* 32bit bsf */
- extern __inline int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-@@ -297,3 +301,7 @@ __writeeflags (unsigned int X)
- #define _rotwr(a,b)		__rorw((a), (b))
- #define _rotl(a,b)		__rold((a), (b))
- #define _rotr(a,b)		__rord((a), (b))
-+
-+#ifdef __cplusplus
-+}
-+#endif
-diff --git a/gcc/config/i386/immintrin.h b/gcc/config/i386/immintrin.h
-index 73b4859..49a03e4 100644
---- a/gcc/config/i386/immintrin.h
-+++ b/gcc/config/i386/immintrin.h
-@@ -78,6 +78,10 @@ _rdrand16_step (unsigned short *__P)
-   return __builtin_ia32_rdrand16_step (__P);
- }
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _rdrand32_step (unsigned int *__P)
-@@ -174,4 +178,8 @@ _rdrand64_step (unsigned long long *__P)
- 
- #endif /* __x86_64__  */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _IMMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/lwpintrin.h b/gcc/config/i386/lwpintrin.h
-index 1cd046a..26d65f1 100644
---- a/gcc/config/i386/lwpintrin.h
-+++ b/gcc/config/i386/lwpintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_LWP__
- #endif /* __LWP__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __llwpcb (void *pcbAddress)
- {
-@@ -71,6 +75,9 @@ __lwpval64 (unsigned long long data2, unsigned int data1, unsigned int flags)
- #endif
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
- 
- #ifdef __OPTIMIZE__
- extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-diff --git a/gcc/config/i386/lzcntintrin.h b/gcc/config/i386/lzcntintrin.h
-index b680a35..d292f24 100644
---- a/gcc/config/i386/lzcntintrin.h
-+++ b/gcc/config/i386/lzcntintrin.h
-@@ -35,6 +35,10 @@
- #define __DISABLE_LZCNT__
- #endif /* __LZCNT__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __lzcnt16 (unsigned short __X)
- {
-@@ -72,4 +76,8 @@ _lzcnt_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif /* __DISABLE_LZCNT__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _LZCNTINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/mm3dnow.h b/gcc/config/i386/mm3dnow.h
-index bf847f9..464e98f 100644
---- a/gcc/config/i386/mm3dnow.h
-+++ b/gcc/config/i386/mm3dnow.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_3dNOW__
- #endif /* __3dNOW__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _m_femms (void)
- {
-@@ -210,6 +214,10 @@ _m_pswapd (__m64 __A)
- 
- #endif /* __3dNOW_A__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_3dNOW__
- #undef __DISABLE_3dNOW__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/mmintrin.h b/gcc/config/i386/mmintrin.h
-index b351200..eaee690 100644
---- a/gcc/config/i386/mmintrin.h
-+++ b/gcc/config/i386/mmintrin.h
-@@ -33,6 +33,10 @@
- #define __DISABLE_MMX__
- #endif /* __MMX__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* The Intel API is flexible enough that we must allow aliasing with other
-    vector types, and their scalar components.  */
- typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
-@@ -939,4 +943,8 @@ _mm_set1_pi8 (char __b)
- #pragma GCC pop_options
- #endif /* __DISABLE_MMX__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _MMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
-index 3be2f35..f8c99c7 100644
---- a/gcc/config/i386/pmm_malloc.h
-+++ b/gcc/config/i386/pmm_malloc.h
-@@ -34,6 +34,10 @@ extern int posix_memalign (void **, size_t, size_t);
- extern "C" int posix_memalign (void **, size_t, size_t) throw ();
- #endif
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- static __inline void *
- _mm_malloc (size_t size, size_t alignment)
- {
-@@ -54,4 +58,8 @@ _mm_free (void * ptr)
-   free (ptr);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _MM_MALLOC_H_INCLUDED */
-diff --git a/gcc/config/i386/pmmintrin.h b/gcc/config/i386/pmmintrin.h
-index 6a79500..2c98a85 100644
---- a/gcc/config/i386/pmmintrin.h
-+++ b/gcc/config/i386/pmmintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSE3__
- #endif /* __SSE3__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Additional bits in the MXCSR.  */
- #define _MM_DENORMALS_ZERO_MASK		0x0040
- #define _MM_DENORMALS_ZERO_ON		0x0040
-@@ -124,6 +128,10 @@ _mm_mwait (unsigned int __E, unsigned int __H)
-   __builtin_ia32_mwait (__E, __H);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_SSE3__
- #undef __DISABLE_SSE3__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/popcntintrin.h b/gcc/config/i386/popcntintrin.h
-index 41845d8..285e96a 100644
---- a/gcc/config/i386/popcntintrin.h
-+++ b/gcc/config/i386/popcntintrin.h
-@@ -30,6 +30,10 @@
- #define __DISABLE_POPCNT__
- #endif /* __POPCNT__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Calculate a number of bits set to 1.  */
- extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_popcnt_u32 (unsigned int __X)
-@@ -50,4 +54,8 @@ _mm_popcnt_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif  /* __DISABLE_POPCNT__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _POPCNTINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/prfchwintrin.h b/gcc/config/i386/prfchwintrin.h
-index b2f5772..f779a28 100644
---- a/gcc/config/i386/prfchwintrin.h
-+++ b/gcc/config/i386/prfchwintrin.h
-@@ -28,10 +28,18 @@
- #ifndef _PRFCHWINTRIN_H_INCLUDED
- #define _PRFCHWINTRIN_H_INCLUDED
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _m_prefetchw (void *__P)
- {
-   __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _PRFCHWINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/rdseedintrin.h b/gcc/config/i386/rdseedintrin.h
-index 0ab18e5..98eb318 100644
---- a/gcc/config/i386/rdseedintrin.h
-+++ b/gcc/config/i386/rdseedintrin.h
-@@ -35,6 +35,10 @@
- #endif /* __RDSEED__ */
- 
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline int
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _rdseed16_step (unsigned short *p)
-@@ -63,4 +67,8 @@ _rdseed64_step (unsigned long long *p)
- #pragma GCC pop_options
- #endif /* __DISABLE_RDSEED__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _RDSEEDINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/rtmintrin.h b/gcc/config/i386/rtmintrin.h
-index ac40d22..3aa8246 100644
---- a/gcc/config/i386/rtmintrin.h
-+++ b/gcc/config/i386/rtmintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_RTM__
- #endif /* __RTM__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- #define _XBEGIN_STARTED		(~0u)
- #define _XABORT_EXPLICIT	(1 << 0)
- #define _XABORT_RETRY		(1 << 1)
-@@ -81,4 +85,8 @@ _xabort (const unsigned int imm)
- #pragma GCC pop_options
- #endif /* __DISABLE_RTM__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _RTMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
-index 886ace4..0922b45 100644
---- a/gcc/config/i386/smmintrin.h
-+++ b/gcc/config/i386/smmintrin.h
-@@ -37,6 +37,10 @@
- #define __DISABLE_SSE4_1__
- #endif /* __SSE4_1__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Rounding mode macros. */
- #define _MM_FROUND_TO_NEAREST_INT	0x00
- #define _MM_FROUND_TO_NEG_INF		0x01
-@@ -822,6 +826,10 @@ _mm_cmpgt_epi64 (__m128i __X, __m128i __Y)
- #define __DISABLE_SSE4_2__
- #endif /* __SSE4_1__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- /* Accumulate CRC32 (polynomial 0x11EDC6F41) value.  */
- extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_crc32_u8 (unsigned int __C, unsigned char __V)
-diff --git a/gcc/config/i386/tbmintrin.h b/gcc/config/i386/tbmintrin.h
-index 871f532..744b9ca 100644
---- a/gcc/config/i386/tbmintrin.h
-+++ b/gcc/config/i386/tbmintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_TBM__
- #endif /* __TBM__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- #ifdef __OPTIMIZE__
- extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- __bextri_u32 (unsigned int __X, const unsigned int __I)
-@@ -177,4 +181,8 @@ __tzmsk_u64 (unsigned long long __X)
- #pragma GCC pop_options
- #endif /* __DISABLE_TBM__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _TBMINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/tmmintrin.h b/gcc/config/i386/tmmintrin.h
-index 89556d2..f89e33c 100644
---- a/gcc/config/i386/tmmintrin.h
-+++ b/gcc/config/i386/tmmintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_SSSE3__
- #endif /* __SSSE3__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_hadd_epi16 (__m128i __X, __m128i __Y)
- {
-@@ -241,6 +245,10 @@ _mm_abs_pi32 (__m64 __X)
-   return (__m64) __builtin_ia32_pabsd ((__v2si)__X);
- }
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_SSSE3__
- #undef __DISABLE_SSSE3__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/wmmintrin.h b/gcc/config/i386/wmmintrin.h
-index 2002375..a22bb07 100644
---- a/gcc/config/i386/wmmintrin.h
-+++ b/gcc/config/i386/wmmintrin.h
-@@ -30,6 +30,10 @@
- /* We need definitions from the SSE2 header file.  */
- #include <emmintrin.h>
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* AES */
- 
- #ifndef __AES__
-@@ -124,6 +128,10 @@ _mm_clmulepi64_si128 (__m128i __X, __m128i __Y, const int __I)
- 					  (__v2di)(__m128i)(Y), (int)(I)))
- #endif
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_PCLMUL__
- #undef __DISABLE_PCLMUL__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/xmmintrin.h b/gcc/config/i386/xmmintrin.h
-index a3824e7..ee1a1fc 100644
---- a/gcc/config/i386/xmmintrin.h
-+++ b/gcc/config/i386/xmmintrin.h
-@@ -64,6 +64,10 @@ _mm_prefetch (const void *__P, enum _mm_hint __I)
- #define __DISABLE_SSE__
- #endif /* __SSE__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* The Intel API is flexible enough that we must allow aliasing with other
-    vector types, and their scalar components.  */
- typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
-@@ -1254,6 +1258,10 @@ do {									\
-   (row3) = __builtin_ia32_movhlps (__t3, __t2);				\
- } while (0)
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- /* For backward source compatibility.  */
- # include <emmintrin.h>
- 
-diff --git a/gcc/config/i386/xopintrin.h b/gcc/config/i386/xopintrin.h
-index cc82bc5..d567a98 100644
---- a/gcc/config/i386/xopintrin.h
-+++ b/gcc/config/i386/xopintrin.h
-@@ -36,6 +36,10 @@
- #define __DISABLE_XOP__
- #endif /* __XOP__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Integer multiply/add intructions. */
- extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
-@@ -836,6 +840,10 @@ _mm256_permute2_ps (__m256 __X, __m256 __Y, __m256i __C, const int __I)
-  					  (int)(I)))
- #endif /* __OPTIMIZE__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #ifdef __DISABLE_XOP__
- #undef __DISABLE_XOP__
- #pragma GCC pop_options
-diff --git a/gcc/config/i386/xsaveintrin.h b/gcc/config/i386/xsaveintrin.h
-index 47be25f..be2caea 100644
---- a/gcc/config/i386/xsaveintrin.h
-+++ b/gcc/config/i386/xsaveintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_XSAVE__
- #endif /* __XSAVE__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _xsave (void *__P, long long __M)
-@@ -69,4 +73,8 @@ _xrstor64 (void *__P, long long __M)
- #pragma GCC pop_options
- #endif /* __DISABLE_XSAVE__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _XSAVEINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/xsaveoptintrin.h b/gcc/config/i386/xsaveoptintrin.h
-index d7534b4..90eeb45 100644
---- a/gcc/config/i386/xsaveoptintrin.h
-+++ b/gcc/config/i386/xsaveoptintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_XSAVEOPT__
- #endif /* __XSAVEOPT__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- extern __inline void
- __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- _xsaveopt (void *__P, long long __M)
-@@ -55,4 +59,8 @@ _xsaveopt64 (void *__P, long long __M)
- #pragma GCC pop_options
- #endif /* __DISABLE_XSAVEOPT__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _XSAVEOPTINTRIN_H_INCLUDED */
-diff --git a/gcc/config/i386/xtestintrin.h b/gcc/config/i386/xtestintrin.h
-index ba79e5c..864b727 100644
---- a/gcc/config/i386/xtestintrin.h
-+++ b/gcc/config/i386/xtestintrin.h
-@@ -34,6 +34,10 @@
- #define __DISABLE_RTM__
- #endif /* __RTM__ */
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- /* Return non-zero if the instruction executes inside an RTM or HLE code
-    region.  Return zero otherwise.   */
- extern __inline int
-@@ -48,4 +52,8 @@ _xtest (void)
- #pragma GCC pop_options
- #endif /* __DISABLE_RTM__ */
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif /* _XTESTINTRIN_H_INCLUDED */
--- 
-1.8.4.5
-
diff -r cdd39c428e50 -r d618b728985f src/native-gcc.mk
--- a/src/native-gcc.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/native-gcc.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -3,10 +3,10 @@
 
 PKG             := native-gcc
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 4.9.4
-$(PKG)_CHECKSUM := 5bb0b783a57a62b11f1f9bd2aa37145da221d3d0
+$(PKG)_VERSION  := 7.1.0
+$(PKG)_CHECKSUM := a6dca81b25a97416211218f725b26f01e8063e05
 $(PKG)_SUBDIR   := gcc-$($(PKG)_VERSION)
-$(PKG)_FILE     := gcc-$($(PKG)_VERSION).tar.bz2
+$(PKG)_FILE     := gcc-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
 $(PKG)_URL_2    := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
 
diff -r cdd39c428e50 -r d618b728985f src/pthreads.mk
--- a/src/pthreads.mk	Wed Jul 26 08:36:12 2017 -0400
+++ b/src/pthreads.mk	Mon Jul 31 16:53:21 2017 -0400
@@ -16,6 +16,12 @@
 
 ifeq ($(MXE_SYSTEM)$(MXE_NATIVE_BUILD),mingwno)
 define $(PKG)_BUILD
+    # apply the mingw-w64 patches to the mingw sources
+    $(foreach PKG_PATCH,$(sort $(wildcard $(TOP_DIR)/src/mingw-w64-*.patch)),
+      (cd '$(1)' && $(PATCH) -p1 -u) < $(PKG_PATCH))
+    $(foreach PKG_PATCH,$(sort $(wildcard $(TOP_DIR)/src/$(MXE_SYSTEM)-mingw-w64-*.patch)),
+      (cd '$(1)' && $(PATCH) -p1 -u) < $(PKG_PATCH))
+
     cd '$(1)/mingw-w64-libraries/winpthreads' && ./configure \
         $(HOST_AND_BUILD_CONFIGURE_OPTIONS) \
         --prefix='$(HOST_PREFIX)' \
