|
Packit Service |
82fcde |
/* Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
Contributed by Jakub Jelinek <jakub@redhat.com>.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public License as
|
|
Packit Service |
82fcde |
published by the Free Software Foundation; either version 2.1 of the
|
|
Packit Service |
82fcde |
License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; see the file COPYING.LIB. If
|
|
Packit Service |
82fcde |
not, see <http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <dlfcn.h>
|
|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
#include <unwind.h>
|
|
Packit Service |
82fcde |
#include <gnu/lib-names.h>
|
|
Packit Service |
82fcde |
#include <sysdep.h>
|
|
Packit Service |
82fcde |
#include <unwind-resume.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
void (*__libgcc_s_resume) (struct _Unwind_Exception *exc)
|
|
Packit Service |
82fcde |
attribute_hidden __attribute__ ((noreturn));
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static _Unwind_Reason_Code (*libgcc_s_personality) PERSONALITY_PROTO;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
void attribute_hidden __attribute__ ((cold))
|
|
Packit Service |
82fcde |
__libgcc_s_init (void)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
void *resume, *personality;
|
|
Packit Service |
82fcde |
void *handle;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* See include/dlfcn.h. Use of __libc_dlopen requires RTLD_NOW. */
|
|
Packit Service |
82fcde |
handle = __libc_dlopen (LIBGCC_S_SO);
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
if (handle == NULL
|
|
Packit Service |
82fcde |
|| (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
|
|
Packit Service |
82fcde |
|| (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL)
|
|
Packit Service |
82fcde |
__libc_fatal (LIBGCC_S_SO
|
|
Packit Service |
82fcde |
" must be installed for unwinding to work\n");
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifdef PTR_MANGLE
|
|
Packit Service |
82fcde |
PTR_MANGLE (resume);
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
__libgcc_s_resume = resume;
|
|
Packit Service |
82fcde |
#ifdef PTR_MANGLE
|
|
Packit Service |
82fcde |
PTR_MANGLE (personality);
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
libgcc_s_personality = personality;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#if !HAVE_ARCH_UNWIND_RESUME
|
|
Packit Service |
82fcde |
void
|
|
Packit Service |
82fcde |
_Unwind_Resume (struct _Unwind_Exception *exc)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
if (__glibc_unlikely (__libgcc_s_resume == NULL))
|
|
Packit Service |
82fcde |
__libgcc_s_init ();
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
__typeof (__libgcc_s_resume) resume = __libgcc_s_resume;
|
|
Packit Service |
82fcde |
#ifdef PTR_DEMANGLE
|
|
Packit Service |
82fcde |
PTR_DEMANGLE (resume);
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
(*resume) (exc);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
_Unwind_Reason_Code
|
|
Packit Service |
82fcde |
__gcc_personality_v0 PERSONALITY_PROTO
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
if (__glibc_unlikely (libgcc_s_personality == NULL))
|
|
Packit Service |
82fcde |
__libgcc_s_init ();
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
__typeof (libgcc_s_personality) personality = libgcc_s_personality;
|
|
Packit Service |
82fcde |
#ifdef PTR_DEMANGLE
|
|
Packit Service |
82fcde |
PTR_DEMANGLE (personality);
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
return (*personality) PERSONALITY_ARGS;
|
|
Packit Service |
82fcde |
}
|