llvm / clang and thread_local storage problems

Ken Cunningham ken.cunningham.webuse at gmail.com
Sun Oct 9 08:57:34 PDT 2016


I get it. I figured that function might be missing from my libc.

I found a replacement for that function online last night (with unknown license at present) that I thought I might be able to crib.

<https://raw.githubusercontent.com/cloudius-systems/osv/master/libc/cxa_thread_atexit.cc>

Thanks. WIll see if I can put it all together.

Thanks,

Ken



On 2016-10-09, at 12:53 AM, Jeremy Huddleston Sequoia wrote:

> thread_local support was added in OS X 10.9 (along with __cxa_thread_atexit being added to Libc as part of that support).  As long as your minimum deployment target is 10.9, you should be fine.  The issue is that you're on 10.6, so you don't have __cxa_thread_atexit.
> 
> There is active conversation right now about adding a fallback implementation of __cxa_thread_atexit directly into libcxxabi.  See https://reviews.llvm.org/D21803 as that might be quite useful for your needs.  If so, provide a patch to libcxxabi that incorporates it, and I'll get it in.
> 
> Thanks,
> Jeremy
> 
> 
>> On Oct 8, 2016, at 23:06, Ken Cunningham <ken.cunningham.webuse at gmail.com> wrote:
>> 
>> 
>> On 2016-10-08, at 10:03 PM, Stephen J. Butler wrote:
>> 
>>> FYI, it's in the Xcode 8 release notes:
>>> 
>>> https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
>>> 
>>> I did a quick test file and it seems to compile with Apple clang. No clue on compatibility issues though.
>>> 
>> 
>> Thanks!
>> 
>> 
>>> Thanks for finding and sharing that information. It sounds like you could get TLS by using MacPorts clang instead of Xcode clang, but that it will be incompatible with whatever TLS implementation Apple eventually creates.
>> 
>> 
>> I had hoped it would be in the macports-clang-3.7 build I'm using, but it seems to error out.
>> 
>> However, I noticed this bit in the the libcxxabi port 
>> 
>> libcxxabi-3.7.0.src/include/cxxabi.h
>> 
>> 
>> #ifdef __linux__
>> // Linux TLS support. Not yet an official part of the Itanium ABI.
>> // https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables
>> extern int __cxa_thread_atexit(void (*)(void *), void *, void *) throw();
>> #endif
>> 
>> and - if I open up that guard, it actually builds cleanly on MacOSX.
>> 
>> I wonder if TLS support was just disabled on all but Linux...perhaps I'll try installing this new version I just built and see what happens. --- after I back everything up :>
>> 
>> Ken
>> _______________________________________________
>> macports-dev mailing list
>> macports-dev at lists.macosforge.org
>> https://lists.macosforge.org/mailman/listinfo/macports-dev
> 



More information about the macports-dev mailing list