TLS + LDC + Android (ARM) = FAIL

Igor Shirkalin mathsoft at inbox.ru
Wed Nov 1 18:56:00 UTC 2017


On Wednesday, 1 November 2017 at 18:30:28 UTC, Johannes Pfau 
wrote:
> Am Wed, 01 Nov 2017 18:06:29 +0000
> schrieb Joakim <dlang at joakim.fea.st>:
>
>> On Wednesday, 1 November 2017 at 17:24:32 UTC, Igor Shirkalin 
>> wrote:
>> > [...]
>> 
>> If you're having problems with the emulated TLS I put together 
>> for Android, it is most likely because I didn't document well 
>> what needs to be done when linking for Android.  Specifically, 
>> there are three rules that _must_ be followed:
>> 
>> 1. You must use the ld.bfd linker, ld.gold won't do.
>> 2. You must have a D main function, even for a shared library
>> (which can be put next to android_main, if you're using the
>> default Android wrapper from my D android library).
>> 3. The ELF object with the D main function must be passed to 
>> the
>> linker first.
>> 
>> If you look at my examples on the wiki, you'll see that they 
>> all follow these rules:
>> 
>> https://wiki.dlang.org/Build_D_for_Android
>> 
>> I should have called these rules out separately though, like 
>> I'm doing here, a documentation oversight.
>
> Also when mixing D and C code, you can't access extern TLS 
> variables across the language boundary. Maybe OP tries to do 
> that as he mixes D/C code?
>
> -- Johannes
Everything was beautiful for Win/Linux/iOS/Android.
Some day we had to use LDC (for some obvious reasons). I marked 
every function with @nogc and pure (it helped me to optimize the 
code). The problem is TLS. Android doesn't support it. At all. If 
you understand I talk about -betterC feature.

- Igor


More information about the Digitalmars-d mailing list