Solaris/x86 port - how to get the TLS section?

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Nov 26 09:33:29 PST 2014


On Tuesday, 25 November 2014 at 20:27:40 UTC, Jacob Carlborg 
wrote:
> On 2014-11-25 18:59, Kai Nacke wrote:
>
>> Does somebody else know a way to get a pointer to or the 
>> module id of
>> the TLS section? Maybe a linkmap or a /proc/<pid>/map based 
>> solution?
>> Every suggestion is welcome!
>
> How about manually iterating the sections, would that be 
> possible?

That is no problem. The trouble starts because the TLS section is 
allocated for every thread (at least if the thread touches a 
variable in this section). I need to find the start of the 
section at runtime for a thread. The module id helps her because 
__tls_get_addr() can then be used.

> I found this link that might be of help: 
> https://docs.oracle.com/cd/E26502_01/html/E26507/chapter8-1.html#scrolltoc

That's a nice summary of the Drepper paper only for Solaris. 
Unfortunately all the OS stuff is missing.

Regards,
Kai


More information about the digitalmars-d-ldc mailing list