summaryrefslogtreecommitdiffstats
path: root/src/gcc-2-intrinsics.patch
diff options
context:
space:
mode:
Diffstat (limited to 'src/gcc-2-intrinsics.patch')
-rw-r--r--src/gcc-2-intrinsics.patch813
1 files changed, 813 insertions, 0 deletions
diff --git a/src/gcc-2-intrinsics.patch b/src/gcc-2-intrinsics.patch
new file mode 100644
index 0000000..5fda900
--- /dev/null
+++ b/src/gcc-2-intrinsics.patch
@@ -0,0 +1,813 @@
+# 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 -Nur gcc-4.8.0.orig/gcc/config/i386/adxintrin.h gcc-4.8.0/gcc/config/i386/adxintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/adxintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/adxintrin.h 2013-03-25 20:56:28.799283008 +1100
+@@ -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 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _ADXINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/ammintrin.h gcc-4.8.0/gcc/config/i386/ammintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/ammintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/ammintrin.h 2013-03-25 20:57:25.809281634 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE3, SSE2 and SSE header files*/
+ #include <pmmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_stream_sd (double * __P, __m128d __Y)
+ {
+@@ -83,6 +87,10 @@
+ (unsigned int)(I), (unsigned int)(L)))
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE4A__ */
+
+ #endif /* _AMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/avx2intrin.h gcc-4.8.0/gcc/config/i386/avx2intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/avx2intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/avx2intrin.h 2013-03-25 20:58:19.069280351 +1100
+@@ -25,6 +25,10 @@
+ # error "Never use <avx2intrin.h> directly; include <immintrin.h> instead."
+ #endif
+
++#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. */
+@@ -1871,3 +1875,7 @@
+ (__v4si)(__m128i)MASK, \
+ (int)SCALE)
+ #endif /* __OPTIMIZE__ */
++
++#ifdef __cplusplus
++}
++#endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/avxintrin.h gcc-4.8.0/gcc/config/i386/avxintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/avxintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/avxintrin.h 2013-03-25 21:27:20.819238377 +1100
+@@ -28,6 +28,10 @@
+ # error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
+ #endif
+
++#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)));
+@@ -1424,3 +1428,7 @@
+ {
+ return (__m256i) __builtin_ia32_si256_si ((__v4si)__A);
+ }
++
++#ifdef __cplusplus
++}
++#endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/bmi2intrin.h gcc-4.8.0/gcc/config/i386/bmi2intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/bmi2intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/bmi2intrin.h 2013-03-25 20:58:50.845946252 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _BMI2INTRIN_H_INCLUDED
+ #define _BMI2INTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline unsigned int
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _bzhi_u32 (unsigned int __X, unsigned int __Y)
+@@ -99,4 +103,8 @@
+
+ #endif /* !__x86_64__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _BMI2INTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/bmiintrin.h gcc-4.8.0/gcc/config/i386/bmiintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/bmiintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/bmiintrin.h 2013-03-25 20:59:19.032612239 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _BMIINTRIN_H_INCLUDED
+ #define _BMIINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ __tzcnt_u16 (unsigned short __X)
+ {
+@@ -116,4 +120,8 @@
+
+ #endif /* __x86_64__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _BMIINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/cpuid.h gcc-4.8.0/gcc/config/i386/cpuid.h
+--- gcc-4.8.0.orig/gcc/config/i386/cpuid.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/cpuid.h 2013-03-25 19:28:56.476076250 +1100
+@@ -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)
+@@ -266,3 +270,8 @@
+ __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
+ return 1;
+ }
++
++#ifdef __cplusplus
++}
++#endif
++
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/emmintrin.h gcc-4.8.0/gcc/config/i386/emmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/emmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/emmintrin.h 2013-03-25 19:28:56.476076250 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE header files*/
+ #include <xmmintrin.h>
+
++#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 @@
+ return (__m128d) __A;
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE2__ */
+
+ #endif /* _EMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/f16cintrin.h gcc-4.8.0/gcc/config/i386/f16cintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/f16cintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/f16cintrin.h 2013-03-25 21:00:27.905943912 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _F16CINTRIN_H_INCLUDED
+ #define _F16CINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _cvtsh_ss (unsigned short __S)
+ {
+@@ -88,5 +92,9 @@
+ ((__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf)(__m256) A, (int) (I)))
+ #endif /* __OPTIMIZE */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _F16CINTRIN_H_INCLUDED */
+ #endif /* __F16C__ */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/fma4intrin.h gcc-4.8.0/gcc/config/i386/fma4intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/fma4intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/fma4intrin.h 2013-03-25 19:28:56.479409583 +1100
+@@ -35,6 +35,10 @@
+ /* We need definitions from the SSE4A, SSE3, SSE2 and SSE header files. */
+ #include <ammintrin.h>
+
++#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)
+@@ -231,6 +235,10 @@
+ return (__m256d) __builtin_ia32_vfmaddsubpd256 ((__v4df)__A, (__v4df)__B, -(__v4df)__C);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif
+
+ #endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/fmaintrin.h gcc-4.8.0/gcc/config/i386/fmaintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/fmaintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/fmaintrin.h 2013-03-25 21:01:36.072608935 +1100
+@@ -32,6 +32,10 @@
+ # error "FMA instruction set not enabled"
+ #else
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline __m128d
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
+@@ -292,6 +296,10 @@
+ -(__v8sf)__C);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif
+
+ #endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/fxsrintrin.h gcc-4.8.0/gcc/config/i386/fxsrintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/fxsrintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/fxsrintrin.h 2013-03-25 21:02:02.299274971 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _FXSRINTRIN_H_INCLUDED
+ #define _FXSRINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _fxsave (void *__P)
+@@ -58,4 +62,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _FXSRINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/gmm_malloc.h gcc-4.8.0/gcc/config/i386/gmm_malloc.h
+--- gcc-4.8.0.orig/gcc/config/i386/gmm_malloc.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/gmm_malloc.h 2013-03-25 19:28:56.479409583 +1100
+@@ -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 @@
+ free (((void **) aligned_ptr) [-1]);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _MM_MALLOC_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/ia32intrin.h gcc-4.8.0/gcc/config/i386/ia32intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/ia32intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/ia32intrin.h 2013-03-25 21:30:01.905901162 +1100
+@@ -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__))
+@@ -240,3 +244,7 @@
+ #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 -Nur gcc-4.8.0.orig/gcc/config/i386/immintrin.h gcc-4.8.0/gcc/config/i386/immintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/immintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/immintrin.h 2013-03-25 21:11:37.879261100 +1100
+@@ -88,6 +88,10 @@
+ #include <xtestintrin.h>
+ #endif
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ #ifdef __RDRND__
+ extern __inline int
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+@@ -173,4 +177,8 @@
+ #endif /* __RDRND__ */
+ #endif /* __x86_64__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _IMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/lwpintrin.h gcc-4.8.0/gcc/config/i386/lwpintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/lwpintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/lwpintrin.h 2013-03-25 19:28:56.479409583 +1100
+@@ -32,6 +32,10 @@
+ # error "LWP instruction set not enabled"
+ #else
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ __llwpcb (void *pcbAddress)
+ {
+@@ -95,6 +99,10 @@
+ #endif
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __LWP__ */
+
+ #endif /* _LWPINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/lzcntintrin.h gcc-4.8.0/gcc/config/i386/lzcntintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/lzcntintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/lzcntintrin.h 2013-03-25 21:12:40.285926264 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _LZCNTINTRIN_H_INCLUDED
+ #define _LZCNTINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ __lzcnt16 (unsigned short __X)
+ {
+@@ -64,4 +68,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _LZCNTINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/mm3dnow.h gcc-4.8.0/gcc/config/i386/mm3dnow.h
+--- gcc-4.8.0.orig/gcc/config/i386/mm3dnow.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/mm3dnow.h 2013-03-25 19:28:56.482742915 +1100
+@@ -32,6 +32,10 @@
+ #include <mmintrin.h>
+ #include <prfchwintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _m_femms (void)
+ {
+@@ -205,6 +209,11 @@
+ }
+
+ #endif /* __3dNOW_A__ */
++
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __3dNOW__ */
+
+ #endif /* _MM3DNOW_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/mmintrin.h gcc-4.8.0/gcc/config/i386/mmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/mmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/mmintrin.h 2013-03-25 19:28:56.482742915 +1100
+@@ -30,6 +30,11 @@
+ #ifndef __MMX__
+ # error "MMX instruction set not enabled"
+ #else
++
++#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__));
+@@ -916,5 +921,9 @@
+ return _mm_set_pi8 (__b, __b, __b, __b, __b, __b, __b, __b);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __MMX__ */
+ #endif /* _MMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/pmm_malloc.h gcc-4.8.0/gcc/config/i386/pmm_malloc.h
+--- gcc-4.8.0.orig/gcc/config/i386/pmm_malloc.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/pmm_malloc.h 2013-03-25 19:28:56.482742915 +1100
+@@ -34,6 +34,10 @@
+ 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 @@
+ free (ptr);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _MM_MALLOC_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/pmmintrin.h gcc-4.8.0/gcc/config/i386/pmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/pmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/pmmintrin.h 2013-03-25 19:28:56.482742915 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE2 and SSE header files*/
+ #include <emmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Additional bits in the MXCSR. */
+ #define _MM_DENORMALS_ZERO_MASK 0x0040
+ #define _MM_DENORMALS_ZERO_ON 0x0040
+@@ -122,6 +126,10 @@
+ __builtin_ia32_mwait (__E, __H);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE3__ */
+
+ #endif /* _PMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/popcntintrin.h gcc-4.8.0/gcc/config/i386/popcntintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/popcntintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/popcntintrin.h 2013-03-25 19:28:56.482742915 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _POPCNTINTRIN_H_INCLUDED
+ #define _POPCNTINTRIN_H_INCLUDED
+
++#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)
+@@ -43,4 +47,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _POPCNTINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/prfchwintrin.h gcc-4.8.0/gcc/config/i386/prfchwintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/prfchwintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/prfchwintrin.h 2013-03-25 21:13:57.149257744 +1100
+@@ -33,10 +33,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 -Nur gcc-4.8.0.orig/gcc/config/i386/rdseedintrin.h gcc-4.8.0/gcc/config/i386/rdseedintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/rdseedintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/rdseedintrin.h 2013-03-25 21:14:16.099257288 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _RDSEEDINTRIN_H_INCLUDED
+ #define _RDSEEDINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline int
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _rdseed16_step (unsigned short *p)
+@@ -55,4 +59,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _RDSEEDINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/rtmintrin.h gcc-4.8.0/gcc/config/i386/rtmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/rtmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/rtmintrin.h 2013-03-25 21:23:20.389244172 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _RTMINTRIN_H_INCLUDED
+ #define _RTMINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ #define _XBEGIN_STARTED (~0u)
+ #define _XABORT_EXPLICIT (1 << 0)
+ #define _XABORT_RETRY (1 << 1)
+@@ -74,4 +78,8 @@
+ #define _xabort(N) __builtin_ia32_xabort (N)
+ #endif /* __OPTIMIZE__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _RTMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/smmintrin.h gcc-4.8.0/gcc/config/i386/smmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/smmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/smmintrin.h 2013-03-25 19:28:56.486076248 +1100
+@@ -35,6 +35,10 @@
+ files. */
+ #include <tmmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Rounding mode macros. */
+ #define _MM_FROUND_TO_NEAREST_INT 0x00
+ #define _MM_FROUND_TO_NEG_INF 0x01
+@@ -825,6 +829,10 @@
+
+ #endif /* __SSE4_2__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE4_1__ */
+
+ #endif /* _SMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/tbmintrin.h gcc-4.8.0/gcc/config/i386/tbmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/tbmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/tbmintrin.h 2013-03-25 21:24:08.535909678 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _TBMINTRIN_H_INCLUDED
+ #define _TBMINTRIN_H_INCLUDED
+
++#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)
+@@ -169,4 +173,9 @@
+
+
+ #endif /* __x86_64__ */
++
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _TBMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/tmmintrin.h gcc-4.8.0/gcc/config/i386/tmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/tmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/tmmintrin.h 2013-03-25 19:28:56.486076248 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE3, SSE2 and SSE header files*/
+ #include <pmmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_hadd_epi16 (__m128i __X, __m128i __Y)
+ {
+@@ -239,6 +243,10 @@
+ return (__m64) __builtin_ia32_pabsd ((__v2si)__X);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSSE3__ */
+
+ #endif /* _TMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/wmmintrin.h gcc-4.8.0/gcc/config/i386/wmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/wmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/wmmintrin.h 2013-03-25 21:34:25.419228145 +1100
+@@ -34,6 +34,10 @@
+ # error "AES/PCLMUL instructions not enabled"
+ #else
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* AES */
+
+ #ifdef __AES__
+@@ -115,6 +119,10 @@
+ #endif
+ #endif /* __PCLMUL__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __AES__/__PCLMUL__ */
+
+ #endif /* _WMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xmmintrin.h gcc-4.8.0/gcc/config/i386/xmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xmmintrin.h 2013-03-25 19:28:56.486076248 +1100
+@@ -37,6 +37,10 @@
+ /* Get _mm_malloc () and _mm_free (). */
+ #include <mm_malloc.h>
+
++#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__));
+@@ -1241,6 +1245,10 @@
+ (row3) = __builtin_ia32_movhlps (__t3, __t2); \
+ } while (0)
+
++#ifdef __cplusplus
++}
++#endif
++
+ /* For backward source compatibility. */
+ #ifdef __SSE2__
+ # include <emmintrin.h>
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xopintrin.h gcc-4.8.0/gcc/config/i386/xopintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xopintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xopintrin.h 2013-03-25 19:28:56.489409581 +1100
+@@ -34,6 +34,10 @@
+
+ #include <fma4intrin.h>
+
++#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)
+@@ -830,6 +834,10 @@
+ (int)(I)))
+ #endif /* __OPTIMIZE__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __XOP__ */
+
+ #endif /* _XOPMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xsaveintrin.h gcc-4.8.0/gcc/config/i386/xsaveintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xsaveintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xsaveintrin.h 2013-03-25 21:24:35.619242359 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _XSAVEINTRIN_H_INCLUDED
+ #define _XSAVEINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _xsave (void *__P, long long __M)
+@@ -58,4 +62,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _XSAVEINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xsaveoptintrin.h gcc-4.8.0/gcc/config/i386/xsaveoptintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xsaveoptintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xsaveoptintrin.h 2013-03-25 21:24:56.469241856 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _XSAVEOPTINTRIN_H_INCLUDED
+ #define _XSAVEOPTINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _xsaveopt (void *__P, long long __M)
+@@ -44,4 +48,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _XSAVEOPTINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xtestintrin.h gcc-4.8.0/gcc/config/i386/xtestintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xtestintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xtestintrin.h 2013-03-25 21:25:26.389241134 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _XTESTINTRIN_H_INCLUDED
+ #define _XTESTINTRIN_H_INCLUDED
+
++#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
+@@ -41,4 +45,8 @@
+ return __builtin_ia32_xtest ();
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _XTESTINTRIN_H_INCLUDED */