OSDN Git Service

* config/ia64/ia64.md: Use braced strings instead of quoted strings
[pf3gnuchains/gcc-fork.git] / gcc / config / ia64 / crtend.asm
1 /* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
2    Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
3
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.
8
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.
13
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.  */
18
19 .section .ctors,"aw","progbits"
20         .align  8
21 __CTOR_END__:
22         data8   0
23
24 .section .dtors,"aw","progbits"
25         .align 8
26 __DTOR_END__:
27         data8   0
28
29 .section .jcr,"aw","progbits"
30         .align 8
31 __JCR_END__:
32         data8   0
33
34 /*
35  * Fragment of the ELF _init routine that invokes our dtor cleanup.
36  *
37  * We make the call by indirection, because in large programs the 
38  * .fini and .init sections are not in range of the destination, and
39  * we cannot allow the linker to insert a stub at the end of this
40  * fragment of the _fini function.  Further, Itanium does not implement
41  * the long branch instructions, and we do not wish every program to
42  * trap to the kernel for emulation.
43  *
44  * Note that we require __do_global_ctors_aux to preserve the GP,
45  * so that the next fragment in .fini gets the right value.
46  */
47 .section .init,"ax","progbits"
48         { .mlx
49           movl r2 = @pcrel(__do_global_ctors_aux# - 16)
50         }
51         { .mii
52           mov r3 = ip
53           ;;
54           add r2 = r2, r3
55           ;;
56         }
57         { .mib
58           mov b6 = r2
59           br.call.sptk.many b0 = b6
60           ;;
61         }
62
63 .text
64         .align 16
65         .proc __do_global_ctors_aux#
66 __do_global_ctors_aux:
67         /*
68                 for (loc0 = __CTOR_END__-1; *p != -1; --p)
69                   (*p) ();
70         */
71         { .mlx
72           alloc loc4 = ar.pfs, 0, 5, 0, 0
73           movl loc0 = @gprel(__CTOR_END__# - 8)
74           ;;
75         }
76         { .mmi
77           add loc0 = loc0, gp
78           mov loc1 = b0
79           ;;
80         }
81         {
82           .mmi
83           ld8 loc3 = [loc0], -8
84           mov loc2 = gp
85           ;;
86         }
87         { .mfb
88           cmp.eq p6, p0 = -1, loc3
89 (p6)      br.cond.spnt.few 2f
90         }
91 0:
92         { .mmi
93           ld8 r15 = [loc3], 8
94           ;;
95           ld8 gp = [loc3]
96           mov b6 = r15
97         }
98         { .mfb
99           ld8 loc3 = [loc0], -8
100           br.call.sptk.many b0 = b6
101           ;;
102         }
103         { .mfb
104           cmp.ne p6, p0 = -1, loc3
105 (p6)      br.cond.sptk.few 0b
106         }
107 2:
108         { .mii
109           mov gp = loc2
110           mov b0 = loc1
111           mov ar.pfs = loc4
112         }
113         { .bbb
114           br.ret.sptk.many b0
115           ;;
116         }
117         .endp __do_global_ctors_aux#