[LLVMdev] Thread local data and atomic instructions

Jon Harrop jon at ffconsultancy.com
Sat Nov 21 11:23:38 PST 2009


On Saturday 21 November 2009 18:05:08 Anton Korobeynikov wrote:
> Hello
>
> > I need a shadow stack per thread and I'm not sure how to do that. Passing
> > it everywhere seems like a bad idea. I could put it in a global thread id
> > -> thread-local data mapping but that would incur lookup and locking
> > every time I fiddle with it (which is often!). Is it possible for me to
> > create a global using LLVM and mark it as thread local and use that
> > instead?
>
> In theory - yes, but it will work only on x86/linux. No thread local
> stuff on darwin at all, for example.

Ugh. What if I make thread local data in the C code of my run-time (compiled 
with GCC) with C functions to get and set it?

How does llvm-gcc handle thread local data on Darwin then?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list