Supporting emulated tls
Martin Nowak
dawg at dawgfoto.de
Thu Mar 22 22:03:40 PDT 2012
On Mon, 19 Mar 2012 10:40:25 +0100, Jacob Carlborg <doob at me.com> wrote:
> As I understand it, in the native ELF implementation, assembly is used
> to access the current module id, this is for FreeBSD:
> http://people.freebsd.org/~marcel/tls.html
> This is how ___tls_get_addr is implemented on FreeBSD ELF i386:
>
> https://bitbucket.org/freebsd/freebsd-head/src/4e8f50fe2f05/libexec/rtld-elf/i386/reloc.c#cl-355
Not quite.
Access to the static image is done through %fs relative addressing
which is super-fast and requires no runtime linking.
The general dynamic addressing needs one tls_index
struct in the GOT for every variable and a call to
_tls_get_addr(tls_index*).
The module index and the offset are filled by the runtime linker.
More information about the D.gnu
mailing list