TLS for Android
Joakim
joakim at airpost.net
Sat Mar 8 23:36:31 PST 2014
On Sunday, 9 March 2014 at 05:38:07 UTC, Joakim wrote:
> On Saturday, 8 March 2014 at 22:44:16 UTC, David Nadlinger
> wrote:
>> Well, yes and no. I was specifically referring to keeping the
>> normal
>> TLS infrastructure (i.e. %gs-based addressing on Linux/x86) in
>> place
>> and just replacing the part that Glibc does (but Bionic
>> doesn't) with
>> a piece of code in druntime. __tls_get_addr isn't necessarily
>> used on
>> x86.
>
> While Android/X86 TLS does use the %gs register
> (https://github.com/android/platform_bionic/blob/master/libc/private/__get_tls.h#L45),
> that's not portable and I'd like to try Android/ARM after this,
> so I'll stick with the pthread_(get|set)specific calls to wrap
> it:
>
> https://github.com/android/platform_bionic/blob/master/libc/bionic/pthread_key.cpp
You mention "replacing the part that Glibc does (but Bionic
doesn't) with a piece of code in druntime." Just to be clear,
you're referring to accessing TLS variables using an offset into
the initialization image, which is what ___tls_get_addr from
druntime does in Walter's packed TLS approach, right? If not,
I'm not sure exactly what you're referring to. With all this TLS
stuff split up between the compiler, linker, and runtime linker,
often undocumented or poorly documenented in the latter two
cases, it's been confusing to follow the TLS code path to see
what's happening.
More information about the digitalmars-d-ldc
mailing list