This is the mail archive of the 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

Jakub Jelinek wrote:

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, thanks a lot for those additional details. I hope to look a bit more into these issues myself, starting from your indications, maybe you can also browse a bit libsupc++/ and look at the get_globals functions?!? Note that the involved __thread var is local static in our case.


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