LLVM and TLS

Jacob Carlborg via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Feb 20 01:04:18 PST 2015


On 2015-02-19 23:27, deadalnix wrote:

> Hijacking this as I'm investigating how TLS plays with shared object.

I guess you can read the documentation at [1] and the source code in 
druntime for Linux and FreeBSD.

> So, my understanding is that the segment register is used as a base for
> TLS, and TLS globals are indexed using this register as a base.
>
> This sounds like it can work until you have to cross shared object
> boundaries. What is done in this case ?

I think that is when a runtime helper functions is used, i.e. 
__tls_get_addr. Multiple models of TLS exist and they very between 
platforms and depending of what features are needed, i.e. shared 
objects. There's some documentation [1].

[1] http://www.akkadia.org/drepper/tls.pdf

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list