]>
Commit | Line | Data |
---|---|---|
99dee823 | 1 | # Copyright (C) 2001-2021 Free Software Foundation, Inc. |
be393ecf NC |
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 | |
748086b7 | 6 | # Free Software Foundation; either version 3, or (at your option) any |
be393ecf NC |
7 | # later version. |
8 | # | |
be393ecf NC |
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 | # | |
748086b7 JJ |
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. | |
be393ecf | 17 | # |
748086b7 JJ |
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/>. | |
be393ecf | 22 | |
978e411f CD |
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 | ||
6f0668cf RE |
29 | #ifdef __ARM_EABI__ |
30 | /* Some attributes that are common to all routines in this file. */ | |
31 | /* Tag_ABI_align_needed: This code does not require 8-byte | |
32 | alignment from the caller. */ | |
33 | /* .eabi_attribute 24, 0 -- default setting. */ | |
34 | /* Tag_ABI_align_preserved: This code preserves 8-byte | |
35 | alignment in any callee. */ | |
36 | .eabi_attribute 25, 1 | |
37 | #endif /* __ARM_EABI__ */ | |
38 | ||
be393ecf NC |
39 | # This file just makes sure that the .fini and .init sections do in |
40 | # fact return. Users may put any desired instructions in those sections. | |
41 | # This file is the last thing linked into any executable. | |
42 | ||
43aa4e05 | 43 | # Note - this macro is complemented by the FUNC_START macro |
5f73c6cc | 44 | # in crti.S. If you change this macro you must also change |
be393ecf NC |
45 | # that macro match. |
46 | # | |
72ac76be | 47 | # Note - we do not try any fancy optimizations of the return |
be393ecf | 48 | # sequences here, it is just not worth it. Instead keep things |
d47657bd | 49 | # simple. Restore all the save registers, including the link |
be393ecf | 50 | # register and then perform the correct function return instruction. |
82c732f9 | 51 | # We also save/restore r3 to ensure stack alignment. |
be393ecf NC |
52 | .macro FUNC_END |
53 | #ifdef __thumb__ | |
54 | .thumb | |
55 | ||
82c732f9 | 56 | pop {r3, r4, r5, r6, r7} |
be393ecf NC |
57 | pop {r3} |
58 | mov lr, r3 | |
59 | #else | |
60 | .arm | |
61 | ||
82c732f9 PB |
62 | sub sp, fp, #40 |
63 | ldmfd sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr} | |
be393ecf NC |
64 | #endif |
65 | ||
66 | #if defined __THUMB_INTERWORK__ || defined __thumb__ | |
67 | bx lr | |
be393ecf NC |
68 | #else |
69 | mov pc, lr | |
70 | #endif | |
be393ecf NC |
71 | .endm |
72 | ||
73 | ||
be393ecf NC |
74 | .section ".init" |
75 | ;; | |
76 | FUNC_END | |
77 | ||
78 | .section ".fini" | |
79 | ;; | |
80 | FUNC_END | |
81 | ||
5f73c6cc | 82 | # end of crtn.S |