1 /* Copyright (C) 2003-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, see <https://www.gnu.org/licenses/>. */
17
18 #include <stdio.h>
19 #include <gnu/lib-names.h>
20 #include <unwind-link.h>
21 #include <sysdep.h>
22 #include <unwind-resume.h>
23
24 static struct unwind_link *
link(void)25 link (void)
26 {
27 struct unwind_link *unwind_link = __libc_unwind_link_get ();
28 if (unwind_link == NULL)
29 __libc_fatal (LIBGCC_S_SO " must be installed for unwinding to work\n");
30 return unwind_link;
31 }
32
33 #if !HAVE_ARCH_UNWIND_RESUME
34 void
_Unwind_Resume(struct _Unwind_Exception * exc)35 _Unwind_Resume (struct _Unwind_Exception *exc)
36 {
37 UNWIND_LINK_PTR (link (), _Unwind_Resume) (exc);
38 }
39 #endif
40
41 _Unwind_Reason_Code
42 __gcc_personality_v0 PERSONALITY_PROTO
43 {
44 return UNWIND_LINK_PTR (link (), personality) PERSONALITY_ARGS;
45 }
46
47 _Unwind_Reason_Code
_Unwind_ForcedUnwind(struct _Unwind_Exception * exc,_Unwind_Stop_Fn stop,void * stop_argument)48 _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,
49 void *stop_argument)
50 {
51 return UNWIND_LINK_PTR (link (), _Unwind_ForcedUnwind)
52 (exc, stop, stop_argument);
53 }
54
55 _Unwind_Word
_Unwind_GetCFA(struct _Unwind_Context * context)56 _Unwind_GetCFA (struct _Unwind_Context *context)
57 {
58 return UNWIND_LINK_PTR (link (), _Unwind_GetCFA) (context);
59 }
60