On Tue, 03 Jan 2012 18:56:56 +0100, Jacob Carlborg <[email protected]> wrote:

On 2012-01-03 18:27, Sean Kelly wrote:
The trick seems to be mapping in TLS (on OSX anyway) and running static crore at the right time. Are there other issues as well?

TLS has at least been an issue to me when trying to implement support for dynamic libraries on Mac OS X. I have no idea how the ___tls_get_addr function should be implemented to support dynamic libraries, especially not since we're rolling our own implementation and there's no documentation to follow.

I don't think there's any problems with the static constructors.

I've posted about my problems before at the DMD internals mailing list:

http://dfeed.kimsufi.thecybershadow.net/discussion/post/[email protected]


Without support from the OS (TLS segment register)
and none of the linker (module index as dynamic TLS relocations)
any implementation will be severely flawed/inefficient.

As a workaround you could determine the library that called
__tls_get_addr by the return address, e.g. through __builtin_return_address(0),
and a search it among the .text ranges of all loaded libraries.

Reply via email to