2011-11-30 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>

* tlssup.c (__dyn_tls_init): Reapply patch from 3105314.

        Thank you to Earnie for creating the patch file.
This commit is contained in:
Chris Sutcliffe
2011-11-30 23:49:46 +00:00
parent 23d5544748
commit a1690e62ab
2 changed files with 12 additions and 1 deletions

View File

@@ -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)();
}