* config/i386/i386.md (mmx_pinsrw): Output operands in correct
[official-gcc.git] / gcc / config / ia64 / crtbegin.asm
blob1b57a99316c687345a54b4ca950b994495b24b40
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 .section .ctors,"aw","progbits"
20 .align 8
21 __CTOR_LIST__:
22 data8 -1
24 .section .dtors,"aw","progbits"
25 .align 8
26 __DTOR_LIST__:
27 data8 -1
29 .section .sdata
30 .type dtor_ptr#,@object
31 .size dtor_ptr#,8
32 dtor_ptr:
33 data8 __DTOR_LIST__# + 8
35 #ifndef SHARED
36 .type __ia64_app_header#,@object
37 .size __ia64_app_header#,8
38 .global __ia64_app_header
39 __ia64_app_header:
40 data8 @segrel(.Lsegrel_ref#)
41 #endif
43 /* A handle for __cxa_finalize to manage c++ local destructors. */
44 .global __dso_handle#
45 .type __dso_handle#,@object
46 .size __dso_handle#,8
47 #ifdef SHARED
48 .section .data
49 __dso_handle:
50 data8 __dso_handle#
51 #else
52 .section .bss
53 __dso_handle:
54 data8 0
55 #endif
56 .hidden __dso_handle#
60 * Fragment of the ELF _fini routine that invokes our dtor cleanup.
62 * We make the call by indirection, because in large programs the
63 * .fini and .init sections are not in range of the destination, and
64 * we cannot allow the linker to insert a stub at the end of this
65 * fragment of the _fini function. Further, Itanium does not implement
66 * the long branch instructions, and we do not wish every program to
67 * trap to the kernel for emulation.
69 * Note that we require __do_global_dtors_aux to preserve the GP,
70 * so that the next fragment in .fini gets the right value.
72 .section .fini,"ax","progbits"
73 { .mlx
74 movl r2 = @gprel(__do_global_dtors_aux#)
77 { .mii
78 nop.m 0
79 add r2 = r2, gp
81 mov b6 = r2
83 { .bbb
84 br.call.sptk.many b0 = b6
88 #ifndef SHARED
90 * Fragment of the ELF _init routine that sets up __ia64_app_header
93 .section .init,"ax","progbits"
94 .Lsegrel_ref:
95 { .mmi
96 addl r2 = @gprel(__ia64_app_header), gp
97 mov r16 = ip
100 { .mmi
101 ld8 r3 = [r2]
103 sub r16 = r16, r3
106 { .mfb
107 st8 [r2] = r16
109 #endif
111 .section .text
112 .align 16
113 .proc __do_global_dtors_aux#
114 __do_global_dtors_aux:
115 #ifndef SHARED
116 { .mii
117 alloc loc3 = ar.pfs, 0, 4, 1, 0
118 addl loc0 = @gprel(dtor_ptr#), gp
119 mov loc1 = b0
121 { .mib
122 mov loc2 = gp
123 br.sptk.few 1f
126 #else
128 if (__cxa_finalize)
129 __cxa_finalize(__dso_handle)
131 { .mii
132 alloc loc3 = ar.pfs, 0, 4, 1, 0
133 addl loc0 = @gprel(dtor_ptr#), gp
134 addl r16 = @ltoff(@fptr(__cxa_finalize#)), gp
137 { .mmi
138 ld8 r16 = [r16]
140 addl out0 = @ltoff(__dso_handle#), gp
141 cmp.ne p7, p0 = r0, r16
144 { .mmi
145 ld8 out0 = [out0]
146 (p7) ld8 r18 = [r16], 8
147 mov loc1 = b0
150 { .mfi
151 mov loc2 = gp
152 (p7) mov b6 = r18
155 .mfb
156 (p7) ld8 gp = [r16]
157 (p7) br.call.sptk.many b0 = b6
159 { .mfb
160 br.sptk.few 1f
162 #endif
164 do {
165 dtor_ptr++;
166 (*(dtor_ptr-1)) ();
167 } while (dtor_ptr);
170 { .mmi
171 st8 [loc0] = r15
172 ld8 r17 = [r16], 8
175 { .mib
176 ld8 gp = [r16]
177 mov b6 = r17
178 br.call.sptk.many b0 = b6
181 { .mmi
182 ld8 r15 = [loc0]
184 ld8 r16 = [r15], 8
187 { .mfb
188 cmp.ne p6, p0 = r0, r16
189 (p6) br.cond.sptk.few 0b
191 { .mii
192 mov gp = loc2
193 mov b0 = loc1
194 mov ar.pfs = loc3
196 { .bbb
197 br.ret.sptk.many b0
200 .endp __do_global_dtors_aux#
202 #ifdef SHARED
203 .weak __cxa_finalize#
204 #endif