Jacob Carlborg wrote:
As I said, the static TLS data is put in the object file like any other data.
No, it isn't. It has to go into segregated sections so it can be distinguished from regular static data. Fixup records are different for them, and some special code sequences are used to access them.
I can see that the linker could/would be a problem. Of course the compiler needs to be updated but there should be any problems updating dmd. I guess you're referring to gcc. I also have to say that I haven't fully understood what the linker does in this case, with the TLS data.
On Linux, the linker understands the special TLS sections, and the special relocation fixups to reference them. It also patches the specific TLS access code sequences emitted by the compiler differently depending on whether the result is to go into an executable or a shared library.
On OSX, none of this happens.
