0
|
1 # Copyright (C) 2001, 2008, 2009 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 3, or (at your option) any
|
|
7 # later version.
|
|
8 #
|
|
9 # This file is distributed in the hope that it will be useful, but
|
|
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12 # General Public License for more details.
|
|
13 #
|
|
14 # Under Section 7 of GPL version 3, you are granted additional
|
|
15 # permissions described in the GCC Runtime Library Exception, version
|
|
16 # 3.1, as published by the Free Software Foundation.
|
|
17 #
|
|
18 # You should have received a copy of the GNU General Public License and
|
|
19 # a copy of the GCC Runtime Library Exception along with this program;
|
|
20 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
21 # <http://www.gnu.org/licenses/>.
|
|
22
|
|
23 /* An executable stack is *not* required for these functions. */
|
|
24 #if defined(__ELF__) && defined(__linux__)
|
|
25 .section .note.GNU-stack,"",%progbits
|
|
26 .previous
|
|
27 #endif
|
|
28
|
|
29 # This file just make a stack frame for the contents of the .fini and
|
|
30 # .init sections. Users may put any desired instructions in those
|
|
31 # sections.
|
|
32
|
|
33 #ifdef __ELF__
|
|
34 #define TYPE(x) .type x,function
|
|
35 #else
|
|
36 #define TYPE(x)
|
|
37 #endif
|
|
38
|
|
39 # Note - this macro is complemented by the FUNC_END macro
|
|
40 # in crtn.asm. If you change this macro you must also change
|
|
41 # that macro match.
|
|
42 .macro FUNC_START
|
|
43 #ifdef __thumb__
|
|
44 .thumb
|
|
45
|
|
46 push {r3, r4, r5, r6, r7, lr}
|
|
47 #else
|
|
48 .arm
|
|
49 # Create a stack frame and save any call-preserved registers
|
|
50 mov ip, sp
|
|
51 stmdb sp!, {r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
|
|
52 sub fp, ip, #4
|
|
53 #endif
|
|
54 .endm
|
|
55
|
|
56 .section ".init"
|
|
57 .align 2
|
|
58 .global _init
|
|
59 #ifdef __thumb__
|
|
60 .thumb_func
|
|
61 #endif
|
|
62 TYPE(_init)
|
|
63 _init:
|
|
64 FUNC_START
|
|
65
|
|
66
|
|
67 .section ".fini"
|
|
68 .align 2
|
|
69 .global _fini
|
|
70 #ifdef __thumb__
|
|
71 .thumb_func
|
|
72 #endif
|
|
73 TYPE(_fini)
|
|
74 _fini:
|
|
75 FUNC_START
|
|
76
|
|
77 # end of crti.asm
|