TLS for Android

Jacob Carlborg doob at me.com
Sat Mar 8 02:06:56 PST 2014


On 2014-03-08 01:55, Joakim wrote:
> So I've been looking into implementing TLS for Android/x86, rummaging
> through old TLS git commits for dmd and ldc to see what to do.  It
> appears that Walter implemented TLS on OS X more than four years ago by
> packing thread-local variables into special segments and then unpacking
> them in druntime, which uses pthread_(get|set)specific on OS X nowadays:
>
> http://www.drdobbs.com/architecture-and-design/implementing-thread-local-storage-on-os/228701185
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/rt/sections_osx.d#L106
>
>
> Since Android also provides these pthread functions for TLS, seems like
> a similar approach is called for.
>
> I notice that ldc never used this approach, depending on llvm's built-in
> TLS support instead:
>
> https://github.com/ldc-developers/ldc/commit/4d7a6eda234bc8d12703cc577c09c2ca50ac6bda#diff-19

Yes. DMD started to implemented support for TLS on OS X before 10.7 
which is the first version of OS X to natively support TLS. LDC doesn't 
support older versions of OS X than 10.7 since it uses native TLS.

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list