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: RFC: C++ PATCH to support dynamic initialization and destruction of C++11 and OpenMP TLS variables


On 10/05/2012 10:38 AM, Jason Merrill wrote:
On 10/05/2012 04:29 AM, Richard Guenther wrote:
Or if we have the extra indirection via a reference anyway, we could
have a pointer TLS variable (NULL initialized) that on the first access
will trap where in a trap handler we could then perform initialization
and setup of that pointer.

Interesting idea. But I don't think there's any way to determine from a SEGV handler which null pointer needs to be initialized, and in any case users might want to have their own SEGV handlers.

But then, with support from the kernel and dynamic loader we aren't limited to normal signal handlers; it ought to be possible to mark a page of thread_local variables as trapping so that the first reference invokes a designated initialization function. I think that such a scheme ought to be link-compatible with this one so long as the initialization function is the same; references would just be direct rather than through the wrapper function.


It sounds like recent versions of MacOS X support something like this, though clang doesn't take advantage of it yet.

Jason


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