OS X libphobos2.so

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 7 00:37:39 PST 2015


On 2015-11-06 19:46, bitwise wrote:

> Currently, the compiler just calls ___tls_get_addr(void *p) to get the
> thread local copy of a global. If that function signature is altered to
> take a pointer to the image as well, the problem is solved.

Hehe, you make it sound so easy. Perhaps I missed something and you know 
more than I do. But as far as I know you have two options:

1. Implement native TLS. This will require modifications to the compiler 
and minor tweaks in the runtime

2. Continue to use the custom TLS implementation but add support for 
dynamic libraries. This will require modifications to the compiler (as 
you said above) and major changes to the runtime

The native TLS implementation works as you described above (roughly). I 
can hardly believe that the code Apple added to the dynamic linker to 
implement TLS is not necessary. I don't see how you can get around not 
implementing the same code as the dynamic linker does.

I also think that this is a good opportunity to change to native TLS. I 
don't like this situation we have now: "Yeah, D is compatible with C, 
except TLS on OS X.".

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list