对代码库的快速 greplibstd++
揭示了以下两种用法__gx_personality_v0
:
在 libsupc++/unwind-cxx.h
// GNU C++ personality routine, Version 0.
extern "C" _Unwind_Reason_Code __gxx_personality_v0
(int, _Unwind_Action, _Unwind_Exception_Class,
struct _Unwind_Exception *, struct _Unwind_Context *);
在 libsupc++/eh_personality.cc
#define PERSONALITY_FUNCTION __gxx_personality_v0
extern "C" _Unwind_Reason_Code
PERSONALITY_FUNCTION (int version,
_Unwind_Action actions,
_Unwind_Exception_Class exception_class,
struct _Unwind_Exception *ue_header,
struct _Unwind_Context *context)
{
// ... code to handle exceptions and stuff ...
}
(注意:实际上比这要复杂一些;有一些条件编译可以改变一些细节)。
因此,只要您的代码实际上没有使用异常处理,将符号定义为void*
不会影响任何东西,但是一旦这样做,您就会崩溃 -__gxx_personality_v0
是一个函数,而不是某个全局对象,所以尝试调用该函数将跳转到地址 0 并导致段错误。