1169689Skan# Copyright (C) 2001, 2004 Free Software Foundation, Inc. 290075Sobrien# Written By Nick Clifton 390075Sobrien# 490075Sobrien# This file is free software; you can redistribute it and/or modify it 590075Sobrien# under the terms of the GNU General Public License as published by the 690075Sobrien# Free Software Foundation; either version 2, or (at your option) any 790075Sobrien# later version. 890075Sobrien# 990075Sobrien# In addition to the permissions in the GNU General Public License, the 1090075Sobrien# Free Software Foundation gives you unlimited permission to link the 1190075Sobrien# compiled version of this file with other programs, and to distribute 1290075Sobrien# those programs without any restriction coming from the use of this 1390075Sobrien# file. (The General Public License restrictions do apply in other 1490075Sobrien# respects; for example, they cover modification of the file, and 1590075Sobrien# distribution when not linked into another program.) 1690075Sobrien# 1790075Sobrien# This file is distributed in the hope that it will be useful, but 1890075Sobrien# WITHOUT ANY WARRANTY; without even the implied warranty of 1990075Sobrien# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2090075Sobrien# General Public License for more details. 2190075Sobrien# 2290075Sobrien# You should have received a copy of the GNU General Public License 2390075Sobrien# along with this program; see the file COPYING. If not, write to 24169689Skan# the Free Software Foundation, 51 Franklin Street, Fifth Floor, 25169689Skan# Boston, MA 02110-1301, USA. 2690075Sobrien# 2790075Sobrien# As a special exception, if you link this library with files 2890075Sobrien# compiled with GCC to produce an executable, this does not cause 2990075Sobrien# the resulting executable to be covered by the GNU General Public License. 3090075Sobrien# This exception does not however invalidate any other reasons why 3190075Sobrien# the executable file might be covered by the GNU General Public License. 3290075Sobrien# 3390075Sobrien 3490075Sobrien# This file just makes sure that the .fini and .init sections do in 3590075Sobrien# fact return. Users may put any desired instructions in those sections. 3690075Sobrien# This file is the last thing linked into any executable. 3790075Sobrien 38117395Skan # Note - this macro is complemented by the FUNC_START macro 3990075Sobrien # in crti.asm. If you change this macro you must also change 4090075Sobrien # that macro match. 4190075Sobrien # 42132718Skan # Note - we do not try any fancy optimizations of the return 4390075Sobrien # sequences here, it is just not worth it. Instead keep things 4490075Sobrien # simple. Restore all the save resgisters, including the link 4590075Sobrien # register and then perform the correct function return instruction. 46169689Skan # We also save/restore r3 to ensure stack alignment. 4790075Sobrien.macro FUNC_END 4890075Sobrien#ifdef __thumb__ 4990075Sobrien .thumb 5090075Sobrien 51169689Skan pop {r3, r4, r5, r6, r7} 5290075Sobrien pop {r3} 5390075Sobrien mov lr, r3 5490075Sobrien#else 5590075Sobrien .arm 5690075Sobrien 57169689Skan sub sp, fp, #40 58169689Skan ldmfd sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr} 5990075Sobrien#endif 6090075Sobrien 6190075Sobrien#if defined __THUMB_INTERWORK__ || defined __thumb__ 6290075Sobrien bx lr 6390075Sobrien#else 6490075Sobrien mov pc, lr 6590075Sobrien#endif 6690075Sobrien.endm 6790075Sobrien 6890075Sobrien 6990075Sobrien .file "crtn.asm" 7090075Sobrien 71288373Skib .section .note.GNU-stack,"",%progbits 72288373Skib 7390075Sobrien .section ".init" 7490075Sobrien ;; 7590075Sobrien FUNC_END 7690075Sobrien 7790075Sobrien .section ".fini" 7890075Sobrien ;; 7990075Sobrien FUNC_END 8090075Sobrien 8190075Sobrien# end of crtn.asm 82