aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib/crtsavres.S
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-06-12 17:20:58 -0400
committerPaul Mackerras <paulus@samba.org>2008-06-16 01:00:54 -0400
commitda3de6df33f5f42ff9dc40093fbc884f524c9a49 (patch)
treeb0c5d209cde49e55bdd41b6125ae58918bd31ed5 /arch/powerpc/lib/crtsavres.S
parent143580ecfb7999147e546cc3814023e233e95fa5 (diff)
[POWERPC] Fix -Os kernel builds with newer gcc versions
GCC 4.4.x looks to be adding support for generating out-of-line register saves/restores based on: http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01678.html This breaks the kernel if we enable CONFIG_CC_OPTIMIZE_FOR_SIZE. To fix this we add the use the save/restore code from gcc and simplified it down for our needs (integer only). Additionally, we have to link this code into each module. The other solution was to add EXPORT_SYMBOL() which meant going through the trampoline which seemed nonsensical for these out-of-line routines. Finally, we add some checks to prom_init_check.sh to ignore the out-of-line save/restore functions. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/lib/crtsavres.S')
-rw-r--r--arch/powerpc/lib/crtsavres.S229
1 files changed, 229 insertions, 0 deletions
diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
new file mode 100644
index 000000000000..70a9cd8a3008
--- /dev/null
+++ b/arch/powerpc/lib/crtsavres.S
@@ -0,0 +1,229 @@
1/*
2 * Special support for eabi and SVR4
3 *
4 * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
5 * Copyright 2008 Freescale Semiconductor, Inc.
6 * Written By Michael Meissner
7 *
8 * Based on gcc/config/rs6000/crtsavres.asm from gcc
9 *
10 * This file is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2, or (at your option) any
13 * later version.
14 *
15 * In addition to the permissions in the GNU General Public License, the
16 * Free Software Foundation gives you unlimited permission to link the
17 * compiled version of this file with other programs, and to distribute
18 * those programs without any restriction coming from the use of this
19 * file. (The General Public License restrictions do apply in other
20 * respects; for example, they cover modification of the file, and
21 * distribution when not linked into another program.)
22 *
23 * This file is distributed in the hope that it will be useful, but
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; see the file COPYING. If not, write to
30 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
31 * Boston, MA 02110-1301, USA.
32 *
33 * As a special exception, if you link this library with files
34 * compiled with GCC to produce an executable, this does not cause
35 * the resulting executable to be covered by the GNU General Public License.
36 * This exception does not however invalidate any other reasons why
37 * the executable file might be covered by the GNU General Public License.
38 */
39
40#include <asm/ppc_asm.h>
41
42 .file "crtsavres.S"
43 .section ".text"
44
45#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
46
47/* Routines for saving integer registers, called by the compiler. */
48/* Called with r11 pointing to the stack header word of the caller of the */
49/* function, just beyond the end of the integer save area. */
50
51_GLOBAL(_savegpr_14)
52_GLOBAL(_save32gpr_14)
53 stw 14,-72(11) /* save gp registers */
54_GLOBAL(_savegpr_15)
55_GLOBAL(_save32gpr_15)
56 stw 15,-68(11)
57_GLOBAL(_savegpr_16)
58_GLOBAL(_save32gpr_16)
59 stw 16,-64(11)
60_GLOBAL(_savegpr_17)
61_GLOBAL(_save32gpr_17)
62 stw 17,-60(11)
63_GLOBAL(_savegpr_18)
64_GLOBAL(_save32gpr_18)
65 stw 18,-56(11)
66_GLOBAL(_savegpr_19)
67_GLOBAL(_save32gpr_19)
68 stw 19,-52(11)
69_GLOBAL(_savegpr_20)
70_GLOBAL(_save32gpr_20)
71 stw 20,-48(11)
72_GLOBAL(_savegpr_21)
73_GLOBAL(_save32gpr_21)
74 stw 21,-44(11)
75_GLOBAL(_savegpr_22)
76_GLOBAL(_save32gpr_22)
77 stw 22,-40(11)
78_GLOBAL(_savegpr_23)
79_GLOBAL(_save32gpr_23)
80 stw 23,-36(11)
81_GLOBAL(_savegpr_24)
82_GLOBAL(_save32gpr_24)
83 stw 24,-32(11)
84_GLOBAL(_savegpr_25)
85_GLOBAL(_save32gpr_25)
86 stw 25,-28(11)
87_GLOBAL(_savegpr_26)
88_GLOBAL(_save32gpr_26)
89 stw 26,-24(11)
90_GLOBAL(_savegpr_27)
91_GLOBAL(_save32gpr_27)
92 stw 27,-20(11)
93_GLOBAL(_savegpr_28)
94_GLOBAL(_save32gpr_28)
95 stw 28,-16(11)
96_GLOBAL(_savegpr_29)
97_GLOBAL(_save32gpr_29)
98 stw 29,-12(11)
99_GLOBAL(_savegpr_30)
100_GLOBAL(_save32gpr_30)
101 stw 30,-8(11)
102_GLOBAL(_savegpr_31)
103_GLOBAL(_save32gpr_31)
104 stw 31,-4(11)
105 blr
106
107/* Routines for restoring integer registers, called by the compiler. */
108/* Called with r11 pointing to the stack header word of the caller of the */
109/* function, just beyond the end of the integer restore area. */
110
111_GLOBAL(_restgpr_14)
112_GLOBAL(_rest32gpr_14)
113 lwz 14,-72(11) /* restore gp registers */
114_GLOBAL(_restgpr_15)
115_GLOBAL(_rest32gpr_15)
116 lwz 15,-68(11)
117_GLOBAL(_restgpr_16)
118_GLOBAL(_rest32gpr_16)
119 lwz 16,-64(11)
120_GLOBAL(_restgpr_17)
121_GLOBAL(_rest32gpr_17)
122 lwz 17,-60(11)
123_GLOBAL(_restgpr_18)
124_GLOBAL(_rest32gpr_18)
125 lwz 18,-56(11)
126_GLOBAL(_restgpr_19)
127_GLOBAL(_rest32gpr_19)
128 lwz 19,-52(11)
129_GLOBAL(_restgpr_20)
130_GLOBAL(_rest32gpr_20)
131 lwz 20,-48(11)
132_GLOBAL(_restgpr_21)
133_GLOBAL(_rest32gpr_21)
134 lwz 21,-44(11)
135_GLOBAL(_restgpr_22)
136_GLOBAL(_rest32gpr_22)
137 lwz 22,-40(11)
138_GLOBAL(_restgpr_23)
139_GLOBAL(_rest32gpr_23)
140 lwz 23,-36(11)
141_GLOBAL(_restgpr_24)
142_GLOBAL(_rest32gpr_24)
143 lwz 24,-32(11)
144_GLOBAL(_restgpr_25)
145_GLOBAL(_rest32gpr_25)
146 lwz 25,-28(11)
147_GLOBAL(_restgpr_26)
148_GLOBAL(_rest32gpr_26)
149 lwz 26,-24(11)
150_GLOBAL(_restgpr_27)
151_GLOBAL(_rest32gpr_27)
152 lwz 27,-20(11)
153_GLOBAL(_restgpr_28)
154_GLOBAL(_rest32gpr_28)
155 lwz 28,-16(11)
156_GLOBAL(_restgpr_29)
157_GLOBAL(_rest32gpr_29)
158 lwz 29,-12(11)
159_GLOBAL(_restgpr_30)
160_GLOBAL(_rest32gpr_30)
161 lwz 30,-8(11)
162_GLOBAL(_restgpr_31)
163_GLOBAL(_rest32gpr_31)
164 lwz 31,-4(11)
165 blr
166
167/* Routines for restoring integer registers, called by the compiler. */
168/* Called with r11 pointing to the stack header word of the caller of the */
169/* function, just beyond the end of the integer restore area. */
170
171_GLOBAL(_restgpr_14_x)
172_GLOBAL(_rest32gpr_14_x)
173 lwz 14,-72(11) /* restore gp registers */
174_GLOBAL(_restgpr_15_x)
175_GLOBAL(_rest32gpr_15_x)
176 lwz 15,-68(11)
177_GLOBAL(_restgpr_16_x)
178_GLOBAL(_rest32gpr_16_x)
179 lwz 16,-64(11)
180_GLOBAL(_restgpr_17_x)
181_GLOBAL(_rest32gpr_17_x)
182 lwz 17,-60(11)
183_GLOBAL(_restgpr_18_x)
184_GLOBAL(_rest32gpr_18_x)
185 lwz 18,-56(11)
186_GLOBAL(_restgpr_19_x)
187_GLOBAL(_rest32gpr_19_x)
188 lwz 19,-52(11)
189_GLOBAL(_restgpr_20_x)
190_GLOBAL(_rest32gpr_20_x)
191 lwz 20,-48(11)
192_GLOBAL(_restgpr_21_x)
193_GLOBAL(_rest32gpr_21_x)
194 lwz 21,-44(11)
195_GLOBAL(_restgpr_22_x)
196_GLOBAL(_rest32gpr_22_x)
197 lwz 22,-40(11)
198_GLOBAL(_restgpr_23_x)
199_GLOBAL(_rest32gpr_23_x)
200 lwz 23,-36(11)
201_GLOBAL(_restgpr_24_x)
202_GLOBAL(_rest32gpr_24_x)
203 lwz 24,-32(11)
204_GLOBAL(_restgpr_25_x)
205_GLOBAL(_rest32gpr_25_x)
206 lwz 25,-28(11)
207_GLOBAL(_restgpr_26_x)
208_GLOBAL(_rest32gpr_26_x)
209 lwz 26,-24(11)
210_GLOBAL(_restgpr_27_x)
211_GLOBAL(_rest32gpr_27_x)
212 lwz 27,-20(11)
213_GLOBAL(_restgpr_28_x)
214_GLOBAL(_rest32gpr_28_x)
215 lwz 28,-16(11)
216_GLOBAL(_restgpr_29_x)
217_GLOBAL(_rest32gpr_29_x)
218 lwz 29,-12(11)
219_GLOBAL(_restgpr_30_x)
220_GLOBAL(_rest32gpr_30_x)
221 lwz 30,-8(11)
222_GLOBAL(_restgpr_31_x)
223_GLOBAL(_rest32gpr_31_x)
224 lwz 0,4(11)
225 lwz 31,-4(11)
226 mtlr 0
227 mr 1,11
228 blr
229#endif