--emulated-tls explanation?

Denis Feklushkin feklushkin.denis at gmail.com
Tue Oct 13 12:00:34 UTC 2020


On Tuesday, 13 October 2020 at 11:38:33 UTC, IGotD- wrote:

>> 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 is implemented inside of LLVM?
Can you provide link to right declaration?

Google full of "__tls_get_addr()" form

> 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;
> }

Yep, sounds like the correct explanation of my issue! Thanks!


More information about the digitalmars-d-ldc mailing list