TLS for Android (and iOS)

Joakim joakim at
Thu Mar 27 11:10:26 PDT 2014

On Thursday, 27 March 2014 at 16:01:31 UTC, Dan Olson wrote:
> Any TLS progress out there in LDC-land?

I've been familiarizing myself with the relevant dmd backend 
source, but haven't tried anything yet.

> To pass thread/fiber unittests on iOS, I put in temporary 
> workaround
> using pthread_get/setspecific directly for the two threadlocals
> (Thread.sm_this and Fiber.sm_this).  Now I can pass 74 of 85
> druntime/phobos unittests on iOS.

I thought about doing the same, but didn't bother since I was 
able to get all of druntime's unit tests to pass by using 
Android's limited and flaky TLS support, left over from the linux 

> If nobody is working on the emulated TLS for LDC, I will give 
> it a try.
> Nothing to lose.

Whatever I do to implement packed TLS in the dmd backend is not 
going to work for ldc anyway, so nothing stopping you from making 
your own effort.  You will have to patch llvm also, if the weak 
symbols bug David pointed out is still around in llvm 3.5.  Let 
us know what approach you take.

More information about the digitalmars-d-ldc mailing list