This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: emulating tls for systems without


On Fri, Oct 06, 2006 at 04:17:00PM -0700, Geoffrey Keating wrote:
> (The big benefit of the non-emulated TLS is that memory is allocated  
> on pthread_create(), so you know that either memory gets allocated or  
> the thread doesn't get created, and either way you don't get random  
> crashes...)

That's actually only true for the local-exec and initial-exec tls
models, global-dynamic and local-dynamic tls models do sometimes
allocate memory on the first access and can abort the process
the same way as emutls does.

So, if libstdc++-v3 relies on no allocations being done on __thread
var access, it needs to use __attribute__((tls_model ("initial-exec"))),
at least on Linux or wherever else is initial-exec model allowed
even for dlopened shared libraries (though, it shouldn't really use more
than 8 or worst case 16 bytes there, the space for these in dlopened
libraries is quite limited).

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]