Hi, well,
- (ULONG_PTR) &_tls_start+1, (ULONG_PTR) &_tls_end, + (ULONG_PTR) &_tls_start, (ULONG_PTR) &_tls_end, looks to me wrong due we always have one pointer-size allocated in TLS. shouldn't be the required fix as the following here? - (ULONG_PTR) &_tls_start+1, (ULONG_PTR) &_tls_end, + (ULONG_PTR) (&_tls_start+1), (ULONG_PTR) &_tls_end, Cheers, Kai 2013/2/19 David Nadlinger <c...@klickverbot.at>: > Hi all, > > please find two patches to fix/improve TLS support in mingw-w64-crt attached. > > The first diff is an actual bug fix; it corrects the TLS start address > written to the TLS dictionary (_tls_used). It is used to determine the > size and initial contents of the TLS area for new threads. If it does > not point to the start of the section, all the initial data will be > off (as well as the size), because the Windows TLS model uses offsets > relative to the section start (@SECREL). > > The second diff is just a small optimization, it moves the TLS > dictionary out of the .tls section, as it isn't itself thread-specific > data. The current situation seems to work fine as it is just read-only > data anyway, but it is confusing while debugging and also wastes a few > bytes of TLS memory. > > Using the patches, TLS works fine in our (LDC) compiler. I'm not quite > sure what the best way to add a test case for this is, as the MinGW > GCC uses the "emutls" infrastructure instead of native Windows TLS for > __thread variables, and a test case in asm seems a bit cumbersome to > handle. > > Also, please let me know if there is another preferred method to submit > patches. > > David > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > -- | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public