diff options
author | Chris Sutcliffe <ir0nh34d@users.sourceforge.net> | 2011-12-01 03:49:46 +0400 |
---|---|---|
committer | Chris Sutcliffe <ir0nh34d@users.sourceforge.net> | 2011-12-01 03:49:46 +0400 |
commit | a1690e62abbbc14dbd6768fdd2ecca4ef4c9698f (patch) | |
tree | 9013afa5bdd40f4667098d441e6dee52df2260a9 /winsup/mingw | |
parent | 23d55447481e9b042b6cc603d0ce2a3d7316359c (diff) |
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.
Diffstat (limited to 'winsup/mingw')
-rw-r--r-- | winsup/mingw/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/mingw/tlssup.c | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 4d7e6ced7..e0cdd738f 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,9 @@ +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. + 2011-11-26 Keith Marshall <keithmarshall@users.sourceforge.net> Clean up DIRENT errno handling; make it more POSIX conformant. diff --git a/winsup/mingw/tlssup.c b/winsup/mingw/tlssup.c index e1685f5fc..4a152b45b 100644 --- a/winsup/mingw/tlssup.c +++ b/winsup/mingw/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)(); } |