1 /* setjmp for s390, ELF version.
2 Copyright (C) 2000-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
20 #include <pointer_guard.h>
23 #include <bits/setjmp.h>
24 #include <shlib-compat.h>
25 #include <stap-probe.h>
27 #if !IS_IN (rtld) && defined SHARED \
28 && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
29 # define NEED_COMPAT_SYMBOLS 1
30 /* We need a unique name in case of symbol versioning. */
31 # define setjmp __v1setjmp
32 # define _setjmp __v1_setjmp
33 # define __sigsetjmp __v1__sigsetjmp
35 # define NEED_COMPAT_SYMBOLS 0
38 /* We include the BSD entry points here as well. */
40 lhi %r3,1 /* second argument of one */
41 j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */
44 /* Binary compatibility entry point. */
46 lhi %r3,0 /* second argument of zero */
47 j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */
49 #if NEED_COMPAT_SYMBOLS
50 strong_alias (_setjmp, __GI__setjmp)
52 libc_hidden_def (_setjmp)
56 lhi %r3,0 /* second argument of zero */
57 j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */
62 /* setjmp probe expects sig/setjmp first argument (4@%r2), second
63 argument (-4@%r3) and target address (4@%r14). */
64 LIBC_PROBE (setjmp, 3, 4@%r2, -4@%r3, 4@%r14)
66 stm %r6,%r13,0(%r2) /* store registers in jmp_buf */
70 PTR_MANGLE2 (%r5, %r1)
73 stm %r6,%r15,0(%r2) /* store registers in jmp_buf */
78 /* In ld.so we never save the signal mask. */
82 /* We cannot use the PLT, because it requires that %r12 be set, but
83 we can't save and restore our caller's value. Instead, we do an
84 indirect jump through the GOT. */
86 .L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */
87 /* get address of __sigjmp_save from got */
88 l %r1,__sigjmp_save@GOT(%r1)
90 .L1: .long _GLOBAL_OFFSET_TABLE_ - .L0
93 .L0: l %r1,.L1-.L0(0,%r1) /* load address of __sigjmp_save */
94 br %r1 /* tail-call __sigjmp_save */
95 .L1: .long __sigjmp_save
98 #if NEED_COMPAT_SYMBOLS
99 strong_alias (__sigsetjmp, __GI___sigsetjmp)
101 libc_hidden_def (__sigsetjmp)
104 #if NEED_COMPAT_SYMBOLS
105 /* In glibc release 2.19 new versions of setjmp-functions were introduced,
106 but were reverted before 2.20. Thus both versions are the same function. */
112 strong_alias (__v1setjmp, __v2setjmp);
113 versioned_symbol (libc, __v1setjmp, setjmp, GLIBC_2_0);
114 compat_symbol (libc, __v2setjmp, setjmp, GLIBC_2_19);
116 strong_alias (__v1_setjmp, __v2_setjmp);
117 versioned_symbol (libc, __v1_setjmp, _setjmp, GLIBC_2_0);
118 compat_symbol (libc, __v2_setjmp, _setjmp, GLIBC_2_19);
120 strong_alias (__v1__sigsetjmp, __v2__sigsetjmp);
121 versioned_symbol (libc, __v1__sigsetjmp, __sigsetjmp, GLIBC_2_0);
122 compat_symbol (libc, __v2__sigsetjmp, __sigsetjmp, GLIBC_2_19);
123 #endif /* NEED_COMPAT_SYMBOLS */