2014-01-01 11:03:15 +00:00
|
|
|
/* Copyright (C) 2003-2014 Free Software Foundation, Inc.
|
2003-07-22 23:56:53 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Jakub Jelinek <jakub@redhat.com>.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
|
|
|
not, see <http://www.gnu.org/licenses/>. */
|
2003-07-22 23:56:53 +00:00
|
|
|
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unwind.h>
|
2012-04-26 03:48:48 +00:00
|
|
|
#include <gnu/lib-names.h>
|
2003-07-22 23:56:53 +00:00
|
|
|
|
|
|
|
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
|
|
|
|
static _Unwind_Reason_Code (*libgcc_s_personality)
|
|
|
|
(int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
|
|
|
|
struct _Unwind_Context *);
|
|
|
|
|
|
|
|
static void
|
|
|
|
init (void)
|
|
|
|
{
|
|
|
|
void *resume, *personality;
|
|
|
|
void *handle;
|
|
|
|
|
2009-11-03 22:52:01 +00:00
|
|
|
handle = __libc_dlopen (LIBGCC_S_SO);
|
2003-07-22 23:56:53 +00:00
|
|
|
|
|
|
|
if (handle == NULL
|
|
|
|
|| (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
|
|
|
|
|| (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL)
|
2009-11-03 22:52:01 +00:00
|
|
|
__libc_fatal (LIBGCC_S_SO " must be installed for pthread_cancel to work\n");
|
2003-07-22 23:56:53 +00:00
|
|
|
|
|
|
|
libgcc_s_resume = resume;
|
|
|
|
libgcc_s_personality = personality;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_Unwind_Resume (struct _Unwind_Exception *exc)
|
|
|
|
{
|
2014-02-10 13:45:42 +00:00
|
|
|
if (__glibc_unlikely (libgcc_s_resume == NULL))
|
2003-07-22 23:56:53 +00:00
|
|
|
init ();
|
|
|
|
libgcc_s_resume (exc);
|
|
|
|
}
|
|
|
|
|
|
|
|
_Unwind_Reason_Code
|
|
|
|
__gcc_personality_v0 (int version, _Unwind_Action actions,
|
|
|
|
_Unwind_Exception_Class exception_class,
|
|
|
|
struct _Unwind_Exception *ue_header,
|
|
|
|
struct _Unwind_Context *context)
|
|
|
|
{
|
2014-02-10 13:45:42 +00:00
|
|
|
if (__glibc_unlikely (libgcc_s_personality == NULL))
|
2003-07-22 23:56:53 +00:00
|
|
|
init ();
|
|
|
|
return libgcc_s_personality (version, actions, exception_class,
|
|
|
|
ue_header, context);
|
|
|
|
}
|