]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/ia64/crtend.S
Update copyright years.
[thirdparty/gcc.git] / libgcc / config / ia64 / crtend.S
CommitLineData
85ec4feb 1/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
c65ebc55
JW
2 Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
3
92b4f0af 4 This file is part of GCC.
c65ebc55 5
92b4f0af
JW
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
748086b7 8 the Free Software Foundation; either version 3, or (at your option)
92b4f0af
JW
9 any later version.
10
11 GCC is distributed in the hope that it will be useful,
c65ebc55 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
92b4f0af
JW
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
c65ebc55 15
748086b7
JJ
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
19
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
92b4f0af 24
07cf4226
DM
25#include "auto-host.h"
26
c65ebc55
JW
27.section .ctors,"aw","progbits"
28 .align 8
29__CTOR_END__:
30 data8 0
31
32.section .dtors,"aw","progbits"
33 .align 8
34__DTOR_END__:
35 data8 0
36
e6b6bf09 37#if HAVE_INITFINI_ARRAY_SUPPORT
e24e0aa7
L
38 .global __do_global_ctors_aux
39 .hidden __do_global_ctors_aux
e10e461e 40#else /* !HAVE_INITFINI_ARRAY_SUPPORT */
c65ebc55
JW
41/*
42 * Fragment of the ELF _init routine that invokes our dtor cleanup.
43 *
53749ab7
RH
44 * We make the call by indirection, because in large programs the
45 * .fini and .init sections are not in range of the destination, and
46 * we cannot allow the linker to insert a stub at the end of this
47 * fragment of the _fini function. Further, Itanium does not implement
48 * the long branch instructions, and we do not wish every program to
49 * trap to the kernel for emulation.
50 *
51 * Note that we require __do_global_ctors_aux to preserve the GP,
52 * so that the next fragment in .fini gets the right value.
c65ebc55
JW
53 */
54.section .init,"ax","progbits"
53749ab7 55 { .mlx
8f744ea9 56 movl r2 = @pcrel(__do_global_ctors_aux - 16)
c65ebc55 57 }
53749ab7 58 { .mii
515edc9b
RH
59 mov r3 = ip
60 ;;
61 add r2 = r2, r3
c65ebc55 62 ;;
53749ab7 63 }
515edc9b
RH
64 { .mib
65 mov b6 = r2
53749ab7 66 br.call.sptk.many b0 = b6
c65ebc55
JW
67 ;;
68 }
e10e461e 69#endif /* !HAVE_INITFINI_ARRAY_SUPPORT */
c65ebc55
JW
70
71.text
8f744ea9 72 .align 32
8f744ea9 73 .proc __do_global_ctors_aux
c65ebc55 74__do_global_ctors_aux:
8f744ea9 75 .prologue
c65ebc55
JW
76 /*
77 for (loc0 = __CTOR_END__-1; *p != -1; --p)
78 (*p) ();
79 */
8f744ea9 80 .save ar.pfs, r34
c35b64c2 81 alloc loc2 = ar.pfs, 0, 5, 0, 0
8f744ea9
DM
82 movl loc0 = @gprel(__CTOR_END__ - 8)
83 ;;
84
85 add loc0 = loc0, gp
86 ;;
87 ld8 loc3 = [loc0], -8
88 .save rp, loc1
89 mov loc1 = rp
90 .body
91 ;;
92
93 cmp.eq p6, p0 = -1, loc3
c35b64c2
DM
94 mov loc4 = gp
95(p6) br.cond.spnt.few .exit
8f744ea9 96
c35b64c2 97.loop: ld8 r15 = [loc3], 8
8f744ea9
DM
98 ;;
99 ld8 gp = [loc3]
100 mov b6 = r15
101
102 ld8 loc3 = [loc0], -8
103 nop 0
104 br.call.sptk.many rp = b6
105 ;;
106
107 cmp.ne p6, p0 = -1, loc3
108 nop 0
c35b64c2 109(p6) br.cond.sptk.few .loop
8f744ea9 110
c35b64c2 111.exit: mov gp = loc3
8f744ea9
DM
112 mov rp = loc1
113 mov ar.pfs = loc2
114
115 br.ret.sptk.many rp
116 .endp __do_global_ctors_aux