1 /* Copyright
(C
) 2000, 2001, 2003, 2005 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 2, 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 You should have received a copy of the GNU General
Public License
17 along with GCC
; see the file COPYING. If not, write to
18 the Free Software Foundation
, 51 Franklin Street
, Fifth Floor
,
19 Boston
, MA
02110-1301, USA.
*/
21 /* As a special exception
, if you link
this library with other files
,
22 some of which are compiled with GCC
, to produce an executable
,
23 this library does
not by itself cause the resulting executable
24 to be covered by the GNU General
Public License.
25 This exception does
not however invalidate any other reasons why
26 the executable file might be covered by the GNU General
Public License.
*/
28 #
include "auto-host.h"
30 .
section .ctors
,"aw","progbits"
35 .
section .dtors
,"aw","progbits"
40 .
section .jcr
,"aw","progbits"
45 #ifdef HAVE_INITFINI_ARRAY
46 .
global __do_global_ctors_aux
47 .hidden __do_global_ctors_aux
48 #else
/* !HAVE_INITFINI_ARRAY
*/
50 * Fragment of the ELF _init routine that invokes our dtor cleanup.
52 * We make the
call by indirection
, because
in large programs the
53 * .fini
and .init sections are
not in range of the destination
, and
54 * we cannot allow the linker to insert a stub at the
end of
this
55 * fragment of the _fini function. Further
, Itanium does
not implement
56 * the long branch instructions
, and we do
not wish every program to
57 * trap to the kernel for emulation.
59 * Note that we require __do_global_ctors_aux to preserve the GP
,
60 * so that the next fragment
in .fini gets the right value.
62 .
section .init
,"ax","progbits"
64 movl r2 = @pcrel(__do_global_ctors_aux - 16)
74 br.call.sptk.many b0 = b6
77 #endif
/* !HAVE_INITFINI_ARRAY
*/
81 .
proc __do_global_ctors_aux
82 __do_global_ctors_aux:
85 for
(loc0
= __CTOR_END__
-1; *p != -1; --p)
89 alloc loc2
= ar.pfs
, 0, 5, 0, 0
90 movl loc0
= @gprel(__CTOR_END__
- 8)
101 cmp.
eq p6
, p0
= -1, loc3
103 (p6
) br.cond.spnt.few .exit
105 .
loop: ld8 r15
= [loc3
], 8
110 ld8 loc3
= [loc0
], -8
112 br.
call.sptk.many rp
= b6
115 cmp.ne p6
, p0
= -1, loc3
117 (p6
) br.cond.sptk.few .
loop
124 .
endp __do_global_ctors_aux