--emulated-tls explanation?
IGotD-
nise at nise.com
Tue Oct 13 11:38:33 UTC 2020
On Tuesday, 13 October 2020 at 11:27:45 UTC, Denis Feklushkin
wrote:
> On Tuesday, 13 October 2020 at 11:23:23 UTC, IGotD- wrote:
>> On Tuesday, 13 October 2020 at 11:13:16 UTC, Denis Feklushkin
>> wrote:
>>>
>>> But it is still not clear why static variables are now not
>>> "superimposed" on one another at the same addresses.
>>>
>>
>> If you don't have emulated TLS, your build shouldn't even
>> succeed if you haven't implemented __tls_get_address. So if
>> you have a build that you can test, where does this
>> __tls_get_address come from?
>
> It is provided by "picolibc" library.
>
> Actually it provides __aeabi_read_tp but I wrap it:
> https://github.com/denizzzka/d_c_arm_test/blob/master/d/freertos_druntime_backend/external/rt/sections.d#L45
The function prototype of __tls_get_address is wrong. It should be
struct tls_index
{
size_t ti_module;
size_t ti_offset;
};
void* __tls_get_addr(tls_index* ti)
You perhaps don't use modules but you certainly need an offset.
It should rather be something like
void* __tls_get_addr(tls_index* ti)
{
return getThreadTlsArea(ti->ti_module) + ti->ti_offset;
}
More information about the digitalmars-d-ldc
mailing list