1 /* Copyright (C) 2000-2024 Free Software Foundation, Inc.
2 Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
4 This file is part of GCC.
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
8 the Free Software Foundation; either version 3, or (at your option)
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
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.
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/>. */
25 #include "auto-host.h"
27 .section .ctors,"aw","progbits"
32 .section .dtors,"aw","progbits"
37 #if HAVE_INITFINI_ARRAY_SUPPORT
38 .global __do_global_ctors_aux
39 .hidden __do_global_ctors_aux
40 #else /* !HAVE_INITFINI_ARRAY_SUPPORT */
42 * Fragment of the ELF _init routine that invokes our dtor cleanup.
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.
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.
54 .section .init,"ax","progbits"
56 movl r2 = @pcrel(__do_global_ctors_aux - 16)
66 br.call.sptk.many b0 = b6
69 #endif /* !HAVE_INITFINI_ARRAY_SUPPORT */
73 .proc __do_global_ctors_aux
74 __do_global_ctors_aux:
77 for (loc0 = __CTOR_END__-1; *p != -1; --p)
81 alloc loc2 = ar.pfs, 0, 5, 0, 0
82 movl loc0 = @gprel(__CTOR_END__ - 8)
93 cmp.eq p6, p0 = -1, loc3
95 (p6) br.cond.spnt.few .exit
97 .loop: ld8 r15 = [loc3], 8
102 ld8 loc3 = [loc0], -8
104 br.call.sptk.many rp = b6
107 cmp.ne p6, p0 = -1, loc3
109 (p6) br.cond.sptk.few .loop
116 .endp __do_global_ctors_aux