[cxx-abi-dev] thread_local CONstructors

Jason Merrill jason at redhat.com
Thu Sep 27 12:54:04 UTC 2012


On 09/26/2012 05:03 PM, Jason Merrill wrote:
> On 09/26/2012 10:59 AM, Richard Henderson wrote:
>> Which means that one call to __tls_get_addr can be shared for the
>> lookup of I and I_DONE.
>
> I suppose tweaking the wrapper to
>
> extern int& i_init() __attribute__ ((weak));
> inline int& i_wrapper()
> {
>    if (i_init)
>      return i_init();
>    else
>      return i;
> }
>
> would avoid looking up the TLS address on both sides of the call to i_init.

On further consideration, I guess this wouldn't really be a win; it 
would prevent making i_init an alias to the whole-TU init function, and 
then you'd need to look up i in both i_init and the TU init fn.

Jason



More information about the cxx-abi-dev mailing list