Ehem, ARM

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 23 04:39:20 PDT 2014


On Friday, 21 March 2014 at 19:59:41 UTC, Joakim wrote:
> Been awhile since I updated on the Android effort: I'm now able 
> to get all 38 druntime modules' unit tests to pass on 
> Android/x86... under somewhat random conditions.  It's finicky 
> and some of the tests start failing and many segfaulting on 
> exit, as mentioned before, if I make minor changes to the unit 
> tests, like changing some TLS globals to shared.  I'm guessing 
> this is because I don't really have TLS working yet, I'm just 
> taking advantage of the fact that the baked-in TLS in linux 
> kinda sorta still works on Android.
>
> As long as it's local-exec, uninitialized TLS mostly works if 
> it's less than 4-5 KB, while initialized TLS doesn't get 
> initialized correctly.  Of course, it's possible that I'm 
> hitting some other codegen incompatibility altogether, 
> unrelated to TLS, but the fact that it sometimes works 
> depending on the number of TLS variables makes me think it's a 
> TLS issue.  I also got a bit more than half of the Phobos unit 
> tests to pass, with a lot of seg faults there too.
>
> Android is going to need a packed TLS approach, similar to what 
> Walter implemented for OS X with dmd:
>
> http://www.drdobbs.com/architecture-and-design/implementing-thread-local-storage-on-os/228701185
>
> I've been looking into doing something similar for ELF, but 
> this is the first time hacking on a compiler for me.  If 
> someone else more familiar with dmd or ldc could put packed TLS 
> for ELF together more quickly, that would certainly speed 
> things up.  If not, I'll have something together eventually. ;)

Alright, finally hacked dmd to produce something like packed TLS 
for ELF.  I just ran the druntime unit tests on Android/x86 and 
all 38 modules passed, :) even after changing the number of TLS 
variables a couple times, which was causing segfaults with the 
native TLS before.  I'll try running the phobos unit tests next, 
then building a sample Android/x86 D app/apk, ie the kind you can 
actually install on Android.


More information about the Digitalmars-d mailing list