0
|
1 # Copyright (C) 2001, 2004, 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 makes sure that the .fini and .init sections do in
|
|
30 # fact return. Users may put any desired instructions in those sections.
|
|
31 # This file is the last thing linked into any executable.
|
|
32
|
|
33 # Note - this macro is complemented by the FUNC_START macro
|
|
34 # in crti.asm. If you change this macro you must also change
|
|
35 # that macro match.
|
|
36 #
|
|
37 # Note - we do not try any fancy optimizations of the return
|
|
38 # sequences here, it is just not worth it. Instead keep things
|
|
39 # simple. Restore all the save resgisters, including the link
|
|
40 # register and then perform the correct function return instruction.
|
|
41 # We also save/restore r3 to ensure stack alignment.
|
|
42 .macro FUNC_END
|
|
43 #ifdef __thumb__
|
|
44 .thumb
|
|
45
|
|
46 pop {r3, r4, r5, r6, r7}
|
|
47 pop {r3}
|
|
48 mov lr, r3
|
|
49 #else
|
|
50 .arm
|
|
51
|
|
52 sub sp, fp, #40
|
|
53 ldmfd sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr}
|
|
54 #endif
|
|
55
|
|
56 #if defined __THUMB_INTERWORK__ || defined __thumb__
|
|
57 bx lr
|
|
58 #else
|
|
59 mov pc, lr
|
|
60 #endif
|
|
61 .endm
|
|
62
|
|
63
|
|
64 .section ".init"
|
|
65 ;;
|
|
66 FUNC_END
|
|
67
|
|
68 .section ".fini"
|
|
69 ;;
|
|
70 FUNC_END
|
|
71
|
|
72 # end of crtn.asm
|