summaryrefslogtreecommitdiff
path: root/dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch')
-rw-r--r--dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch b/dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch
new file mode 100644
index 000000000000..eff81002e624
--- /dev/null
+++ b/dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch
@@ -0,0 +1,27 @@
+https://sourceforge.net/tracker/?func=detail&aid=3446009&group_id=2435&atid=302435
+https://bugs.gentoo.org/419627
+
+--- a/tlssup.c
++++ b/tlssup.c
+@@ -84,6 +84,7 @@ BOOL WINAPI
+ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
+ {
+ _PVFV *pfunc;
++ int nfuncs, ifunc;
+
+ /* We don't let us trick here. */
+ if (_CRT_MT != 2)
+@@ -96,8 +97,12 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
+ return TRUE;
+ }
+
+- for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc)
++ /* Use the nfuncs variable to iterate the TLS functions instead of pfunc to
++ avoid nasty compiler optimizations when comparing two global pointers. */
++ nfuncs = &__xd_z - (&__xd_a + 1);
++ for (ifunc=0; ifunc < nfuncs; ++ifunc)
+ {
++ pfunc = (&__xd_a + 1) + ifunc;
+ if (*pfunc != NULL)
+ (*pfunc)();
+ }