[libcxx-dev] Static initialization order potential issue in libcxxabi
Idan Freiberg via libcxx-dev
libcxx-dev at lists.llvm.org
Sun Dec 8 03:52:00 PST 2019
I believe iv'e identified an issue with libcxxabi.
The symptom is that, when calling std::treminate() on some simple program,
the program segfaults.
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).
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 default_terminate_handler).
One solution for iv'e found is wrapping the default_terminate_handler with
a function and set this function as __cxa_terminate_handler first.
I would be happy to hear your insights about this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libcxx-dev