[cfe-dev] __thread support in Clang

Eric Christopher echristo at apple.com
Tue Mar 1 22:19:00 PST 2011


On Mar 1, 2011, at 10:11 PM, Anatol Pomozov wrote:

> Hi,
> 
> I am trying to port a program from Linux to macosx. The program uses
> several features one of them is Thread-Local Storage. It uses __thread
> GCC attribute for this.
> 
> The program compiles fine on Linux i386 but fails on macosx
> 10.6.4/clang2.8 with following error: "error: thread-local storage is
> unsupported for the current target"
> 
> My question is: what is the status of this feature?

It depends on the OS, it isn't a clang specific feature.

> Are you going to
> implement it any time soon? If not - what is the best alternative of
> TLS on macosx/clang?

pthreads.

> 
> This issue a little bit confusing as the LLVM2.0 release note [1]
> states that "A number of ELF features are now supported by LLVM,
> including ... Thread Local Storage (TLS) with the __thread keyword"

OS X doesn't use ELF.

-eric



More information about the cfe-dev mailing list