81 lines
3.0 KiB
Diff
81 lines
3.0 KiB
Diff
diff --git a/src/rt/sections_android.d b/src/rt/sections_android.d
|
|
index cd8d5535..6a7fcd11 100644
|
|
--- a/runtime/druntime/src/rt/sections_android.d
|
|
+++ b/runtime/druntime/src/rt/sections_android.d
|
|
@@ -76,7 +76,11 @@ void initSections() nothrow @nogc
|
|
_sections.moduleGroup = ModuleGroup(mbeg[0 .. mend - mbeg]);
|
|
|
|
auto pbeg = cast(void*)&_tlsend;
|
|
- auto pend = cast(void*)&__bss_end__;
|
|
+ version(X86) auto pend = cast(void*)&_end;
|
|
+ else version(X86_64) auto pend = cast(void*)& _end;
|
|
+ else version(ARM) auto pend = cast(void*)& __bss_end__;
|
|
+ else version(AArch64) auto pend = cast(void*)& __bss_end__;
|
|
+ else static assert( false, "Android architecture not supported." );
|
|
// _tlsend is a 32-bit int and may not be 64-bit void*-aligned, so align pbeg.
|
|
version(D_LP64) pbeg = cast(void*)(cast(size_t)(pbeg + 7) & ~cast(size_t)7);
|
|
_sections._gcRanges[0] = pbeg[0 .. pend - pbeg];
|
|
@@ -115,43 +119,14 @@ void scanTLSRanges(void[]* rng, scope void delegate(void* pbeg, void* pend) noth
|
|
* the corresponding address in the TLS dynamic per-thread data.
|
|
*/
|
|
|
|
-version(X86)
|
|
+extern(C) void* __tls_get_addr( void* p ) nothrow @nogc
|
|
{
|
|
- // NB: the compiler mangles this function as '___tls_get_addr'
|
|
- // even though it is extern(D)
|
|
- extern(D) void* ___tls_get_addr( void* p ) nothrow @nogc
|
|
- {
|
|
- debug(PRINTF) printf(" ___tls_get_addr input - %p\n", p);
|
|
- immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
|
|
- auto tls = getTLSBlockAlloc();
|
|
- assert(offset < tls.length);
|
|
- return tls.ptr + offset;
|
|
- }
|
|
-}
|
|
-else version(ARM)
|
|
-{
|
|
- extern(C) void* __tls_get_addr( void** p ) nothrow @nogc
|
|
- {
|
|
- debug(PRINTF) printf(" __tls_get_addr input - %p\n", *p);
|
|
- immutable offset = cast(size_t)(*p - cast(void*)&_tlsstart);
|
|
- auto tls = getTLSBlockAlloc();
|
|
- assert(offset < tls.length);
|
|
- return tls.ptr + offset;
|
|
- }
|
|
-}
|
|
-else version(AArch64)
|
|
-{
|
|
- extern(C) void* __tls_get_addr( void* p ) nothrow @nogc
|
|
- {
|
|
- debug(PRINTF) printf(" __tls_get_addr input - %p\n", p);
|
|
- immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
|
|
- auto tls = getTLSBlockAlloc();
|
|
- assert(offset < tls.length);
|
|
- return tls.ptr + offset;
|
|
- }
|
|
+ debug(PRINTF) printf(" __tls_get_addr input - %p\n", p);
|
|
+ immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
|
|
+ auto tls = getTLSBlockAlloc();
|
|
+ assert(offset < tls.length);
|
|
+ return tls.ptr + offset;
|
|
}
|
|
-else
|
|
- static assert( false, "Android architecture not supported." );
|
|
|
|
private:
|
|
|
|
@@ -209,7 +184,11 @@ extern(C)
|
|
void* __stop_minfo;
|
|
}
|
|
|
|
- size_t __bss_end__;
|
|
+ version(X86) size_t _end;
|
|
+ else version(X86_64) size_t _end;
|
|
+ else version(ARM) size_t __bss_end__;
|
|
+ else version(AArch64) size_t __bss_end__;
|
|
+ else static assert( false, "Android architecture not supported." );
|
|
|
|
int _tlsstart;
|
|
int _tlsend;
|