]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/sh/crti.S
Update copyright years.
[thirdparty/gcc.git] / libgcc / config / sh / crti.S
CommitLineData
83ffe9cd 1/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
1a66cd67
AO
2 This file was adapted from glibc sources.
3
7ec022b2 4This file is part of GCC.
1a66cd67 5
7ec022b2 6GCC is free software; you can redistribute it and/or modify it
1a66cd67 7under the terms of the GNU General Public License as published by the
748086b7 8Free Software Foundation; either version 3, or (at your option) any
1a66cd67
AO
9later version.
10
7ec022b2 11GCC is distributed in the hope that it will be useful,
1a66cd67
AO
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
748086b7
JJ
16Under Section 7 of GPL version 3, you are granted additional
17permissions described in the GCC Runtime Library Exception, version
183.1, as published by the Free Software Foundation.
19
20You should have received a copy of the GNU General Public License and
21a copy of the GCC Runtime Library Exception along with this program;
22see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23<http://www.gnu.org/licenses/>. */
24
69044fa9 25#include "crt.h"
1a66cd67
AO
26
27/* The code in sections .init and .fini is supposed to be a single
28 regular function. The function in .init is called directly from
5f73c6cc 29 start in crt1.S. The function in .fini is atexit()ed in crt1.S
1a66cd67
AO
30 too.
31
5f73c6cc
RO
32 crti.S contributes the prologue of a function to these sections,
33 and crtn.S comes up the epilogue. STARTFILE_SPEC should list
1a66cd67
AO
34 crti.o before any other object files that might add code to .init
35 or .fini sections, and ENDFILE_SPEC should list crtn.o after any
36 such object files. */
37
38 .section .init
ef14c259 39/* The alignment below can't be smaller, otherwise the mova below
1a66cd67
AO
40 breaks. Yes, we might align just the label, but then we'd be
41 exchanging an alignment here for one there, since the code fragment
42 below ensures 4-byte alignment on __ELF__. */
43#ifdef __ELF__
44 .p2align 2
45#else
46 .p2align 1
47#endif
69044fa9
OE
48 .global GLOBAL(_init)
49GLOBAL(_init):
1a66cd67
AO
50#ifdef __ELF__
51 mov.l r12,@-r15
52 mova 0f,r0
53 mov.l 0f,r12
54#endif
55 mov.l r14,@-r15
56#ifdef __ELF__
57 add r0,r12
58#endif
59 sts.l pr,@-r15
60#ifdef __ELF__
61 bra 1f
62#endif
63 mov r15,r14
64#ifdef __ELF__
650: .long _GLOBAL_OFFSET_TABLE_
661:
67#endif
68
69 .section .fini
ef14c259 70/* The alignment below can't be smaller, otherwise the mova below
1a66cd67
AO
71 breaks. Yes, we might align just the label, but then we'd be
72 exchanging an alignment here for one there, since the code fragment
73 below ensures 4-byte alignment on __ELF__. */
74#ifdef __ELF__
75 .p2align 2
76#else
77 .p2align 1
78#endif
69044fa9
OE
79 .global GLOBAL(_fini)
80GLOBAL(_fini):
1a66cd67
AO
81#ifdef __ELF__
82 mov.l r12,@-r15
83 mova 0f,r0
84 mov.l 0f,r12
85#endif
86 mov.l r14,@-r15
87#ifdef __ELF__
88 add r0,r12
89#endif
90 sts.l pr,@-r15
91#ifdef __ELF__
92 bra 1f
93#endif
94 mov r15,r14
95#ifdef __ELF__
960: .long _GLOBAL_OFFSET_TABLE_
971:
98#endif