What is the state of D with Android/iOS
Joakim via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 24 11:34:14 PST 2015
On Tuesday, 24 February 2015 at 17:55:59 UTC, Rishub Nagpal wrote:
> On Tuesday, 24 February 2015 at 17:15:28 UTC, Joakim wrote:
>> If you simply want to call a D library within an Android/iOS
>> app, that's possible, though there are still some rough edges.
>> Specifically, there is still some work to be done with
>> certain floating-point operations on iOS
>> (http://forum.dlang.org/post/m2mw4tab0w.fsf@comcast.net) and
>> while Android/x86 will work fine
>> (http://wiki.dlang.org/Build_DMD_for_Android), Android/ARM
>> doesn't currently support TLS. That lack of TLS support means
>> you'd have to run a slightly patched druntime and I'm fairly
>> certain phobos wouldn't work.
>
>
> Could any of these patches be used as a basis to remedy it?
>
> https://groups.google.com/forum/#!topic/0xlab-devel/aSOcm3c9PFk
> https://bugs.kde.org/show_bug.cgi?id=302709
>
> Could you in theory recompile Android to support TLS and then
> try to compile an executable for Android/ARM ?
Sorry, the way I wrote that may have been confusing: I meant that
ldc doesn't currently support any form of TLS for Android/ARM.
Native TLS is not supported on Android/bionic for any
architecture, whether x86 or ARM. I worked around this on x86 by
removing the SHF_TLS and STT_TLS flags from the ELF objects and
using pthread_setspecific/pthread_getspecific instead (more
details on the dmd PR:
https://github.com/D-Programming-Language/dmd/pull/3643), which
is basically how Walter implemented TLS on OS X/Mach-O years ago,
as OS X didn't support native TLS till 10.7 and their TLV APIs
are still undocumented.
I need to patch llvm in a similar way to that dmd PR, so that
Android/ARM can use the same scheme. It appears that Dan did
something similar with his patched llvm for iOS.
As for your linked Android patches, that might be possible but
would be pointless unless you are only deploying to a device you
patched the OS for. Better to patch llvm to support the same TLS
scheme used for Android/x86.
More information about the Digitalmars-d
mailing list