OSDN Git Service

* config/darwin.h (REGISTER_TARGET_PRAGMAS): Define.
[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 GNU CC.
5
6 GNU CC 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 GNU CC 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, 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, 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 #ifdef __ELF__
54         mov.l   r12,@-r15
55         mova    0f,r0
56         mov.l   0f,r12
57 #endif
58         mov.l   r14,@-r15
59 #ifdef __ELF__
60         add     r0,r12
61 #endif
62         sts.l   pr,@-r15
63 #ifdef __ELF__
64         bra     1f
65 #endif
66         mov     r15,r14
67 #ifdef __ELF__
68 0:      .long   _GLOBAL_OFFSET_TABLE_
69 1:
70 #endif
71
72         .section .fini
73 /* The alignment below can't be smaller, otherwise the mova below
74    breaks.  Yes, we might align just the label, but then we'd be
75    exchanging an alignment here for one there, since the code fragment
76    below ensures 4-byte alignment on __ELF__.  */
77 #ifdef __ELF__
78         .p2align 2
79 #else
80         .p2align 1
81 #endif
82         .global  _fini
83 _fini:  
84 #ifdef __ELF__
85         mov.l   r12,@-r15
86         mova    0f,r0
87         mov.l   0f,r12
88 #endif
89         mov.l   r14,@-r15
90 #ifdef __ELF__
91         add     r0,r12
92 #endif
93         sts.l   pr,@-r15
94 #ifdef __ELF__
95         bra     1f
96 #endif
97         mov     r15,r14
98 #ifdef __ELF__
99 0:      .long   _GLOBAL_OFFSET_TABLE_
100 1:
101 #endif