OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [ia64/] [crtend.S] - Blame information for rev 768

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 734 jeremybenn
/* Copyright (C) 2000, 2001, 2003, 2005, 2009 Free Software Foundation, Inc.
2
   Contributed by Jes Sorensen, 
3
 
4
   This file is part of GCC.
5
 
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)
9
   any later version.
10
 
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.
15
 
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.
19
 
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
   .  */
24
 
25
#include "auto-host.h"
26
 
27
.section .ctors,"aw","progbits"
28
        .align  8
29
__CTOR_END__:
30
        data8   0
31
 
32
.section .dtors,"aw","progbits"
33
        .align 8
34
__DTOR_END__:
35
        data8   0
36
 
37
.section .jcr,"aw","progbits"
38
        .align 8
39
__JCR_END__:
40
        data8   0
41
 
42
#ifdef HAVE_INITFINI_ARRAY_SUPPORT
43
        .global __do_global_ctors_aux
44
        .hidden __do_global_ctors_aux
45
#else /* !HAVE_INITFINI_ARRAY_SUPPORT */
46
/*
47
 * Fragment of the ELF _init routine that invokes our dtor cleanup.
48
 *
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.
55
 *
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.
58
 */
59
.section .init,"ax","progbits"
60
        { .mlx
61
          movl r2 = @pcrel(__do_global_ctors_aux - 16)
62
        }
63
        { .mii
64
          mov r3 = ip
65
          ;;
66
          add r2 = r2, r3
67
          ;;
68
        }
69
        { .mib
70
          mov b6 = r2
71
          br.call.sptk.many b0 = b6
72
          ;;
73
        }
74
#endif /* !HAVE_INITFINI_ARRAY_SUPPORT */
75
 
76
.text
77
        .align 32
78
        .proc __do_global_ctors_aux
79
__do_global_ctors_aux:
80
        .prologue
81
        /*
82
                for (loc0 = __CTOR_END__-1; *p != -1; --p)
83
                  (*p) ();
84
        */
85
        .save ar.pfs, r34
86
        alloc loc2 = ar.pfs, 0, 5, 0, 0
87
        movl loc0 = @gprel(__CTOR_END__ - 8)
88
        ;;
89
 
90
        add loc0 = loc0, gp
91
        ;;
92
        ld8 loc3 = [loc0], -8
93
        .save rp, loc1
94
        mov loc1 = rp
95
        .body
96
        ;;
97
 
98
        cmp.eq p6, p0 = -1, loc3
99
        mov loc4 = gp
100
(p6)    br.cond.spnt.few .exit
101
 
102
.loop:  ld8 r15 = [loc3], 8
103
        ;;
104
        ld8 gp = [loc3]
105
        mov b6 = r15
106
 
107
        ld8 loc3 = [loc0], -8
108
        nop 0
109
        br.call.sptk.many rp = b6
110
        ;;
111
 
112
        cmp.ne p6, p0 = -1, loc3
113
        nop 0
114
(p6)    br.cond.sptk.few .loop
115
 
116
.exit:  mov gp = loc3
117
        mov rp = loc1
118
        mov ar.pfs = loc2
119
 
120
        br.ret.sptk.many rp
121
        .endp __do_global_ctors_aux

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.