<div dir="ltr">Hello,<div><br></div><div>I believe iv'e identified an issue with libcxxabi.</div><div>The symptom is that, when calling std::treminate() on some simple program, the program segfaults.</div><div><br></div><div>After a bit of debugging libcxxabi, Iv'e noticed that `__cxa_terminate_handler` is NULL at program initialization. However, calling std::set_terminate(nullptr); sets the actual default terminate handler (in my case is just std::abort). </div><div><br></div><div>I tend to believe this is related to an static initialization order issue, in which `__cxa_terminate_handler`  doesn't not get this correct value of std::abort (set by <span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">default_terminate_handler). </span></div><div><a href="https://github.com/llvm/llvm-project/blob/master/libcxxabi/src/cxa_default_handlers.cpp#L96">https://github.com/llvm/llvm-project/blob/master/libcxxabi/src/cxa_default_handlers.cpp#L96</a></div><div><br></div><div>One solution for iv'e found is wrapping the <span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">default_terminate_handler with a function and set this function as </span>__cxa_terminate_handler first.</div><div><br></div><div>I would be happy to hear your insights about this.<br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-family:arial;font-size:small">Idan Freiberg</span></div><span style="font-family:arial;font-size:small">Mobile: +972-52-2925213</span><br></div></div></div></div>