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
