Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 16cf449

Browse files
committed
Bionic: switched to using a single cross-platform __tls_get_addr with LLVM 7.
1 parent 7d8ee85 commit 16cf449

File tree

1 file changed

+6
-35
lines changed

1 file changed

+6
-35
lines changed

src/rt/sections_android.d

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -107,43 +107,14 @@ void scanTLSRanges(void[]* rng, scope void delegate(void* pbeg, void* pend) noth
107107
* the corresponding address in the TLS dynamic per-thread data.
108108
*/
109109

110-
version (X86)
110+
extern(C) void* __tls_get_addr( void* p ) nothrow @nogc
111111
{
112-
// NB: the compiler mangles this function as '___tls_get_addr'
113-
// even though it is extern(D)
114-
extern(D) void* ___tls_get_addr( void* p ) nothrow @nogc
115-
{
116-
debug(PRINTF) printf(" ___tls_get_addr input - %p\n", p);
117-
immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
118-
auto tls = getTLSBlockAlloc();
119-
assert(offset < tls.length);
120-
return tls.ptr + offset;
121-
}
122-
}
123-
else version (ARM)
124-
{
125-
extern(C) void* __tls_get_addr( void** p ) nothrow @nogc
126-
{
127-
debug(PRINTF) printf(" __tls_get_addr input - %p\n", *p);
128-
immutable offset = cast(size_t)(*p - cast(void*)&_tlsstart);
129-
auto tls = getTLSBlockAlloc();
130-
assert(offset < tls.length);
131-
return tls.ptr + offset;
132-
}
133-
}
134-
else version (AArch64)
135-
{
136-
extern(C) void* __tls_get_addr( void* p ) nothrow @nogc
137-
{
138-
debug(PRINTF) printf(" __tls_get_addr input - %p\n", p);
139-
immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
140-
auto tls = getTLSBlockAlloc();
141-
assert(offset < tls.length);
142-
return tls.ptr + offset;
143-
}
112+
debug(PRINTF) printf(" __tls_get_addr input - %p\n", p);
113+
immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
114+
auto tls = getTLSBlockAlloc();
115+
assert(offset < tls.length);
116+
return tls.ptr + offset;
144117
}
145-
else
146-
static assert( false, "Android architecture not supported." );
147118

148119
private:
149120

0 commit comments

Comments
 (0)