Enable C++ for baremetal.
/trunk/scripts/build/cc/gcc.sh | 7 5 2 0 +++++--
/trunk/config/cc.in | 8 2 6 0 ++------
2 files changed, 7 insertions(+), 8 deletions(-)
1 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/Makefile.am gcc/libffi/Makefile.am
2 --- gcc-3.2.2.orig/libffi/Makefile.am Tue Jan 28 10:43:56 2003
3 +++ gcc/libffi/Makefile.am Tue Jan 28 10:48:33 2003
5 src/mips/n32.s src/mips/o32.S src/mips/o32.s \
6 src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S \
7 src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \
8 + src/x86/ffi64.c src/x86/unix64.S \
9 src/alpha/ffi.c src/alpha/osf.S \
10 src/m68k/ffi.c src/m68k/sysv.S \
11 src/powerpc/ffi.c src/powerpc/sysv.S \
12 src/powerpc/ppc_closure.S src/powerpc/asm.h \
13 src/powerpc/ffi_darwin.c \
14 src/powerpc/darwin.S src/powerpc/aix.S \
15 - src/powerpc/darwin_closure.S src/powerpc/aix_closures.S \
16 - src/arm/ffi.c src/arm/sysv.S
17 + src/powerpc/darwin_closure.S src/powerpc/aix_closure.S \
18 + src/arm/ffi.c src/arm/sysv.S \
19 + src/s390/ffi.c src/s390/sysv.S \
20 + src/sh/ffi.c src/sh/sysv.S
22 VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@
25 ffitest_LDFLAGS = -shared-libgcc
27 TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
28 +TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S
29 TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s
30 TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S
31 TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S
33 TARGET_SRC_IA64 = src/ia64/ffi.c src/ia64/unix.S
34 TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S
35 TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
36 -TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closures.S
37 +TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
38 TARGET_SRC_POWERPC_DARWIN = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
39 TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c
40 +TARGET_SRC_S390 = src/s390/sysv.S src/s390/ffi.c
41 +TARGET_SRC_X86_64 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
42 +TARGET_SRC_SH = src/sh/sysv.S src/sh/ffi.c
44 ##libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c $(TARGET_SRC_@TARGET@)
45 ## Work around automake deficiency
47 libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
48 libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
51 +libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
52 +libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
55 libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
56 libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
58 libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
59 libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
62 +libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
63 +libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
66 +libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
67 +libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
70 +libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
71 +libfficonvenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
74 AM_CFLAGS = -fexceptions
76 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/Makefile.in gcc/libffi/Makefile.in
77 --- gcc-3.2.2.orig/libffi/Makefile.in Wed Jan 29 07:59:05 2003
78 +++ gcc/libffi/Makefile.in Wed Jan 29 07:58:58 2003
80 src/mips/n32.s src/mips/o32.S src/mips/o32.s \
81 src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S \
82 src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \
83 + src/x86/ffi64.c src/x86/unix64.S \
84 src/alpha/ffi.c src/alpha/osf.S \
85 src/m68k/ffi.c src/m68k/sysv.S \
86 src/powerpc/ffi.c src/powerpc/sysv.S \
87 src/powerpc/ppc_closure.S src/powerpc/asm.h \
88 src/powerpc/ffi_darwin.c \
89 src/powerpc/darwin.S src/powerpc/aix.S \
90 - src/powerpc/darwin_closure.S src/powerpc/aix_closures.S \
91 - src/arm/ffi.c src/arm/sysv.S
92 + src/powerpc/darwin_closure.S src/powerpc/aix_closure.S \
93 + src/arm/ffi.c src/arm/sysv.S \
94 + src/s390/ffi.c src/s390/sysv.S \
95 + src/sh/ffi.c src/sh/sysv.S
98 VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@
100 ffitest_LDFLAGS = -shared-libgcc
102 TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
103 +TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S
104 TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s
105 TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S
106 TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S
107 @@ -170,14 +174,18 @@
108 TARGET_SRC_IA64 = src/ia64/ffi.c src/ia64/unix.S
109 TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S
110 TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
111 -TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closures.S
112 +TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
113 TARGET_SRC_POWERPC_DARWIN = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
114 TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c
115 +TARGET_SRC_S390 = src/s390/sysv.S src/s390/ffi.c
116 +TARGET_SRC_X86_64 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
117 +TARGET_SRC_SH = src/sh/sysv.S src/sh/ffi.c
119 libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \
120 src/raw_api.c src/java_raw_api.c
122 @MIPS_GCC_TRUE@libffi_la_SOURCES = @MIPS_GCC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
123 +@MIPS_LINUX_TRUE@libffi_la_SOURCES = @MIPS_LINUX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
124 @MIPS_SGI_TRUE@libffi_la_SOURCES = @MIPS_SGI_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
125 @X86_TRUE@libffi_la_SOURCES = @X86_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
126 @X86_WIN32_TRUE@libffi_la_SOURCES = @X86_WIN32_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32)
128 @POWERPC_AIX_TRUE@libffi_la_SOURCES = @POWERPC_AIX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX)
129 @POWERPC_DARWIN_TRUE@libffi_la_SOURCES = @POWERPC_DARWIN_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN)
130 @ARM_TRUE@libffi_la_SOURCES = @ARM_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
131 +@S390_TRUE@libffi_la_SOURCES = @S390_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
132 +@X86_64_TRUE@libffi_la_SOURCES = @X86_64_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
133 +@SH_TRUE@libffi_la_SOURCES = @SH_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
134 @MIPS_GCC_TRUE@libffi_convenience_la_SOURCES = @MIPS_GCC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
135 +@MIPS_LINUX_TRUE@libffi_convenience_la_SOURCES = @MIPS_LINUX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
136 @MIPS_SGI_TRUE@libffi_convenience_la_SOURCES = @MIPS_SGI_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
137 @X86_TRUE@libffi_convenience_la_SOURCES = @X86_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
138 @X86_WIN32_TRUE@libffi_convenience_la_SOURCES = @X86_WIN32_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32)
140 @POWERPC_AIX_TRUE@libffi_convenience_la_SOURCES = @POWERPC_AIX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX)
141 @POWERPC_DARWIN_TRUE@libffi_convenience_la_SOURCES = @POWERPC_DARWIN_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN)
142 @ARM_TRUE@libffi_convenience_la_SOURCES = @ARM_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
143 +@S390_TRUE@libffi_convenience_la_SOURCES = @S390_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
144 +@X86_64_TRUE@libffi_convenience_la_SOURCES = @X86_64_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
145 +@SH_TRUE@libfficonvenience_la_SOURCES = @SH_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
147 AM_CFLAGS = -fexceptions
151 INCLUDES = -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
152 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
153 -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
154 +mkinstalldirs = $(SHELL) $(top_srcdir)/${libffi_basedir}/../mkinstalldirs
155 CONFIG_HEADER = fficonfig.h
157 LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
160 libffi_convenience_la_LDFLAGS =
161 libffi_convenience_la_LIBADD =
162 -@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
163 -@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
164 -@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \
165 -@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo
166 @ALPHA_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
167 @ALPHA_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
168 @ALPHA_TRUE@src/java_raw_api.lo src/alpha/ffi.lo src/alpha/osf.lo
169 @@ -234,12 +245,29 @@
170 @MIPS_GCC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
171 @MIPS_GCC_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \
172 @MIPS_GCC_TRUE@src/mips/n32.lo
173 -@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
174 -@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
175 -@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo
176 +@S390_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
177 +@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
178 +@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo
179 @M68K_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
180 @M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
181 @M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo
182 +@X86_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
183 +@X86_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
184 +@X86_TRUE@src/x86/ffi.lo src/x86/sysv.lo
185 +@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
186 +@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
187 +@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \
188 +@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo
189 +@MIPS_LINUX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
190 +@MIPS_LINUX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
191 +@MIPS_LINUX_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo
192 +@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
193 +@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
194 +@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo
195 +@X86_64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
196 +@X86_64_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
197 +@X86_64_TRUE@src/java_raw_api.lo src/x86/ffi64.lo src/x86/unix64.lo \
198 +@X86_64_TRUE@src/x86/ffi.lo src/x86/sysv.lo
199 @SPARC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
200 @SPARC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
201 @SPARC_TRUE@src/java_raw_api.lo src/sparc/ffi.lo src/sparc/v8.lo \
202 @@ -247,62 +275,75 @@
203 @POWERPC_AIX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
204 @POWERPC_AIX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
205 @POWERPC_AIX_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \
206 -@POWERPC_AIX_TRUE@src/powerpc/aix.lo src/powerpc/aix_closures.lo
207 -@X86_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
208 -@X86_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
209 -@X86_TRUE@src/x86/ffi.lo src/x86/sysv.lo
210 -@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
211 -@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
212 -@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo
213 +@POWERPC_AIX_TRUE@src/powerpc/aix.lo src/powerpc/aix_closure.lo
214 +@MIPS_SGI_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
215 +@MIPS_SGI_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
216 +@MIPS_SGI_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \
217 +@MIPS_SGI_TRUE@src/mips/n32.lo
218 @POWERPC_DARWIN_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
219 @POWERPC_DARWIN_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
220 @POWERPC_DARWIN_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \
221 @POWERPC_DARWIN_TRUE@src/powerpc/darwin.lo \
222 @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo
223 -@MIPS_SGI_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
224 -@MIPS_SGI_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
225 -@MIPS_SGI_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \
226 -@MIPS_SGI_TRUE@src/mips/n32.lo
227 +@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
228 +@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
229 +@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo
230 +@SH_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
231 +@SH_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
232 +@SH_TRUE@src/sh/sysv.lo src/sh/ffi.lo
234 +@SH_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
235 +@SH_TRUE@src/raw_api.lo src/java_raw_api.lo src/sh/sysv.lo \
236 +@SH_TRUE@src/sh/ffi.lo
237 +@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
238 +@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
239 +@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo
240 +@X86_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
241 +@X86_TRUE@src/raw_api.lo src/java_raw_api.lo src/x86/ffi.lo \
242 +@X86_TRUE@src/x86/sysv.lo
243 @POWERPC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
244 @POWERPC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
245 @POWERPC_TRUE@src/powerpc/ffi.lo src/powerpc/sysv.lo \
246 @POWERPC_TRUE@src/powerpc/ppc_closure.lo
247 -@ALPHA_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
248 -@ALPHA_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
249 -@ALPHA_TRUE@src/alpha/ffi.lo src/alpha/osf.lo
250 -@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
251 -@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
252 -@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo
253 -@MIPS_GCC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
254 -@MIPS_GCC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
255 -@MIPS_GCC_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
256 -@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
257 -@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
258 -@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo
259 -@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
260 -@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
261 -@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo
262 +@MIPS_LINUX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
263 +@MIPS_LINUX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
264 +@MIPS_LINUX_TRUE@src/mips/ffi.lo src/mips/o32.lo
265 @SPARC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
266 @SPARC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
267 @SPARC_TRUE@src/sparc/ffi.lo src/sparc/v8.lo src/sparc/v9.lo
268 @POWERPC_AIX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
269 @POWERPC_AIX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
270 @POWERPC_AIX_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/aix.lo \
271 -@POWERPC_AIX_TRUE@src/powerpc/aix_closures.lo
272 -@X86_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
273 -@X86_TRUE@src/raw_api.lo src/java_raw_api.lo src/x86/ffi.lo \
274 -@X86_TRUE@src/x86/sysv.lo
275 +@POWERPC_AIX_TRUE@src/powerpc/aix_closure.lo
276 +@MIPS_SGI_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
277 +@MIPS_SGI_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
278 +@MIPS_SGI_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
279 @ARM_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
280 @ARM_TRUE@src/raw_api.lo src/java_raw_api.lo src/arm/sysv.lo \
281 @ARM_TRUE@src/arm/ffi.lo
282 +@ALPHA_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
283 +@ALPHA_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
284 +@ALPHA_TRUE@src/alpha/ffi.lo src/alpha/osf.lo
285 +@MIPS_GCC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
286 +@MIPS_GCC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
287 +@MIPS_GCC_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
288 +@S390_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
289 +@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
290 +@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo
291 +@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
292 +@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
293 +@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo
294 +@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
295 +@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
296 +@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo
297 +@X86_64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
298 +@X86_64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
299 +@X86_64_TRUE@src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffi.lo \
300 +@X86_64_TRUE@src/x86/sysv.lo
301 @POWERPC_DARWIN_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
302 @POWERPC_DARWIN_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
303 @POWERPC_DARWIN_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/darwin.lo \
304 @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo
305 -@MIPS_SGI_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
306 -@MIPS_SGI_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
307 -@MIPS_SGI_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
308 noinst_PROGRAMS = ffitest$(EXEEXT)
309 PROGRAMS = $(noinst_PROGRAMS)
312 -chmod 777 $(distdir)
313 $(mkinstalldirs) $(distdir)/src/alpha $(distdir)/src/arm \
314 $(distdir)/src/m68k $(distdir)/src/mips \
315 - $(distdir)/src/powerpc $(distdir)/src/sparc \
317 + $(distdir)/src/powerpc $(distdir)/src/s390 $(distdir)/src/sh \
318 + $(distdir)/src/sparc $(distdir)/src/x86
319 @for file in $(DISTFILES); do \
320 if test -f $$file; then d=.; else d=$(srcdir); fi; \
321 if test -d $$d/$$file; then \
322 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/acinclude.m4 gcc/libffi/acinclude.m4
323 --- gcc-3.2.2.orig/libffi/acinclude.m4 Sun Sep 10 16:43:14 2000
324 +++ gcc/libffi/acinclude.m4 Tue Dec 17 03:22:47 2002
326 dnl to add a definition of LIBTOOL to Makefile.in.
328 AC_DEFUN([AC_PROG_LIBTOOL],)
329 +AC_DEFUN([AM_PROG_LIBTOOL],)
333 +sinclude(../config/accross.m4)
334 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/aclocal.m4 gcc/libffi/aclocal.m4
335 --- gcc-3.2.2.orig/libffi/aclocal.m4 Fri Feb 1 07:25:31 2002
336 +++ gcc/libffi/aclocal.m4 Tue Dec 17 03:22:47 2002
338 -dnl aclocal.m4 generated automatically by aclocal 1.4
339 +dnl aclocal.m4 generated automatically by aclocal 1.4-p5
341 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
342 +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
343 dnl This file is free software; the Free Software Foundation
344 dnl gives unlimited permission to copy and/or distribute it,
345 dnl with or without modifications, as long as this notice is preserved.
347 dnl to add a definition of LIBTOOL to Makefile.in.
349 AC_DEFUN([AC_PROG_LIBTOOL],)
350 +AC_DEFUN([AM_PROG_LIBTOOL],)
354 -AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
355 -[changequote(<<, >>)dnl
356 -dnl The name to #define.
357 -define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
358 -dnl The cache variable name.
359 -define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
360 -changequote([, ])dnl
361 -AC_MSG_CHECKING(size of $1)
362 -AC_CACHE_VAL(AC_CV_NAME,
363 -[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
364 - AC_TRY_COMPILE([#include "confdefs.h"
365 -#include <sys/types.h>
367 -], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
368 - if test x$AC_CV_NAME != x ; then break; fi
371 -if test x$AC_CV_NAME = x ; then
372 - AC_MSG_ERROR([cannot determine a size for $1])
374 -AC_MSG_RESULT($AC_CV_NAME)
375 -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
376 -undefine([AC_TYPE_NAME])dnl
377 -undefine([AC_CV_NAME])dnl
380 -AC_DEFUN([AC_C_BIGENDIAN_CROSS],
381 -[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
382 -[ac_cv_c_bigendian=unknown
383 -# See if sys/param.h defines the BYTE_ORDER macro.
384 -AC_TRY_COMPILE([#include <sys/types.h>
385 -#include <sys/param.h>], [
386 -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
387 - bogus endian macros
388 -#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
389 -AC_TRY_COMPILE([#include <sys/types.h>
390 -#include <sys/param.h>], [
391 -#if BYTE_ORDER != BIG_ENDIAN
393 -#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
394 -if test $ac_cv_c_bigendian = unknown; then
395 -AC_TRY_RUN([main () {
396 - /* Are we little or big endian? From Harbison&Steele. */
400 - char c[sizeof (long)];
403 - exit (u.c[sizeof (long) - 1] == 1);
404 -}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes,
405 -[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ])
407 -if test $ac_cv_c_bigendian = unknown; then
408 -AC_MSG_CHECKING(to probe for byte ordering)
410 -cat >conftest.c <<EOF
411 -short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
412 -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
413 -void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }
414 -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
415 -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
416 -void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }
417 -int main() { _ascii (); _ebcdic (); return 0; }
419 -] if test -f conftest.c ; then
420 - if ${CC-cc} ${CFLAGS} conftest.c -o conftest.o && test -f conftest.o ; then
421 - if test `grep -l BIGenDianSyS conftest.o` ; then
422 - echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG
423 - ac_cv_c_bigendian=yes
425 - if test `grep -l LiTTleEnDian conftest.o` ; then
426 - echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG
427 - if test $ac_cv_c_bigendian = yes ; then
428 - ac_cv_c_bigendian=unknown;
430 - ac_cv_c_bigendian=no
433 - echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG
436 -AC_MSG_RESULT($ac_cv_c_bigendian)
438 -if test $ac_cv_c_bigendian = yes; then
439 - AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian])
444 -AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN])
445 -if test $ac_cv_c_bigendian = unknown; then
446 - AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian)
449 +sinclude(../config/accross.m4)
451 # Like AC_CONFIG_HEADER, but automatically create stamp file.
453 -AC_DEFUN(AM_CONFIG_HEADER,
454 +AC_DEFUN([AM_CONFIG_HEADER],
456 AC_CONFIG_HEADER([$1])
457 dnl When config.status generates a header, we must update the stamp-h file.
460 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
462 -AC_DEFUN(AM_INIT_AUTOMAKE,
463 +AC_DEFUN([AM_INIT_AUTOMAKE],
464 [AC_REQUIRE([AC_PROG_INSTALL])
468 # Check to make sure that the build environment is sane.
471 -AC_DEFUN(AM_SANITY_CHECK,
472 +AC_DEFUN([AM_SANITY_CHECK],
473 [AC_MSG_CHECKING([whether build environment is sane])
478 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
479 dnl The program must properly implement --version.
480 -AC_DEFUN(AM_MISSING_PROG,
481 +AC_DEFUN([AM_MISSING_PROG],
482 [AC_MSG_CHECKING(for working $2)
483 # Run test in a subshell; some versions of sh will print an error if
484 # an executable is not found, even if stderr is redirected.
489 -AC_DEFUN(AM_MAINTAINER_MODE,
490 +AC_DEFUN([AM_MAINTAINER_MODE],
491 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
492 dnl maintainer-mode is disabled by default
493 AC_ARG_ENABLE(maintainer-mode,
496 # Define a conditional.
498 -AC_DEFUN(AM_CONDITIONAL,
499 +AC_DEFUN([AM_CONDITIONAL],
503 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/configure gcc/libffi/configure
504 --- gcc-3.2.2.orig/libffi/configure Wed Jan 29 07:59:05 2003
505 +++ gcc/libffi/configure Sat Feb 1 20:16:19 2003
506 @@ -633,17 +633,16 @@
508 if test "${srcdir}" = "."; then
509 if test "${with_target_subdir}" != "."; then
510 - libffi_basedir="${srcdir}/${with_multisrctop}.."
511 + libffi_basedir="${with_multisrctop}../"
513 - libffi_basedir="${srcdir}/${with_multisrctop}"
514 + libffi_basedir="${with_multisrctop}"
517 - libffi_basedir="${srcdir}"
523 -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
524 +for ac_dir in ${libffi_basedir}.. $srcdir/${libffi_basedir}..; do
525 if test -f $ac_dir/install-sh; then
527 ac_install_sh="$ac_aux_dir/install-sh -c"
528 @@ -655,13 +654,14 @@
531 if test -z "$ac_aux_dir"; then
532 - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
533 + { echo "configure: error: can not find install-sh or install.sh in ${libffi_basedir}.. $srcdir/${libffi_basedir}.." 1>&2; exit 1; }
535 ac_config_guess=$ac_aux_dir/config.guess
536 ac_config_sub=$ac_aux_dir/config.sub
537 ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
541 # Make sure we can run config.sub.
542 if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
543 else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
544 @@ -1238,9 +1238,18 @@
548 - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
549 - lt_cv_file_magic_cmd=/usr/bin/file
550 - lt_cv_file_magic_test_file=/usr/lib/libc.sl
553 + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
554 + lt_cv_file_magic_cmd=/usr/bin/file
555 + lt_cv_file_magic_test_file=/usr/lib/libc.sl
558 + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
559 + lt_cv_file_magic_cmd=/usr/bin/file
560 + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
566 @@ -1267,7 +1276,7 @@
567 # This must be Linux ELF.
570 - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
571 + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* )
572 lt_cv_deplibs_check_method=pass_all ;;
574 # glibc up to 2.1.1 does not perform some relocations on ARM
575 @@ -1330,13 +1339,13 @@
576 deplibs_check_method=$lt_cv_deplibs_check_method
578 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
579 -echo "configure:1334: checking for object suffix" >&5
580 +echo "configure:1343: checking for object suffix" >&5
581 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
582 echo $ac_n "(cached) $ac_c" 1>&6
585 echo 'int i = 1;' > conftest.$ac_ext
586 -if { (eval echo configure:1340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
587 +if { (eval echo configure:1349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
588 for ac_file in conftest.*; do
591 @@ -1356,7 +1365,7 @@
594 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
595 -echo "configure:1360: checking for executable suffix" >&5
596 +echo "configure:1369: checking for executable suffix" >&5
597 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
598 echo $ac_n "(cached) $ac_c" 1>&6
600 @@ -1366,7 +1375,7 @@
602 echo 'int main () { return 0; }' > conftest.$ac_ext
604 - if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
605 + if { (eval echo configure:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
606 for file in conftest.*; do
608 *.c | *.o | *.obj) ;;
609 @@ -1399,7 +1408,7 @@
611 if test "$file_magic_cmd" = '$MAGIC_CMD'; then
612 echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
613 -echo "configure:1403: checking for ${ac_tool_prefix}file" >&5
614 +echo "configure:1412: checking for ${ac_tool_prefix}file" >&5
615 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
616 echo $ac_n "(cached) $ac_c" 1>&6
618 @@ -1461,7 +1470,7 @@
619 if test -z "$lt_cv_path_MAGIC_CMD"; then
620 if test -n "$ac_tool_prefix"; then
621 echo $ac_n "checking for file""... $ac_c" 1>&6
622 -echo "configure:1465: checking for file" >&5
623 +echo "configure:1474: checking for file" >&5
624 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
625 echo $ac_n "(cached) $ac_c" 1>&6
627 @@ -1532,7 +1541,7 @@
628 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
629 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
630 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
631 -echo "configure:1536: checking for $ac_word" >&5
632 +echo "configure:1545: checking for $ac_word" >&5
633 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
634 echo $ac_n "(cached) $ac_c" 1>&6
636 @@ -1564,7 +1573,7 @@
637 # Extract the first word of "ranlib", so it can be a program name with args.
638 set dummy ranlib; ac_word=$2
639 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
640 -echo "configure:1568: checking for $ac_word" >&5
641 +echo "configure:1577: checking for $ac_word" >&5
642 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
643 echo $ac_n "(cached) $ac_c" 1>&6
645 @@ -1599,7 +1608,7 @@
646 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
647 set dummy ${ac_tool_prefix}strip; ac_word=$2
648 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
649 -echo "configure:1603: checking for $ac_word" >&5
650 +echo "configure:1612: checking for $ac_word" >&5
651 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
652 echo $ac_n "(cached) $ac_c" 1>&6
654 @@ -1631,7 +1640,7 @@
655 # Extract the first word of "strip", so it can be a program name with args.
656 set dummy strip; ac_word=$2
657 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
658 -echo "configure:1635: checking for $ac_word" >&5
659 +echo "configure:1644: checking for $ac_word" >&5
660 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
661 echo $ac_n "(cached) $ac_c" 1>&6
663 @@ -1698,8 +1707,8 @@
666 # Find out which ABI we are using.
667 - echo '#line 1702 "configure"' > conftest.$ac_ext
668 - if { (eval echo configure:1703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
669 + echo '#line 1711 "configure"' > conftest.$ac_ext
670 + if { (eval echo configure:1712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
671 case `/usr/bin/file conftest.$ac_objext` in
674 @@ -1715,12 +1724,70 @@
679 + # Find out which ABI we are using.
680 + echo 'int i;' > conftest.$ac_ext
681 + if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
682 + case "`/usr/bin/file conftest.o`" in
684 + HPUX_IA64_MODE="32"
687 + HPUX_IA64_MODE="64"
694 +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
695 + # Find out which ABI we are using.
696 + echo 'int i;' > conftest.$ac_ext
697 + if { (eval echo configure:1747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
698 + case "`/usr/bin/file conftest.o`" in
702 + LD="${LD-ld} -m elf_i386"
705 + LD="${LD-ld} -m elf32ppclinux"
708 + LD="${LD-ld} -m elf_s390"
711 + LD="${LD-ld} -m elf32_sparc"
718 + LD="${LD-ld} -m elf_x86_64"
720 + ppc*-*linux*|powerpc*-*linux*)
721 + LD="${LD-ld} -m elf64ppc"
724 + LD="${LD-ld} -m elf64_s390"
727 + LD="${LD-ld} -m elf64_sparc"
737 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
738 SAVE_CFLAGS="$CFLAGS"
739 CFLAGS="$CFLAGS -belf"
740 echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
741 -echo "configure:1724: checking whether the C compiler needs -belf" >&5
742 +echo "configure:1791: checking whether the C compiler needs -belf" >&5
743 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
744 echo $ac_n "(cached) $ac_c" 1>&6
746 @@ -1733,14 +1800,14 @@
747 cross_compiling=$ac_cv_prog_cc_cross
749 cat > conftest.$ac_ext <<EOF
750 -#line 1737 "configure"
751 +#line 1804 "configure"
752 #include "confdefs.h"
758 -if { (eval echo configure:1744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
759 +if { (eval echo configure:1811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
761 lt_cv_cc_needs_belf=yes
763 @@ -1868,7 +1935,7 @@
764 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
765 # ./install, which can be erroneously created by make from ./install.sh.
766 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
767 -echo "configure:1872: checking for a BSD compatible install" >&5
768 +echo "configure:1939: checking for a BSD compatible install" >&5
769 if test -z "$INSTALL"; then
770 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
771 echo $ac_n "(cached) $ac_c" 1>&6
772 @@ -1921,7 +1988,7 @@
773 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
775 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
776 -echo "configure:1925: checking whether build environment is sane" >&5
777 +echo "configure:1992: checking whether build environment is sane" >&5
780 echo timestamp > conftestfile
781 @@ -1978,7 +2045,7 @@
782 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
784 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
785 -echo "configure:1982: checking whether ${MAKE-make} sets \${MAKE}" >&5
786 +echo "configure:2049: checking whether ${MAKE-make} sets \${MAKE}" >&5
787 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
788 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
789 echo $ac_n "(cached) $ac_c" 1>&6
790 @@ -2017,7 +2084,7 @@
792 missing_dir=`cd $ac_aux_dir && pwd`
793 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
794 -echo "configure:2021: checking for working aclocal" >&5
795 +echo "configure:2088: checking for working aclocal" >&5
796 # Run test in a subshell; some versions of sh will print an error if
797 # an executable is not found, even if stderr is redirected.
798 # Redirect stdin to placate older versions of autoconf. Sigh.
799 @@ -2030,7 +2097,7 @@
802 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
803 -echo "configure:2034: checking for working autoconf" >&5
804 +echo "configure:2101: checking for working autoconf" >&5
805 # Run test in a subshell; some versions of sh will print an error if
806 # an executable is not found, even if stderr is redirected.
807 # Redirect stdin to placate older versions of autoconf. Sigh.
808 @@ -2043,7 +2110,7 @@
811 echo $ac_n "checking for working automake""... $ac_c" 1>&6
812 -echo "configure:2047: checking for working automake" >&5
813 +echo "configure:2114: checking for working automake" >&5
814 # Run test in a subshell; some versions of sh will print an error if
815 # an executable is not found, even if stderr is redirected.
816 # Redirect stdin to placate older versions of autoconf. Sigh.
817 @@ -2056,7 +2123,7 @@
820 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
821 -echo "configure:2060: checking for working autoheader" >&5
822 +echo "configure:2127: checking for working autoheader" >&5
823 # Run test in a subshell; some versions of sh will print an error if
824 # an executable is not found, even if stderr is redirected.
825 # Redirect stdin to placate older versions of autoconf. Sigh.
826 @@ -2069,7 +2136,7 @@
829 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
830 -echo "configure:2073: checking for working makeinfo" >&5
831 +echo "configure:2140: checking for working makeinfo" >&5
832 # Run test in a subshell; some versions of sh will print an error if
833 # an executable is not found, even if stderr is redirected.
834 # Redirect stdin to placate older versions of autoconf. Sigh.
835 @@ -2086,7 +2153,7 @@
838 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
839 -echo "configure:2090: checking for executable suffix" >&5
840 +echo "configure:2157: checking for executable suffix" >&5
841 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
842 echo $ac_n "(cached) $ac_c" 1>&6
844 @@ -2096,7 +2163,7 @@
846 echo 'int main () { return 0; }' > conftest.$ac_ext
848 - if { (eval echo configure:2100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
849 + if { (eval echo configure:2167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
850 for file in conftest.*; do
852 *.c | *.o | *.obj) ;;
853 @@ -2117,7 +2184,7 @@
856 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
857 -echo "configure:2121: checking whether to enable maintainer-specific portions of Makefiles" >&5
858 +echo "configure:2188: checking whether to enable maintainer-specific portions of Makefiles" >&5
859 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
860 if test "${enable_maintainer_mode+set}" = set; then
861 enableval="$enable_maintainer_mode"
862 @@ -2143,7 +2210,7 @@
863 # Extract the first word of "gcc", so it can be a program name with args.
864 set dummy gcc; ac_word=$2
865 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
866 -echo "configure:2147: checking for $ac_word" >&5
867 +echo "configure:2214: checking for $ac_word" >&5
868 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
869 echo $ac_n "(cached) $ac_c" 1>&6
871 @@ -2173,7 +2240,7 @@
872 # Extract the first word of "cc", so it can be a program name with args.
873 set dummy cc; ac_word=$2
874 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
875 -echo "configure:2177: checking for $ac_word" >&5
876 +echo "configure:2244: checking for $ac_word" >&5
877 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
878 echo $ac_n "(cached) $ac_c" 1>&6
880 @@ -2224,7 +2291,7 @@
881 # Extract the first word of "cl", so it can be a program name with args.
882 set dummy cl; ac_word=$2
883 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
884 -echo "configure:2228: checking for $ac_word" >&5
885 +echo "configure:2295: checking for $ac_word" >&5
886 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
887 echo $ac_n "(cached) $ac_c" 1>&6
889 @@ -2256,7 +2323,7 @@
892 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
893 -echo "configure:2260: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
894 +echo "configure:2327: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
897 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
898 @@ -2267,12 +2334,12 @@
900 cat > conftest.$ac_ext << EOF
902 -#line 2271 "configure"
903 +#line 2338 "configure"
904 #include "confdefs.h"
908 -if { (eval echo configure:2276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
909 +if { (eval echo configure:2343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
910 ac_cv_prog_cc_works=yes
911 # If we can't run a trivial program, we are probably using a cross compiler.
912 if (./conftest; exit) 2>/dev/null; then
913 @@ -2298,12 +2365,12 @@
914 { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
916 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
917 -echo "configure:2302: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
918 +echo "configure:2369: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
919 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
920 cross_compiling=$ac_cv_prog_cc_cross
922 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
923 -echo "configure:2307: checking whether we are using GNU C" >&5
924 +echo "configure:2374: checking whether we are using GNU C" >&5
925 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
926 echo $ac_n "(cached) $ac_c" 1>&6
928 @@ -2312,7 +2379,7 @@
932 -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2316: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
933 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
937 @@ -2331,7 +2398,7 @@
938 ac_save_CFLAGS="$CFLAGS"
940 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
941 -echo "configure:2335: checking whether ${CC-cc} accepts -g" >&5
942 +echo "configure:2402: checking whether ${CC-cc} accepts -g" >&5
943 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
944 echo $ac_n "(cached) $ac_c" 1>&6
946 @@ -2381,17 +2448,23 @@
947 i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;;
948 sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;;
949 sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;;
950 -sparc-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
951 -sparc64-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
952 -alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd*) TARGET=ALPHA; TARGETDIR=alpha;;
953 +sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;;
954 +sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;;
955 +alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;;
956 ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
957 m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;;
959 +mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;;
960 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
961 powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
962 powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;;
963 powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
964 rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
965 arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;;
966 +s390-*-linux-*) TARGET=S390; TARGETDIR=s390;;
967 +s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
968 +x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
969 +sh-*-linux* | sh[34]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
972 if test $TARGETDIR = unknown; then
973 @@ -2418,6 +2491,15 @@
977 +if test x$TARGET = xMIPS_LINUX; then
979 + MIPS_LINUX_FALSE='#'
981 + MIPS_LINUX_TRUE='#'
986 if test x$TARGET = xSPARC; then
989 @@ -2507,8 +2589,39 @@
994 +if test x$TARGET = xS390; then
1003 +if test x$TARGET = xX86_64; then
1012 +if test x$TARGET = xSH; then
1020 +if test x$TARGET = xMIPS_LINUX; then
1024 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
1025 -echo "configure:2512: checking how to run the C preprocessor" >&5
1026 +echo "configure:2625: checking how to run the C preprocessor" >&5
1027 # On Suns, sometimes $CPP names a directory.
1028 if test -n "$CPP" && test -d "$CPP"; then
1030 @@ -2523,13 +2636,13 @@
1031 # On the NeXT, cc -E runs the code through the compiler's parser,
1032 # not just through cpp.
1033 cat > conftest.$ac_ext <<EOF
1034 -#line 2527 "configure"
1035 +#line 2640 "configure"
1036 #include "confdefs.h"
1040 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1041 -{ (eval echo configure:2533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1042 +{ (eval echo configure:2646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1043 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1044 if test -z "$ac_err"; then
1046 @@ -2540,13 +2653,13 @@
1048 CPP="${CC-cc} -E -traditional-cpp"
1049 cat > conftest.$ac_ext <<EOF
1050 -#line 2544 "configure"
1051 +#line 2657 "configure"
1052 #include "confdefs.h"
1056 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1057 -{ (eval echo configure:2550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1058 +{ (eval echo configure:2663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1059 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1060 if test -z "$ac_err"; then
1062 @@ -2557,13 +2670,13 @@
1064 CPP="${CC-cc} -nologo -E"
1065 cat > conftest.$ac_ext <<EOF
1066 -#line 2561 "configure"
1067 +#line 2674 "configure"
1068 #include "confdefs.h"
1072 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1073 -{ (eval echo configure:2567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1074 +{ (eval echo configure:2680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1075 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1076 if test -z "$ac_err"; then
1078 @@ -2588,12 +2701,12 @@
1079 echo "$ac_t""$CPP" 1>&6
1081 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
1082 -echo "configure:2592: checking for ANSI C header files" >&5
1083 +echo "configure:2705: checking for ANSI C header files" >&5
1084 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
1085 echo $ac_n "(cached) $ac_c" 1>&6
1087 cat > conftest.$ac_ext <<EOF
1088 -#line 2597 "configure"
1089 +#line 2710 "configure"
1090 #include "confdefs.h"
1093 @@ -2601,7 +2714,7 @@
1096 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1097 -{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1098 +{ (eval echo configure:2718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1099 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1100 if test -z "$ac_err"; then
1102 @@ -2618,7 +2731,7 @@
1103 if test $ac_cv_header_stdc = yes; then
1104 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
1105 cat > conftest.$ac_ext <<EOF
1106 -#line 2622 "configure"
1107 +#line 2735 "configure"
1108 #include "confdefs.h"
1111 @@ -2636,7 +2749,7 @@
1112 if test $ac_cv_header_stdc = yes; then
1113 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
1114 cat > conftest.$ac_ext <<EOF
1115 -#line 2640 "configure"
1116 +#line 2753 "configure"
1117 #include "confdefs.h"
1120 @@ -2657,7 +2770,7 @@
1123 cat > conftest.$ac_ext <<EOF
1124 -#line 2661 "configure"
1125 +#line 2774 "configure"
1126 #include "confdefs.h"
1128 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
1129 @@ -2668,7 +2781,7 @@
1133 -if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1134 +if { (eval echo configure:2785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1138 @@ -2694,12 +2807,12 @@
1139 for ac_func in memcpy
1141 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1142 -echo "configure:2698: checking for $ac_func" >&5
1143 +echo "configure:2811: checking for $ac_func" >&5
1144 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1145 echo $ac_n "(cached) $ac_c" 1>&6
1147 cat > conftest.$ac_ext <<EOF
1148 -#line 2703 "configure"
1149 +#line 2816 "configure"
1150 #include "confdefs.h"
1151 /* System header to define __stub macros and hopefully few prototypes,
1152 which can conflict with char $ac_func(); below. */
1153 @@ -2722,7 +2835,7 @@
1157 -if { (eval echo configure:2726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1158 +if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1160 eval "ac_cv_func_$ac_func=yes"
1162 @@ -2749,19 +2862,19 @@
1163 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
1164 # for constant arguments. Useless!
1165 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
1166 -echo "configure:2753: checking for working alloca.h" >&5
1167 +echo "configure:2866: checking for working alloca.h" >&5
1168 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
1169 echo $ac_n "(cached) $ac_c" 1>&6
1171 cat > conftest.$ac_ext <<EOF
1172 -#line 2758 "configure"
1173 +#line 2871 "configure"
1174 #include "confdefs.h"
1177 char *p = alloca(2 * sizeof(int));
1180 -if { (eval echo configure:2765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1181 +if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1183 ac_cv_header_alloca_h=yes
1185 @@ -2782,12 +2895,12 @@
1188 echo $ac_n "checking for alloca""... $ac_c" 1>&6
1189 -echo "configure:2786: checking for alloca" >&5
1190 +echo "configure:2899: checking for alloca" >&5
1191 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
1192 echo $ac_n "(cached) $ac_c" 1>&6
1194 cat > conftest.$ac_ext <<EOF
1195 -#line 2791 "configure"
1196 +#line 2904 "configure"
1197 #include "confdefs.h"
1200 @@ -2815,7 +2928,7 @@
1201 char *p = (char *) alloca(1);
1204 -if { (eval echo configure:2819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1205 +if { (eval echo configure:2932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1207 ac_cv_func_alloca_works=yes
1209 @@ -2847,12 +2960,12 @@
1212 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
1213 -echo "configure:2851: checking whether alloca needs Cray hooks" >&5
1214 +echo "configure:2964: checking whether alloca needs Cray hooks" >&5
1215 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
1216 echo $ac_n "(cached) $ac_c" 1>&6
1218 cat > conftest.$ac_ext <<EOF
1219 -#line 2856 "configure"
1220 +#line 2969 "configure"
1221 #include "confdefs.h"
1222 #if defined(CRAY) && ! defined(CRAY2)
1224 @@ -2877,12 +2990,12 @@
1225 if test $ac_cv_os_cray = yes; then
1226 for ac_func in _getb67 GETB67 getb67; do
1227 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1228 -echo "configure:2881: checking for $ac_func" >&5
1229 +echo "configure:2994: checking for $ac_func" >&5
1230 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1231 echo $ac_n "(cached) $ac_c" 1>&6
1233 cat > conftest.$ac_ext <<EOF
1234 -#line 2886 "configure"
1235 +#line 2999 "configure"
1236 #include "confdefs.h"
1237 /* System header to define __stub macros and hopefully few prototypes,
1238 which can conflict with char $ac_func(); below. */
1239 @@ -2905,7 +3018,7 @@
1243 -if { (eval echo configure:2909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1244 +if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1246 eval "ac_cv_func_$ac_func=yes"
1248 @@ -2932,7 +3045,7 @@
1251 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
1252 -echo "configure:2936: checking stack direction for C alloca" >&5
1253 +echo "configure:3049: checking stack direction for C alloca" >&5
1254 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
1255 echo $ac_n "(cached) $ac_c" 1>&6
1257 @@ -2940,7 +3053,7 @@
1258 ac_cv_c_stack_direction=0
1260 cat > conftest.$ac_ext <<EOF
1261 -#line 2944 "configure"
1262 +#line 3057 "configure"
1263 #include "confdefs.h"
1264 find_stack_direction ()
1266 @@ -2959,7 +3072,7 @@
1267 exit (find_stack_direction() < 0);
1270 -if { (eval echo configure:2963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1271 +if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1273 ac_cv_c_stack_direction=1
1275 @@ -2982,13 +3095,13 @@
1278 echo $ac_n "checking size of short""... $ac_c" 1>&6
1279 -echo "configure:2986: checking size of short" >&5
1280 +echo "configure:3099: checking size of short" >&5
1281 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
1282 echo $ac_n "(cached) $ac_c" 1>&6
1284 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1285 cat > conftest.$ac_ext <<EOF
1286 -#line 2992 "configure"
1287 +#line 3105 "configure"
1288 #include "confdefs.h"
1289 #include "confdefs.h"
1290 #include <sys/types.h>
1291 @@ -2998,7 +3111,7 @@
1292 switch (0) case 0: case (sizeof (short) == $ac_size):;
1295 -if { (eval echo configure:3002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1296 +if { (eval echo configure:3115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1298 ac_cv_sizeof_short=$ac_size
1300 @@ -3021,13 +3134,13 @@
1303 echo $ac_n "checking size of int""... $ac_c" 1>&6
1304 -echo "configure:3025: checking size of int" >&5
1305 +echo "configure:3138: checking size of int" >&5
1306 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
1307 echo $ac_n "(cached) $ac_c" 1>&6
1309 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1310 cat > conftest.$ac_ext <<EOF
1311 -#line 3031 "configure"
1312 +#line 3144 "configure"
1313 #include "confdefs.h"
1314 #include "confdefs.h"
1315 #include <sys/types.h>
1316 @@ -3037,7 +3150,7 @@
1317 switch (0) case 0: case (sizeof (int) == $ac_size):;
1320 -if { (eval echo configure:3041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1321 +if { (eval echo configure:3154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1323 ac_cv_sizeof_int=$ac_size
1325 @@ -3060,13 +3173,13 @@
1328 echo $ac_n "checking size of long""... $ac_c" 1>&6
1329 -echo "configure:3064: checking size of long" >&5
1330 +echo "configure:3177: checking size of long" >&5
1331 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
1332 echo $ac_n "(cached) $ac_c" 1>&6
1334 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1335 cat > conftest.$ac_ext <<EOF
1336 -#line 3070 "configure"
1337 +#line 3183 "configure"
1338 #include "confdefs.h"
1339 #include "confdefs.h"
1340 #include <sys/types.h>
1341 @@ -3076,7 +3189,7 @@
1342 switch (0) case 0: case (sizeof (long) == $ac_size):;
1345 -if { (eval echo configure:3080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1346 +if { (eval echo configure:3193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1348 ac_cv_sizeof_long=$ac_size
1350 @@ -3099,13 +3212,13 @@
1353 echo $ac_n "checking size of long long""... $ac_c" 1>&6
1354 -echo "configure:3103: checking size of long long" >&5
1355 +echo "configure:3216: checking size of long long" >&5
1356 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
1357 echo $ac_n "(cached) $ac_c" 1>&6
1359 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1360 cat > conftest.$ac_ext <<EOF
1361 -#line 3109 "configure"
1362 +#line 3222 "configure"
1363 #include "confdefs.h"
1364 #include "confdefs.h"
1365 #include <sys/types.h>
1366 @@ -3115,7 +3228,7 @@
1367 switch (0) case 0: case (sizeof (long long) == $ac_size):;
1370 -if { (eval echo configure:3119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1371 +if { (eval echo configure:3232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1373 ac_cv_sizeof_long_long=$ac_size
1375 @@ -3138,13 +3251,13 @@
1378 echo $ac_n "checking size of float""... $ac_c" 1>&6
1379 -echo "configure:3142: checking size of float" >&5
1380 +echo "configure:3255: checking size of float" >&5
1381 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then
1382 echo $ac_n "(cached) $ac_c" 1>&6
1384 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1385 cat > conftest.$ac_ext <<EOF
1386 -#line 3148 "configure"
1387 +#line 3261 "configure"
1388 #include "confdefs.h"
1389 #include "confdefs.h"
1390 #include <sys/types.h>
1391 @@ -3154,7 +3267,7 @@
1392 switch (0) case 0: case (sizeof (float) == $ac_size):;
1395 -if { (eval echo configure:3158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1396 +if { (eval echo configure:3271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1398 ac_cv_sizeof_float=$ac_size
1400 @@ -3177,13 +3290,13 @@
1403 echo $ac_n "checking size of double""... $ac_c" 1>&6
1404 -echo "configure:3181: checking size of double" >&5
1405 +echo "configure:3294: checking size of double" >&5
1406 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then
1407 echo $ac_n "(cached) $ac_c" 1>&6
1409 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1410 cat > conftest.$ac_ext <<EOF
1411 -#line 3187 "configure"
1412 +#line 3300 "configure"
1413 #include "confdefs.h"
1414 #include "confdefs.h"
1415 #include <sys/types.h>
1416 @@ -3193,7 +3306,7 @@
1417 switch (0) case 0: case (sizeof (double) == $ac_size):;
1420 -if { (eval echo configure:3197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1421 +if { (eval echo configure:3310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1423 ac_cv_sizeof_double=$ac_size
1425 @@ -3216,13 +3329,13 @@
1428 echo $ac_n "checking size of long double""... $ac_c" 1>&6
1429 -echo "configure:3220: checking size of long double" >&5
1430 +echo "configure:3333: checking size of long double" >&5
1431 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
1432 echo $ac_n "(cached) $ac_c" 1>&6
1434 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1435 cat > conftest.$ac_ext <<EOF
1436 -#line 3226 "configure"
1437 +#line 3339 "configure"
1438 #include "confdefs.h"
1439 #include "confdefs.h"
1440 #include <sys/types.h>
1441 @@ -3232,7 +3345,7 @@
1442 switch (0) case 0: case (sizeof (long double) == $ac_size):;
1445 -if { (eval echo configure:3236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1446 +if { (eval echo configure:3349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1448 ac_cv_sizeof_long_double=$ac_size
1450 @@ -3256,13 +3369,13 @@
1453 echo $ac_n "checking size of void *""... $ac_c" 1>&6
1454 -echo "configure:3260: checking size of void *" >&5
1455 +echo "configure:3373: checking size of void *" >&5
1456 if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
1457 echo $ac_n "(cached) $ac_c" 1>&6
1459 for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1460 cat > conftest.$ac_ext <<EOF
1461 -#line 3266 "configure"
1462 +#line 3379 "configure"
1463 #include "confdefs.h"
1464 #include "confdefs.h"
1465 #include <sys/types.h>
1466 @@ -3272,7 +3385,7 @@
1467 switch (0) case 0: case (sizeof (void *) == $ac_size):;
1470 -if { (eval echo configure:3276: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1471 +if { (eval echo configure:3389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1473 ac_cv_sizeof_void_p=$ac_size
1475 @@ -3295,14 +3408,14 @@
1478 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
1479 -echo "configure:3299: checking whether byte ordering is bigendian" >&5
1480 +echo "configure:3412: checking whether byte ordering is bigendian" >&5
1481 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
1482 echo $ac_n "(cached) $ac_c" 1>&6
1484 ac_cv_c_bigendian=unknown
1485 # See if sys/param.h defines the BYTE_ORDER macro.
1486 cat > conftest.$ac_ext <<EOF
1487 -#line 3306 "configure"
1488 +#line 3419 "configure"
1489 #include "confdefs.h"
1490 #include <sys/types.h>
1491 #include <sys/param.h>
1492 @@ -3313,11 +3426,11 @@
1496 -if { (eval echo configure:3317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1497 +if { (eval echo configure:3430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1499 # It does; now see whether it defined to BIG_ENDIAN or not.
1500 cat > conftest.$ac_ext <<EOF
1501 -#line 3321 "configure"
1502 +#line 3434 "configure"
1503 #include "confdefs.h"
1504 #include <sys/types.h>
1505 #include <sys/param.h>
1506 @@ -3328,7 +3441,7 @@
1510 -if { (eval echo configure:3332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1511 +if { (eval echo configure:3445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1513 ac_cv_c_bigendian=yes
1515 @@ -3348,7 +3461,7 @@
1516 echo $ac_n "cross-compiling... " 2>&6
1518 cat > conftest.$ac_ext <<EOF
1519 -#line 3352 "configure"
1520 +#line 3465 "configure"
1521 #include "confdefs.h"
1523 /* Are we little or big endian? From Harbison&Steele. */
1524 @@ -3361,7 +3474,7 @@
1525 exit (u.c[sizeof (long) - 1] == 1);
1528 -if { (eval echo configure:3365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1529 +if { (eval echo configure:3478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1531 ac_cv_c_bigendian=no
1533 @@ -3379,7 +3492,7 @@
1534 echo "$ac_t""$ac_cv_c_bigendian" 1>&6
1535 if test $ac_cv_c_bigendian = unknown; then
1536 echo $ac_n "checking to probe for byte ordering""... $ac_c" 1>&6
1537 -echo "configure:3383: checking to probe for byte ordering" >&5
1538 +echo "configure:3496: checking to probe for byte ordering" >&5
1540 cat >conftest.c <<EOF
1541 short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
1542 @@ -3414,6 +3527,10 @@
1543 #define WORDS_BIGENDIAN 1
1546 + cat >> confdefs.h <<\EOF
1547 +#define HOST_WORDS_BIG_ENDIAN 1
1553 @@ -3429,7 +3546,7 @@
1555 if test x$TARGET = xSPARC; then
1556 echo $ac_n "checking assembler and linker support unaligned pc related relocs""... $ac_c" 1>&6
1557 -echo "configure:3433: checking assembler and linker support unaligned pc related relocs" >&5
1558 +echo "configure:3550: checking assembler and linker support unaligned pc related relocs" >&5
1559 if eval "test \"`echo '$''{'libffi_cv_as_sparc_ua_pcrel'+set}'`\" = set"; then
1560 echo $ac_n "(cached) $ac_c" 1>&6
1562 @@ -3439,14 +3556,14 @@
1563 CFLAGS="$CFLAGS -fpic"
1564 LDFLAGS="$LDFLAGS -shared"
1565 cat > conftest.$ac_ext <<EOF
1566 -#line 3443 "configure"
1567 +#line 3560 "configure"
1568 #include "confdefs.h"
1569 asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");
1574 -if { (eval echo configure:3450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1575 +if { (eval echo configure:3567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1577 libffi_cv_as_sparc_ua_pcrel=yes
1579 @@ -3709,6 +3826,8 @@
1580 s%@MIPS_GCC_FALSE@%$MIPS_GCC_FALSE%g
1581 s%@MIPS_SGI_TRUE@%$MIPS_SGI_TRUE%g
1582 s%@MIPS_SGI_FALSE@%$MIPS_SGI_FALSE%g
1583 +s%@MIPS_LINUX_TRUE@%$MIPS_LINUX_TRUE%g
1584 +s%@MIPS_LINUX_FALSE@%$MIPS_LINUX_FALSE%g
1585 s%@SPARC_TRUE@%$SPARC_TRUE%g
1586 s%@SPARC_FALSE@%$SPARC_FALSE%g
1587 s%@X86_TRUE@%$X86_TRUE%g
1588 @@ -3729,6 +3848,12 @@
1589 s%@POWERPC_DARWIN_FALSE@%$POWERPC_DARWIN_FALSE%g
1590 s%@ARM_TRUE@%$ARM_TRUE%g
1591 s%@ARM_FALSE@%$ARM_FALSE%g
1592 +s%@S390_TRUE@%$S390_TRUE%g
1593 +s%@S390_FALSE@%$S390_FALSE%g
1594 +s%@X86_64_TRUE@%$X86_64_TRUE%g
1595 +s%@X86_64_FALSE@%$X86_64_FALSE%g
1596 +s%@SH_TRUE@%$SH_TRUE%g
1597 +s%@SH_FALSE@%$SH_FALSE%g
1599 s%@ALLOCA@%$ALLOCA%g
1600 s%@TARGET@%$TARGET%g
1601 @@ -3969,7 +4094,7 @@
1603 if test -n "$CONFIG_FILES"; then
1604 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
1605 - ac_file=Makefile . ${libffi_basedir}/../config-ml.in
1606 + ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in
1610 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/configure.in gcc/libffi/configure.in
1611 --- gcc-3.2.2.orig/libffi/configure.in Tue Jan 28 10:43:56 2003
1612 +++ gcc/libffi/configure.in Sat Feb 1 20:16:19 2003
1615 if test "${srcdir}" = "."; then
1616 if test "${with_target_subdir}" != "."; then
1617 - libffi_basedir="${srcdir}/${with_multisrctop}.."
1618 + libffi_basedir="${with_multisrctop}../"
1620 - libffi_basedir="${srcdir}/${with_multisrctop}"
1621 + libffi_basedir="${with_multisrctop}"
1624 - libffi_basedir="${srcdir}"
1627 AC_SUBST(libffi_basedir)
1628 +AC_CONFIG_AUX_DIR(${libffi_basedir}..)
1633 i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;;
1634 sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;;
1635 sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;;
1636 -sparc-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
1637 -sparc64-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
1638 -alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd*) TARGET=ALPHA; TARGETDIR=alpha;;
1639 +sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;;
1640 +sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;;
1641 +alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;;
1642 ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
1643 m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;;
1645 +mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;;
1646 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
1647 powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
1648 powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;;
1649 powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
1650 rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
1651 arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;;
1652 +s390-*-linux-*) TARGET=S390; TARGETDIR=s390;;
1653 +s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
1654 +x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
1655 +sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
1658 if test $TARGETDIR = unknown; then
1661 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
1662 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
1663 +AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX)
1664 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
1665 AM_CONDITIONAL(X86, test x$TARGET = xX86)
1666 AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
1668 AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
1669 AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
1670 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
1671 +AM_CONDITIONAL(S390, test x$TARGET = xS390)
1672 +AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
1673 +AM_CONDITIONAL(SH, test x$TARGET = xSH)
1675 +if test x$TARGET = xMIPS_LINUX; then
1680 AC_CHECK_FUNCS(memcpy)
1683 if test -n "$CONFIG_FILES"; then
1684 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
1685 - ac_file=Makefile . ${libffi_basedir}/../config-ml.in
1686 + ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in
1690 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/include/Makefile.in gcc/libffi/include/Makefile.in
1691 --- gcc-3.2.2.orig/libffi/include/Makefile.in Tue Oct 9 14:32:16 2001
1692 +++ gcc/libffi/include/Makefile.in Mon Apr 29 13:14:44 2002
1695 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
1702 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/include/ffi.h.in gcc/libffi/include/ffi.h.in
1703 --- gcc-3.2.2.orig/libffi/include/ffi.h.in Wed Mar 13 07:35:56 2002
1704 +++ gcc/libffi/include/ffi.h.in Wed Jan 29 00:54:28 2003
1706 /* -----------------------------------------------------------------*-C-*-
1707 - libffi @VERSION@ - Copyright (c) 1996-2002 Cygnus Solutions
1708 + libffi @VERSION@ - Copyright (c) 1996-2003 Cygnus Solutions
1710 Permission is hereby granted, free of charge, to any person obtaining
1711 a copy of this software and associated documentation files (the
1712 @@ -164,6 +164,12 @@
1717 +#if defined (__s390x__)
1724 /* ---- Generic type definitions ----------------------------------------- */
1725 @@ -189,16 +195,23 @@
1729 - /* ---- Intel x86 ---------------- */
1731 + /* ---- Intel x86 Win32 ---------- */
1735 + /* TODO: Add fastcall support for the sake of completeness */
1736 FFI_DEFAULT_ABI = FFI_SYSV,
1739 - /* ---- Intel x86 Win32 ---------- */
1741 + /* ---- Intel x86 and AMD x86-64 - */
1742 +#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
1744 + FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */
1746 FFI_DEFAULT_ABI = FFI_SYSV,
1748 + FFI_DEFAULT_ABI = FFI_UNIX64,
1752 /* ---- Intel ia64 ---------------- */
1753 @@ -251,6 +264,18 @@
1754 FFI_DEFAULT_ABI = FFI_SYSV,
1757 + /* ---- S390 --------------------- */
1760 + FFI_DEFAULT_ABI = FFI_SYSV,
1763 + /* ---- SuperH ------------------- */
1766 + FFI_DEFAULT_ABI = FFI_SYSV,
1769 /* Leave this for debugging purposes */
1773 /*@null@*/ struct _ffi_type **elements;
1776 -/* These are defined in ffi.c */
1777 +/* These are defined in types.c */
1778 extern ffi_type ffi_type_void;
1779 extern ffi_type ffi_type_uint8;
1780 extern ffi_type ffi_type_sint8;
1781 @@ -373,13 +398,7 @@
1783 /* ---- Definitions for closures ----------------------------------------- */
1787 -#define FFI_CLOSURES 1 /* x86 supports closures */
1788 -#define FFI_TRAMPOLINE_SIZE 10
1789 -#define FFI_NATIVE_RAW_API 1 /* and has native raw api support */
1791 -#elif defined(X86_WIN32)
1794 #define FFI_CLOSURES 1 /* x86 supports closures */
1795 #define FFI_TRAMPOLINE_SIZE 10
1796 @@ -424,6 +443,40 @@
1797 #define FFI_TRAMPOLINE_SIZE 24 /* see struct below */
1798 #define FFI_NATIVE_RAW_API 0
1800 +#elif defined(SPARC64)
1802 +#define FFI_CLOSURES 1
1803 +#define FFI_TRAMPOLINE_SIZE 24
1804 +#define FFI_NATIVE_RAW_API 0
1806 +#elif defined(SPARC)
1808 +#define FFI_CLOSURES 1
1809 +#define FFI_TRAMPOLINE_SIZE 16
1810 +#define FFI_NATIVE_RAW_API 0
1812 +#elif defined(S390)
1814 +#define FFI_CLOSURES 1
1816 +#define FFI_TRAMPOLINE_SIZE 32
1818 +#define FFI_TRAMPOLINE_SIZE 16
1820 +#define FFI_NATIVE_RAW_API 0
1824 +#define FFI_CLOSURES 1
1825 +#define FFI_TRAMPOLINE_SIZE 16
1826 +#define FFI_NATIVE_RAW_API 0
1828 +#elif defined(__x86_64__)
1830 +#define FFI_CLOSURES 1
1831 +#define FFI_TRAMPOLINE_SIZE 24
1832 +#define FFI_NATIVE_RAW_API 0
1836 #define FFI_CLOSURES 0
1837 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/arm/ffi.c gcc/libffi/src/arm/ffi.c
1838 --- gcc-3.2.2.orig/libffi/src/arm/ffi.c Sat Mar 3 07:21:23 2001
1839 +++ gcc/libffi/src/arm/ffi.c Fri Jul 19 08:08:30 2002
1843 register unsigned int i;
1845 - register unsigned int avn;
1846 register void **p_argv;
1847 register char *argp;
1848 register ffi_type **p_arg;
1853 if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) {
1858 - avn = ecif->cif->nargs;
1859 p_argv = ecif->avalue;
1861 for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
1862 - (i != 0) && (avn != 0);
1868 argp = (char *) ALIGN(argp, (*p_arg)->alignment);
1875 if (z < sizeof(int))
1885 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/arm/sysv.S gcc/libffi/src/arm/sysv.S
1886 --- gcc-3.2.2.orig/libffi/src/arm/sysv.S Sat Mar 3 07:21:23 2001
1887 +++ gcc/libffi/src/arm/sysv.S Mon Sep 30 03:08:58 2002
1889 #ifdef HAVE_MACHINE_ASM_H
1890 #include <machine/asm.h>
1892 -/* XXX these lose for some platforms, I'm sure. */
1893 +#ifdef __USER_LABEL_PREFIX__
1894 +#define CONCAT1(a, b) CONCAT2(a, b)
1895 +#define CONCAT2(a, b) a ## b
1897 +/* Use the right prefix for global labels. */
1898 +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
1902 #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
1905 @@ -96,12 +103,20 @@
1908 cmp a4, #FFI_TYPE_FLOAT
1916 # return DOUBLE or LONGDOUBLE
1917 cmp a4, #FFI_TYPE_DOUBLE
1919 + stmeqia a3, {a1, a2}
1925 ldmfd sp!, {a1-a4, fp, pc}
1926 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/java_raw_api.c gcc/libffi/src/java_raw_api.c
1927 --- gcc-3.2.2.orig/libffi/src/java_raw_api.c Tue Apr 9 07:31:14 2002
1928 +++ gcc/libffi/src/java_raw_api.c Tue Oct 8 23:55:02 2002
1931 case FFI_TYPE_UINT8:
1932 case FFI_TYPE_SINT8:
1933 - *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 1);
1934 + *args = (void*) ((char*)(raw++) + 3);
1937 case FFI_TYPE_UINT16:
1938 case FFI_TYPE_SINT16:
1939 - *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 2);
1940 + *args = (void*) ((char*)(raw++) + 2);
1943 -#if SIZEOF_ARG >= 4
1944 - case FFI_TYPE_UINT32:
1945 - case FFI_TYPE_SINT32:
1946 - *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 4);
1951 case FFI_TYPE_UINT64:
1952 case FFI_TYPE_SINT64:
1953 @@ -157,31 +150,54 @@
1954 switch ((*tp)->type)
1956 case FFI_TYPE_UINT8:
1957 +#if WORDS_BIGENDIAN
1958 + *(UINT32*)(raw++) = *(UINT8*) (*args);
1960 (raw++)->uint = *(UINT8*) (*args);
1964 case FFI_TYPE_SINT8:
1965 +#if WORDS_BIGENDIAN
1966 + *(SINT32*)(raw++) = *(SINT8*) (*args);
1968 (raw++)->sint = *(SINT8*) (*args);
1972 case FFI_TYPE_UINT16:
1973 +#if WORDS_BIGENDIAN
1974 + *(UINT32*)(raw++) = *(UINT16*) (*args);
1976 (raw++)->uint = *(UINT16*) (*args);
1980 case FFI_TYPE_SINT16:
1981 +#if WORDS_BIGENDIAN
1982 + *(SINT32*)(raw++) = *(SINT16*) (*args);
1984 (raw++)->sint = *(SINT16*) (*args);
1988 -#if SIZEOF_ARG >= 4
1989 case FFI_TYPE_UINT32:
1990 +#if WORDS_BIGENDIAN
1991 + *(UINT32*)(raw++) = *(UINT32*) (*args);
1993 (raw++)->uint = *(UINT32*) (*args);
1997 case FFI_TYPE_SINT32:
1998 +#if WORDS_BIGENDIAN
1999 + *(SINT32*)(raw++) = *(SINT32*) (*args);
2001 (raw++)->sint = *(SINT32*) (*args);
2004 - case FFI_TYPE_FLOAT:
2007 + case FFI_TYPE_FLOAT:
2008 (raw++)->flt = *(FLOAT32*) (*args);
2011 @@ -211,6 +227,55 @@
2013 #if !FFI_NATIVE_RAW_API
2016 +ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
2018 +#if WORDS_BIGENDIAN && SIZEOF_ARG == 8
2019 + switch (cif->rtype->type)
2021 + case FFI_TYPE_UINT8:
2022 + case FFI_TYPE_UINT16:
2023 + case FFI_TYPE_UINT32:
2024 + *(UINT64 *)rvalue <<= 32;
2027 + case FFI_TYPE_SINT8:
2028 + case FFI_TYPE_SINT16:
2029 + case FFI_TYPE_SINT32:
2030 + case FFI_TYPE_INT:
2031 + *(SINT64 *)rvalue <<= 32;
2041 +ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
2043 +#if WORDS_BIGENDIAN && SIZEOF_ARG == 8
2044 + switch (cif->rtype->type)
2046 + case FFI_TYPE_UINT8:
2047 + case FFI_TYPE_UINT16:
2048 + case FFI_TYPE_UINT32:
2049 + *(UINT64 *)rvalue >>= 32;
2052 + case FFI_TYPE_SINT8:
2053 + case FFI_TYPE_SINT16:
2054 + case FFI_TYPE_SINT32:
2055 + case FFI_TYPE_INT:
2056 + *(SINT64 *)rvalue >>= 32;
2065 /* This is a generic definition of ffi_raw_call, to be used if the
2066 * native system does not provide a machine-specific implementation.
2068 void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
2069 ffi_java_raw_to_ptrarray (cif, raw, avalue);
2070 ffi_call (cif, fn, rvalue, avalue);
2071 + ffi_java_rvalue_to_raw (cif, rvalue);
2074 #if FFI_CLOSURES /* base system provides closures */
2077 ffi_java_ptrarray_to_raw (cif, avalue, raw);
2078 (*cl->fun) (cif, rvalue, raw, cl->user_data);
2079 + ffi_java_raw_to_rvalue (cif, rvalue);
2082 /* Again, here is the generic version of ffi_prep_raw_closure, which
2083 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/m68k/ffi.c gcc/libffi/src/m68k/ffi.c
2084 --- gcc-3.2.2.orig/libffi/src/m68k/ffi.c Sun Aug 8 22:27:19 1999
2085 +++ gcc/libffi/src/m68k/ffi.c Fri Jul 19 08:08:30 2002
2087 ffi_prep_args (void *stack, extended_cif *ecif)
2095 void *struct_value_ptr;
2100 if (ecif->cif->rtype->type == FFI_TYPE_STRUCT
2103 struct_value_ptr = NULL;
2105 - avn = ecif->cif->nargs;
2106 p_argv = ecif->avalue;
2108 for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
2109 - i != 0 && avn != 0;
2115 if (((*p_arg)->alignment - 1) & (unsigned) argp)
2116 argp = (char *) ALIGN (argp, (*p_arg)->alignment);
2122 if (z < sizeof (int))
2125 memcpy (argp, *p_argv, z);
2131 return struct_value_ptr;
2132 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/mips/ffi.c gcc/libffi/src/mips/ffi.c
2133 --- gcc-3.2.2.orig/libffi/src/mips/ffi.c Sat Mar 3 07:21:23 2001
2134 +++ gcc/libffi/src/mips/ffi.c Fri Jul 19 08:08:31 2002
2136 OTHER DEALINGS IN THE SOFTWARE.
2137 ----------------------------------------------------------------------- */
2139 +#include <sgidefs.h>
2141 #include <ffi_common.h>
2148 register void **p_argv;
2149 register char *argp;
2150 register ffi_type **p_arg;
2155 - avn = ecif->cif->nargs;
2156 p_argv = ecif->avalue;
2158 - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
2161 + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++)
2166 #define OFFSET sizeof(int)
2173 if (z < sizeof(SLOT_TYPE_UNSIGNED))
2183 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/powerpc/darwin.S gcc/libffi/src/powerpc/darwin.S
2184 --- gcc-3.2.2.orig/libffi/src/powerpc/darwin.S Sat Jan 19 01:22:34 2002
2185 +++ gcc/libffi/src/powerpc/darwin.S Thu Jan 23 03:21:55 2003
2188 PowerPC Assembly glue.
2190 - $Id: darwin.S,v 1.2 2002/01/18 16:22:34 dje Exp $
2192 Permission is hereby granted, free of charge, to any person obtaining
2193 a copy of this software and associated documentation files (the
2194 ``Software''), to deal in the Software without restriction, including
2199 - mr r12,r8 // We only need r12 until the call, so it doesn't have to be saved...
2201 + mr r12,r8 /* We only need r12 until the call,
2202 + so it doesn't have to be saved... */
2204 /* Save the old stack pointer as AP. */
2208 /* Allocate the stack space we need. */
2211 /* Save registers we use. */
2226 /* Save arguments over call... */
2227 - mr r31,r5 /* flags, */
2228 - mr r30,r6 /* rvalue, */
2229 - mr r29,r7 /* function address, */
2230 - mr r28,r8 /* our AP. */
2232 + mr r31,r5 /* flags, */
2233 + mr r30,r6 /* rvalue, */
2234 + mr r29,r7 /* function address, */
2235 + mr r28,r8 /* our AP. */
2237 /* Call ffi_prep_args. */
2241 L(float_return_value):
2243 b L(done_return_value)
2244 -//END(_ffi_call_DARWIN)
2246 +/* END(_ffi_call_DARWIN) */
2248 /* Provide a null definition of _ffi_call_AIX. */
2250 @@ -155,5 +158,61 @@
2254 -//END(_ffi_call_AIX)
2255 +/* END(_ffi_call_AIX) */
2258 +.section __TEXT,__eh_frame
2260 + .set L$set$0,LECIE1-LSCIE1
2261 + .long L$set$0 ; Length of Common Information Entry
2263 + .long 0x0 ; CIE Identifier Tag
2264 + .byte 0x1 ; CIE Version
2265 + .ascii "zR\0" ; CIE Augmentation
2266 + .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
2267 + .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
2268 + .byte 0x41 ; CIE RA Column
2269 + .byte 0x1 ; uleb128 0x1; Augmentation size
2270 + .byte 0x10 ; FDE Encoding (pcrel)
2271 + .byte 0xc ; DW_CFA_def_cfa
2272 + .byte 0x1 ; uleb128 0x1
2273 + .byte 0x0 ; uleb128 0x0
2277 + .set L$set$1,LEFDE1-LASFDE1
2278 + .long L$set$1 ; FDE Length
2280 + .set L$set$2,LASFDE1-Lframe1
2281 + .long L$set$2 ; FDE CIE offset
2282 + .long LFB0-. ; FDE initial location
2283 + .set L$set$3,LFE1-LFB0
2284 + .long L$set$3 ; FDE address range
2285 + .byte 0x0 ; uleb128 0x0; Augmentation size
2286 + .byte 0x4 ; DW_CFA_advance_loc4
2287 + .set L$set$4,LCFI0-LFB1
2289 + .byte 0xd ; DW_CFA_def_cfa_register
2290 + .byte 0x08 ; uleb128 0x08
2291 + .byte 0x4 ; DW_CFA_advance_loc4
2292 + .set L$set$5,LCFI1-LCFI0
2294 + .byte 0x11 ; DW_CFA_offset_extended_sf
2295 + .byte 0x41 ; uleb128 0x41
2296 + .byte 0x7e ; sleb128 -2
2297 + .byte 0x9f ; DW_CFA_offset, column 0x1f
2298 + .byte 0x1 ; uleb128 0x1
2299 + .byte 0x9e ; DW_CFA_offset, column 0x1e
2300 + .byte 0x2 ; uleb128 0x2
2301 + .byte 0x9d ; DW_CFA_offset, column 0x1d
2302 + .byte 0x3 ; uleb128 0x3
2303 + .byte 0x9c ; DW_CFA_offset, column 0x1c
2304 + .byte 0x4 ; uleb128 0x4
2305 + .byte 0x4 ; DW_CFA_advance_loc4
2306 + .set L$set$6,LCFI2-LCFI1
2308 + .byte 0xd ; DW_CFA_def_cfa_register
2309 + .byte 0x1c ; uleb128 0x1c
2313 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/prep_cif.c gcc/libffi/src/prep_cif.c
2314 --- gcc-3.2.2.orig/libffi/src/prep_cif.c Sat Mar 3 07:21:22 2001
2315 +++ gcc/libffi/src/prep_cif.c Mon Sep 30 20:59:42 2002
2317 /* Perform a sanity check on the return type */
2318 FFI_ASSERT(ffi_type_test(cif->rtype));
2321 + /* x86-64 and s390 stack space allocation is handled in prep_machdep. */
2322 +#if !defined M68K && !defined __x86_64__ && !defined S390
2323 /* Make space for the return structure pointer */
2324 if (cif->rtype->type == FFI_TYPE_STRUCT
2327 if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))
2328 return FFI_BAD_TYPEDEF;
2330 +#if !defined __x86_64__ && !defined S390
2332 if (((*ptr)->type == FFI_TYPE_STRUCT
2333 && ((*ptr)->size > 16 || cif->abi != FFI_V9))
2336 bytes += STACK_ARG_SIZE((*ptr)->size);
2342 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/s390/ffi.c gcc/libffi/src/s390/ffi.c
2343 --- gcc-3.2.2.orig/libffi/src/s390/ffi.c Thu Jan 1 09:00:00 1970
2344 +++ gcc/libffi/src/s390/ffi.c Thu Feb 6 08:58:57 2003
2346 +/* -----------------------------------------------------------------------
2347 + ffi.c - Copyright (c) 2000 Software AG
2349 + S390 Foreign Function Interface
2351 + Permission is hereby granted, free of charge, to any person obtaining
2352 + a copy of this software and associated documentation files (the
2353 + ``Software''), to deal in the Software without restriction, including
2354 + without limitation the rights to use, copy, modify, merge, publish,
2355 + distribute, sublicense, and/or sell copies of the Software, and to
2356 + permit persons to whom the Software is furnished to do so, subject to
2357 + the following conditions:
2359 + The above copyright notice and this permission notice shall be included
2360 + in all copies or substantial portions of the Software.
2362 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
2363 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2364 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2365 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
2366 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2367 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2368 + OTHER DEALINGS IN THE SOFTWARE.
2369 + ----------------------------------------------------------------------- */
2370 +/*====================================================================*/
2373 +/*====================================================================*/
2376 +#include <ffi_common.h>
2378 +#include <stdlib.h>
2381 +/*====================== End of Includes =============================*/
2383 +/*====================================================================*/
2386 +/*====================================================================*/
2388 +/* Maximum number of GPRs available for argument passing. */
2389 +#define MAX_GPRARGS 5
2391 +/* Maximum number of FPRs available for argument passing. */
2393 +#define MAX_FPRARGS 4
2395 +#define MAX_FPRARGS 2
2398 +/* Round to multiple of 16. */
2399 +#define ROUND_SIZE(size) (((size) + 15) & ~15)
2401 +/* If these values change, sysv.S must be adapted! */
2402 +#define FFI390_RET_VOID 0
2403 +#define FFI390_RET_STRUCT 1
2404 +#define FFI390_RET_FLOAT 2
2405 +#define FFI390_RET_DOUBLE 3
2406 +#define FFI390_RET_INT32 4
2407 +#define FFI390_RET_INT64 5
2409 +/*===================== End of Defines ===============================*/
2411 +/*====================================================================*/
2414 +/*====================================================================*/
2416 +static void ffi_prep_args (unsigned char *, extended_cif *);
2417 +static int ffi_check_float_struct (ffi_type *);
2419 +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
2420 +__attribute__ ((visibility ("hidden")))
2422 +ffi_closure_helper_SYSV (ffi_closure *, unsigned long *,
2423 + unsigned long long *, unsigned long *);
2425 +/*====================== End of Prototypes ===========================*/
2427 +/*====================================================================*/
2430 +/*====================================================================*/
2432 +extern void ffi_call_SYSV(unsigned,
2434 + void (*)(unsigned char *, extended_cif *),
2439 +extern void ffi_closure_SYSV(void);
2441 +/*====================== End of Externals ============================*/
2443 +/*====================================================================*/
2445 +/* Name - ffi_check_struct_type. */
2447 +/* Function - Determine if a structure can be passed within a */
2448 +/* general purpose or floating point register. */
2450 +/*====================================================================*/
2453 +ffi_check_struct_type (ffi_type *arg)
2455 + size_t size = arg->size;
2457 + /* If the struct has just one element, look at that element
2458 + to find out whether to consider the struct as floating point. */
2459 + while (arg->type == FFI_TYPE_STRUCT
2460 + && arg->elements[0] && !arg->elements[1])
2461 + arg = arg->elements[0];
2463 + /* Structs of size 1, 2, 4, and 8 are passed in registers,
2464 + just like the corresponding int/float types. */
2468 + return FFI_TYPE_UINT8;
2471 + return FFI_TYPE_UINT16;
2474 + if (arg->type == FFI_TYPE_FLOAT)
2475 + return FFI_TYPE_FLOAT;
2477 + return FFI_TYPE_UINT32;
2480 + if (arg->type == FFI_TYPE_DOUBLE)
2481 + return FFI_TYPE_DOUBLE;
2483 + return FFI_TYPE_UINT64;
2489 + /* Other structs are passed via a pointer to the data. */
2490 + return FFI_TYPE_POINTER;
2493 +/*======================== End of Routine ============================*/
2495 +/*====================================================================*/
2497 +/* Name - ffi_prep_args. */
2499 +/* Function - Prepare parameters for call to function. */
2501 +/* ffi_prep_args is called by the assembly routine once stack space */
2502 +/* has been allocated for the function's arguments. */
2504 +/*====================================================================*/
2507 +ffi_prep_args (unsigned char *stack, extended_cif *ecif)
2509 + /* The stack space will be filled with those areas:
2511 + FPR argument register save area (highest addresses)
2512 + GPR argument register save area
2513 + temporary struct copies
2514 + overflow argument area (lowest addresses)
2516 + We set up the following pointers:
2518 + p_fpr: bottom of the FPR area (growing upwards)
2519 + p_gpr: bottom of the GPR area (growing upwards)
2520 + p_ov: bottom of the overflow area (growing upwards)
2521 + p_struct: top of the struct copy area (growing downwards)
2523 + All areas are kept aligned to twice the word size. */
2525 + int gpr_off = ecif->cif->bytes;
2526 + int fpr_off = gpr_off + ROUND_SIZE (MAX_GPRARGS * sizeof (long));
2528 + unsigned long long *p_fpr = (unsigned long long *)(stack + fpr_off);
2529 + unsigned long *p_gpr = (unsigned long *)(stack + gpr_off);
2530 + unsigned char *p_struct = (unsigned char *)p_gpr;
2531 + unsigned long *p_ov = (unsigned long *)stack;
2538 + void **p_argv = ecif->avalue;
2541 + /* If we returning a structure then we set the first parameter register
2542 + to the address of where we are returning this structure. */
2544 + if (ecif->cif->flags == FFI390_RET_STRUCT)
2545 + p_gpr[n_gpr++] = (unsigned long) ecif->rvalue;
2547 + /* Now for the arguments. */
2549 + for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
2551 + i--, ptr++, p_argv++)
2553 + void *arg = *p_argv;
2554 + int type = (*ptr)->type;
2556 + /* Check how a structure type is passed. */
2557 + if (type == FFI_TYPE_STRUCT)
2559 + type = ffi_check_struct_type (*ptr);
2561 + /* If we pass the struct via pointer, copy the data. */
2562 + if (type == FFI_TYPE_POINTER)
2564 + p_struct -= ROUND_SIZE ((*ptr)->size);
2565 + memcpy (p_struct, (char *)arg, (*ptr)->size);
2570 + /* Pointers are passed like UINTs of the same size. */
2571 + if (type == FFI_TYPE_POINTER)
2573 + type = FFI_TYPE_UINT64;
2575 + type = FFI_TYPE_UINT32;
2578 + /* Now handle all primitive int/float data types. */
2581 + case FFI_TYPE_DOUBLE:
2582 + if (n_fpr < MAX_FPRARGS)
2583 + p_fpr[n_fpr++] = *(unsigned long long *) arg;
2586 + p_ov[n_ov++] = *(unsigned long *) arg;
2588 + p_ov[n_ov++] = ((unsigned long *) arg)[0],
2589 + p_ov[n_ov++] = ((unsigned long *) arg)[1];
2593 + case FFI_TYPE_FLOAT:
2594 + if (n_fpr < MAX_FPRARGS)
2595 + p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32;
2597 + p_ov[n_ov++] = *(unsigned int *) arg;
2600 + case FFI_TYPE_UINT64:
2601 + case FFI_TYPE_SINT64:
2603 + if (n_gpr < MAX_GPRARGS)
2604 + p_gpr[n_gpr++] = *(unsigned long *) arg;
2606 + p_ov[n_ov++] = *(unsigned long *) arg;
2608 + if (n_gpr == MAX_GPRARGS-1)
2609 + n_gpr = MAX_GPRARGS;
2610 + if (n_gpr < MAX_GPRARGS)
2611 + p_gpr[n_gpr++] = ((unsigned long *) arg)[0],
2612 + p_gpr[n_gpr++] = ((unsigned long *) arg)[1];
2614 + p_ov[n_ov++] = ((unsigned long *) arg)[0],
2615 + p_ov[n_ov++] = ((unsigned long *) arg)[1];
2619 + case FFI_TYPE_UINT32:
2620 + if (n_gpr < MAX_GPRARGS)
2621 + p_gpr[n_gpr++] = *(unsigned int *) arg;
2623 + p_ov[n_ov++] = *(unsigned int *) arg;
2626 + case FFI_TYPE_INT:
2627 + case FFI_TYPE_SINT32:
2628 + if (n_gpr < MAX_GPRARGS)
2629 + p_gpr[n_gpr++] = *(signed int *) arg;
2631 + p_ov[n_ov++] = *(signed int *) arg;
2634 + case FFI_TYPE_UINT16:
2635 + if (n_gpr < MAX_GPRARGS)
2636 + p_gpr[n_gpr++] = *(unsigned short *) arg;
2638 + p_ov[n_ov++] = *(unsigned short *) arg;
2641 + case FFI_TYPE_SINT16:
2642 + if (n_gpr < MAX_GPRARGS)
2643 + p_gpr[n_gpr++] = *(signed short *) arg;
2645 + p_ov[n_ov++] = *(signed short *) arg;
2648 + case FFI_TYPE_UINT8:
2649 + if (n_gpr < MAX_GPRARGS)
2650 + p_gpr[n_gpr++] = *(unsigned char *) arg;
2652 + p_ov[n_ov++] = *(unsigned char *) arg;
2655 + case FFI_TYPE_SINT8:
2656 + if (n_gpr < MAX_GPRARGS)
2657 + p_gpr[n_gpr++] = *(signed char *) arg;
2659 + p_ov[n_ov++] = *(signed char *) arg;
2669 +/*======================== End of Routine ============================*/
2671 +/*====================================================================*/
2673 +/* Name - ffi_prep_cif_machdep. */
2675 +/* Function - Perform machine dependent CIF processing. */
2677 +/*====================================================================*/
2680 +ffi_prep_cif_machdep(ffi_cif *cif)
2682 + size_t struct_size = 0;
2690 + /* Determine return value handling. */
2692 + switch (cif->rtype->type)
2694 + /* Void is easy. */
2695 + case FFI_TYPE_VOID:
2696 + cif->flags = FFI390_RET_VOID;
2699 + /* Structures are returned via a hidden pointer. */
2700 + case FFI_TYPE_STRUCT:
2701 + cif->flags = FFI390_RET_STRUCT;
2702 + n_gpr++; /* We need one GPR to pass the pointer. */
2705 + /* Floating point values are returned in fpr 0. */
2706 + case FFI_TYPE_FLOAT:
2707 + cif->flags = FFI390_RET_FLOAT;
2710 + case FFI_TYPE_DOUBLE:
2711 + cif->flags = FFI390_RET_DOUBLE;
2714 + /* Integer values are returned in gpr 2 (and gpr 3
2715 + for 64-bit values on 31-bit machines). */
2716 + case FFI_TYPE_UINT64:
2717 + case FFI_TYPE_SINT64:
2718 + cif->flags = FFI390_RET_INT64;
2721 + case FFI_TYPE_POINTER:
2722 + case FFI_TYPE_INT:
2723 + case FFI_TYPE_UINT32:
2724 + case FFI_TYPE_SINT32:
2725 + case FFI_TYPE_UINT16:
2726 + case FFI_TYPE_SINT16:
2727 + case FFI_TYPE_UINT8:
2728 + case FFI_TYPE_SINT8:
2729 + /* These are to be extended to word size. */
2731 + cif->flags = FFI390_RET_INT64;
2733 + cif->flags = FFI390_RET_INT32;
2742 + /* Now for the arguments. */
2744 + for (ptr = cif->arg_types, i = cif->nargs;
2748 + int type = (*ptr)->type;
2750 + /* Check how a structure type is passed. */
2751 + if (type == FFI_TYPE_STRUCT)
2753 + type = ffi_check_struct_type (*ptr);
2755 + /* If we pass the struct via pointer, we must reserve space
2756 + to copy its data for proper call-by-value semantics. */
2757 + if (type == FFI_TYPE_POINTER)
2758 + struct_size += ROUND_SIZE ((*ptr)->size);
2761 + /* Now handle all primitive int/float data types. */
2764 + /* The first MAX_FPRARGS floating point arguments
2765 + go in FPRs, the rest overflow to the stack. */
2767 + case FFI_TYPE_DOUBLE:
2768 + if (n_fpr < MAX_FPRARGS)
2771 + n_ov += sizeof (double) / sizeof (long);
2774 + case FFI_TYPE_FLOAT:
2775 + if (n_fpr < MAX_FPRARGS)
2781 + /* On 31-bit machines, 64-bit integers are passed in GPR pairs,
2782 + if one is still available, or else on the stack. If only one
2783 + register is free, skip the register (it won't be used for any
2784 + subsequent argument either). */
2787 + case FFI_TYPE_UINT64:
2788 + case FFI_TYPE_SINT64:
2789 + if (n_gpr == MAX_GPRARGS-1)
2790 + n_gpr = MAX_GPRARGS;
2791 + if (n_gpr < MAX_GPRARGS)
2798 + /* Everything else is passed in GPRs (until MAX_GPRARGS
2799 + have been used) or overflows to the stack. */
2802 + if (n_gpr < MAX_GPRARGS)
2810 + /* Total stack space as required for overflow arguments
2811 + and temporary structure copies. */
2813 + cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size;
2818 +/*======================== End of Routine ============================*/
2820 +/*====================================================================*/
2822 +/* Name - ffi_call. */
2824 +/* Function - Call the FFI routine. */
2826 +/*====================================================================*/
2829 +ffi_call(ffi_cif *cif,
2834 + int ret_type = cif->flags;
2835 + extended_cif ecif;
2838 + ecif.avalue = avalue;
2839 + ecif.rvalue = rvalue;
2841 + /* If we don't have a return value, we need to fake one. */
2842 + if (rvalue == NULL)
2844 + if (ret_type == FFI390_RET_STRUCT)
2845 + ecif.rvalue = alloca (cif->rtype->size);
2847 + ret_type = FFI390_RET_VOID;
2853 + ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args,
2854 + ret_type, ecif.rvalue, fn);
2863 +/*======================== End of Routine ============================*/
2865 +/*====================================================================*/
2867 +/* Name - ffi_closure_helper_SYSV. */
2869 +/* Function - Call a FFI closure target function. */
2871 +/*====================================================================*/
2874 +ffi_closure_helper_SYSV (ffi_closure *closure,
2875 + unsigned long *p_gpr,
2876 + unsigned long long *p_fpr,
2877 + unsigned long *p_ov)
2879 + unsigned long long ret_buffer;
2881 + void *rvalue = &ret_buffer;
2892 + /* Allocate buffer for argument list pointers. */
2894 + p_arg = avalue = alloca (closure->cif->nargs * sizeof (void *));
2896 + /* If we returning a structure, pass the structure address
2897 + directly to the target function. Otherwise, have the target
2898 + function store the return value to the GPR save area. */
2900 + if (closure->cif->flags == FFI390_RET_STRUCT)
2901 + rvalue = (void *) p_gpr[n_gpr++];
2903 + /* Now for the arguments. */
2905 + for (ptr = closure->cif->arg_types, i = closure->cif->nargs;
2907 + i--, p_arg++, ptr++)
2909 + int deref_struct_pointer = 0;
2910 + int type = (*ptr)->type;
2912 + /* Check how a structure type is passed. */
2913 + if (type == FFI_TYPE_STRUCT)
2915 + type = ffi_check_struct_type (*ptr);
2917 + /* If we pass the struct via pointer, remember to
2918 + retrieve the pointer later. */
2919 + if (type == FFI_TYPE_POINTER)
2920 + deref_struct_pointer = 1;
2923 + /* Pointers are passed like UINTs of the same size. */
2924 + if (type == FFI_TYPE_POINTER)
2926 + type = FFI_TYPE_UINT64;
2928 + type = FFI_TYPE_UINT32;
2931 + /* Now handle all primitive int/float data types. */
2934 + case FFI_TYPE_DOUBLE:
2935 + if (n_fpr < MAX_FPRARGS)
2936 + *p_arg = &p_fpr[n_fpr++];
2938 + *p_arg = &p_ov[n_ov],
2939 + n_ov += sizeof (double) / sizeof (long);
2942 + case FFI_TYPE_FLOAT:
2943 + if (n_fpr < MAX_FPRARGS)
2944 + *p_arg = &p_fpr[n_fpr++];
2946 + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4;
2949 + case FFI_TYPE_UINT64:
2950 + case FFI_TYPE_SINT64:
2952 + if (n_gpr < MAX_GPRARGS)
2953 + *p_arg = &p_gpr[n_gpr++];
2955 + *p_arg = &p_ov[n_ov++];
2957 + if (n_gpr == MAX_GPRARGS-1)
2958 + n_gpr = MAX_GPRARGS;
2959 + if (n_gpr < MAX_GPRARGS)
2960 + *p_arg = &p_gpr[n_gpr], n_gpr += 2;
2962 + *p_arg = &p_ov[n_ov], n_ov += 2;
2966 + case FFI_TYPE_INT:
2967 + case FFI_TYPE_UINT32:
2968 + case FFI_TYPE_SINT32:
2969 + if (n_gpr < MAX_GPRARGS)
2970 + *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 4;
2972 + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4;
2975 + case FFI_TYPE_UINT16:
2976 + case FFI_TYPE_SINT16:
2977 + if (n_gpr < MAX_GPRARGS)
2978 + *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 2;
2980 + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 2;
2983 + case FFI_TYPE_UINT8:
2984 + case FFI_TYPE_SINT8:
2985 + if (n_gpr < MAX_GPRARGS)
2986 + *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 1;
2988 + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1;
2996 + /* If this is a struct passed via pointer, we need to
2997 + actually retrieve that pointer. */
2998 + if (deref_struct_pointer)
2999 + *p_arg = *(void **)*p_arg;
3003 + /* Call the target function. */
3004 + (closure->fun) (closure->cif, rvalue, avalue, closure->user_data);
3006 + /* Convert the return value. */
3007 + switch (closure->cif->rtype->type)
3009 + /* Void is easy, and so is struct. */
3010 + case FFI_TYPE_VOID:
3011 + case FFI_TYPE_STRUCT:
3014 + /* Floating point values are returned in fpr 0. */
3015 + case FFI_TYPE_FLOAT:
3016 + p_fpr[0] = (long long) *(unsigned int *) rvalue << 32;
3019 + case FFI_TYPE_DOUBLE:
3020 + p_fpr[0] = *(unsigned long long *) rvalue;
3023 + /* Integer values are returned in gpr 2 (and gpr 3
3024 + for 64-bit values on 31-bit machines). */
3025 + case FFI_TYPE_UINT64:
3026 + case FFI_TYPE_SINT64:
3028 + p_gpr[0] = *(unsigned long *) rvalue;
3030 + p_gpr[0] = ((unsigned long *) rvalue)[0],
3031 + p_gpr[1] = ((unsigned long *) rvalue)[1];
3035 + case FFI_TYPE_POINTER:
3036 + case FFI_TYPE_UINT32:
3037 + case FFI_TYPE_UINT16:
3038 + case FFI_TYPE_UINT8:
3039 + p_gpr[0] = *(unsigned long *) rvalue;
3042 + case FFI_TYPE_INT:
3043 + case FFI_TYPE_SINT32:
3044 + case FFI_TYPE_SINT16:
3045 + case FFI_TYPE_SINT8:
3046 + p_gpr[0] = *(signed long *) rvalue;
3055 +/*======================== End of Routine ============================*/
3057 +/*====================================================================*/
3059 +/* Name - ffi_prep_closure. */
3061 +/* Function - Prepare a FFI closure. */
3063 +/*====================================================================*/
3066 +ffi_prep_closure (ffi_closure *closure,
3068 + void (*fun) (ffi_cif *, void *, void **, void *),
3071 + FFI_ASSERT (cif->abi == FFI_SYSV);
3074 + *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */
3075 + *(short *)&closure->tramp [2] = 0x9801; /* lm %r0,%r1,6(%r1) */
3076 + *(short *)&closure->tramp [4] = 0x1006;
3077 + *(short *)&closure->tramp [6] = 0x07f1; /* br %r1 */
3078 + *(long *)&closure->tramp [8] = (long)closure;
3079 + *(long *)&closure->tramp[12] = (long)&ffi_closure_SYSV;
3081 + *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */
3082 + *(short *)&closure->tramp [2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */
3083 + *(short *)&closure->tramp [4] = 0x100e;
3084 + *(short *)&closure->tramp [6] = 0x0004;
3085 + *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */
3086 + *(long *)&closure->tramp[16] = (long)closure;
3087 + *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV;
3090 + closure->cif = cif;
3091 + closure->user_data = user_data;
3092 + closure->fun = fun;
3097 +/*======================== End of Routine ============================*/
3099 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/s390/sysv.S gcc/libffi/src/s390/sysv.S
3100 --- gcc-3.2.2.orig/libffi/src/s390/sysv.S Thu Jan 1 09:00:00 1970
3101 +++ gcc/libffi/src/s390/sysv.S Thu Nov 28 01:44:35 2002
3103 +/* -----------------------------------------------------------------------
3104 + sysv.S - Copyright (c) 2000 Software AG
3106 + S390 Foreign Function Interface
3108 + Permission is hereby granted, free of charge, to any person obtaining
3109 + a copy of this software and associated documentation files (the
3110 + ``Software''), to deal in the Software without restriction, including
3111 + without limitation the rights to use, copy, modify, merge, publish,
3112 + distribute, sublicense, and/or sell copies of the Software, and to
3113 + permit persons to whom the Software is furnished to do so, subject to
3114 + the following conditions:
3116 + The above copyright notice and this permission notice shall be included
3117 + in all copies or substantial portions of the Software.
3119 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
3120 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3121 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3122 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
3123 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3124 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3125 + OTHER DEALINGS IN THE SOFTWARE.
3126 + ----------------------------------------------------------------------- */
3134 + # r4: ffi_prep_args
3139 + # This assumes we are using gas.
3140 + .globl ffi_call_SYSV
3141 + .type ffi_call_SYSV,%function
3144 + stm %r6,%r15,24(%r15) # Save registers
3146 + basr %r13,0 # Set up base register
3148 + lr %r11,%r15 # Set up frame pointer
3151 + ahi %r15,-96-48 # Allocate stack
3152 + lr %r8,%r6 # Save ecif.rvalue
3154 + ic %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address
3155 + l %r7,96(%r11) # Load function address
3156 + st %r11,0(%r15) # Set up back chain
3157 + ahi %r11,-48 # Register save area
3160 + la %r2,96(%r15) # Save area
3161 + # r3 already holds &ecif
3162 + basr %r14,%r4 # Call ffi_prep_args
3164 + lm %r2,%r6,0(%r11) # Load arguments
3167 + la %r14,0(%r13,%r9) # Set return address
3168 + br %r7 # ... and call function
3170 +.LretNone: # Return void
3172 + lm %r6,%r15,48+24(%r11)
3177 + ste %f0,0(%r8) # Return float
3178 + lm %r6,%r15,48+24(%r11)
3183 + std %f0,0(%r8) # Return double
3184 + lm %r6,%r15,48+24(%r11)
3189 + st %r2,0(%r8) # Return int
3190 + lm %r6,%r15,48+24(%r11)
3195 + stm %r2,%r3,0(%r8) # Return long long
3196 + lm %r6,%r15,48+24(%r11)
3200 + .byte .LretNone-.Lbase # FFI390_RET_VOID
3201 + .byte .LretNone-.Lbase # FFI390_RET_STRUCT
3202 + .byte .LretFloat-.Lbase # FFI390_RET_FLOAT
3203 + .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE
3204 + .byte .LretInt32-.Lbase # FFI390_RET_INT32
3205 + .byte .LretInt64-.Lbase # FFI390_RET_INT64
3208 +.ffi_call_SYSV_end:
3209 + .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
3212 + .globl ffi_closure_SYSV
3213 + .type ffi_closure_SYSV,%function
3216 + stm %r12,%r15,48(%r15) # Save registers
3218 + basr %r13,0 # Set up base register
3220 + stm %r2,%r6,8(%r15) # Save arguments
3223 + lr %r1,%r15 # Set up stack frame
3226 + l %r12,.Lchelper-.Lcbase(%r13) # Get helper function
3227 + lr %r2,%r0 # Closure
3228 + la %r3,8(%r1) # GPRs
3229 + la %r4,64(%r1) # FPRs
3230 + la %r5,96(%r1) # Overflow
3231 + st %r1,0(%r15) # Set up back chain
3233 + bas %r14,0(%r12,%r13) # Call helper
3236 + ld %f0,96+64(%r15) # Load return registers
3237 + lm %r2,%r3,96+8(%r15)
3238 + lm %r12,%r15,96+48(%r15)
3243 + .long ffi_closure_helper_SYSV-.Lcbase
3247 +.ffi_closure_SYSV_end:
3248 + .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV
3251 + .section .eh_frame,"a",@progbits
3253 + .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
3255 + .4byte 0x0 # CIE Identifier Tag
3256 + .byte 0x1 # CIE Version
3257 + .ascii "zR\0" # CIE Augmentation
3258 + .uleb128 0x1 # CIE Code Alignment Factor
3259 + .sleb128 -4 # CIE Data Alignment Factor
3260 + .byte 0xe # CIE RA Column
3261 + .uleb128 0x1 # Augmentation size
3262 + .byte 0x1b # FDE Encoding (pcrel sdata4)
3263 + .byte 0xc # DW_CFA_def_cfa
3269 + .4byte .LEFDE1-.LASFDE1 # FDE Length
3271 + .4byte .LASFDE1-.Lframe1 # FDE CIE offset
3272 + .4byte .LFB1-. # FDE initial location
3273 + .4byte .LFE1-.LFB1 # FDE address range
3274 + .uleb128 0x0 # Augmentation size
3275 + .byte 0x4 # DW_CFA_advance_loc4
3276 + .4byte .LCFI0-.LFB1
3277 + .byte 0x8f # DW_CFA_offset, column 0xf
3279 + .byte 0x8e # DW_CFA_offset, column 0xe
3281 + .byte 0x8d # DW_CFA_offset, column 0xd
3283 + .byte 0x8c # DW_CFA_offset, column 0xc
3285 + .byte 0x8b # DW_CFA_offset, column 0xb
3287 + .byte 0x8a # DW_CFA_offset, column 0xa
3289 + .byte 0x89 # DW_CFA_offset, column 0x9
3291 + .byte 0x88 # DW_CFA_offset, column 0x8
3293 + .byte 0x87 # DW_CFA_offset, column 0x7
3295 + .byte 0x86 # DW_CFA_offset, column 0x6
3297 + .byte 0x4 # DW_CFA_advance_loc4
3298 + .4byte .LCFI1-.LCFI0
3299 + .byte 0xd # DW_CFA_def_cfa_register
3301 + .byte 0x4 # DW_CFA_advance_loc4
3302 + .4byte .LCFI2-.LCFI1
3303 + .byte 0xe # DW_CFA_def_cfa_offset
3308 + .4byte .LEFDE2-.LASFDE2 # FDE Length
3310 + .4byte .LASFDE2-.Lframe1 # FDE CIE offset
3311 + .4byte .LFB2-. # FDE initial location
3312 + .4byte .LFE2-.LFB2 # FDE address range
3313 + .uleb128 0x0 # Augmentation size
3314 + .byte 0x4 # DW_CFA_advance_loc4
3315 + .4byte .LCFI10-.LFB2
3316 + .byte 0x8f # DW_CFA_offset, column 0xf
3318 + .byte 0x8e # DW_CFA_offset, column 0xe
3320 + .byte 0x8d # DW_CFA_offset, column 0xd
3322 + .byte 0x8c # DW_CFA_offset, column 0xc
3324 + .byte 0x4 # DW_CFA_advance_loc4
3325 + .4byte .LCFI11-.LCFI10
3326 + .byte 0xe # DW_CFA_def_cfa_offset
3337 + # r4: ffi_prep_args
3342 + # This assumes we are using gas.
3343 + .globl ffi_call_SYSV
3344 + .type ffi_call_SYSV,%function
3347 + stmg %r6,%r15,48(%r15) # Save registers
3349 + larl %r13,.Lbase # Set up base register
3350 + lgr %r11,%r15 # Set up frame pointer
3353 + aghi %r15,-160-80 # Allocate stack
3354 + lgr %r8,%r6 # Save ecif.rvalue
3355 + llgc %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address
3356 + lg %r7,160(%r11) # Load function address
3357 + stg %r11,0(%r15) # Set up back chain
3358 + aghi %r11,-80 # Register save area
3361 + la %r2,160(%r15) # Save area
3362 + # r3 already holds &ecif
3363 + basr %r14,%r4 # Call ffi_prep_args
3365 + lmg %r2,%r6,0(%r11) # Load arguments
3370 + la %r14,0(%r13,%r9) # Set return address
3371 + br %r7 # ... and call function
3374 +.LretNone: # Return void
3375 + lg %r4,80+112(%r11)
3376 + lmg %r6,%r15,80+48(%r11)
3380 + lg %r4,80+112(%r11)
3381 + ste %f0,0(%r8) # Return float
3382 + lmg %r6,%r15,80+48(%r11)
3386 + lg %r4,80+112(%r11)
3387 + std %f0,0(%r8) # Return double
3388 + lmg %r6,%r15,80+48(%r11)
3392 + lg %r4,80+112(%r11)
3393 + st %r2,0(%r8) # Return int
3394 + lmg %r6,%r15,80+48(%r11)
3398 + lg %r4,80+112(%r11)
3399 + stg %r2,0(%r8) # Return long
3400 + lmg %r6,%r15,80+48(%r11)
3404 + .byte .LretNone-.Lbase # FFI390_RET_VOID
3405 + .byte .LretNone-.Lbase # FFI390_RET_STRUCT
3406 + .byte .LretFloat-.Lbase # FFI390_RET_FLOAT
3407 + .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE
3408 + .byte .LretInt32-.Lbase # FFI390_RET_INT32
3409 + .byte .LretInt64-.Lbase # FFI390_RET_INT64
3412 +.ffi_call_SYSV_end:
3413 + .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
3416 + .globl ffi_closure_SYSV
3417 + .type ffi_closure_SYSV,%function
3420 + stmg %r14,%r15,112(%r15) # Save registers
3422 + stmg %r2,%r6,16(%r15) # Save arguments
3427 + lgr %r1,%r15 # Set up stack frame
3430 + lgr %r2,%r0 # Closure
3431 + la %r3,16(%r1) # GPRs
3432 + la %r4,128(%r1) # FPRs
3433 + la %r5,160(%r1) # Overflow
3434 + stg %r1,0(%r15) # Set up back chain
3436 + brasl %r14,ffi_closure_helper_SYSV # Call helper
3438 + lg %r14,160+112(%r15)
3439 + ld %f0,160+128(%r15) # Load return registers
3440 + lg %r2,160+16(%r15)
3445 +.ffi_closure_SYSV_end:
3446 + .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV
3450 + .section .eh_frame,"a",@progbits
3452 + .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
3454 + .4byte 0x0 # CIE Identifier Tag
3455 + .byte 0x1 # CIE Version
3456 + .ascii "zR\0" # CIE Augmentation
3457 + .uleb128 0x1 # CIE Code Alignment Factor
3458 + .sleb128 -8 # CIE Data Alignment Factor
3459 + .byte 0xe # CIE RA Column
3460 + .uleb128 0x1 # Augmentation size
3461 + .byte 0x1b # FDE Encoding (pcrel sdata4)
3462 + .byte 0xc # DW_CFA_def_cfa
3468 + .4byte .LEFDE1-.LASFDE1 # FDE Length
3470 + .4byte .LASFDE1-.Lframe1 # FDE CIE offset
3471 + .4byte .LFB1-. # FDE initial location
3472 + .4byte .LFE1-.LFB1 # FDE address range
3473 + .uleb128 0x0 # Augmentation size
3474 + .byte 0x4 # DW_CFA_advance_loc4
3475 + .4byte .LCFI0-.LFB1
3476 + .byte 0x8f # DW_CFA_offset, column 0xf
3478 + .byte 0x8e # DW_CFA_offset, column 0xe
3480 + .byte 0x8d # DW_CFA_offset, column 0xd
3482 + .byte 0x8c # DW_CFA_offset, column 0xc
3484 + .byte 0x8b # DW_CFA_offset, column 0xb
3486 + .byte 0x8a # DW_CFA_offset, column 0xa
3488 + .byte 0x89 # DW_CFA_offset, column 0x9
3490 + .byte 0x88 # DW_CFA_offset, column 0x8
3492 + .byte 0x87 # DW_CFA_offset, column 0x7
3494 + .byte 0x86 # DW_CFA_offset, column 0x6
3496 + .byte 0x4 # DW_CFA_advance_loc4
3497 + .4byte .LCFI1-.LCFI0
3498 + .byte 0xd # DW_CFA_def_cfa_register
3500 + .byte 0x4 # DW_CFA_advance_loc4
3501 + .4byte .LCFI2-.LCFI1
3502 + .byte 0xe # DW_CFA_def_cfa_offset
3507 + .4byte .LEFDE2-.LASFDE2 # FDE Length
3509 + .4byte .LASFDE2-.Lframe1 # FDE CIE offset
3510 + .4byte .LFB2-. # FDE initial location
3511 + .4byte .LFE2-.LFB2 # FDE address range
3512 + .uleb128 0x0 # Augmentation size
3513 + .byte 0x4 # DW_CFA_advance_loc4
3514 + .4byte .LCFI10-.LFB2
3515 + .byte 0x8f # DW_CFA_offset, column 0xf
3517 + .byte 0x8e # DW_CFA_offset, column 0xe
3519 + .byte 0x4 # DW_CFA_advance_loc4
3520 + .4byte .LCFI11-.LCFI10
3521 + .byte 0xe # DW_CFA_def_cfa_offset
3528 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sh/ffi.c gcc/libffi/src/sh/ffi.c
3529 --- gcc-3.2.2.orig/libffi/src/sh/ffi.c Thu Jan 1 09:00:00 1970
3530 +++ gcc/libffi/src/sh/ffi.c Fri Jul 19 10:08:43 2002
3532 +/* -----------------------------------------------------------------------
3533 + ffi.c - Copyright (c) 2002 Kaz Kojima
3535 + SuperH Foreign Function Interface
3537 + Permission is hereby granted, free of charge, to any person obtaining
3538 + a copy of this software and associated documentation files (the
3539 + ``Software''), to deal in the Software without restriction, including
3540 + without limitation the rights to use, copy, modify, merge, publish,
3541 + distribute, sublicense, and/or sell copies of the Software, and to
3542 + permit persons to whom the Software is furnished to do so, subject to
3543 + the following conditions:
3545 + The above copyright notice and this permission notice shall be included
3546 + in all copies or substantial portions of the Software.
3548 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
3549 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3550 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3551 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
3552 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3553 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3554 + OTHER DEALINGS IN THE SOFTWARE.
3555 + ----------------------------------------------------------------------- */
3558 +#include <ffi_common.h>
3560 +#include <stdlib.h>
3563 +#if defined(__SH4__)
3567 +#if defined(__HITACHI__)
3568 +#define STRUCT_VALUE_ADDRESS_WITH_ARG 1
3570 +#define STRUCT_VALUE_ADDRESS_WITH_ARG 0
3573 +/* If the structure has essentialy an unique element, return its type. */
3575 +simple_type (ffi_type *arg)
3577 + if (arg->type != FFI_TYPE_STRUCT)
3579 + else if (arg->elements[1])
3580 + return FFI_TYPE_STRUCT;
3582 + return simple_type (arg->elements[0]);
3586 +return_type (ffi_type *arg)
3588 + unsigned short type;
3590 + if (arg->type != FFI_TYPE_STRUCT)
3593 + type = simple_type (arg->elements[0]);
3594 + if (! arg->elements[1])
3598 + case FFI_TYPE_SINT8:
3599 + case FFI_TYPE_UINT8:
3600 + case FFI_TYPE_SINT16:
3601 + case FFI_TYPE_UINT16:
3602 + case FFI_TYPE_SINT32:
3603 + case FFI_TYPE_UINT32:
3604 + return FFI_TYPE_INT;
3611 + /* gcc uses r0/r1 pair for some kind of structures. */
3612 + if (arg->size <= 2 * sizeof (int))
3617 + while ((e = arg->elements[i++]))
3619 + type = simple_type (e);
3622 + case FFI_TYPE_SINT32:
3623 + case FFI_TYPE_UINT32:
3624 + case FFI_TYPE_INT:
3625 + case FFI_TYPE_FLOAT:
3626 + return FFI_TYPE_UINT64;
3634 + return FFI_TYPE_STRUCT;
3637 +/* ffi_prep_args is called by the assembly routine once stack space
3638 + has been allocated for the function's arguments */
3640 +/*@-exportheader@*/
3641 +void ffi_prep_args(char *stack, extended_cif *ecif)
3642 +/*@=exportheader@*/
3644 + register unsigned int i;
3646 + register unsigned int avn;
3647 + register void **p_argv;
3648 + register char *argp;
3649 + register ffi_type **p_arg;
3651 +#if defined(__SH4__)
3658 + if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT)
3660 + *(void **) argp = ecif->rvalue;
3662 + ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0;
3667 + /* Set arguments for registers. */
3669 + avn = ecif->cif->nargs;
3670 + p_argv = ecif->avalue;
3672 + for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++)
3676 + z = (*p_arg)->size;
3677 + if (z < sizeof(int))
3679 + if (greg++ >= NGREGARG)
3683 + switch ((*p_arg)->type)
3685 + case FFI_TYPE_SINT8:
3686 + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
3689 + case FFI_TYPE_UINT8:
3690 + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
3693 + case FFI_TYPE_SINT16:
3694 + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
3697 + case FFI_TYPE_UINT16:
3698 + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
3701 + case FFI_TYPE_STRUCT:
3702 + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
3710 + else if (z == sizeof(int))
3712 +#if defined(__SH4__)
3713 + if ((*p_arg)->type == FFI_TYPE_FLOAT)
3715 + if (freg++ >= NFREGARG)
3721 + if (greg++ >= NGREGARG)
3724 + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
3727 +#if defined(__SH4__)
3728 + else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
3730 + if (freg + 1 >= NFREGARG)
3732 + freg = (freg + 1) & ~1;
3734 + memcpy (argp, *p_argv, z);
3740 + int n = (z + sizeof (int) - 1) / sizeof (int);
3741 +#if defined(__SH4__)
3742 + if (greg + n - 1 >= NGREGARG)
3746 + if (greg >= NGREGARG)
3748 + else if (greg + n - 1 >= NGREGARG)
3753 + memcpy (argp, *p_argv, z);
3758 + /* Set arguments on stack. */
3760 +#if defined(__SH4__)
3763 + p_argv = ecif->avalue;
3765 + for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++)
3769 + z = (*p_arg)->size;
3770 + if (z < sizeof(int))
3772 + if (greg++ < NGREGARG)
3776 + switch ((*p_arg)->type)
3778 + case FFI_TYPE_SINT8:
3779 + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
3782 + case FFI_TYPE_UINT8:
3783 + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
3786 + case FFI_TYPE_SINT16:
3787 + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
3790 + case FFI_TYPE_UINT16:
3791 + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
3794 + case FFI_TYPE_STRUCT:
3795 + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
3803 + else if (z == sizeof(int))
3805 +#if defined(__SH4__)
3806 + if ((*p_arg)->type == FFI_TYPE_FLOAT)
3808 + if (freg++ < NFREGARG)
3814 + if (greg++ < NGREGARG)
3817 + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
3820 +#if defined(__SH4__)
3821 + else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
3823 + if (freg + 1 < NFREGARG)
3825 + freg = (freg + 1) & ~1;
3829 + memcpy (argp, *p_argv, z);
3835 + int n = (z + sizeof (int) - 1) / sizeof (int);
3836 + if (greg + n - 1 < NGREGARG)
3841 +#if (! defined(__SH4__))
3842 + else if (greg < NGREGARG)
3848 + memcpy (argp, *p_argv, z);
3856 +/* Perform machine dependent cif processing */
3857 +ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
3863 +#if defined(__SH4__)
3869 + greg = ((return_type (cif->rtype) == FFI_TYPE_STRUCT) &&
3870 + STRUCT_VALUE_ADDRESS_WITH_ARG) ? 1 : 0;
3872 +#if defined(__SH4__)
3873 + for (i = j = 0; i < cif->nargs && j < 12; i++)
3875 + type = (cif->arg_types)[i]->type;
3878 + case FFI_TYPE_FLOAT:
3879 + if (freg >= NFREGARG)
3882 + cif->flags += ((cif->arg_types)[i]->type) << (2 * j);
3886 + case FFI_TYPE_DOUBLE:
3887 + if ((freg + 1) >= NFREGARG)
3889 + freg = (freg + 1) & ~1;
3891 + cif->flags += ((cif->arg_types)[i]->type) << (2 * j);
3896 + size = (cif->arg_types)[i]->size;
3897 + n = (size + sizeof (int) - 1) / sizeof (int);
3898 + if (greg + n - 1 >= NGREGARG)
3901 + for (m = 0; m < n; m++)
3902 + cif->flags += FFI_TYPE_INT << (2 * j++);
3907 + for (i = j = 0; i < cif->nargs && j < 4; i++)
3909 + size = (cif->arg_types)[i]->size;
3910 + n = (size + sizeof (int) - 1) / sizeof (int);
3911 + if (greg >= NGREGARG)
3913 + else if (greg + n - 1 >= NGREGARG)
3917 + for (m = 0; m < n; m++)
3918 + cif->flags += FFI_TYPE_INT << (2 * j++);
3922 + /* Set the return type flag */
3923 + switch (cif->rtype->type)
3925 + case FFI_TYPE_STRUCT:
3926 + cif->flags += (unsigned) (return_type (cif->rtype)) << 24;
3929 + case FFI_TYPE_VOID:
3930 + case FFI_TYPE_FLOAT:
3931 + case FFI_TYPE_DOUBLE:
3932 + case FFI_TYPE_SINT64:
3933 + case FFI_TYPE_UINT64:
3934 + cif->flags += (unsigned) cif->rtype->type << 24;
3938 + cif->flags += FFI_TYPE_INT << 24;
3946 +/*@-exportheader@*/
3947 +extern void ffi_call_SYSV(void (*)(char *, extended_cif *),
3948 + /*@out@*/ extended_cif *,
3949 + unsigned, unsigned,
3950 + /*@out@*/ unsigned *,
3953 +/*@=exportheader@*/
3955 +void ffi_call(/*@dependent@*/ ffi_cif *cif,
3957 + /*@out@*/ void *rvalue,
3958 + /*@dependent@*/ void **avalue)
3960 + extended_cif ecif;
3963 + ecif.avalue = avalue;
3965 + /* If the return value is a struct and we don't have a return */
3966 + /* value address then we need to make one */
3968 + if ((rvalue == NULL) &&
3969 + (cif->rtype->type == FFI_TYPE_STRUCT))
3972 + ecif.rvalue = alloca(cif->rtype->size);
3976 + ecif.rvalue = rvalue;
3983 + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes,
3984 + cif->flags, ecif.rvalue, fn);
3993 +extern void ffi_closure_SYSV (void);
3994 +#if defined(__SH4__)
3995 +extern void __ic_invalidate (void *line);
3999 +ffi_prep_closure (ffi_closure* closure,
4001 + void (*fun)(ffi_cif*, void*, void**, void*),
4004 + unsigned int *tramp;
4006 + FFI_ASSERT (cif->abi == FFI_GCC_SYSV);
4008 + tramp = (unsigned int *) &closure->tramp[0];
4009 +#ifdef __LITTLE_ENDIAN__
4010 + tramp[0] = 0xd301d202;
4011 + tramp[1] = 0x0009422b;
4013 + tramp[0] = 0xd202d301;
4014 + tramp[1] = 0x422b0009;
4016 + *(void **) &tramp[2] = (void *)closure; /* ctx */
4017 + *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */
4019 + closure->cif = cif;
4020 + closure->fun = fun;
4021 + closure->user_data = user_data;
4023 +#if defined(__SH4__)
4024 + /* Flush the icache. */
4025 + __ic_invalidate(&closure->tramp[0]);
4031 +/* Basically the trampoline invokes ffi_closure_SYSV, and on
4032 + * entry, r3 holds the address of the closure.
4033 + * After storing the registers that could possibly contain
4034 + * parameters to be passed into the stack frame and setting
4035 + * up space for a return value, ffi_closure_SYSV invokes the
4036 + * following helper function to do most of the work.
4039 +#ifdef __LITTLE_ENDIAN__
4041 +#define OFS_INT16 2
4044 +#define OFS_INT16 2
4048 +ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
4049 + unsigned long *pgr, unsigned long *pfr,
4050 + unsigned long *pst)
4055 + int ireg, greg = 0;
4056 +#if defined(__SH4__)
4062 + cif = closure->cif;
4063 + avalue = alloca(cif->nargs * sizeof(void *));
4065 + /* Copy the caller's structure return value address so that the closure
4066 + returns the data directly to the caller. */
4067 + if (cif->rtype->type == FFI_TYPE_STRUCT)
4070 + ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0;
4075 + cif = closure->cif;
4079 + /* Grab the addresses of the arguments from the stack frame. */
4080 + for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
4084 + z = (*p_arg)->size;
4085 + if (z < sizeof(int))
4087 + if (greg++ >= NGREGARG)
4091 + switch ((*p_arg)->type)
4093 + case FFI_TYPE_SINT8:
4094 + case FFI_TYPE_UINT8:
4095 + avalue[i] = (((char *)pgr) + OFS_INT8);
4098 + case FFI_TYPE_SINT16:
4099 + case FFI_TYPE_UINT16:
4100 + avalue[i] = (((char *)pgr) + OFS_INT16);
4103 + case FFI_TYPE_STRUCT:
4112 + else if (z == sizeof(int))
4114 +#if defined(__SH4__)
4115 + if ((*p_arg)->type == FFI_TYPE_FLOAT)
4117 + if (freg++ >= NFREGARG)
4125 + if (greg++ >= NGREGARG)
4131 +#if defined(__SH4__)
4132 + else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
4134 + if (freg + 1 >= NFREGARG)
4136 + freg = (freg + 1) & ~1;
4144 + int n = (z + sizeof (int) - 1) / sizeof (int);
4145 +#if defined(__SH4__)
4146 + if (greg + n - 1 >= NGREGARG)
4150 + if (greg >= NGREGARG)
4152 + else if (greg + n - 1 >= NGREGARG)
4163 +#if defined(__SH4__)
4167 + for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
4171 + z = (*p_arg)->size;
4172 + if (z < sizeof(int))
4174 + if (greg++ < NGREGARG)
4178 + switch ((*p_arg)->type)
4180 + case FFI_TYPE_SINT8:
4181 + case FFI_TYPE_UINT8:
4182 + avalue[i] = (((char *)pst) + OFS_INT8);
4185 + case FFI_TYPE_SINT16:
4186 + case FFI_TYPE_UINT16:
4187 + avalue[i] = (((char *)pst) + OFS_INT16);
4190 + case FFI_TYPE_STRUCT:
4199 + else if (z == sizeof(int))
4201 +#if defined(__SH4__)
4202 + if ((*p_arg)->type == FFI_TYPE_FLOAT)
4204 + if (freg++ < NFREGARG)
4210 + if (greg++ < NGREGARG)
4216 +#if defined(__SH4__)
4217 + else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
4219 + if (freg + 1 < NFREGARG)
4221 + freg = (freg + 1) & ~1;
4231 + int n = (z + sizeof (int) - 1) / sizeof (int);
4232 + if (greg + n - 1 < NGREGARG)
4237 +#if (! defined(__SH4__))
4238 + else if (greg < NGREGARG)
4249 + (closure->fun) (cif, rvalue, avalue, closure->user_data);
4251 + /* Tell ffi_closure_osf how to perform return type promotions. */
4252 + return cif->rtype->type;
4254 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sh/sysv.S gcc/libffi/src/sh/sysv.S
4255 --- gcc-3.2.2.orig/libffi/src/sh/sysv.S Thu Jan 1 09:00:00 1970
4256 +++ gcc/libffi/src/sh/sysv.S Tue Dec 17 03:22:48 2002
4258 +/* -----------------------------------------------------------------------
4259 + sysv.S - Copyright (c) 2002 Kaz Kojima
4261 + SuperH Foreign Function Interface
4263 + Permission is hereby granted, free of charge, to any person obtaining
4264 + a copy of this software and associated documentation files (the
4265 + ``Software''), to deal in the Software without restriction, including
4266 + without limitation the rights to use, copy, modify, merge, publish,
4267 + distribute, sublicense, and/or sell copies of the Software, and to
4268 + permit persons to whom the Software is furnished to do so, subject to
4269 + the following conditions:
4271 + The above copyright notice and this permission notice shall be included
4272 + in all copies or substantial portions of the Software.
4274 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
4275 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4276 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
4277 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
4278 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
4279 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4280 + OTHER DEALINGS IN THE SOFTWARE.
4281 + ----------------------------------------------------------------------- */
4285 +#ifdef HAVE_MACHINE_ASM_H
4286 +#include <machine/asm.h>
4288 +/* XXX these lose for some platforms, I'm sure. */
4290 +#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
4293 +#if defined(__HITACHI__)
4294 +#define STRUCT_VALUE_ADDRESS_WITH_ARG 1
4296 +#define STRUCT_VALUE_ADDRESS_WITH_ARG 0
4301 + # r4: ffi_prep_args
4308 + # This assumes we are using gas.
4309 +ENTRY(ffi_call_SYSV)
4326 +#if defined(__SH4__)
4344 + mov #FFI_TYPE_STRUCT,r2
4347 +#if STRUCT_VALUE_ADDRESS_WITH_ARG
4367 + cmp/eq #FFI_TYPE_DOUBLE,r0
4400 +#ifdef __LITTLE_ENDIAN__
4429 + cmp/eq #FFI_TYPE_FLOAT,r0
4449 +#ifdef __LITTLE_ENDIAN__
4486 + cmp/eq #FFI_TYPE_INT,r0
4517 +#if (! STRUCT_VALUE_ADDRESS_WITH_ARG)
4520 + mov.l @(28,r14),r1
4525 + mov #FFI_TYPE_DOUBLE,r2
4529 + mov.l @(24,r14),r1
4530 +#ifdef __LITTLE_ENDIAN__
4543 + mov #FFI_TYPE_SINT64,r2
4546 + mov #FFI_TYPE_UINT64,r2
4551 + mov.l @(24,r14),r2
4557 + mov #FFI_TYPE_FLOAT,r2
4561 + mov.l @(24,r14),r1
4566 + mov #FFI_TYPE_INT,r2
4570 + mov.l @(24,r14),r1
4575 + # Remove the space we pushed for the args
4603 + mov #FFI_TYPE_STRUCT,r2
4606 +#if STRUCT_VALUE_ADDRESS_WITH_ARG
4625 + cmp/eq #FFI_TYPE_DOUBLE,r0
4694 +#if (! STRUCT_VALUE_ADDRESS_WITH_ARG)
4697 + mov.l @(28,r14),r1
4702 + mov #FFI_TYPE_DOUBLE,r2
4706 + mov.l @(24,r14),r2
4712 + mov #FFI_TYPE_SINT64,r2
4715 + mov #FFI_TYPE_UINT64,r2
4720 + mov.l @(24,r14),r2
4726 + mov #FFI_TYPE_FLOAT,r2
4729 + mov #FFI_TYPE_INT,r2
4733 + mov.l @(24,r14),r1
4738 + # Remove the space we pushed for the args
4750 +.ffi_call_SYSV_end:
4751 + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
4753 +.globl ffi_closure_helper_SYSV
4755 +ENTRY(ffi_closure_SYSV)
4763 + 32 bytes (floating register parameters, SH-4 only)
4764 + 16 bytes (register parameters)
4767 + <- new stack pointer
4770 +#if defined(__SH4__)
4786 +#if defined(__SH4__)
4789 +#ifdef __LITTLE_ENDIAN__
4816 +#if defined(__SH4__)
4838 + .long ffi_closure_helper_SYSV
4840 + .short L_case_v - 0b /* FFI_TYPE_VOID */
4841 + .short L_case_i - 0b /* FFI_TYPE_INT */
4842 +#if defined(__SH4__)
4843 + .short L_case_f - 0b /* FFI_TYPE_FLOAT */
4844 + .short L_case_d - 0b /* FFI_TYPE_DOUBLE */
4845 + .short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */
4847 + .short L_case_i - 0b /* FFI_TYPE_FLOAT */
4848 + .short L_case_ll - 0b /* FFI_TYPE_DOUBLE */
4849 + .short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */
4851 + .short L_case_uq - 0b /* FFI_TYPE_UINT8 */
4852 + .short L_case_q - 0b /* FFI_TYPE_SINT8 */
4853 + .short L_case_uh - 0b /* FFI_TYPE_UINT16 */
4854 + .short L_case_h - 0b /* FFI_TYPE_SINT16 */
4855 + .short L_case_i - 0b /* FFI_TYPE_UINT32 */
4856 + .short L_case_i - 0b /* FFI_TYPE_SINT32 */
4857 + .short L_case_ll - 0b /* FFI_TYPE_UINT64 */
4858 + .short L_case_ll - 0b /* FFI_TYPE_SINT64 */
4859 + .short L_case_v - 0b /* FFI_TYPE_STRUCT */
4860 + .short L_case_i - 0b /* FFI_TYPE_POINTER */
4862 +#if defined(__SH4__)
4864 +#ifdef __LITTLE_ENDIAN__
4889 +#ifdef __LITTLE_ENDIAN__
4897 +#ifdef __LITTLE_ENDIAN__
4906 +#ifdef __LITTLE_ENDIAN__
4914 +#ifdef __LITTLE_ENDIAN__
4920 + /* fall through */
4923 +#if defined(__SH4__)
4932 +.ffi_closure_SYSV_end:
4933 + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
4935 + .section ".eh_frame","aw",@progbits
4937 + .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */
4939 + .4byte 0x0 /* CIE Identifier Tag */
4940 + .byte 0x1 /* CIE Version */
4941 + .byte 0x0 /* CIE Augmentation */
4942 + .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */
4943 + .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */
4944 + .byte 0x11 /* CIE RA Column */
4945 + .byte 0xc /* DW_CFA_def_cfa */
4946 + .byte 0xf /* uleb128 0xf */
4947 + .byte 0x0 /* uleb128 0x0 */
4951 + .4byte .LEFDE1-.LASFDE1 /* FDE Length */
4953 + .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */
4954 + .4byte .LFB1 /* FDE initial location */
4955 + .4byte .LFE1-.LFB1 /* FDE address range */
4956 + .byte 0x4 /* DW_CFA_advance_loc4 */
4957 + .4byte .LCFI0-.LFB1
4958 + .byte 0xe /* DW_CFA_def_cfa_offset */
4959 + .byte 0x4 /* uleb128 0x4 */
4960 + .byte 0x4 /* DW_CFA_advance_loc4 */
4961 + .4byte .LCFI1-.LCFI0
4962 + .byte 0xe /* DW_CFA_def_cfa_offset */
4963 + .byte 0x8 /* uleb128 0x4 */
4964 + .byte 0x4 /* DW_CFA_advance_loc4 */
4965 + .4byte .LCFI2-.LCFI1
4966 + .byte 0xe /* DW_CFA_def_cfa_offset */
4967 + .byte 0xc /* uleb128 0x4 */
4968 + .byte 0x4 /* DW_CFA_advance_loc4 */
4969 + .4byte .LCFI3-.LCFI2
4970 + .byte 0xe /* DW_CFA_def_cfa_offset */
4971 + .byte 0x10 /* uleb128 0x4 */
4972 + .byte 0x4 /* DW_CFA_advance_loc4 */
4973 + .4byte .LCFI4-.LCFI3
4974 + .byte 0xe /* DW_CFA_def_cfa_offset */
4975 + .byte 0x14 /* uleb128 0x4 */
4976 + .byte 0x4 /* DW_CFA_advance_loc4 */
4977 + .4byte .LCFI5-.LCFI4
4978 + .byte 0xe /* DW_CFA_def_cfa_offset */
4979 + .byte 0x18 /* uleb128 0x4 */
4980 + .byte 0x91 /* DW_CFA_offset, column 0x11 */
4981 + .byte 0x6 /* uleb128 0x6 */
4982 + .byte 0x8e /* DW_CFA_offset, column 0xe */
4983 + .byte 0x5 /* uleb128 0x5 */
4984 + .byte 0x8c /* DW_CFA_offset, column 0xc */
4985 + .byte 0x4 /* uleb128 0x4 */
4986 + .byte 0x8a /* DW_CFA_offset, column 0xa */
4987 + .byte 0x3 /* uleb128 0x3 */
4988 + .byte 0x89 /* DW_CFA_offset, column 0x9 */
4989 + .byte 0x2 /* uleb128 0x2 */
4990 + .byte 0x88 /* DW_CFA_offset, column 0x8 */
4991 + .byte 0x1 /* uleb128 0x1 */
4992 + .byte 0x4 /* DW_CFA_advance_loc4 */
4993 + .4byte .LCFI6-.LCFI5
4994 + .byte 0xd /* DW_CFA_def_cfa_register */
4995 + .byte 0xe /* uleb128 0xe */
5000 + .4byte .LEFDE3-.LASFDE3 /* FDE Length */
5002 + .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */
5003 + .4byte .LFB2 /* FDE initial location */
5004 + .4byte .LFE2-.LFB2 /* FDE address range */
5005 + .byte 0x4 /* DW_CFA_advance_loc4 */
5006 + .4byte .LCFI7-.LFB2
5007 + .byte 0xe /* DW_CFA_def_cfa_offset */
5008 + .byte 0x4 /* uleb128 0x4 */
5009 + .byte 0x4 /* DW_CFA_advance_loc4 */
5010 + .4byte .LCFI8-.LCFI7
5011 + .byte 0xe /* DW_CFA_def_cfa_offset */
5012 + .byte 0x8 /* uleb128 0x8 */
5013 + .byte 0x4 /* DW_CFA_advance_loc4 */
5014 + .4byte .LCFI9-.LCFI8
5015 + .byte 0xe /* DW_CFA_def_cfa_offset */
5016 +#if defined(__SH4__)
5017 + .byte 8+56 /* uleb128 8+56 */
5019 + .byte 8+24 /* uleb128 8+24 */
5021 + .byte 0x91 /* DW_CFA_offset, column 0x11 */
5023 + .byte 0x8e /* DW_CFA_offset, column 0xe */
5025 + .byte 0x4 /* DW_CFA_advance_loc4 */
5026 + .4byte .LCFIA-.LCFI9
5027 + .byte 0xd /* DW_CFA_def_cfa_register */
5028 + .byte 0xe /* uleb128 0xe */
5031 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/ffi.c gcc/libffi/src/sparc/ffi.c
5032 --- gcc-3.2.2.orig/libffi/src/sparc/ffi.c Sat Mar 3 07:21:23 2001
5033 +++ gcc/libffi/src/sparc/ffi.c Sat Jan 4 08:08:56 2003
5035 /* -----------------------------------------------------------------------
5036 - ffi.c - Copyright (c) 1996 Cygnus Solutions
5037 + ffi.c - Copyright (c) 1996, 2003 Cygnus Solutions
5039 Sparc Foreign Function Interface
5046 +extern void ffi_closure_v9(void);
5048 +extern void ffi_closure_v8(void);
5051 /* ffi_prep_args is called by the assembly routine once stack space
5052 has been allocated for the function's arguments */
5054 void ffi_prep_args_v8(char *stack, extended_cif *ecif)
5065 /* Skip 16 words for the window save area */
5066 argp = stack + 16*sizeof(int);
5069 ((int*)argp)[5] = 0;
5072 - avn = ecif->cif->nargs;
5073 p_argv = ecif->avalue;
5075 - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
5078 + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++)
5085 if ((*p_arg)->type == FFI_TYPE_STRUCT
5086 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
5087 || (*p_arg)->type == FFI_TYPE_LONGDOUBLE
5096 @@ -420,3 +415,101 @@
5102 +ffi_prep_closure (ffi_closure* closure,
5104 + void (*fun)(ffi_cif*, void*, void**, void*),
5107 + unsigned int *tramp = (unsigned int *) &closure->tramp[0];
5109 + unsigned long ctx = (unsigned long) closure;
5112 + /* Trampoline address is equal to the closure address. We take advantage
5113 + of that to reduce the trampoline size by 8 bytes. */
5114 + FFI_ASSERT (cif->abi == FFI_V9);
5115 + fn = (unsigned long) ffi_closure_v9;
5116 + tramp[0] = 0x83414000; /* rd %pc, %g1 */
5117 + tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */
5118 + tramp[2] = 0x81c14000; /* jmp %g5 */
5119 + tramp[3] = 0x01000000; /* nop */
5120 + *((unsigned long *) &tramp[4]) = fn;
5122 + FFI_ASSERT (cif->abi == FFI_V8);
5123 + fn = (unsigned long) ffi_closure_v8;
5124 + tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */
5125 + tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */
5126 + tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */
5127 + tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */
5130 + closure->cif = cif;
5131 + closure->fun = fun;
5132 + closure->user_data = user_data;
5134 + /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */
5136 + asm volatile ("flush %0" : : "r" (closure) : "memory");
5137 + asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory");
5139 + asm volatile ("iflush %0" : : "r" (closure) : "memory");
5140 + asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory");
5147 +ffi_closure_sparc_inner(ffi_closure *closure,
5148 + void *rvalue, unsigned long *gpr, double *fpr)
5152 + ffi_type **arg_types;
5155 + cif = closure->cif;
5156 + avalue = alloca(cif->nargs * sizeof(void *));
5160 + /* Copy the caller's structure return address to that the closure
5161 + returns the data directly to the caller. */
5162 + if (cif->flags == FFI_TYPE_STRUCT)
5164 + rvalue = (void *) gpr[0];
5170 + arg_types = cif->arg_types;
5172 + /* Grab the addresses of the arguments from the stack frame. */
5175 + /* Assume big-endian. FIXME */
5176 + argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG;
5179 + if (i < 6 && (arg_types[i]->type == FFI_TYPE_FLOAT
5180 + || arg_types[i]->type == FFI_TYPE_DOUBLE
5181 +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
5182 + || arg_types[i]->type == FFI_TYPE_LONGDOUBLE
5185 + avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size;
5188 + avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size;
5192 + /* Invoke the closure. */
5193 + (closure->fun) (cif, rvalue, avalue, closure->user_data);
5195 + /* Tell ffi_closure_sparc how to perform return type promotions. */
5196 + return cif->rtype->type;
5198 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/v8.S gcc/libffi/src/sparc/v8.S
5199 --- gcc-3.2.2.orig/libffi/src/sparc/v8.S Mon Apr 29 05:12:04 2002
5200 +++ gcc/libffi/src/sparc/v8.S Sat Jan 4 08:08:56 2003
5202 /* -----------------------------------------------------------------------
5203 - v8.S - Copyright (c) 1996, 1997 Cygnus Solutions
5204 + v8.S - Copyright (c) 1996, 1997, 2003 Cygnus Solutions
5206 Sparc Foreign Function Interface
5210 .size ffi_call_V8,.ffi_call_V8_end-ffi_call_V8
5213 +#define STACKFRAME 104 /* 16*4 register window +
5214 + 1*4 struct return +
5215 + 6*4 args backing store +
5218 +/* ffi_closure_v8(...)
5220 + Receives the closure argument in %g2. */
5224 + .globl ffi_closure_v8
5227 + .register %g2, #scratch
5229 + save %sp, -STACKFRAME, %sp
5232 + ! Store all of the potential argument registers in va_list format.
5233 + st %i0, [%fp+68+0]
5234 + st %i1, [%fp+68+4]
5235 + st %i2, [%fp+68+8]
5236 + st %i3, [%fp+68+12]
5237 + st %i4, [%fp+68+16]
5238 + st %i5, [%fp+68+20]
5240 + ! Call ffi_closure_sparc_inner to do the bulk of the work.
5244 + call ffi_closure_sparc_inner
5247 + ! Load up the return value in the proper type.
5248 + cmp %o0, FFI_TYPE_VOID
5251 + cmp %o0, FFI_TYPE_FLOAT
5255 + cmp %o0, FFI_TYPE_DOUBLE
5259 + cmp %o0, FFI_TYPE_SINT64
5263 + cmp %o0, FFI_TYPE_UINT64
5275 +.ffi_closure_v8_end:
5276 + .size ffi_closure_v8,.ffi_closure_v8_end-ffi_closure_v8
5281 @@ -148,3 +214,26 @@
5282 .byte 0x1f ! uleb128 0x1f
5286 + .uaword .LLEFDE2-.LLASFDE2 ! FDE Length
5288 + .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset
5289 +#ifdef HAVE_AS_SPARC_UA_PCREL
5290 + .uaword %r_disp32(.LLFB2)
5291 + .uaword .LLFE2-.LLFB2 ! FDE address range
5295 + .uanword .LLFE2-.LLFB2 ! FDE address range
5297 + .byte 0x0 ! uleb128 0x0; Augmentation size
5298 + .byte 0x4 ! DW_CFA_advance_loc4
5299 + .uaword .LLCFI1-.LLFB2
5300 + .byte 0xd ! DW_CFA_def_cfa_register
5301 + .byte 0x1e ! uleb128 0x1e
5302 + .byte 0x2d ! DW_CFA_GNU_window_save
5303 + .byte 0x9 ! DW_CFA_register
5304 + .byte 0xf ! uleb128 0xf
5305 + .byte 0x1f ! uleb128 0x1f
5308 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/v9.S gcc/libffi/src/sparc/v9.S
5309 --- gcc-3.2.2.orig/libffi/src/sparc/v9.S Mon Apr 29 05:12:04 2002
5310 +++ gcc/libffi/src/sparc/v9.S Sat Jan 4 08:08:56 2003
5312 /* -----------------------------------------------------------------------
5313 - v9.S - Copyright (c) 2000 Cygnus Solutions
5314 + v9.S - Copyright (c) 2000, 2003 Cygnus Solutions
5316 Sparc 64bit Foreign Function Interface
5319 cmp %i3, FFI_TYPE_STRUCT
5320 be,pn %icc, dostruct
5322 - cmp %i3, FFI_TYPE_LONGDOUBLE
5323 + cmp %i3, FFI_TYPE_LONGDOUBLE
5327 @@ -125,6 +125,88 @@
5329 .size ffi_call_V9,.ffi_call_V9_end-ffi_call_V9
5332 +#define STACKFRAME 240 /* 16*8 register window +
5333 + 6*8 args backing store +
5335 +#define FP %fp+STACK_BIAS
5337 +/* ffi_closure_v9(...)
5339 + Receives the closure argument in %g1. */
5343 + .globl ffi_closure_v9
5347 + save %sp, -STACKFRAME, %sp
5350 + ! Store all of the potential argument registers in va_list format.
5351 + stx %i0, [FP+128+0]
5352 + stx %i1, [FP+128+8]
5353 + stx %i2, [FP+128+16]
5354 + stx %i3, [FP+128+24]
5355 + stx %i4, [FP+128+32]
5356 + stx %i5, [FP+128+40]
5358 + ! Store possible floating point argument registers too.
5366 + ! Call ffi_closure_sparc_inner to do the bulk of the work.
5368 + add %fp, STACK_BIAS-64, %o1
5369 + add %fp, STACK_BIAS+128, %o2
5370 + call ffi_closure_sparc_inner
5371 + add %fp, STACK_BIAS-48, %o3
5373 + ! Load up the return value in the proper type.
5374 + cmp %o0, FFI_TYPE_VOID
5377 + cmp %o0, FFI_TYPE_FLOAT
5378 + be,a,pn %icc, done1
5381 + cmp %o0, FFI_TYPE_DOUBLE
5382 + be,a,pn %icc, done1
5385 + cmp %o0, FFI_TYPE_LONGDOUBLE
5386 + be,a,pn %icc, longdouble1
5389 + cmp %o0, FFI_TYPE_STRUCT
5390 + be,pn %icc, struct1
5392 + ! FFI_TYPE_UINT64 | FFI_TYPE_SINT64 | FFI_TYPE_POINTER
5410 +.ffi_closure_v9_end:
5411 + .size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9
5413 .section ".eh_frame",#alloc,#write
5415 .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry
5416 @@ -169,5 +251,27 @@
5417 .byte 0x1f ! uleb128 0x1f
5422 + .uaword .LLEFDE2-.LLASFDE2 ! FDE Length
5424 + .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset
5425 +#ifdef HAVE_AS_SPARC_UA_PCREL
5426 + .uaword %r_disp32(.LLFB2)
5427 + .uaword .LLFE2-.LLFB2 ! FDE address range
5431 + .uaxword .LLFE2-.LLFB2 ! FDE address range
5433 + .byte 0x0 ! uleb128 0x0; Augmentation size
5434 + .byte 0x4 ! DW_CFA_advance_loc4
5435 + .uaword .LLCFI1-.LLFB2
5436 + .byte 0xd ! DW_CFA_def_cfa_register
5437 + .byte 0x1e ! uleb128 0x1e
5438 + .byte 0x2d ! DW_CFA_GNU_window_save
5439 + .byte 0x9 ! DW_CFA_register
5440 + .byte 0xf ! uleb128 0xf
5441 + .byte 0x1f ! uleb128 0x1f
5445 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/types.c gcc/libffi/src/types.c
5446 --- gcc-3.2.2.orig/libffi/src/types.c Tue Mar 27 11:39:16 2001
5447 +++ gcc/libffi/src/types.c Wed Nov 27 07:24:05 2002
5449 FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32);
5450 FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
5452 -#if defined ALPHA || defined SPARC64
5453 +#if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \
5456 FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER);
5463 +#if defined X86 || defined X86_WIN32 || defined ARM || defined M68K
5465 FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
5466 FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
5468 -#elif defined X86_WIN32
5470 -FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
5471 -FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
5475 -FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
5476 -FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
5481 FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
5482 FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
5489 -FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
5490 -FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
5492 -#elif defined X86_WIN32
5493 +#if defined X86 || defined X86_WIN32 || defined M68K
5495 FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
5496 FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
5498 FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
5499 FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
5504 FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
5505 -FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
5506 +FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
5510 FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
5514 FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
5518 FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE);
5522 +#elif defined X86_64
5524 +FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
5525 +FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
5529 FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
5530 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/ffi.c gcc/libffi/src/x86/ffi.c
5531 --- gcc-3.2.2.orig/libffi/src/x86/ffi.c Tue May 28 18:22:08 2002
5532 +++ gcc/libffi/src/x86/ffi.c Fri Dec 6 10:16:45 2002
5534 /* -----------------------------------------------------------------------
5535 - ffi.c - Copyright (c) 1996, 1998, 1999 Cygnus Solutions
5536 + ffi.c - Copyright (c) 1996, 1998, 1999, 2001 Red Hat, Inc.
5537 + Copyright (c) 2002 Ranjit Mathew
5538 + Copyright (c) 2002 Bo Thorsen
5539 + Copyright (c) 2002 Roger Sayle
5541 x86 Foreign Function Interface
5544 OTHER DEALINGS IN THE SOFTWARE.
5545 ----------------------------------------------------------------------- */
5550 #include <ffi_common.h>
5555 register unsigned int i;
5557 register void **p_argv;
5558 register char *argp;
5559 register ffi_type **p_arg;
5564 if (ecif->cif->rtype->type == FFI_TYPE_STRUCT)
5565 @@ -148,6 +151,18 @@
5571 +/*@-exportheader@*/
5572 +extern void ffi_call_STDCALL(void (*)(char *, extended_cif *),
5573 + /*@out@*/ extended_cif *,
5574 + unsigned, unsigned,
5575 + /*@out@*/ unsigned *,
5578 +/*@=exportheader@*/
5579 +#endif /* X86_WIN32 */
5581 void ffi_call(/*@dependent@*/ ffi_cif *cif,
5583 /*@out@*/ void *rvalue,
5584 @@ -180,6 +195,14 @@
5585 cif->flags, ecif.rvalue, fn);
5591 + ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes,
5592 + cif->flags, ecif.rvalue, fn);
5595 +#endif /* X86_WIN32 */
5599 @@ -266,12 +289,10 @@
5602 register unsigned int i;
5604 register void **p_argv;
5605 register char *argp;
5606 register ffi_type **p_arg;
5611 if ( cif->rtype->type == FFI_TYPE_STRUCT ) {
5612 @@ -281,13 +302,14 @@
5616 - for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++)
5617 + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
5621 /* Align if necessary */
5622 - if (((*p_arg)->alignment - 1) & (unsigned) argp)
5623 + if (((*p_arg)->alignment - 1) & (unsigned) argp) {
5624 argp = (char *) ALIGN(argp, (*p_arg)->alignment);
5638 @@ -449,6 +471,15 @@
5639 /*@out@*/ unsigned *,
5644 +ffi_call_STDCALL(void (*)(char *, extended_cif *),
5645 + /*@out@*/ extended_cif *,
5646 + unsigned, unsigned,
5647 + /*@out@*/ unsigned *,
5649 +#endif /* X86_WIN32 */
5652 ffi_raw_call(/*@dependent@*/ ffi_cif *cif,
5654 @@ -483,6 +514,14 @@
5655 cif->flags, ecif.rvalue, fn);
5661 + ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes,
5662 + cif->flags, ecif.rvalue, fn);
5665 +#endif /* X86_WIN32 */
5674 +#endif /* __x86_64__ */
5675 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/ffi64.c gcc/libffi/src/x86/ffi64.c
5676 --- gcc-3.2.2.orig/libffi/src/x86/ffi64.c Thu Jan 1 09:00:00 1970
5677 +++ gcc/libffi/src/x86/ffi64.c Wed Jan 29 00:54:28 2003
5679 +/* -----------------------------------------------------------------------
5680 + ffi.c - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
5682 + x86-64 Foreign Function Interface
5684 + Permission is hereby granted, free of charge, to any person obtaining
5685 + a copy of this software and associated documentation files (the
5686 + ``Software''), to deal in the Software without restriction, including
5687 + without limitation the rights to use, copy, modify, merge, publish,
5688 + distribute, sublicense, and/or sell copies of the Software, and to
5689 + permit persons to whom the Software is furnished to do so, subject to
5690 + the following conditions:
5692 + The above copyright notice and this permission notice shall be included
5693 + in all copies or substantial portions of the Software.
5695 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
5696 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
5697 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
5698 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
5699 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
5700 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
5701 + OTHER DEALINGS IN THE SOFTWARE.
5702 + ----------------------------------------------------------------------- */
5705 +#include <ffi_common.h>
5707 +#include <stdlib.h>
5708 +#include <stdarg.h>
5710 +/* ffi_prep_args is called by the assembly routine once stack space
5711 + has been allocated for the function's arguments */
5715 +#define MAX_GPR_REGS 6
5716 +#define MAX_SSE_REGS 8
5719 + /* Registers for argument passing. */
5720 + long gpr[MAX_GPR_REGS];
5721 + __int128_t sse[MAX_SSE_REGS];
5723 + /* Stack space for arguments. */
5727 +/* All reference to register classes here is identical to the code in
5728 + gcc/config/i386/i386.c. Do *not* change one without the other. */
5730 +/* Register class used for passing given 64bit part of the argument.
5731 + These represent classes as documented by the PS ABI, with the exception
5732 + of SSESF, SSEDF classes, that are basically SSE class, just gcc will
5733 + use SF or DFmode move instead of DImode to avoid reformating penalties.
5735 + Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves
5736 + whenever possible (upper half does contain padding).
5738 +enum x86_64_reg_class
5741 + X86_64_INTEGER_CLASS,
5742 + X86_64_INTEGERSI_CLASS,
5744 + X86_64_SSESF_CLASS,
5745 + X86_64_SSEDF_CLASS,
5746 + X86_64_SSEUP_CLASS,
5748 + X86_64_X87UP_CLASS,
5749 + X86_64_MEMORY_CLASS
5752 +#define MAX_CLASSES 4
5754 +/* x86-64 register passing implementation. See x86-64 ABI for details. Goal
5755 + of this code is to classify each 8bytes of incoming argument by the register
5756 + class and assign registers accordingly. */
5758 +/* Return the union class of CLASS1 and CLASS2.
5759 + See the x86-64 PS ABI for details. */
5761 +static enum x86_64_reg_class
5762 +merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
5764 + /* Rule #1: If both classes are equal, this is the resulting class. */
5765 + if (class1 == class2)
5768 + /* Rule #2: If one of the classes is NO_CLASS, the resulting class is
5769 + the other class. */
5770 + if (class1 == X86_64_NO_CLASS)
5772 + if (class2 == X86_64_NO_CLASS)
5775 + /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */
5776 + if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS)
5777 + return X86_64_MEMORY_CLASS;
5779 + /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */
5780 + if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS)
5781 + || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS))
5782 + return X86_64_INTEGERSI_CLASS;
5783 + if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS
5784 + || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS)
5785 + return X86_64_INTEGER_CLASS;
5787 + /* Rule #5: If one of the classes is X87 or X87UP class, MEMORY is used. */
5788 + if (class1 == X86_64_X87_CLASS || class1 == X86_64_X87UP_CLASS
5789 + || class2 == X86_64_X87_CLASS || class2 == X86_64_X87UP_CLASS)
5790 + return X86_64_MEMORY_CLASS;
5792 + /* Rule #6: Otherwise class SSE is used. */
5793 + return X86_64_SSE_CLASS;
5796 +/* Classify the argument of type TYPE and mode MODE.
5797 + CLASSES will be filled by the register class used to pass each word
5798 + of the operand. The number of words is returned. In case the parameter
5799 + should be passed in memory, 0 is returned. As a special case for zero
5800 + sized containers, classes[0] will be NO_CLASS and 1 is returned.
5802 + See the x86-64 PS ABI for details.
5805 +classify_argument (ffi_type *type, enum x86_64_reg_class classes[],
5808 + /* First, align to the right place. */
5809 + *byte_offset = ALIGN(*byte_offset, type->alignment);
5811 + switch (type->type)
5813 + case FFI_TYPE_UINT8:
5814 + case FFI_TYPE_SINT8:
5815 + case FFI_TYPE_UINT16:
5816 + case FFI_TYPE_SINT16:
5817 + case FFI_TYPE_UINT32:
5818 + case FFI_TYPE_SINT32:
5819 + case FFI_TYPE_UINT64:
5820 + case FFI_TYPE_SINT64:
5821 + case FFI_TYPE_POINTER:
5822 + if (((*byte_offset) % 8 + type->size) <= 4)
5823 + classes[0] = X86_64_INTEGERSI_CLASS;
5825 + classes[0] = X86_64_INTEGER_CLASS;
5827 + case FFI_TYPE_FLOAT:
5828 + if (((*byte_offset) % 8) == 0)
5829 + classes[0] = X86_64_SSESF_CLASS;
5831 + classes[0] = X86_64_SSE_CLASS;
5833 + case FFI_TYPE_DOUBLE:
5834 + classes[0] = X86_64_SSEDF_CLASS;
5836 + case FFI_TYPE_LONGDOUBLE:
5837 + classes[0] = X86_64_X87_CLASS;
5838 + classes[1] = X86_64_X87UP_CLASS;
5840 + case FFI_TYPE_STRUCT:
5842 + const int UNITS_PER_WORD = 8;
5843 + int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
5846 + enum x86_64_reg_class subclasses[MAX_CLASSES];
5848 + /* If the struct is larger than 16 bytes, pass it on the stack. */
5849 + if (type->size > 16)
5852 + for (i = 0; i < words; i++)
5853 + classes[i] = X86_64_NO_CLASS;
5855 + /* Merge the fields of structure. */
5856 + for (ptr=type->elements; (*ptr)!=NULL; ptr++)
5860 + num = classify_argument (*ptr, subclasses, byte_offset);
5863 + for (i = 0; i < num; i++)
5865 + int pos = *byte_offset / 8;
5866 + classes[i + pos] =
5867 + merge_classes (subclasses[i], classes[i + pos]);
5870 + if ((*ptr)->type != FFI_TYPE_STRUCT)
5871 + *byte_offset += (*ptr)->size;
5874 + /* Final merger cleanup. */
5875 + for (i = 0; i < words; i++)
5877 + /* If one class is MEMORY, everything should be passed in
5879 + if (classes[i] == X86_64_MEMORY_CLASS)
5882 + /* The X86_64_SSEUP_CLASS should be always preceded by
5883 + X86_64_SSE_CLASS. */
5884 + if (classes[i] == X86_64_SSEUP_CLASS
5885 + && (i == 0 || classes[i - 1] != X86_64_SSE_CLASS))
5886 + classes[i] = X86_64_SSE_CLASS;
5888 + /* X86_64_X87UP_CLASS should be preceded by X86_64_X87_CLASS. */
5889 + if (classes[i] == X86_64_X87UP_CLASS
5890 + && (i == 0 || classes[i - 1] != X86_64_X87_CLASS))
5891 + classes[i] = X86_64_SSE_CLASS;
5899 + return 0; /* Never reached. */
5902 +/* Examine the argument and return set number of register required in each
5903 + class. Return 0 iff parameter should be passed in memory. */
5905 +examine_argument (ffi_type *type, int in_return, int *int_nregs,int *sse_nregs)
5907 + enum x86_64_reg_class class[MAX_CLASSES];
5911 + n = classify_argument (type, class, &offset);
5918 + for (n--; n>=0; n--)
5921 + case X86_64_INTEGER_CLASS:
5922 + case X86_64_INTEGERSI_CLASS:
5925 + case X86_64_SSE_CLASS:
5926 + case X86_64_SSESF_CLASS:
5927 + case X86_64_SSEDF_CLASS:
5930 + case X86_64_NO_CLASS:
5931 + case X86_64_SSEUP_CLASS:
5933 + case X86_64_X87_CLASS:
5934 + case X86_64_X87UP_CLASS:
5944 +/* Functions to load floats and double to an SSE register placeholder. */
5945 +extern void float2sse (float, __int128_t *);
5946 +extern void double2sse (double, __int128_t *);
5947 +extern void floatfloat2sse (void *, __int128_t *);
5949 +/* Functions to put the floats and doubles back. */
5950 +extern float sse2float (__int128_t *);
5951 +extern double sse2double (__int128_t *);
5952 +extern void sse2floatfloat(__int128_t *, void *);
5954 +/*@-exportheader@*/
5956 +ffi_prep_args (stackLayout *stack, extended_cif *ecif)
5957 +/*@=exportheader@*/
5959 + int gprcount, ssecount, i, g, s;
5961 + void *argp = &stack->argspace;
5964 + /* First check if the return value should be passed in memory. If so,
5965 + pass the pointer as the first argument. */
5966 + gprcount = ssecount = 0;
5967 + if (ecif->cif->rtype->type != FFI_TYPE_VOID
5968 + && examine_argument (ecif->cif->rtype, 1, &g, &s) == 0)
5969 + (void *)stack->gpr[gprcount++] = ecif->rvalue;
5971 + for (i=ecif->cif->nargs, p_arg=ecif->cif->arg_types, p_argv = ecif->avalue;
5972 + i!=0; i--, p_arg++, p_argv++)
5974 + int in_register = 0;
5976 + switch ((*p_arg)->type)
5978 + case FFI_TYPE_SINT8:
5979 + case FFI_TYPE_SINT16:
5980 + case FFI_TYPE_SINT32:
5981 + case FFI_TYPE_SINT64:
5982 + case FFI_TYPE_UINT8:
5983 + case FFI_TYPE_UINT16:
5984 + case FFI_TYPE_UINT32:
5985 + case FFI_TYPE_UINT64:
5986 + case FFI_TYPE_POINTER:
5987 + if (gprcount < MAX_GPR_REGS)
5989 + stack->gpr[gprcount] = 0;
5990 + stack->gpr[gprcount++] = *(long long *)(*p_argv);
5995 + case FFI_TYPE_FLOAT:
5996 + if (ssecount < MAX_SSE_REGS)
5998 + float2sse (*(float *)(*p_argv), &stack->sse[ssecount++]);
6003 + case FFI_TYPE_DOUBLE:
6004 + if (ssecount < MAX_SSE_REGS)
6006 + double2sse (*(double *)(*p_argv), &stack->sse[ssecount++]);
6015 + /* Either all places in registers where filled, or this is a
6016 + type that potentially goes into a memory slot. */
6017 + if (examine_argument (*p_arg, 0, &g, &s) == 0
6018 + || gprcount + g > MAX_GPR_REGS || ssecount + s > MAX_SSE_REGS)
6020 + /* Pass this argument in memory. */
6021 + argp = (void *)ALIGN(argp, (*p_arg)->alignment);
6022 + memcpy (argp, *p_argv, (*p_arg)->size);
6023 + argp += (*p_arg)->size;
6027 + /* All easy cases are eliminated. Now fire the big guns. */
6029 + enum x86_64_reg_class classes[MAX_CLASSES];
6030 + int offset = 0, j, num;
6033 + num = classify_argument (*p_arg, classes, &offset);
6034 + for (j=0, a=*p_argv; j<num; j++, a+=8)
6036 + switch (classes[j])
6038 + case X86_64_INTEGER_CLASS:
6039 + case X86_64_INTEGERSI_CLASS:
6040 + stack->gpr[gprcount++] = *(long long *)a;
6042 + case X86_64_SSE_CLASS:
6043 + floatfloat2sse (a, &stack->sse[ssecount++]);
6045 + case X86_64_SSESF_CLASS:
6046 + float2sse (*(float *)a, &stack->sse[ssecount++]);
6048 + case X86_64_SSEDF_CLASS:
6049 + double2sse (*(double *)a, &stack->sse[ssecount++]);
6059 +/* Perform machine dependent cif processing. */
6061 +ffi_prep_cif_machdep (ffi_cif *cif)
6063 + int gprcount, ssecount, i, g, s;
6065 + gprcount = ssecount = 0;
6067 + /* Reset the byte count. We handle this size estimation here. */
6070 + /* If the return value should be passed in memory, pass the pointer
6071 + as the first argument. The actual memory isn't allocated here. */
6072 + if (cif->rtype->type != FFI_TYPE_VOID
6073 + && examine_argument (cif->rtype, 1, &g, &s) == 0)
6076 + /* Go over all arguments and determine the way they should be passed.
6077 + If it's in a register and there is space for it, let that be so. If
6078 + not, add it's size to the stack byte count. */
6079 + for (i=0; i<cif->nargs; i++)
6081 + if (examine_argument (cif->arg_types[i], 0, &g, &s) == 0
6082 + || gprcount + g > MAX_GPR_REGS || ssecount + s > MAX_SSE_REGS)
6084 + /* This is passed in memory. First align to the basic type. */
6085 + cif->bytes = ALIGN(cif->bytes, cif->arg_types[i]->alignment);
6087 + /* Stack arguments are *always* at least 8 byte aligned. */
6088 + cif->bytes = ALIGN(cif->bytes, 8);
6090 + /* Now add the size of this argument. */
6091 + cif->bytes += cif->arg_types[i]->size;
6100 + /* Set the flag for the closures return. */
6101 + switch (cif->rtype->type)
6103 + case FFI_TYPE_VOID:
6104 + case FFI_TYPE_STRUCT:
6105 + case FFI_TYPE_SINT64:
6106 + case FFI_TYPE_FLOAT:
6107 + case FFI_TYPE_DOUBLE:
6108 + case FFI_TYPE_LONGDOUBLE:
6109 + cif->flags = (unsigned) cif->rtype->type;
6112 + case FFI_TYPE_UINT64:
6113 + cif->flags = FFI_TYPE_SINT64;
6117 + cif->flags = FFI_TYPE_INT;
6127 + __int128_t sse[2];
6132 +ffi_fill_return_value (return_value *rv, extended_cif *ecif)
6134 + enum x86_64_reg_class classes[MAX_CLASSES];
6136 + long *gpr = rv->gpr;
6137 + __int128_t *sse = rv->sse;
6141 + /* This is needed because of the way x86-64 handles signed short
6143 + switch (ecif->cif->rtype->type)
6145 + case FFI_TYPE_SINT8:
6146 + sc = *(signed char *)gpr;
6147 + *(long long *)ecif->rvalue = (long long)sc;
6149 + case FFI_TYPE_SINT16:
6150 + ss = *(signed short *)gpr;
6151 + *(long long *)ecif->rvalue = (long long)ss;
6154 + /* Just continue. */
6158 + num = classify_argument (ecif->cif->rtype, classes, &i);
6161 + /* Return in memory. */
6162 + ecif->rvalue = (void *) rv->gpr[0];
6163 + else if (num == 2 && classes[0] == X86_64_X87_CLASS &&
6164 + classes[1] == X86_64_X87UP_CLASS)
6165 + /* This is a long double (this is easiest to handle this way instead
6166 + of an eightbyte at a time as in the loop below. */
6167 + *((long double *)ecif->rvalue) = rv->st0;
6172 + for (i=0, a=ecif->rvalue; i<num; i++, a+=8)
6174 + switch (classes[i])
6176 + case X86_64_INTEGER_CLASS:
6177 + case X86_64_INTEGERSI_CLASS:
6178 + *(long long *)a = *gpr;
6181 + case X86_64_SSE_CLASS:
6182 + sse2floatfloat (sse++, a);
6184 + case X86_64_SSESF_CLASS:
6185 + *(float *)a = sse2float (sse++);
6187 + case X86_64_SSEDF_CLASS:
6188 + *(double *)a = sse2double (sse++);
6198 +/*@-exportheader@*/
6199 +extern void ffi_call_UNIX64(void (*)(stackLayout *, extended_cif *),
6200 + void (*) (return_value *, extended_cif *),
6201 + /*@out@*/ extended_cif *,
6202 + unsigned, /*@out@*/ unsigned *, void (*fn)());
6204 +/*@=exportheader@*/
6206 +void ffi_call(/*@dependent@*/ ffi_cif *cif,
6208 + /*@out@*/ void *rvalue,
6209 + /*@dependent@*/ void **avalue)
6211 + extended_cif ecif;
6215 + ecif.avalue = avalue;
6217 + /* If the return value is a struct and we don't have a return */
6218 + /* value address then we need to make one */
6220 + if ((rvalue == NULL) &&
6221 + (examine_argument (cif->rtype, 1, &dummy, &dummy) == 0))
6224 + ecif.rvalue = alloca(cif->rtype->size);
6228 + ecif.rvalue = rvalue;
6230 + /* Stack must always be 16byte aligned. Make it so. */
6231 + cif->bytes = ALIGN(cif->bytes, 16);
6236 + /* Calling 32bit code from 64bit is not possible */
6242 + ffi_call_UNIX64 (ffi_prep_args, ffi_fill_return_value, &ecif,
6243 + cif->bytes, ecif.rvalue, fn);
6253 +extern void ffi_closure_UNIX64(void);
6256 +ffi_prep_closure (ffi_closure* closure,
6258 + void (*fun)(ffi_cif*, void*, void**, void*),
6261 + volatile unsigned short *tramp;
6263 + /* FFI_ASSERT (cif->abi == FFI_OSF); */
6265 + tramp = (volatile unsigned short *) &closure->tramp[0];
6266 + tramp[0] = 0xbb49; /* mov <code>, %r11 */
6267 + tramp[5] = 0xba49; /* mov <data>, %r10 */
6268 + tramp[10] = 0xff49; /* jmp *%r11 */
6269 + tramp[11] = 0x00e3;
6270 + *(void * volatile *) &tramp[1] = ffi_closure_UNIX64;
6271 + *(void * volatile *) &tramp[6] = closure;
6273 + closure->cif = cif;
6274 + closure->fun = fun;
6275 + closure->user_data = user_data;
6281 +ffi_closure_UNIX64_inner(ffi_closure *closure, va_list l, void *rp)
6285 + ffi_type **arg_types;
6286 + long i, avn, argn;
6288 + cif = closure->cif;
6289 + avalue = alloca(cif->nargs * sizeof(void *));
6295 + arg_types = cif->arg_types;
6297 + /* Grab the addresses of the arguments from the stack frame. */
6300 + switch (arg_types[i]->type)
6302 + case FFI_TYPE_SINT8:
6303 + case FFI_TYPE_UINT8:
6304 + case FFI_TYPE_SINT16:
6305 + case FFI_TYPE_UINT16:
6306 + case FFI_TYPE_SINT32:
6307 + case FFI_TYPE_UINT32:
6308 + case FFI_TYPE_SINT64:
6309 + case FFI_TYPE_UINT64:
6310 + case FFI_TYPE_POINTER:
6312 + if (l->gp_offset > 48-8)
6314 + avalue[i] = l->overflow_arg_area;
6315 + l->overflow_arg_area = (char *)l->overflow_arg_area + 8;
6319 + avalue[i] = (char *)l->reg_save_area + l->gp_offset;
6320 + l->gp_offset += 8;
6325 + case FFI_TYPE_STRUCT:
6330 + case FFI_TYPE_DOUBLE:
6332 + if (l->fp_offset > 176-16)
6334 + avalue[i] = l->overflow_arg_area;
6335 + l->overflow_arg_area = (char *)l->overflow_arg_area + 8;
6339 + avalue[i] = (char *)l->reg_save_area + l->fp_offset;
6340 + l->fp_offset += 16;
6344 + fprintf (stderr, "double arg %d = %g\n", i, *(double *)avalue[i]);
6348 + case FFI_TYPE_FLOAT:
6350 + if (l->fp_offset > 176-16)
6352 + avalue[i] = l->overflow_arg_area;
6353 + l->overflow_arg_area = (char *)l->overflow_arg_area + 8;
6357 + avalue[i] = (char *)l->reg_save_area + l->fp_offset;
6358 + l->fp_offset += 16;
6362 + fprintf (stderr, "float arg %d = %g\n", i, *(float *)avalue[i]);
6370 + argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG;
6374 + /* Invoke the closure. */
6375 + (closure->fun) (cif, rp, avalue, closure->user_data);
6377 + /* FIXME: Structs not supported. */
6378 + FFI_ASSERT(cif->rtype->type != FFI_TYPE_STRUCT);
6380 + /* Tell ffi_closure_UNIX64 how to perform return type promotions. */
6382 + return cif->rtype->type;
6384 +#endif /* ifndef __x86_64__ */
6385 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/sysv.S gcc/libffi/src/x86/sysv.S
6386 --- gcc-3.2.2.orig/libffi/src/x86/sysv.S Tue Jul 17 02:10:53 2001
6387 +++ gcc/libffi/src/x86/sysv.S Fri Jul 19 08:08:31 2002
6389 /* -----------------------------------------------------------------------
6390 - sysv.S - Copyright (c) 1996, 1998, 2001 Cygnus Solutions
6391 + sysv.S - Copyright (c) 1996, 1998, 2001, 2002 Cygnus Solutions
6393 X86 Foreign Function Interface
6396 OTHER DEALINGS IN THE SOFTWARE.
6397 ----------------------------------------------------------------------- */
6407 .set .LLFDE1,.LEFDE1-.LSFDE1
6409 +#endif /* ifndef __x86_64__ */
6410 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/unix64.S gcc/libffi/src/x86/unix64.S
6411 --- gcc-3.2.2.orig/libffi/src/x86/unix64.S Thu Jan 1 09:00:00 1970
6412 +++ gcc/libffi/src/x86/unix64.S Wed Jan 29 00:54:28 2003
6414 +/* -----------------------------------------------------------------------
6415 + unix64.S - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
6417 + x86-64 Foreign Function Interface
6419 + Permission is hereby granted, free of charge, to any person obtaining
6420 + a copy of this software and associated documentation files (the
6421 + ``Software''), to deal in the Software without restriction, including
6422 + without limitation the rights to use, copy, modify, merge, publish,
6423 + distribute, sublicense, and/or sell copies of the Software, and to
6424 + permit persons to whom the Software is furnished to do so, subject to
6425 + the following conditions:
6427 + The above copyright notice and this permission notice shall be included
6428 + in all copies or substantial portions of the Software.
6430 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
6431 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6432 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6433 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
6434 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
6435 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6436 + OTHER DEALINGS IN THE SOFTWARE.
6437 + ----------------------------------------------------------------------- */
6445 + .string "asm in progress %lld\n"
6447 + .string "asm in progress\n"
6450 +.globl ffi_call_UNIX64
6451 + .type ffi_call_UNIX64,@function
6459 + /* Save all arguments */
6462 + movq %rdi, -8(%rbp) /* ffi_prep_args */
6463 + movq %rsi, -16(%rbp) /* ffi_fill_return_value */
6464 + movq %rdx, -24(%rbp) /* ecif */
6465 + movq %rcx, -32(%rbp) /* cif->bytes */
6466 + movq %r8, -40(%rbp) /* ecif.rvalue */
6467 + movq %r9, -48(%rbp) /* fn */
6469 + /* Make room for all of the new args and the register args */
6474 + /* Setup the call to ffi_prep_args. */
6475 + movq %rdi, %rax /* &ffi_prep_args */
6476 + movq %rsp, %rdi /* stackLayout */
6477 + movq %rdx, %rsi /* ecif */
6478 + call *%rax /* ffi_prep_args(stackLayout, ecif);*/
6480 + /* ffi_prep_args have put all the register contents into the */
6481 + /* stackLayout struct. Now put the register values in place. */
6483 + movq 8(%rsp), %rsi
6484 + movq 16(%rsp), %rdx
6485 + movq 24(%rsp), %rcx
6486 + movq 32(%rsp), %r8
6487 + movq 40(%rsp), %r9
6488 + movaps 48(%rsp), %xmm0
6489 + movaps 64(%rsp), %xmm1
6490 + movaps 80(%rsp), %xmm2
6491 + movaps 96(%rsp), %xmm3
6492 + movaps 112(%rsp), %xmm4
6493 + movaps 128(%rsp), %xmm5
6494 + movaps 144(%rsp), %xmm6
6495 + movaps 160(%rsp), %xmm7
6497 + /* Remove space for stackLayout so stack arguments are placed
6498 + correctly for the call. */
6502 + /* Call the user function. */
6505 + /* Make stack space for the return_value struct. */
6508 + /* Fill in all potential return values to this struct. */
6510 + movq %rdx, 8(%rsp)
6511 + movaps %xmm0, 16(%rsp)
6512 + movaps %xmm1, 32(%rsp)
6515 + /* Now call ffi_fill_return_value. */
6516 + movq %rsp, %rdi /* struct return_value */
6517 + movq -24(%rbp), %rsi /* ecif */
6518 + movq -16(%rbp), %rax /* &ffi_fill_return_value */
6519 + call *%rax /* call it */
6521 + /* And the work is done. */
6525 +.ffi_call_UNIX64_end:
6526 + .size ffi_call_UNIX64,.ffi_call_UNIX64_end-ffi_call_UNIX64
6531 + .type float2sse,@function
6533 + /* Save the contents of this sse-float in a pointer. */
6534 + movaps %xmm0, (%rdi)
6538 +.globl floatfloat2sse
6539 + .type floatfloat2sse,@function
6541 + /* Save the contents of these two sse-floats in a pointer. */
6542 + movq (%rdi), %xmm0
6543 + movaps %xmm0, (%rsi)
6548 + .type double2sse,@function
6550 + /* Save the contents of this sse-double in a pointer. */
6551 + movaps %xmm0, (%rdi)
6556 + .type sse2float,@function
6558 + /* Save the contents of this sse-float in a pointer. */
6559 + movaps (%rdi), %xmm0
6564 + .type sse2double,@function
6566 + /* Save the contents of this pointer in a sse-double. */
6567 + movaps (%rdi), %xmm0
6571 +.globl sse2floatfloat
6572 + .type sse2floatfloat,@function
6574 + /* Save the contents of this pointer in two sse-floats. */
6575 + movaps (%rdi), %xmm0
6576 + movq %xmm0, (%rsi)
6580 +.globl ffi_closure_UNIX64
6581 + .type ffi_closure_UNIX64,@function
6583 +ffi_closure_UNIX64:
6591 + movq %rdi, -176(%rbp)
6592 + movq %rsi, -168(%rbp)
6593 + movq %rdx, -160(%rbp)
6594 + movq %rcx, -152(%rbp)
6595 + movq %r8, -144(%rbp)
6596 + movq %r9, -136(%rbp)
6597 + /* FIXME: We can avoid all this stashing of XMM registers by
6598 + (in ffi_prep_closure) computing the number of
6599 + floating-point args and moving it into %rax before calling
6600 + this function. Once this is done, uncomment the next few
6601 + lines and only the essential XMM registers will be written
6602 + to memory. This is a significant saving. */
6603 +/* movzbl %al, %eax */
6604 +/* movq %rax, %rdx */
6605 +/* leaq 0(,%rdx,4), %rax */
6606 +/* leaq 2f(%rip), %rdx */
6607 +/* subq %rax, %rdx */
6608 + leaq -1(%rbp), %rax
6610 + movaps %xmm7, -15(%rax)
6611 + movaps %xmm6, -31(%rax)
6612 + movaps %xmm5, -47(%rax)
6613 + movaps %xmm4, -63(%rax)
6614 + movaps %xmm3, -79(%rax)
6615 + movaps %xmm2, -95(%rax)
6616 + movaps %xmm1, -111(%rax)
6617 + movaps %xmm0, -127(%rax)
6619 + movl %edi, -180(%rbp)
6620 + movl $0, -224(%rbp)
6621 + movl $48, -220(%rbp)
6622 + leaq 16(%rbp), %rax
6623 + movq %rax, -216(%rbp)
6624 + leaq -176(%rbp), %rdx
6625 + movq %rdx, -208(%rbp)
6626 + leaq -224(%rbp), %rsi
6629 + call ffi_closure_UNIX64_inner@PLT
6631 + cmpl $FFI_TYPE_FLOAT, %eax
6633 + cmpl $FFI_TYPE_DOUBLE, %eax
6635 + cmpl $FFI_TYPE_LONGDOUBLE, %eax
6637 + cmpl $FFI_TYPE_STRUCT, %eax
6645 + movaps -240(%rbp), %xmm0
6653 + .section .eh_frame,"a",@progbits
6655 + .long .LECIE1-.LSCIE1
6673 + .long .LEFDE1-.LASFDE1
6675 + .long .LASFDE1-.Lframe0
6680 + .byte 0x4 # DW_CFA_advance_loc4
6681 + .long .LCFI0-.LFB1
6682 + .byte 0xe # DW_CFA_def_cfa_offset
6684 + .byte 0x86 # DW_CFA_offset: r6 at cfa-16
6686 + .byte 0x4 # DW_CFA_advance_loc4
6687 + .long .LCFI1-.LCFI0
6688 + .byte 0x86 # DW_CFA_offset: r6 at cfa-16
6690 + .byte 0xd # DW_CFA_def_cfa_reg: r6
6695 + .long .LEFDE3-.LASFDE3 # FDE Length
6697 + .long .LASFDE3-.Lframe0 # FDE CIE offset
6699 + .long .LFB2-. # FDE initial location
6700 + .long .LFE2-.LFB2 # FDE address range
6701 + .uleb128 0x0 # Augmentation size
6702 + .byte 0x4 # DW_CFA_advance_loc4
6703 + .long .LCFI10-.LFB2
6704 + .byte 0xe # DW_CFA_def_cfa_offset
6706 + .byte 0x86 # DW_CFA_offset, column 0x6
6708 + .byte 0x4 # DW_CFA_advance_loc4
6709 + .long .LCFI11-.LCFI10
6710 + .byte 0xd # DW_CFA_def_cfa_register
6715 +#endif /* __x86_64__ */
6716 diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/win32.S gcc/libffi/src/x86/win32.S
6717 --- gcc-3.2.2.orig/libffi/src/x86/win32.S Tue Mar 27 11:39:16 2001
6718 +++ gcc/libffi/src/x86/win32.S Fri Dec 6 10:16:45 2002
6720 /* -----------------------------------------------------------------------
6721 - win32.S - Copyright (c) 1996, 1998, 2001 Cygnus Solutions
6722 + win32.S - Copyright (c) 1996, 1998, 2001, 2002 Red Hat, Inc.
6723 + Copyright (c) 2001 John Beniton
6724 + Copyright (c) 2002 Ranjit Mathew
6727 X86 Foreign Function Interface
6730 # Return stack to previous state and call the function
6734 + # FIXME: Align the stack to a 128-bit boundary to avoid
6735 + # potential performance hits.
6739 # Remove the space we pushed for the args
6741 @@ -123,3 +129,98 @@
6746 + # This assumes we are using gas.
6748 +.globl _ffi_call_STDCALL
6754 + # Make room for all of the new args.
6755 + movl 16(%ebp),%ecx
6760 + # Place all of the ffi_prep_args in position
6765 + # Return stack to previous state and call the function
6768 + # FIXME: Align the stack to a 128-bit boundary to avoid
6769 + # potential performance hits.
6773 + # stdcall functions pop arguments off the stack themselves
6775 + # Load %ecx with the return type code
6776 + movl 20(%ebp),%ecx
6778 + # If the return value pointer is NULL, assume no return value.
6782 + # Even if there is no space for the return value, we are
6783 + # obliged to handle floating-point values.
6784 + cmpl $FFI_TYPE_FLOAT,%ecx
6791 + cmpl $FFI_TYPE_INT,%ecx
6793 + # Load %ecx with the pointer to storage for the return value
6794 + movl 24(%ebp),%ecx
6799 + cmpl $FFI_TYPE_FLOAT,%ecx
6801 + # Load %ecx with the pointer to storage for the return value
6802 + movl 24(%ebp),%ecx
6807 + cmpl $FFI_TYPE_DOUBLE,%ecx
6808 + jne sc_retlongdouble
6809 + # Load %ecx with the pointer to storage for the return value
6810 + movl 24(%ebp),%ecx
6815 + cmpl $FFI_TYPE_LONGDOUBLE,%ecx
6817 + # Load %ecx with the pointer to storage for the return value
6818 + movl 24(%ebp),%ecx
6823 + cmpl $FFI_TYPE_SINT64,%ecx
6825 + # Load %ecx with the pointer to storage for the return value
6826 + movl 24(%ebp),%ecx
6839 +.ffi_call_STDCALL_end:
6840 --- gcc-3.2.2.orig/libjava/configure.host Mon Jun 10 13:15:26 2002
6841 +++ gcc-3.2.2/libjava/configure.host Sat Feb 15 19:57:25 2003
6842 @@ -115,6 +115,12 @@
6843 enable_getenv_properties_default=no
6844 enable_main_args_default=no
6848 + libgcj_flags="${libgcj_flags} -mieee"
6849 + libgcj_interpreter=yes
6850 + enable_hash_synchronization_default=yes
6854 # This case statement supports generic port properties and may refine
6861 + sh-linux* | sh[34]*-linux*)
6862 can_unwind_signal=yes