Supporting emulated tls

Jacob Carlborg doob at me.com
Mon Mar 19 02:54:53 PDT 2012


On 2012-03-19 09:17, Johannes Pfau wrote:
> Am Sun, 18 Mar 2012 22:06:41 +0100
> schrieb Jacob Carlborg<doob at me.com>:

> Yes, but OSX still uses emulated tls. With the way dmd emulates TLS
> it's possible to remove __tls_beg and __tls_end, but for native TLS
> those symbols are still needed. However, as the runtime linker (ld.so)
> has got the necessary information, it's possible that OSX even offers a
> API to access it. It's just that most C libraries don't provide a way to
> get the TLS segment sizes and the (per thread) addresses of the TLS
> blocks.

The dyld library on Mac OS X provides access to segments and sections. 
But since the dynamic loader needs can get this information it should be 
possible for other applications to get this information as well?

Just walk through the object file and find the necessary segments?

>> Mac OS X 10.7 + supports TLS natively. But I don't know where to find
>> documentation about it. It always possible to look at the source code.
>>
>
> Then it's probably already supported by GCC/GDC. But having working
> emulated TLS would be nice for many other architectures. Native TLS is
> not that widespread.

Yeah, don't know about GCC though, Apple cares less and less about GCC 
and putting all their effort in to LLVM and Clang. Ok, I didn't know how 
widespread TLS was.

-- 
/Jacob Carlborg


More information about the D.gnu mailing list