diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2008-06-12 17:19:06 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-16 01:00:52 -0400 |
commit | 143580ecfb7999147e546cc3814023e233e95fa5 (patch) | |
tree | 5ba519c2be2fb19a5ced64743eba075e1bd61b1d /arch/powerpc/boot | |
parent | 305c73687157d677bee6f2a5dbee438d844a028c (diff) |
[POWERPC] Fix bootwrapper 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 bootwrapper as we'd need to link with libgcc to get the
implementation of the register save/restores.
To workaround this issue, we just stole the save/restore code from gcc
and simplified it down for our needs (integer only).
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r-- | arch/powerpc/boot/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/boot/crtsavres.S | 233 |
2 files changed, 234 insertions, 1 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index d53b84e761a9..1cee2f9fdf06 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -51,7 +51,7 @@ $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ | |||
51 | $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) | 51 | $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) |
52 | 52 | ||
53 | src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c | 53 | src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c |
54 | src-wlib := string.S crt0.S stdio.c main.c \ | 54 | src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ |
55 | $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ | 55 | $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ |
56 | ns16550.c serial.c simple_alloc.c div64.S util.S \ | 56 | ns16550.c serial.c simple_alloc.c div64.S util.S \ |
57 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ | 57 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ |
diff --git a/arch/powerpc/boot/crtsavres.S b/arch/powerpc/boot/crtsavres.S new file mode 100644 index 000000000000..f3d9b35c07d4 --- /dev/null +++ b/arch/powerpc/boot/crtsavres.S | |||
@@ -0,0 +1,233 @@ | |||
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 | .file "crtsavres.S" | ||
41 | .section ".text" | ||
42 | |||
43 | /* On PowerPC64 Linux, these functions are provided by the linker. */ | ||
44 | #ifndef __powerpc64__ | ||
45 | |||
46 | #define _GLOBAL(name) \ | ||
47 | .type name,@function; \ | ||
48 | .globl name; \ | ||
49 | name: | ||
50 | |||
51 | /* Routines for saving integer registers, called by the compiler. */ | ||
52 | /* Called with r11 pointing to the stack header word of the caller of the */ | ||
53 | /* function, just beyond the end of the integer save area. */ | ||
54 | |||
55 | _GLOBAL(_savegpr_14) | ||
56 | _GLOBAL(_save32gpr_14) | ||
57 | stw 14,-72(11) /* save gp registers */ | ||
58 | _GLOBAL(_savegpr_15) | ||
59 | _GLOBAL(_save32gpr_15) | ||
60 | stw 15,-68(11) | ||
61 | _GLOBAL(_savegpr_16) | ||
62 | _GLOBAL(_save32gpr_16) | ||
63 | stw 16,-64(11) | ||
64 | _GLOBAL(_savegpr_17) | ||
65 | _GLOBAL(_save32gpr_17) | ||
66 | stw 17,-60(11) | ||
67 | _GLOBAL(_savegpr_18) | ||
68 | _GLOBAL(_save32gpr_18) | ||
69 | stw 18,-56(11) | ||
70 | _GLOBAL(_savegpr_19) | ||
71 | _GLOBAL(_save32gpr_19) | ||
72 | stw 19,-52(11) | ||
73 | _GLOBAL(_savegpr_20) | ||
74 | _GLOBAL(_save32gpr_20) | ||
75 | stw 20,-48(11) | ||
76 | _GLOBAL(_savegpr_21) | ||
77 | _GLOBAL(_save32gpr_21) | ||
78 | stw 21,-44(11) | ||
79 | _GLOBAL(_savegpr_22) | ||
80 | _GLOBAL(_save32gpr_22) | ||
81 | stw 22,-40(11) | ||
82 | _GLOBAL(_savegpr_23) | ||
83 | _GLOBAL(_save32gpr_23) | ||
84 | stw 23,-36(11) | ||
85 | _GLOBAL(_savegpr_24) | ||
86 | _GLOBAL(_save32gpr_24) | ||
87 | stw 24,-32(11) | ||
88 | _GLOBAL(_savegpr_25) | ||
89 | _GLOBAL(_save32gpr_25) | ||
90 | stw 25,-28(11) | ||
91 | _GLOBAL(_savegpr_26) | ||
92 | _GLOBAL(_save32gpr_26) | ||
93 | stw 26,-24(11) | ||
94 | _GLOBAL(_savegpr_27) | ||
95 | _GLOBAL(_save32gpr_27) | ||
96 | stw 27,-20(11) | ||
97 | _GLOBAL(_savegpr_28) | ||
98 | _GLOBAL(_save32gpr_28) | ||
99 | stw 28,-16(11) | ||
100 | _GLOBAL(_savegpr_29) | ||
101 | _GLOBAL(_save32gpr_29) | ||
102 | stw 29,-12(11) | ||
103 | _GLOBAL(_savegpr_30) | ||
104 | _GLOBAL(_save32gpr_30) | ||
105 | stw 30,-8(11) | ||
106 | _GLOBAL(_savegpr_31) | ||
107 | _GLOBAL(_save32gpr_31) | ||
108 | stw 31,-4(11) | ||
109 | blr | ||
110 | |||
111 | /* Routines for restoring integer registers, called by the compiler. */ | ||
112 | /* Called with r11 pointing to the stack header word of the caller of the */ | ||
113 | /* function, just beyond the end of the integer restore area. */ | ||
114 | |||
115 | _GLOBAL(_restgpr_14) | ||
116 | _GLOBAL(_rest32gpr_14) | ||
117 | lwz 14,-72(11) /* restore gp registers */ | ||
118 | _GLOBAL(_restgpr_15) | ||
119 | _GLOBAL(_rest32gpr_15) | ||
120 | lwz 15,-68(11) | ||
121 | _GLOBAL(_restgpr_16) | ||
122 | _GLOBAL(_rest32gpr_16) | ||
123 | lwz 16,-64(11) | ||
124 | _GLOBAL(_restgpr_17) | ||
125 | _GLOBAL(_rest32gpr_17) | ||
126 | lwz 17,-60(11) | ||
127 | _GLOBAL(_restgpr_18) | ||
128 | _GLOBAL(_rest32gpr_18) | ||
129 | lwz 18,-56(11) | ||
130 | _GLOBAL(_restgpr_19) | ||
131 | _GLOBAL(_rest32gpr_19) | ||
132 | lwz 19,-52(11) | ||
133 | _GLOBAL(_restgpr_20) | ||
134 | _GLOBAL(_rest32gpr_20) | ||
135 | lwz 20,-48(11) | ||
136 | _GLOBAL(_restgpr_21) | ||
137 | _GLOBAL(_rest32gpr_21) | ||
138 | lwz 21,-44(11) | ||
139 | _GLOBAL(_restgpr_22) | ||
140 | _GLOBAL(_rest32gpr_22) | ||
141 | lwz 22,-40(11) | ||
142 | _GLOBAL(_restgpr_23) | ||
143 | _GLOBAL(_rest32gpr_23) | ||
144 | lwz 23,-36(11) | ||
145 | _GLOBAL(_restgpr_24) | ||
146 | _GLOBAL(_rest32gpr_24) | ||
147 | lwz 24,-32(11) | ||
148 | _GLOBAL(_restgpr_25) | ||
149 | _GLOBAL(_rest32gpr_25) | ||
150 | lwz 25,-28(11) | ||
151 | _GLOBAL(_restgpr_26) | ||
152 | _GLOBAL(_rest32gpr_26) | ||
153 | lwz 26,-24(11) | ||
154 | _GLOBAL(_restgpr_27) | ||
155 | _GLOBAL(_rest32gpr_27) | ||
156 | lwz 27,-20(11) | ||
157 | _GLOBAL(_restgpr_28) | ||
158 | _GLOBAL(_rest32gpr_28) | ||
159 | lwz 28,-16(11) | ||
160 | _GLOBAL(_restgpr_29) | ||
161 | _GLOBAL(_rest32gpr_29) | ||
162 | lwz 29,-12(11) | ||
163 | _GLOBAL(_restgpr_30) | ||
164 | _GLOBAL(_rest32gpr_30) | ||
165 | lwz 30,-8(11) | ||
166 | _GLOBAL(_restgpr_31) | ||
167 | _GLOBAL(_rest32gpr_31) | ||
168 | lwz 31,-4(11) | ||
169 | blr | ||
170 | |||
171 | /* Routines for restoring integer registers, called by the compiler. */ | ||
172 | /* Called with r11 pointing to the stack header word of the caller of the */ | ||
173 | /* function, just beyond the end of the integer restore area. */ | ||
174 | |||
175 | _GLOBAL(_restgpr_14_x) | ||
176 | _GLOBAL(_rest32gpr_14_x) | ||
177 | lwz 14,-72(11) /* restore gp registers */ | ||
178 | _GLOBAL(_restgpr_15_x) | ||
179 | _GLOBAL(_rest32gpr_15_x) | ||
180 | lwz 15,-68(11) | ||
181 | _GLOBAL(_restgpr_16_x) | ||
182 | _GLOBAL(_rest32gpr_16_x) | ||
183 | lwz 16,-64(11) | ||
184 | _GLOBAL(_restgpr_17_x) | ||
185 | _GLOBAL(_rest32gpr_17_x) | ||
186 | lwz 17,-60(11) | ||
187 | _GLOBAL(_restgpr_18_x) | ||
188 | _GLOBAL(_rest32gpr_18_x) | ||
189 | lwz 18,-56(11) | ||
190 | _GLOBAL(_restgpr_19_x) | ||
191 | _GLOBAL(_rest32gpr_19_x) | ||
192 | lwz 19,-52(11) | ||
193 | _GLOBAL(_restgpr_20_x) | ||
194 | _GLOBAL(_rest32gpr_20_x) | ||
195 | lwz 20,-48(11) | ||
196 | _GLOBAL(_restgpr_21_x) | ||
197 | _GLOBAL(_rest32gpr_21_x) | ||
198 | lwz 21,-44(11) | ||
199 | _GLOBAL(_restgpr_22_x) | ||
200 | _GLOBAL(_rest32gpr_22_x) | ||
201 | lwz 22,-40(11) | ||
202 | _GLOBAL(_restgpr_23_x) | ||
203 | _GLOBAL(_rest32gpr_23_x) | ||
204 | lwz 23,-36(11) | ||
205 | _GLOBAL(_restgpr_24_x) | ||
206 | _GLOBAL(_rest32gpr_24_x) | ||
207 | lwz 24,-32(11) | ||
208 | _GLOBAL(_restgpr_25_x) | ||
209 | _GLOBAL(_rest32gpr_25_x) | ||
210 | lwz 25,-28(11) | ||
211 | _GLOBAL(_restgpr_26_x) | ||
212 | _GLOBAL(_rest32gpr_26_x) | ||
213 | lwz 26,-24(11) | ||
214 | _GLOBAL(_restgpr_27_x) | ||
215 | _GLOBAL(_rest32gpr_27_x) | ||
216 | lwz 27,-20(11) | ||
217 | _GLOBAL(_restgpr_28_x) | ||
218 | _GLOBAL(_rest32gpr_28_x) | ||
219 | lwz 28,-16(11) | ||
220 | _GLOBAL(_restgpr_29_x) | ||
221 | _GLOBAL(_rest32gpr_29_x) | ||
222 | lwz 29,-12(11) | ||
223 | _GLOBAL(_restgpr_30_x) | ||
224 | _GLOBAL(_rest32gpr_30_x) | ||
225 | lwz 30,-8(11) | ||
226 | _GLOBAL(_restgpr_31_x) | ||
227 | _GLOBAL(_rest32gpr_31_x) | ||
228 | lwz 0,4(11) | ||
229 | lwz 31,-4(11) | ||
230 | mtlr 0 | ||
231 | mr 1,11 | ||
232 | blr | ||
233 | #endif | ||