[cfe-dev] __thread support in Clang

Jeffrey Yasskin jyasskin at google.com
Tue Mar 1 23:24:12 PST 2011


On Tue, Mar 1, 2011 at 11:17 PM, Eric Christopher <echristo at apple.com> wrote:
>>>
>>> It depends on the OS, it isn't a clang specific feature.
>>
>> Is it spcific to OS or binary format? I have following simple program
>>
>
> It's specific to the OS (which generally has a specific binary format).
>
>> __thread int a = 0;
>> void main() {
>>    a = 2;
>> }
>>
>> that is fails to compile with gcc-4.2 and clang-2.8 but compiles fine
>> with gcc-4.5 from macports. I believe that gcc-4.5 has support of this
>> feature on macosx. The binary produced by gcc-4.5 is Mach-O file.
>> $ file ./a.out
>> ./a.out: Mach-O 64-bit executable x86_64
>>
>
> Yes, it uses an emulated tls that ends up being calls out to pthread
> and semaphore functions. I don't believe there's any plans to implement
> this sort of thing in clang - at the least I don't plan to :)

Presumably someone plans to implement C++0x's thread_local storage duration?




More information about the cfe-dev mailing list