]> git.ipfire.org Git - thirdparty/gcc.git/blame - libphobos/libdruntime/config/systemz/get_tls_offset.S
Update copyright years.
[thirdparty/gcc.git] / libphobos / libdruntime / config / systemz / get_tls_offset.S
CommitLineData
88e508f9 1/* IBM Z support code for TLS offsets.
a945c346 2 Copyright (C) 2020-2024 Free Software Foundation, Inc.
88e508f9
RD
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16Under Section 7 of GPL version 3, you are granted additional
17permissions described in the GCC Runtime Library Exception, version
183.1, as published by the Free Software Foundation.
19
20You should have received a copy of the GNU General Public License and
21a copy of the GCC Runtime Library Exception along with this program;
22see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23<http://www.gnu.org/licenses/>. */
24
25/* __tls_get_offset expects the GOT pointer in %r12 and adds
26 it to its argument in %r2. In order to get the offset of
27 ti, we load it into %r2, subtract the current %r12 from %r2
28 so the addition will result in a nop (%r2 - %r12 + %r12).
29
30 Note: This file is shared between systemz and s390 as the
31 same file is used in multilib case for s390x and s390. */
32
33#include "../common/threadasm.S"
34
35 .text
36 .globl CSYM(__ibmz_get_tls_offset)
37 .type CSYM(__ibmz_get_tls_offset), @function
38 .align 8
39CSYM(__ibmz_get_tls_offset):
40 .cfi_startproc
41
42#ifdef __s390x__
43 .machinemode zarch
44 stmg %r14,%r15,112(%r15)
45 .cfi_offset 14, -48
46 .cfi_offset 15, -40
47 aghi %r15,-160
48 .cfi_def_cfa_offset 320
49 sgr %r2,%r12
50 brasl %r14,__tls_get_offset@PLT
51 lg %r4,272(%r15)
52 lmg %r14,%r15,272(%r15)
53 .cfi_restore 15
54 .cfi_restore 14
55 .cfi_def_cfa_offset 160
56 br %r4
57#else
58 .machinemode esa
59 stm %r12,%r15,48(%r15)
60 .cfi_offset 12, -48
61 .cfi_offset 13, -44
62 .cfi_offset 14, -40
63 .cfi_offset 15, -36
64 ahi %r15,-96
65 .cfi_def_cfa_offset 192
66 larl %r12,_GLOBAL_OFFSET_TABLE_
67 sr %r2,%r12
68 brasl %r14,__tls_get_offset@PLT
69 l %r4,152(%r15)
70 lm %r12,%r15,144(%r15)
71 .cfi_restore 15
72 .cfi_restore 14
73 .cfi_restore 13
74 .cfi_restore 12
75 .cfi_def_cfa_offset 96
76 br %r4
77#endif
78 .cfi_endproc
79 .size __ibmz_get_tls_offset, .-__ibmz_get_tls_offset