OSDN Git Service

* config/sh/sh.md (consttable_4): Call mark_symbol_refs_as_used.
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / crti.asm
1 /* Copyright (C) 2000, 2001 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 2, or (at your option) any
9 later version.
10
11 In addition to the permissions in the GNU General Public License, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of this file into combinations with other programs,
14 and to distribute those combinations without any restriction coming
15 from the use of this file.  (The General Public License restrictions
16 do apply in other respects; for example, they cover modification of
17 the file, and distribution when not linked into a combine
18 executable.)
19
20 GCC is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; see the file COPYING.  If not, write to
27 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28 Boston, MA 02110-1301, USA.  */
29
30 /* The code in sections .init and .fini is supposed to be a single
31    regular function.  The function in .init is called directly from
32    start in crt1.asm.  The function in .fini is atexit()ed in crt1.asm
33    too.
34
35    crti.asm contributes the prologue of a function to these sections,
36    and crtn.asm comes up the epilogue.  STARTFILE_SPEC should list
37    crti.o before any other object files that might add code to .init
38    or .fini sections, and ENDFILE_SPEC should list crtn.o after any
39    such object files.  */
40
41         .section .init
42 /* The alignment below can't be smaller, otherwise the mova below
43    breaks.  Yes, we might align just the label, but then we'd be
44    exchanging an alignment here for one there, since the code fragment
45    below ensures 4-byte alignment on __ELF__.  */
46 #ifdef __ELF__
47         .p2align 2
48 #else
49         .p2align 1
50 #endif
51         .global  _init
52 _init:
53 #if __SHMEDIA__
54         addi    r15, -16, r15
55         st.q    r15, 8, r14
56         st.q    r15, 0, r18
57         add     r15, r63, r14
58 #elif __SH5__ && ! __SHMEDIA__
59         mov     r15,r0
60         add     #-8,r15
61         mov.l   r14,@-r0
62         sts.l   pr,@-r0
63         mov     r15,r14
64         nop
65 #else
66 #ifdef __ELF__
67         mov.l   r12,@-r15
68         mova    0f,r0
69         mov.l   0f,r12
70 #endif
71         mov.l   r14,@-r15
72 #ifdef __ELF__
73         add     r0,r12
74 #endif
75         sts.l   pr,@-r15
76 #ifdef __ELF__
77         bra     1f
78 #endif
79         mov     r15,r14
80 #ifdef __ELF__
81 0:      .long   _GLOBAL_OFFSET_TABLE_
82 1:
83 #endif
84 #endif /* __SHMEDIA__ */
85
86         .section .fini
87 /* The alignment below can't be smaller, otherwise the mova below
88    breaks.  Yes, we might align just the label, but then we'd be
89    exchanging an alignment here for one there, since the code fragment
90    below ensures 4-byte alignment on __ELF__.  */
91 #ifdef __ELF__
92         .p2align 2
93 #else
94         .p2align 1
95 #endif
96         .global  _fini
97 _fini:  
98 #if __SHMEDIA__
99         addi    r15, -16, r15
100         st.q    r15, 8, r14
101         st.q    r15, 0, r18
102         add     r15, r63, r14
103 #elif __SH5__ && ! __SHMEDIA__
104         mov     r15,r0
105         add     #-8,r15
106         mov.l   r14,@-r0
107         sts.l   pr,@-r0
108         mov     r15,r14
109         nop
110 #else
111 #ifdef __ELF__
112         mov.l   r12,@-r15
113         mova    0f,r0
114         mov.l   0f,r12
115 #endif
116         mov.l   r14,@-r15
117 #ifdef __ELF__
118         add     r0,r12
119 #endif
120         sts.l   pr,@-r15
121 #ifdef __ELF__
122         bra     1f
123 #endif
124         mov     r15,r14
125 #ifdef __ELF__
126 0:      .long   _GLOBAL_OFFSET_TABLE_
127 1:
128 #endif
129 #endif /* __SHMEDIA__ */