D for Android

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Sat May 9 22:37:03 PDT 2015


On Friday, 8 May 2015 at 16:42:21 UTC, Dan Olson wrote:
> Joakim, the ldc merge-2.067 branch works well and has updated
> druntime/phobos.  I know it has some of your Android updates.  
> You may
> have more fun working with it.

OK, I'll try it.  I didn't want to run into bugs unrelated to 
cross-compiling, so I hadn't tried it yet.

> I wonder if we should keep a common LLVM fork with changes to 
> support D
> on targets without builtin TLS?  I did another LLVM hack in x86 
> backend
> to support TLS on iPhone sim, and have been thinking about 
> adding a
> fallback TLS, like emulated tls that gcc and gdc has, to 
> support TLS
> using a target plugin to get lookup address.  That way it could 
> be wired
> into any old embedded multi thread RTOS with some sort of 
> thread-local
> support.
>
> Maybe someday could even get LLVM to accept some patches.

Sounds like a worthwhile idea, though my patches to llvm are 
minimal.  I'm sure they'd seriously consider accepting such 
patches, since the gcc backend already has this built in.

I just checked last week and the recent Android NDK's gcc has 
emulated TLS enabled by default, while the same C/C++ source 
employing TLS __thread and compiled with the NDK's clang will 
segfault because it doesn't have emulated TLS.  Emulated TLS 
wasn't added to the NDK's gcc by google either: it appears to 
have just slipped in from upstream, which is perhaps why they 
seem to be unaware that it works for one compiler in the NDK and 
not the other.

Let the llvm guys know of this disparity, and I'm sure they'll be 
up for remedying it.


More information about the Digitalmars-d mailing list