I observe that r220932 (Removing the static initializer in ManagedStatic.cpp by using llvm_call_once to initialize the ManagedStatic mutex.) is causing tablegen to segfault in PPC platforms during static initialization. The crash happens while calling std::call_once introduced by this patch in the wrapper used in getManagedStaticMutex.
I understand this call is buggy for some platforms (or probably some oldish libstdc++ versions). Is this a known issue? Should we guard LLVM_DEFINE_ONCE_FLAG definition with platform specific macros to avoid the crash, at least for the moment?
The MSVC STL has a similar problem, and call_once isn’t available in mingw64-win32. We have some hand-rolled double checked locking that you can probably use to workaround it.
That said, in the long term I would like to be able to rely on standard C++11 constructs.
Ok, I'll put a patch together to fix this later today. I'll probably
do what Reid was suggesting and use what is already in there for
Windows.
Hm, better hold off on that. Ulrich Weigand has noted that there is
invalid code generation occurring around a TLS call. Looks like is is
probably a PPC back end problem at the moment.