[llvm-dev] using emulated-tls on Darwin 8, 9, 10

Ken Cunningham via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 10 08:29:33 PST 2018

On 2018-12-10, at 2:43 AM, Jacob Carlborg via llvm-dev wrote:

> On 2018-12-10 07:52, Ken Cunningham via llvm-dev wrote:
>> All that being sorted out, we now have libc++ 7.0.0 and libc++abi  built and being used with emulated-tls support  on darwin < 11 now. Thanks!
> Cool. BTW, what about TLS in C, i.e. "__thread"?

Yes, the various tests I've tried with this pass. I am a hobbyist, not a professional programmer, so it's possible I'm missing some aspect of the TLS coverage or the implementation. The darwin code in llvm generally assumes tlv_atexit for TLS, and I might be overlooking some detail that I haven't as yet discovered.

I wonder if there is any appetite to have darwin support the -femulated-tls flag in general, for testing the subsystems, etc. Right now if you use the flag, you still get tlv_atexit in the end.

I should be able to find a way to test if femulated-tls is set while in the scope of CodeGen/ItaniumCXXABI.cpp and branch on the flag to cxa_thread_atexit -- and if I sort that out, a general implementation would appear workable.


More information about the llvm-dev mailing list