OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / crti.asm
1 #   Copyright (C) 2001 Free Software Foundation, Inc.
2 #   Written By Nick Clifton
3
4 # This file is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the
6 # Free Software Foundation; either version 2, or (at your option) any
7 # later version.
8
9 # In addition to the permissions in the GNU General Public License, the
10 # Free Software Foundation gives you unlimited permission to link the
11 # compiled version of this file with other programs, and to distribute
12 # those programs without any restriction coming from the use of this
13 # file.  (The General Public License restrictions do apply in other
14 # respects; for example, they cover modification of the file, and
15 # distribution when not linked into another program.)
16
17 # This file is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 # General Public License for more details.
21
22 # You should have received a copy of the GNU General Public License
23 # along with this program; see the file COPYING.  If not, write to
24 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
25 # Boston, MA 02110-1301, USA.
26
27 #    As a special exception, if you link this library with files
28 #    compiled with GCC to produce an executable, this does not cause
29 #    the resulting executable to be covered by the GNU General Public License.
30 #    This exception does not however invalidate any other reasons why
31 #    the executable file might be covered by the GNU General Public License.
32
33
34 /* An executable stack is *not* required for these functions.  */
35 #if defined(__ELF__) && defined(__linux__)
36 .section .note.GNU-stack,"",%progbits
37 .previous
38 #endif
39
40 # This file just make a stack frame for the contents of the .fini and
41 # .init sections.  Users may put any desired instructions in those
42 # sections.
43
44 #ifdef __ELF__
45 #define TYPE(x) .type x,function
46 #else
47 #define TYPE(x)
48 #endif
49
50         # Note - this macro is complemented by the FUNC_END macro
51         # in crtn.asm.  If you change this macro you must also change
52         # that macro match.
53 .macro FUNC_START
54 #ifdef __thumb__
55         .thumb
56         
57         push    {r3, r4, r5, r6, r7, lr}
58 #else
59         .arm
60         #  Create a stack frame and save any call-preserved registers
61         mov     ip, sp
62         stmdb   sp!, {r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
63         sub     fp, ip, #4
64 #endif
65 .endm
66                 
67         .file           "crti.asm"
68
69         .section        ".init"
70         .align 2
71         .global _init
72 #ifdef __thumb__
73         .thumb_func
74 #endif
75         TYPE(_init)
76 _init:
77         FUNC_START
78         
79                 
80         .section        ".fini"
81         .align  2
82         .global _fini
83 #ifdef __thumb__
84         .thumb_func
85 #endif
86         TYPE(_fini)
87 _fini:
88         FUNC_START
89         
90 # end of crti.asm