Jacob Carlborg wrote:
On 2010-10-13 20:18, Walter Bright wrote:
Furthermore, OSX has no documented way to allocate TLS
static data in the object file. I spent considerable effort figuring out
a way to do this and get around the numerous bugs in the OSX linker that
tried to stop me.

I just read a bit about how TLS is implemented on linux, just of curiosity what was the problem, the linker, runtime, loader or all? On linux the static TLS data is put in the the object file like any other data. The only difference is it has a different name of the section/segment and an additional flag. Then of course the linker, runtime and loader know about these sections and make any necessary initializations when the application loads.

The linker, runtime, and loader do not know about any TLS sections under OSX, and do not do any necessary initializations. The linker bugs were because it behaved erratically when laying out named sections that were not the usual sections emitted by gcc.


Anyhow, the source is here:

http://www.dsource.org/projects/druntime/browser/trunk/src/core/thread.d

and the function you're interested in is ___tls_get_addr. You're welcome
to make improvements to it.

That doesn't seem to be a lot of code to optimize, is Thread.getThis() slow?

I've already been 'round the block on that code a few times. If you want to have a go at it, perhaps I missed something and you'll see it.

Reply via email to