1 /* Copyright
(C
) 2000, 2001, 2003, 2005, 2009 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 .
section .jcr
,"aw","progbits"
42 #ifdef HAVE_INITFINI_ARRAY
43 .
global __do_global_ctors_aux
44 .hidden __do_global_ctors_aux
45 #else
/* !HAVE_INITFINI_ARRAY
*/
47 * Fragment of the ELF _init routine that invokes our dtor cleanup.
49 * We make the
call by indirection
, because
in large programs the
50 * .fini
and .init sections are
not in range of the destination
, and
51 * we cannot allow the linker to insert a stub at the
end of
this
52 * fragment of the _fini function. Further
, Itanium does
not implement
53 * the long branch instructions
, and we do
not wish every program to
54 * trap to the kernel for emulation.
56 * Note that we require __do_global_ctors_aux to preserve the GP
,
57 * so that the next fragment
in .fini gets the right value.
59 .
section .init
,"ax","progbits"
61 movl r2 = @pcrel(__do_global_ctors_aux - 16)
71 br.call.sptk.many b0 = b6
74 #endif
/* !HAVE_INITFINI_ARRAY
*/
78 .
proc __do_global_ctors_aux
79 __do_global_ctors_aux:
82 for
(loc0
= __CTOR_END__
-1; *p != -1; --p)
86 alloc loc2
= ar.pfs
, 0, 5, 0, 0
87 movl loc0
= @gprel(__CTOR_END__
- 8)
98 cmp.
eq p6
, p0
= -1, loc3
100 (p6
) br.cond.spnt.few .exit
102 .
loop: ld8 r15
= [loc3
], 8
107 ld8 loc3
= [loc0
], -8
109 br.
call.sptk.many rp
= b6
112 cmp.ne p6
, p0
= -1, loc3
114 (p6
) br.cond.sptk.few .
loop
121 .
endp __do_global_ctors_aux