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:28:51 PST 2014
On Wednesday, 26 November 2014 at 02:11:10 UTC, Joakim wrote:
> On Tuesday, 25 November 2014 at 19:35:36 UTC, Joakim wrote:
>> On Tuesday, 25 November 2014 at 17:59:48 UTC, Kai Nacke wrote:
>>> Hi!
>>>
>>> GitHub master contains a close-to-working port of LDC to
>>> Solaris/x86. The only missing piece is getting a pointer to
>>> the TLS section. I tried the following:
>>>
>>> 1) Solaris uses the ELF file format. Unfortunately, it does
>>> not support the dl_phdr_info.dlpi_tls_modid field which is
>>> used on FreeBSD to get the module id of the TLS section.
>>>
>>> 2) On glibc-based systems, the function dlinfo(RTLD_SELF,
>>> RTLD_DI_TLS_MODID, &modid) can be used to get the module id.
>>> Again, this is not supported on Solaris.
>>>
>>> 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!
>>>
>>> Regards,
>>> Kai
>>
>> Take a look at Drepper's TLS reference, if you haven't already:
>>
>> http://www.akkadia.org/drepper/tls.pdf
>>
>> He talks a lot about how Solaris is different in there.
>
> Hmm, I don't see it in there. btw, isn't the TLS module id for
> the executable itself usually 1? If you don't plan on
> supporting shared libraries, maybe you can just hard-code it
> for now?
That's a good hint. I try this.
Regards,
Kai
More information about the digitalmars-d-ldc
mailing list