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
0001-fix-tls-start-offset.diff
Description: Binary data
0002-do-not-place-tls-used-in-tls-section.diff
Description: Binary data
------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
