1 /* Copyright (C) 2014-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
6    License as published by the Free Software Foundation; either
7    version 2.1 of the 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; if not, see
16    <https://www.gnu.org/licenses/>.
17 
18    Versioned copy of debug/longjmp_chk.c modified for versioning
19    the reverted jmpbuf extension.  */
20 
21 #include <shlib-compat.h>
22 
23 #if IS_IN (libc) && defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
24 /* this is a copy from debug/longjmp_chk.c because we need an unique name
25    for __longjmp_chk, but it is already named via a define
26    for __libc_siglongjmp in debug/longjmp_chk.c.  */
27 # include <setjmp.h>
28 
29 // XXX Should move to include/setjmp.h
30 extern void ____longjmp_chk (__jmp_buf __env, int __val)
31      __attribute__ ((__noreturn__));
32 
33 # define __longjmp ____longjmp_chk
34 # define __libc_siglongjmp __v1__longjmp_chk
35 
36 # include <setjmp/longjmp.c>
37 
38 /* In glibc release 2.19 a new versions of __longjmp_chk was introduced,
39    but was reverted before 2.20. Thus both versions are the same function.  */
40 strong_alias (__v1__longjmp_chk, __v2__longjmp_chk);
41 versioned_symbol (libc, __v1__longjmp_chk, __longjmp_chk, GLIBC_2_11);
42 compat_symbol (libc, __v2__longjmp_chk, __longjmp_chk, GLIBC_2_19);
43 
44 #else
45 
46 # include <debug/longjmp_chk.c>
47 
48 #endif
49