D for Android

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Thu May 7 08:58:00 PDT 2015


On Sunday, 17 August 2014 at 18:19:29 UTC, Joakim wrote:
> I'll keep updating the wiki with more info, how to build for 
> the command-line and run the druntime/phobos unit tests, along 
> with directions for future work.

An update: I tinkered with ldc and Android/ARM for the hackathon. 
  Didn't get that working yet, but I took Dan Olson's advice to 
reuse the existing llvm TLS function calls and got ldc to work 
with Android/x86 a couple days ago.

41 of 42 druntime modules' tests pass: only core.internal convert 
doesn't, but that module's tests aren't normally run by ldc 
anyway.  Around 15 of 71 phobos modules' tests fail somewhere, 
most likely related to "long double" issues that either need to 
be backported, as git master for ldc is still using a year-old 
druntime/phobos that doesn't have some subsequent Android PRs, or 
fixed, but I haven't looked into those much yet.  Obviously, I 
can reuse some of this work for Android/ARM, so it should help.

I'm putting these in-progress patches online, in case my 
ultrabook gets run over by a bus or someone else would like to 
tinker with them.  All it required was a small patch to llvm:

https://gist.github.com/joakim-noah/1fb23fba1ba5b7e87e1a

and these patches for ldc, druntime, and phobos:

https://gist.github.com/joakim-noah/bb0b04965470332d10e4
https://gist.github.com/joakim-noah/c27a0c7f2b5b65cdc268
https://gist.github.com/joakim-noah/07ed7ab1e5732ab91126

Most of the druntime and phobos patches were backported from PRs 
already committed in their respective master branches.  The only 
real new work is in druntime's rt.sections_ldc.  It's all a bit 
hacky right now, but I'll clean it up and submit PRs eventually.

I tried the same approach that worked on x86 on ARM, with the 
similar ARM GOT relocation as can be seen in the llvm patch 
above, but it didn't work.  I'm reading up on the relevant ELF 
relocation info and looking at the ARM assembly.  If anybody 
better versed with those low-level linker details would like to 
chip in, that should be the last remaining piece to get much of 
Android/ARM working.


More information about the Digitalmars-d mailing list