Use GOT instead of GOT12 all over
[glibc.git] / sysdeps / s390 / s390-32 / setjmp.S
blobc0cf3abe17bf7275ee29c71b39b3a0246a27e472
1 /* setjmp for s390, ELF version.
2    Copyright (C) 2000-2014 Free Software Foundation, Inc.
3    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4    This file is part of the GNU C Library.
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <http://www.gnu.org/licenses/>.  */
20 #include <sysdep.h>
21 #define _ASM
22 #define _SETJMP_H
23 #include <bits/setjmp.h>
24 #include <shlib-compat.h>
26 #if !defined IS_IN_rtld
27 # if defined SHARED &&  SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
28         /* we need a unique name in case of symbol versioning.  */
29 #  define __sigsetjmp __v1__sigsetjmp
30 # endif /* if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)  */
31 #endif /* !defined IS_IN_rtld  */
33         /* We include the BSD entry points here as well but we make
34            them weak.  */
35 ENTRY (setjmp)
36         .weak C_SYMBOL_NAME (setjmp)
37         lhi    %r3,1                /* second argument of one */
38         j      .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */
39 END (setjmp)
41         /* Binary compatibility entry point.  */
42 ENTRY(_setjmp)
43         .weak  C_SYMBOL_NAME (_setjmp)
44         lhi    %r3,0                /* second argument of zero */
45         j      .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */
46 END (_setjmp)
47 libc_hidden_def (_setjmp)
49 ENTRY(__setjmp)
50         lhi    %r3,0                /* second argument of zero */
51         j      .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */
52 END (__setjmp)
54 ENTRY(__sigsetjmp)
55 .Linternal_sigsetjmp:
56 #ifdef PTR_MANGLE
57         stm    %r6,%r13,0(%r2)      /* store registers in jmp_buf */
58         lr     %r4,%r14
59         lr     %r5,%r15
60         PTR_MANGLE (%r4, %r1)
61         PTR_MANGLE2 (%r5, %r1)
62         stm    %r4,%r5,32(%r2)
63 #else
64         stm    %r6,%r15,0(%r2)      /* store registers in jmp_buf */
65 #endif
66         std    %f4,40(%r2)
67         std    %f6,48(%r2)
68 #ifdef IS_IN_rtld
69         /* In ld.so we never save the signal mask.  */
70         lhi    %r2,0
71         br     %r14
72 #elif defined PIC
73         /* We cannot use the PLT, because it requires that %r12 be set, but
74            we can't save and restore our caller's value.  Instead, we do an
75            indirect jump through the GOT. */
76         basr   %r1,0
77 .L0:    al     %r1,.L1 - .L0(0,%r1) /* get address of global offset table */
78                                     /* get address of __sigjmp_save from got */
79         l      %r1,__sigjmp_save@GOT(%r1)
80         br     %r1
81 .L1:    .long  _GLOBAL_OFFSET_TABLE_ - .L0
82 #else
83         basr   %r1,0
84 .L0:    l      %r1,.L1-.L0(0,%r1)   /* load address of __sigjmp_save */
85         br     %r1                  /* tail-call __sigjmp_save */
86 .L1:    .long  __sigjmp_save
87 #endif
88 END (__sigsetjmp)
90 #if !defined IS_IN_rtld
91 # if defined SHARED &&  SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
92 /* In glibc release 2.19 new versions of setjmp-functions were introduced,
93    but were reverted before 2.20. Thus both versions are the same function.  */
95 #  undef __sigsetjmp
97 weak_alias (setjmp, __v1setjmp);
98 weak_alias (setjmp, __v2setjmp);
99 versioned_symbol (libc, __v1setjmp, setjmp, GLIBC_2_0);
100 compat_symbol (libc, __v2setjmp, setjmp, GLIBC_2_19);
102 weak_alias (_setjmp, __v1_setjmp);
103 weak_alias (_setjmp, __v2_setjmp);
104 versioned_symbol (libc, __v1_setjmp, _setjmp, GLIBC_2_0);
105 compat_symbol (libc, __v2_setjmp, _setjmp, GLIBC_2_19);
107 strong_alias (__v1__sigsetjmp, __v2__sigsetjmp);
108 versioned_symbol (libc, __v1__sigsetjmp, __sigsetjmp, GLIBC_2_0);
109 compat_symbol (libc, __v2__sigsetjmp, __sigsetjmp, GLIBC_2_19);
110 # endif /* if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)  */
111 #endif /* if !defined IS_IN_rtld  */