[mingw32-runtime] GCC 4.6 compatibility patch from upstream

Kalev Lember kalev at fedoraproject.org
Fri Aug 26 15:28:59 UTC 2011


commit 301153195afae02e77811376ec9b916d6ba09452
Author: Kalev Lember <kalevlember at gmail.com>
Date:   Fri Aug 26 14:53:44 2011 +0300

    GCC 4.6 compatibility patch from upstream

 mingw32-runtime.spec |    6 ++++
 mingwrt-gcc46.patch  |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 0 deletions(-)
---
diff --git a/mingw32-runtime.spec b/mingw32-runtime.spec
index 837593f..4b03ca2 100644
--- a/mingw32-runtime.spec
+++ b/mingw32-runtime.spec
@@ -18,6 +18,10 @@ Source0:        http://downloads.sourceforge.net/mingw/mingwrt-%{version}-mingw3
 # fix float.h when gcc's float.h precedes it in the include path.
 Patch0:         mingwrt-float.patch
 
+# Backported from upstream,
+# http://sourceforge.net/tracker/?func=detail&aid=3105314&group_id=2435&atid=302435
+Patch1:         mingwrt-gcc46.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
@@ -39,6 +43,7 @@ MinGW Windows cross-compiler runtime, base libraries.
 %prep
 %setup -q -n mingwrt-%{version}-mingw32
 %patch0 -p1 -b .float
+%patch1 -p1 -b .gcc46
 
 
 %build
@@ -76,6 +81,7 @@ rm -rf $RPM_BUILD_ROOT
 %changelog
 * Fri Aug 26 2011 Kalev Lember <kalevlember at gmail.com> - 3.18-4
 - Fix float.h when gcc's float.h precedes it in the include path
+- GCC 4.6 compatibility patch from upstream
 
 * Tue May 10 2011 Kalev Lember <kalev at smartlink.ee> - 3.18-3
 - Build without -fexceptions (#629209)
diff --git a/mingwrt-gcc46.patch b/mingwrt-gcc46.patch
new file mode 100644
index 0000000..1a3d0e1
--- /dev/null
+++ b/mingwrt-gcc46.patch
@@ -0,0 +1,76 @@
+From ee45e1e97ae69c66cd261dc8c4e2e4640238a34b Mon Sep 17 00:00:00 2001
+From: ironhead <ironhead>
+Date: Mon, 27 Dec 2010 21:01:13 +0000
+Subject: [PATCH] 2010-11-08 Rodrigo Rivas Costa <rodrigorivascosta at gmail.com>
+
+        * tlssup.c (__dyn_tls_init): Use an integer variable to iterate between
+        __xd_a and __xd_z.
+---
+ ChangeLog |    5 +++++
+ tlssup.c  |   21 ++++++++++++---------
+ 2 files changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index e90df7c..bc65b26 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2010-11-08 Rodrigo Rivas Costa <rodrigorivascosta at gmail.com>
++
++	* tlssup.c (__dyn_tls_init): Use an integer variable to iterate between
++	__xd_a and __xd_z.
++
+ 2010-07-25  Keith Marshall  <keithmarshall at users.sourceforge.net>
+ 
+ 	Accept that mingwrt headers are not guaranteed to precede GCC's in the
+diff --git a/tlssup.c b/tlssup.c
+index b101d11..660d098 100644
+--- a/tlssup.c
++++ b/tlssup.c
+@@ -94,6 +94,7 @@ BOOL WINAPI
+ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
+ {
+   _PVFV *pfunc;
++  int nfuncs, ifunc;
+ 
+ #ifndef _WIN64
+   if (_winmajor < 4)
+@@ -107,13 +108,13 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
+     }
+     if (__mingw_mthread_hdll == NULL || !__mingw_gMTRemoveKeyDtor || !__mingw_gMTKeyDtor)
+       {
+-	__mingw_gMTKeyDtor = NULL;
+-	__mingw_gMTRemoveKeyDtor = NULL;
+-	if (__mingw_mthread_hdll)
+-	  FreeLibrary (__mingw_mthread_hdll);
+-	__mingw_mthread_hdll = NULL;
+-	_CRT_MT = 0;
+-	return TRUE;
++  __mingw_gMTKeyDtor = NULL;
++  __mingw_gMTRemoveKeyDtor = NULL;
++  if (__mingw_mthread_hdll)
++    FreeLibrary (__mingw_mthread_hdll);
++  __mingw_mthread_hdll = NULL;
++  _CRT_MT = 0;
++  return TRUE;
+       }
+     _CRT_MT = 1;
+     return TRUE;
+@@ -130,10 +131,12 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
+       return TRUE;
+     }
+ 
+-  for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc)
++  nfuncs = &__xd_z - (&__xd_a + 1);
++  for (ifunc = 0; ifunc < nfuncs; ++ifunc)
+     {
++      pfunc = (&__xd_a + 1) + ifunc;
+       if (*pfunc != NULL)
+-	(*pfunc)();
++        (*pfunc)();
+     }
+   return TRUE;
+ }
+-- 
+1.7.6
+


More information about the mingw mailing list