Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / contrib / gcc / config / alpha / crtbegin.asm
1  # Copyright (C) 1996, 1998 Free Software Foundation, Inc.
2  #  Contributed by Richard Henderson (rth@tamu.edu)
3  #
4  # This file is free software; you can redistribute it and/or modify it
5  # under the terms of the GNU General Public License as published by the
6  # Free Software Foundation; either version 2, or (at your option) any
7  # later version.
8  # 
9  # In addition to the permissions in the GNU General Public License, the
10  # Free Software Foundation gives you unlimited permission to link the
11  # compiled version of this file with other programs, and to distribute
12  # those programs without any restriction coming from the use of this
13  # file.  (The General Public License restrictions do apply in other
14  # respects; for example, they cover modification of the file, and
15  # distribution when not linked into another program.)
16  # 
17  # This file is distributed in the hope that it will be useful, but
18  # WITHOUT ANY WARRANTY; without even the implied warranty of
19  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  # General Public License for more details.
21  # 
22  # You should have received a copy of the GNU General Public License
23  # along with this program; see the file COPYING.  If not, write to
24  # the Free Software Foundation, 59 Temple Place - Suite 330,
25  # Boston, MA 02111-1307, USA.
26  # 
27  #    As a special exception, if you link this library with files
28  #    compiled with GCC to produce an executable, this does not cause
29  #    the resulting executable to be covered by the GNU General Public License.
30  #    This exception does not however invalidate any other reasons why
31  #    the executable file might be covered by the GNU General Public License.
32
33  #
34  # Heads of the constructor/destructor lists.
35  #
36
37  # The __*TOR_LIST__ symbols are not global because when this file is used
38  # in a shared library, we do not want the symbol to fall over to the
39  # application's lists.
40
41 .section .ctors,"aw"
42
43         .align 3
44 __CTOR_LIST__:
45         .quad -1
46
47 .section .dtors,"aw"
48
49         .align 3
50 __DTOR_LIST__:
51         .quad -1
52
53 .section .eh_frame,"aw"
54 __EH_FRAME_BEGIN__:
55
56  #
57  # Fragment of the ELF _fini routine that invokes our dtor cleanup.
58  #
59
60 .section .fini,"ax"
61
62         # Since the bits of the _fini function are spread across many
63         # object files, each potentially with its own GP, we must
64         # assume we need to load ours.  Further, our .fini section
65         # can easily be more than 4MB away from our .text bits so we
66         # can't use bsr.
67
68         br      $29,1f
69 1:      ldgp    $29,0($29)
70         jsr     $26,__do_global_dtors_aux
71         ldgp    $29,0($26)
72
73         # Ideally this call would go in crtend.o, except that we can't
74         # get hold of __EH_FRAME_BEGIN__ there.
75
76         jsr     $26,__do_frame_takedown
77
78         # Must match the alignment we got from crti.o else we get
79         # zero-filled holes in our _fini function and then SIGILL.
80         .align 3
81
82  #
83  # Fragment of the ELF _init routine that sets up the frame info.
84  #
85
86 .section .init,"ax"
87        br      $29,1f
88 1:     ldgp    $29,0($29)
89        jsr     $26,__do_frame_setup
90        .align 3
91
92  #
93  # Invoke our destructors in order.
94  #
95
96 .data
97
98  # Support recursive calls to exit.
99 $ptr:   .quad   __DTOR_LIST__
100
101 .text
102
103         .align 3
104         .ent __do_global_dtors_aux
105
106 __do_global_dtors_aux:
107         lda     $30,-16($30)
108         .frame  $30,16,$26,0
109         stq     $9,8($30)
110         stq     $26,0($30)
111         .mask   0x4000200,-16
112         .prologue 0
113
114         lda     $9,$ptr
115         br      1f
116 0:      stq     $1,0($9)
117         jsr     $26,($27)
118 1:      ldq     $1,0($9)
119         ldq     $27,8($1)
120         addq    $1,8,$1
121         bne     $27,0b
122
123         ldq     $26,0($30)
124         ldq     $9,8($30)
125         lda     $30,16($30)
126         ret
127
128         .end __do_global_dtors_aux
129
130  #
131  # Install our frame info.
132  #
133
134  # ??? How can we rationally keep this size correct?
135
136 .section .bss
137         .type $object,@object
138         .align 3
139 $object:
140         .zero 48
141         .size $object, 48
142
143 .text 
144
145         .align 3
146         .ent __do_frame_setup
147
148 __do_frame_setup:
149         ldgp    $29,0($27)
150         lda     $30,-16($30)
151         .frame  $30,16,$26,0
152         stq     $26,0($30)
153         .mask   0x4000000,-16
154         .prologue 1
155
156         lda     $1,__register_frame_info
157         beq     $1,0f
158         lda     $16,__EH_FRAME_BEGIN__
159         lda     $17,$object
160         jsr     $26,__register_frame_info
161         ldq     $26,0($30)
162 0:      lda     $30,16($30)
163         ret
164
165         .end __do_frame_setup
166
167  #
168  # Remove our frame info.
169  #
170
171         .align 3
172         .ent __do_frame_takedown
173
174 __do_frame_takedown:
175         ldgp    $29,0($27)
176         lda     $30,-16($30)
177         .frame  $30,16,$26,0
178         stq     $26,0($30)
179         .mask   0x4000000,-16
180         .prologue 1
181
182         lda     $1,__deregister_frame_info
183         beq     $1,0f
184         lda     $16,__EH_FRAME_BEGIN__
185         jsr     $26,__deregister_frame_info
186         ldq     $26,0($30)
187 0:      lda     $30,16($30)
188         ret
189
190         .end __do_frame_takedown
191
192 .weak __register_frame_info
193 .weak __deregister_frame_info
194
195 .section        .rodata
196         .ascii "$FreeBSD: src/contrib/gcc/config/alpha/crtbegin.asm,v 1.1.1.2.2.3 2001/08/19 00:01:16 obrien Exp $\0"
197         .ascii "$DragonFly: src/contrib/gcc/config/alpha/Attic/crtbegin.asm,v 1.2 2003/06/17 04:24:01 dillon Exp $\0"