
Bronek Kozicki <brok <at> rubikon.pl> writes:
Hi Bronek, I hope you don't mind following up in here as I don't have access to the private groups right now anyway.
_tls_used variable appears to be absolutely required. To explain, I was
What I understand (it's quite blury picture right now) is that if you define one of: a) int _tls_index or b) _declspec(thread) some_variable
I believe things are a little bit different. Most of it is just guessing, though. But anyway: Essentially if a symbol named "__tls_used" is present, the VC6 linker will emit. VC 7 introduced __declspec(thread) which uses this functionality. Therefore the 7.0= CRT provides the __tls_used structure referencing the data in ]CRTXLA,CRTXLZ[. This would result in a static TLS section emitted for every PE image. Therefore the VC7 linker introduced a check for the __tls_index and the ".tls" section. __declspec(thread) introduces a data item in .tls. Accessing such a variable introduces references to _tls_array and _tls_index. So if you use VC7+ linker you need ".tls" section and __tls_used. With a VC6 linker the latter should be sufficient. With a GCC ld a version script might help. And GCC also support something like __attribute__((section)) which might work with PE images, too. -hg