]>
Commit | Line | Data |
---|---|---|
ebb92a49 TS |
1 | /* Special .init and .fini section support for SH. NPTL version. |
2 | Copyright (C) 2003, 2009 Free Software Foundation, Inc. | |
a54e8d33 UD |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it | |
6 | and/or modify it under the terms of the GNU Library General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2 of the License, or (at your option) any later version. | |
9 | ||
10 | In addition to the permissions in the GNU Library General Public | |
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 | |
14 | coming from the use of this file. (The Library General Public | |
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 | |
22 | GNU Library General Public License for more details. | |
23 | ||
24 | You should have received a copy of the GNU Library General Public | |
59ba27a6 PE |
25 | License along with the GNU C Library; see the file COPYING.LIB. If |
26 | not, see <http://www.gnu.org/licenses/>. */ | |
a54e8d33 UD |
27 | |
28 | /* This file is compiled into assembly code which is then munged by a sed | |
29 | script into two files: crti.s and crtn.s. | |
30 | ||
31 | * crti.s puts a function prologue at the beginning of the | |
32 | .init and .fini sections and defines global symbols for | |
33 | those addresses, so they can be called as functions. | |
34 | ||
35 | * crtn.s puts the corresponding function epilogues | |
36 | in the .init and .fini sections. */ | |
37 | ||
38 | __asm__ ("\n\ | |
39 | \n\ | |
40 | #include \"defs.h\"\n\ | |
41 | \n\ | |
42 | /*@HEADER_ENDS*/\n\ | |
43 | \n\ | |
44 | /*@TESTS_BEGIN*/\n\ | |
45 | \n\ | |
46 | /*@TESTS_END*/\n\ | |
47 | \n\ | |
48 | /*@_init_PROLOG_BEGINS*/\n\ | |
49 | .section .init\n\ | |
50 | .align 5\n\ | |
51 | .global _init\n\ | |
52 | .type _init,@function\n\ | |
53 | _init:\n\ | |
54 | mov.l r12,@-r15\n\ | |
55 | mov.l r14,@-r15\n\ | |
56 | sts.l pr,@-r15\n\ | |
57 | mova .L22,r0\n\ | |
58 | mov.l .L22,r12\n\ | |
59 | add r0,r12\n\ | |
60 | mova .L24,r0\n\ | |
61 | mov.l .L24,r1\n\ | |
62 | add r0,r1\n\ | |
a54e8d33 UD |
63 | jsr @r1\n\ |
64 | mov r15,r14\n\ | |
65 | bra 1f\n\ | |
66 | nop\n\ | |
67 | .align 2\n\ | |
68 | .L22:\n\ | |
69 | .long _GLOBAL_OFFSET_TABLE_\n\ | |
a54e8d33 UD |
70 | .L24:\n\ |
71 | .long __pthread_initialize_minimal_internal@PLT\n\ | |
72 | 1:\n\ | |
73 | ALIGN\n\ | |
74 | END_INIT\n\ | |
75 | \n\ | |
76 | /*@_init_PROLOG_ENDS*/\n\ | |
77 | \n\ | |
78 | /*@_init_EPILOG_BEGINS*/\n\ | |
79 | .section .init\n\ | |
80 | mov r14,r15\n\ | |
81 | lds.l @r15+,pr\n\ | |
82 | mov.l @r15+,r14\n\ | |
83 | rts \n\ | |
84 | mov.l @r15+,r12\n\ | |
85 | END_INIT\n\ | |
a54e8d33 UD |
86 | \n\ |
87 | /*@_init_EPILOG_ENDS*/\n\ | |
88 | \n\ | |
89 | /*@_fini_PROLOG_BEGINS*/\n\ | |
90 | .section .fini\n\ | |
91 | .align 5\n\ | |
92 | .global _fini\n\ | |
93 | .type _fini,@function\n\ | |
94 | _fini:\n\ | |
95 | mov.l r12,@-r15\n\ | |
96 | mov.l r14,@-r15\n\ | |
97 | sts.l pr,@-r15\n\ | |
98 | mova .L27,r0\n\ | |
99 | mov.l .L27,r12\n\ | |
100 | add r0,r12\n\ | |
101 | mov r15,r14\n\ | |
102 | ALIGN\n\ | |
103 | END_FINI\n\ | |
104 | bra 1f\n\ | |
105 | nop\n\ | |
106 | .align 2\n\ | |
107 | .L27:\n\ | |
108 | .long _GLOBAL_OFFSET_TABLE_\n\ | |
109 | 1:\n\ | |
110 | /*@_fini_PROLOG_ENDS*/\n\ | |
111 | \n\ | |
112 | /*@_fini_EPILOG_BEGINS*/\n\ | |
113 | .section .fini\n\ | |
114 | mov r14,r15\n\ | |
115 | lds.l @r15+,pr\n\ | |
116 | mov.l @r15+,r14\n\ | |
117 | rts \n\ | |
118 | mov.l @r15+,r12\n\ | |
119 | \n\ | |
120 | END_FINI\n\ | |
121 | \n\ | |
122 | /*@_fini_EPILOG_ENDS*/\n\ | |
123 | \n\ | |
124 | /*@TRAILER_BEGINS*/\n\ | |
125 | "); |