From d08eb146daa43b46b16b0da23c2d0dd4a2de062a Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 3 Feb 2017 19:18:21 +1100 Subject: [PATCH 1/9] gcc4 plugin: freeze build rule and patch --- plugins/gcc4/gcc4-overlay.mk | 7 - plugins/gcc4/gcc4.mk | 130 ++++++ plugins/gcc4/gcc4.patch | 884 +++++++++++++++++++++++++++++++++++ 3 files changed, 1014 insertions(+), 7 deletions(-) create mode 100644 plugins/gcc4/gcc4.mk create mode 100644 plugins/gcc4/gcc4.patch diff --git a/plugins/gcc4/gcc4-overlay.mk b/plugins/gcc4/gcc4-overlay.mk index bfeb2f48..8b777a35 100644 --- a/plugins/gcc4/gcc4-overlay.mk +++ b/plugins/gcc4/gcc4-overlay.mk @@ -20,10 +20,3 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.bz2 $(PKG)_URL := http://isl.gforge.inria.fr/$($(PKG)_FILE) $(PKG)_URL_2 := ftp://gcc.gnu.org/pub/gcc/infrastructure/$($(PKG)_FILE) - -PKG := gcc -$(PKG)_VERSION := 4.9.4 -$(PKG)_CHECKSUM := 6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092 -$(PKG)_SUBDIR := gcc-$($(PKG)_VERSION) -$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2 -$(PKG)_URL := http://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE) diff --git a/plugins/gcc4/gcc4.mk b/plugins/gcc4/gcc4.mk new file mode 100644 index 00000000..3e264ac9 --- /dev/null +++ b/plugins/gcc4/gcc4.mk @@ -0,0 +1,130 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +PKG := gcc +$(PKG)_WEBSITE := http://gcc.gnu.org/ +$(PKG)_DESCR := GCC +$(PKG)_IGNORE := 5% +$(PKG)_VERSION := 4.9.4 +$(PKG)_CHECKSUM := 6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092 +$(PKG)_SUBDIR := gcc-$($(PKG)_VERSION) +$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2 +$(PKG)_PATCHES := $(basename $(lastword $(MAKEFILE_LIST))).patch +$(PKG)_URL := http://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) +$(PKG)_DEPS := binutils mingw-w64 + +$(PKG)_FILE_$(BUILD) := + +define $(PKG)_UPDATE + $(WGET) -q -O- 'http://ftp.gnu.org/gnu/gcc/?C=M;O=D' | \ + $(SED) -n 's,.* +Date: Thu, 30 Jul 2015 10:00:49 +0200 +Subject: [PATCH 1/2] mingw-float + +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 805b84d..b9dcc48 100644 +--- a/gcc/ginclude/float.h ++++ b/gcc/ginclude/float.h +@@ -263,3 +263,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 ++#endif ++#endif +-- +2.1.4 + + +From b5497062665c4f4e2a9e10f6ec44817f845ebe17 Mon Sep 17 00:00:00 2001 +From: Ilya Goncharov +Date: Thu, 30 Jul 2015 10:04:07 +0200 +Subject: [PATCH 2/2] intrinsics + +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 dd2a26c..2e680b3 100644 +--- a/gcc/config/i386/adxintrin.h ++++ b/gcc/config/i386/adxintrin.h +@@ -28,5 +28,9 @@ + #ifndef _ADXINTRIN_H_INCLUDED + #define _ADXINTRIN_H_INCLUDED + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + extern __inline unsigned char + __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +@@ -78,4 +82,8 @@ _addcarryx_u64 (unsigned char __CF, unsigned long 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 fb9a53f..341a1e4 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 b2a2f48..6d9e7ce 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. */ +@@ -1901,4 +1905,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 f49fe9d..dc099b8 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))); +@@ -1464,4 +1468,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 9f4df77..af873b0 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 a2e966c..ebf541d 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 f3ad4db..b145078 100644 +--- a/gcc/config/i386/cpuid.h ++++ b/gcc/config/i386/cpuid.h +@@ -21,6 +21,10 @@ + * . + */ + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + /* %ecx */ + #define bit_SSE3 (1 << 0) + #define bit_PCLMUL (1 << 1) +@@ -242,3 +246,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 b19f05a..64ef2d9 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))); +@@ -1535,6 +1539,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 d810a93..e2574ca 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 06668e8..8813ee4 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 9128b4d..d4bdf5d 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 a3932e0..aa5dfa4 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 52b853c..de07c3c 100644 +--- a/gcc/config/i386/gmm_malloc.h ++++ b/gcc/config/i386/gmm_malloc.h +@@ -27,6 +27,10 @@ + #include + #include + ++#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 1f728c8..e8abf07 100644 +--- a/gcc/config/i386/ia32intrin.h ++++ b/gcc/config/i386/ia32intrin.h +@@ -25,6 +25,10 @@ + # error "Never use directly; include 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 a1e9c3c..dfd9ea7 100644 +--- a/gcc/config/i386/immintrin.h ++++ b/gcc/config/i386/immintrin.h +@@ -96,6 +96,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) +@@ -192,4 +196,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 714b565..a362d57 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 9f9f145..357940b 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 2a88997..1f22553 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 d098473..1cb9e54 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 901001b..79abf65 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 feb42de..ac1c3c6 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 d5ccf31..15e8783 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 2f15716..23ae144 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 b65fbc9..36f3ecd 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 6396c9d..c12f499 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 b078780..39d969d 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 cc265bb..a0b3710 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 ac2e343..f9b54f0 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 37eac1f..c98e0af 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 + ++#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 9cd3fa7..9334f27 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__)); +@@ -1245,6 +1249,10 @@ do { \ + (row3) = __builtin_ia32_movhlps (__t3, __t2); \ + } while (0) + ++#ifdef __cplusplus ++} ++#endif ++ + /* For backward source compatibility. */ + # include + +diff --git a/gcc/config/i386/xopintrin.h b/gcc/config/i386/xopintrin.h +index 6573767..e70ff21 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 614fcf6..a4f33d7 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 7f71c01..c195951 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 026e60b..6a78c42 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 */ +-- +2.1.4 + From d04f6ea96ad57253a6f7bed60ac15c5c789afe7e Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 3 Feb 2017 20:25:56 +1100 Subject: [PATCH 2/9] gcc: use SOURCE_DIR and BUILD_DIR --- src/gcc.mk | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/gcc.mk b/src/gcc.mk index e352d44c..b4159104 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -23,8 +23,7 @@ endef define $(PKG)_CONFIGURE # configure gcc - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ + cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \ --target='$(TARGET)' \ --build='$(BUILD)' \ --prefix='$(PREFIX)' \ @@ -71,47 +70,46 @@ endef define $(PKG)_BUILD_mingw-w64 # install mingw-w64 headers - $(call PREPARE_PKG_SOURCE,mingw-w64,$(1)) - mkdir '$(1).headers-build' - cd '$(1).headers-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-headers/configure' \ + $(call PREPARE_PKG_SOURCE,mingw-w64,$(BUILD_DIR)) + mkdir '$(BUILD_DIR).headers' + cd '$(BUILD_DIR).headers' && '$(BUILD_DIR)/$(mingw-w64_SUBDIR)/mingw-w64-headers/configure' \ --host='$(TARGET)' \ --prefix='$(PREFIX)/$(TARGET)' \ --enable-sdk=all \ --enable-idl \ --enable-secure-api \ $(mingw-w64-headers_CONFIGURE_OPTS) - $(MAKE) -C '$(1).headers-build' install + $(MAKE) -C '$(BUILD_DIR).headers' install # build standalone gcc $($(PKG)_CONFIGURE) - $(MAKE) -C '$(1).build' -j '$(JOBS)' all-gcc - $(MAKE) -C '$(1).build' -j 1 $(INSTALL_STRIP_TOOLCHAIN)-gcc + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' all-gcc + $(MAKE) -C '$(BUILD_DIR)' -j 1 $(INSTALL_STRIP_TOOLCHAIN)-gcc # build mingw-w64-crt - mkdir '$(1).crt-build' - cd '$(1).crt-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \ + mkdir '$(BUILD_DIR).crt' + cd '$(BUILD_DIR).crt' && '$(BUILD_DIR)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \ --host='$(TARGET)' \ --prefix='$(PREFIX)/$(TARGET)' \ @gcc-crt-config-opts@ - $(MAKE) -C '$(1).crt-build' -j '$(JOBS)' || $(MAKE) -C '$(1).crt-build' -j '$(JOBS)' - $(MAKE) -C '$(1).crt-build' -j 1 $(INSTALL_STRIP_TOOLCHAIN) + $(MAKE) -C '$(BUILD_DIR).crt' -j '$(JOBS)' || $(MAKE) -C '$(BUILD_DIR).crt' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR).crt' -j 1 $(INSTALL_STRIP_TOOLCHAIN) # build posix threads - mkdir '$(1).pthread-build' - cd '$(1).pthread-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-libraries/winpthreads/configure' \ + mkdir '$(BUILD_DIR).pthreads' + cd '$(BUILD_DIR).pthreads' && '$(BUILD_DIR)/$(mingw-w64_SUBDIR)/mingw-w64-libraries/winpthreads/configure' \ $(MXE_CONFIGURE_OPTS) - $(MAKE) -C '$(1).pthread-build' -j '$(JOBS)' || $(MAKE) -C '$(1).pthread-build' -j '$(JOBS)' - $(MAKE) -C '$(1).pthread-build' -j 1 $(INSTALL_STRIP_TOOLCHAIN) + $(MAKE) -C '$(BUILD_DIR).pthreads' -j '$(JOBS)' || $(MAKE) -C '$(BUILD_DIR).pthreads' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR).pthreads' -j 1 $(INSTALL_STRIP_TOOLCHAIN) # build rest of gcc - cd '$(1).build' - $(MAKE) -C '$(1).build' -j '$(JOBS)' - $(MAKE) -C '$(1).build' -j 1 $(INSTALL_STRIP_TOOLCHAIN) + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR)' -j 1 $(INSTALL_STRIP_TOOLCHAIN) # shared libgcc isn't installed to version-specific locations # so install correctly to simplify cleanup $(and $(BUILD_SHARED), - $(MAKE) -C '$(1).build/$(TARGET)/libgcc' -j 1 \ + $(MAKE) -C '$(BUILD_DIR)/$(TARGET)/libgcc' -j 1 \ toolexecdir='$(PREFIX)/$(TARGET)/bin' \ SHLIB_SLIBDIR_QUAL= \ install-shared) From 7ab58c37198b11351e963a02b307ff3c0d396e0e Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 3 Feb 2017 20:27:16 +1100 Subject: [PATCH 3/9] gcc: remove patch The first one seems to be needed for MinGW.org only. The patch was originally provided to fix _clear87 not defined errors. A simple test program from _clear87 documentation seems to be working [1]. The second one is not needed since [2] (committed on 2013-09-20). [1]: https://msdn.microsoft.com/en-us/library/49bs2z07.aspx [2]: http://sourceforge.net/p/mingw-w64/code/6303/ replaces and closes #1082 --- src/gcc-1.patch | 884 ------------------------------------------------ 1 file changed, 884 deletions(-) delete mode 100644 src/gcc-1.patch diff --git a/src/gcc-1.patch b/src/gcc-1.patch deleted file mode 100644 index e33c39c6..00000000 --- a/src/gcc-1.patch +++ /dev/null @@ -1,884 +0,0 @@ -This file is part of MXE. See LICENSE.md for licensing information. - -From 05788ad7e6bf16402aa7c9c085784c3582de425c Mon Sep 17 00:00:00 2001 -From: Mark Brand -Date: Thu, 30 Jul 2015 10:00:49 +0200 -Subject: [PATCH 1/2] mingw-float - -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 805b84d..b9dcc48 100644 ---- a/gcc/ginclude/float.h -+++ b/gcc/ginclude/float.h -@@ -263,3 +263,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 -+#endif -+#endif --- -2.1.4 - - -From b5497062665c4f4e2a9e10f6ec44817f845ebe17 Mon Sep 17 00:00:00 2001 -From: Ilya Goncharov -Date: Thu, 30 Jul 2015 10:04:07 +0200 -Subject: [PATCH 2/2] intrinsics - -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 dd2a26c..2e680b3 100644 ---- a/gcc/config/i386/adxintrin.h -+++ b/gcc/config/i386/adxintrin.h -@@ -28,5 +28,9 @@ - #ifndef _ADXINTRIN_H_INCLUDED - #define _ADXINTRIN_H_INCLUDED - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - extern __inline unsigned char - __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -@@ -78,4 +82,8 @@ _addcarryx_u64 (unsigned char __CF, unsigned long 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 fb9a53f..341a1e4 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 b2a2f48..6d9e7ce 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. */ -@@ -1901,4 +1905,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 f49fe9d..dc099b8 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))); -@@ -1464,4 +1468,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 9f4df77..af873b0 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 a2e966c..ebf541d 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 f3ad4db..b145078 100644 ---- a/gcc/config/i386/cpuid.h -+++ b/gcc/config/i386/cpuid.h -@@ -21,6 +21,10 @@ - * . - */ - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - /* %ecx */ - #define bit_SSE3 (1 << 0) - #define bit_PCLMUL (1 << 1) -@@ -242,3 +246,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 b19f05a..64ef2d9 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))); -@@ -1535,6 +1539,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 d810a93..e2574ca 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 06668e8..8813ee4 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 9128b4d..d4bdf5d 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 a3932e0..aa5dfa4 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 52b853c..de07c3c 100644 ---- a/gcc/config/i386/gmm_malloc.h -+++ b/gcc/config/i386/gmm_malloc.h -@@ -27,6 +27,10 @@ - #include - #include - -+#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 1f728c8..e8abf07 100644 ---- a/gcc/config/i386/ia32intrin.h -+++ b/gcc/config/i386/ia32intrin.h -@@ -25,6 +25,10 @@ - # error "Never use directly; include 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 a1e9c3c..dfd9ea7 100644 ---- a/gcc/config/i386/immintrin.h -+++ b/gcc/config/i386/immintrin.h -@@ -96,6 +96,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) -@@ -192,4 +196,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 714b565..a362d57 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 9f9f145..357940b 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 2a88997..1f22553 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 d098473..1cb9e54 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 901001b..79abf65 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 feb42de..ac1c3c6 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 d5ccf31..15e8783 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 2f15716..23ae144 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 b65fbc9..36f3ecd 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 6396c9d..c12f499 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 b078780..39d969d 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 cc265bb..a0b3710 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 ac2e343..f9b54f0 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 37eac1f..c98e0af 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 - -+#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 9cd3fa7..9334f27 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__)); -@@ -1245,6 +1249,10 @@ do { \ - (row3) = __builtin_ia32_movhlps (__t3, __t2); \ - } while (0) - -+#ifdef __cplusplus -+} -+#endif -+ - /* For backward source compatibility. */ - # include - -diff --git a/gcc/config/i386/xopintrin.h b/gcc/config/i386/xopintrin.h -index 6573767..e70ff21 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 614fcf6..a4f33d7 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 7f71c01..c195951 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 026e60b..6a78c42 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 */ --- -2.1.4 - From c6a3c2599368aa9052035b31d68ce69224ea3f68 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 3 Feb 2017 20:31:31 +1100 Subject: [PATCH 4/9] gcc cloog: remove unnecessary rules/variables/options --- plugins/examples/host-toolchain/gcc-host.mk | 4 ++-- src/cloog.mk | 1 - src/gcc.mk | 9 --------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/plugins/examples/host-toolchain/gcc-host.mk b/plugins/examples/host-toolchain/gcc-host.mk index 8dd35daa..bab48e1d 100644 --- a/plugins/examples/host-toolchain/gcc-host.mk +++ b/plugins/examples/host-toolchain/gcc-host.mk @@ -9,7 +9,7 @@ $(PKG)_FILE = $(gcc_FILE) $(PKG)_PATCHES = $(realpath $(sort $(wildcard $(addsuffix /gcc-[0-9]*.patch, $(TOP_DIR)/src)))) $(PKG)_URL = $(gcc_URL) $(PKG)_URL_2 = $(gcc_URL_2) -$(PKG)_DEPS := gcc binutils-host cloog gmp isl mpfr mpc pthreads +$(PKG)_DEPS := gcc binutils-host gmp isl mpfr mpc pthreads define $(PKG)_UPDATE echo $(gcc_VERSION) @@ -35,7 +35,7 @@ define $(PKG)_BUILD --disable-win32-registry \ --enable-threads=$(MXE_GCC_THREADS) \ --enable-libgomp \ - --with-{cloog,gmp,isl,mpc,mpfr}='$(PREFIX)/$(TARGET)' \ + --with-{gmp,isl,mpc,mpfr}='$(PREFIX)/$(TARGET)' \ $($(PKG)_CONFIGURE_OPTS) $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' diff --git a/src/cloog.mk b/src/cloog.mk index 0124f68e..d5d67585 100644 --- a/src/cloog.mk +++ b/src/cloog.mk @@ -10,7 +10,6 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://www.bastoul.net/cloog/pages/download/$($(PKG)_FILE) $(PKG)_URL_2 := ftp://gcc.gnu.org/pub/gcc/infrastructure/$($(PKG)_FILE) -$(PKG)_TARGETS := $(MXE_TARGETS) $(PKG)_DEPS := gcc gmp isl define $(PKG)_UPDATE diff --git a/src/gcc.mk b/src/gcc.mk index b4159104..b9303fe8 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -12,8 +12,6 @@ $(PKG)_URL := http://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG) $(PKG)_URL_2 := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE) $(PKG)_DEPS := binutils mingw-w64 -$(PKG)_FILE_$(BUILD) := - define $(PKG)_UPDATE $(WGET) -q -O- 'http://ftp.gnu.org/gnu/gcc/?C=M;O=D' | \ $(SED) -n 's,.* Date: Fri, 3 Feb 2017 20:39:14 +1100 Subject: [PATCH 5/9] gcc: move shared libgcc install to post build and cleanup libcc1 --- src/gcc.mk | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/gcc.mk b/src/gcc.mk index b9303fe8..31e8d28f 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -48,23 +48,6 @@ define $(PKG)_CONFIGURE $(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'") endef -define $(PKG)_POST_BUILD - # - no non-trivial way to configure installation of *.dlls - # each sudbir has it's own variations of variables like: - # `toolexeclibdir` `install-toolexeclibLTLIBRARIES` etc. - # and maintaining those would be cumbersome - # - need to keep `--enable-version-specific-runtime-libs` otherwise - # libraries go directly into $(PREFIX)/$(TARGET)/lib and are - # harder to cleanup - # - ignore rm failure as parallel build may have cleaned up, but - # don't wildcard all libs so future additions will be detected - $(and $(BUILD_SHARED), - mv -v '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll '$(PREFIX)/$(TARGET)/bin/' - -rm -v '$(PREFIX)/lib/gcc/$(TARGET)/'libgcc_s*.dll - -rm -v '$(PREFIX)/lib/gcc/$(TARGET)/lib/'libgcc_s*.a - -rmdir '$(PREFIX)/lib/gcc/$(TARGET)/lib/') -endef - define $(PKG)_BUILD_mingw-w64 # install mingw-w64 headers $(call PREPARE_PKG_SOURCE,mingw-w64,$(BUILD_DIR)) @@ -103,15 +86,33 @@ define $(PKG)_BUILD_mingw-w64 $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' $(MAKE) -C '$(BUILD_DIR)' -j 1 $(INSTALL_STRIP_TOOLCHAIN) - # shared libgcc isn't installed to version-specific locations - # so install correctly to simplify cleanup + $($(PKG)_POST_BUILD) +endef + +define $(PKG)_POST_BUILD + # - no non-trivial way to configure installation of *.dlls + # each sudbir has it's own variations of variables like: + # `toolexeclibdir` `install-toolexeclibLTLIBRARIES` etc. + # and maintaining those would be cumbersome + # - shared libgcc isn't installed to version-specific locations + # - need to keep `--enable-version-specific-runtime-libs` otherwise + # libraries go directly into $(PREFIX)/$(TARGET)/lib and are + # harder to cleanup + # - ignore rm failure as parallel build may have cleaned up, but + # don't wildcard all libs so future additions will be detected $(and $(BUILD_SHARED), $(MAKE) -C '$(BUILD_DIR)/$(TARGET)/libgcc' -j 1 \ toolexecdir='$(PREFIX)/$(TARGET)/bin' \ SHLIB_SLIBDIR_QUAL= \ - install-shared) + install-shared + mv -v '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll '$(PREFIX)/$(TARGET)/bin/' + -rm -v '$(PREFIX)/lib/gcc/$(TARGET)/'libgcc_s*.dll + -rm -v '$(PREFIX)/lib/gcc/$(TARGET)/lib/'libgcc_s*.a + -rmdir '$(PREFIX)/lib/gcc/$(TARGET)/lib/') - $($(PKG)_POST_BUILD) + # cc1libdir isn't passed to subdirs so install correctly and rm + $(MAKE) -C '$(BUILD_DIR)/libcc1' -j 1 install cc1libdir='$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)' + -rm -f '$(PREFIX)/lib/'libcc1* endef $(PKG)_BUILD_x86_64-w64-mingw32 = $(subst @gcc-crt-config-opts@,--disable-lib32,$($(PKG)_BUILD_mingw-w64)) From ec66310194ac1cda6a7493e60ca15c1527356b5a Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 3 Feb 2017 20:47:41 +1100 Subject: [PATCH 6/9] gcc: allow native cpu detection when building with clang fixes #1641 --- src/gcc-1-fixes.patch | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/gcc-1-fixes.patch diff --git a/src/gcc-1-fixes.patch b/src/gcc-1-fixes.patch new file mode 100644 index 00000000..4cab760b --- /dev/null +++ b/src/gcc-1-fixes.patch @@ -0,0 +1,27 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony Theodore +Date: Thu, 2 Feb 2017 02:05:50 +1100 +Subject: [PATCH] allow native cpu detection when building with clang + +function was disabled for non-gcc5 in: +https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b587c12551143c14f023860a1dbdf7316ae71f27;hp=43096b526a9f23008b9769372f11475ae63487bc + +clang can build it correctly and this should probably be a feature test + +diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c +index 1111111..2222222 100644 +--- a/gcc/config/i386/driver-i386.c ++++ b/gcc/config/i386/driver-i386.c +@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see + + const char *host_detect_local_cpu (int argc, const char **argv); + +-#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__)) ++#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__)) || defined(__clang__) + #include "cpuid.h" + + struct cache_desc From df1c3b4a8fcb3dc814c9690b13681a7d8ebd1dab Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 3 Feb 2017 20:49:24 +1100 Subject: [PATCH 7/9] Revert "hyperscan: fix build with gcc54 on darwin" This reverts commit 2a92ee34324326b4988fb7899a02b59553c25329. --- src/hyperscan-1-fixes.patch | 47 ------------------------------------- src/hyperscan.mk | 2 +- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/src/hyperscan-1-fixes.patch b/src/hyperscan-1-fixes.patch index 8df4378a..025c71dd 100644 --- a/src/hyperscan-1-fixes.patch +++ b/src/hyperscan-1-fixes.patch @@ -422,50 +422,3 @@ index 1111111..2222222 100644 Libs.private: @PRIVATE_LIBS@ -Cflags: -I${includedir}/hs +Cflags: -I${includedir}/hs -posix - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tony Theodore -Date: Sat, 21 Jan 2017 14:41:17 +1100 -Subject: [PATCH] add libatomic linking for gcc54 on macos - - -diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt -index 1111111..2222222 100644 ---- a/examples/CMakeLists.txt -+++ b/examples/CMakeLists.txt -@@ -7,7 +7,7 @@ endif() - add_executable(simplegrep simplegrep.c) - set_source_files_properties(simplegrep.c PROPERTIES COMPILE_FLAGS - "-Wall -Wno-unused-parameter") --target_link_libraries(simplegrep hs) -+target_link_libraries(simplegrep hs atomic) - - if (PCAP_LIBRARY) - add_executable(pcapscan pcapscan.cc) -diff --git a/libhs.pc.in b/libhs.pc.in -index 1111111..2222222 100644 ---- a/libhs.pc.in -+++ b/libhs.pc.in -@@ -7,5 +7,5 @@ Name: libhs - Description: Intel(R) Hyperscan Library - Version: @HS_VERSION@ - Libs: -L${libdir} -lhs --Libs.private: @PRIVATE_LIBS@ -+Libs.private: @PRIVATE_LIBS@ -latomic - Cflags: -I${includedir}/hs -posix -diff --git a/unit/CMakeLists.txt b/unit/CMakeLists.txt -index 1111111..2222222 100644 ---- a/unit/CMakeLists.txt -+++ b/unit/CMakeLists.txt -@@ -113,9 +113,9 @@ set(unit_hyperscan_SOURCES - ) - add_executable(unit-hyperscan ${unit_hyperscan_SOURCES}) - if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS) --target_link_libraries(unit-hyperscan hs_shared gtest expressionutil) -+target_link_libraries(unit-hyperscan hs_shared gtest expressionutil atomic) - else() --target_link_libraries(unit-hyperscan hs gtest expressionutil) -+target_link_libraries(unit-hyperscan hs gtest expressionutil atomic) - endif() - - # diff --git a/src/hyperscan.mk b/src/hyperscan.mk index ec55aef7..694bdb9f 100644 --- a/src/hyperscan.mk +++ b/src/hyperscan.mk @@ -21,7 +21,7 @@ define $(PKG)_BUILD # Add the following options to run on (virtual) machine without AVX2 # -DCMAKE_C_FLAGS="-march=core2" -DCMAKE_CXX_FLAGS="-march=core2" cd '$(1).build' && '$(TARGET)-cmake' \ - -DCMAKE_C_FLAGS="-msse4" -DCMAKE_CXX_FLAGS="-msse4" \ + -DCMAKE_C_FLAGS="-mssse4" -DCMAKE_CXX_FLAGS="-mssse4" \ -DRAGEL='$(PREFIX)/$(BUILD)/bin/ragel' \ '$(1)' $(MAKE) -C '$(1).build' -j '$(JOBS)' From db65b0022567ca3c9342bdae7fcb799343368f6d Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 3 Feb 2017 20:49:38 +1100 Subject: [PATCH 8/9] Revert "hyperscan: enable -msse4 flag" This reverts commit b9485ff3bf4b8b9e7d8003e0602fd75ef85349d1. --- src/hyperscan.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hyperscan.mk b/src/hyperscan.mk index 694bdb9f..2161aa29 100644 --- a/src/hyperscan.mk +++ b/src/hyperscan.mk @@ -21,7 +21,6 @@ define $(PKG)_BUILD # Add the following options to run on (virtual) machine without AVX2 # -DCMAKE_C_FLAGS="-march=core2" -DCMAKE_CXX_FLAGS="-march=core2" cd '$(1).build' && '$(TARGET)-cmake' \ - -DCMAKE_C_FLAGS="-mssse4" -DCMAKE_CXX_FLAGS="-mssse4" \ -DRAGEL='$(PREFIX)/$(BUILD)/bin/ragel' \ '$(1)' $(MAKE) -C '$(1).build' -j '$(JOBS)' From b1b913196993fa00ca9914224bca3528ca6c3aef Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 3 Feb 2017 20:50:58 +1100 Subject: [PATCH 9/9] gcc4 plugin: remove note about broken hyperscan --- plugins/gcc4/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/gcc4/README.md b/plugins/gcc4/README.md index 92b6910c..afbe8846 100644 --- a/plugins/gcc4/README.md +++ b/plugins/gcc4/README.md @@ -2,8 +2,3 @@ GCC 4.9.4 was used before [GCC 5.4.0](https://github.com/mxe/mxe/pull/1541). This plugin is a backup in case of problems with GCC 5.4.0. - -The only package known not to work with this plugin is hyperscan. -It was changed to work with GCC 5.4.0 (`-latomic` was added) and -that change broke support of GCC 4.9.4. -See [the comment](https://github.com/mxe/mxe/pull/1541#issuecomment-274389620).