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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [sh/] [crti.S] - Blame information for rev 849

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

Line No. Rev Author Line
1 734 jeremybenn
/* Copyright (C) 2000, 2001, 2009, 2011 Free Software Foundation, Inc.
2
   This file was adapted from glibc sources.
3
 
4
This file is part of GCC.
5
 
6
GCC is free software; you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published by the
8
Free Software Foundation; either version 3, or (at your option) any
9
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 GNU
14
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
 
26
/* The code in sections .init and .fini is supposed to be a single
27
   regular function.  The function in .init is called directly from
28
   start in crt1.S.  The function in .fini is atexit()ed in crt1.S
29
   too.
30
 
31
   crti.S contributes the prologue of a function to these sections,
32
   and crtn.S comes up the epilogue.  STARTFILE_SPEC should list
33
   crti.o before any other object files that might add code to .init
34
   or .fini sections, and ENDFILE_SPEC should list crtn.o after any
35
   such object files.  */
36
 
37
        .section .init
38
/* The alignment below can't be smaller, otherwise the mova below
39
   breaks.  Yes, we might align just the label, but then we'd be
40
   exchanging an alignment here for one there, since the code fragment
41
   below ensures 4-byte alignment on __ELF__.  */
42
#ifdef __ELF__
43
        .p2align 2
44
#else
45
        .p2align 1
46
#endif
47
        .global  _init
48
_init:
49
#if __SHMEDIA__
50
        addi    r15, -16, r15
51
        st.q    r15, 8, r14
52
        st.q    r15, 0, r18
53
        add     r15, r63, r14
54
#elif __SH5__ && ! __SHMEDIA__
55
        mov     r15,r0
56
        add     #-8,r15
57
        mov.l   r14,@-r0
58
        sts.l   pr,@-r0
59
        mov     r15,r14
60
        nop
61
#else
62
#ifdef __ELF__
63
        mov.l   r12,@-r15
64
        mova    0f,r0
65
        mov.l   0f,r12
66
#endif
67
        mov.l   r14,@-r15
68
#ifdef __ELF__
69
        add     r0,r12
70
#endif
71
        sts.l   pr,@-r15
72
#ifdef __ELF__
73
        bra     1f
74
#endif
75
        mov     r15,r14
76
#ifdef __ELF__
77
0:      .long   _GLOBAL_OFFSET_TABLE_
78
1:
79
#endif
80
#endif /* __SHMEDIA__ */
81
 
82
        .section .fini
83
/* The alignment below can't be smaller, otherwise the mova below
84
   breaks.  Yes, we might align just the label, but then we'd be
85
   exchanging an alignment here for one there, since the code fragment
86
   below ensures 4-byte alignment on __ELF__.  */
87
#ifdef __ELF__
88
        .p2align 2
89
#else
90
        .p2align 1
91
#endif
92
        .global  _fini
93
_fini:
94
#if __SHMEDIA__
95
        addi    r15, -16, r15
96
        st.q    r15, 8, r14
97
        st.q    r15, 0, r18
98
        add     r15, r63, r14
99
#elif __SH5__ && ! __SHMEDIA__
100
        mov     r15,r0
101
        add     #-8,r15
102
        mov.l   r14,@-r0
103
        sts.l   pr,@-r0
104
        mov     r15,r14
105
        nop
106
#else
107
#ifdef __ELF__
108
        mov.l   r12,@-r15
109
        mova    0f,r0
110
        mov.l   0f,r12
111
#endif
112
        mov.l   r14,@-r15
113
#ifdef __ELF__
114
        add     r0,r12
115
#endif
116
        sts.l   pr,@-r15
117
#ifdef __ELF__
118
        bra     1f
119
#endif
120
        mov     r15,r14
121
#ifdef __ELF__
122
0:      .long   _GLOBAL_OFFSET_TABLE_
123
1:
124
#endif
125
#endif /* __SHMEDIA__ */

powered by: WebSVN 2.1.0

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