]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgcc/config/arm/crtn.S
Move crtstuff support to toplevel libgcc
[thirdparty/gcc.git] / libgcc / config / arm / crtn.S
1 # Copyright (C) 2001, 2004, 2008, 2009, 2010, 2011
2 # Free Software Foundation, Inc.
3 # Written By Nick Clifton
4 #
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 3, or (at your option) any
8 # later version.
9 #
10 # This file is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
14 #
15 # Under Section 7 of GPL version 3, you are granted additional
16 # permissions described in the GCC Runtime Library Exception, version
17 # 3.1, as published by the Free Software Foundation.
18 #
19 # You should have received a copy of the GNU General Public License and
20 # a copy of the GCC Runtime Library Exception along with this program;
21 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 # <http://www.gnu.org/licenses/>.
23
24 /* An executable stack is *not* required for these functions. */
25 #if defined(__ELF__) && defined(__linux__)
26 .section .note.GNU-stack,"",%progbits
27 .previous
28 #endif
29
30 #ifdef __ARM_EABI__
31 /* Some attributes that are common to all routines in this file. */
32 /* Tag_ABI_align_needed: This code does not require 8-byte
33 alignment from the caller. */
34 /* .eabi_attribute 24, 0 -- default setting. */
35 /* Tag_ABI_align_preserved: This code preserves 8-byte
36 alignment in any callee. */
37 .eabi_attribute 25, 1
38 #endif /* __ARM_EABI__ */
39
40 # This file just makes sure that the .fini and .init sections do in
41 # fact return. Users may put any desired instructions in those sections.
42 # This file is the last thing linked into any executable.
43
44 # Note - this macro is complemented by the FUNC_START macro
45 # in crti.S. If you change this macro you must also change
46 # that macro match.
47 #
48 # Note - we do not try any fancy optimizations of the return
49 # sequences here, it is just not worth it. Instead keep things
50 # simple. Restore all the save resgisters, including the link
51 # register and then perform the correct function return instruction.
52 # We also save/restore r3 to ensure stack alignment.
53 .macro FUNC_END
54 #ifdef __thumb__
55 .thumb
56
57 pop {r3, r4, r5, r6, r7}
58 pop {r3}
59 mov lr, r3
60 #else
61 .arm
62
63 sub sp, fp, #40
64 ldmfd sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr}
65 #endif
66
67 #if defined __THUMB_INTERWORK__ || defined __thumb__
68 bx lr
69 #else
70 mov pc, lr
71 #endif
72 .endm
73
74
75 .section ".init"
76 ;;
77 FUNC_END
78
79 .section ".fini"
80 ;;
81 FUNC_END
82
83 # end of crtn.S