TLS + LDC + Android (ARM) = FAIL

Johannes Pfau nospam at example.com
Wed Nov 1 18:30:28 UTC 2017


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:
> > We solved the subject with modifying druntime source related 
> > with tls. Imaging, we have lost a lot of D's features.
> > As far as I know DMD or GDC are not available for ARM 
> > architecture. So we need LDC.
> > A short story: we have big C/C++ project that links D (LDC) 
> > code for different platforms.
> >
> > Does new "-betterC" mean we may use parallelism with using 
> > separate linker?
> >
> > - IS  
> 
> 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



More information about the Digitalmars-d mailing list