xref: /openbsd/gnu/gcc/gcc/config/sh/crtn.asm (revision 404b540a)
1/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
2   This file was adapted from glibc sources.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11In addition to the permissions in the GNU General Public License, the
12Free Software Foundation gives you unlimited permission to link the
13compiled version of this file into combinations with other programs,
14and to distribute those combinations without any restriction coming
15from the use of this file.  (The General Public License restrictions
16do apply in other respects; for example, they cover modification of
17the file, and distribution when not linked into a combine
18executable.)
19
20GCC is distributed in the hope that it will be useful,
21but WITHOUT ANY WARRANTY; without even the implied warranty of
22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23General Public License for more details.
24
25You should have received a copy of the GNU General Public License
26along with this program; see the file COPYING.  If not, write to
27the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28Boston, MA 02110-1301, USA.  */
29
30/* See an explanation about .init and .fini in crti.asm.  */
31
32	.section .init
33#if __SHMEDIA__
34	add	r14, r63, r15
35	ld.q	r15, 0, r18
36	ptabs	r18, tr0
37	ld.q	r15, 8, r14
38	addi	r15, 16, r15
39	blink	tr0, r63
40#elif __SH5__ && ! __SHMEDIA__
41	mov	r14,r15
42	lds.l	@r14+,pr
43	mov.l	@r14,r14
44	rts
45	add	#8,r15
46#else
47	mov	r14,r15
48	lds.l	@r15+,pr
49	mov.l	@r15+,r14
50	rts
51#ifdef __ELF__
52	mov.l	@r15+,r12
53#else
54	nop
55#endif
56#endif /* __SHMEDIA__ */
57
58	.section .fini
59#if __SHMEDIA__
60	add	r14, r63, r15
61	ld.q	r15, 0, r18
62	ptabs	r18, tr0
63	ld.q	r15, 8, r14
64	addi	r15, 16, r15
65	blink	tr0, r63
66#elif __SH5__ && ! __SHMEDIA__
67	mov	r14,r15
68	lds.l	@r14+,pr
69	mov.l	@r14,r14
70	rts
71	add	#8,r15
72#else
73	mov	r14,r15
74	lds.l	@r15+,pr
75	mov.l	@r15+,r14
76	rts
77#ifdef __ELF__
78	mov.l	@r15+,r12
79#else
80	nop
81#endif
82#endif /* __SHMEDIA__ */
83