]>
Commit | Line | Data |
---|---|---|
6b58cbc0 | 1 | /* Special .init and .fini section support for SH. Linuxthread version. |
ae9ecd08 | 2 | Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. |
6b58cbc0 UD |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it | |
cc7375ce | 6 | and/or modify it under the terms of the GNU Lesser General Public |
6b58cbc0 | 7 | License as published by the Free Software Foundation; either |
cc7375ce | 8 | version 2.1 of the License, or (at your option) any later version. |
6b58cbc0 | 9 | |
cc7375ce | 10 | In addition to the permissions in the GNU Lesser General Public |
6b58cbc0 UD |
11 | License, the Free Software Foundation gives you unlimited |
12 | permission to link the compiled version of this file with other | |
13 | programs, and to distribute those programs without any restriction | |
cc7375ce | 14 | coming from the use of this file. (The Lesser General Public |
6b58cbc0 UD |
15 | License restrictions do apply in other respects; for example, they |
16 | cover modification of the file, and distribution when not linked | |
17 | into another program.) | |
18 | ||
19 | The GNU C Library is distributed in the hope that it will be | |
20 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty | |
21 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
cc7375ce | 22 | GNU Lesser General Public License for more details. |
6b58cbc0 | 23 | |
cc7375ce | 24 | You should have received a copy of the GNU Lesser General Public |
6b58cbc0 UD |
25 | License along with the GNU C Library; see the file COPYING.LIB. If not, |
26 | write to the Free Software Foundation, 59 Temple Place - Suite 330, | |
27 | Boston, MA 02111-1307, USA. */ | |
28 | ||
29 | /* This file is compiled into assembly code which is then munged by a sed | |
30 | script into two files: crti.s and crtn.s. | |
31 | ||
32 | * crti.s puts a function prologue at the beginning of the | |
33 | .init and .fini sections and defines global symbols for | |
34 | those addresses, so they can be called as functions. | |
35 | ||
36 | * crtn.s puts the corresponding function epilogues | |
37 | in the .init and .fini sections. */ | |
38 | ||
bdee30cf UD |
39 | __asm__ ("\n\ |
40 | \n\ | |
41 | #include \"defs.h\"\n\ | |
42 | \n\ | |
43 | /*@HEADER_ENDS*/\n\ | |
44 | \n\ | |
45 | /*@TESTS_BEGIN*/\n\ | |
46 | \n\ | |
47 | /*@TESTS_END*/\n\ | |
48 | \n\ | |
49 | /*@_init_PROLOG_BEGINS*/\n\ | |
50 | .section .init\n\ | |
51 | .align 5\n\ | |
52 | .global _init\n\ | |
53 | .type _init,@function\n\ | |
54 | _init:\n\ | |
55 | mov.l r12,@-r15\n\ | |
56 | mov.l r14,@-r15\n\ | |
57 | sts.l pr,@-r15\n\ | |
58 | mova .L22,r0\n\ | |
59 | mov.l .L22,r12\n\ | |
60 | add r0,r12\n\ | |
61 | mova .L24,r0\n\ | |
62 | mov.l .L24,r1\n\ | |
63 | add r0,r1\n\ | |
64 | jsr @r1\n\ | |
65 | nop\n\ | |
66 | mova .L23,r0\n\ | |
67 | mov.l .L23,r1\n\ | |
68 | add r0,r1\n\ | |
69 | jsr @r1\n\ | |
70 | mov r15,r14\n\ | |
71 | bra 1f\n\ | |
72 | nop\n\ | |
73 | .align 2\n\ | |
74 | .L22:\n\ | |
75 | .long _GLOBAL_OFFSET_TABLE_\n\ | |
76 | .L23:\n\ | |
77 | .long __gmon_start__@PLT\n\ | |
78 | .L24:\n\ | |
79 | .long __pthread_initialize_minimal@PLT\n\ | |
bdee30cf UD |
80 | 1:\n\ |
81 | ALIGN\n\ | |
82 | END_INIT\n\ | |
83 | \n\ | |
84 | /*@_init_PROLOG_ENDS*/\n\ | |
85 | \n\ | |
86 | /*@_init_EPILOG_BEGINS*/\n\ | |
87 | .section .init\n\ | |
88 | mov r14,r15\n\ | |
89 | lds.l @r15+,pr\n\ | |
90 | mov.l @r15+,r14\n\ | |
91 | rts \n\ | |
92 | mov.l @r15+,r12\n\ | |
93 | END_INIT\n\ | |
94 | .section .text\n\ | |
95 | .align 5\n\ | |
96 | .weak __gmon_start__\n\ | |
97 | .type __gmon_start__,@function\n\ | |
98 | __gmon_start__:\n\ | |
99 | mov.l r14,@-r15\n\ | |
100 | mov r15,r14\n\ | |
101 | mov r14,r15\n\ | |
102 | rts \n\ | |
103 | mov.l @r15+,r14\n\ | |
104 | \n\ | |
105 | /*@_init_EPILOG_ENDS*/\n\ | |
106 | \n\ | |
107 | /*@_fini_PROLOG_BEGINS*/\n\ | |
108 | .section .fini\n\ | |
109 | .align 5\n\ | |
110 | .global _fini\n\ | |
111 | .type _fini,@function\n\ | |
112 | _fini:\n\ | |
113 | mov.l r12,@-r15\n\ | |
114 | mov.l r14,@-r15\n\ | |
115 | sts.l pr,@-r15\n\ | |
116 | mova .L27,r0\n\ | |
117 | mov.l .L27,r12\n\ | |
118 | add r0,r12\n\ | |
119 | mov r15,r14\n\ | |
120 | ALIGN\n\ | |
121 | END_FINI\n\ | |
122 | bra 1f\n\ | |
123 | nop\n\ | |
124 | .align 2\n\ | |
125 | .L27:\n\ | |
126 | .long _GLOBAL_OFFSET_TABLE_\n\ | |
127 | 1:\n\ | |
128 | /*@_fini_PROLOG_ENDS*/\n\ | |
129 | \n\ | |
130 | /*@_fini_EPILOG_BEGINS*/\n\ | |
131 | .section .fini\n\ | |
132 | mov r14,r15\n\ | |
133 | lds.l @r15+,pr\n\ | |
134 | mov.l @r15+,r14\n\ | |
135 | rts \n\ | |
136 | mov.l @r15+,r12\n\ | |
137 | \n\ | |
138 | END_FINI\n\ | |
139 | \n\ | |
140 | /*@_fini_EPILOG_ENDS*/\n\ | |
141 | \n\ | |
142 | /*@TRAILER_BEGINS*/\n\ | |
6b58cbc0 | 143 | "); |