[cxx-abi-dev] thread_local summary

Jason Merrill jason at redhat.com
Wed Oct 3 04:34:59 UTC 2012


On 10/02/2012 05:34 PM, John McCall wrote:
> I would guess that the odds are that most translation units are only going
> to define at most one single thread-local variable that needs dynamic
> initialization.  Why don't we have the everything-in-the-TU init function return
> a reference to the last thread_local variable it initializes?

That sounds plausible, though I'm not sure how much of a win it would be 
since you would only get the double load when doing the initialization 
anyway.

>> The init function symbol is an alias to the function that initializes all the thread_local variables defined in a translation unit.  For a variable with vague linkage, the alias should be weak.
>
> Hmm.  Those of us not on ELF might need to go in a totally different
> direction here.  I am not at all confident about making an alias to a
> weak symbol, particularly when the referent is generally not semantically
> equivalent.

Sure, if you don't have useful aliases you'll need to use some sort of stub.

Jason



More information about the cxx-abi-dev mailing list