On Monday, 25 November 2013 at 10:38:24 UTC, Joakim wrote:
On Friday, 22 November 2013 at 18:01:44 UTC, Joakim wrote:
I spent some time setting up the appropriate VMs and looking
at the relevant Android dev tools myself. It appears that the
Android NDK uses a lightly patched version of stock llvm/clang
3.3, along with the gold linker. Their patches are available
online:
https://android.googlesource.com/toolchain/llvm/+log/release_33
https://android.googlesource.com/toolchain/clang/+log/release_33
Their llvm is the same as llvm 3.3 until commit ce33750 and
clang is the same until commit 20c7d45. The stock llvm/clang
3.3 have some limited support for Android, not much. I'm
going to start going through those patches next.
Since there are only about 50-100 llvm/clang patches, many of
them architecture-specific and so not necessary, this suggests
that the Android ABI is not that different from linux.
Alright, went through all the Android llvm/clang patches and
there's little of significance. They hardcode two clang
options for android/x86, -mstackrealign and -msse3, add a few
tweaks for ARM, and that's about it. Most of the patches are
for some other NDK work by MediaTek, which don't appear to be
used by the official Android NDK.
I was able to compile an identical stripped shared library from
the samples just by using the stock clang 3.3 that's installed
in Arch linux, once I added the two hardcoded flags in with the
rest of the flags their makefiles generate, so you really don't
even need to use their compiler, at least for Android/x86.
Next step, get dmd to do the same with a "hello world" native
Android app. I'll update this thread as I go, for anyone who's
interested.
Thanks, I'm interested.