may depend on unwinding. */
__libc_lock_define (static, lock);
+#ifndef HAVE_CC_WITH_LIBUNWIND
+# define UNWIND_SONAME LIBGCC_S_SO
+#else
+# define UNWIND_SONAME LIBUNWIND_SO
+#endif
+
struct unwind_link *
__libc_unwind_link_get (void)
{
/* Initialize a copy of the data, so that we do not need about
unlocking in case the dynamic loader somehow triggers
unwinding. */
- void *local_libgcc_handle = __libc_dlopen (LIBGCC_S_SO);
+ void *local_libgcc_handle = __libc_dlopen (UNWIND_SONAME);
if (local_libgcc_handle == NULL)
{
__libc_lock_unlock (lock);
local.ptr___frame_state_for
= __libc_dlsym (local_libgcc_handle, "__frame_state_for");
#endif
+#ifndef HAVE_CC_WITH_LIBUNWIND
local.ptr_personality
= __libc_dlsym (local_libgcc_handle, "__gcc_personality_v0");
+#else
+ local.ptr__Unwind_GetLanguageSpecificData
+ = __libc_dlsym (local_libgcc_handle, "_Unwind_GetLanguageSpecificData");
+ local.ptr__Unwind_SetGR
+ = __libc_dlsym (local_libgcc_handle, "_Unwind_SetGR");
+ local.ptr__Unwind_SetIP
+ = __libc_dlsym (local_libgcc_handle, "_Unwind_SetIP");
+ local.ptr__Unwind_GetRegionStart
+ = __libc_dlsym (local_libgcc_handle, "_Unwind_GetRegionStart");
+#endif
UNWIND_LINK_EXTRA_INIT
/* If a symbol is missing, libgcc_s has somehow been corrupted. */
assert (local.ptr__Unwind_GetIP != NULL);
#endif
assert (local.ptr__Unwind_Resume != NULL);
+#ifndef HAVE_CC_WITH_LIBUNWIND
assert (local.ptr_personality != NULL);
+#else
+ assert (local.ptr__Unwind_GetLanguageSpecificData != NULL);
+ assert (local.ptr__Unwind_SetGR != NULL);
+ assert (local.ptr__Unwind_GetIP != NULL);
+ assert (local.ptr__Unwind_SetIP != NULL);
+ assert (local.ptr__Unwind_GetRegionStart != NULL);
+#endif
PTR_MANGLE (local.ptr__Unwind_Backtrace);
PTR_MANGLE (local.ptr__Unwind_ForcedUnwind);
#if UNWIND_LINK_FRAME_STATE_FOR
PTR_MANGLE (local.ptr___frame_state_for);
#endif
+#ifndef HAVE_CC_WITH_LIBUNWIND
PTR_MANGLE (local.ptr_personality);
+#else
+ PTR_MANGLE (local.ptr__Unwind_GetLanguageSpecificData);
+ PTR_MANGLE (local.ptr__Unwind_SetGR);
+ PTR_MANGLE (local.ptr__Unwind_SetIP);
+ PTR_MANGLE (local.ptr__Unwind_GetRegionStart);
+#endif
__libc_lock_lock (lock);
if (atomic_load_relaxed (&global_libgcc_handle) != NULL)
# include <pointer_guard.h>
# include <unwind-resume.h>
+# ifndef HAVE_CC_WITH_LIBUNWIND
+# define UNWIND_SONAME LIBGCC_S_SO
+# else
+# define UNWIND_SONAME LIBUNWIND_SO
+# endif
+
# if UNWIND_LINK_FRAME_STATE_FOR
struct frame_state;
# endif
#if UNWIND_LINK_FRAME_STATE_FOR
struct frame_state *(*ptr___frame_state_for) (void *, struct frame_state *);
#endif
+#ifndef HAVE_CC_WITH_LIBUNWIND
_Unwind_Reason_Code (*ptr_personality) PERSONALITY_PROTO;
+#else
+ __typeof (_Unwind_GetLanguageSpecificData) *ptr__Unwind_GetLanguageSpecificData;
+ __typeof (_Unwind_SetGR) *ptr__Unwind_SetGR;
+ __typeof (_Unwind_SetIP) *ptr__Unwind_SetIP;
+ __typeof (_Unwind_GetRegionStart) *ptr__Unwind_GetRegionStart;
+#endif
UNWIND_LINK_EXTRA_FIELDS
};
}
#endif
+#ifndef HAVE_CC_WITH_LIBUNWIND
_Unwind_Reason_Code
__gcc_personality_v0 PERSONALITY_PROTO
{
return UNWIND_LINK_PTR (link (), personality) PERSONALITY_ARGS;
}
+#else
+void *
+_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
+{
+ return UNWIND_LINK_PTR (link (), _Unwind_GetLanguageSpecificData) (context);
+}
+
+void
+_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
+{
+ UNWIND_LINK_PTR (link (), _Unwind_SetGR) (context, index, val);
+}
+
+_Unwind_Ptr
+_Unwind_GetIP (struct _Unwind_Context *context)
+{
+ return UNWIND_LINK_PTR (link (), _Unwind_GetIP) (context);
+}
+
+void
+_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
+{
+ UNWIND_LINK_PTR (link (), _Unwind_SetIP) (context, val);
+}
+
+_Unwind_Ptr
+_Unwind_GetRegionStart (struct _Unwind_Context *context)
+{
+ return UNWIND_LINK_PTR (link (), _Unwind_GetRegionStart) (context);
+}
+#endif
_Unwind_Reason_Code
_Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,