mingw-runtime-3.18-gcc-4.6.patch 861 B

12345678910111213141516171819202122232425262728
  1. https://sourceforge.net/tracker/?func=detail&aid=3446009&group_id=2435&atid=302435
  2. https://bugs.gentoo.org/419627
  3. --- a/tlssup.c
  4. +++ b/tlssup.c
  5. @@ -84,6 +84,7 @@ BOOL WINAPI
  6. __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
  7. {
  8. _PVFV *pfunc;
  9. + int nfuncs, ifunc;
  10. /* We don't let us trick here. */
  11. if (_CRT_MT != 2)
  12. @@ -96,8 +97,12 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
  13. return TRUE;
  14. }
  15. - for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc)
  16. + /* Use the nfuncs variable to iterate the TLS functions instead of pfunc to
  17. + avoid nasty compiler optimizations when comparing two global pointers. */
  18. + nfuncs = &__xd_z - (&__xd_a + 1);
  19. + for (ifunc=0; ifunc < nfuncs; ++ifunc)
  20. {
  21. + pfunc = (&__xd_a + 1) + ifunc;
  22. if (*pfunc != NULL)
  23. (*pfunc)();
  24. }