1 /* Copyright (C) 2000, 2001 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 #include "auto-host.h"
21 .section .ctors,"aw","progbits"
26 .section .dtors,"aw","progbits"
31 .section .jcr,"aw","progbits"
36 .type dtor_ptr#,@object
39 data8 @gprel(__DTOR_LIST__# + 8)
41 /* A handle for __cxa_finalize to manage c++ local destructors. */
43 .type __dso_handle#,@object
57 #ifdef HAVE_INITFINI_ARRAY
59 .section .fini_array,"a","progbits"
60 data8 @fptr(__do_global_dtors_aux)
62 .section .init_array,"a","progbits"
63 data8 @fptr(__do_jv_register_classes)
65 #else /* !HAVE_INITFINI_ARRAY */
67 * Fragment of the ELF _fini routine that invokes our dtor cleanup.
69 * We make the call by indirection, because in large programs the
70 * .fini and .init sections are not in range of the destination, and
71 * we cannot allow the linker to insert a stub at the end of this
72 * fragment of the _fini function. Further, Itanium does not implement
73 * the long branch instructions, and we do not wish every program to
74 * trap to the kernel for emulation.
76 * Note that we require __do_global_dtors_aux to preserve the GP,
77 * so that the next fragment in .fini gets the right value.
79 .section .fini,"ax","progbits"
81 movl r2 = @pcrel(__do_global_dtors_aux# - 16)
91 br.call.sptk.many b0 = b6
95 /* Likewise for _init. */
97 .section .init,"ax","progbits"
99 movl r2 = @pcrel(__do_jv_register_classes# - 16)
109 br.call.sptk.many b0 = b6
112 #endif /* !HAVE_INITFINI_ARRAY */
116 .proc __do_global_dtors_aux#
117 __do_global_dtors_aux:
120 alloc loc3 = ar.pfs, 0, 4, 1, 0
121 addl loc0 = @gprel(dtor_ptr#), gp
132 __cxa_finalize(__dso_handle)
135 alloc loc3 = ar.pfs, 0, 4, 1, 0
136 addl loc0 = @gprel(dtor_ptr#), gp
137 addl r16 = @ltoff(@fptr(__cxa_finalize#)), gp
143 addl out0 = @ltoff(__dso_handle#), gp
144 cmp.ne p7, p0 = r0, r16
149 (p7) ld8 r18 = [r16], 8
160 (p7) br.call.sptk.many b0 = b6
181 br.call.sptk.many b0 = b6
198 cmp.ne p6, p0 = r0, r16
200 (p6) br.cond.sptk.few 0b
206 .endp __do_global_dtors_aux#
209 .proc __do_jv_register_classes#
210 __do_jv_register_classes:
212 alloc loc2 = ar.pfs, 0, 3, 1, 0
213 movl out0 = @gprel(__JCR_LIST__)
217 addl r14 = @ltoff(@fptr(_Jv_RegisterClasses)), gp
224 cmp.ne p6, p0 = r0, r0
228 cmp.eq.or p6, p0 = r0, r14
229 cmp.eq.or p6, p0 = r0, r15
230 (p6) br.ret.sptk.many b0
241 br.call.sptk.many b0 = b6
253 .endp __do_jv_register_classes#
256 .weak __cxa_finalize#
258 .weak _Jv_RegisterClasses