1.1 --- a/patches/gcc/3.2.3/140-gcc-3.2.3-libffi-1.patch Mon Jul 28 20:17:48 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,6864 +0,0 @@
1.4 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/Makefile.am gcc/libffi/Makefile.am
1.5 ---- gcc-3.2.2.orig/libffi/Makefile.am Tue Jan 28 10:43:56 2003
1.6 -+++ gcc/libffi/Makefile.am Tue Jan 28 10:48:33 2003
1.7 -@@ -8,14 +8,17 @@
1.8 - src/mips/n32.s src/mips/o32.S src/mips/o32.s \
1.9 - src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S \
1.10 - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \
1.11 -+ src/x86/ffi64.c src/x86/unix64.S \
1.12 - src/alpha/ffi.c src/alpha/osf.S \
1.13 - src/m68k/ffi.c src/m68k/sysv.S \
1.14 - src/powerpc/ffi.c src/powerpc/sysv.S \
1.15 - src/powerpc/ppc_closure.S src/powerpc/asm.h \
1.16 - src/powerpc/ffi_darwin.c \
1.17 - src/powerpc/darwin.S src/powerpc/aix.S \
1.18 -- src/powerpc/darwin_closure.S src/powerpc/aix_closures.S \
1.19 -- src/arm/ffi.c src/arm/sysv.S
1.20 -+ src/powerpc/darwin_closure.S src/powerpc/aix_closure.S \
1.21 -+ src/arm/ffi.c src/arm/sysv.S \
1.22 -+ src/s390/ffi.c src/s390/sysv.S \
1.23 -+ src/sh/ffi.c src/sh/sysv.S
1.24 -
1.25 - VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@
1.26 -
1.27 -@@ -83,6 +86,7 @@
1.28 - ffitest_LDFLAGS = -shared-libgcc
1.29 -
1.30 - TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
1.31 -+TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S
1.32 - TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s
1.33 - TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S
1.34 - TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S
1.35 -@@ -91,9 +95,12 @@
1.36 - TARGET_SRC_IA64 = src/ia64/ffi.c src/ia64/unix.S
1.37 - TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S
1.38 - TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
1.39 --TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closures.S
1.40 -+TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
1.41 - TARGET_SRC_POWERPC_DARWIN = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
1.42 - TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c
1.43 -+TARGET_SRC_S390 = src/s390/sysv.S src/s390/ffi.c
1.44 -+TARGET_SRC_X86_64 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
1.45 -+TARGET_SRC_SH = src/sh/sysv.S src/sh/ffi.c
1.46 -
1.47 - ##libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c $(TARGET_SRC_@TARGET@)
1.48 - ## Work around automake deficiency
1.49 -@@ -103,6 +110,10 @@
1.50 - libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
1.51 - libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
1.52 - endif
1.53 -+if MIPS_LINUX
1.54 -+libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
1.55 -+libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
1.56 -+endif
1.57 - if MIPS_SGI
1.58 - libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
1.59 - libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
1.60 -@@ -147,6 +158,18 @@
1.61 - libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
1.62 - libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
1.63 - endif
1.64 -+if S390
1.65 -+libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
1.66 -+libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
1.67 -+endif
1.68 -+if X86_64
1.69 -+libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
1.70 -+libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
1.71 -+endif
1.72 -+if SH
1.73 -+libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
1.74 -+libfficonvenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
1.75 -+endif
1.76 -
1.77 - AM_CFLAGS = -fexceptions
1.78 -
1.79 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/Makefile.in gcc/libffi/Makefile.in
1.80 ---- gcc-3.2.2.orig/libffi/Makefile.in Wed Jan 29 07:59:05 2003
1.81 -+++ gcc/libffi/Makefile.in Wed Jan 29 07:58:58 2003
1.82 -@@ -91,14 +91,17 @@
1.83 - src/mips/n32.s src/mips/o32.S src/mips/o32.s \
1.84 - src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S \
1.85 - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \
1.86 -+ src/x86/ffi64.c src/x86/unix64.S \
1.87 - src/alpha/ffi.c src/alpha/osf.S \
1.88 - src/m68k/ffi.c src/m68k/sysv.S \
1.89 - src/powerpc/ffi.c src/powerpc/sysv.S \
1.90 - src/powerpc/ppc_closure.S src/powerpc/asm.h \
1.91 - src/powerpc/ffi_darwin.c \
1.92 - src/powerpc/darwin.S src/powerpc/aix.S \
1.93 -- src/powerpc/darwin_closure.S src/powerpc/aix_closures.S \
1.94 -- src/arm/ffi.c src/arm/sysv.S
1.95 -+ src/powerpc/darwin_closure.S src/powerpc/aix_closure.S \
1.96 -+ src/arm/ffi.c src/arm/sysv.S \
1.97 -+ src/s390/ffi.c src/s390/sysv.S \
1.98 -+ src/sh/ffi.c src/sh/sysv.S
1.99 -
1.100 -
1.101 - VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@
1.102 -@@ -162,6 +165,7 @@
1.103 - ffitest_LDFLAGS = -shared-libgcc
1.104 -
1.105 - TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
1.106 -+TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S
1.107 - TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s
1.108 - TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S
1.109 - TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S
1.110 -@@ -170,14 +174,18 @@
1.111 - TARGET_SRC_IA64 = src/ia64/ffi.c src/ia64/unix.S
1.112 - TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S
1.113 - TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
1.114 --TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closures.S
1.115 -+TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
1.116 - TARGET_SRC_POWERPC_DARWIN = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
1.117 - TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c
1.118 -+TARGET_SRC_S390 = src/s390/sysv.S src/s390/ffi.c
1.119 -+TARGET_SRC_X86_64 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
1.120 -+TARGET_SRC_SH = src/sh/sysv.S src/sh/ffi.c
1.121 -
1.122 - libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \
1.123 - src/raw_api.c src/java_raw_api.c
1.124 -
1.125 - @MIPS_GCC_TRUE@libffi_la_SOURCES = @MIPS_GCC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
1.126 -+@MIPS_LINUX_TRUE@libffi_la_SOURCES = @MIPS_LINUX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
1.127 - @MIPS_SGI_TRUE@libffi_la_SOURCES = @MIPS_SGI_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
1.128 - @X86_TRUE@libffi_la_SOURCES = @X86_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
1.129 - @X86_WIN32_TRUE@libffi_la_SOURCES = @X86_WIN32_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32)
1.130 -@@ -189,7 +197,11 @@
1.131 - @POWERPC_AIX_TRUE@libffi_la_SOURCES = @POWERPC_AIX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX)
1.132 - @POWERPC_DARWIN_TRUE@libffi_la_SOURCES = @POWERPC_DARWIN_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN)
1.133 - @ARM_TRUE@libffi_la_SOURCES = @ARM_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
1.134 -+@S390_TRUE@libffi_la_SOURCES = @S390_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
1.135 -+@X86_64_TRUE@libffi_la_SOURCES = @X86_64_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
1.136 -+@SH_TRUE@libffi_la_SOURCES = @SH_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
1.137 - @MIPS_GCC_TRUE@libffi_convenience_la_SOURCES = @MIPS_GCC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
1.138 -+@MIPS_LINUX_TRUE@libffi_convenience_la_SOURCES = @MIPS_LINUX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
1.139 - @MIPS_SGI_TRUE@libffi_convenience_la_SOURCES = @MIPS_SGI_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
1.140 - @X86_TRUE@libffi_convenience_la_SOURCES = @X86_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
1.141 - @X86_WIN32_TRUE@libffi_convenience_la_SOURCES = @X86_WIN32_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32)
1.142 -@@ -201,6 +213,9 @@
1.143 - @POWERPC_AIX_TRUE@libffi_convenience_la_SOURCES = @POWERPC_AIX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX)
1.144 - @POWERPC_DARWIN_TRUE@libffi_convenience_la_SOURCES = @POWERPC_DARWIN_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN)
1.145 - @ARM_TRUE@libffi_convenience_la_SOURCES = @ARM_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
1.146 -+@S390_TRUE@libffi_convenience_la_SOURCES = @S390_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
1.147 -+@X86_64_TRUE@libffi_convenience_la_SOURCES = @X86_64_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
1.148 -+@SH_TRUE@libfficonvenience_la_SOURCES = @SH_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
1.149 -
1.150 - AM_CFLAGS = -fexceptions
1.151 -
1.152 -@@ -208,7 +223,7 @@
1.153 -
1.154 - INCLUDES = -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
1.155 - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1.156 --mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
1.157 -+mkinstalldirs = $(SHELL) $(top_srcdir)/${libffi_basedir}/../mkinstalldirs
1.158 - CONFIG_HEADER = fficonfig.h
1.159 - CONFIG_CLEAN_FILES =
1.160 - LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
1.161 -@@ -220,10 +235,6 @@
1.162 - LIBS = @LIBS@
1.163 - libffi_convenience_la_LDFLAGS =
1.164 - libffi_convenience_la_LIBADD =
1.165 --@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.166 --@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.167 --@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \
1.168 --@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo
1.169 - @ALPHA_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.170 - @ALPHA_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.171 - @ALPHA_TRUE@src/java_raw_api.lo src/alpha/ffi.lo src/alpha/osf.lo
1.172 -@@ -234,12 +245,29 @@
1.173 - @MIPS_GCC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.174 - @MIPS_GCC_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \
1.175 - @MIPS_GCC_TRUE@src/mips/n32.lo
1.176 --@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.177 --@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.178 --@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo
1.179 -+@S390_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.180 -+@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.181 -+@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo
1.182 - @M68K_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.183 - @M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.184 - @M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo
1.185 -+@X86_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.186 -+@X86_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.187 -+@X86_TRUE@src/x86/ffi.lo src/x86/sysv.lo
1.188 -+@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.189 -+@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.190 -+@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \
1.191 -+@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo
1.192 -+@MIPS_LINUX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.193 -+@MIPS_LINUX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.194 -+@MIPS_LINUX_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo
1.195 -+@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.196 -+@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.197 -+@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo
1.198 -+@X86_64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.199 -+@X86_64_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.200 -+@X86_64_TRUE@src/java_raw_api.lo src/x86/ffi64.lo src/x86/unix64.lo \
1.201 -+@X86_64_TRUE@src/x86/ffi.lo src/x86/sysv.lo
1.202 - @SPARC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.203 - @SPARC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.204 - @SPARC_TRUE@src/java_raw_api.lo src/sparc/ffi.lo src/sparc/v8.lo \
1.205 -@@ -247,62 +275,75 @@
1.206 - @POWERPC_AIX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.207 - @POWERPC_AIX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.208 - @POWERPC_AIX_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \
1.209 --@POWERPC_AIX_TRUE@src/powerpc/aix.lo src/powerpc/aix_closures.lo
1.210 --@X86_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.211 --@X86_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.212 --@X86_TRUE@src/x86/ffi.lo src/x86/sysv.lo
1.213 --@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.214 --@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.215 --@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo
1.216 -+@POWERPC_AIX_TRUE@src/powerpc/aix.lo src/powerpc/aix_closure.lo
1.217 -+@MIPS_SGI_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.218 -+@MIPS_SGI_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.219 -+@MIPS_SGI_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \
1.220 -+@MIPS_SGI_TRUE@src/mips/n32.lo
1.221 - @POWERPC_DARWIN_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.222 - @POWERPC_DARWIN_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.223 - @POWERPC_DARWIN_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \
1.224 - @POWERPC_DARWIN_TRUE@src/powerpc/darwin.lo \
1.225 - @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo
1.226 --@MIPS_SGI_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \
1.227 --@MIPS_SGI_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \
1.228 --@MIPS_SGI_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \
1.229 --@MIPS_SGI_TRUE@src/mips/n32.lo
1.230 -+@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.231 -+@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.232 -+@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo
1.233 -+@SH_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.234 -+@SH_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.235 -+@SH_TRUE@src/sh/sysv.lo src/sh/ffi.lo
1.236 - libffi_la_LIBADD =
1.237 -+@SH_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
1.238 -+@SH_TRUE@src/raw_api.lo src/java_raw_api.lo src/sh/sysv.lo \
1.239 -+@SH_TRUE@src/sh/ffi.lo
1.240 -+@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.241 -+@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.242 -+@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo
1.243 -+@X86_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
1.244 -+@X86_TRUE@src/raw_api.lo src/java_raw_api.lo src/x86/ffi.lo \
1.245 -+@X86_TRUE@src/x86/sysv.lo
1.246 - @POWERPC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.247 - @POWERPC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.248 - @POWERPC_TRUE@src/powerpc/ffi.lo src/powerpc/sysv.lo \
1.249 - @POWERPC_TRUE@src/powerpc/ppc_closure.lo
1.250 --@ALPHA_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.251 --@ALPHA_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.252 --@ALPHA_TRUE@src/alpha/ffi.lo src/alpha/osf.lo
1.253 --@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.254 --@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.255 --@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo
1.256 --@MIPS_GCC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.257 --@MIPS_GCC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.258 --@MIPS_GCC_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
1.259 --@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.260 --@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.261 --@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo
1.262 --@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.263 --@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.264 --@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo
1.265 -+@MIPS_LINUX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.266 -+@MIPS_LINUX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.267 -+@MIPS_LINUX_TRUE@src/mips/ffi.lo src/mips/o32.lo
1.268 - @SPARC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.269 - @SPARC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.270 - @SPARC_TRUE@src/sparc/ffi.lo src/sparc/v8.lo src/sparc/v9.lo
1.271 - @POWERPC_AIX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.272 - @POWERPC_AIX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.273 - @POWERPC_AIX_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/aix.lo \
1.274 --@POWERPC_AIX_TRUE@src/powerpc/aix_closures.lo
1.275 --@X86_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
1.276 --@X86_TRUE@src/raw_api.lo src/java_raw_api.lo src/x86/ffi.lo \
1.277 --@X86_TRUE@src/x86/sysv.lo
1.278 -+@POWERPC_AIX_TRUE@src/powerpc/aix_closure.lo
1.279 -+@MIPS_SGI_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.280 -+@MIPS_SGI_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.281 -+@MIPS_SGI_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
1.282 - @ARM_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
1.283 - @ARM_TRUE@src/raw_api.lo src/java_raw_api.lo src/arm/sysv.lo \
1.284 - @ARM_TRUE@src/arm/ffi.lo
1.285 -+@ALPHA_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.286 -+@ALPHA_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.287 -+@ALPHA_TRUE@src/alpha/ffi.lo src/alpha/osf.lo
1.288 -+@MIPS_GCC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.289 -+@MIPS_GCC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.290 -+@MIPS_GCC_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
1.291 -+@S390_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.292 -+@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.293 -+@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo
1.294 -+@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.295 -+@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.296 -+@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo
1.297 -+@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.298 -+@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.299 -+@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo
1.300 -+@X86_64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.301 -+@X86_64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.302 -+@X86_64_TRUE@src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffi.lo \
1.303 -+@X86_64_TRUE@src/x86/sysv.lo
1.304 - @POWERPC_DARWIN_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.305 - @POWERPC_DARWIN_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.306 - @POWERPC_DARWIN_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/darwin.lo \
1.307 - @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo
1.308 --@MIPS_SGI_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \
1.309 --@MIPS_SGI_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \
1.310 --@MIPS_SGI_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo
1.311 - noinst_PROGRAMS = ffitest$(EXEEXT)
1.312 - PROGRAMS = $(noinst_PROGRAMS)
1.313 -
1.314 -@@ -578,8 +616,8 @@
1.315 - -chmod 777 $(distdir)
1.316 - $(mkinstalldirs) $(distdir)/src/alpha $(distdir)/src/arm \
1.317 - $(distdir)/src/m68k $(distdir)/src/mips \
1.318 -- $(distdir)/src/powerpc $(distdir)/src/sparc \
1.319 -- $(distdir)/src/x86
1.320 -+ $(distdir)/src/powerpc $(distdir)/src/s390 $(distdir)/src/sh \
1.321 -+ $(distdir)/src/sparc $(distdir)/src/x86
1.322 - @for file in $(DISTFILES); do \
1.323 - if test -f $$file; then d=.; else d=$(srcdir); fi; \
1.324 - if test -d $$d/$$file; then \
1.325 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/acinclude.m4 gcc/libffi/acinclude.m4
1.326 ---- gcc-3.2.2.orig/libffi/acinclude.m4 Sun Sep 10 16:43:14 2000
1.327 -+++ gcc/libffi/acinclude.m4 Tue Dec 17 03:22:47 2002
1.328 -@@ -4,5 +4,8 @@
1.329 - dnl to add a definition of LIBTOOL to Makefile.in.
1.330 - ifelse(yes,no,[
1.331 - AC_DEFUN([AC_PROG_LIBTOOL],)
1.332 -+AC_DEFUN([AM_PROG_LIBTOOL],)
1.333 - AC_SUBST(LIBTOOL)
1.334 - ])
1.335 -+
1.336 -+sinclude(../config/accross.m4)
1.337 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/aclocal.m4 gcc/libffi/aclocal.m4
1.338 ---- gcc-3.2.2.orig/libffi/aclocal.m4 Fri Feb 1 07:25:31 2002
1.339 -+++ gcc/libffi/aclocal.m4 Tue Dec 17 03:22:47 2002
1.340 -@@ -1,6 +1,6 @@
1.341 --dnl aclocal.m4 generated automatically by aclocal 1.4
1.342 -+dnl aclocal.m4 generated automatically by aclocal 1.4-p5
1.343 -
1.344 --dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
1.345 -+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
1.346 - dnl This file is free software; the Free Software Foundation
1.347 - dnl gives unlimited permission to copy and/or distribute it,
1.348 - dnl with or without modifications, as long as this notice is preserved.
1.349 -@@ -16,108 +16,15 @@
1.350 - dnl to add a definition of LIBTOOL to Makefile.in.
1.351 - ifelse(yes,no,[
1.352 - AC_DEFUN([AC_PROG_LIBTOOL],)
1.353 -+AC_DEFUN([AM_PROG_LIBTOOL],)
1.354 - AC_SUBST(LIBTOOL)
1.355 - ])
1.356 -
1.357 --AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
1.358 --[changequote(<<, >>)dnl
1.359 --dnl The name to #define.
1.360 --define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
1.361 --dnl The cache variable name.
1.362 --define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
1.363 --changequote([, ])dnl
1.364 --AC_MSG_CHECKING(size of $1)
1.365 --AC_CACHE_VAL(AC_CV_NAME,
1.366 --[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
1.367 -- AC_TRY_COMPILE([#include "confdefs.h"
1.368 --#include <sys/types.h>
1.369 --$2
1.370 --], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
1.371 -- if test x$AC_CV_NAME != x ; then break; fi
1.372 --done
1.373 --])
1.374 --if test x$AC_CV_NAME = x ; then
1.375 -- AC_MSG_ERROR([cannot determine a size for $1])
1.376 --fi
1.377 --AC_MSG_RESULT($AC_CV_NAME)
1.378 --AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
1.379 --undefine([AC_TYPE_NAME])dnl
1.380 --undefine([AC_CV_NAME])dnl
1.381 --])
1.382 --
1.383 --AC_DEFUN([AC_C_BIGENDIAN_CROSS],
1.384 --[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
1.385 --[ac_cv_c_bigendian=unknown
1.386 --# See if sys/param.h defines the BYTE_ORDER macro.
1.387 --AC_TRY_COMPILE([#include <sys/types.h>
1.388 --#include <sys/param.h>], [
1.389 --#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
1.390 -- bogus endian macros
1.391 --#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
1.392 --AC_TRY_COMPILE([#include <sys/types.h>
1.393 --#include <sys/param.h>], [
1.394 --#if BYTE_ORDER != BIG_ENDIAN
1.395 -- not big endian
1.396 --#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
1.397 --if test $ac_cv_c_bigendian = unknown; then
1.398 --AC_TRY_RUN([main () {
1.399 -- /* Are we little or big endian? From Harbison&Steele. */
1.400 -- union
1.401 -- {
1.402 -- long l;
1.403 -- char c[sizeof (long)];
1.404 -- } u;
1.405 -- u.l = 1;
1.406 -- exit (u.c[sizeof (long) - 1] == 1);
1.407 --}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes,
1.408 --[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ])
1.409 --fi])
1.410 --if test $ac_cv_c_bigendian = unknown; then
1.411 --AC_MSG_CHECKING(to probe for byte ordering)
1.412 --[
1.413 --cat >conftest.c <<EOF
1.414 --short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
1.415 --short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
1.416 --void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }
1.417 --short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
1.418 --short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
1.419 --void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }
1.420 --int main() { _ascii (); _ebcdic (); return 0; }
1.421 --EOF
1.422 --] if test -f conftest.c ; then
1.423 -- if ${CC-cc} ${CFLAGS} conftest.c -o conftest.o && test -f conftest.o ; then
1.424 -- if test `grep -l BIGenDianSyS conftest.o` ; then
1.425 -- echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG
1.426 -- ac_cv_c_bigendian=yes
1.427 -- fi
1.428 -- if test `grep -l LiTTleEnDian conftest.o` ; then
1.429 -- echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG
1.430 -- if test $ac_cv_c_bigendian = yes ; then
1.431 -- ac_cv_c_bigendian=unknown;
1.432 -- else
1.433 -- ac_cv_c_bigendian=no
1.434 -- fi
1.435 -- fi
1.436 -- echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG
1.437 -- fi
1.438 -- fi
1.439 --AC_MSG_RESULT($ac_cv_c_bigendian)
1.440 --fi
1.441 --if test $ac_cv_c_bigendian = yes; then
1.442 -- AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian])
1.443 -- BYTEORDER=4321
1.444 --else
1.445 -- BYTEORDER=1234
1.446 --fi
1.447 --AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN])
1.448 --if test $ac_cv_c_bigendian = unknown; then
1.449 -- AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian)
1.450 --fi
1.451 --])
1.452 -+sinclude(../config/accross.m4)
1.453 -
1.454 - # Like AC_CONFIG_HEADER, but automatically create stamp file.
1.455 -
1.456 --AC_DEFUN(AM_CONFIG_HEADER,
1.457 -+AC_DEFUN([AM_CONFIG_HEADER],
1.458 - [AC_PREREQ([2.12])
1.459 - AC_CONFIG_HEADER([$1])
1.460 - dnl When config.status generates a header, we must update the stamp-h file.
1.461 -@@ -147,7 +54,7 @@
1.462 - dnl Usage:
1.463 - dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1.464 -
1.465 --AC_DEFUN(AM_INIT_AUTOMAKE,
1.466 -+AC_DEFUN([AM_INIT_AUTOMAKE],
1.467 - [AC_REQUIRE([AC_PROG_INSTALL])
1.468 - PACKAGE=[$1]
1.469 - AC_SUBST(PACKAGE)
1.470 -@@ -175,7 +82,7 @@
1.471 - # Check to make sure that the build environment is sane.
1.472 - #
1.473 -
1.474 --AC_DEFUN(AM_SANITY_CHECK,
1.475 -+AC_DEFUN([AM_SANITY_CHECK],
1.476 - [AC_MSG_CHECKING([whether build environment is sane])
1.477 - # Just in case
1.478 - sleep 1
1.479 -@@ -216,7 +123,7 @@
1.480 -
1.481 - dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1.482 - dnl The program must properly implement --version.
1.483 --AC_DEFUN(AM_MISSING_PROG,
1.484 -+AC_DEFUN([AM_MISSING_PROG],
1.485 - [AC_MSG_CHECKING(for working $2)
1.486 - # Run test in a subshell; some versions of sh will print an error if
1.487 - # an executable is not found, even if stderr is redirected.
1.488 -@@ -235,7 +142,7 @@
1.489 -
1.490 - # serial 1
1.491 -
1.492 --AC_DEFUN(AM_MAINTAINER_MODE,
1.493 -+AC_DEFUN([AM_MAINTAINER_MODE],
1.494 - [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1.495 - dnl maintainer-mode is disabled by default
1.496 - AC_ARG_ENABLE(maintainer-mode,
1.497 -@@ -252,7 +159,7 @@
1.498 -
1.499 - # Define a conditional.
1.500 -
1.501 --AC_DEFUN(AM_CONDITIONAL,
1.502 -+AC_DEFUN([AM_CONDITIONAL],
1.503 - [AC_SUBST($1_TRUE)
1.504 - AC_SUBST($1_FALSE)
1.505 - if $2; then
1.506 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/configure gcc/libffi/configure
1.507 ---- gcc-3.2.2.orig/libffi/configure Wed Jan 29 07:59:05 2003
1.508 -+++ gcc/libffi/configure Sat Feb 1 20:16:19 2003
1.509 -@@ -633,17 +633,16 @@
1.510 -
1.511 - if test "${srcdir}" = "."; then
1.512 - if test "${with_target_subdir}" != "."; then
1.513 -- libffi_basedir="${srcdir}/${with_multisrctop}.."
1.514 -+ libffi_basedir="${with_multisrctop}../"
1.515 - else
1.516 -- libffi_basedir="${srcdir}/${with_multisrctop}"
1.517 -+ libffi_basedir="${with_multisrctop}"
1.518 - fi
1.519 - else
1.520 -- libffi_basedir="${srcdir}"
1.521 -+ libffi_basedir=
1.522 - fi
1.523 -
1.524 --
1.525 - ac_aux_dir=
1.526 --for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
1.527 -+for ac_dir in ${libffi_basedir}.. $srcdir/${libffi_basedir}..; do
1.528 - if test -f $ac_dir/install-sh; then
1.529 - ac_aux_dir=$ac_dir
1.530 - ac_install_sh="$ac_aux_dir/install-sh -c"
1.531 -@@ -655,13 +654,14 @@
1.532 - fi
1.533 - done
1.534 - if test -z "$ac_aux_dir"; then
1.535 -- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
1.536 -+ { echo "configure: error: can not find install-sh or install.sh in ${libffi_basedir}.. $srcdir/${libffi_basedir}.." 1>&2; exit 1; }
1.537 - fi
1.538 - ac_config_guess=$ac_aux_dir/config.guess
1.539 - ac_config_sub=$ac_aux_dir/config.sub
1.540 - ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
1.541 -
1.542 -
1.543 -+
1.544 - # Make sure we can run config.sub.
1.545 - if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
1.546 - else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
1.547 -@@ -1238,9 +1238,18 @@
1.548 - ;;
1.549 -
1.550 - hpux10.20*|hpux11*)
1.551 -- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
1.552 -- lt_cv_file_magic_cmd=/usr/bin/file
1.553 -- lt_cv_file_magic_test_file=/usr/lib/libc.sl
1.554 -+ case $host_cpu in
1.555 -+ hppa*)
1.556 -+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
1.557 -+ lt_cv_file_magic_cmd=/usr/bin/file
1.558 -+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
1.559 -+ ;;
1.560 -+ ia64*)
1.561 -+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
1.562 -+ lt_cv_file_magic_cmd=/usr/bin/file
1.563 -+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
1.564 -+ ;;
1.565 -+ esac
1.566 - ;;
1.567 -
1.568 - irix5* | irix6*)
1.569 -@@ -1267,7 +1276,7 @@
1.570 - # This must be Linux ELF.
1.571 - linux-gnu*)
1.572 - case $host_cpu in
1.573 -- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
1.574 -+ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* )
1.575 - lt_cv_deplibs_check_method=pass_all ;;
1.576 - *)
1.577 - # glibc up to 2.1.1 does not perform some relocations on ARM
1.578 -@@ -1330,13 +1339,13 @@
1.579 - deplibs_check_method=$lt_cv_deplibs_check_method
1.580 -
1.581 - echo $ac_n "checking for object suffix""... $ac_c" 1>&6
1.582 --echo "configure:1334: checking for object suffix" >&5
1.583 -+echo "configure:1343: checking for object suffix" >&5
1.584 - if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
1.585 - echo $ac_n "(cached) $ac_c" 1>&6
1.586 - else
1.587 - rm -f conftest*
1.588 - echo 'int i = 1;' > conftest.$ac_ext
1.589 --if { (eval echo configure:1340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.590 -+if { (eval echo configure:1349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.591 - for ac_file in conftest.*; do
1.592 - case $ac_file in
1.593 - *.c) ;;
1.594 -@@ -1356,7 +1365,7 @@
1.595 -
1.596 -
1.597 - echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
1.598 --echo "configure:1360: checking for executable suffix" >&5
1.599 -+echo "configure:1369: checking for executable suffix" >&5
1.600 - if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
1.601 - echo $ac_n "(cached) $ac_c" 1>&6
1.602 - else
1.603 -@@ -1366,7 +1375,7 @@
1.604 - rm -f conftest*
1.605 - echo 'int main () { return 0; }' > conftest.$ac_ext
1.606 - ac_cv_exeext=
1.607 -- if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
1.608 -+ if { (eval echo configure:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
1.609 - for file in conftest.*; do
1.610 - case $file in
1.611 - *.c | *.o | *.obj) ;;
1.612 -@@ -1399,7 +1408,7 @@
1.613 - file_magic*)
1.614 - if test "$file_magic_cmd" = '$MAGIC_CMD'; then
1.615 - echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
1.616 --echo "configure:1403: checking for ${ac_tool_prefix}file" >&5
1.617 -+echo "configure:1412: checking for ${ac_tool_prefix}file" >&5
1.618 - if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
1.619 - echo $ac_n "(cached) $ac_c" 1>&6
1.620 - else
1.621 -@@ -1461,7 +1470,7 @@
1.622 - if test -z "$lt_cv_path_MAGIC_CMD"; then
1.623 - if test -n "$ac_tool_prefix"; then
1.624 - echo $ac_n "checking for file""... $ac_c" 1>&6
1.625 --echo "configure:1465: checking for file" >&5
1.626 -+echo "configure:1474: checking for file" >&5
1.627 - if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
1.628 - echo $ac_n "(cached) $ac_c" 1>&6
1.629 - else
1.630 -@@ -1532,7 +1541,7 @@
1.631 - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
1.632 - set dummy ${ac_tool_prefix}ranlib; ac_word=$2
1.633 - echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1.634 --echo "configure:1536: checking for $ac_word" >&5
1.635 -+echo "configure:1545: checking for $ac_word" >&5
1.636 - if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
1.637 - echo $ac_n "(cached) $ac_c" 1>&6
1.638 - else
1.639 -@@ -1564,7 +1573,7 @@
1.640 - # Extract the first word of "ranlib", so it can be a program name with args.
1.641 - set dummy ranlib; ac_word=$2
1.642 - echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1.643 --echo "configure:1568: checking for $ac_word" >&5
1.644 -+echo "configure:1577: checking for $ac_word" >&5
1.645 - if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
1.646 - echo $ac_n "(cached) $ac_c" 1>&6
1.647 - else
1.648 -@@ -1599,7 +1608,7 @@
1.649 - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
1.650 - set dummy ${ac_tool_prefix}strip; ac_word=$2
1.651 - echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1.652 --echo "configure:1603: checking for $ac_word" >&5
1.653 -+echo "configure:1612: checking for $ac_word" >&5
1.654 - if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
1.655 - echo $ac_n "(cached) $ac_c" 1>&6
1.656 - else
1.657 -@@ -1631,7 +1640,7 @@
1.658 - # Extract the first word of "strip", so it can be a program name with args.
1.659 - set dummy strip; ac_word=$2
1.660 - echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1.661 --echo "configure:1635: checking for $ac_word" >&5
1.662 -+echo "configure:1644: checking for $ac_word" >&5
1.663 - if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
1.664 - echo $ac_n "(cached) $ac_c" 1>&6
1.665 - else
1.666 -@@ -1698,8 +1707,8 @@
1.667 - case $host in
1.668 - *-*-irix6*)
1.669 - # Find out which ABI we are using.
1.670 -- echo '#line 1702 "configure"' > conftest.$ac_ext
1.671 -- if { (eval echo configure:1703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.672 -+ echo '#line 1711 "configure"' > conftest.$ac_ext
1.673 -+ if { (eval echo configure:1712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.674 - case `/usr/bin/file conftest.$ac_objext` in
1.675 - *32-bit*)
1.676 - LD="${LD-ld} -32"
1.677 -@@ -1715,12 +1724,70 @@
1.678 - rm -rf conftest*
1.679 - ;;
1.680 -
1.681 -+ia64-*-hpux*)
1.682 -+ # Find out which ABI we are using.
1.683 -+ echo 'int i;' > conftest.$ac_ext
1.684 -+ if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.685 -+ case "`/usr/bin/file conftest.o`" in
1.686 -+ *ELF-32*)
1.687 -+ HPUX_IA64_MODE="32"
1.688 -+ ;;
1.689 -+ *ELF-64*)
1.690 -+ HPUX_IA64_MODE="64"
1.691 -+ ;;
1.692 -+ esac
1.693 -+ fi
1.694 -+ rm -rf conftest*
1.695 -+ ;;
1.696 -+
1.697 -+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
1.698 -+ # Find out which ABI we are using.
1.699 -+ echo 'int i;' > conftest.$ac_ext
1.700 -+ if { (eval echo configure:1747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.701 -+ case "`/usr/bin/file conftest.o`" in
1.702 -+ *32-bit*)
1.703 -+ case $host in
1.704 -+ x86_64-*linux*)
1.705 -+ LD="${LD-ld} -m elf_i386"
1.706 -+ ;;
1.707 -+ ppc64-*linux*)
1.708 -+ LD="${LD-ld} -m elf32ppclinux"
1.709 -+ ;;
1.710 -+ s390x-*linux*)
1.711 -+ LD="${LD-ld} -m elf_s390"
1.712 -+ ;;
1.713 -+ sparc64-*linux*)
1.714 -+ LD="${LD-ld} -m elf32_sparc"
1.715 -+ ;;
1.716 -+ esac
1.717 -+ ;;
1.718 -+ *64-bit*)
1.719 -+ case $host in
1.720 -+ x86_64-*linux*)
1.721 -+ LD="${LD-ld} -m elf_x86_64"
1.722 -+ ;;
1.723 -+ ppc*-*linux*|powerpc*-*linux*)
1.724 -+ LD="${LD-ld} -m elf64ppc"
1.725 -+ ;;
1.726 -+ s390*-*linux*)
1.727 -+ LD="${LD-ld} -m elf64_s390"
1.728 -+ ;;
1.729 -+ sparc*-*linux*)
1.730 -+ LD="${LD-ld} -m elf64_sparc"
1.731 -+ ;;
1.732 -+ esac
1.733 -+ ;;
1.734 -+ esac
1.735 -+ fi
1.736 -+ rm -rf conftest*
1.737 -+ ;;
1.738 -+
1.739 - *-*-sco3.2v5*)
1.740 - # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1.741 - SAVE_CFLAGS="$CFLAGS"
1.742 - CFLAGS="$CFLAGS -belf"
1.743 - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
1.744 --echo "configure:1724: checking whether the C compiler needs -belf" >&5
1.745 -+echo "configure:1791: checking whether the C compiler needs -belf" >&5
1.746 - if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
1.747 - echo $ac_n "(cached) $ac_c" 1>&6
1.748 - else
1.749 -@@ -1733,14 +1800,14 @@
1.750 - cross_compiling=$ac_cv_prog_cc_cross
1.751 -
1.752 - cat > conftest.$ac_ext <<EOF
1.753 --#line 1737 "configure"
1.754 -+#line 1804 "configure"
1.755 - #include "confdefs.h"
1.756 -
1.757 - int main() {
1.758 -
1.759 - ; return 0; }
1.760 - EOF
1.761 --if { (eval echo configure:1744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.762 -+if { (eval echo configure:1811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.763 - rm -rf conftest*
1.764 - lt_cv_cc_needs_belf=yes
1.765 - else
1.766 -@@ -1868,7 +1935,7 @@
1.767 - # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
1.768 - # ./install, which can be erroneously created by make from ./install.sh.
1.769 - echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
1.770 --echo "configure:1872: checking for a BSD compatible install" >&5
1.771 -+echo "configure:1939: checking for a BSD compatible install" >&5
1.772 - if test -z "$INSTALL"; then
1.773 - if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
1.774 - echo $ac_n "(cached) $ac_c" 1>&6
1.775 -@@ -1921,7 +1988,7 @@
1.776 - test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
1.777 -
1.778 - echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
1.779 --echo "configure:1925: checking whether build environment is sane" >&5
1.780 -+echo "configure:1992: checking whether build environment is sane" >&5
1.781 - # Just in case
1.782 - sleep 1
1.783 - echo timestamp > conftestfile
1.784 -@@ -1978,7 +2045,7 @@
1.785 - test "$program_transform_name" = "" && program_transform_name="s,x,x,"
1.786 -
1.787 - echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
1.788 --echo "configure:1982: checking whether ${MAKE-make} sets \${MAKE}" >&5
1.789 -+echo "configure:2049: checking whether ${MAKE-make} sets \${MAKE}" >&5
1.790 - set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
1.791 - if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
1.792 - echo $ac_n "(cached) $ac_c" 1>&6
1.793 -@@ -2017,7 +2084,7 @@
1.794 -
1.795 - missing_dir=`cd $ac_aux_dir && pwd`
1.796 - echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
1.797 --echo "configure:2021: checking for working aclocal" >&5
1.798 -+echo "configure:2088: checking for working aclocal" >&5
1.799 - # Run test in a subshell; some versions of sh will print an error if
1.800 - # an executable is not found, even if stderr is redirected.
1.801 - # Redirect stdin to placate older versions of autoconf. Sigh.
1.802 -@@ -2030,7 +2097,7 @@
1.803 - fi
1.804 -
1.805 - echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
1.806 --echo "configure:2034: checking for working autoconf" >&5
1.807 -+echo "configure:2101: checking for working autoconf" >&5
1.808 - # Run test in a subshell; some versions of sh will print an error if
1.809 - # an executable is not found, even if stderr is redirected.
1.810 - # Redirect stdin to placate older versions of autoconf. Sigh.
1.811 -@@ -2043,7 +2110,7 @@
1.812 - fi
1.813 -
1.814 - echo $ac_n "checking for working automake""... $ac_c" 1>&6
1.815 --echo "configure:2047: checking for working automake" >&5
1.816 -+echo "configure:2114: checking for working automake" >&5
1.817 - # Run test in a subshell; some versions of sh will print an error if
1.818 - # an executable is not found, even if stderr is redirected.
1.819 - # Redirect stdin to placate older versions of autoconf. Sigh.
1.820 -@@ -2056,7 +2123,7 @@
1.821 - fi
1.822 -
1.823 - echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
1.824 --echo "configure:2060: checking for working autoheader" >&5
1.825 -+echo "configure:2127: checking for working autoheader" >&5
1.826 - # Run test in a subshell; some versions of sh will print an error if
1.827 - # an executable is not found, even if stderr is redirected.
1.828 - # Redirect stdin to placate older versions of autoconf. Sigh.
1.829 -@@ -2069,7 +2136,7 @@
1.830 - fi
1.831 -
1.832 - echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
1.833 --echo "configure:2073: checking for working makeinfo" >&5
1.834 -+echo "configure:2140: checking for working makeinfo" >&5
1.835 - # Run test in a subshell; some versions of sh will print an error if
1.836 - # an executable is not found, even if stderr is redirected.
1.837 - # Redirect stdin to placate older versions of autoconf. Sigh.
1.838 -@@ -2086,7 +2153,7 @@
1.839 -
1.840 -
1.841 - echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
1.842 --echo "configure:2090: checking for executable suffix" >&5
1.843 -+echo "configure:2157: checking for executable suffix" >&5
1.844 - if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
1.845 - echo $ac_n "(cached) $ac_c" 1>&6
1.846 - else
1.847 -@@ -2096,7 +2163,7 @@
1.848 - rm -f conftest*
1.849 - echo 'int main () { return 0; }' > conftest.$ac_ext
1.850 - ac_cv_exeext=
1.851 -- if { (eval echo configure:2100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
1.852 -+ if { (eval echo configure:2167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
1.853 - for file in conftest.*; do
1.854 - case $file in
1.855 - *.c | *.o | *.obj) ;;
1.856 -@@ -2117,7 +2184,7 @@
1.857 - ac_exeext=$EXEEXT
1.858 -
1.859 - echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
1.860 --echo "configure:2121: checking whether to enable maintainer-specific portions of Makefiles" >&5
1.861 -+echo "configure:2188: checking whether to enable maintainer-specific portions of Makefiles" >&5
1.862 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
1.863 - if test "${enable_maintainer_mode+set}" = set; then
1.864 - enableval="$enable_maintainer_mode"
1.865 -@@ -2143,7 +2210,7 @@
1.866 - # Extract the first word of "gcc", so it can be a program name with args.
1.867 - set dummy gcc; ac_word=$2
1.868 - echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1.869 --echo "configure:2147: checking for $ac_word" >&5
1.870 -+echo "configure:2214: checking for $ac_word" >&5
1.871 - if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
1.872 - echo $ac_n "(cached) $ac_c" 1>&6
1.873 - else
1.874 -@@ -2173,7 +2240,7 @@
1.875 - # Extract the first word of "cc", so it can be a program name with args.
1.876 - set dummy cc; ac_word=$2
1.877 - echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1.878 --echo "configure:2177: checking for $ac_word" >&5
1.879 -+echo "configure:2244: checking for $ac_word" >&5
1.880 - if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
1.881 - echo $ac_n "(cached) $ac_c" 1>&6
1.882 - else
1.883 -@@ -2224,7 +2291,7 @@
1.884 - # Extract the first word of "cl", so it can be a program name with args.
1.885 - set dummy cl; ac_word=$2
1.886 - echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1.887 --echo "configure:2228: checking for $ac_word" >&5
1.888 -+echo "configure:2295: checking for $ac_word" >&5
1.889 - if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
1.890 - echo $ac_n "(cached) $ac_c" 1>&6
1.891 - else
1.892 -@@ -2256,7 +2323,7 @@
1.893 - fi
1.894 -
1.895 - echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
1.896 --echo "configure:2260: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
1.897 -+echo "configure:2327: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
1.898 -
1.899 - ac_ext=c
1.900 - # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
1.901 -@@ -2267,12 +2334,12 @@
1.902 -
1.903 - cat > conftest.$ac_ext << EOF
1.904 -
1.905 --#line 2271 "configure"
1.906 -+#line 2338 "configure"
1.907 - #include "confdefs.h"
1.908 -
1.909 - main(){return(0);}
1.910 - EOF
1.911 --if { (eval echo configure:2276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.912 -+if { (eval echo configure:2343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.913 - ac_cv_prog_cc_works=yes
1.914 - # If we can't run a trivial program, we are probably using a cross compiler.
1.915 - if (./conftest; exit) 2>/dev/null; then
1.916 -@@ -2298,12 +2365,12 @@
1.917 - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
1.918 - fi
1.919 - echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
1.920 --echo "configure:2302: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
1.921 -+echo "configure:2369: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
1.922 - echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
1.923 - cross_compiling=$ac_cv_prog_cc_cross
1.924 -
1.925 - echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
1.926 --echo "configure:2307: checking whether we are using GNU C" >&5
1.927 -+echo "configure:2374: checking whether we are using GNU C" >&5
1.928 - if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
1.929 - echo $ac_n "(cached) $ac_c" 1>&6
1.930 - else
1.931 -@@ -2312,7 +2379,7 @@
1.932 - yes;
1.933 - #endif
1.934 - EOF
1.935 --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
1.936 -+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
1.937 - ac_cv_prog_gcc=yes
1.938 - else
1.939 - ac_cv_prog_gcc=no
1.940 -@@ -2331,7 +2398,7 @@
1.941 - ac_save_CFLAGS="$CFLAGS"
1.942 - CFLAGS=
1.943 - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
1.944 --echo "configure:2335: checking whether ${CC-cc} accepts -g" >&5
1.945 -+echo "configure:2402: checking whether ${CC-cc} accepts -g" >&5
1.946 - if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
1.947 - echo $ac_n "(cached) $ac_c" 1>&6
1.948 - else
1.949 -@@ -2381,17 +2448,23 @@
1.950 - i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;;
1.951 - sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;;
1.952 - sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;;
1.953 --sparc-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
1.954 --sparc64-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
1.955 --alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd*) TARGET=ALPHA; TARGETDIR=alpha;;
1.956 -+sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;;
1.957 -+sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;;
1.958 -+alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;;
1.959 - ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
1.960 - m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;;
1.961 -+mips64*-*);;
1.962 -+mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;;
1.963 - powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
1.964 - powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
1.965 - powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;;
1.966 - powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
1.967 - rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
1.968 - arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;;
1.969 -+s390-*-linux-*) TARGET=S390; TARGETDIR=s390;;
1.970 -+s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
1.971 -+x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
1.972 -+sh-*-linux* | sh[34]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
1.973 - esac
1.974 -
1.975 - if test $TARGETDIR = unknown; then
1.976 -@@ -2418,6 +2491,15 @@
1.977 - fi
1.978 -
1.979 -
1.980 -+if test x$TARGET = xMIPS_LINUX; then
1.981 -+ MIPS_LINUX_TRUE=
1.982 -+ MIPS_LINUX_FALSE='#'
1.983 -+else
1.984 -+ MIPS_LINUX_TRUE='#'
1.985 -+ MIPS_LINUX_FALSE=
1.986 -+fi
1.987 -+
1.988 -+
1.989 - if test x$TARGET = xSPARC; then
1.990 - SPARC_TRUE=
1.991 - SPARC_FALSE='#'
1.992 -@@ -2507,8 +2589,39 @@
1.993 - ARM_FALSE=
1.994 - fi
1.995 -
1.996 -+
1.997 -+if test x$TARGET = xS390; then
1.998 -+ S390_TRUE=
1.999 -+ S390_FALSE='#'
1.1000 -+else
1.1001 -+ S390_TRUE='#'
1.1002 -+ S390_FALSE=
1.1003 -+fi
1.1004 -+
1.1005 -+
1.1006 -+if test x$TARGET = xX86_64; then
1.1007 -+ X86_64_TRUE=
1.1008 -+ X86_64_FALSE='#'
1.1009 -+else
1.1010 -+ X86_64_TRUE='#'
1.1011 -+ X86_64_FALSE=
1.1012 -+fi
1.1013 -+
1.1014 -+
1.1015 -+if test x$TARGET = xSH; then
1.1016 -+ SH_TRUE=
1.1017 -+ SH_FALSE='#'
1.1018 -+else
1.1019 -+ SH_TRUE='#'
1.1020 -+ SH_FALSE=
1.1021 -+fi
1.1022 -+
1.1023 -+if test x$TARGET = xMIPS_LINUX; then
1.1024 -+ TARGET=MIPS
1.1025 -+fi
1.1026 -+
1.1027 - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
1.1028 --echo "configure:2512: checking how to run the C preprocessor" >&5
1.1029 -+echo "configure:2625: checking how to run the C preprocessor" >&5
1.1030 - # On Suns, sometimes $CPP names a directory.
1.1031 - if test -n "$CPP" && test -d "$CPP"; then
1.1032 - CPP=
1.1033 -@@ -2523,13 +2636,13 @@
1.1034 - # On the NeXT, cc -E runs the code through the compiler's parser,
1.1035 - # not just through cpp.
1.1036 - cat > conftest.$ac_ext <<EOF
1.1037 --#line 2527 "configure"
1.1038 -+#line 2640 "configure"
1.1039 - #include "confdefs.h"
1.1040 - #include <assert.h>
1.1041 - Syntax Error
1.1042 - EOF
1.1043 - ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1.1044 --{ (eval echo configure:2533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1045 -+{ (eval echo configure:2646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1046 - ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1.1047 - if test -z "$ac_err"; then
1.1048 - :
1.1049 -@@ -2540,13 +2653,13 @@
1.1050 - rm -rf conftest*
1.1051 - CPP="${CC-cc} -E -traditional-cpp"
1.1052 - cat > conftest.$ac_ext <<EOF
1.1053 --#line 2544 "configure"
1.1054 -+#line 2657 "configure"
1.1055 - #include "confdefs.h"
1.1056 - #include <assert.h>
1.1057 - Syntax Error
1.1058 - EOF
1.1059 - ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1.1060 --{ (eval echo configure:2550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1061 -+{ (eval echo configure:2663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1062 - ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1.1063 - if test -z "$ac_err"; then
1.1064 - :
1.1065 -@@ -2557,13 +2670,13 @@
1.1066 - rm -rf conftest*
1.1067 - CPP="${CC-cc} -nologo -E"
1.1068 - cat > conftest.$ac_ext <<EOF
1.1069 --#line 2561 "configure"
1.1070 -+#line 2674 "configure"
1.1071 - #include "confdefs.h"
1.1072 - #include <assert.h>
1.1073 - Syntax Error
1.1074 - EOF
1.1075 - ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1.1076 --{ (eval echo configure:2567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1077 -+{ (eval echo configure:2680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1078 - ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1.1079 - if test -z "$ac_err"; then
1.1080 - :
1.1081 -@@ -2588,12 +2701,12 @@
1.1082 - echo "$ac_t""$CPP" 1>&6
1.1083 -
1.1084 - echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
1.1085 --echo "configure:2592: checking for ANSI C header files" >&5
1.1086 -+echo "configure:2705: checking for ANSI C header files" >&5
1.1087 - if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
1.1088 - echo $ac_n "(cached) $ac_c" 1>&6
1.1089 - else
1.1090 - cat > conftest.$ac_ext <<EOF
1.1091 --#line 2597 "configure"
1.1092 -+#line 2710 "configure"
1.1093 - #include "confdefs.h"
1.1094 - #include <stdlib.h>
1.1095 - #include <stdarg.h>
1.1096 -@@ -2601,7 +2714,7 @@
1.1097 - #include <float.h>
1.1098 - EOF
1.1099 - ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1.1100 --{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1101 -+{ (eval echo configure:2718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1.1102 - ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1.1103 - if test -z "$ac_err"; then
1.1104 - rm -rf conftest*
1.1105 -@@ -2618,7 +2731,7 @@
1.1106 - if test $ac_cv_header_stdc = yes; then
1.1107 - # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
1.1108 - cat > conftest.$ac_ext <<EOF
1.1109 --#line 2622 "configure"
1.1110 -+#line 2735 "configure"
1.1111 - #include "confdefs.h"
1.1112 - #include <string.h>
1.1113 - EOF
1.1114 -@@ -2636,7 +2749,7 @@
1.1115 - if test $ac_cv_header_stdc = yes; then
1.1116 - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
1.1117 - cat > conftest.$ac_ext <<EOF
1.1118 --#line 2640 "configure"
1.1119 -+#line 2753 "configure"
1.1120 - #include "confdefs.h"
1.1121 - #include <stdlib.h>
1.1122 - EOF
1.1123 -@@ -2657,7 +2770,7 @@
1.1124 - :
1.1125 - else
1.1126 - cat > conftest.$ac_ext <<EOF
1.1127 --#line 2661 "configure"
1.1128 -+#line 2774 "configure"
1.1129 - #include "confdefs.h"
1.1130 - #include <ctype.h>
1.1131 - #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
1.1132 -@@ -2668,7 +2781,7 @@
1.1133 - exit (0); }
1.1134 -
1.1135 - EOF
1.1136 --if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1.1137 -+if { (eval echo configure:2785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1.1138 - then
1.1139 - :
1.1140 - else
1.1141 -@@ -2694,12 +2807,12 @@
1.1142 - for ac_func in memcpy
1.1143 - do
1.1144 - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1.1145 --echo "configure:2698: checking for $ac_func" >&5
1.1146 -+echo "configure:2811: checking for $ac_func" >&5
1.1147 - if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1.1148 - echo $ac_n "(cached) $ac_c" 1>&6
1.1149 - else
1.1150 - cat > conftest.$ac_ext <<EOF
1.1151 --#line 2703 "configure"
1.1152 -+#line 2816 "configure"
1.1153 - #include "confdefs.h"
1.1154 - /* System header to define __stub macros and hopefully few prototypes,
1.1155 - which can conflict with char $ac_func(); below. */
1.1156 -@@ -2722,7 +2835,7 @@
1.1157 -
1.1158 - ; return 0; }
1.1159 - EOF
1.1160 --if { (eval echo configure:2726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1161 -+if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1162 - rm -rf conftest*
1.1163 - eval "ac_cv_func_$ac_func=yes"
1.1164 - else
1.1165 -@@ -2749,19 +2862,19 @@
1.1166 - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
1.1167 - # for constant arguments. Useless!
1.1168 - echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
1.1169 --echo "configure:2753: checking for working alloca.h" >&5
1.1170 -+echo "configure:2866: checking for working alloca.h" >&5
1.1171 - if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
1.1172 - echo $ac_n "(cached) $ac_c" 1>&6
1.1173 - else
1.1174 - cat > conftest.$ac_ext <<EOF
1.1175 --#line 2758 "configure"
1.1176 -+#line 2871 "configure"
1.1177 - #include "confdefs.h"
1.1178 - #include <alloca.h>
1.1179 - int main() {
1.1180 - char *p = alloca(2 * sizeof(int));
1.1181 - ; return 0; }
1.1182 - EOF
1.1183 --if { (eval echo configure:2765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1184 -+if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1185 - rm -rf conftest*
1.1186 - ac_cv_header_alloca_h=yes
1.1187 - else
1.1188 -@@ -2782,12 +2895,12 @@
1.1189 - fi
1.1190 -
1.1191 - echo $ac_n "checking for alloca""... $ac_c" 1>&6
1.1192 --echo "configure:2786: checking for alloca" >&5
1.1193 -+echo "configure:2899: checking for alloca" >&5
1.1194 - if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
1.1195 - echo $ac_n "(cached) $ac_c" 1>&6
1.1196 - else
1.1197 - cat > conftest.$ac_ext <<EOF
1.1198 --#line 2791 "configure"
1.1199 -+#line 2904 "configure"
1.1200 - #include "confdefs.h"
1.1201 -
1.1202 - #ifdef __GNUC__
1.1203 -@@ -2815,7 +2928,7 @@
1.1204 - char *p = (char *) alloca(1);
1.1205 - ; return 0; }
1.1206 - EOF
1.1207 --if { (eval echo configure:2819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1208 -+if { (eval echo configure:2932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1209 - rm -rf conftest*
1.1210 - ac_cv_func_alloca_works=yes
1.1211 - else
1.1212 -@@ -2847,12 +2960,12 @@
1.1213 -
1.1214 -
1.1215 - echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
1.1216 --echo "configure:2851: checking whether alloca needs Cray hooks" >&5
1.1217 -+echo "configure:2964: checking whether alloca needs Cray hooks" >&5
1.1218 - if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
1.1219 - echo $ac_n "(cached) $ac_c" 1>&6
1.1220 - else
1.1221 - cat > conftest.$ac_ext <<EOF
1.1222 --#line 2856 "configure"
1.1223 -+#line 2969 "configure"
1.1224 - #include "confdefs.h"
1.1225 - #if defined(CRAY) && ! defined(CRAY2)
1.1226 - webecray
1.1227 -@@ -2877,12 +2990,12 @@
1.1228 - if test $ac_cv_os_cray = yes; then
1.1229 - for ac_func in _getb67 GETB67 getb67; do
1.1230 - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1.1231 --echo "configure:2881: checking for $ac_func" >&5
1.1232 -+echo "configure:2994: checking for $ac_func" >&5
1.1233 - if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1.1234 - echo $ac_n "(cached) $ac_c" 1>&6
1.1235 - else
1.1236 - cat > conftest.$ac_ext <<EOF
1.1237 --#line 2886 "configure"
1.1238 -+#line 2999 "configure"
1.1239 - #include "confdefs.h"
1.1240 - /* System header to define __stub macros and hopefully few prototypes,
1.1241 - which can conflict with char $ac_func(); below. */
1.1242 -@@ -2905,7 +3018,7 @@
1.1243 -
1.1244 - ; return 0; }
1.1245 - EOF
1.1246 --if { (eval echo configure:2909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1247 -+if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1248 - rm -rf conftest*
1.1249 - eval "ac_cv_func_$ac_func=yes"
1.1250 - else
1.1251 -@@ -2932,7 +3045,7 @@
1.1252 - fi
1.1253 -
1.1254 - echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
1.1255 --echo "configure:2936: checking stack direction for C alloca" >&5
1.1256 -+echo "configure:3049: checking stack direction for C alloca" >&5
1.1257 - if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
1.1258 - echo $ac_n "(cached) $ac_c" 1>&6
1.1259 - else
1.1260 -@@ -2940,7 +3053,7 @@
1.1261 - ac_cv_c_stack_direction=0
1.1262 - else
1.1263 - cat > conftest.$ac_ext <<EOF
1.1264 --#line 2944 "configure"
1.1265 -+#line 3057 "configure"
1.1266 - #include "confdefs.h"
1.1267 - find_stack_direction ()
1.1268 - {
1.1269 -@@ -2959,7 +3072,7 @@
1.1270 - exit (find_stack_direction() < 0);
1.1271 - }
1.1272 - EOF
1.1273 --if { (eval echo configure:2963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1.1274 -+if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1.1275 - then
1.1276 - ac_cv_c_stack_direction=1
1.1277 - else
1.1278 -@@ -2982,13 +3095,13 @@
1.1279 -
1.1280 -
1.1281 - echo $ac_n "checking size of short""... $ac_c" 1>&6
1.1282 --echo "configure:2986: checking size of short" >&5
1.1283 -+echo "configure:3099: checking size of short" >&5
1.1284 - if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
1.1285 - echo $ac_n "(cached) $ac_c" 1>&6
1.1286 - else
1.1287 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1288 - cat > conftest.$ac_ext <<EOF
1.1289 --#line 2992 "configure"
1.1290 -+#line 3105 "configure"
1.1291 - #include "confdefs.h"
1.1292 - #include "confdefs.h"
1.1293 - #include <sys/types.h>
1.1294 -@@ -2998,7 +3111,7 @@
1.1295 - switch (0) case 0: case (sizeof (short) == $ac_size):;
1.1296 - ; return 0; }
1.1297 - EOF
1.1298 --if { (eval echo configure:3002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1299 -+if { (eval echo configure:3115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1300 - rm -rf conftest*
1.1301 - ac_cv_sizeof_short=$ac_size
1.1302 - else
1.1303 -@@ -3021,13 +3134,13 @@
1.1304 -
1.1305 -
1.1306 - echo $ac_n "checking size of int""... $ac_c" 1>&6
1.1307 --echo "configure:3025: checking size of int" >&5
1.1308 -+echo "configure:3138: checking size of int" >&5
1.1309 - if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
1.1310 - echo $ac_n "(cached) $ac_c" 1>&6
1.1311 - else
1.1312 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1313 - cat > conftest.$ac_ext <<EOF
1.1314 --#line 3031 "configure"
1.1315 -+#line 3144 "configure"
1.1316 - #include "confdefs.h"
1.1317 - #include "confdefs.h"
1.1318 - #include <sys/types.h>
1.1319 -@@ -3037,7 +3150,7 @@
1.1320 - switch (0) case 0: case (sizeof (int) == $ac_size):;
1.1321 - ; return 0; }
1.1322 - EOF
1.1323 --if { (eval echo configure:3041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1324 -+if { (eval echo configure:3154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1325 - rm -rf conftest*
1.1326 - ac_cv_sizeof_int=$ac_size
1.1327 - else
1.1328 -@@ -3060,13 +3173,13 @@
1.1329 -
1.1330 -
1.1331 - echo $ac_n "checking size of long""... $ac_c" 1>&6
1.1332 --echo "configure:3064: checking size of long" >&5
1.1333 -+echo "configure:3177: checking size of long" >&5
1.1334 - if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
1.1335 - echo $ac_n "(cached) $ac_c" 1>&6
1.1336 - else
1.1337 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1338 - cat > conftest.$ac_ext <<EOF
1.1339 --#line 3070 "configure"
1.1340 -+#line 3183 "configure"
1.1341 - #include "confdefs.h"
1.1342 - #include "confdefs.h"
1.1343 - #include <sys/types.h>
1.1344 -@@ -3076,7 +3189,7 @@
1.1345 - switch (0) case 0: case (sizeof (long) == $ac_size):;
1.1346 - ; return 0; }
1.1347 - EOF
1.1348 --if { (eval echo configure:3080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1349 -+if { (eval echo configure:3193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1350 - rm -rf conftest*
1.1351 - ac_cv_sizeof_long=$ac_size
1.1352 - else
1.1353 -@@ -3099,13 +3212,13 @@
1.1354 -
1.1355 -
1.1356 - echo $ac_n "checking size of long long""... $ac_c" 1>&6
1.1357 --echo "configure:3103: checking size of long long" >&5
1.1358 -+echo "configure:3216: checking size of long long" >&5
1.1359 - if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
1.1360 - echo $ac_n "(cached) $ac_c" 1>&6
1.1361 - else
1.1362 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1363 - cat > conftest.$ac_ext <<EOF
1.1364 --#line 3109 "configure"
1.1365 -+#line 3222 "configure"
1.1366 - #include "confdefs.h"
1.1367 - #include "confdefs.h"
1.1368 - #include <sys/types.h>
1.1369 -@@ -3115,7 +3228,7 @@
1.1370 - switch (0) case 0: case (sizeof (long long) == $ac_size):;
1.1371 - ; return 0; }
1.1372 - EOF
1.1373 --if { (eval echo configure:3119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1374 -+if { (eval echo configure:3232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1375 - rm -rf conftest*
1.1376 - ac_cv_sizeof_long_long=$ac_size
1.1377 - else
1.1378 -@@ -3138,13 +3251,13 @@
1.1379 -
1.1380 -
1.1381 - echo $ac_n "checking size of float""... $ac_c" 1>&6
1.1382 --echo "configure:3142: checking size of float" >&5
1.1383 -+echo "configure:3255: checking size of float" >&5
1.1384 - if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then
1.1385 - echo $ac_n "(cached) $ac_c" 1>&6
1.1386 - else
1.1387 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1388 - cat > conftest.$ac_ext <<EOF
1.1389 --#line 3148 "configure"
1.1390 -+#line 3261 "configure"
1.1391 - #include "confdefs.h"
1.1392 - #include "confdefs.h"
1.1393 - #include <sys/types.h>
1.1394 -@@ -3154,7 +3267,7 @@
1.1395 - switch (0) case 0: case (sizeof (float) == $ac_size):;
1.1396 - ; return 0; }
1.1397 - EOF
1.1398 --if { (eval echo configure:3158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1399 -+if { (eval echo configure:3271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1400 - rm -rf conftest*
1.1401 - ac_cv_sizeof_float=$ac_size
1.1402 - else
1.1403 -@@ -3177,13 +3290,13 @@
1.1404 -
1.1405 -
1.1406 - echo $ac_n "checking size of double""... $ac_c" 1>&6
1.1407 --echo "configure:3181: checking size of double" >&5
1.1408 -+echo "configure:3294: checking size of double" >&5
1.1409 - if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then
1.1410 - echo $ac_n "(cached) $ac_c" 1>&6
1.1411 - else
1.1412 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1413 - cat > conftest.$ac_ext <<EOF
1.1414 --#line 3187 "configure"
1.1415 -+#line 3300 "configure"
1.1416 - #include "confdefs.h"
1.1417 - #include "confdefs.h"
1.1418 - #include <sys/types.h>
1.1419 -@@ -3193,7 +3306,7 @@
1.1420 - switch (0) case 0: case (sizeof (double) == $ac_size):;
1.1421 - ; return 0; }
1.1422 - EOF
1.1423 --if { (eval echo configure:3197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1424 -+if { (eval echo configure:3310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1425 - rm -rf conftest*
1.1426 - ac_cv_sizeof_double=$ac_size
1.1427 - else
1.1428 -@@ -3216,13 +3329,13 @@
1.1429 -
1.1430 -
1.1431 - echo $ac_n "checking size of long double""... $ac_c" 1>&6
1.1432 --echo "configure:3220: checking size of long double" >&5
1.1433 -+echo "configure:3333: checking size of long double" >&5
1.1434 - if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
1.1435 - echo $ac_n "(cached) $ac_c" 1>&6
1.1436 - else
1.1437 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1438 - cat > conftest.$ac_ext <<EOF
1.1439 --#line 3226 "configure"
1.1440 -+#line 3339 "configure"
1.1441 - #include "confdefs.h"
1.1442 - #include "confdefs.h"
1.1443 - #include <sys/types.h>
1.1444 -@@ -3232,7 +3345,7 @@
1.1445 - switch (0) case 0: case (sizeof (long double) == $ac_size):;
1.1446 - ; return 0; }
1.1447 - EOF
1.1448 --if { (eval echo configure:3236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1449 -+if { (eval echo configure:3349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1450 - rm -rf conftest*
1.1451 - ac_cv_sizeof_long_double=$ac_size
1.1452 - else
1.1453 -@@ -3256,13 +3369,13 @@
1.1454 -
1.1455 -
1.1456 - echo $ac_n "checking size of void *""... $ac_c" 1>&6
1.1457 --echo "configure:3260: checking size of void *" >&5
1.1458 -+echo "configure:3373: checking size of void *" >&5
1.1459 - if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
1.1460 - echo $ac_n "(cached) $ac_c" 1>&6
1.1461 - else
1.1462 - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
1.1463 - cat > conftest.$ac_ext <<EOF
1.1464 --#line 3266 "configure"
1.1465 -+#line 3379 "configure"
1.1466 - #include "confdefs.h"
1.1467 - #include "confdefs.h"
1.1468 - #include <sys/types.h>
1.1469 -@@ -3272,7 +3385,7 @@
1.1470 - switch (0) case 0: case (sizeof (void *) == $ac_size):;
1.1471 - ; return 0; }
1.1472 - EOF
1.1473 --if { (eval echo configure:3276: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1474 -+if { (eval echo configure:3389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1475 - rm -rf conftest*
1.1476 - ac_cv_sizeof_void_p=$ac_size
1.1477 - else
1.1478 -@@ -3295,14 +3408,14 @@
1.1479 -
1.1480 -
1.1481 - echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
1.1482 --echo "configure:3299: checking whether byte ordering is bigendian" >&5
1.1483 -+echo "configure:3412: checking whether byte ordering is bigendian" >&5
1.1484 - if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
1.1485 - echo $ac_n "(cached) $ac_c" 1>&6
1.1486 - else
1.1487 - ac_cv_c_bigendian=unknown
1.1488 - # See if sys/param.h defines the BYTE_ORDER macro.
1.1489 - cat > conftest.$ac_ext <<EOF
1.1490 --#line 3306 "configure"
1.1491 -+#line 3419 "configure"
1.1492 - #include "confdefs.h"
1.1493 - #include <sys/types.h>
1.1494 - #include <sys/param.h>
1.1495 -@@ -3313,11 +3426,11 @@
1.1496 - #endif
1.1497 - ; return 0; }
1.1498 - EOF
1.1499 --if { (eval echo configure:3317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1500 -+if { (eval echo configure:3430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1501 - rm -rf conftest*
1.1502 - # It does; now see whether it defined to BIG_ENDIAN or not.
1.1503 - cat > conftest.$ac_ext <<EOF
1.1504 --#line 3321 "configure"
1.1505 -+#line 3434 "configure"
1.1506 - #include "confdefs.h"
1.1507 - #include <sys/types.h>
1.1508 - #include <sys/param.h>
1.1509 -@@ -3328,7 +3441,7 @@
1.1510 - #endif
1.1511 - ; return 0; }
1.1512 - EOF
1.1513 --if { (eval echo configure:3332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1514 -+if { (eval echo configure:3445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1.1515 - rm -rf conftest*
1.1516 - ac_cv_c_bigendian=yes
1.1517 - else
1.1518 -@@ -3348,7 +3461,7 @@
1.1519 - echo $ac_n "cross-compiling... " 2>&6
1.1520 - else
1.1521 - cat > conftest.$ac_ext <<EOF
1.1522 --#line 3352 "configure"
1.1523 -+#line 3465 "configure"
1.1524 - #include "confdefs.h"
1.1525 - main () {
1.1526 - /* Are we little or big endian? From Harbison&Steele. */
1.1527 -@@ -3361,7 +3474,7 @@
1.1528 - exit (u.c[sizeof (long) - 1] == 1);
1.1529 - }
1.1530 - EOF
1.1531 --if { (eval echo configure:3365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1.1532 -+if { (eval echo configure:3478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1.1533 - then
1.1534 - ac_cv_c_bigendian=no
1.1535 - else
1.1536 -@@ -3379,7 +3492,7 @@
1.1537 - echo "$ac_t""$ac_cv_c_bigendian" 1>&6
1.1538 - if test $ac_cv_c_bigendian = unknown; then
1.1539 - echo $ac_n "checking to probe for byte ordering""... $ac_c" 1>&6
1.1540 --echo "configure:3383: checking to probe for byte ordering" >&5
1.1541 -+echo "configure:3496: checking to probe for byte ordering" >&5
1.1542 -
1.1543 - cat >conftest.c <<EOF
1.1544 - short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
1.1545 -@@ -3414,6 +3527,10 @@
1.1546 - #define WORDS_BIGENDIAN 1
1.1547 - EOF
1.1548 -
1.1549 -+ cat >> confdefs.h <<\EOF
1.1550 -+#define HOST_WORDS_BIG_ENDIAN 1
1.1551 -+EOF
1.1552 -+
1.1553 - BYTEORDER=4321
1.1554 - else
1.1555 - BYTEORDER=1234
1.1556 -@@ -3429,7 +3546,7 @@
1.1557 -
1.1558 - if test x$TARGET = xSPARC; then
1.1559 - echo $ac_n "checking assembler and linker support unaligned pc related relocs""... $ac_c" 1>&6
1.1560 --echo "configure:3433: checking assembler and linker support unaligned pc related relocs" >&5
1.1561 -+echo "configure:3550: checking assembler and linker support unaligned pc related relocs" >&5
1.1562 - if eval "test \"`echo '$''{'libffi_cv_as_sparc_ua_pcrel'+set}'`\" = set"; then
1.1563 - echo $ac_n "(cached) $ac_c" 1>&6
1.1564 - else
1.1565 -@@ -3439,14 +3556,14 @@
1.1566 - CFLAGS="$CFLAGS -fpic"
1.1567 - LDFLAGS="$LDFLAGS -shared"
1.1568 - cat > conftest.$ac_ext <<EOF
1.1569 --#line 3443 "configure"
1.1570 -+#line 3560 "configure"
1.1571 - #include "confdefs.h"
1.1572 - asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");
1.1573 - int main() {
1.1574 -
1.1575 - ; return 0; }
1.1576 - EOF
1.1577 --if { (eval echo configure:3450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1578 -+if { (eval echo configure:3567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1.1579 - rm -rf conftest*
1.1580 - libffi_cv_as_sparc_ua_pcrel=yes
1.1581 - else
1.1582 -@@ -3709,6 +3826,8 @@
1.1583 - s%@MIPS_GCC_FALSE@%$MIPS_GCC_FALSE%g
1.1584 - s%@MIPS_SGI_TRUE@%$MIPS_SGI_TRUE%g
1.1585 - s%@MIPS_SGI_FALSE@%$MIPS_SGI_FALSE%g
1.1586 -+s%@MIPS_LINUX_TRUE@%$MIPS_LINUX_TRUE%g
1.1587 -+s%@MIPS_LINUX_FALSE@%$MIPS_LINUX_FALSE%g
1.1588 - s%@SPARC_TRUE@%$SPARC_TRUE%g
1.1589 - s%@SPARC_FALSE@%$SPARC_FALSE%g
1.1590 - s%@X86_TRUE@%$X86_TRUE%g
1.1591 -@@ -3729,6 +3848,12 @@
1.1592 - s%@POWERPC_DARWIN_FALSE@%$POWERPC_DARWIN_FALSE%g
1.1593 - s%@ARM_TRUE@%$ARM_TRUE%g
1.1594 - s%@ARM_FALSE@%$ARM_FALSE%g
1.1595 -+s%@S390_TRUE@%$S390_TRUE%g
1.1596 -+s%@S390_FALSE@%$S390_FALSE%g
1.1597 -+s%@X86_64_TRUE@%$X86_64_TRUE%g
1.1598 -+s%@X86_64_FALSE@%$X86_64_FALSE%g
1.1599 -+s%@SH_TRUE@%$SH_TRUE%g
1.1600 -+s%@SH_FALSE@%$SH_FALSE%g
1.1601 - s%@CPP@%$CPP%g
1.1602 - s%@ALLOCA@%$ALLOCA%g
1.1603 - s%@TARGET@%$TARGET%g
1.1604 -@@ -3969,7 +4094,7 @@
1.1605 -
1.1606 - if test -n "$CONFIG_FILES"; then
1.1607 - LD="${ORIGINAL_LD_FOR_MULTILIBS}"
1.1608 -- ac_file=Makefile . ${libffi_basedir}/../config-ml.in
1.1609 -+ ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in
1.1610 - fi
1.1611 -
1.1612 - exit 0
1.1613 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/configure.in gcc/libffi/configure.in
1.1614 ---- gcc-3.2.2.orig/libffi/configure.in Tue Jan 28 10:43:56 2003
1.1615 -+++ gcc/libffi/configure.in Sat Feb 1 20:16:19 2003
1.1616 -@@ -22,14 +22,15 @@
1.1617 -
1.1618 - if test "${srcdir}" = "."; then
1.1619 - if test "${with_target_subdir}" != "."; then
1.1620 -- libffi_basedir="${srcdir}/${with_multisrctop}.."
1.1621 -+ libffi_basedir="${with_multisrctop}../"
1.1622 - else
1.1623 -- libffi_basedir="${srcdir}/${with_multisrctop}"
1.1624 -+ libffi_basedir="${with_multisrctop}"
1.1625 - fi
1.1626 - else
1.1627 -- libffi_basedir="${srcdir}"
1.1628 -+ libffi_basedir=
1.1629 - fi
1.1630 - AC_SUBST(libffi_basedir)
1.1631 -+AC_CONFIG_AUX_DIR(${libffi_basedir}..)
1.1632 -
1.1633 - AC_CANONICAL_HOST
1.1634 -
1.1635 -@@ -56,17 +57,23 @@
1.1636 - i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;;
1.1637 - sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;;
1.1638 - sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;;
1.1639 --sparc-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
1.1640 --sparc64-*-linux*) TARGET=SPARC; TARGETDIR=sparc;;
1.1641 --alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd*) TARGET=ALPHA; TARGETDIR=alpha;;
1.1642 -+sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;;
1.1643 -+sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;;
1.1644 -+alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;;
1.1645 - ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
1.1646 - m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;;
1.1647 -+mips64*-*);;
1.1648 -+mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;;
1.1649 - powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
1.1650 - powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
1.1651 - powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;;
1.1652 - powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
1.1653 - rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
1.1654 - arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;;
1.1655 -+s390-*-linux-*) TARGET=S390; TARGETDIR=s390;;
1.1656 -+s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
1.1657 -+x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
1.1658 -+sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
1.1659 - esac
1.1660 -
1.1661 - if test $TARGETDIR = unknown; then
1.1662 -@@ -75,6 +82,7 @@
1.1663 -
1.1664 - AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
1.1665 - AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
1.1666 -+AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX)
1.1667 - AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
1.1668 - AM_CONDITIONAL(X86, test x$TARGET = xX86)
1.1669 - AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
1.1670 -@@ -85,6 +93,13 @@
1.1671 - AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
1.1672 - AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
1.1673 - AM_CONDITIONAL(ARM, test x$TARGET = xARM)
1.1674 -+AM_CONDITIONAL(S390, test x$TARGET = xS390)
1.1675 -+AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
1.1676 -+AM_CONDITIONAL(SH, test x$TARGET = xSH)
1.1677 -+
1.1678 -+if test x$TARGET = xMIPS_LINUX; then
1.1679 -+ TARGET=MIPS
1.1680 -+fi
1.1681 -
1.1682 - AC_HEADER_STDC
1.1683 - AC_CHECK_FUNCS(memcpy)
1.1684 -@@ -171,7 +186,7 @@
1.1685 - [
1.1686 - if test -n "$CONFIG_FILES"; then
1.1687 - LD="${ORIGINAL_LD_FOR_MULTILIBS}"
1.1688 -- ac_file=Makefile . ${libffi_basedir}/../config-ml.in
1.1689 -+ ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in
1.1690 - fi
1.1691 - ],
1.1692 - srcdir=${srcdir}
1.1693 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/include/Makefile.in gcc/libffi/include/Makefile.in
1.1694 ---- gcc-3.2.2.orig/libffi/include/Makefile.in Tue Oct 9 14:32:16 2001
1.1695 -+++ gcc/libffi/include/Makefile.in Mon Apr 29 13:14:44 2002
1.1696 -@@ -99,7 +99,7 @@
1.1697 -
1.1698 - DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
1.1699 -
1.1700 --TAR = gnutar
1.1701 -+TAR = gtar
1.1702 - GZIP_ENV = --best
1.1703 - all: all-redirect
1.1704 - .SUFFIXES:
1.1705 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/include/ffi.h.in gcc/libffi/include/ffi.h.in
1.1706 ---- gcc-3.2.2.orig/libffi/include/ffi.h.in Wed Mar 13 07:35:56 2002
1.1707 -+++ gcc/libffi/include/ffi.h.in Wed Jan 29 00:54:28 2003
1.1708 -@@ -1,5 +1,5 @@
1.1709 - /* -----------------------------------------------------------------*-C-*-
1.1710 -- libffi @VERSION@ - Copyright (c) 1996-2002 Cygnus Solutions
1.1711 -+ libffi @VERSION@ - Copyright (c) 1996-2003 Cygnus Solutions
1.1712 -
1.1713 - Permission is hereby granted, free of charge, to any person obtaining
1.1714 - a copy of this software and associated documentation files (the
1.1715 -@@ -164,6 +164,12 @@
1.1716 - #endif
1.1717 - #endif
1.1718 -
1.1719 -+#ifdef S390
1.1720 -+#if defined (__s390x__)
1.1721 -+#define S390X
1.1722 -+#endif
1.1723 -+#endif
1.1724 -+
1.1725 - #ifndef LIBFFI_ASM
1.1726 -
1.1727 - /* ---- Generic type definitions ----------------------------------------- */
1.1728 -@@ -189,16 +195,23 @@
1.1729 - #endif
1.1730 - #endif
1.1731 -
1.1732 -- /* ---- Intel x86 ---------------- */
1.1733 --#ifdef X86
1.1734 -+ /* ---- Intel x86 Win32 ---------- */
1.1735 -+#ifdef X86_WIN32
1.1736 - FFI_SYSV,
1.1737 -+ FFI_STDCALL,
1.1738 -+ /* TODO: Add fastcall support for the sake of completeness */
1.1739 - FFI_DEFAULT_ABI = FFI_SYSV,
1.1740 - #endif
1.1741 -
1.1742 -- /* ---- Intel x86 Win32 ---------- */
1.1743 --#ifdef X86_WIN32
1.1744 -+ /* ---- Intel x86 and AMD x86-64 - */
1.1745 -+#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
1.1746 - FFI_SYSV,
1.1747 -+ FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */
1.1748 -+#ifdef __i386__
1.1749 - FFI_DEFAULT_ABI = FFI_SYSV,
1.1750 -+#else
1.1751 -+ FFI_DEFAULT_ABI = FFI_UNIX64,
1.1752 -+#endif
1.1753 - #endif
1.1754 -
1.1755 - /* ---- Intel ia64 ---------------- */
1.1756 -@@ -251,6 +264,18 @@
1.1757 - FFI_DEFAULT_ABI = FFI_SYSV,
1.1758 - #endif
1.1759 -
1.1760 -+ /* ---- S390 --------------------- */
1.1761 -+#ifdef S390
1.1762 -+ FFI_SYSV,
1.1763 -+ FFI_DEFAULT_ABI = FFI_SYSV,
1.1764 -+#endif
1.1765 -+
1.1766 -+ /* ---- SuperH ------------------- */
1.1767 -+#ifdef SH
1.1768 -+ FFI_SYSV,
1.1769 -+ FFI_DEFAULT_ABI = FFI_SYSV,
1.1770 -+#endif
1.1771 -+
1.1772 - /* Leave this for debugging purposes */
1.1773 - FFI_LAST_ABI
1.1774 -
1.1775 -@@ -264,7 +289,7 @@
1.1776 - /*@null@*/ struct _ffi_type **elements;
1.1777 - } ffi_type;
1.1778 -
1.1779 --/* These are defined in ffi.c */
1.1780 -+/* These are defined in types.c */
1.1781 - extern ffi_type ffi_type_void;
1.1782 - extern ffi_type ffi_type_uint8;
1.1783 - extern ffi_type ffi_type_sint8;
1.1784 -@@ -373,13 +398,7 @@
1.1785 -
1.1786 - /* ---- Definitions for closures ----------------------------------------- */
1.1787 -
1.1788 --#ifdef X86
1.1789 --
1.1790 --#define FFI_CLOSURES 1 /* x86 supports closures */
1.1791 --#define FFI_TRAMPOLINE_SIZE 10
1.1792 --#define FFI_NATIVE_RAW_API 1 /* and has native raw api support */
1.1793 --
1.1794 --#elif defined(X86_WIN32)
1.1795 -+#ifdef __i386__
1.1796 -
1.1797 - #define FFI_CLOSURES 1 /* x86 supports closures */
1.1798 - #define FFI_TRAMPOLINE_SIZE 10
1.1799 -@@ -424,6 +443,40 @@
1.1800 - #define FFI_TRAMPOLINE_SIZE 24 /* see struct below */
1.1801 - #define FFI_NATIVE_RAW_API 0
1.1802 -
1.1803 -+#elif defined(SPARC64)
1.1804 -+
1.1805 -+#define FFI_CLOSURES 1
1.1806 -+#define FFI_TRAMPOLINE_SIZE 24
1.1807 -+#define FFI_NATIVE_RAW_API 0
1.1808 -+
1.1809 -+#elif defined(SPARC)
1.1810 -+
1.1811 -+#define FFI_CLOSURES 1
1.1812 -+#define FFI_TRAMPOLINE_SIZE 16
1.1813 -+#define FFI_NATIVE_RAW_API 0
1.1814 -+
1.1815 -+#elif defined(S390)
1.1816 -+
1.1817 -+#define FFI_CLOSURES 1
1.1818 -+#ifdef S390X
1.1819 -+#define FFI_TRAMPOLINE_SIZE 32
1.1820 -+#else
1.1821 -+#define FFI_TRAMPOLINE_SIZE 16
1.1822 -+#endif
1.1823 -+#define FFI_NATIVE_RAW_API 0
1.1824 -+
1.1825 -+#elif defined(SH)
1.1826 -+
1.1827 -+#define FFI_CLOSURES 1
1.1828 -+#define FFI_TRAMPOLINE_SIZE 16
1.1829 -+#define FFI_NATIVE_RAW_API 0
1.1830 -+
1.1831 -+#elif defined(__x86_64__)
1.1832 -+
1.1833 -+#define FFI_CLOSURES 1
1.1834 -+#define FFI_TRAMPOLINE_SIZE 24
1.1835 -+#define FFI_NATIVE_RAW_API 0
1.1836 -+
1.1837 - #else
1.1838 -
1.1839 - #define FFI_CLOSURES 0
1.1840 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/arm/ffi.c gcc/libffi/src/arm/ffi.c
1.1841 ---- gcc-3.2.2.orig/libffi/src/arm/ffi.c Sat Mar 3 07:21:23 2001
1.1842 -+++ gcc/libffi/src/arm/ffi.c Fri Jul 19 08:08:30 2002
1.1843 -@@ -36,13 +36,10 @@
1.1844 - /*@=exportheader@*/
1.1845 - {
1.1846 - register unsigned int i;
1.1847 -- register int tmp;
1.1848 -- register unsigned int avn;
1.1849 - register void **p_argv;
1.1850 - register char *argp;
1.1851 - register ffi_type **p_arg;
1.1852 -
1.1853 -- tmp = 0;
1.1854 - argp = stack;
1.1855 -
1.1856 - if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) {
1.1857 -@@ -50,11 +47,10 @@
1.1858 - argp += 4;
1.1859 - }
1.1860 -
1.1861 -- avn = ecif->cif->nargs;
1.1862 - p_argv = ecif->avalue;
1.1863 -
1.1864 - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
1.1865 -- (i != 0) && (avn != 0);
1.1866 -+ (i != 0);
1.1867 - i--, p_arg++)
1.1868 - {
1.1869 - size_t z;
1.1870 -@@ -64,9 +60,6 @@
1.1871 - argp = (char *) ALIGN(argp, (*p_arg)->alignment);
1.1872 - }
1.1873 -
1.1874 -- if (avn != 0)
1.1875 -- {
1.1876 -- avn--;
1.1877 - z = (*p_arg)->size;
1.1878 - if (z < sizeof(int))
1.1879 - {
1.1880 -@@ -107,7 +100,6 @@
1.1881 - }
1.1882 - p_argv++;
1.1883 - argp += z;
1.1884 -- }
1.1885 - }
1.1886 -
1.1887 - return;
1.1888 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/arm/sysv.S gcc/libffi/src/arm/sysv.S
1.1889 ---- gcc-3.2.2.orig/libffi/src/arm/sysv.S Sat Mar 3 07:21:23 2001
1.1890 -+++ gcc/libffi/src/arm/sysv.S Mon Sep 30 03:08:58 2002
1.1891 -@@ -28,8 +28,15 @@
1.1892 - #ifdef HAVE_MACHINE_ASM_H
1.1893 - #include <machine/asm.h>
1.1894 - #else
1.1895 --/* XXX these lose for some platforms, I'm sure. */
1.1896 -+#ifdef __USER_LABEL_PREFIX__
1.1897 -+#define CONCAT1(a, b) CONCAT2(a, b)
1.1898 -+#define CONCAT2(a, b) a ## b
1.1899 -+
1.1900 -+/* Use the right prefix for global labels. */
1.1901 -+#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
1.1902 -+#else
1.1903 - #define CNAME(x) x
1.1904 -+#endif
1.1905 - #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
1.1906 - #endif
1.1907 -
1.1908 -@@ -96,12 +103,20 @@
1.1909 -
1.1910 - # return FLOAT
1.1911 - cmp a4, #FFI_TYPE_FLOAT
1.1912 -+#ifdef __SOFTFP__
1.1913 -+ streq a1, [a3]
1.1914 -+#else
1.1915 - stfeqs f0, [a3]
1.1916 -+#endif
1.1917 - beq epilogue
1.1918 -
1.1919 - # return DOUBLE or LONGDOUBLE
1.1920 - cmp a4, #FFI_TYPE_DOUBLE
1.1921 -+#ifdef __SOFTFP__
1.1922 -+ stmeqia a3, {a1, a2}
1.1923 -+#else
1.1924 - stfeqd f0, [a3]
1.1925 -+#endif
1.1926 -
1.1927 - epilogue:
1.1928 - ldmfd sp!, {a1-a4, fp, pc}
1.1929 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/java_raw_api.c gcc/libffi/src/java_raw_api.c
1.1930 ---- gcc-3.2.2.orig/libffi/src/java_raw_api.c Tue Apr 9 07:31:14 2002
1.1931 -+++ gcc/libffi/src/java_raw_api.c Tue Oct 8 23:55:02 2002
1.1932 -@@ -81,21 +81,14 @@
1.1933 - {
1.1934 - case FFI_TYPE_UINT8:
1.1935 - case FFI_TYPE_SINT8:
1.1936 -- *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 1);
1.1937 -+ *args = (void*) ((char*)(raw++) + 3);
1.1938 - break;
1.1939 -
1.1940 - case FFI_TYPE_UINT16:
1.1941 - case FFI_TYPE_SINT16:
1.1942 -- *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 2);
1.1943 -+ *args = (void*) ((char*)(raw++) + 2);
1.1944 - break;
1.1945 -
1.1946 --#if SIZEOF_ARG >= 4
1.1947 -- case FFI_TYPE_UINT32:
1.1948 -- case FFI_TYPE_SINT32:
1.1949 -- *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 4);
1.1950 -- break;
1.1951 --#endif
1.1952 --
1.1953 - #if SIZEOF_ARG == 8
1.1954 - case FFI_TYPE_UINT64:
1.1955 - case FFI_TYPE_SINT64:
1.1956 -@@ -157,31 +150,54 @@
1.1957 - switch ((*tp)->type)
1.1958 - {
1.1959 - case FFI_TYPE_UINT8:
1.1960 -+#if WORDS_BIGENDIAN
1.1961 -+ *(UINT32*)(raw++) = *(UINT8*) (*args);
1.1962 -+#else
1.1963 - (raw++)->uint = *(UINT8*) (*args);
1.1964 -+#endif
1.1965 - break;
1.1966 -
1.1967 - case FFI_TYPE_SINT8:
1.1968 -+#if WORDS_BIGENDIAN
1.1969 -+ *(SINT32*)(raw++) = *(SINT8*) (*args);
1.1970 -+#else
1.1971 - (raw++)->sint = *(SINT8*) (*args);
1.1972 -+#endif
1.1973 - break;
1.1974 -
1.1975 - case FFI_TYPE_UINT16:
1.1976 -+#if WORDS_BIGENDIAN
1.1977 -+ *(UINT32*)(raw++) = *(UINT16*) (*args);
1.1978 -+#else
1.1979 - (raw++)->uint = *(UINT16*) (*args);
1.1980 -+#endif
1.1981 - break;
1.1982 -
1.1983 - case FFI_TYPE_SINT16:
1.1984 -+#if WORDS_BIGENDIAN
1.1985 -+ *(SINT32*)(raw++) = *(SINT16*) (*args);
1.1986 -+#else
1.1987 - (raw++)->sint = *(SINT16*) (*args);
1.1988 -+#endif
1.1989 - break;
1.1990 -
1.1991 --#if SIZEOF_ARG >= 4
1.1992 - case FFI_TYPE_UINT32:
1.1993 -+#if WORDS_BIGENDIAN
1.1994 -+ *(UINT32*)(raw++) = *(UINT32*) (*args);
1.1995 -+#else
1.1996 - (raw++)->uint = *(UINT32*) (*args);
1.1997 -+#endif
1.1998 - break;
1.1999 -
1.2000 - case FFI_TYPE_SINT32:
1.2001 -+#if WORDS_BIGENDIAN
1.2002 -+ *(SINT32*)(raw++) = *(SINT32*) (*args);
1.2003 -+#else
1.2004 - (raw++)->sint = *(SINT32*) (*args);
1.2005 -- break;
1.2006 - #endif
1.2007 -- case FFI_TYPE_FLOAT:
1.2008 -+ break;
1.2009 -+
1.2010 -+ case FFI_TYPE_FLOAT:
1.2011 - (raw++)->flt = *(FLOAT32*) (*args);
1.2012 - break;
1.2013 -
1.2014 -@@ -211,6 +227,55 @@
1.2015 -
1.2016 - #if !FFI_NATIVE_RAW_API
1.2017 -
1.2018 -+static void
1.2019 -+ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
1.2020 -+{
1.2021 -+#if WORDS_BIGENDIAN && SIZEOF_ARG == 8
1.2022 -+ switch (cif->rtype->type)
1.2023 -+ {
1.2024 -+ case FFI_TYPE_UINT8:
1.2025 -+ case FFI_TYPE_UINT16:
1.2026 -+ case FFI_TYPE_UINT32:
1.2027 -+ *(UINT64 *)rvalue <<= 32;
1.2028 -+ break;
1.2029 -+
1.2030 -+ case FFI_TYPE_SINT8:
1.2031 -+ case FFI_TYPE_SINT16:
1.2032 -+ case FFI_TYPE_SINT32:
1.2033 -+ case FFI_TYPE_INT:
1.2034 -+ *(SINT64 *)rvalue <<= 32;
1.2035 -+ break;
1.2036 -+
1.2037 -+ default:
1.2038 -+ break;
1.2039 -+ }
1.2040 -+#endif
1.2041 -+}
1.2042 -+
1.2043 -+static void
1.2044 -+ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
1.2045 -+{
1.2046 -+#if WORDS_BIGENDIAN && SIZEOF_ARG == 8
1.2047 -+ switch (cif->rtype->type)
1.2048 -+ {
1.2049 -+ case FFI_TYPE_UINT8:
1.2050 -+ case FFI_TYPE_UINT16:
1.2051 -+ case FFI_TYPE_UINT32:
1.2052 -+ *(UINT64 *)rvalue >>= 32;
1.2053 -+ break;
1.2054 -+
1.2055 -+ case FFI_TYPE_SINT8:
1.2056 -+ case FFI_TYPE_SINT16:
1.2057 -+ case FFI_TYPE_SINT32:
1.2058 -+ case FFI_TYPE_INT:
1.2059 -+ *(SINT64 *)rvalue >>= 32;
1.2060 -+ break;
1.2061 -+
1.2062 -+ default:
1.2063 -+ break;
1.2064 -+ }
1.2065 -+#endif
1.2066 -+}
1.2067 -
1.2068 - /* This is a generic definition of ffi_raw_call, to be used if the
1.2069 - * native system does not provide a machine-specific implementation.
1.2070 -@@ -227,6 +292,7 @@
1.2071 - void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
1.2072 - ffi_java_raw_to_ptrarray (cif, raw, avalue);
1.2073 - ffi_call (cif, fn, rvalue, avalue);
1.2074 -+ ffi_java_rvalue_to_raw (cif, rvalue);
1.2075 - }
1.2076 -
1.2077 - #if FFI_CLOSURES /* base system provides closures */
1.2078 -@@ -240,6 +306,7 @@
1.2079 -
1.2080 - ffi_java_ptrarray_to_raw (cif, avalue, raw);
1.2081 - (*cl->fun) (cif, rvalue, raw, cl->user_data);
1.2082 -+ ffi_java_raw_to_rvalue (cif, rvalue);
1.2083 - }
1.2084 -
1.2085 - /* Again, here is the generic version of ffi_prep_raw_closure, which
1.2086 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/m68k/ffi.c gcc/libffi/src/m68k/ffi.c
1.2087 ---- gcc-3.2.2.orig/libffi/src/m68k/ffi.c Sun Aug 8 22:27:19 1999
1.2088 -+++ gcc/libffi/src/m68k/ffi.c Fri Jul 19 08:08:30 2002
1.2089 -@@ -16,14 +16,11 @@
1.2090 - ffi_prep_args (void *stack, extended_cif *ecif)
1.2091 - {
1.2092 - unsigned int i;
1.2093 -- int tmp;
1.2094 -- unsigned int avn;
1.2095 - void **p_argv;
1.2096 - char *argp;
1.2097 - ffi_type **p_arg;
1.2098 - void *struct_value_ptr;
1.2099 -
1.2100 -- tmp = 0;
1.2101 - argp = stack;
1.2102 -
1.2103 - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT
1.2104 -@@ -32,11 +29,10 @@
1.2105 - else
1.2106 - struct_value_ptr = NULL;
1.2107 -
1.2108 -- avn = ecif->cif->nargs;
1.2109 - p_argv = ecif->avalue;
1.2110 -
1.2111 - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
1.2112 -- i != 0 && avn != 0;
1.2113 -+ i != 0;
1.2114 - i--, p_arg++)
1.2115 - {
1.2116 - size_t z;
1.2117 -@@ -45,9 +41,6 @@
1.2118 - if (((*p_arg)->alignment - 1) & (unsigned) argp)
1.2119 - argp = (char *) ALIGN (argp, (*p_arg)->alignment);
1.2120 -
1.2121 -- if (avn != 0)
1.2122 -- {
1.2123 -- avn--;
1.2124 - z = (*p_arg)->size;
1.2125 - if (z < sizeof (int))
1.2126 - {
1.2127 -@@ -82,7 +75,6 @@
1.2128 - memcpy (argp, *p_argv, z);
1.2129 - p_argv++;
1.2130 - argp += z;
1.2131 -- }
1.2132 - }
1.2133 -
1.2134 - return struct_value_ptr;
1.2135 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/mips/ffi.c gcc/libffi/src/mips/ffi.c
1.2136 ---- gcc-3.2.2.orig/libffi/src/mips/ffi.c Sat Mar 3 07:21:23 2001
1.2137 -+++ gcc/libffi/src/mips/ffi.c Fri Jul 19 08:08:31 2002
1.2138 -@@ -23,6 +23,7 @@
1.2139 - OTHER DEALINGS IN THE SOFTWARE.
1.2140 - ----------------------------------------------------------------------- */
1.2141 -
1.2142 -+#include <sgidefs.h>
1.2143 - #include <ffi.h>
1.2144 - #include <ffi_common.h>
1.2145 -
1.2146 -@@ -50,7 +51,6 @@
1.2147 - int flags)
1.2148 - {
1.2149 - register int i;
1.2150 -- register int avn;
1.2151 - register void **p_argv;
1.2152 - register char *argp;
1.2153 - register ffi_type **p_arg;
1.2154 -@@ -80,12 +80,9 @@
1.2155 - FIX_ARGP;
1.2156 - }
1.2157 -
1.2158 -- avn = ecif->cif->nargs;
1.2159 - p_argv = ecif->avalue;
1.2160 -
1.2161 -- for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
1.2162 -- i && avn;
1.2163 -- i--, p_arg++)
1.2164 -+ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++)
1.2165 - {
1.2166 - size_t z;
1.2167 -
1.2168 -@@ -101,9 +98,6 @@
1.2169 - #define OFFSET sizeof(int)
1.2170 - #endif
1.2171 -
1.2172 -- if (avn)
1.2173 -- {
1.2174 -- avn--;
1.2175 - z = (*p_arg)->size;
1.2176 - if (z < sizeof(SLOT_TYPE_UNSIGNED))
1.2177 - {
1.2178 -@@ -179,7 +173,6 @@
1.2179 - p_argv++;
1.2180 - argp += z;
1.2181 - FIX_ARGP;
1.2182 -- }
1.2183 - }
1.2184 -
1.2185 - return;
1.2186 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/powerpc/darwin.S gcc/libffi/src/powerpc/darwin.S
1.2187 ---- gcc-3.2.2.orig/libffi/src/powerpc/darwin.S Sat Jan 19 01:22:34 2002
1.2188 -+++ gcc/libffi/src/powerpc/darwin.S Thu Jan 23 03:21:55 2003
1.2189 -@@ -3,8 +3,6 @@
1.2190 -
1.2191 - PowerPC Assembly glue.
1.2192 -
1.2193 -- $Id: darwin.S,v 1.2 2002/01/18 16:22:34 dje Exp $
1.2194 --
1.2195 - Permission is hereby granted, free of charge, to any person obtaining
1.2196 - a copy of this software and associated documentation files (the
1.2197 - ``Software''), to deal in the Software without restriction, including
1.2198 -@@ -39,30 +37,34 @@
1.2199 - .text
1.2200 - .align 2
1.2201 - _ffi_call_DARWIN:
1.2202 -- mr r12,r8 // We only need r12 until the call, so it doesn't have to be saved...
1.2203 -+LFB0:
1.2204 -+ mr r12,r8 /* We only need r12 until the call,
1.2205 -+ so it doesn't have to be saved... */
1.2206 -+LFB1:
1.2207 - /* Save the old stack pointer as AP. */
1.2208 - mr r8,r1
1.2209 --
1.2210 -+LCFI0:
1.2211 - /* Allocate the stack space we need. */
1.2212 - stwux r1,r1,r4
1.2213 -
1.2214 - /* Save registers we use. */
1.2215 - mflr r9
1.2216 -
1.2217 -- stw r28,-16(r8)
1.2218 -+ stw r28,-16(r8)
1.2219 - stw r29,-12(r8)
1.2220 - stw r30, -8(r8)
1.2221 - stw r31, -4(r8)
1.2222 --
1.2223 -- stw r9, 8(r8)
1.2224 -+
1.2225 -+ stw r9, 8(r8)
1.2226 - stw r2, 20(r1)
1.2227 -+LCFI1:
1.2228 -
1.2229 - /* Save arguments over call... */
1.2230 -- mr r31,r5 /* flags, */
1.2231 -- mr r30,r6 /* rvalue, */
1.2232 -- mr r29,r7 /* function address, */
1.2233 -- mr r28,r8 /* our AP. */
1.2234 --
1.2235 -+ mr r31,r5 /* flags, */
1.2236 -+ mr r30,r6 /* rvalue, */
1.2237 -+ mr r29,r7 /* function address, */
1.2238 -+ mr r28,r8 /* our AP. */
1.2239 -+LCFI2:
1.2240 - /* Call ffi_prep_args. */
1.2241 - mr r4,r1
1.2242 - li r9,0
1.2243 -@@ -145,7 +147,8 @@
1.2244 - L(float_return_value):
1.2245 - stfs f1,0(r30)
1.2246 - b L(done_return_value)
1.2247 --//END(_ffi_call_DARWIN)
1.2248 -+LFE1:
1.2249 -+/* END(_ffi_call_DARWIN) */
1.2250 -
1.2251 - /* Provide a null definition of _ffi_call_AIX. */
1.2252 - .text
1.2253 -@@ -155,5 +158,61 @@
1.2254 - .align 2
1.2255 - _ffi_call_AIX:
1.2256 - blr
1.2257 --//END(_ffi_call_AIX)
1.2258 -+/* END(_ffi_call_AIX) */
1.2259 -
1.2260 -+.data
1.2261 -+.section __TEXT,__eh_frame
1.2262 -+Lframe1:
1.2263 -+ .set L$set$0,LECIE1-LSCIE1
1.2264 -+ .long L$set$0 ; Length of Common Information Entry
1.2265 -+LSCIE1:
1.2266 -+ .long 0x0 ; CIE Identifier Tag
1.2267 -+ .byte 0x1 ; CIE Version
1.2268 -+ .ascii "zR\0" ; CIE Augmentation
1.2269 -+ .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
1.2270 -+ .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
1.2271 -+ .byte 0x41 ; CIE RA Column
1.2272 -+ .byte 0x1 ; uleb128 0x1; Augmentation size
1.2273 -+ .byte 0x10 ; FDE Encoding (pcrel)
1.2274 -+ .byte 0xc ; DW_CFA_def_cfa
1.2275 -+ .byte 0x1 ; uleb128 0x1
1.2276 -+ .byte 0x0 ; uleb128 0x0
1.2277 -+ .align 2
1.2278 -+LECIE1:
1.2279 -+LSFDE1:
1.2280 -+ .set L$set$1,LEFDE1-LASFDE1
1.2281 -+ .long L$set$1 ; FDE Length
1.2282 -+LASFDE1:
1.2283 -+ .set L$set$2,LASFDE1-Lframe1
1.2284 -+ .long L$set$2 ; FDE CIE offset
1.2285 -+ .long LFB0-. ; FDE initial location
1.2286 -+ .set L$set$3,LFE1-LFB0
1.2287 -+ .long L$set$3 ; FDE address range
1.2288 -+ .byte 0x0 ; uleb128 0x0; Augmentation size
1.2289 -+ .byte 0x4 ; DW_CFA_advance_loc4
1.2290 -+ .set L$set$4,LCFI0-LFB1
1.2291 -+ .long L$set$4
1.2292 -+ .byte 0xd ; DW_CFA_def_cfa_register
1.2293 -+ .byte 0x08 ; uleb128 0x08
1.2294 -+ .byte 0x4 ; DW_CFA_advance_loc4
1.2295 -+ .set L$set$5,LCFI1-LCFI0
1.2296 -+ .long L$set$5
1.2297 -+ .byte 0x11 ; DW_CFA_offset_extended_sf
1.2298 -+ .byte 0x41 ; uleb128 0x41
1.2299 -+ .byte 0x7e ; sleb128 -2
1.2300 -+ .byte 0x9f ; DW_CFA_offset, column 0x1f
1.2301 -+ .byte 0x1 ; uleb128 0x1
1.2302 -+ .byte 0x9e ; DW_CFA_offset, column 0x1e
1.2303 -+ .byte 0x2 ; uleb128 0x2
1.2304 -+ .byte 0x9d ; DW_CFA_offset, column 0x1d
1.2305 -+ .byte 0x3 ; uleb128 0x3
1.2306 -+ .byte 0x9c ; DW_CFA_offset, column 0x1c
1.2307 -+ .byte 0x4 ; uleb128 0x4
1.2308 -+ .byte 0x4 ; DW_CFA_advance_loc4
1.2309 -+ .set L$set$6,LCFI2-LCFI1
1.2310 -+ .long L$set$6
1.2311 -+ .byte 0xd ; DW_CFA_def_cfa_register
1.2312 -+ .byte 0x1c ; uleb128 0x1c
1.2313 -+ .align 2
1.2314 -+LEFDE1:
1.2315 -+
1.2316 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/prep_cif.c gcc/libffi/src/prep_cif.c
1.2317 ---- gcc-3.2.2.orig/libffi/src/prep_cif.c Sat Mar 3 07:21:22 2001
1.2318 -+++ gcc/libffi/src/prep_cif.c Mon Sep 30 20:59:42 2002
1.2319 -@@ -103,7 +103,8 @@
1.2320 - /* Perform a sanity check on the return type */
1.2321 - FFI_ASSERT(ffi_type_test(cif->rtype));
1.2322 -
1.2323 --#ifndef M68K
1.2324 -+ /* x86-64 and s390 stack space allocation is handled in prep_machdep. */
1.2325 -+#if !defined M68K && !defined __x86_64__ && !defined S390
1.2326 - /* Make space for the return structure pointer */
1.2327 - if (cif->rtype->type == FFI_TYPE_STRUCT
1.2328 - #ifdef SPARC
1.2329 -@@ -122,6 +123,7 @@
1.2330 - if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))
1.2331 - return FFI_BAD_TYPEDEF;
1.2332 -
1.2333 -+#if !defined __x86_64__ && !defined S390
1.2334 - #ifdef SPARC
1.2335 - if (((*ptr)->type == FFI_TYPE_STRUCT
1.2336 - && ((*ptr)->size > 16 || cif->abi != FFI_V9))
1.2337 -@@ -137,6 +139,7 @@
1.2338 -
1.2339 - bytes += STACK_ARG_SIZE((*ptr)->size);
1.2340 - }
1.2341 -+#endif
1.2342 - }
1.2343 -
1.2344 - cif->bytes = bytes;
1.2345 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/s390/ffi.c gcc/libffi/src/s390/ffi.c
1.2346 ---- gcc-3.2.2.orig/libffi/src/s390/ffi.c Thu Jan 1 09:00:00 1970
1.2347 -+++ gcc/libffi/src/s390/ffi.c Thu Feb 6 08:58:57 2003
1.2348 -@@ -0,0 +1,753 @@
1.2349 -+/* -----------------------------------------------------------------------
1.2350 -+ ffi.c - Copyright (c) 2000 Software AG
1.2351 -+
1.2352 -+ S390 Foreign Function Interface
1.2353 -+
1.2354 -+ Permission is hereby granted, free of charge, to any person obtaining
1.2355 -+ a copy of this software and associated documentation files (the
1.2356 -+ ``Software''), to deal in the Software without restriction, including
1.2357 -+ without limitation the rights to use, copy, modify, merge, publish,
1.2358 -+ distribute, sublicense, and/or sell copies of the Software, and to
1.2359 -+ permit persons to whom the Software is furnished to do so, subject to
1.2360 -+ the following conditions:
1.2361 -+
1.2362 -+ The above copyright notice and this permission notice shall be included
1.2363 -+ in all copies or substantial portions of the Software.
1.2364 -+
1.2365 -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1.2366 -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.2367 -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.2368 -+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
1.2369 -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1.2370 -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1.2371 -+ OTHER DEALINGS IN THE SOFTWARE.
1.2372 -+ ----------------------------------------------------------------------- */
1.2373 -+/*====================================================================*/
1.2374 -+/* Includes */
1.2375 -+/* -------- */
1.2376 -+/*====================================================================*/
1.2377 -+
1.2378 -+#include <ffi.h>
1.2379 -+#include <ffi_common.h>
1.2380 -+
1.2381 -+#include <stdlib.h>
1.2382 -+#include <stdio.h>
1.2383 -+
1.2384 -+/*====================== End of Includes =============================*/
1.2385 -+
1.2386 -+/*====================================================================*/
1.2387 -+/* Defines */
1.2388 -+/* ------- */
1.2389 -+/*====================================================================*/
1.2390 -+
1.2391 -+/* Maximum number of GPRs available for argument passing. */
1.2392 -+#define MAX_GPRARGS 5
1.2393 -+
1.2394 -+/* Maximum number of FPRs available for argument passing. */
1.2395 -+#ifdef __s390x__
1.2396 -+#define MAX_FPRARGS 4
1.2397 -+#else
1.2398 -+#define MAX_FPRARGS 2
1.2399 -+#endif
1.2400 -+
1.2401 -+/* Round to multiple of 16. */
1.2402 -+#define ROUND_SIZE(size) (((size) + 15) & ~15)
1.2403 -+
1.2404 -+/* If these values change, sysv.S must be adapted! */
1.2405 -+#define FFI390_RET_VOID 0
1.2406 -+#define FFI390_RET_STRUCT 1
1.2407 -+#define FFI390_RET_FLOAT 2
1.2408 -+#define FFI390_RET_DOUBLE 3
1.2409 -+#define FFI390_RET_INT32 4
1.2410 -+#define FFI390_RET_INT64 5
1.2411 -+
1.2412 -+/*===================== End of Defines ===============================*/
1.2413 -+
1.2414 -+/*====================================================================*/
1.2415 -+/* Prototypes */
1.2416 -+/* ---------- */
1.2417 -+/*====================================================================*/
1.2418 -+
1.2419 -+static void ffi_prep_args (unsigned char *, extended_cif *);
1.2420 -+static int ffi_check_float_struct (ffi_type *);
1.2421 -+void
1.2422 -+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
1.2423 -+__attribute__ ((visibility ("hidden")))
1.2424 -+#endif
1.2425 -+ffi_closure_helper_SYSV (ffi_closure *, unsigned long *,
1.2426 -+ unsigned long long *, unsigned long *);
1.2427 -+
1.2428 -+/*====================== End of Prototypes ===========================*/
1.2429 -+
1.2430 -+/*====================================================================*/
1.2431 -+/* Externals */
1.2432 -+/* --------- */
1.2433 -+/*====================================================================*/
1.2434 -+
1.2435 -+extern void ffi_call_SYSV(unsigned,
1.2436 -+ extended_cif *,
1.2437 -+ void (*)(unsigned char *, extended_cif *),
1.2438 -+ unsigned,
1.2439 -+ void *,
1.2440 -+ void (*fn)());
1.2441 -+
1.2442 -+extern void ffi_closure_SYSV(void);
1.2443 -+
1.2444 -+/*====================== End of Externals ============================*/
1.2445 -+
1.2446 -+/*====================================================================*/
1.2447 -+/* */
1.2448 -+/* Name - ffi_check_struct_type. */
1.2449 -+/* */
1.2450 -+/* Function - Determine if a structure can be passed within a */
1.2451 -+/* general purpose or floating point register. */
1.2452 -+/* */
1.2453 -+/*====================================================================*/
1.2454 -+
1.2455 -+static int
1.2456 -+ffi_check_struct_type (ffi_type *arg)
1.2457 -+{
1.2458 -+ size_t size = arg->size;
1.2459 -+
1.2460 -+ /* If the struct has just one element, look at that element
1.2461 -+ to find out whether to consider the struct as floating point. */
1.2462 -+ while (arg->type == FFI_TYPE_STRUCT
1.2463 -+ && arg->elements[0] && !arg->elements[1])
1.2464 -+ arg = arg->elements[0];
1.2465 -+
1.2466 -+ /* Structs of size 1, 2, 4, and 8 are passed in registers,
1.2467 -+ just like the corresponding int/float types. */
1.2468 -+ switch (size)
1.2469 -+ {
1.2470 -+ case 1:
1.2471 -+ return FFI_TYPE_UINT8;
1.2472 -+
1.2473 -+ case 2:
1.2474 -+ return FFI_TYPE_UINT16;
1.2475 -+
1.2476 -+ case 4:
1.2477 -+ if (arg->type == FFI_TYPE_FLOAT)
1.2478 -+ return FFI_TYPE_FLOAT;
1.2479 -+ else
1.2480 -+ return FFI_TYPE_UINT32;
1.2481 -+
1.2482 -+ case 8:
1.2483 -+ if (arg->type == FFI_TYPE_DOUBLE)
1.2484 -+ return FFI_TYPE_DOUBLE;
1.2485 -+ else
1.2486 -+ return FFI_TYPE_UINT64;
1.2487 -+
1.2488 -+ default:
1.2489 -+ break;
1.2490 -+ }
1.2491 -+
1.2492 -+ /* Other structs are passed via a pointer to the data. */
1.2493 -+ return FFI_TYPE_POINTER;
1.2494 -+}
1.2495 -+
1.2496 -+/*======================== End of Routine ============================*/
1.2497 -+
1.2498 -+/*====================================================================*/
1.2499 -+/* */
1.2500 -+/* Name - ffi_prep_args. */
1.2501 -+/* */
1.2502 -+/* Function - Prepare parameters for call to function. */
1.2503 -+/* */
1.2504 -+/* ffi_prep_args is called by the assembly routine once stack space */
1.2505 -+/* has been allocated for the function's arguments. */
1.2506 -+/* */
1.2507 -+/*====================================================================*/
1.2508 -+
1.2509 -+static void
1.2510 -+ffi_prep_args (unsigned char *stack, extended_cif *ecif)
1.2511 -+{
1.2512 -+ /* The stack space will be filled with those areas:
1.2513 -+
1.2514 -+ FPR argument register save area (highest addresses)
1.2515 -+ GPR argument register save area
1.2516 -+ temporary struct copies
1.2517 -+ overflow argument area (lowest addresses)
1.2518 -+
1.2519 -+ We set up the following pointers:
1.2520 -+
1.2521 -+ p_fpr: bottom of the FPR area (growing upwards)
1.2522 -+ p_gpr: bottom of the GPR area (growing upwards)
1.2523 -+ p_ov: bottom of the overflow area (growing upwards)
1.2524 -+ p_struct: top of the struct copy area (growing downwards)
1.2525 -+
1.2526 -+ All areas are kept aligned to twice the word size. */
1.2527 -+
1.2528 -+ int gpr_off = ecif->cif->bytes;
1.2529 -+ int fpr_off = gpr_off + ROUND_SIZE (MAX_GPRARGS * sizeof (long));
1.2530 -+
1.2531 -+ unsigned long long *p_fpr = (unsigned long long *)(stack + fpr_off);
1.2532 -+ unsigned long *p_gpr = (unsigned long *)(stack + gpr_off);
1.2533 -+ unsigned char *p_struct = (unsigned char *)p_gpr;
1.2534 -+ unsigned long *p_ov = (unsigned long *)stack;
1.2535 -+
1.2536 -+ int n_fpr = 0;
1.2537 -+ int n_gpr = 0;
1.2538 -+ int n_ov = 0;
1.2539 -+
1.2540 -+ ffi_type **ptr;
1.2541 -+ void **p_argv = ecif->avalue;
1.2542 -+ int i;
1.2543 -+
1.2544 -+ /* If we returning a structure then we set the first parameter register
1.2545 -+ to the address of where we are returning this structure. */
1.2546 -+
1.2547 -+ if (ecif->cif->flags == FFI390_RET_STRUCT)
1.2548 -+ p_gpr[n_gpr++] = (unsigned long) ecif->rvalue;
1.2549 -+
1.2550 -+ /* Now for the arguments. */
1.2551 -+
1.2552 -+ for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
1.2553 -+ i > 0;
1.2554 -+ i--, ptr++, p_argv++)
1.2555 -+ {
1.2556 -+ void *arg = *p_argv;
1.2557 -+ int type = (*ptr)->type;
1.2558 -+
1.2559 -+ /* Check how a structure type is passed. */
1.2560 -+ if (type == FFI_TYPE_STRUCT)
1.2561 -+ {
1.2562 -+ type = ffi_check_struct_type (*ptr);
1.2563 -+
1.2564 -+ /* If we pass the struct via pointer, copy the data. */
1.2565 -+ if (type == FFI_TYPE_POINTER)
1.2566 -+ {
1.2567 -+ p_struct -= ROUND_SIZE ((*ptr)->size);
1.2568 -+ memcpy (p_struct, (char *)arg, (*ptr)->size);
1.2569 -+ arg = &p_struct;
1.2570 -+ }
1.2571 -+ }
1.2572 -+
1.2573 -+ /* Pointers are passed like UINTs of the same size. */
1.2574 -+ if (type == FFI_TYPE_POINTER)
1.2575 -+#ifdef __s390x__
1.2576 -+ type = FFI_TYPE_UINT64;
1.2577 -+#else
1.2578 -+ type = FFI_TYPE_UINT32;
1.2579 -+#endif
1.2580 -+
1.2581 -+ /* Now handle all primitive int/float data types. */
1.2582 -+ switch (type)
1.2583 -+ {
1.2584 -+ case FFI_TYPE_DOUBLE:
1.2585 -+ if (n_fpr < MAX_FPRARGS)
1.2586 -+ p_fpr[n_fpr++] = *(unsigned long long *) arg;
1.2587 -+ else
1.2588 -+#ifdef __s390x__
1.2589 -+ p_ov[n_ov++] = *(unsigned long *) arg;
1.2590 -+#else
1.2591 -+ p_ov[n_ov++] = ((unsigned long *) arg)[0],
1.2592 -+ p_ov[n_ov++] = ((unsigned long *) arg)[1];
1.2593 -+#endif
1.2594 -+ break;
1.2595 -+
1.2596 -+ case FFI_TYPE_FLOAT:
1.2597 -+ if (n_fpr < MAX_FPRARGS)
1.2598 -+ p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32;
1.2599 -+ else
1.2600 -+ p_ov[n_ov++] = *(unsigned int *) arg;
1.2601 -+ break;
1.2602 -+
1.2603 -+ case FFI_TYPE_UINT64:
1.2604 -+ case FFI_TYPE_SINT64:
1.2605 -+#ifdef __s390x__
1.2606 -+ if (n_gpr < MAX_GPRARGS)
1.2607 -+ p_gpr[n_gpr++] = *(unsigned long *) arg;
1.2608 -+ else
1.2609 -+ p_ov[n_ov++] = *(unsigned long *) arg;
1.2610 -+#else
1.2611 -+ if (n_gpr == MAX_GPRARGS-1)
1.2612 -+ n_gpr = MAX_GPRARGS;
1.2613 -+ if (n_gpr < MAX_GPRARGS)
1.2614 -+ p_gpr[n_gpr++] = ((unsigned long *) arg)[0],
1.2615 -+ p_gpr[n_gpr++] = ((unsigned long *) arg)[1];
1.2616 -+ else
1.2617 -+ p_ov[n_ov++] = ((unsigned long *) arg)[0],
1.2618 -+ p_ov[n_ov++] = ((unsigned long *) arg)[1];
1.2619 -+#endif
1.2620 -+ break;
1.2621 -+
1.2622 -+ case FFI_TYPE_UINT32:
1.2623 -+ if (n_gpr < MAX_GPRARGS)
1.2624 -+ p_gpr[n_gpr++] = *(unsigned int *) arg;
1.2625 -+ else
1.2626 -+ p_ov[n_ov++] = *(unsigned int *) arg;
1.2627 -+ break;
1.2628 -+
1.2629 -+ case FFI_TYPE_INT:
1.2630 -+ case FFI_TYPE_SINT32:
1.2631 -+ if (n_gpr < MAX_GPRARGS)
1.2632 -+ p_gpr[n_gpr++] = *(signed int *) arg;
1.2633 -+ else
1.2634 -+ p_ov[n_ov++] = *(signed int *) arg;
1.2635 -+ break;
1.2636 -+
1.2637 -+ case FFI_TYPE_UINT16:
1.2638 -+ if (n_gpr < MAX_GPRARGS)
1.2639 -+ p_gpr[n_gpr++] = *(unsigned short *) arg;
1.2640 -+ else
1.2641 -+ p_ov[n_ov++] = *(unsigned short *) arg;
1.2642 -+ break;
1.2643 -+
1.2644 -+ case FFI_TYPE_SINT16:
1.2645 -+ if (n_gpr < MAX_GPRARGS)
1.2646 -+ p_gpr[n_gpr++] = *(signed short *) arg;
1.2647 -+ else
1.2648 -+ p_ov[n_ov++] = *(signed short *) arg;
1.2649 -+ break;
1.2650 -+
1.2651 -+ case FFI_TYPE_UINT8:
1.2652 -+ if (n_gpr < MAX_GPRARGS)
1.2653 -+ p_gpr[n_gpr++] = *(unsigned char *) arg;
1.2654 -+ else
1.2655 -+ p_ov[n_ov++] = *(unsigned char *) arg;
1.2656 -+ break;
1.2657 -+
1.2658 -+ case FFI_TYPE_SINT8:
1.2659 -+ if (n_gpr < MAX_GPRARGS)
1.2660 -+ p_gpr[n_gpr++] = *(signed char *) arg;
1.2661 -+ else
1.2662 -+ p_ov[n_ov++] = *(signed char *) arg;
1.2663 -+ break;
1.2664 -+
1.2665 -+ default:
1.2666 -+ FFI_ASSERT (0);
1.2667 -+ break;
1.2668 -+ }
1.2669 -+ }
1.2670 -+}
1.2671 -+
1.2672 -+/*======================== End of Routine ============================*/
1.2673 -+
1.2674 -+/*====================================================================*/
1.2675 -+/* */
1.2676 -+/* Name - ffi_prep_cif_machdep. */
1.2677 -+/* */
1.2678 -+/* Function - Perform machine dependent CIF processing. */
1.2679 -+/* */
1.2680 -+/*====================================================================*/
1.2681 -+
1.2682 -+ffi_status
1.2683 -+ffi_prep_cif_machdep(ffi_cif *cif)
1.2684 -+{
1.2685 -+ size_t struct_size = 0;
1.2686 -+ int n_gpr = 0;
1.2687 -+ int n_fpr = 0;
1.2688 -+ int n_ov = 0;
1.2689 -+
1.2690 -+ ffi_type **ptr;
1.2691 -+ int i;
1.2692 -+
1.2693 -+ /* Determine return value handling. */
1.2694 -+
1.2695 -+ switch (cif->rtype->type)
1.2696 -+ {
1.2697 -+ /* Void is easy. */
1.2698 -+ case FFI_TYPE_VOID:
1.2699 -+ cif->flags = FFI390_RET_VOID;
1.2700 -+ break;
1.2701 -+
1.2702 -+ /* Structures are returned via a hidden pointer. */
1.2703 -+ case FFI_TYPE_STRUCT:
1.2704 -+ cif->flags = FFI390_RET_STRUCT;
1.2705 -+ n_gpr++; /* We need one GPR to pass the pointer. */
1.2706 -+ break;
1.2707 -+
1.2708 -+ /* Floating point values are returned in fpr 0. */
1.2709 -+ case FFI_TYPE_FLOAT:
1.2710 -+ cif->flags = FFI390_RET_FLOAT;
1.2711 -+ break;
1.2712 -+
1.2713 -+ case FFI_TYPE_DOUBLE:
1.2714 -+ cif->flags = FFI390_RET_DOUBLE;
1.2715 -+ break;
1.2716 -+
1.2717 -+ /* Integer values are returned in gpr 2 (and gpr 3
1.2718 -+ for 64-bit values on 31-bit machines). */
1.2719 -+ case FFI_TYPE_UINT64:
1.2720 -+ case FFI_TYPE_SINT64:
1.2721 -+ cif->flags = FFI390_RET_INT64;
1.2722 -+ break;
1.2723 -+
1.2724 -+ case FFI_TYPE_POINTER:
1.2725 -+ case FFI_TYPE_INT:
1.2726 -+ case FFI_TYPE_UINT32:
1.2727 -+ case FFI_TYPE_SINT32:
1.2728 -+ case FFI_TYPE_UINT16:
1.2729 -+ case FFI_TYPE_SINT16:
1.2730 -+ case FFI_TYPE_UINT8:
1.2731 -+ case FFI_TYPE_SINT8:
1.2732 -+ /* These are to be extended to word size. */
1.2733 -+#ifdef __s390x__
1.2734 -+ cif->flags = FFI390_RET_INT64;
1.2735 -+#else
1.2736 -+ cif->flags = FFI390_RET_INT32;
1.2737 -+#endif
1.2738 -+ break;
1.2739 -+
1.2740 -+ default:
1.2741 -+ FFI_ASSERT (0);
1.2742 -+ break;
1.2743 -+ }
1.2744 -+
1.2745 -+ /* Now for the arguments. */
1.2746 -+
1.2747 -+ for (ptr = cif->arg_types, i = cif->nargs;
1.2748 -+ i > 0;
1.2749 -+ i--, ptr++)
1.2750 -+ {
1.2751 -+ int type = (*ptr)->type;
1.2752 -+
1.2753 -+ /* Check how a structure type is passed. */
1.2754 -+ if (type == FFI_TYPE_STRUCT)
1.2755 -+ {
1.2756 -+ type = ffi_check_struct_type (*ptr);
1.2757 -+
1.2758 -+ /* If we pass the struct via pointer, we must reserve space
1.2759 -+ to copy its data for proper call-by-value semantics. */
1.2760 -+ if (type == FFI_TYPE_POINTER)
1.2761 -+ struct_size += ROUND_SIZE ((*ptr)->size);
1.2762 -+ }
1.2763 -+
1.2764 -+ /* Now handle all primitive int/float data types. */
1.2765 -+ switch (type)
1.2766 -+ {
1.2767 -+ /* The first MAX_FPRARGS floating point arguments
1.2768 -+ go in FPRs, the rest overflow to the stack. */
1.2769 -+
1.2770 -+ case FFI_TYPE_DOUBLE:
1.2771 -+ if (n_fpr < MAX_FPRARGS)
1.2772 -+ n_fpr++;
1.2773 -+ else
1.2774 -+ n_ov += sizeof (double) / sizeof (long);
1.2775 -+ break;
1.2776 -+
1.2777 -+ case FFI_TYPE_FLOAT:
1.2778 -+ if (n_fpr < MAX_FPRARGS)
1.2779 -+ n_fpr++;
1.2780 -+ else
1.2781 -+ n_ov++;
1.2782 -+ break;
1.2783 -+
1.2784 -+ /* On 31-bit machines, 64-bit integers are passed in GPR pairs,
1.2785 -+ if one is still available, or else on the stack. If only one
1.2786 -+ register is free, skip the register (it won't be used for any
1.2787 -+ subsequent argument either). */
1.2788 -+
1.2789 -+#ifndef __s390x__
1.2790 -+ case FFI_TYPE_UINT64:
1.2791 -+ case FFI_TYPE_SINT64:
1.2792 -+ if (n_gpr == MAX_GPRARGS-1)
1.2793 -+ n_gpr = MAX_GPRARGS;
1.2794 -+ if (n_gpr < MAX_GPRARGS)
1.2795 -+ n_gpr += 2;
1.2796 -+ else
1.2797 -+ n_ov += 2;
1.2798 -+ break;
1.2799 -+#endif
1.2800 -+
1.2801 -+ /* Everything else is passed in GPRs (until MAX_GPRARGS
1.2802 -+ have been used) or overflows to the stack. */
1.2803 -+
1.2804 -+ default:
1.2805 -+ if (n_gpr < MAX_GPRARGS)
1.2806 -+ n_gpr++;
1.2807 -+ else
1.2808 -+ n_ov++;
1.2809 -+ break;
1.2810 -+ }
1.2811 -+ }
1.2812 -+
1.2813 -+ /* Total stack space as required for overflow arguments
1.2814 -+ and temporary structure copies. */
1.2815 -+
1.2816 -+ cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size;
1.2817 -+
1.2818 -+ return FFI_OK;
1.2819 -+}
1.2820 -+
1.2821 -+/*======================== End of Routine ============================*/
1.2822 -+
1.2823 -+/*====================================================================*/
1.2824 -+/* */
1.2825 -+/* Name - ffi_call. */
1.2826 -+/* */
1.2827 -+/* Function - Call the FFI routine. */
1.2828 -+/* */
1.2829 -+/*====================================================================*/
1.2830 -+
1.2831 -+void
1.2832 -+ffi_call(ffi_cif *cif,
1.2833 -+ void (*fn)(),
1.2834 -+ void *rvalue,
1.2835 -+ void **avalue)
1.2836 -+{
1.2837 -+ int ret_type = cif->flags;
1.2838 -+ extended_cif ecif;
1.2839 -+
1.2840 -+ ecif.cif = cif;
1.2841 -+ ecif.avalue = avalue;
1.2842 -+ ecif.rvalue = rvalue;
1.2843 -+
1.2844 -+ /* If we don't have a return value, we need to fake one. */
1.2845 -+ if (rvalue == NULL)
1.2846 -+ {
1.2847 -+ if (ret_type == FFI390_RET_STRUCT)
1.2848 -+ ecif.rvalue = alloca (cif->rtype->size);
1.2849 -+ else
1.2850 -+ ret_type = FFI390_RET_VOID;
1.2851 -+ }
1.2852 -+
1.2853 -+ switch (cif->abi)
1.2854 -+ {
1.2855 -+ case FFI_SYSV:
1.2856 -+ ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args,
1.2857 -+ ret_type, ecif.rvalue, fn);
1.2858 -+ break;
1.2859 -+
1.2860 -+ default:
1.2861 -+ FFI_ASSERT (0);
1.2862 -+ break;
1.2863 -+ }
1.2864 -+}
1.2865 -+
1.2866 -+/*======================== End of Routine ============================*/
1.2867 -+
1.2868 -+/*====================================================================*/
1.2869 -+/* */
1.2870 -+/* Name - ffi_closure_helper_SYSV. */
1.2871 -+/* */
1.2872 -+/* Function - Call a FFI closure target function. */
1.2873 -+/* */
1.2874 -+/*====================================================================*/
1.2875 -+
1.2876 -+void
1.2877 -+ffi_closure_helper_SYSV (ffi_closure *closure,
1.2878 -+ unsigned long *p_gpr,
1.2879 -+ unsigned long long *p_fpr,
1.2880 -+ unsigned long *p_ov)
1.2881 -+{
1.2882 -+ unsigned long long ret_buffer;
1.2883 -+
1.2884 -+ void *rvalue = &ret_buffer;
1.2885 -+ void **avalue;
1.2886 -+ void **p_arg;
1.2887 -+
1.2888 -+ int n_gpr = 0;
1.2889 -+ int n_fpr = 0;
1.2890 -+ int n_ov = 0;
1.2891 -+
1.2892 -+ ffi_type **ptr;
1.2893 -+ int i;
1.2894 -+
1.2895 -+ /* Allocate buffer for argument list pointers. */
1.2896 -+
1.2897 -+ p_arg = avalue = alloca (closure->cif->nargs * sizeof (void *));
1.2898 -+
1.2899 -+ /* If we returning a structure, pass the structure address
1.2900 -+ directly to the target function. Otherwise, have the target
1.2901 -+ function store the return value to the GPR save area. */
1.2902 -+
1.2903 -+ if (closure->cif->flags == FFI390_RET_STRUCT)
1.2904 -+ rvalue = (void *) p_gpr[n_gpr++];
1.2905 -+
1.2906 -+ /* Now for the arguments. */
1.2907 -+
1.2908 -+ for (ptr = closure->cif->arg_types, i = closure->cif->nargs;
1.2909 -+ i > 0;
1.2910 -+ i--, p_arg++, ptr++)
1.2911 -+ {
1.2912 -+ int deref_struct_pointer = 0;
1.2913 -+ int type = (*ptr)->type;
1.2914 -+
1.2915 -+ /* Check how a structure type is passed. */
1.2916 -+ if (type == FFI_TYPE_STRUCT)
1.2917 -+ {
1.2918 -+ type = ffi_check_struct_type (*ptr);
1.2919 -+
1.2920 -+ /* If we pass the struct via pointer, remember to
1.2921 -+ retrieve the pointer later. */
1.2922 -+ if (type == FFI_TYPE_POINTER)
1.2923 -+ deref_struct_pointer = 1;
1.2924 -+ }
1.2925 -+
1.2926 -+ /* Pointers are passed like UINTs of the same size. */
1.2927 -+ if (type == FFI_TYPE_POINTER)
1.2928 -+#ifdef __s390x__
1.2929 -+ type = FFI_TYPE_UINT64;
1.2930 -+#else
1.2931 -+ type = FFI_TYPE_UINT32;
1.2932 -+#endif
1.2933 -+
1.2934 -+ /* Now handle all primitive int/float data types. */
1.2935 -+ switch (type)
1.2936 -+ {
1.2937 -+ case FFI_TYPE_DOUBLE:
1.2938 -+ if (n_fpr < MAX_FPRARGS)
1.2939 -+ *p_arg = &p_fpr[n_fpr++];
1.2940 -+ else
1.2941 -+ *p_arg = &p_ov[n_ov],
1.2942 -+ n_ov += sizeof (double) / sizeof (long);
1.2943 -+ break;
1.2944 -+
1.2945 -+ case FFI_TYPE_FLOAT:
1.2946 -+ if (n_fpr < MAX_FPRARGS)
1.2947 -+ *p_arg = &p_fpr[n_fpr++];
1.2948 -+ else
1.2949 -+ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4;
1.2950 -+ break;
1.2951 -+
1.2952 -+ case FFI_TYPE_UINT64:
1.2953 -+ case FFI_TYPE_SINT64:
1.2954 -+#ifdef __s390x__
1.2955 -+ if (n_gpr < MAX_GPRARGS)
1.2956 -+ *p_arg = &p_gpr[n_gpr++];
1.2957 -+ else
1.2958 -+ *p_arg = &p_ov[n_ov++];
1.2959 -+#else
1.2960 -+ if (n_gpr == MAX_GPRARGS-1)
1.2961 -+ n_gpr = MAX_GPRARGS;
1.2962 -+ if (n_gpr < MAX_GPRARGS)
1.2963 -+ *p_arg = &p_gpr[n_gpr], n_gpr += 2;
1.2964 -+ else
1.2965 -+ *p_arg = &p_ov[n_ov], n_ov += 2;
1.2966 -+#endif
1.2967 -+ break;
1.2968 -+
1.2969 -+ case FFI_TYPE_INT:
1.2970 -+ case FFI_TYPE_UINT32:
1.2971 -+ case FFI_TYPE_SINT32:
1.2972 -+ if (n_gpr < MAX_GPRARGS)
1.2973 -+ *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 4;
1.2974 -+ else
1.2975 -+ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4;
1.2976 -+ break;
1.2977 -+
1.2978 -+ case FFI_TYPE_UINT16:
1.2979 -+ case FFI_TYPE_SINT16:
1.2980 -+ if (n_gpr < MAX_GPRARGS)
1.2981 -+ *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 2;
1.2982 -+ else
1.2983 -+ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 2;
1.2984 -+ break;
1.2985 -+
1.2986 -+ case FFI_TYPE_UINT8:
1.2987 -+ case FFI_TYPE_SINT8:
1.2988 -+ if (n_gpr < MAX_GPRARGS)
1.2989 -+ *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 1;
1.2990 -+ else
1.2991 -+ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1;
1.2992 -+ break;
1.2993 -+
1.2994 -+ default:
1.2995 -+ FFI_ASSERT (0);
1.2996 -+ break;
1.2997 -+ }
1.2998 -+
1.2999 -+ /* If this is a struct passed via pointer, we need to
1.3000 -+ actually retrieve that pointer. */
1.3001 -+ if (deref_struct_pointer)
1.3002 -+ *p_arg = *(void **)*p_arg;
1.3003 -+ }
1.3004 -+
1.3005 -+
1.3006 -+ /* Call the target function. */
1.3007 -+ (closure->fun) (closure->cif, rvalue, avalue, closure->user_data);
1.3008 -+
1.3009 -+ /* Convert the return value. */
1.3010 -+ switch (closure->cif->rtype->type)
1.3011 -+ {
1.3012 -+ /* Void is easy, and so is struct. */
1.3013 -+ case FFI_TYPE_VOID:
1.3014 -+ case FFI_TYPE_STRUCT:
1.3015 -+ break;
1.3016 -+
1.3017 -+ /* Floating point values are returned in fpr 0. */
1.3018 -+ case FFI_TYPE_FLOAT:
1.3019 -+ p_fpr[0] = (long long) *(unsigned int *) rvalue << 32;
1.3020 -+ break;
1.3021 -+
1.3022 -+ case FFI_TYPE_DOUBLE:
1.3023 -+ p_fpr[0] = *(unsigned long long *) rvalue;
1.3024 -+ break;
1.3025 -+
1.3026 -+ /* Integer values are returned in gpr 2 (and gpr 3
1.3027 -+ for 64-bit values on 31-bit machines). */
1.3028 -+ case FFI_TYPE_UINT64:
1.3029 -+ case FFI_TYPE_SINT64:
1.3030 -+#ifdef __s390x__
1.3031 -+ p_gpr[0] = *(unsigned long *) rvalue;
1.3032 -+#else
1.3033 -+ p_gpr[0] = ((unsigned long *) rvalue)[0],
1.3034 -+ p_gpr[1] = ((unsigned long *) rvalue)[1];
1.3035 -+#endif
1.3036 -+ break;
1.3037 -+
1.3038 -+ case FFI_TYPE_POINTER:
1.3039 -+ case FFI_TYPE_UINT32:
1.3040 -+ case FFI_TYPE_UINT16:
1.3041 -+ case FFI_TYPE_UINT8:
1.3042 -+ p_gpr[0] = *(unsigned long *) rvalue;
1.3043 -+ break;
1.3044 -+
1.3045 -+ case FFI_TYPE_INT:
1.3046 -+ case FFI_TYPE_SINT32:
1.3047 -+ case FFI_TYPE_SINT16:
1.3048 -+ case FFI_TYPE_SINT8:
1.3049 -+ p_gpr[0] = *(signed long *) rvalue;
1.3050 -+ break;
1.3051 -+
1.3052 -+ default:
1.3053 -+ FFI_ASSERT (0);
1.3054 -+ break;
1.3055 -+ }
1.3056 -+}
1.3057 -+
1.3058 -+/*======================== End of Routine ============================*/
1.3059 -+
1.3060 -+/*====================================================================*/
1.3061 -+/* */
1.3062 -+/* Name - ffi_prep_closure. */
1.3063 -+/* */
1.3064 -+/* Function - Prepare a FFI closure. */
1.3065 -+/* */
1.3066 -+/*====================================================================*/
1.3067 -+
1.3068 -+ffi_status
1.3069 -+ffi_prep_closure (ffi_closure *closure,
1.3070 -+ ffi_cif *cif,
1.3071 -+ void (*fun) (ffi_cif *, void *, void **, void *),
1.3072 -+ void *user_data)
1.3073 -+{
1.3074 -+ FFI_ASSERT (cif->abi == FFI_SYSV);
1.3075 -+
1.3076 -+#ifndef __s390x__
1.3077 -+ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */
1.3078 -+ *(short *)&closure->tramp [2] = 0x9801; /* lm %r0,%r1,6(%r1) */
1.3079 -+ *(short *)&closure->tramp [4] = 0x1006;
1.3080 -+ *(short *)&closure->tramp [6] = 0x07f1; /* br %r1 */
1.3081 -+ *(long *)&closure->tramp [8] = (long)closure;
1.3082 -+ *(long *)&closure->tramp[12] = (long)&ffi_closure_SYSV;
1.3083 -+#else
1.3084 -+ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */
1.3085 -+ *(short *)&closure->tramp [2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */
1.3086 -+ *(short *)&closure->tramp [4] = 0x100e;
1.3087 -+ *(short *)&closure->tramp [6] = 0x0004;
1.3088 -+ *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */
1.3089 -+ *(long *)&closure->tramp[16] = (long)closure;
1.3090 -+ *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV;
1.3091 -+#endif
1.3092 -+
1.3093 -+ closure->cif = cif;
1.3094 -+ closure->user_data = user_data;
1.3095 -+ closure->fun = fun;
1.3096 -+
1.3097 -+ return FFI_OK;
1.3098 -+}
1.3099 -+
1.3100 -+/*======================== End of Routine ============================*/
1.3101 -+
1.3102 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/s390/sysv.S gcc/libffi/src/s390/sysv.S
1.3103 ---- gcc-3.2.2.orig/libffi/src/s390/sysv.S Thu Jan 1 09:00:00 1970
1.3104 -+++ gcc/libffi/src/s390/sysv.S Thu Nov 28 01:44:35 2002
1.3105 -@@ -0,0 +1,425 @@
1.3106 -+/* -----------------------------------------------------------------------
1.3107 -+ sysv.S - Copyright (c) 2000 Software AG
1.3108 -+
1.3109 -+ S390 Foreign Function Interface
1.3110 -+
1.3111 -+ Permission is hereby granted, free of charge, to any person obtaining
1.3112 -+ a copy of this software and associated documentation files (the
1.3113 -+ ``Software''), to deal in the Software without restriction, including
1.3114 -+ without limitation the rights to use, copy, modify, merge, publish,
1.3115 -+ distribute, sublicense, and/or sell copies of the Software, and to
1.3116 -+ permit persons to whom the Software is furnished to do so, subject to
1.3117 -+ the following conditions:
1.3118 -+
1.3119 -+ The above copyright notice and this permission notice shall be included
1.3120 -+ in all copies or substantial portions of the Software.
1.3121 -+
1.3122 -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1.3123 -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.3124 -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.3125 -+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1.3126 -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1.3127 -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1.3128 -+ OTHER DEALINGS IN THE SOFTWARE.
1.3129 -+ ----------------------------------------------------------------------- */
1.3130 -+
1.3131 -+#ifndef __s390x__
1.3132 -+
1.3133 -+.text
1.3134 -+
1.3135 -+ # r2: cif->bytes
1.3136 -+ # r3: &ecif
1.3137 -+ # r4: ffi_prep_args
1.3138 -+ # r5: ret_type
1.3139 -+ # r6: ecif.rvalue
1.3140 -+ # ov: fn
1.3141 -+
1.3142 -+ # This assumes we are using gas.
1.3143 -+ .globl ffi_call_SYSV
1.3144 -+ .type ffi_call_SYSV,%function
1.3145 -+ffi_call_SYSV:
1.3146 -+.LFB1:
1.3147 -+ stm %r6,%r15,24(%r15) # Save registers
1.3148 -+.LCFI0:
1.3149 -+ basr %r13,0 # Set up base register
1.3150 -+.Lbase:
1.3151 -+ lr %r11,%r15 # Set up frame pointer
1.3152 -+.LCFI1:
1.3153 -+ sr %r15,%r2
1.3154 -+ ahi %r15,-96-48 # Allocate stack
1.3155 -+ lr %r8,%r6 # Save ecif.rvalue
1.3156 -+ sr %r9,%r9
1.3157 -+ ic %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address
1.3158 -+ l %r7,96(%r11) # Load function address
1.3159 -+ st %r11,0(%r15) # Set up back chain
1.3160 -+ ahi %r11,-48 # Register save area
1.3161 -+.LCFI2:
1.3162 -+
1.3163 -+ la %r2,96(%r15) # Save area
1.3164 -+ # r3 already holds &ecif
1.3165 -+ basr %r14,%r4 # Call ffi_prep_args
1.3166 -+
1.3167 -+ lm %r2,%r6,0(%r11) # Load arguments
1.3168 -+ ld %f0,32(%r11)
1.3169 -+ ld %f2,40(%r11)
1.3170 -+ la %r14,0(%r13,%r9) # Set return address
1.3171 -+ br %r7 # ... and call function
1.3172 -+
1.3173 -+.LretNone: # Return void
1.3174 -+ l %r4,48+56(%r11)
1.3175 -+ lm %r6,%r15,48+24(%r11)
1.3176 -+ br %r4
1.3177 -+
1.3178 -+.LretFloat:
1.3179 -+ l %r4,48+56(%r11)
1.3180 -+ ste %f0,0(%r8) # Return float
1.3181 -+ lm %r6,%r15,48+24(%r11)
1.3182 -+ br %r4
1.3183 -+
1.3184 -+.LretDouble:
1.3185 -+ l %r4,48+56(%r11)
1.3186 -+ std %f0,0(%r8) # Return double
1.3187 -+ lm %r6,%r15,48+24(%r11)
1.3188 -+ br %r4
1.3189 -+
1.3190 -+.LretInt32:
1.3191 -+ l %r4,48+56(%r11)
1.3192 -+ st %r2,0(%r8) # Return int
1.3193 -+ lm %r6,%r15,48+24(%r11)
1.3194 -+ br %r4
1.3195 -+
1.3196 -+.LretInt64:
1.3197 -+ l %r4,48+56(%r11)
1.3198 -+ stm %r2,%r3,0(%r8) # Return long long
1.3199 -+ lm %r6,%r15,48+24(%r11)
1.3200 -+ br %r4
1.3201 -+
1.3202 -+.Ltable:
1.3203 -+ .byte .LretNone-.Lbase # FFI390_RET_VOID
1.3204 -+ .byte .LretNone-.Lbase # FFI390_RET_STRUCT
1.3205 -+ .byte .LretFloat-.Lbase # FFI390_RET_FLOAT
1.3206 -+ .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE
1.3207 -+ .byte .LretInt32-.Lbase # FFI390_RET_INT32
1.3208 -+ .byte .LretInt64-.Lbase # FFI390_RET_INT64
1.3209 -+
1.3210 -+.LFE1:
1.3211 -+.ffi_call_SYSV_end:
1.3212 -+ .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
1.3213 -+
1.3214 -+
1.3215 -+ .globl ffi_closure_SYSV
1.3216 -+ .type ffi_closure_SYSV,%function
1.3217 -+ffi_closure_SYSV:
1.3218 -+.LFB2:
1.3219 -+ stm %r12,%r15,48(%r15) # Save registers
1.3220 -+.LCFI10:
1.3221 -+ basr %r13,0 # Set up base register
1.3222 -+.Lcbase:
1.3223 -+ stm %r2,%r6,8(%r15) # Save arguments
1.3224 -+ std %f0,64(%r15)
1.3225 -+ std %f2,72(%r15)
1.3226 -+ lr %r1,%r15 # Set up stack frame
1.3227 -+ ahi %r15,-96
1.3228 -+.LCFI11:
1.3229 -+ l %r12,.Lchelper-.Lcbase(%r13) # Get helper function
1.3230 -+ lr %r2,%r0 # Closure
1.3231 -+ la %r3,8(%r1) # GPRs
1.3232 -+ la %r4,64(%r1) # FPRs
1.3233 -+ la %r5,96(%r1) # Overflow
1.3234 -+ st %r1,0(%r15) # Set up back chain
1.3235 -+
1.3236 -+ bas %r14,0(%r12,%r13) # Call helper
1.3237 -+
1.3238 -+ l %r4,96+56(%r15)
1.3239 -+ ld %f0,96+64(%r15) # Load return registers
1.3240 -+ lm %r2,%r3,96+8(%r15)
1.3241 -+ lm %r12,%r15,96+48(%r15)
1.3242 -+ br %r4
1.3243 -+
1.3244 -+ .align 4
1.3245 -+.Lchelper:
1.3246 -+ .long ffi_closure_helper_SYSV-.Lcbase
1.3247 -+
1.3248 -+.LFE2:
1.3249 -+
1.3250 -+.ffi_closure_SYSV_end:
1.3251 -+ .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV
1.3252 -+
1.3253 -+
1.3254 -+ .section .eh_frame,"a",@progbits
1.3255 -+.Lframe1:
1.3256 -+ .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
1.3257 -+.LSCIE1:
1.3258 -+ .4byte 0x0 # CIE Identifier Tag
1.3259 -+ .byte 0x1 # CIE Version
1.3260 -+ .ascii "zR\0" # CIE Augmentation
1.3261 -+ .uleb128 0x1 # CIE Code Alignment Factor
1.3262 -+ .sleb128 -4 # CIE Data Alignment Factor
1.3263 -+ .byte 0xe # CIE RA Column
1.3264 -+ .uleb128 0x1 # Augmentation size
1.3265 -+ .byte 0x1b # FDE Encoding (pcrel sdata4)
1.3266 -+ .byte 0xc # DW_CFA_def_cfa
1.3267 -+ .uleb128 0xf
1.3268 -+ .uleb128 0x60
1.3269 -+ .align 4
1.3270 -+.LECIE1:
1.3271 -+.LSFDE1:
1.3272 -+ .4byte .LEFDE1-.LASFDE1 # FDE Length
1.3273 -+.LASFDE1:
1.3274 -+ .4byte .LASFDE1-.Lframe1 # FDE CIE offset
1.3275 -+ .4byte .LFB1-. # FDE initial location
1.3276 -+ .4byte .LFE1-.LFB1 # FDE address range
1.3277 -+ .uleb128 0x0 # Augmentation size
1.3278 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3279 -+ .4byte .LCFI0-.LFB1
1.3280 -+ .byte 0x8f # DW_CFA_offset, column 0xf
1.3281 -+ .uleb128 0x9
1.3282 -+ .byte 0x8e # DW_CFA_offset, column 0xe
1.3283 -+ .uleb128 0xa
1.3284 -+ .byte 0x8d # DW_CFA_offset, column 0xd
1.3285 -+ .uleb128 0xb
1.3286 -+ .byte 0x8c # DW_CFA_offset, column 0xc
1.3287 -+ .uleb128 0xc
1.3288 -+ .byte 0x8b # DW_CFA_offset, column 0xb
1.3289 -+ .uleb128 0xd
1.3290 -+ .byte 0x8a # DW_CFA_offset, column 0xa
1.3291 -+ .uleb128 0xe
1.3292 -+ .byte 0x89 # DW_CFA_offset, column 0x9
1.3293 -+ .uleb128 0xf
1.3294 -+ .byte 0x88 # DW_CFA_offset, column 0x8
1.3295 -+ .uleb128 0x10
1.3296 -+ .byte 0x87 # DW_CFA_offset, column 0x7
1.3297 -+ .uleb128 0x11
1.3298 -+ .byte 0x86 # DW_CFA_offset, column 0x6
1.3299 -+ .uleb128 0x12
1.3300 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3301 -+ .4byte .LCFI1-.LCFI0
1.3302 -+ .byte 0xd # DW_CFA_def_cfa_register
1.3303 -+ .uleb128 0xb
1.3304 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3305 -+ .4byte .LCFI2-.LCFI1
1.3306 -+ .byte 0xe # DW_CFA_def_cfa_offset
1.3307 -+ .uleb128 0x90
1.3308 -+ .align 4
1.3309 -+.LEFDE1:
1.3310 -+.LSFDE2:
1.3311 -+ .4byte .LEFDE2-.LASFDE2 # FDE Length
1.3312 -+.LASFDE2:
1.3313 -+ .4byte .LASFDE2-.Lframe1 # FDE CIE offset
1.3314 -+ .4byte .LFB2-. # FDE initial location
1.3315 -+ .4byte .LFE2-.LFB2 # FDE address range
1.3316 -+ .uleb128 0x0 # Augmentation size
1.3317 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3318 -+ .4byte .LCFI10-.LFB2
1.3319 -+ .byte 0x8f # DW_CFA_offset, column 0xf
1.3320 -+ .uleb128 0x9
1.3321 -+ .byte 0x8e # DW_CFA_offset, column 0xe
1.3322 -+ .uleb128 0xa
1.3323 -+ .byte 0x8d # DW_CFA_offset, column 0xd
1.3324 -+ .uleb128 0xb
1.3325 -+ .byte 0x8c # DW_CFA_offset, column 0xc
1.3326 -+ .uleb128 0xc
1.3327 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3328 -+ .4byte .LCFI11-.LCFI10
1.3329 -+ .byte 0xe # DW_CFA_def_cfa_offset
1.3330 -+ .uleb128 0xc0
1.3331 -+ .align 4
1.3332 -+.LEFDE2:
1.3333 -+
1.3334 -+#else
1.3335 -+
1.3336 -+.text
1.3337 -+
1.3338 -+ # r2: cif->bytes
1.3339 -+ # r3: &ecif
1.3340 -+ # r4: ffi_prep_args
1.3341 -+ # r5: ret_type
1.3342 -+ # r6: ecif.rvalue
1.3343 -+ # ov: fn
1.3344 -+
1.3345 -+ # This assumes we are using gas.
1.3346 -+ .globl ffi_call_SYSV
1.3347 -+ .type ffi_call_SYSV,%function
1.3348 -+ffi_call_SYSV:
1.3349 -+.LFB1:
1.3350 -+ stmg %r6,%r15,48(%r15) # Save registers
1.3351 -+.LCFI0:
1.3352 -+ larl %r13,.Lbase # Set up base register
1.3353 -+ lgr %r11,%r15 # Set up frame pointer
1.3354 -+.LCFI1:
1.3355 -+ sgr %r15,%r2
1.3356 -+ aghi %r15,-160-80 # Allocate stack
1.3357 -+ lgr %r8,%r6 # Save ecif.rvalue
1.3358 -+ llgc %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address
1.3359 -+ lg %r7,160(%r11) # Load function address
1.3360 -+ stg %r11,0(%r15) # Set up back chain
1.3361 -+ aghi %r11,-80 # Register save area
1.3362 -+.LCFI2:
1.3363 -+
1.3364 -+ la %r2,160(%r15) # Save area
1.3365 -+ # r3 already holds &ecif
1.3366 -+ basr %r14,%r4 # Call ffi_prep_args
1.3367 -+
1.3368 -+ lmg %r2,%r6,0(%r11) # Load arguments
1.3369 -+ ld %f0,48(%r11)
1.3370 -+ ld %f2,56(%r11)
1.3371 -+ ld %f4,64(%r11)
1.3372 -+ ld %f6,72(%r11)
1.3373 -+ la %r14,0(%r13,%r9) # Set return address
1.3374 -+ br %r7 # ... and call function
1.3375 -+
1.3376 -+.Lbase:
1.3377 -+.LretNone: # Return void
1.3378 -+ lg %r4,80+112(%r11)
1.3379 -+ lmg %r6,%r15,80+48(%r11)
1.3380 -+ br %r4
1.3381 -+
1.3382 -+.LretFloat:
1.3383 -+ lg %r4,80+112(%r11)
1.3384 -+ ste %f0,0(%r8) # Return float
1.3385 -+ lmg %r6,%r15,80+48(%r11)
1.3386 -+ br %r4
1.3387 -+
1.3388 -+.LretDouble:
1.3389 -+ lg %r4,80+112(%r11)
1.3390 -+ std %f0,0(%r8) # Return double
1.3391 -+ lmg %r6,%r15,80+48(%r11)
1.3392 -+ br %r4
1.3393 -+
1.3394 -+.LretInt32:
1.3395 -+ lg %r4,80+112(%r11)
1.3396 -+ st %r2,0(%r8) # Return int
1.3397 -+ lmg %r6,%r15,80+48(%r11)
1.3398 -+ br %r4
1.3399 -+
1.3400 -+.LretInt64:
1.3401 -+ lg %r4,80+112(%r11)
1.3402 -+ stg %r2,0(%r8) # Return long
1.3403 -+ lmg %r6,%r15,80+48(%r11)
1.3404 -+ br %r4
1.3405 -+
1.3406 -+.Ltable:
1.3407 -+ .byte .LretNone-.Lbase # FFI390_RET_VOID
1.3408 -+ .byte .LretNone-.Lbase # FFI390_RET_STRUCT
1.3409 -+ .byte .LretFloat-.Lbase # FFI390_RET_FLOAT
1.3410 -+ .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE
1.3411 -+ .byte .LretInt32-.Lbase # FFI390_RET_INT32
1.3412 -+ .byte .LretInt64-.Lbase # FFI390_RET_INT64
1.3413 -+
1.3414 -+.LFE1:
1.3415 -+.ffi_call_SYSV_end:
1.3416 -+ .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
1.3417 -+
1.3418 -+
1.3419 -+ .globl ffi_closure_SYSV
1.3420 -+ .type ffi_closure_SYSV,%function
1.3421 -+ffi_closure_SYSV:
1.3422 -+.LFB2:
1.3423 -+ stmg %r14,%r15,112(%r15) # Save registers
1.3424 -+.LCFI10:
1.3425 -+ stmg %r2,%r6,16(%r15) # Save arguments
1.3426 -+ std %f0,128(%r15)
1.3427 -+ std %f2,136(%r15)
1.3428 -+ std %f4,144(%r15)
1.3429 -+ std %f6,152(%r15)
1.3430 -+ lgr %r1,%r15 # Set up stack frame
1.3431 -+ aghi %r15,-160
1.3432 -+.LCFI11:
1.3433 -+ lgr %r2,%r0 # Closure
1.3434 -+ la %r3,16(%r1) # GPRs
1.3435 -+ la %r4,128(%r1) # FPRs
1.3436 -+ la %r5,160(%r1) # Overflow
1.3437 -+ stg %r1,0(%r15) # Set up back chain
1.3438 -+
1.3439 -+ brasl %r14,ffi_closure_helper_SYSV # Call helper
1.3440 -+
1.3441 -+ lg %r14,160+112(%r15)
1.3442 -+ ld %f0,160+128(%r15) # Load return registers
1.3443 -+ lg %r2,160+16(%r15)
1.3444 -+ la %r15,160(%r15)
1.3445 -+ br %r14
1.3446 -+.LFE2:
1.3447 -+
1.3448 -+.ffi_closure_SYSV_end:
1.3449 -+ .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV
1.3450 -+
1.3451 -+
1.3452 -+
1.3453 -+ .section .eh_frame,"a",@progbits
1.3454 -+.Lframe1:
1.3455 -+ .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
1.3456 -+.LSCIE1:
1.3457 -+ .4byte 0x0 # CIE Identifier Tag
1.3458 -+ .byte 0x1 # CIE Version
1.3459 -+ .ascii "zR\0" # CIE Augmentation
1.3460 -+ .uleb128 0x1 # CIE Code Alignment Factor
1.3461 -+ .sleb128 -8 # CIE Data Alignment Factor
1.3462 -+ .byte 0xe # CIE RA Column
1.3463 -+ .uleb128 0x1 # Augmentation size
1.3464 -+ .byte 0x1b # FDE Encoding (pcrel sdata4)
1.3465 -+ .byte 0xc # DW_CFA_def_cfa
1.3466 -+ .uleb128 0xf
1.3467 -+ .uleb128 0xa0
1.3468 -+ .align 8
1.3469 -+.LECIE1:
1.3470 -+.LSFDE1:
1.3471 -+ .4byte .LEFDE1-.LASFDE1 # FDE Length
1.3472 -+.LASFDE1:
1.3473 -+ .4byte .LASFDE1-.Lframe1 # FDE CIE offset
1.3474 -+ .4byte .LFB1-. # FDE initial location
1.3475 -+ .4byte .LFE1-.LFB1 # FDE address range
1.3476 -+ .uleb128 0x0 # Augmentation size
1.3477 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3478 -+ .4byte .LCFI0-.LFB1
1.3479 -+ .byte 0x8f # DW_CFA_offset, column 0xf
1.3480 -+ .uleb128 0x5
1.3481 -+ .byte 0x8e # DW_CFA_offset, column 0xe
1.3482 -+ .uleb128 0x6
1.3483 -+ .byte 0x8d # DW_CFA_offset, column 0xd
1.3484 -+ .uleb128 0x7
1.3485 -+ .byte 0x8c # DW_CFA_offset, column 0xc
1.3486 -+ .uleb128 0x8
1.3487 -+ .byte 0x8b # DW_CFA_offset, column 0xb
1.3488 -+ .uleb128 0x9
1.3489 -+ .byte 0x8a # DW_CFA_offset, column 0xa
1.3490 -+ .uleb128 0xa
1.3491 -+ .byte 0x89 # DW_CFA_offset, column 0x9
1.3492 -+ .uleb128 0xb
1.3493 -+ .byte 0x88 # DW_CFA_offset, column 0x8
1.3494 -+ .uleb128 0xc
1.3495 -+ .byte 0x87 # DW_CFA_offset, column 0x7
1.3496 -+ .uleb128 0xd
1.3497 -+ .byte 0x86 # DW_CFA_offset, column 0x6
1.3498 -+ .uleb128 0xe
1.3499 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3500 -+ .4byte .LCFI1-.LCFI0
1.3501 -+ .byte 0xd # DW_CFA_def_cfa_register
1.3502 -+ .uleb128 0xb
1.3503 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3504 -+ .4byte .LCFI2-.LCFI1
1.3505 -+ .byte 0xe # DW_CFA_def_cfa_offset
1.3506 -+ .uleb128 0xf0
1.3507 -+ .align 8
1.3508 -+.LEFDE1:
1.3509 -+.LSFDE2:
1.3510 -+ .4byte .LEFDE2-.LASFDE2 # FDE Length
1.3511 -+.LASFDE2:
1.3512 -+ .4byte .LASFDE2-.Lframe1 # FDE CIE offset
1.3513 -+ .4byte .LFB2-. # FDE initial location
1.3514 -+ .4byte .LFE2-.LFB2 # FDE address range
1.3515 -+ .uleb128 0x0 # Augmentation size
1.3516 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3517 -+ .4byte .LCFI10-.LFB2
1.3518 -+ .byte 0x8f # DW_CFA_offset, column 0xf
1.3519 -+ .uleb128 0x5
1.3520 -+ .byte 0x8e # DW_CFA_offset, column 0xe
1.3521 -+ .uleb128 0x6
1.3522 -+ .byte 0x4 # DW_CFA_advance_loc4
1.3523 -+ .4byte .LCFI11-.LCFI10
1.3524 -+ .byte 0xe # DW_CFA_def_cfa_offset
1.3525 -+ .uleb128 0x140
1.3526 -+ .align 8
1.3527 -+.LEFDE2:
1.3528 -+
1.3529 -+#endif
1.3530 -+
1.3531 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sh/ffi.c gcc/libffi/src/sh/ffi.c
1.3532 ---- gcc-3.2.2.orig/libffi/src/sh/ffi.c Thu Jan 1 09:00:00 1970
1.3533 -+++ gcc/libffi/src/sh/ffi.c Fri Jul 19 10:08:43 2002
1.3534 -@@ -0,0 +1,722 @@
1.3535 -+/* -----------------------------------------------------------------------
1.3536 -+ ffi.c - Copyright (c) 2002 Kaz Kojima
1.3537 -+
1.3538 -+ SuperH Foreign Function Interface
1.3539 -+
1.3540 -+ Permission is hereby granted, free of charge, to any person obtaining
1.3541 -+ a copy of this software and associated documentation files (the
1.3542 -+ ``Software''), to deal in the Software without restriction, including
1.3543 -+ without limitation the rights to use, copy, modify, merge, publish,
1.3544 -+ distribute, sublicense, and/or sell copies of the Software, and to
1.3545 -+ permit persons to whom the Software is furnished to do so, subject to
1.3546 -+ the following conditions:
1.3547 -+
1.3548 -+ The above copyright notice and this permission notice shall be included
1.3549 -+ in all copies or substantial portions of the Software.
1.3550 -+
1.3551 -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1.3552 -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.3553 -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.3554 -+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1.3555 -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1.3556 -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1.3557 -+ OTHER DEALINGS IN THE SOFTWARE.
1.3558 -+ ----------------------------------------------------------------------- */
1.3559 -+
1.3560 -+#include <ffi.h>
1.3561 -+#include <ffi_common.h>
1.3562 -+
1.3563 -+#include <stdlib.h>
1.3564 -+
1.3565 -+#define NGREGARG 4
1.3566 -+#if defined(__SH4__)
1.3567 -+#define NFREGARG 8
1.3568 -+#endif
1.3569 -+
1.3570 -+#if defined(__HITACHI__)
1.3571 -+#define STRUCT_VALUE_ADDRESS_WITH_ARG 1
1.3572 -+#else
1.3573 -+#define STRUCT_VALUE_ADDRESS_WITH_ARG 0
1.3574 -+#endif
1.3575 -+
1.3576 -+/* If the structure has essentialy an unique element, return its type. */
1.3577 -+static int
1.3578 -+simple_type (ffi_type *arg)
1.3579 -+{
1.3580 -+ if (arg->type != FFI_TYPE_STRUCT)
1.3581 -+ return arg->type;
1.3582 -+ else if (arg->elements[1])
1.3583 -+ return FFI_TYPE_STRUCT;
1.3584 -+
1.3585 -+ return simple_type (arg->elements[0]);
1.3586 -+}
1.3587 -+
1.3588 -+static int
1.3589 -+return_type (ffi_type *arg)
1.3590 -+{
1.3591 -+ unsigned short type;
1.3592 -+
1.3593 -+ if (arg->type != FFI_TYPE_STRUCT)
1.3594 -+ return arg->type;
1.3595 -+
1.3596 -+ type = simple_type (arg->elements[0]);
1.3597 -+ if (! arg->elements[1])
1.3598 -+ {
1.3599 -+ switch (type)
1.3600 -+ {
1.3601 -+ case FFI_TYPE_SINT8:
1.3602 -+ case FFI_TYPE_UINT8:
1.3603 -+ case FFI_TYPE_SINT16:
1.3604 -+ case FFI_TYPE_UINT16:
1.3605 -+ case FFI_TYPE_SINT32:
1.3606 -+ case FFI_TYPE_UINT32:
1.3607 -+ return FFI_TYPE_INT;
1.3608 -+
1.3609 -+ default:
1.3610 -+ return type;
1.3611 -+ }
1.3612 -+ }
1.3613 -+
1.3614 -+ /* gcc uses r0/r1 pair for some kind of structures. */
1.3615 -+ if (arg->size <= 2 * sizeof (int))
1.3616 -+ {
1.3617 -+ int i = 0;
1.3618 -+ ffi_type *e;
1.3619 -+
1.3620 -+ while ((e = arg->elements[i++]))
1.3621 -+ {
1.3622 -+ type = simple_type (e);
1.3623 -+ switch (type)
1.3624 -+ {
1.3625 -+ case FFI_TYPE_SINT32:
1.3626 -+ case FFI_TYPE_UINT32:
1.3627 -+ case FFI_TYPE_INT:
1.3628 -+ case FFI_TYPE_FLOAT:
1.3629 -+ return FFI_TYPE_UINT64;
1.3630 -+
1.3631 -+ default:
1.3632 -+ break;
1.3633 -+ }
1.3634 -+ }
1.3635 -+ }
1.3636 -+
1.3637 -+ return FFI_TYPE_STRUCT;
1.3638 -+}
1.3639 -+
1.3640 -+/* ffi_prep_args is called by the assembly routine once stack space
1.3641 -+ has been allocated for the function's arguments */
1.3642 -+
1.3643 -+/*@-exportheader@*/
1.3644 -+void ffi_prep_args(char *stack, extended_cif *ecif)
1.3645 -+/*@=exportheader@*/
1.3646 -+{
1.3647 -+ register unsigned int i;
1.3648 -+ register int tmp;
1.3649 -+ register unsigned int avn;
1.3650 -+ register void **p_argv;
1.3651 -+ register char *argp;
1.3652 -+ register ffi_type **p_arg;
1.3653 -+ int greg, ireg;
1.3654 -+#if defined(__SH4__)
1.3655 -+ int freg = 0;
1.3656 -+#endif
1.3657 -+
1.3658 -+ tmp = 0;
1.3659 -+ argp = stack;
1.3660 -+
1.3661 -+ if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT)
1.3662 -+ {
1.3663 -+ *(void **) argp = ecif->rvalue;
1.3664 -+ argp += 4;
1.3665 -+ ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0;
1.3666 -+ }
1.3667 -+ else
1.3668 -+ ireg = 0;
1.3669 -+
1.3670 -+ /* Set arguments for registers. */
1.3671 -+ greg = ireg;
1.3672 -+ avn = ecif->cif->nargs;
1.3673 -+ p_argv = ecif->avalue;
1.3674 -+
1.3675 -+ for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++)
1.3676 -+ {
1.3677 -+ size_t z;
1.3678 -+
1.3679 -+ z = (*p_arg)->size;
1.3680 -+ if (z < sizeof(int))
1.3681 -+ {
1.3682 -+ if (greg++ >= NGREGARG)
1.3683 -+ continue;
1.3684 -+
1.3685 -+ z = sizeof(int);
1.3686 -+ switch ((*p_arg)->type)
1.3687 -+ {
1.3688 -+ case FFI_TYPE_SINT8:
1.3689 -+ *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
1.3690 -+ break;
1.3691 -+
1.3692 -+ case FFI_TYPE_UINT8:
1.3693 -+ *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
1.3694 -+ break;
1.3695 -+
1.3696 -+ case FFI_TYPE_SINT16:
1.3697 -+ *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
1.3698 -+ break;
1.3699 -+
1.3700 -+ case FFI_TYPE_UINT16:
1.3701 -+ *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
1.3702 -+ break;
1.3703 -+
1.3704 -+ case FFI_TYPE_STRUCT:
1.3705 -+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
1.3706 -+ break;
1.3707 -+
1.3708 -+ default:
1.3709 -+ FFI_ASSERT(0);
1.3710 -+ }
1.3711 -+ argp += z;
1.3712 -+ }
1.3713 -+ else if (z == sizeof(int))
1.3714 -+ {
1.3715 -+#if defined(__SH4__)
1.3716 -+ if ((*p_arg)->type == FFI_TYPE_FLOAT)
1.3717 -+ {
1.3718 -+ if (freg++ >= NFREGARG)
1.3719 -+ continue;
1.3720 -+ }
1.3721 -+ else
1.3722 -+#endif
1.3723 -+ {
1.3724 -+ if (greg++ >= NGREGARG)
1.3725 -+ continue;
1.3726 -+ }
1.3727 -+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
1.3728 -+ argp += z;
1.3729 -+ }
1.3730 -+#if defined(__SH4__)
1.3731 -+ else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
1.3732 -+ {
1.3733 -+ if (freg + 1 >= NFREGARG)
1.3734 -+ continue;
1.3735 -+ freg = (freg + 1) & ~1;
1.3736 -+ freg += 2;
1.3737 -+ memcpy (argp, *p_argv, z);
1.3738 -+ argp += z;
1.3739 -+ }
1.3740 -+#endif
1.3741 -+ else
1.3742 -+ {
1.3743 -+ int n = (z + sizeof (int) - 1) / sizeof (int);
1.3744 -+#if defined(__SH4__)
1.3745 -+ if (greg + n - 1 >= NGREGARG)
1.3746 -+ continue;
1.3747 -+ greg += n;
1.3748 -+#else
1.3749 -+ if (greg >= NGREGARG)
1.3750 -+ continue;
1.3751 -+ else if (greg + n - 1 >= NGREGARG)
1.3752 -+ greg = NGREGARG;
1.3753 -+ else
1.3754 -+ greg += n;
1.3755 -+#endif
1.3756 -+ memcpy (argp, *p_argv, z);
1.3757 -+ argp += z;
1.3758 -+ }
1.3759 -+ }
1.3760 -+
1.3761 -+ /* Set arguments on stack. */
1.3762 -+ greg = ireg;
1.3763 -+#if defined(__SH4__)
1.3764 -+ freg = 0;
1.3765 -+#endif
1.3766 -+ p_argv = ecif->avalue;
1.3767 -+
1.3768 -+ for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++)
1.3769 -+ {
1.3770 -+ size_t z;
1.3771 -+
1.3772 -+ z = (*p_arg)->size;
1.3773 -+ if (z < sizeof(int))
1.3774 -+ {
1.3775 -+ if (greg++ < NGREGARG)
1.3776 -+ continue;
1.3777 -+
1.3778 -+ z = sizeof(int);
1.3779 -+ switch ((*p_arg)->type)
1.3780 -+ {
1.3781 -+ case FFI_TYPE_SINT8:
1.3782 -+ *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
1.3783 -+ break;
1.3784 -+
1.3785 -+ case FFI_TYPE_UINT8:
1.3786 -+ *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
1.3787 -+ break;
1.3788 -+
1.3789 -+ case FFI_TYPE_SINT16:
1.3790 -+ *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
1.3791 -+ break;
1.3792 -+
1.3793 -+ case FFI_TYPE_UINT16:
1.3794 -+ *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
1.3795 -+ break;
1.3796 -+
1.3797 -+ case FFI_TYPE_STRUCT:
1.3798 -+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
1.3799 -+ break;
1.3800 -+
1.3801 -+ default:
1.3802 -+ FFI_ASSERT(0);
1.3803 -+ }
1.3804 -+ argp += z;
1.3805 -+ }
1.3806 -+ else if (z == sizeof(int))
1.3807 -+ {
1.3808 -+#if defined(__SH4__)
1.3809 -+ if ((*p_arg)->type == FFI_TYPE_FLOAT)
1.3810 -+ {
1.3811 -+ if (freg++ < NFREGARG)
1.3812 -+ continue;
1.3813 -+ }
1.3814 -+ else
1.3815 -+#endif
1.3816 -+ {
1.3817 -+ if (greg++ < NGREGARG)
1.3818 -+ continue;
1.3819 -+ }
1.3820 -+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
1.3821 -+ argp += z;
1.3822 -+ }
1.3823 -+#if defined(__SH4__)
1.3824 -+ else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
1.3825 -+ {
1.3826 -+ if (freg + 1 < NFREGARG)
1.3827 -+ {
1.3828 -+ freg = (freg + 1) & ~1;
1.3829 -+ freg += 2;
1.3830 -+ continue;
1.3831 -+ }
1.3832 -+ memcpy (argp, *p_argv, z);
1.3833 -+ argp += z;
1.3834 -+ }
1.3835 -+#endif
1.3836 -+ else
1.3837 -+ {
1.3838 -+ int n = (z + sizeof (int) - 1) / sizeof (int);
1.3839 -+ if (greg + n - 1 < NGREGARG)
1.3840 -+ {
1.3841 -+ greg += n;
1.3842 -+ continue;
1.3843 -+ }
1.3844 -+#if (! defined(__SH4__))
1.3845 -+ else if (greg < NGREGARG)
1.3846 -+ {
1.3847 -+ greg = NGREGARG;
1.3848 -+ continue;
1.3849 -+ }
1.3850 -+#endif
1.3851 -+ memcpy (argp, *p_argv, z);
1.3852 -+ argp += z;
1.3853 -+ }
1.3854 -+ }
1.3855 -+
1.3856 -+ return;
1.3857 -+}
1.3858 -+
1.3859 -+/* Perform machine dependent cif processing */
1.3860 -+ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
1.3861 -+{
1.3862 -+ int i, j;
1.3863 -+ int size, type;
1.3864 -+ int n, m;
1.3865 -+ int greg;
1.3866 -+#if defined(__SH4__)
1.3867 -+ int freg = 0;
1.3868 -+#endif
1.3869 -+
1.3870 -+ cif->flags = 0;
1.3871 -+
1.3872 -+ greg = ((return_type (cif->rtype) == FFI_TYPE_STRUCT) &&
1.3873 -+ STRUCT_VALUE_ADDRESS_WITH_ARG) ? 1 : 0;
1.3874 -+
1.3875 -+#if defined(__SH4__)
1.3876 -+ for (i = j = 0; i < cif->nargs && j < 12; i++)
1.3877 -+ {
1.3878 -+ type = (cif->arg_types)[i]->type;
1.3879 -+ switch (type)
1.3880 -+ {
1.3881 -+ case FFI_TYPE_FLOAT:
1.3882 -+ if (freg >= NFREGARG)
1.3883 -+ continue;
1.3884 -+ freg++;
1.3885 -+ cif->flags += ((cif->arg_types)[i]->type) << (2 * j);
1.3886 -+ j++;
1.3887 -+ break;
1.3888 -+
1.3889 -+ case FFI_TYPE_DOUBLE:
1.3890 -+ if ((freg + 1) >= NFREGARG)
1.3891 -+ continue;
1.3892 -+ freg = (freg + 1) & ~1;
1.3893 -+ freg += 2;
1.3894 -+ cif->flags += ((cif->arg_types)[i]->type) << (2 * j);
1.3895 -+ j++;
1.3896 -+ break;
1.3897 -+
1.3898 -+ default:
1.3899 -+ size = (cif->arg_types)[i]->size;
1.3900 -+ n = (size + sizeof (int) - 1) / sizeof (int);
1.3901 -+ if (greg + n - 1 >= NGREGARG)
1.3902 -+ continue;
1.3903 -+ greg += n;
1.3904 -+ for (m = 0; m < n; m++)
1.3905 -+ cif->flags += FFI_TYPE_INT << (2 * j++);
1.3906 -+ break;
1.3907 -+ }
1.3908 -+ }
1.3909 -+#else
1.3910 -+ for (i = j = 0; i < cif->nargs && j < 4; i++)
1.3911 -+ {
1.3912 -+ size = (cif->arg_types)[i]->size;
1.3913 -+ n = (size + sizeof (int) - 1) / sizeof (int);
1.3914 -+ if (greg >= NGREGARG)
1.3915 -+ continue;
1.3916 -+ else if (greg + n - 1 >= NGREGARG)
1.3917 -+ greg = NGREGARG;
1.3918 -+ else
1.3919 -+ greg += n;
1.3920 -+ for (m = 0; m < n; m++)
1.3921 -+ cif->flags += FFI_TYPE_INT << (2 * j++);
1.3922 -+ }
1.3923 -+#endif
1.3924 -+
1.3925 -+ /* Set the return type flag */
1.3926 -+ switch (cif->rtype->type)
1.3927 -+ {
1.3928 -+ case FFI_TYPE_STRUCT:
1.3929 -+ cif->flags += (unsigned) (return_type (cif->rtype)) << 24;
1.3930 -+ break;
1.3931 -+
1.3932 -+ case FFI_TYPE_VOID:
1.3933 -+ case FFI_TYPE_FLOAT:
1.3934 -+ case FFI_TYPE_DOUBLE:
1.3935 -+ case FFI_TYPE_SINT64:
1.3936 -+ case FFI_TYPE_UINT64:
1.3937 -+ cif->flags += (unsigned) cif->rtype->type << 24;
1.3938 -+ break;
1.3939 -+
1.3940 -+ default:
1.3941 -+ cif->flags += FFI_TYPE_INT << 24;
1.3942 -+ break;
1.3943 -+ }
1.3944 -+
1.3945 -+ return FFI_OK;
1.3946 -+}
1.3947 -+
1.3948 -+/*@-declundef@*/
1.3949 -+/*@-exportheader@*/
1.3950 -+extern void ffi_call_SYSV(void (*)(char *, extended_cif *),
1.3951 -+ /*@out@*/ extended_cif *,
1.3952 -+ unsigned, unsigned,
1.3953 -+ /*@out@*/ unsigned *,
1.3954 -+ void (*fn)());
1.3955 -+/*@=declundef@*/
1.3956 -+/*@=exportheader@*/
1.3957 -+
1.3958 -+void ffi_call(/*@dependent@*/ ffi_cif *cif,
1.3959 -+ void (*fn)(),
1.3960 -+ /*@out@*/ void *rvalue,
1.3961 -+ /*@dependent@*/ void **avalue)
1.3962 -+{
1.3963 -+ extended_cif ecif;
1.3964 -+
1.3965 -+ ecif.cif = cif;
1.3966 -+ ecif.avalue = avalue;
1.3967 -+
1.3968 -+ /* If the return value is a struct and we don't have a return */
1.3969 -+ /* value address then we need to make one */
1.3970 -+
1.3971 -+ if ((rvalue == NULL) &&
1.3972 -+ (cif->rtype->type == FFI_TYPE_STRUCT))
1.3973 -+ {
1.3974 -+ /*@-sysunrecog@*/
1.3975 -+ ecif.rvalue = alloca(cif->rtype->size);
1.3976 -+ /*@=sysunrecog@*/
1.3977 -+ }
1.3978 -+ else
1.3979 -+ ecif.rvalue = rvalue;
1.3980 -+
1.3981 -+
1.3982 -+ switch (cif->abi)
1.3983 -+ {
1.3984 -+ case FFI_SYSV:
1.3985 -+ /*@-usedef@*/
1.3986 -+ ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes,
1.3987 -+ cif->flags, ecif.rvalue, fn);
1.3988 -+ /*@=usedef@*/
1.3989 -+ break;
1.3990 -+ default:
1.3991 -+ FFI_ASSERT(0);
1.3992 -+ break;
1.3993 -+ }
1.3994 -+}
1.3995 -+
1.3996 -+extern void ffi_closure_SYSV (void);
1.3997 -+#if defined(__SH4__)
1.3998 -+extern void __ic_invalidate (void *line);
1.3999 -+#endif
1.4000 -+
1.4001 -+ffi_status
1.4002 -+ffi_prep_closure (ffi_closure* closure,
1.4003 -+ ffi_cif* cif,
1.4004 -+ void (*fun)(ffi_cif*, void*, void**, void*),
1.4005 -+ void *user_data)
1.4006 -+{
1.4007 -+ unsigned int *tramp;
1.4008 -+
1.4009 -+ FFI_ASSERT (cif->abi == FFI_GCC_SYSV);
1.4010 -+
1.4011 -+ tramp = (unsigned int *) &closure->tramp[0];
1.4012 -+#ifdef __LITTLE_ENDIAN__
1.4013 -+ tramp[0] = 0xd301d202;
1.4014 -+ tramp[1] = 0x0009422b;
1.4015 -+#else
1.4016 -+ tramp[0] = 0xd202d301;
1.4017 -+ tramp[1] = 0x422b0009;
1.4018 -+#endif
1.4019 -+ *(void **) &tramp[2] = (void *)closure; /* ctx */
1.4020 -+ *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */
1.4021 -+
1.4022 -+ closure->cif = cif;
1.4023 -+ closure->fun = fun;
1.4024 -+ closure->user_data = user_data;
1.4025 -+
1.4026 -+#if defined(__SH4__)
1.4027 -+ /* Flush the icache. */
1.4028 -+ __ic_invalidate(&closure->tramp[0]);
1.4029 -+#endif
1.4030 -+
1.4031 -+ return FFI_OK;
1.4032 -+}
1.4033 -+
1.4034 -+/* Basically the trampoline invokes ffi_closure_SYSV, and on
1.4035 -+ * entry, r3 holds the address of the closure.
1.4036 -+ * After storing the registers that could possibly contain
1.4037 -+ * parameters to be passed into the stack frame and setting
1.4038 -+ * up space for a return value, ffi_closure_SYSV invokes the
1.4039 -+ * following helper function to do most of the work.
1.4040 -+ */
1.4041 -+
1.4042 -+#ifdef __LITTLE_ENDIAN__
1.4043 -+#define OFS_INT8 0
1.4044 -+#define OFS_INT16 2
1.4045 -+#else
1.4046 -+#define OFS_INT8 3
1.4047 -+#define OFS_INT16 2
1.4048 -+#endif
1.4049 -+
1.4050 -+int
1.4051 -+ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
1.4052 -+ unsigned long *pgr, unsigned long *pfr,
1.4053 -+ unsigned long *pst)
1.4054 -+{
1.4055 -+ void **avalue;
1.4056 -+ ffi_type **p_arg;
1.4057 -+ int i, avn;
1.4058 -+ int ireg, greg = 0;
1.4059 -+#if defined(__SH4__)
1.4060 -+ int freg = 0;
1.4061 -+#endif
1.4062 -+ ffi_cif *cif;
1.4063 -+ double temp;
1.4064 -+
1.4065 -+ cif = closure->cif;
1.4066 -+ avalue = alloca(cif->nargs * sizeof(void *));
1.4067 -+
1.4068 -+ /* Copy the caller's structure return value address so that the closure
1.4069 -+ returns the data directly to the caller. */
1.4070 -+ if (cif->rtype->type == FFI_TYPE_STRUCT)
1.4071 -+ {
1.4072 -+ rvalue = *pgr++;
1.4073 -+ ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0;
1.4074 -+ }
1.4075 -+ else
1.4076 -+ ireg = 0;
1.4077 -+
1.4078 -+ cif = closure->cif;
1.4079 -+ greg = ireg;
1.4080 -+ avn = cif->nargs;
1.4081 -+
1.4082 -+ /* Grab the addresses of the arguments from the stack frame. */
1.4083 -+ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
1.4084 -+ {
1.4085 -+ size_t z;
1.4086 -+
1.4087 -+ z = (*p_arg)->size;
1.4088 -+ if (z < sizeof(int))
1.4089 -+ {
1.4090 -+ if (greg++ >= NGREGARG)
1.4091 -+ continue;
1.4092 -+
1.4093 -+ z = sizeof(int);
1.4094 -+ switch ((*p_arg)->type)
1.4095 -+ {
1.4096 -+ case FFI_TYPE_SINT8:
1.4097 -+ case FFI_TYPE_UINT8:
1.4098 -+ avalue[i] = (((char *)pgr) + OFS_INT8);
1.4099 -+ break;
1.4100 -+
1.4101 -+ case FFI_TYPE_SINT16:
1.4102 -+ case FFI_TYPE_UINT16:
1.4103 -+ avalue[i] = (((char *)pgr) + OFS_INT16);
1.4104 -+ break;
1.4105 -+
1.4106 -+ case FFI_TYPE_STRUCT:
1.4107 -+ avalue[i] = pgr;
1.4108 -+ break;
1.4109 -+
1.4110 -+ default:
1.4111 -+ FFI_ASSERT(0);
1.4112 -+ }
1.4113 -+ pgr++;
1.4114 -+ }
1.4115 -+ else if (z == sizeof(int))
1.4116 -+ {
1.4117 -+#if defined(__SH4__)
1.4118 -+ if ((*p_arg)->type == FFI_TYPE_FLOAT)
1.4119 -+ {
1.4120 -+ if (freg++ >= NFREGARG)
1.4121 -+ continue;
1.4122 -+ avalue[i] = pfr;
1.4123 -+ pfr++;
1.4124 -+ }
1.4125 -+ else
1.4126 -+#endif
1.4127 -+ {
1.4128 -+ if (greg++ >= NGREGARG)
1.4129 -+ continue;
1.4130 -+ avalue[i] = pgr;
1.4131 -+ pgr++;
1.4132 -+ }
1.4133 -+ }
1.4134 -+#if defined(__SH4__)
1.4135 -+ else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
1.4136 -+ {
1.4137 -+ if (freg + 1 >= NFREGARG)
1.4138 -+ continue;
1.4139 -+ freg = (freg + 1) & ~1;
1.4140 -+ freg += 2;
1.4141 -+ avalue[i] = pfr;
1.4142 -+ pfr += 2;
1.4143 -+ }
1.4144 -+#endif
1.4145 -+ else
1.4146 -+ {
1.4147 -+ int n = (z + sizeof (int) - 1) / sizeof (int);
1.4148 -+#if defined(__SH4__)
1.4149 -+ if (greg + n - 1 >= NGREGARG)
1.4150 -+ continue;
1.4151 -+ greg += n;
1.4152 -+#else
1.4153 -+ if (greg >= NGREGARG)
1.4154 -+ continue;
1.4155 -+ else if (greg + n - 1 >= NGREGARG)
1.4156 -+ greg = NGREGARG;
1.4157 -+ else
1.4158 -+ greg += n;
1.4159 -+#endif
1.4160 -+ avalue[i] = pgr;
1.4161 -+ pgr += n;
1.4162 -+ }
1.4163 -+ }
1.4164 -+
1.4165 -+ greg = ireg;
1.4166 -+#if defined(__SH4__)
1.4167 -+ freg = 0;
1.4168 -+#endif
1.4169 -+
1.4170 -+ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
1.4171 -+ {
1.4172 -+ size_t z;
1.4173 -+
1.4174 -+ z = (*p_arg)->size;
1.4175 -+ if (z < sizeof(int))
1.4176 -+ {
1.4177 -+ if (greg++ < NGREGARG)
1.4178 -+ continue;
1.4179 -+
1.4180 -+ z = sizeof(int);
1.4181 -+ switch ((*p_arg)->type)
1.4182 -+ {
1.4183 -+ case FFI_TYPE_SINT8:
1.4184 -+ case FFI_TYPE_UINT8:
1.4185 -+ avalue[i] = (((char *)pst) + OFS_INT8);
1.4186 -+ break;
1.4187 -+
1.4188 -+ case FFI_TYPE_SINT16:
1.4189 -+ case FFI_TYPE_UINT16:
1.4190 -+ avalue[i] = (((char *)pst) + OFS_INT16);
1.4191 -+ break;
1.4192 -+
1.4193 -+ case FFI_TYPE_STRUCT:
1.4194 -+ avalue[i] = pst;
1.4195 -+ break;
1.4196 -+
1.4197 -+ default:
1.4198 -+ FFI_ASSERT(0);
1.4199 -+ }
1.4200 -+ pst++;
1.4201 -+ }
1.4202 -+ else if (z == sizeof(int))
1.4203 -+ {
1.4204 -+#if defined(__SH4__)
1.4205 -+ if ((*p_arg)->type == FFI_TYPE_FLOAT)
1.4206 -+ {
1.4207 -+ if (freg++ < NFREGARG)
1.4208 -+ continue;
1.4209 -+ }
1.4210 -+ else
1.4211 -+#endif
1.4212 -+ {
1.4213 -+ if (greg++ < NGREGARG)
1.4214 -+ continue;
1.4215 -+ }
1.4216 -+ avalue[i] = pst;
1.4217 -+ pst++;
1.4218 -+ }
1.4219 -+#if defined(__SH4__)
1.4220 -+ else if ((*p_arg)->type == FFI_TYPE_DOUBLE)
1.4221 -+ {
1.4222 -+ if (freg + 1 < NFREGARG)
1.4223 -+ {
1.4224 -+ freg = (freg + 1) & ~1;
1.4225 -+ freg += 2;
1.4226 -+ continue;
1.4227 -+ }
1.4228 -+ avalue[i] = pst;
1.4229 -+ pst += 2;
1.4230 -+ }
1.4231 -+#endif
1.4232 -+ else
1.4233 -+ {
1.4234 -+ int n = (z + sizeof (int) - 1) / sizeof (int);
1.4235 -+ if (greg + n - 1 < NGREGARG)
1.4236 -+ {
1.4237 -+ greg += n;
1.4238 -+ continue;
1.4239 -+ }
1.4240 -+#if (! defined(__SH4__))
1.4241 -+ else if (greg < NGREGARG)
1.4242 -+ {
1.4243 -+ greg = NGREGARG;
1.4244 -+ continue;
1.4245 -+ }
1.4246 -+#endif
1.4247 -+ avalue[i] = pst;
1.4248 -+ pst += n;
1.4249 -+ }
1.4250 -+ }
1.4251 -+
1.4252 -+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
1.4253 -+
1.4254 -+ /* Tell ffi_closure_osf how to perform return type promotions. */
1.4255 -+ return cif->rtype->type;
1.4256 -+}
1.4257 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sh/sysv.S gcc/libffi/src/sh/sysv.S
1.4258 ---- gcc-3.2.2.orig/libffi/src/sh/sysv.S Thu Jan 1 09:00:00 1970
1.4259 -+++ gcc/libffi/src/sh/sysv.S Tue Dec 17 03:22:48 2002
1.4260 -@@ -0,0 +1,773 @@
1.4261 -+/* -----------------------------------------------------------------------
1.4262 -+ sysv.S - Copyright (c) 2002 Kaz Kojima
1.4263 -+
1.4264 -+ SuperH Foreign Function Interface
1.4265 -+
1.4266 -+ Permission is hereby granted, free of charge, to any person obtaining
1.4267 -+ a copy of this software and associated documentation files (the
1.4268 -+ ``Software''), to deal in the Software without restriction, including
1.4269 -+ without limitation the rights to use, copy, modify, merge, publish,
1.4270 -+ distribute, sublicense, and/or sell copies of the Software, and to
1.4271 -+ permit persons to whom the Software is furnished to do so, subject to
1.4272 -+ the following conditions:
1.4273 -+
1.4274 -+ The above copyright notice and this permission notice shall be included
1.4275 -+ in all copies or substantial portions of the Software.
1.4276 -+
1.4277 -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1.4278 -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.4279 -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.4280 -+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1.4281 -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1.4282 -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1.4283 -+ OTHER DEALINGS IN THE SOFTWARE.
1.4284 -+ ----------------------------------------------------------------------- */
1.4285 -+
1.4286 -+#define LIBFFI_ASM
1.4287 -+#include <ffi.h>
1.4288 -+#ifdef HAVE_MACHINE_ASM_H
1.4289 -+#include <machine/asm.h>
1.4290 -+#else
1.4291 -+/* XXX these lose for some platforms, I'm sure. */
1.4292 -+#define CNAME(x) x
1.4293 -+#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
1.4294 -+#endif
1.4295 -+
1.4296 -+#if defined(__HITACHI__)
1.4297 -+#define STRUCT_VALUE_ADDRESS_WITH_ARG 1
1.4298 -+#else
1.4299 -+#define STRUCT_VALUE_ADDRESS_WITH_ARG 0
1.4300 -+#endif
1.4301 -+
1.4302 -+.text
1.4303 -+
1.4304 -+ # r4: ffi_prep_args
1.4305 -+ # r5: &ecif
1.4306 -+ # r6: bytes
1.4307 -+ # r7: flags
1.4308 -+ # sp+0: rvalue
1.4309 -+ # sp+4: fn
1.4310 -+
1.4311 -+ # This assumes we are using gas.
1.4312 -+ENTRY(ffi_call_SYSV)
1.4313 -+ # Save registers
1.4314 -+.LFB1:
1.4315 -+ mov.l r8,@-r15
1.4316 -+.LCFI0:
1.4317 -+ mov.l r9,@-r15
1.4318 -+.LCFI1:
1.4319 -+ mov.l r10,@-r15
1.4320 -+.LCFI2:
1.4321 -+ mov.l r12,@-r15
1.4322 -+.LCFI3:
1.4323 -+ mov.l r14,@-r15
1.4324 -+.LCFI4:
1.4325 -+ sts.l pr,@-r15
1.4326 -+.LCFI5:
1.4327 -+ mov r15,r14
1.4328 -+.LCFI6:
1.4329 -+#if defined(__SH4__)
1.4330 -+ mov r6,r8
1.4331 -+ mov r7,r9
1.4332 -+
1.4333 -+ sub r6,r15
1.4334 -+ add #-16,r15
1.4335 -+ mov #~7,r0
1.4336 -+ and r0,r15
1.4337 -+
1.4338 -+ mov r4,r0
1.4339 -+ jsr @r0
1.4340 -+ mov r15,r4
1.4341 -+
1.4342 -+ mov r9,r1
1.4343 -+ shlr8 r9
1.4344 -+ shlr8 r9
1.4345 -+ shlr8 r9
1.4346 -+
1.4347 -+ mov #FFI_TYPE_STRUCT,r2
1.4348 -+ cmp/eq r2,r9
1.4349 -+ bf 1f
1.4350 -+#if STRUCT_VALUE_ADDRESS_WITH_ARG
1.4351 -+ mov.l @r15+,r4
1.4352 -+ bra 2f
1.4353 -+ mov #5,r2
1.4354 -+#else
1.4355 -+ mov.l @r15+,r10
1.4356 -+#endif
1.4357 -+1:
1.4358 -+ mov #4,r2
1.4359 -+2:
1.4360 -+ mov #4,r3
1.4361 -+
1.4362 -+L_pass:
1.4363 -+ cmp/pl r8
1.4364 -+ bf L_call_it
1.4365 -+
1.4366 -+ mov r1,r0
1.4367 -+ and #3,r0
1.4368 -+
1.4369 -+L_pass_d:
1.4370 -+ cmp/eq #FFI_TYPE_DOUBLE,r0
1.4371 -+ bf L_pass_f
1.4372 -+
1.4373 -+ mov r3,r0
1.4374 -+ and #1,r0
1.4375 -+ tst r0,r0
1.4376 -+ bt 1f
1.4377 -+ add #1,r3
1.4378 -+1:
1.4379 -+ mov r15,r0
1.4380 -+ and #7,r0
1.4381 -+ tst r0,r0
1.4382 -+ bt 2f
1.4383 -+ add #4,r15
1.4384 -+2:
1.4385 -+ mov #12,r0
1.4386 -+ cmp/hs r0,r3
1.4387 -+ bt/s 3f
1.4388 -+ shlr2 r1
1.4389 -+ bsr L_pop_d
1.4390 -+ nop
1.4391 -+3:
1.4392 -+ add #2,r3
1.4393 -+ bra L_pass
1.4394 -+ add #-8,r8
1.4395 -+
1.4396 -+L_pop_d:
1.4397 -+ mov r3,r0
1.4398 -+ add r0,r0
1.4399 -+ add r3,r0
1.4400 -+ add #-12,r0
1.4401 -+ braf r0
1.4402 -+ nop
1.4403 -+#ifdef __LITTLE_ENDIAN__
1.4404 -+ fmov.s @r15+,fr5
1.4405 -+ rts
1.4406 -+ fmov.s @r15+,fr4
1.4407 -+ fmov.s @r15+,fr7
1.4408 -+ rts
1.4409 -+ fmov.s @r15+,fr6
1.4410 -+ fmov.s @r15+,fr9
1.4411 -+ rts
1.4412 -+ fmov.s @r15+,fr8
1.4413 -+ fmov.s @r15+,fr11
1.4414 -+ rts
1.4415 -+ fmov.s @r15+,fr10
1.4416 -+#else
1.4417 -+ fmov.s @r15+,fr4
1.4418 -+ rts
1.4419 -+ fmov.s @r15+,fr5
1.4420 -+ fmov.s @r15+,fr6
1.4421 -+ rts
1.4422 -+ fmov.s @r15+,fr7
1.4423 -+ fmov.s @r15+,fr8
1.4424 -+ rts
1.4425 -+ fmov.s @r15+,fr9
1.4426 -+ fmov.s @r15+,fr10
1.4427 -+ rts
1.4428 -+ fmov.s @r15+,fr11
1.4429 -+#endif
1.4430 -+
1.4431 -+L_pass_f:
1.4432 -+ cmp/eq #FFI_TYPE_FLOAT,r0
1.4433 -+ bf L_pass_i
1.4434 -+
1.4435 -+ mov #12,r0
1.4436 -+ cmp/hs r0,r3
1.4437 -+ bt/s 2f
1.4438 -+ shlr2 r1
1.4439 -+ bsr L_pop_f
1.4440 -+ nop
1.4441 -+2:
1.4442 -+ add #1,r3
1.4443 -+ bra L_pass
1.4444 -+ add #-4,r8
1.4445 -+
1.4446 -+L_pop_f:
1.4447 -+ mov r3,r0
1.4448 -+ shll2 r0
1.4449 -+ add #-16,r0
1.4450 -+ braf r0
1.4451 -+ nop
1.4452 -+#ifdef __LITTLE_ENDIAN__
1.4453 -+ rts
1.4454 -+ fmov.s @r15+,fr5
1.4455 -+ rts
1.4456 -+ fmov.s @r15+,fr4
1.4457 -+ rts
1.4458 -+ fmov.s @r15+,fr7
1.4459 -+ rts
1.4460 -+ fmov.s @r15+,fr6
1.4461 -+ rts
1.4462 -+ fmov.s @r15+,fr9
1.4463 -+ rts
1.4464 -+ fmov.s @r15+,fr8
1.4465 -+ rts
1.4466 -+ fmov.s @r15+,fr11
1.4467 -+ rts
1.4468 -+ fmov.s @r15+,fr10
1.4469 -+#else
1.4470 -+ rts
1.4471 -+ fmov.s @r15+,fr4
1.4472 -+ rts
1.4473 -+ fmov.s @r15+,fr5
1.4474 -+ rts
1.4475 -+ fmov.s @r15+,fr6
1.4476 -+ rts
1.4477 -+ fmov.s @r15+,fr7
1.4478 -+ rts
1.4479 -+ fmov.s @r15+,fr8
1.4480 -+ rts
1.4481 -+ fmov.s @r15+,fr9
1.4482 -+ rts
1.4483 -+ fmov.s @r15+,fr10
1.4484 -+ rts
1.4485 -+ fmov.s @r15+,fr11
1.4486 -+#endif
1.4487 -+
1.4488 -+L_pass_i:
1.4489 -+ cmp/eq #FFI_TYPE_INT,r0
1.4490 -+ bf L_call_it
1.4491 -+
1.4492 -+ mov #8,r0
1.4493 -+ cmp/hs r0,r2
1.4494 -+ bt/s 2f
1.4495 -+ shlr2 r1
1.4496 -+ bsr L_pop_i
1.4497 -+ nop
1.4498 -+2:
1.4499 -+ add #1,r2
1.4500 -+ bra L_pass
1.4501 -+ add #-4,r8
1.4502 -+
1.4503 -+L_pop_i:
1.4504 -+ mov r2,r0
1.4505 -+ shll2 r0
1.4506 -+ add #-16,r0
1.4507 -+ braf r0
1.4508 -+ nop
1.4509 -+ rts
1.4510 -+ mov.l @r15+,r4
1.4511 -+ rts
1.4512 -+ mov.l @r15+,r5
1.4513 -+ rts
1.4514 -+ mov.l @r15+,r6
1.4515 -+ rts
1.4516 -+ mov.l @r15+,r7
1.4517 -+
1.4518 -+L_call_it:
1.4519 -+ # call function
1.4520 -+#if (! STRUCT_VALUE_ADDRESS_WITH_ARG)
1.4521 -+ mov r10, r2
1.4522 -+#endif
1.4523 -+ mov.l @(28,r14),r1
1.4524 -+ jsr @r1
1.4525 -+ nop
1.4526 -+
1.4527 -+L_ret_d:
1.4528 -+ mov #FFI_TYPE_DOUBLE,r2
1.4529 -+ cmp/eq r2,r9
1.4530 -+ bf L_ret_ll
1.4531 -+
1.4532 -+ mov.l @(24,r14),r1
1.4533 -+#ifdef __LITTLE_ENDIAN__
1.4534 -+ fmov.s fr1,@r1
1.4535 -+ add #4,r1
1.4536 -+ bra L_epilogue
1.4537 -+ fmov.s fr0,@r1
1.4538 -+#else
1.4539 -+ fmov.s fr0,@r1
1.4540 -+ add #4,r1
1.4541 -+ bra L_epilogue
1.4542 -+ fmov.s fr1,@r1
1.4543 -+#endif
1.4544 -+
1.4545 -+L_ret_ll:
1.4546 -+ mov #FFI_TYPE_SINT64,r2
1.4547 -+ cmp/eq r2,r9
1.4548 -+ bt/s 1f
1.4549 -+ mov #FFI_TYPE_UINT64,r2
1.4550 -+ cmp/eq r2,r9
1.4551 -+ bf L_ret_f
1.4552 -+
1.4553 -+1:
1.4554 -+ mov.l @(24,r14),r2
1.4555 -+ mov.l r0,@r2
1.4556 -+ bra L_epilogue
1.4557 -+ mov.l r1,@(4,r2)
1.4558 -+
1.4559 -+L_ret_f:
1.4560 -+ mov #FFI_TYPE_FLOAT,r2
1.4561 -+ cmp/eq r2,r9
1.4562 -+ bf L_ret_i
1.4563 -+
1.4564 -+ mov.l @(24,r14),r1
1.4565 -+ bra L_epilogue
1.4566 -+ fmov.s fr0,@r1
1.4567 -+
1.4568 -+L_ret_i:
1.4569 -+ mov #FFI_TYPE_INT,r2
1.4570 -+ cmp/eq r2,r9
1.4571 -+ bf L_epilogue
1.4572 -+
1.4573 -+ mov.l @(24,r14),r1
1.4574 -+ bra L_epilogue
1.4575 -+ mov.l r0,@r1
1.4576 -+
1.4577 -+L_epilogue:
1.4578 -+ # Remove the space we pushed for the args
1.4579 -+ mov r14,r15
1.4580 -+
1.4581 -+ lds.l @r15+,pr
1.4582 -+ mov.l @r15+,r14
1.4583 -+ mov.l @r15+,r12
1.4584 -+ mov.l @r15+,r10
1.4585 -+ mov.l @r15+,r9
1.4586 -+ rts
1.4587 -+ mov.l @r15+,r8
1.4588 -+#else
1.4589 -+ mov r6,r8
1.4590 -+ mov r7,r9
1.4591 -+
1.4592 -+ sub r6,r15
1.4593 -+ add #-16,r15
1.4594 -+ mov #~7,r0
1.4595 -+ and r0,r15
1.4596 -+
1.4597 -+ mov r4,r0
1.4598 -+ jsr @r0
1.4599 -+ mov r15,r4
1.4600 -+
1.4601 -+ mov r9,r3
1.4602 -+ shlr8 r9
1.4603 -+ shlr8 r9
1.4604 -+ shlr8 r9
1.4605 -+
1.4606 -+ mov #FFI_TYPE_STRUCT,r2
1.4607 -+ cmp/eq r2,r9
1.4608 -+ bf 1f
1.4609 -+#if STRUCT_VALUE_ADDRESS_WITH_ARG
1.4610 -+ mov.l @r15+,r4
1.4611 -+ bra 2f
1.4612 -+ mov #5,r2
1.4613 -+#else
1.4614 -+ mov.l @r15+,r10
1.4615 -+#endif
1.4616 -+1:
1.4617 -+ mov #4,r2
1.4618 -+2:
1.4619 -+
1.4620 -+L_pass:
1.4621 -+ cmp/pl r8
1.4622 -+ bf L_call_it
1.4623 -+
1.4624 -+ mov r3,r0
1.4625 -+ and #3,r0
1.4626 -+
1.4627 -+L_pass_d:
1.4628 -+ cmp/eq #FFI_TYPE_DOUBLE,r0
1.4629 -+ bf L_pass_i
1.4630 -+
1.4631 -+ mov r15,r0
1.4632 -+ and #7,r0
1.4633 -+ tst r0,r0
1.4634 -+ bt 1f
1.4635 -+ add #4,r15
1.4636 -+1:
1.4637 -+ mov #8,r0
1.4638 -+ cmp/hs r0,r2
1.4639 -+ bt/s 2f
1.4640 -+ shlr2 r3
1.4641 -+ bsr L_pop_d
1.4642 -+ nop
1.4643 -+2:
1.4644 -+ add #2,r2
1.4645 -+ bra L_pass
1.4646 -+ add #-8,r8
1.4647 -+
1.4648 -+L_pop_d:
1.4649 -+ mov r2,r0
1.4650 -+ add r0,r0
1.4651 -+ add r2,r0
1.4652 -+ add #-12,r0
1.4653 -+ add r0,r0
1.4654 -+ braf r0
1.4655 -+ nop
1.4656 -+ mov.l @r15+,r4
1.4657 -+ rts
1.4658 -+ mov.l @r15+,r5
1.4659 -+ mov.l @r15+,r5
1.4660 -+ rts
1.4661 -+ mov.l @r15+,r6
1.4662 -+ mov.l @r15+,r6
1.4663 -+ rts
1.4664 -+ mov.l @r15+,r7
1.4665 -+ rts
1.4666 -+ mov.l @r15+,r7
1.4667 -+
1.4668 -+L_pass_i:
1.4669 -+ mov #8,r0
1.4670 -+ cmp/hs r0,r2
1.4671 -+ bt/s 2f
1.4672 -+ shlr2 r3
1.4673 -+ bsr L_pop_i
1.4674 -+ nop
1.4675 -+2:
1.4676 -+ add #1,r2
1.4677 -+ bra L_pass
1.4678 -+ add #-4,r8
1.4679 -+
1.4680 -+L_pop_i:
1.4681 -+ mov r2,r0
1.4682 -+ shll2 r0
1.4683 -+ add #-16,r0
1.4684 -+ braf r0
1.4685 -+ nop
1.4686 -+ rts
1.4687 -+ mov.l @r15+,r4
1.4688 -+ rts
1.4689 -+ mov.l @r15+,r5
1.4690 -+ rts
1.4691 -+ mov.l @r15+,r6
1.4692 -+ rts
1.4693 -+ mov.l @r15+,r7
1.4694 -+
1.4695 -+L_call_it:
1.4696 -+ # call function
1.4697 -+#if (! STRUCT_VALUE_ADDRESS_WITH_ARG)
1.4698 -+ mov r10, r2
1.4699 -+#endif
1.4700 -+ mov.l @(28,r14),r1
1.4701 -+ jsr @r1
1.4702 -+ nop
1.4703 -+
1.4704 -+L_ret_d:
1.4705 -+ mov #FFI_TYPE_DOUBLE,r2
1.4706 -+ cmp/eq r2,r9
1.4707 -+ bf L_ret_ll
1.4708 -+
1.4709 -+ mov.l @(24,r14),r2
1.4710 -+ mov.l r0,@r2
1.4711 -+ bra L_epilogue
1.4712 -+ mov.l r1,@(4,r2)
1.4713 -+
1.4714 -+L_ret_ll:
1.4715 -+ mov #FFI_TYPE_SINT64,r2
1.4716 -+ cmp/eq r2,r9
1.4717 -+ bt/s 1f
1.4718 -+ mov #FFI_TYPE_UINT64,r2
1.4719 -+ cmp/eq r2,r9
1.4720 -+ bf L_ret_i
1.4721 -+
1.4722 -+1:
1.4723 -+ mov.l @(24,r14),r2
1.4724 -+ mov.l r0,@r2
1.4725 -+ bra L_epilogue
1.4726 -+ mov.l r1,@(4,r2)
1.4727 -+
1.4728 -+L_ret_i:
1.4729 -+ mov #FFI_TYPE_FLOAT,r2
1.4730 -+ cmp/eq r2,r9
1.4731 -+ bt 1f
1.4732 -+ mov #FFI_TYPE_INT,r2
1.4733 -+ cmp/eq r2,r9
1.4734 -+ bf L_epilogue
1.4735 -+1:
1.4736 -+ mov.l @(24,r14),r1
1.4737 -+ bra L_epilogue
1.4738 -+ mov.l r0,@r1
1.4739 -+
1.4740 -+L_epilogue:
1.4741 -+ # Remove the space we pushed for the args
1.4742 -+ mov r14,r15
1.4743 -+
1.4744 -+ lds.l @r15+,pr
1.4745 -+ mov.l @r15+,r14
1.4746 -+ mov.l @r15+,r12
1.4747 -+ mov.l @r15+,r10
1.4748 -+ mov.l @r15+,r9
1.4749 -+ rts
1.4750 -+ mov.l @r15+,r8
1.4751 -+#endif
1.4752 -+.LFE1:
1.4753 -+.ffi_call_SYSV_end:
1.4754 -+ .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
1.4755 -+
1.4756 -+.globl ffi_closure_helper_SYSV
1.4757 -+
1.4758 -+ENTRY(ffi_closure_SYSV)
1.4759 -+.LFB2:
1.4760 -+ mov.l r14,@-r15
1.4761 -+.LCFI7:
1.4762 -+ sts.l pr,@-r15
1.4763 -+
1.4764 -+ /* Stack layout:
1.4765 -+ ...
1.4766 -+ 32 bytes (floating register parameters, SH-4 only)
1.4767 -+ 16 bytes (register parameters)
1.4768 -+ 4 bytes (result)
1.4769 -+ 4 bytes (5th arg)
1.4770 -+ <- new stack pointer
1.4771 -+ */
1.4772 -+.LCFI8:
1.4773 -+#if defined(__SH4__)
1.4774 -+ add #-56,r15
1.4775 -+#else
1.4776 -+ add #-24,r15
1.4777 -+#endif
1.4778 -+.LCFI9:
1.4779 -+ mov r15,r14
1.4780 -+.LCFIA:
1.4781 -+ mov r14,r1
1.4782 -+ add #24,r1
1.4783 -+ mov.l r7,@-r1
1.4784 -+ mov.l r6,@-r1
1.4785 -+ mov.l r5,@-r1
1.4786 -+ mov.l r4,@-r1
1.4787 -+ mov r1,r6
1.4788 -+
1.4789 -+#if defined(__SH4__)
1.4790 -+ mov r14,r1
1.4791 -+ add #56,r1
1.4792 -+#ifdef __LITTLE_ENDIAN__
1.4793 -+ fmov.s fr10,@-r1
1.4794 -+ fmov.s fr11,@-r1
1.4795 -+ fmov.s fr8,@-r1
1.4796 -+ fmov.s fr9,@-r1
1.4797 -+ fmov.s fr6,@-r1
1.4798 -+ fmov.s fr7,@-r1
1.4799 -+ fmov.s fr4,@-r1
1.4800 -+ fmov.s fr5,@-r1
1.4801 -+#else
1.4802 -+ fmov.s fr11,@-r1
1.4803 -+ fmov.s fr10,@-r1
1.4804 -+ fmov.s fr9,@-r1
1.4805 -+ fmov.s fr8,@-r1
1.4806 -+ fmov.s fr7,@-r1
1.4807 -+ fmov.s fr6,@-r1
1.4808 -+ fmov.s fr5,@-r1
1.4809 -+ fmov.s fr4,@-r1
1.4810 -+#endif
1.4811 -+ mov r1,r7
1.4812 -+#endif
1.4813 -+
1.4814 -+ mov r14,r1
1.4815 -+ add #4,r1
1.4816 -+ mov r1,r5
1.4817 -+
1.4818 -+ mov r14,r1
1.4819 -+#if defined(__SH4__)
1.4820 -+ add #64,r1
1.4821 -+#else
1.4822 -+ add #32,r1
1.4823 -+#endif
1.4824 -+ mov.l r1,@r14
1.4825 -+
1.4826 -+ mov.l L_helper,r0
1.4827 -+ jsr @r0
1.4828 -+ mov r3,r4
1.4829 -+
1.4830 -+ shll r0
1.4831 -+ mov r0,r1
1.4832 -+ mova L_table,r0
1.4833 -+ add r1,r0
1.4834 -+ mov.w @r0,r0
1.4835 -+ mov r14,r2
1.4836 -+ braf r0
1.4837 -+ add #4,r2
1.4838 -+0:
1.4839 -+ .align 2
1.4840 -+L_helper:
1.4841 -+ .long ffi_closure_helper_SYSV
1.4842 -+L_table:
1.4843 -+ .short L_case_v - 0b /* FFI_TYPE_VOID */
1.4844 -+ .short L_case_i - 0b /* FFI_TYPE_INT */
1.4845 -+#if defined(__SH4__)
1.4846 -+ .short L_case_f - 0b /* FFI_TYPE_FLOAT */
1.4847 -+ .short L_case_d - 0b /* FFI_TYPE_DOUBLE */
1.4848 -+ .short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */
1.4849 -+#else
1.4850 -+ .short L_case_i - 0b /* FFI_TYPE_FLOAT */
1.4851 -+ .short L_case_ll - 0b /* FFI_TYPE_DOUBLE */
1.4852 -+ .short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */
1.4853 -+#endif
1.4854 -+ .short L_case_uq - 0b /* FFI_TYPE_UINT8 */
1.4855 -+ .short L_case_q - 0b /* FFI_TYPE_SINT8 */
1.4856 -+ .short L_case_uh - 0b /* FFI_TYPE_UINT16 */
1.4857 -+ .short L_case_h - 0b /* FFI_TYPE_SINT16 */
1.4858 -+ .short L_case_i - 0b /* FFI_TYPE_UINT32 */
1.4859 -+ .short L_case_i - 0b /* FFI_TYPE_SINT32 */
1.4860 -+ .short L_case_ll - 0b /* FFI_TYPE_UINT64 */
1.4861 -+ .short L_case_ll - 0b /* FFI_TYPE_SINT64 */
1.4862 -+ .short L_case_v - 0b /* FFI_TYPE_STRUCT */
1.4863 -+ .short L_case_i - 0b /* FFI_TYPE_POINTER */
1.4864 -+
1.4865 -+#if defined(__SH4__)
1.4866 -+L_case_d:
1.4867 -+#ifdef __LITTLE_ENDIAN__
1.4868 -+ fmov.s @r2+,fr1
1.4869 -+ bra L_case_v
1.4870 -+ fmov.s @r2,fr0
1.4871 -+#else
1.4872 -+ fmov.s @r2+,fr0
1.4873 -+ bra L_case_v
1.4874 -+ fmov.s @r2,fr1
1.4875 -+#endif
1.4876 -+
1.4877 -+L_case_f:
1.4878 -+ bra L_case_v
1.4879 -+ fmov.s @r2,fr0
1.4880 -+#endif
1.4881 -+
1.4882 -+L_case_ll:
1.4883 -+ mov.l @r2+,r0
1.4884 -+ bra L_case_v
1.4885 -+ mov.l @r2,r1
1.4886 -+
1.4887 -+L_case_i:
1.4888 -+ bra L_case_v
1.4889 -+ mov.l @r2,r0
1.4890 -+
1.4891 -+L_case_q:
1.4892 -+#ifdef __LITTLE_ENDIAN__
1.4893 -+#else
1.4894 -+ add #3,r2
1.4895 -+#endif
1.4896 -+ bra L_case_v
1.4897 -+ mov.b @r2,r0
1.4898 -+
1.4899 -+L_case_uq:
1.4900 -+#ifdef __LITTLE_ENDIAN__
1.4901 -+#else
1.4902 -+ add #3,r2
1.4903 -+#endif
1.4904 -+ mov.b @r2,r0
1.4905 -+ bra L_case_v
1.4906 -+ extu.b r0,r0
1.4907 -+
1.4908 -+L_case_h:
1.4909 -+#ifdef __LITTLE_ENDIAN__
1.4910 -+#else
1.4911 -+ add #2,r2
1.4912 -+#endif
1.4913 -+ bra L_case_v
1.4914 -+ mov.w @r2,r0
1.4915 -+
1.4916 -+L_case_uh:
1.4917 -+#ifdef __LITTLE_ENDIAN__
1.4918 -+#else
1.4919 -+ add #2,r2
1.4920 -+#endif
1.4921 -+ mov.w @r2,r0
1.4922 -+ extu.w r0,r0
1.4923 -+ /* fall through */
1.4924 -+
1.4925 -+L_case_v:
1.4926 -+#if defined(__SH4__)
1.4927 -+ add #56,r15
1.4928 -+#else
1.4929 -+ add #24,r15
1.4930 -+#endif
1.4931 -+ lds.l @r15+,pr
1.4932 -+ rts
1.4933 -+ mov.l @r15+,r14
1.4934 -+.LFE2:
1.4935 -+.ffi_closure_SYSV_end:
1.4936 -+ .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
1.4937 -+
1.4938 -+ .section ".eh_frame","aw",@progbits
1.4939 -+__FRAME_BEGIN__:
1.4940 -+ .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */
1.4941 -+.LSCIE1:
1.4942 -+ .4byte 0x0 /* CIE Identifier Tag */
1.4943 -+ .byte 0x1 /* CIE Version */
1.4944 -+ .byte 0x0 /* CIE Augmentation */
1.4945 -+ .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */
1.4946 -+ .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */
1.4947 -+ .byte 0x11 /* CIE RA Column */
1.4948 -+ .byte 0xc /* DW_CFA_def_cfa */
1.4949 -+ .byte 0xf /* uleb128 0xf */
1.4950 -+ .byte 0x0 /* uleb128 0x0 */
1.4951 -+ .align 2
1.4952 -+.LECIE1:
1.4953 -+.LSFDE1:
1.4954 -+ .4byte .LEFDE1-.LASFDE1 /* FDE Length */
1.4955 -+.LASFDE1:
1.4956 -+ .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */
1.4957 -+ .4byte .LFB1 /* FDE initial location */
1.4958 -+ .4byte .LFE1-.LFB1 /* FDE address range */
1.4959 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.4960 -+ .4byte .LCFI0-.LFB1
1.4961 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.4962 -+ .byte 0x4 /* uleb128 0x4 */
1.4963 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.4964 -+ .4byte .LCFI1-.LCFI0
1.4965 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.4966 -+ .byte 0x8 /* uleb128 0x4 */
1.4967 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.4968 -+ .4byte .LCFI2-.LCFI1
1.4969 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.4970 -+ .byte 0xc /* uleb128 0x4 */
1.4971 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.4972 -+ .4byte .LCFI3-.LCFI2
1.4973 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.4974 -+ .byte 0x10 /* uleb128 0x4 */
1.4975 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.4976 -+ .4byte .LCFI4-.LCFI3
1.4977 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.4978 -+ .byte 0x14 /* uleb128 0x4 */
1.4979 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.4980 -+ .4byte .LCFI5-.LCFI4
1.4981 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.4982 -+ .byte 0x18 /* uleb128 0x4 */
1.4983 -+ .byte 0x91 /* DW_CFA_offset, column 0x11 */
1.4984 -+ .byte 0x6 /* uleb128 0x6 */
1.4985 -+ .byte 0x8e /* DW_CFA_offset, column 0xe */
1.4986 -+ .byte 0x5 /* uleb128 0x5 */
1.4987 -+ .byte 0x8c /* DW_CFA_offset, column 0xc */
1.4988 -+ .byte 0x4 /* uleb128 0x4 */
1.4989 -+ .byte 0x8a /* DW_CFA_offset, column 0xa */
1.4990 -+ .byte 0x3 /* uleb128 0x3 */
1.4991 -+ .byte 0x89 /* DW_CFA_offset, column 0x9 */
1.4992 -+ .byte 0x2 /* uleb128 0x2 */
1.4993 -+ .byte 0x88 /* DW_CFA_offset, column 0x8 */
1.4994 -+ .byte 0x1 /* uleb128 0x1 */
1.4995 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.4996 -+ .4byte .LCFI6-.LCFI5
1.4997 -+ .byte 0xd /* DW_CFA_def_cfa_register */
1.4998 -+ .byte 0xe /* uleb128 0xe */
1.4999 -+ .align 2
1.5000 -+.LEFDE1:
1.5001 -+
1.5002 -+.LSFDE3:
1.5003 -+ .4byte .LEFDE3-.LASFDE3 /* FDE Length */
1.5004 -+.LASFDE3:
1.5005 -+ .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */
1.5006 -+ .4byte .LFB2 /* FDE initial location */
1.5007 -+ .4byte .LFE2-.LFB2 /* FDE address range */
1.5008 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.5009 -+ .4byte .LCFI7-.LFB2
1.5010 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.5011 -+ .byte 0x4 /* uleb128 0x4 */
1.5012 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.5013 -+ .4byte .LCFI8-.LCFI7
1.5014 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.5015 -+ .byte 0x8 /* uleb128 0x8 */
1.5016 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.5017 -+ .4byte .LCFI9-.LCFI8
1.5018 -+ .byte 0xe /* DW_CFA_def_cfa_offset */
1.5019 -+#if defined(__SH4__)
1.5020 -+ .byte 8+56 /* uleb128 8+56 */
1.5021 -+#else
1.5022 -+ .byte 8+24 /* uleb128 8+24 */
1.5023 -+#endif
1.5024 -+ .byte 0x91 /* DW_CFA_offset, column 0x11 */
1.5025 -+ .byte 0x2
1.5026 -+ .byte 0x8e /* DW_CFA_offset, column 0xe */
1.5027 -+ .byte 0x1
1.5028 -+ .byte 0x4 /* DW_CFA_advance_loc4 */
1.5029 -+ .4byte .LCFIA-.LCFI9
1.5030 -+ .byte 0xd /* DW_CFA_def_cfa_register */
1.5031 -+ .byte 0xe /* uleb128 0xe */
1.5032 -+ .align 2
1.5033 -+.LEFDE3:
1.5034 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/ffi.c gcc/libffi/src/sparc/ffi.c
1.5035 ---- gcc-3.2.2.orig/libffi/src/sparc/ffi.c Sat Mar 3 07:21:23 2001
1.5036 -+++ gcc/libffi/src/sparc/ffi.c Sat Jan 4 08:08:56 2003
1.5037 -@@ -1,5 +1,5 @@
1.5038 - /* -----------------------------------------------------------------------
1.5039 -- ffi.c - Copyright (c) 1996 Cygnus Solutions
1.5040 -+ ffi.c - Copyright (c) 1996, 2003 Cygnus Solutions
1.5041 -
1.5042 - Sparc Foreign Function Interface
1.5043 -
1.5044 -@@ -28,20 +28,22 @@
1.5045 -
1.5046 - #include <stdlib.h>
1.5047 -
1.5048 -+#ifdef SPARC64
1.5049 -+extern void ffi_closure_v9(void);
1.5050 -+#else
1.5051 -+extern void ffi_closure_v8(void);
1.5052 -+#endif
1.5053 -+
1.5054 - /* ffi_prep_args is called by the assembly routine once stack space
1.5055 - has been allocated for the function's arguments */
1.5056 -
1.5057 - void ffi_prep_args_v8(char *stack, extended_cif *ecif)
1.5058 - {
1.5059 - int i;
1.5060 -- int tmp;
1.5061 -- int avn;
1.5062 - void **p_argv;
1.5063 - char *argp;
1.5064 - ffi_type **p_arg;
1.5065 -
1.5066 -- tmp = 0;
1.5067 --
1.5068 - /* Skip 16 words for the window save area */
1.5069 - argp = stack + 16*sizeof(int);
1.5070 -
1.5071 -@@ -66,18 +68,12 @@
1.5072 - ((int*)argp)[5] = 0;
1.5073 - #endif
1.5074 -
1.5075 -- avn = ecif->cif->nargs;
1.5076 - p_argv = ecif->avalue;
1.5077 -
1.5078 -- for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
1.5079 -- i && avn;
1.5080 -- i--, p_arg++)
1.5081 -+ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++)
1.5082 - {
1.5083 - size_t z;
1.5084 -
1.5085 -- if (avn)
1.5086 -- {
1.5087 -- avn--;
1.5088 - if ((*p_arg)->type == FFI_TYPE_STRUCT
1.5089 - #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
1.5090 - || (*p_arg)->type == FFI_TYPE_LONGDOUBLE
1.5091 -@@ -122,7 +118,6 @@
1.5092 - }
1.5093 - p_argv++;
1.5094 - argp += z;
1.5095 -- }
1.5096 - }
1.5097 -
1.5098 - return;
1.5099 -@@ -420,3 +415,101 @@
1.5100 - }
1.5101 -
1.5102 - }
1.5103 -+
1.5104 -+ffi_status
1.5105 -+ffi_prep_closure (ffi_closure* closure,
1.5106 -+ ffi_cif* cif,
1.5107 -+ void (*fun)(ffi_cif*, void*, void**, void*),
1.5108 -+ void *user_data)
1.5109 -+{
1.5110 -+ unsigned int *tramp = (unsigned int *) &closure->tramp[0];
1.5111 -+ unsigned long fn;
1.5112 -+ unsigned long ctx = (unsigned long) closure;
1.5113 -+
1.5114 -+#ifdef SPARC64
1.5115 -+ /* Trampoline address is equal to the closure address. We take advantage
1.5116 -+ of that to reduce the trampoline size by 8 bytes. */
1.5117 -+ FFI_ASSERT (cif->abi == FFI_V9);
1.5118 -+ fn = (unsigned long) ffi_closure_v9;
1.5119 -+ tramp[0] = 0x83414000; /* rd %pc, %g1 */
1.5120 -+ tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */
1.5121 -+ tramp[2] = 0x81c14000; /* jmp %g5 */
1.5122 -+ tramp[3] = 0x01000000; /* nop */
1.5123 -+ *((unsigned long *) &tramp[4]) = fn;
1.5124 -+#else
1.5125 -+ FFI_ASSERT (cif->abi == FFI_V8);
1.5126 -+ fn = (unsigned long) ffi_closure_v8;
1.5127 -+ tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */
1.5128 -+ tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */
1.5129 -+ tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */
1.5130 -+ tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */
1.5131 -+#endif
1.5132 -+
1.5133 -+ closure->cif = cif;
1.5134 -+ closure->fun = fun;
1.5135 -+ closure->user_data = user_data;
1.5136 -+
1.5137 -+ /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */
1.5138 -+#ifdef SPARC64
1.5139 -+ asm volatile ("flush %0" : : "r" (closure) : "memory");
1.5140 -+ asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory");
1.5141 -+#else
1.5142 -+ asm volatile ("iflush %0" : : "r" (closure) : "memory");
1.5143 -+ asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory");
1.5144 -+#endif
1.5145 -+
1.5146 -+ return FFI_OK;
1.5147 -+}
1.5148 -+
1.5149 -+int
1.5150 -+ffi_closure_sparc_inner(ffi_closure *closure,
1.5151 -+ void *rvalue, unsigned long *gpr, double *fpr)
1.5152 -+{
1.5153 -+ ffi_cif *cif;
1.5154 -+ void **avalue;
1.5155 -+ ffi_type **arg_types;
1.5156 -+ int i, avn, argn;
1.5157 -+
1.5158 -+ cif = closure->cif;
1.5159 -+ avalue = alloca(cif->nargs * sizeof(void *));
1.5160 -+
1.5161 -+ argn = 0;
1.5162 -+
1.5163 -+ /* Copy the caller's structure return address to that the closure
1.5164 -+ returns the data directly to the caller. */
1.5165 -+ if (cif->flags == FFI_TYPE_STRUCT)
1.5166 -+ {
1.5167 -+ rvalue = (void *) gpr[0];
1.5168 -+ argn = 1;
1.5169 -+ }
1.5170 -+
1.5171 -+ i = 0;
1.5172 -+ avn = cif->nargs;
1.5173 -+ arg_types = cif->arg_types;
1.5174 -+
1.5175 -+ /* Grab the addresses of the arguments from the stack frame. */
1.5176 -+ while (i < avn)
1.5177 -+ {
1.5178 -+ /* Assume big-endian. FIXME */
1.5179 -+ argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG;
1.5180 -+
1.5181 -+#ifdef SPARC64
1.5182 -+ if (i < 6 && (arg_types[i]->type == FFI_TYPE_FLOAT
1.5183 -+ || arg_types[i]->type == FFI_TYPE_DOUBLE
1.5184 -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
1.5185 -+ || arg_types[i]->type == FFI_TYPE_LONGDOUBLE
1.5186 -+#endif
1.5187 -+ ))
1.5188 -+ avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size;
1.5189 -+ else
1.5190 -+#endif
1.5191 -+ avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size;
1.5192 -+ i++;
1.5193 -+ }
1.5194 -+
1.5195 -+ /* Invoke the closure. */
1.5196 -+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
1.5197 -+
1.5198 -+ /* Tell ffi_closure_sparc how to perform return type promotions. */
1.5199 -+ return cif->rtype->type;
1.5200 -+}
1.5201 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/v8.S gcc/libffi/src/sparc/v8.S
1.5202 ---- gcc-3.2.2.orig/libffi/src/sparc/v8.S Mon Apr 29 05:12:04 2002
1.5203 -+++ gcc/libffi/src/sparc/v8.S Sat Jan 4 08:08:56 2003
1.5204 -@@ -1,5 +1,5 @@
1.5205 - /* -----------------------------------------------------------------------
1.5206 -- v8.S - Copyright (c) 1996, 1997 Cygnus Solutions
1.5207 -+ v8.S - Copyright (c) 1996, 1997, 2003 Cygnus Solutions
1.5208 -
1.5209 - Sparc Foreign Function Interface
1.5210 -
1.5211 -@@ -94,6 +94,72 @@
1.5212 - .ffi_call_V8_end:
1.5213 - .size ffi_call_V8,.ffi_call_V8_end-ffi_call_V8
1.5214 -
1.5215 -+
1.5216 -+#define STACKFRAME 104 /* 16*4 register window +
1.5217 -+ 1*4 struct return +
1.5218 -+ 6*4 args backing store +
1.5219 -+ 3*4 locals */
1.5220 -+
1.5221 -+/* ffi_closure_v8(...)
1.5222 -+
1.5223 -+ Receives the closure argument in %g2. */
1.5224 -+
1.5225 -+ .text
1.5226 -+ .align 8
1.5227 -+ .globl ffi_closure_v8
1.5228 -+
1.5229 -+ffi_closure_v8:
1.5230 -+ .register %g2, #scratch
1.5231 -+.LLFB2:
1.5232 -+ save %sp, -STACKFRAME, %sp
1.5233 -+.LLCFI1:
1.5234 -+
1.5235 -+ ! Store all of the potential argument registers in va_list format.
1.5236 -+ st %i0, [%fp+68+0]
1.5237 -+ st %i1, [%fp+68+4]
1.5238 -+ st %i2, [%fp+68+8]
1.5239 -+ st %i3, [%fp+68+12]
1.5240 -+ st %i4, [%fp+68+16]
1.5241 -+ st %i5, [%fp+68+20]
1.5242 -+
1.5243 -+ ! Call ffi_closure_sparc_inner to do the bulk of the work.
1.5244 -+ mov %g2, %o0
1.5245 -+ add %fp, -8, %o1
1.5246 -+ add %fp, 68, %o2
1.5247 -+ call ffi_closure_sparc_inner
1.5248 -+ mov 0, %o3
1.5249 -+
1.5250 -+ ! Load up the return value in the proper type.
1.5251 -+ cmp %o0, FFI_TYPE_VOID
1.5252 -+ be done1
1.5253 -+
1.5254 -+ cmp %o0, FFI_TYPE_FLOAT
1.5255 -+ be,a done1
1.5256 -+ ld [%fp-8], %f0
1.5257 -+
1.5258 -+ cmp %o0, FFI_TYPE_DOUBLE
1.5259 -+ be,a done1
1.5260 -+ ldd [%fp-8], %f0
1.5261 -+
1.5262 -+ cmp %o0, FFI_TYPE_SINT64
1.5263 -+ be,a integer
1.5264 -+ ld [%fp-4], %i1
1.5265 -+
1.5266 -+ cmp %o0, FFI_TYPE_UINT64
1.5267 -+ be,a integer
1.5268 -+ ld [%fp-4], %i1
1.5269 -+
1.5270 -+integer:
1.5271 -+ ld [%fp-8], %i0
1.5272 -+
1.5273 -+done1:
1.5274 -+ ret
1.5275 -+ restore
1.5276 -+.LLFE2:
1.5277 -+
1.5278 -+.ffi_closure_v8_end:
1.5279 -+ .size ffi_closure_v8,.ffi_closure_v8_end-ffi_closure_v8
1.5280 -+
1.5281 - #ifdef SPARC64
1.5282 - #define WS 8
1.5283 - #define nword xword
1.5284 -@@ -148,3 +214,26 @@
1.5285 - .byte 0x1f ! uleb128 0x1f
1.5286 - .align WS
1.5287 - .LLEFDE1:
1.5288 -+.LLSFDE2:
1.5289 -+ .uaword .LLEFDE2-.LLASFDE2 ! FDE Length
1.5290 -+.LLASFDE2:
1.5291 -+ .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset
1.5292 -+#ifdef HAVE_AS_SPARC_UA_PCREL
1.5293 -+ .uaword %r_disp32(.LLFB2)
1.5294 -+ .uaword .LLFE2-.LLFB2 ! FDE address range
1.5295 -+#else
1.5296 -+ .align WS
1.5297 -+ .nword .LLFB2
1.5298 -+ .uanword .LLFE2-.LLFB2 ! FDE address range
1.5299 -+#endif
1.5300 -+ .byte 0x0 ! uleb128 0x0; Augmentation size
1.5301 -+ .byte 0x4 ! DW_CFA_advance_loc4
1.5302 -+ .uaword .LLCFI1-.LLFB2
1.5303 -+ .byte 0xd ! DW_CFA_def_cfa_register
1.5304 -+ .byte 0x1e ! uleb128 0x1e
1.5305 -+ .byte 0x2d ! DW_CFA_GNU_window_save
1.5306 -+ .byte 0x9 ! DW_CFA_register
1.5307 -+ .byte 0xf ! uleb128 0xf
1.5308 -+ .byte 0x1f ! uleb128 0x1f
1.5309 -+ .align WS
1.5310 -+.LLEFDE2:
1.5311 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/v9.S gcc/libffi/src/sparc/v9.S
1.5312 ---- gcc-3.2.2.orig/libffi/src/sparc/v9.S Mon Apr 29 05:12:04 2002
1.5313 -+++ gcc/libffi/src/sparc/v9.S Sat Jan 4 08:08:56 2003
1.5314 -@@ -1,5 +1,5 @@
1.5315 - /* -----------------------------------------------------------------------
1.5316 -- v9.S - Copyright (c) 2000 Cygnus Solutions
1.5317 -+ v9.S - Copyright (c) 2000, 2003 Cygnus Solutions
1.5318 -
1.5319 - Sparc 64bit Foreign Function Interface
1.5320 -
1.5321 -@@ -99,7 +99,7 @@
1.5322 - cmp %i3, FFI_TYPE_STRUCT
1.5323 - be,pn %icc, dostruct
1.5324 -
1.5325 -- cmp %i3, FFI_TYPE_LONGDOUBLE
1.5326 -+ cmp %i3, FFI_TYPE_LONGDOUBLE
1.5327 - bne,pt %icc, done
1.5328 - nop
1.5329 - std %f0, [%i4+0]
1.5330 -@@ -125,6 +125,88 @@
1.5331 - .ffi_call_V9_end:
1.5332 - .size ffi_call_V9,.ffi_call_V9_end-ffi_call_V9
1.5333 -
1.5334 -+
1.5335 -+#define STACKFRAME 240 /* 16*8 register window +
1.5336 -+ 6*8 args backing store +
1.5337 -+ 8*8 locals */
1.5338 -+#define FP %fp+STACK_BIAS
1.5339 -+
1.5340 -+/* ffi_closure_v9(...)
1.5341 -+
1.5342 -+ Receives the closure argument in %g1. */
1.5343 -+
1.5344 -+ .text
1.5345 -+ .align 8
1.5346 -+ .globl ffi_closure_v9
1.5347 -+
1.5348 -+ffi_closure_v9:
1.5349 -+.LLFB2:
1.5350 -+ save %sp, -STACKFRAME, %sp
1.5351 -+.LLCFI1:
1.5352 -+
1.5353 -+ ! Store all of the potential argument registers in va_list format.
1.5354 -+ stx %i0, [FP+128+0]
1.5355 -+ stx %i1, [FP+128+8]
1.5356 -+ stx %i2, [FP+128+16]
1.5357 -+ stx %i3, [FP+128+24]
1.5358 -+ stx %i4, [FP+128+32]
1.5359 -+ stx %i5, [FP+128+40]
1.5360 -+
1.5361 -+ ! Store possible floating point argument registers too.
1.5362 -+ std %f0, [FP-48]
1.5363 -+ std %f2, [FP-40]
1.5364 -+ std %f4, [FP-32]
1.5365 -+ std %f6, [FP-24]
1.5366 -+ std %f8, [FP-16]
1.5367 -+ std %f10, [FP-8]
1.5368 -+
1.5369 -+ ! Call ffi_closure_sparc_inner to do the bulk of the work.
1.5370 -+ mov %g1, %o0
1.5371 -+ add %fp, STACK_BIAS-64, %o1
1.5372 -+ add %fp, STACK_BIAS+128, %o2
1.5373 -+ call ffi_closure_sparc_inner
1.5374 -+ add %fp, STACK_BIAS-48, %o3
1.5375 -+
1.5376 -+ ! Load up the return value in the proper type.
1.5377 -+ cmp %o0, FFI_TYPE_VOID
1.5378 -+ be,pn %icc, done1
1.5379 -+
1.5380 -+ cmp %o0, FFI_TYPE_FLOAT
1.5381 -+ be,a,pn %icc, done1
1.5382 -+ ld [FP-64], %f0
1.5383 -+
1.5384 -+ cmp %o0, FFI_TYPE_DOUBLE
1.5385 -+ be,a,pn %icc, done1
1.5386 -+ ldd [FP-64], %f0
1.5387 -+
1.5388 -+ cmp %o0, FFI_TYPE_LONGDOUBLE
1.5389 -+ be,a,pn %icc, longdouble1
1.5390 -+ ldd [FP-64], %f0
1.5391 -+
1.5392 -+ cmp %o0, FFI_TYPE_STRUCT
1.5393 -+ be,pn %icc, struct1
1.5394 -+
1.5395 -+ ! FFI_TYPE_UINT64 | FFI_TYPE_SINT64 | FFI_TYPE_POINTER
1.5396 -+ ldx [FP-64], %i0
1.5397 -+
1.5398 -+done1:
1.5399 -+ ret
1.5400 -+ restore
1.5401 -+
1.5402 -+struct1:
1.5403 -+ ldx [FP-56], %i2
1.5404 -+ ret
1.5405 -+ restore
1.5406 -+
1.5407 -+longdouble1:
1.5408 -+ ldd [FP-56], %f2
1.5409 -+ ret
1.5410 -+ restore
1.5411 -+.LLFE2:
1.5412 -+
1.5413 -+.ffi_closure_v9_end:
1.5414 -+ .size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9
1.5415 -+
1.5416 - .section ".eh_frame",#alloc,#write
1.5417 - .LLframe1:
1.5418 - .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry
1.5419 -@@ -169,5 +251,27 @@
1.5420 - .byte 0x1f ! uleb128 0x1f
1.5421 - .align 8
1.5422 - .LLEFDE1:
1.5423 --
1.5424 -+.LLSFDE2:
1.5425 -+ .uaword .LLEFDE2-.LLASFDE2 ! FDE Length
1.5426 -+.LLASFDE2:
1.5427 -+ .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset
1.5428 -+#ifdef HAVE_AS_SPARC_UA_PCREL
1.5429 -+ .uaword %r_disp32(.LLFB2)
1.5430 -+ .uaword .LLFE2-.LLFB2 ! FDE address range
1.5431 -+#else
1.5432 -+ .align 8
1.5433 -+ .xword .LLFB2
1.5434 -+ .uaxword .LLFE2-.LLFB2 ! FDE address range
1.5435 -+#endif
1.5436 -+ .byte 0x0 ! uleb128 0x0; Augmentation size
1.5437 -+ .byte 0x4 ! DW_CFA_advance_loc4
1.5438 -+ .uaword .LLCFI1-.LLFB2
1.5439 -+ .byte 0xd ! DW_CFA_def_cfa_register
1.5440 -+ .byte 0x1e ! uleb128 0x1e
1.5441 -+ .byte 0x2d ! DW_CFA_GNU_window_save
1.5442 -+ .byte 0x9 ! DW_CFA_register
1.5443 -+ .byte 0xf ! uleb128 0xf
1.5444 -+ .byte 0x1f ! uleb128 0x1f
1.5445 -+ .align 8
1.5446 -+.LLEFDE2:
1.5447 - #endif
1.5448 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/types.c gcc/libffi/src/types.c
1.5449 ---- gcc-3.2.2.orig/libffi/src/types.c Tue Mar 27 11:39:16 2001
1.5450 -+++ gcc/libffi/src/types.c Wed Nov 27 07:24:05 2002
1.5451 -@@ -42,7 +42,8 @@
1.5452 - FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32);
1.5453 - FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
1.5454 -
1.5455 --#if defined ALPHA || defined SPARC64
1.5456 -+#if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \
1.5457 -+ || defined IA64
1.5458 -
1.5459 - FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER);
1.5460 -
1.5461 -@@ -52,22 +53,12 @@
1.5462 -
1.5463 - #endif
1.5464 -
1.5465 --#ifdef X86
1.5466 -+#if defined X86 || defined X86_WIN32 || defined ARM || defined M68K
1.5467 -
1.5468 - FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
1.5469 - FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
1.5470 -
1.5471 --#elif defined X86_WIN32
1.5472 --
1.5473 --FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
1.5474 --FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
1.5475 --
1.5476 --#elif defined ARM
1.5477 --
1.5478 --FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
1.5479 --FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
1.5480 --
1.5481 --#elif defined M68K
1.5482 -+#elif defined SH
1.5483 -
1.5484 - FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
1.5485 - FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
1.5486 -@@ -80,12 +71,7 @@
1.5487 - #endif
1.5488 -
1.5489 -
1.5490 --#ifdef X86
1.5491 --
1.5492 --FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
1.5493 --FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
1.5494 --
1.5495 --#elif defined X86_WIN32
1.5496 -+#if defined X86 || defined X86_WIN32 || defined M68K
1.5497 -
1.5498 - FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
1.5499 - FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
1.5500 -@@ -95,25 +81,25 @@
1.5501 - FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
1.5502 - FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
1.5503 -
1.5504 --#elif defined M68K
1.5505 -+#elif defined SH
1.5506 -
1.5507 - FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
1.5508 --FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
1.5509 -+FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
1.5510 -
1.5511 - #elif defined SPARC
1.5512 -
1.5513 - FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
1.5514 --
1.5515 - #ifdef SPARC64
1.5516 --
1.5517 - FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
1.5518 --
1.5519 - #else
1.5520 --
1.5521 - FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE);
1.5522 --
1.5523 - #endif
1.5524 -
1.5525 -+#elif defined X86_64
1.5526 -+
1.5527 -+FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
1.5528 -+FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
1.5529 -+
1.5530 - #else
1.5531 -
1.5532 - FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
1.5533 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/ffi.c gcc/libffi/src/x86/ffi.c
1.5534 ---- gcc-3.2.2.orig/libffi/src/x86/ffi.c Tue May 28 18:22:08 2002
1.5535 -+++ gcc/libffi/src/x86/ffi.c Fri Dec 6 10:16:45 2002
1.5536 -@@ -1,5 +1,8 @@
1.5537 - /* -----------------------------------------------------------------------
1.5538 -- ffi.c - Copyright (c) 1996, 1998, 1999 Cygnus Solutions
1.5539 -+ ffi.c - Copyright (c) 1996, 1998, 1999, 2001 Red Hat, Inc.
1.5540 -+ Copyright (c) 2002 Ranjit Mathew
1.5541 -+ Copyright (c) 2002 Bo Thorsen
1.5542 -+ Copyright (c) 2002 Roger Sayle
1.5543 -
1.5544 - x86 Foreign Function Interface
1.5545 -
1.5546 -@@ -23,6 +26,8 @@
1.5547 - OTHER DEALINGS IN THE SOFTWARE.
1.5548 - ----------------------------------------------------------------------- */
1.5549 -
1.5550 -+#ifndef __x86_64__
1.5551 -+
1.5552 - #include <ffi.h>
1.5553 - #include <ffi_common.h>
1.5554 -
1.5555 -@@ -36,12 +41,10 @@
1.5556 - /*@=exportheader@*/
1.5557 - {
1.5558 - register unsigned int i;
1.5559 -- register int tmp;
1.5560 - register void **p_argv;
1.5561 - register char *argp;
1.5562 - register ffi_type **p_arg;
1.5563 -
1.5564 -- tmp = 0;
1.5565 - argp = stack;
1.5566 -
1.5567 - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT)
1.5568 -@@ -148,6 +151,18 @@
1.5569 - /*@=declundef@*/
1.5570 - /*@=exportheader@*/
1.5571 -
1.5572 -+#ifdef X86_WIN32
1.5573 -+/*@-declundef@*/
1.5574 -+/*@-exportheader@*/
1.5575 -+extern void ffi_call_STDCALL(void (*)(char *, extended_cif *),
1.5576 -+ /*@out@*/ extended_cif *,
1.5577 -+ unsigned, unsigned,
1.5578 -+ /*@out@*/ unsigned *,
1.5579 -+ void (*fn)());
1.5580 -+/*@=declundef@*/
1.5581 -+/*@=exportheader@*/
1.5582 -+#endif /* X86_WIN32 */
1.5583 -+
1.5584 - void ffi_call(/*@dependent@*/ ffi_cif *cif,
1.5585 - void (*fn)(),
1.5586 - /*@out@*/ void *rvalue,
1.5587 -@@ -180,6 +195,14 @@
1.5588 - cif->flags, ecif.rvalue, fn);
1.5589 - /*@=usedef@*/
1.5590 - break;
1.5591 -+#ifdef X86_WIN32
1.5592 -+ case FFI_STDCALL:
1.5593 -+ /*@-usedef@*/
1.5594 -+ ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes,
1.5595 -+ cif->flags, ecif.rvalue, fn);
1.5596 -+ /*@=usedef@*/
1.5597 -+ break;
1.5598 -+#endif /* X86_WIN32 */
1.5599 - default:
1.5600 - FFI_ASSERT(0);
1.5601 - break;
1.5602 -@@ -266,12 +289,10 @@
1.5603 - /*@=exportheader@*/
1.5604 - {
1.5605 - register unsigned int i;
1.5606 -- register int tmp;
1.5607 - register void **p_argv;
1.5608 - register char *argp;
1.5609 - register ffi_type **p_arg;
1.5610 -
1.5611 -- tmp = 0;
1.5612 - argp = stack;
1.5613 -
1.5614 - if ( cif->rtype->type == FFI_TYPE_STRUCT ) {
1.5615 -@@ -281,13 +302,14 @@
1.5616 -
1.5617 - p_argv = avalue;
1.5618 -
1.5619 -- for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++)
1.5620 -+ for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
1.5621 - {
1.5622 - size_t z;
1.5623 -
1.5624 - /* Align if necessary */
1.5625 -- if (((*p_arg)->alignment - 1) & (unsigned) argp)
1.5626 -+ if (((*p_arg)->alignment - 1) & (unsigned) argp) {
1.5627 - argp = (char *) ALIGN(argp, (*p_arg)->alignment);
1.5628 -+ }
1.5629 -
1.5630 - z = (*p_arg)->size;
1.5631 -
1.5632 -@@ -298,7 +320,7 @@
1.5633 - p_argv++;
1.5634 - argp += z;
1.5635 - }
1.5636 --
1.5637 -+
1.5638 - return;
1.5639 - }
1.5640 -
1.5641 -@@ -449,6 +471,15 @@
1.5642 - /*@out@*/ unsigned *,
1.5643 - void (*fn)());
1.5644 -
1.5645 -+#ifdef X86_WIN32
1.5646 -+extern void
1.5647 -+ffi_call_STDCALL(void (*)(char *, extended_cif *),
1.5648 -+ /*@out@*/ extended_cif *,
1.5649 -+ unsigned, unsigned,
1.5650 -+ /*@out@*/ unsigned *,
1.5651 -+ void (*fn)());
1.5652 -+#endif /* X86_WIN32 */
1.5653 -+
1.5654 - void
1.5655 - ffi_raw_call(/*@dependent@*/ ffi_cif *cif,
1.5656 - void (*fn)(),
1.5657 -@@ -483,6 +514,14 @@
1.5658 - cif->flags, ecif.rvalue, fn);
1.5659 - /*@=usedef@*/
1.5660 - break;
1.5661 -+#ifdef X86_WIN32
1.5662 -+ case FFI_STDCALL:
1.5663 -+ /*@-usedef@*/
1.5664 -+ ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes,
1.5665 -+ cif->flags, ecif.rvalue, fn);
1.5666 -+ /*@=usedef@*/
1.5667 -+ break;
1.5668 -+#endif /* X86_WIN32 */
1.5669 - default:
1.5670 - FFI_ASSERT(0);
1.5671 - break;
1.5672 -@@ -490,3 +529,5 @@
1.5673 - }
1.5674 -
1.5675 - #endif
1.5676 -+
1.5677 -+#endif /* __x86_64__ */
1.5678 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/ffi64.c gcc/libffi/src/x86/ffi64.c
1.5679 ---- gcc-3.2.2.orig/libffi/src/x86/ffi64.c Thu Jan 1 09:00:00 1970
1.5680 -+++ gcc/libffi/src/x86/ffi64.c Wed Jan 29 00:54:28 2003
1.5681 -@@ -0,0 +1,706 @@
1.5682 -+/* -----------------------------------------------------------------------
1.5683 -+ ffi.c - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
1.5684 -+
1.5685 -+ x86-64 Foreign Function Interface
1.5686 -+
1.5687 -+ Permission is hereby granted, free of charge, to any person obtaining
1.5688 -+ a copy of this software and associated documentation files (the
1.5689 -+ ``Software''), to deal in the Software without restriction, including
1.5690 -+ without limitation the rights to use, copy, modify, merge, publish,
1.5691 -+ distribute, sublicense, and/or sell copies of the Software, and to
1.5692 -+ permit persons to whom the Software is furnished to do so, subject to
1.5693 -+ the following conditions:
1.5694 -+
1.5695 -+ The above copyright notice and this permission notice shall be included
1.5696 -+ in all copies or substantial portions of the Software.
1.5697 -+
1.5698 -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1.5699 -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.5700 -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.5701 -+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1.5702 -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1.5703 -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1.5704 -+ OTHER DEALINGS IN THE SOFTWARE.
1.5705 -+ ----------------------------------------------------------------------- */
1.5706 -+
1.5707 -+#include <ffi.h>
1.5708 -+#include <ffi_common.h>
1.5709 -+
1.5710 -+#include <stdlib.h>
1.5711 -+#include <stdarg.h>
1.5712 -+
1.5713 -+/* ffi_prep_args is called by the assembly routine once stack space
1.5714 -+ has been allocated for the function's arguments */
1.5715 -+
1.5716 -+#ifdef __x86_64__
1.5717 -+
1.5718 -+#define MAX_GPR_REGS 6
1.5719 -+#define MAX_SSE_REGS 8
1.5720 -+typedef struct
1.5721 -+{
1.5722 -+ /* Registers for argument passing. */
1.5723 -+ long gpr[MAX_GPR_REGS];
1.5724 -+ __int128_t sse[MAX_SSE_REGS];
1.5725 -+
1.5726 -+ /* Stack space for arguments. */
1.5727 -+ char argspace[0];
1.5728 -+} stackLayout;
1.5729 -+
1.5730 -+/* All reference to register classes here is identical to the code in
1.5731 -+ gcc/config/i386/i386.c. Do *not* change one without the other. */
1.5732 -+
1.5733 -+/* Register class used for passing given 64bit part of the argument.
1.5734 -+ These represent classes as documented by the PS ABI, with the exception
1.5735 -+ of SSESF, SSEDF classes, that are basically SSE class, just gcc will
1.5736 -+ use SF or DFmode move instead of DImode to avoid reformating penalties.
1.5737 -+
1.5738 -+ Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves
1.5739 -+ whenever possible (upper half does contain padding).
1.5740 -+ */
1.5741 -+enum x86_64_reg_class
1.5742 -+ {
1.5743 -+ X86_64_NO_CLASS,
1.5744 -+ X86_64_INTEGER_CLASS,
1.5745 -+ X86_64_INTEGERSI_CLASS,
1.5746 -+ X86_64_SSE_CLASS,
1.5747 -+ X86_64_SSESF_CLASS,
1.5748 -+ X86_64_SSEDF_CLASS,
1.5749 -+ X86_64_SSEUP_CLASS,
1.5750 -+ X86_64_X87_CLASS,
1.5751 -+ X86_64_X87UP_CLASS,
1.5752 -+ X86_64_MEMORY_CLASS
1.5753 -+ };
1.5754 -+
1.5755 -+#define MAX_CLASSES 4
1.5756 -+
1.5757 -+/* x86-64 register passing implementation. See x86-64 ABI for details. Goal
1.5758 -+ of this code is to classify each 8bytes of incoming argument by the register
1.5759 -+ class and assign registers accordingly. */
1.5760 -+
1.5761 -+/* Return the union class of CLASS1 and CLASS2.
1.5762 -+ See the x86-64 PS ABI for details. */
1.5763 -+
1.5764 -+static enum x86_64_reg_class
1.5765 -+merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
1.5766 -+{
1.5767 -+ /* Rule #1: If both classes are equal, this is the resulting class. */
1.5768 -+ if (class1 == class2)
1.5769 -+ return class1;
1.5770 -+
1.5771 -+ /* Rule #2: If one of the classes is NO_CLASS, the resulting class is
1.5772 -+ the other class. */
1.5773 -+ if (class1 == X86_64_NO_CLASS)
1.5774 -+ return class2;
1.5775 -+ if (class2 == X86_64_NO_CLASS)
1.5776 -+ return class1;
1.5777 -+
1.5778 -+ /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */
1.5779 -+ if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS)
1.5780 -+ return X86_64_MEMORY_CLASS;
1.5781 -+
1.5782 -+ /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */
1.5783 -+ if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS)
1.5784 -+ || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS))
1.5785 -+ return X86_64_INTEGERSI_CLASS;
1.5786 -+ if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS
1.5787 -+ || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS)
1.5788 -+ return X86_64_INTEGER_CLASS;
1.5789 -+
1.5790 -+ /* Rule #5: If one of the classes is X87 or X87UP class, MEMORY is used. */
1.5791 -+ if (class1 == X86_64_X87_CLASS || class1 == X86_64_X87UP_CLASS
1.5792 -+ || class2 == X86_64_X87_CLASS || class2 == X86_64_X87UP_CLASS)
1.5793 -+ return X86_64_MEMORY_CLASS;
1.5794 -+
1.5795 -+ /* Rule #6: Otherwise class SSE is used. */
1.5796 -+ return X86_64_SSE_CLASS;
1.5797 -+}
1.5798 -+
1.5799 -+/* Classify the argument of type TYPE and mode MODE.
1.5800 -+ CLASSES will be filled by the register class used to pass each word
1.5801 -+ of the operand. The number of words is returned. In case the parameter
1.5802 -+ should be passed in memory, 0 is returned. As a special case for zero
1.5803 -+ sized containers, classes[0] will be NO_CLASS and 1 is returned.
1.5804 -+
1.5805 -+ See the x86-64 PS ABI for details.
1.5806 -+*/
1.5807 -+static int
1.5808 -+classify_argument (ffi_type *type, enum x86_64_reg_class classes[],
1.5809 -+ int *byte_offset)
1.5810 -+{
1.5811 -+ /* First, align to the right place. */
1.5812 -+ *byte_offset = ALIGN(*byte_offset, type->alignment);
1.5813 -+
1.5814 -+ switch (type->type)
1.5815 -+ {
1.5816 -+ case FFI_TYPE_UINT8:
1.5817 -+ case FFI_TYPE_SINT8:
1.5818 -+ case FFI_TYPE_UINT16:
1.5819 -+ case FFI_TYPE_SINT16:
1.5820 -+ case FFI_TYPE_UINT32:
1.5821 -+ case FFI_TYPE_SINT32:
1.5822 -+ case FFI_TYPE_UINT64:
1.5823 -+ case FFI_TYPE_SINT64:
1.5824 -+ case FFI_TYPE_POINTER:
1.5825 -+ if (((*byte_offset) % 8 + type->size) <= 4)
1.5826 -+ classes[0] = X86_64_INTEGERSI_CLASS;
1.5827 -+ else
1.5828 -+ classes[0] = X86_64_INTEGER_CLASS;
1.5829 -+ return 1;
1.5830 -+ case FFI_TYPE_FLOAT:
1.5831 -+ if (((*byte_offset) % 8) == 0)
1.5832 -+ classes[0] = X86_64_SSESF_CLASS;
1.5833 -+ else
1.5834 -+ classes[0] = X86_64_SSE_CLASS;
1.5835 -+ return 1;
1.5836 -+ case FFI_TYPE_DOUBLE:
1.5837 -+ classes[0] = X86_64_SSEDF_CLASS;
1.5838 -+ return 1;
1.5839 -+ case FFI_TYPE_LONGDOUBLE:
1.5840 -+ classes[0] = X86_64_X87_CLASS;
1.5841 -+ classes[1] = X86_64_X87UP_CLASS;
1.5842 -+ return 2;
1.5843 -+ case FFI_TYPE_STRUCT:
1.5844 -+ {
1.5845 -+ const int UNITS_PER_WORD = 8;
1.5846 -+ int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
1.5847 -+ ffi_type **ptr;
1.5848 -+ int i;
1.5849 -+ enum x86_64_reg_class subclasses[MAX_CLASSES];
1.5850 -+
1.5851 -+ /* If the struct is larger than 16 bytes, pass it on the stack. */
1.5852 -+ if (type->size > 16)
1.5853 -+ return 0;
1.5854 -+
1.5855 -+ for (i = 0; i < words; i++)
1.5856 -+ classes[i] = X86_64_NO_CLASS;
1.5857 -+
1.5858 -+ /* Merge the fields of structure. */
1.5859 -+ for (ptr=type->elements; (*ptr)!=NULL; ptr++)
1.5860 -+ {
1.5861 -+ int num;
1.5862 -+
1.5863 -+ num = classify_argument (*ptr, subclasses, byte_offset);
1.5864 -+ if (num == 0)
1.5865 -+ return 0;
1.5866 -+ for (i = 0; i < num; i++)
1.5867 -+ {
1.5868 -+ int pos = *byte_offset / 8;
1.5869 -+ classes[i + pos] =
1.5870 -+ merge_classes (subclasses[i], classes[i + pos]);
1.5871 -+ }
1.5872 -+
1.5873 -+ if ((*ptr)->type != FFI_TYPE_STRUCT)
1.5874 -+ *byte_offset += (*ptr)->size;
1.5875 -+ }
1.5876 -+
1.5877 -+ /* Final merger cleanup. */
1.5878 -+ for (i = 0; i < words; i++)
1.5879 -+ {
1.5880 -+ /* If one class is MEMORY, everything should be passed in
1.5881 -+ memory. */
1.5882 -+ if (classes[i] == X86_64_MEMORY_CLASS)
1.5883 -+ return 0;
1.5884 -+
1.5885 -+ /* The X86_64_SSEUP_CLASS should be always preceded by
1.5886 -+ X86_64_SSE_CLASS. */
1.5887 -+ if (classes[i] == X86_64_SSEUP_CLASS
1.5888 -+ && (i == 0 || classes[i - 1] != X86_64_SSE_CLASS))
1.5889 -+ classes[i] = X86_64_SSE_CLASS;
1.5890 -+
1.5891 -+ /* X86_64_X87UP_CLASS should be preceded by X86_64_X87_CLASS. */
1.5892 -+ if (classes[i] == X86_64_X87UP_CLASS
1.5893 -+ && (i == 0 || classes[i - 1] != X86_64_X87_CLASS))
1.5894 -+ classes[i] = X86_64_SSE_CLASS;
1.5895 -+ }
1.5896 -+ return words;
1.5897 -+ }
1.5898 -+
1.5899 -+ default:
1.5900 -+ FFI_ASSERT(0);
1.5901 -+ }
1.5902 -+ return 0; /* Never reached. */
1.5903 -+}
1.5904 -+
1.5905 -+/* Examine the argument and return set number of register required in each
1.5906 -+ class. Return 0 iff parameter should be passed in memory. */
1.5907 -+static int
1.5908 -+examine_argument (ffi_type *type, int in_return, int *int_nregs,int *sse_nregs)
1.5909 -+{
1.5910 -+ enum x86_64_reg_class class[MAX_CLASSES];
1.5911 -+ int offset = 0;
1.5912 -+ int n;
1.5913 -+
1.5914 -+ n = classify_argument (type, class, &offset);
1.5915 -+
1.5916 -+ if (n == 0)
1.5917 -+ return 0;
1.5918 -+
1.5919 -+ *int_nregs = 0;
1.5920 -+ *sse_nregs = 0;
1.5921 -+ for (n--; n>=0; n--)
1.5922 -+ switch (class[n])
1.5923 -+ {
1.5924 -+ case X86_64_INTEGER_CLASS:
1.5925 -+ case X86_64_INTEGERSI_CLASS:
1.5926 -+ (*int_nregs)++;
1.5927 -+ break;
1.5928 -+ case X86_64_SSE_CLASS:
1.5929 -+ case X86_64_SSESF_CLASS:
1.5930 -+ case X86_64_SSEDF_CLASS:
1.5931 -+ (*sse_nregs)++;
1.5932 -+ break;
1.5933 -+ case X86_64_NO_CLASS:
1.5934 -+ case X86_64_SSEUP_CLASS:
1.5935 -+ break;
1.5936 -+ case X86_64_X87_CLASS:
1.5937 -+ case X86_64_X87UP_CLASS:
1.5938 -+ if (!in_return)
1.5939 -+ return 0;
1.5940 -+ break;
1.5941 -+ default:
1.5942 -+ abort ();
1.5943 -+ }
1.5944 -+ return 1;
1.5945 -+}
1.5946 -+
1.5947 -+/* Functions to load floats and double to an SSE register placeholder. */
1.5948 -+extern void float2sse (float, __int128_t *);
1.5949 -+extern void double2sse (double, __int128_t *);
1.5950 -+extern void floatfloat2sse (void *, __int128_t *);
1.5951 -+
1.5952 -+/* Functions to put the floats and doubles back. */
1.5953 -+extern float sse2float (__int128_t *);
1.5954 -+extern double sse2double (__int128_t *);
1.5955 -+extern void sse2floatfloat(__int128_t *, void *);
1.5956 -+
1.5957 -+/*@-exportheader@*/
1.5958 -+void
1.5959 -+ffi_prep_args (stackLayout *stack, extended_cif *ecif)
1.5960 -+/*@=exportheader@*/
1.5961 -+{
1.5962 -+ int gprcount, ssecount, i, g, s;
1.5963 -+ void **p_argv;
1.5964 -+ void *argp = &stack->argspace;
1.5965 -+ ffi_type **p_arg;
1.5966 -+
1.5967 -+ /* First check if the return value should be passed in memory. If so,
1.5968 -+ pass the pointer as the first argument. */
1.5969 -+ gprcount = ssecount = 0;
1.5970 -+ if (ecif->cif->rtype->type != FFI_TYPE_VOID
1.5971 -+ && examine_argument (ecif->cif->rtype, 1, &g, &s) == 0)
1.5972 -+ (void *)stack->gpr[gprcount++] = ecif->rvalue;
1.5973 -+
1.5974 -+ for (i=ecif->cif->nargs, p_arg=ecif->cif->arg_types, p_argv = ecif->avalue;
1.5975 -+ i!=0; i--, p_arg++, p_argv++)
1.5976 -+ {
1.5977 -+ int in_register = 0;
1.5978 -+
1.5979 -+ switch ((*p_arg)->type)
1.5980 -+ {
1.5981 -+ case FFI_TYPE_SINT8:
1.5982 -+ case FFI_TYPE_SINT16:
1.5983 -+ case FFI_TYPE_SINT32:
1.5984 -+ case FFI_TYPE_SINT64:
1.5985 -+ case FFI_TYPE_UINT8:
1.5986 -+ case FFI_TYPE_UINT16:
1.5987 -+ case FFI_TYPE_UINT32:
1.5988 -+ case FFI_TYPE_UINT64:
1.5989 -+ case FFI_TYPE_POINTER:
1.5990 -+ if (gprcount < MAX_GPR_REGS)
1.5991 -+ {
1.5992 -+ stack->gpr[gprcount] = 0;
1.5993 -+ stack->gpr[gprcount++] = *(long long *)(*p_argv);
1.5994 -+ in_register = 1;
1.5995 -+ }
1.5996 -+ break;
1.5997 -+
1.5998 -+ case FFI_TYPE_FLOAT:
1.5999 -+ if (ssecount < MAX_SSE_REGS)
1.6000 -+ {
1.6001 -+ float2sse (*(float *)(*p_argv), &stack->sse[ssecount++]);
1.6002 -+ in_register = 1;
1.6003 -+ }
1.6004 -+ break;
1.6005 -+
1.6006 -+ case FFI_TYPE_DOUBLE:
1.6007 -+ if (ssecount < MAX_SSE_REGS)
1.6008 -+ {
1.6009 -+ double2sse (*(double *)(*p_argv), &stack->sse[ssecount++]);
1.6010 -+ in_register = 1;
1.6011 -+ }
1.6012 -+ break;
1.6013 -+ }
1.6014 -+
1.6015 -+ if (in_register)
1.6016 -+ continue;
1.6017 -+
1.6018 -+ /* Either all places in registers where filled, or this is a
1.6019 -+ type that potentially goes into a memory slot. */
1.6020 -+ if (examine_argument (*p_arg, 0, &g, &s) == 0
1.6021 -+ || gprcount + g > MAX_GPR_REGS || ssecount + s > MAX_SSE_REGS)
1.6022 -+ {
1.6023 -+ /* Pass this argument in memory. */
1.6024 -+ argp = (void *)ALIGN(argp, (*p_arg)->alignment);
1.6025 -+ memcpy (argp, *p_argv, (*p_arg)->size);
1.6026 -+ argp += (*p_arg)->size;
1.6027 -+ }
1.6028 -+ else
1.6029 -+ {
1.6030 -+ /* All easy cases are eliminated. Now fire the big guns. */
1.6031 -+
1.6032 -+ enum x86_64_reg_class classes[MAX_CLASSES];
1.6033 -+ int offset = 0, j, num;
1.6034 -+ void *a;
1.6035 -+
1.6036 -+ num = classify_argument (*p_arg, classes, &offset);
1.6037 -+ for (j=0, a=*p_argv; j<num; j++, a+=8)
1.6038 -+ {
1.6039 -+ switch (classes[j])
1.6040 -+ {
1.6041 -+ case X86_64_INTEGER_CLASS:
1.6042 -+ case X86_64_INTEGERSI_CLASS:
1.6043 -+ stack->gpr[gprcount++] = *(long long *)a;
1.6044 -+ break;
1.6045 -+ case X86_64_SSE_CLASS:
1.6046 -+ floatfloat2sse (a, &stack->sse[ssecount++]);
1.6047 -+ break;
1.6048 -+ case X86_64_SSESF_CLASS:
1.6049 -+ float2sse (*(float *)a, &stack->sse[ssecount++]);
1.6050 -+ break;
1.6051 -+ case X86_64_SSEDF_CLASS:
1.6052 -+ double2sse (*(double *)a, &stack->sse[ssecount++]);
1.6053 -+ break;
1.6054 -+ default:
1.6055 -+ abort();
1.6056 -+ }
1.6057 -+ }
1.6058 -+ }
1.6059 -+ }
1.6060 -+}
1.6061 -+
1.6062 -+/* Perform machine dependent cif processing. */
1.6063 -+ffi_status
1.6064 -+ffi_prep_cif_machdep (ffi_cif *cif)
1.6065 -+{
1.6066 -+ int gprcount, ssecount, i, g, s;
1.6067 -+
1.6068 -+ gprcount = ssecount = 0;
1.6069 -+
1.6070 -+ /* Reset the byte count. We handle this size estimation here. */
1.6071 -+ cif->bytes = 0;
1.6072 -+
1.6073 -+ /* If the return value should be passed in memory, pass the pointer
1.6074 -+ as the first argument. The actual memory isn't allocated here. */
1.6075 -+ if (cif->rtype->type != FFI_TYPE_VOID
1.6076 -+ && examine_argument (cif->rtype, 1, &g, &s) == 0)
1.6077 -+ gprcount = 1;
1.6078 -+
1.6079 -+ /* Go over all arguments and determine the way they should be passed.
1.6080 -+ If it's in a register and there is space for it, let that be so. If
1.6081 -+ not, add it's size to the stack byte count. */
1.6082 -+ for (i=0; i<cif->nargs; i++)
1.6083 -+ {
1.6084 -+ if (examine_argument (cif->arg_types[i], 0, &g, &s) == 0
1.6085 -+ || gprcount + g > MAX_GPR_REGS || ssecount + s > MAX_SSE_REGS)
1.6086 -+ {
1.6087 -+ /* This is passed in memory. First align to the basic type. */
1.6088 -+ cif->bytes = ALIGN(cif->bytes, cif->arg_types[i]->alignment);
1.6089 -+
1.6090 -+ /* Stack arguments are *always* at least 8 byte aligned. */
1.6091 -+ cif->bytes = ALIGN(cif->bytes, 8);
1.6092 -+
1.6093 -+ /* Now add the size of this argument. */
1.6094 -+ cif->bytes += cif->arg_types[i]->size;
1.6095 -+ }
1.6096 -+ else
1.6097 -+ {
1.6098 -+ gprcount += g;
1.6099 -+ ssecount += s;
1.6100 -+ }
1.6101 -+ }
1.6102 -+
1.6103 -+ /* Set the flag for the closures return. */
1.6104 -+ switch (cif->rtype->type)
1.6105 -+ {
1.6106 -+ case FFI_TYPE_VOID:
1.6107 -+ case FFI_TYPE_STRUCT:
1.6108 -+ case FFI_TYPE_SINT64:
1.6109 -+ case FFI_TYPE_FLOAT:
1.6110 -+ case FFI_TYPE_DOUBLE:
1.6111 -+ case FFI_TYPE_LONGDOUBLE:
1.6112 -+ cif->flags = (unsigned) cif->rtype->type;
1.6113 -+ break;
1.6114 -+
1.6115 -+ case FFI_TYPE_UINT64:
1.6116 -+ cif->flags = FFI_TYPE_SINT64;
1.6117 -+ break;
1.6118 -+
1.6119 -+ default:
1.6120 -+ cif->flags = FFI_TYPE_INT;
1.6121 -+ break;
1.6122 -+ }
1.6123 -+
1.6124 -+ return FFI_OK;
1.6125 -+}
1.6126 -+
1.6127 -+typedef struct
1.6128 -+{
1.6129 -+ long gpr[2];
1.6130 -+ __int128_t sse[2];
1.6131 -+ long double st0;
1.6132 -+} return_value;
1.6133 -+
1.6134 -+void
1.6135 -+ffi_fill_return_value (return_value *rv, extended_cif *ecif)
1.6136 -+{
1.6137 -+ enum x86_64_reg_class classes[MAX_CLASSES];
1.6138 -+ int i = 0, num;
1.6139 -+ long *gpr = rv->gpr;
1.6140 -+ __int128_t *sse = rv->sse;
1.6141 -+ signed char sc;
1.6142 -+ signed short ss;
1.6143 -+
1.6144 -+ /* This is needed because of the way x86-64 handles signed short
1.6145 -+ integers. */
1.6146 -+ switch (ecif->cif->rtype->type)
1.6147 -+ {
1.6148 -+ case FFI_TYPE_SINT8:
1.6149 -+ sc = *(signed char *)gpr;
1.6150 -+ *(long long *)ecif->rvalue = (long long)sc;
1.6151 -+ return;
1.6152 -+ case FFI_TYPE_SINT16:
1.6153 -+ ss = *(signed short *)gpr;
1.6154 -+ *(long long *)ecif->rvalue = (long long)ss;
1.6155 -+ return;
1.6156 -+ default:
1.6157 -+ /* Just continue. */
1.6158 -+ ;
1.6159 -+ }
1.6160 -+
1.6161 -+ num = classify_argument (ecif->cif->rtype, classes, &i);
1.6162 -+
1.6163 -+ if (num == 0)
1.6164 -+ /* Return in memory. */
1.6165 -+ ecif->rvalue = (void *) rv->gpr[0];
1.6166 -+ else if (num == 2 && classes[0] == X86_64_X87_CLASS &&
1.6167 -+ classes[1] == X86_64_X87UP_CLASS)
1.6168 -+ /* This is a long double (this is easiest to handle this way instead
1.6169 -+ of an eightbyte at a time as in the loop below. */
1.6170 -+ *((long double *)ecif->rvalue) = rv->st0;
1.6171 -+ else
1.6172 -+ {
1.6173 -+ void *a;
1.6174 -+
1.6175 -+ for (i=0, a=ecif->rvalue; i<num; i++, a+=8)
1.6176 -+ {
1.6177 -+ switch (classes[i])
1.6178 -+ {
1.6179 -+ case X86_64_INTEGER_CLASS:
1.6180 -+ case X86_64_INTEGERSI_CLASS:
1.6181 -+ *(long long *)a = *gpr;
1.6182 -+ gpr++;
1.6183 -+ break;
1.6184 -+ case X86_64_SSE_CLASS:
1.6185 -+ sse2floatfloat (sse++, a);
1.6186 -+ break;
1.6187 -+ case X86_64_SSESF_CLASS:
1.6188 -+ *(float *)a = sse2float (sse++);
1.6189 -+ break;
1.6190 -+ case X86_64_SSEDF_CLASS:
1.6191 -+ *(double *)a = sse2double (sse++);
1.6192 -+ break;
1.6193 -+ default:
1.6194 -+ abort();
1.6195 -+ }
1.6196 -+ }
1.6197 -+ }
1.6198 -+}
1.6199 -+
1.6200 -+/*@-declundef@*/
1.6201 -+/*@-exportheader@*/
1.6202 -+extern void ffi_call_UNIX64(void (*)(stackLayout *, extended_cif *),
1.6203 -+ void (*) (return_value *, extended_cif *),
1.6204 -+ /*@out@*/ extended_cif *,
1.6205 -+ unsigned, /*@out@*/ unsigned *, void (*fn)());
1.6206 -+/*@=declundef@*/
1.6207 -+/*@=exportheader@*/
1.6208 -+
1.6209 -+void ffi_call(/*@dependent@*/ ffi_cif *cif,
1.6210 -+ void (*fn)(),
1.6211 -+ /*@out@*/ void *rvalue,
1.6212 -+ /*@dependent@*/ void **avalue)
1.6213 -+{
1.6214 -+ extended_cif ecif;
1.6215 -+ int dummy;
1.6216 -+
1.6217 -+ ecif.cif = cif;
1.6218 -+ ecif.avalue = avalue;
1.6219 -+
1.6220 -+ /* If the return value is a struct and we don't have a return */
1.6221 -+ /* value address then we need to make one */
1.6222 -+
1.6223 -+ if ((rvalue == NULL) &&
1.6224 -+ (examine_argument (cif->rtype, 1, &dummy, &dummy) == 0))
1.6225 -+ {
1.6226 -+ /*@-sysunrecog@*/
1.6227 -+ ecif.rvalue = alloca(cif->rtype->size);
1.6228 -+ /*@=sysunrecog@*/
1.6229 -+ }
1.6230 -+ else
1.6231 -+ ecif.rvalue = rvalue;
1.6232 -+
1.6233 -+ /* Stack must always be 16byte aligned. Make it so. */
1.6234 -+ cif->bytes = ALIGN(cif->bytes, 16);
1.6235 -+
1.6236 -+ switch (cif->abi)
1.6237 -+ {
1.6238 -+ case FFI_SYSV:
1.6239 -+ /* Calling 32bit code from 64bit is not possible */
1.6240 -+ FFI_ASSERT(0);
1.6241 -+ break;
1.6242 -+
1.6243 -+ case FFI_UNIX64:
1.6244 -+ /*@-usedef@*/
1.6245 -+ ffi_call_UNIX64 (ffi_prep_args, ffi_fill_return_value, &ecif,
1.6246 -+ cif->bytes, ecif.rvalue, fn);
1.6247 -+ /*@=usedef@*/
1.6248 -+ break;
1.6249 -+
1.6250 -+ default:
1.6251 -+ FFI_ASSERT(0);
1.6252 -+ break;
1.6253 -+ }
1.6254 -+}
1.6255 -+
1.6256 -+extern void ffi_closure_UNIX64(void);
1.6257 -+
1.6258 -+ffi_status
1.6259 -+ffi_prep_closure (ffi_closure* closure,
1.6260 -+ ffi_cif* cif,
1.6261 -+ void (*fun)(ffi_cif*, void*, void**, void*),
1.6262 -+ void *user_data)
1.6263 -+{
1.6264 -+ volatile unsigned short *tramp;
1.6265 -+
1.6266 -+ /* FFI_ASSERT (cif->abi == FFI_OSF); */
1.6267 -+
1.6268 -+ tramp = (volatile unsigned short *) &closure->tramp[0];
1.6269 -+ tramp[0] = 0xbb49; /* mov <code>, %r11 */
1.6270 -+ tramp[5] = 0xba49; /* mov <data>, %r10 */
1.6271 -+ tramp[10] = 0xff49; /* jmp *%r11 */
1.6272 -+ tramp[11] = 0x00e3;
1.6273 -+ *(void * volatile *) &tramp[1] = ffi_closure_UNIX64;
1.6274 -+ *(void * volatile *) &tramp[6] = closure;
1.6275 -+
1.6276 -+ closure->cif = cif;
1.6277 -+ closure->fun = fun;
1.6278 -+ closure->user_data = user_data;
1.6279 -+
1.6280 -+ return FFI_OK;
1.6281 -+}
1.6282 -+
1.6283 -+int
1.6284 -+ffi_closure_UNIX64_inner(ffi_closure *closure, va_list l, void *rp)
1.6285 -+{
1.6286 -+ ffi_cif *cif;
1.6287 -+ void **avalue;
1.6288 -+ ffi_type **arg_types;
1.6289 -+ long i, avn, argn;
1.6290 -+
1.6291 -+ cif = closure->cif;
1.6292 -+ avalue = alloca(cif->nargs * sizeof(void *));
1.6293 -+
1.6294 -+ argn = 0;
1.6295 -+
1.6296 -+ i = 0;
1.6297 -+ avn = cif->nargs;
1.6298 -+ arg_types = cif->arg_types;
1.6299 -+
1.6300 -+ /* Grab the addresses of the arguments from the stack frame. */
1.6301 -+ while (i < avn)
1.6302 -+ {
1.6303 -+ switch (arg_types[i]->type)
1.6304 -+ {
1.6305 -+ case FFI_TYPE_SINT8:
1.6306 -+ case FFI_TYPE_UINT8:
1.6307 -+ case FFI_TYPE_SINT16:
1.6308 -+ case FFI_TYPE_UINT16:
1.6309 -+ case FFI_TYPE_SINT32:
1.6310 -+ case FFI_TYPE_UINT32:
1.6311 -+ case FFI_TYPE_SINT64:
1.6312 -+ case FFI_TYPE_UINT64:
1.6313 -+ case FFI_TYPE_POINTER:
1.6314 -+ {
1.6315 -+ if (l->gp_offset > 48-8)
1.6316 -+ {
1.6317 -+ avalue[i] = l->overflow_arg_area;
1.6318 -+ l->overflow_arg_area = (char *)l->overflow_arg_area + 8;
1.6319 -+ }
1.6320 -+ else
1.6321 -+ {
1.6322 -+ avalue[i] = (char *)l->reg_save_area + l->gp_offset;
1.6323 -+ l->gp_offset += 8;
1.6324 -+ }
1.6325 -+ }
1.6326 -+ break;
1.6327 -+
1.6328 -+ case FFI_TYPE_STRUCT:
1.6329 -+ /* FIXME */
1.6330 -+ FFI_ASSERT(0);
1.6331 -+ break;
1.6332 -+
1.6333 -+ case FFI_TYPE_DOUBLE:
1.6334 -+ {
1.6335 -+ if (l->fp_offset > 176-16)
1.6336 -+ {
1.6337 -+ avalue[i] = l->overflow_arg_area;
1.6338 -+ l->overflow_arg_area = (char *)l->overflow_arg_area + 8;
1.6339 -+ }
1.6340 -+ else
1.6341 -+ {
1.6342 -+ avalue[i] = (char *)l->reg_save_area + l->fp_offset;
1.6343 -+ l->fp_offset += 16;
1.6344 -+ }
1.6345 -+ }
1.6346 -+#if DEBUG_FFI
1.6347 -+ fprintf (stderr, "double arg %d = %g\n", i, *(double *)avalue[i]);
1.6348 -+#endif
1.6349 -+ break;
1.6350 -+
1.6351 -+ case FFI_TYPE_FLOAT:
1.6352 -+ {
1.6353 -+ if (l->fp_offset > 176-16)
1.6354 -+ {
1.6355 -+ avalue[i] = l->overflow_arg_area;
1.6356 -+ l->overflow_arg_area = (char *)l->overflow_arg_area + 8;
1.6357 -+ }
1.6358 -+ else
1.6359 -+ {
1.6360 -+ avalue[i] = (char *)l->reg_save_area + l->fp_offset;
1.6361 -+ l->fp_offset += 16;
1.6362 -+ }
1.6363 -+ }
1.6364 -+#if DEBUG_FFI
1.6365 -+ fprintf (stderr, "float arg %d = %g\n", i, *(float *)avalue[i]);
1.6366 -+#endif
1.6367 -+ break;
1.6368 -+
1.6369 -+ default:
1.6370 -+ FFI_ASSERT(0);
1.6371 -+ }
1.6372 -+
1.6373 -+ argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG;
1.6374 -+ i++;
1.6375 -+ }
1.6376 -+
1.6377 -+ /* Invoke the closure. */
1.6378 -+ (closure->fun) (cif, rp, avalue, closure->user_data);
1.6379 -+
1.6380 -+ /* FIXME: Structs not supported. */
1.6381 -+ FFI_ASSERT(cif->rtype->type != FFI_TYPE_STRUCT);
1.6382 -+
1.6383 -+ /* Tell ffi_closure_UNIX64 how to perform return type promotions. */
1.6384 -+
1.6385 -+ return cif->rtype->type;
1.6386 -+}
1.6387 -+#endif /* ifndef __x86_64__ */
1.6388 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/sysv.S gcc/libffi/src/x86/sysv.S
1.6389 ---- gcc-3.2.2.orig/libffi/src/x86/sysv.S Tue Jul 17 02:10:53 2001
1.6390 -+++ gcc/libffi/src/x86/sysv.S Fri Jul 19 08:08:31 2002
1.6391 -@@ -1,5 +1,5 @@
1.6392 - /* -----------------------------------------------------------------------
1.6393 -- sysv.S - Copyright (c) 1996, 1998, 2001 Cygnus Solutions
1.6394 -+ sysv.S - Copyright (c) 1996, 1998, 2001, 2002 Cygnus Solutions
1.6395 -
1.6396 - X86 Foreign Function Interface
1.6397 -
1.6398 -@@ -23,6 +23,8 @@
1.6399 - OTHER DEALINGS IN THE SOFTWARE.
1.6400 - ----------------------------------------------------------------------- */
1.6401 -
1.6402 -+#ifndef __x86_64__
1.6403 -+
1.6404 - #define LIBFFI_ASM
1.6405 - #include <ffi.h>
1.6406 -
1.6407 -@@ -163,3 +165,5 @@
1.6408 - .align 4
1.6409 - .LEFDE1:
1.6410 - .set .LLFDE1,.LEFDE1-.LSFDE1
1.6411 -+
1.6412 -+#endif /* ifndef __x86_64__ */
1.6413 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/unix64.S gcc/libffi/src/x86/unix64.S
1.6414 ---- gcc-3.2.2.orig/libffi/src/x86/unix64.S Thu Jan 1 09:00:00 1970
1.6415 -+++ gcc/libffi/src/x86/unix64.S Wed Jan 29 00:54:28 2003
1.6416 -@@ -0,0 +1,302 @@
1.6417 -+/* -----------------------------------------------------------------------
1.6418 -+ unix64.S - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
1.6419 -+
1.6420 -+ x86-64 Foreign Function Interface
1.6421 -+
1.6422 -+ Permission is hereby granted, free of charge, to any person obtaining
1.6423 -+ a copy of this software and associated documentation files (the
1.6424 -+ ``Software''), to deal in the Software without restriction, including
1.6425 -+ without limitation the rights to use, copy, modify, merge, publish,
1.6426 -+ distribute, sublicense, and/or sell copies of the Software, and to
1.6427 -+ permit persons to whom the Software is furnished to do so, subject to
1.6428 -+ the following conditions:
1.6429 -+
1.6430 -+ The above copyright notice and this permission notice shall be included
1.6431 -+ in all copies or substantial portions of the Software.
1.6432 -+
1.6433 -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1.6434 -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.6435 -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.6436 -+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1.6437 -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1.6438 -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1.6439 -+ OTHER DEALINGS IN THE SOFTWARE.
1.6440 -+ ----------------------------------------------------------------------- */
1.6441 -+
1.6442 -+#ifdef __x86_64__
1.6443 -+#define LIBFFI_ASM
1.6444 -+#include <ffi.h>
1.6445 -+
1.6446 -+ .section .rodata
1.6447 -+.LC0:
1.6448 -+ .string "asm in progress %lld\n"
1.6449 -+.LC1:
1.6450 -+ .string "asm in progress\n"
1.6451 -+.text
1.6452 -+ .align 2
1.6453 -+.globl ffi_call_UNIX64
1.6454 -+ .type ffi_call_UNIX64,@function
1.6455 -+
1.6456 -+ffi_call_UNIX64:
1.6457 -+.LFB1:
1.6458 -+ pushq %rbp
1.6459 -+.LCFI0:
1.6460 -+ movq %rsp, %rbp
1.6461 -+.LCFI1:
1.6462 -+ /* Save all arguments */
1.6463 -+ subq $48, %rsp
1.6464 -+.LCFI2:
1.6465 -+ movq %rdi, -8(%rbp) /* ffi_prep_args */
1.6466 -+ movq %rsi, -16(%rbp) /* ffi_fill_return_value */
1.6467 -+ movq %rdx, -24(%rbp) /* ecif */
1.6468 -+ movq %rcx, -32(%rbp) /* cif->bytes */
1.6469 -+ movq %r8, -40(%rbp) /* ecif.rvalue */
1.6470 -+ movq %r9, -48(%rbp) /* fn */
1.6471 -+
1.6472 -+ /* Make room for all of the new args and the register args */
1.6473 -+ addl $176, %ecx
1.6474 -+.LCFI3:
1.6475 -+ subq %rcx, %rsp
1.6476 -+.LCFI4:
1.6477 -+ /* Setup the call to ffi_prep_args. */
1.6478 -+ movq %rdi, %rax /* &ffi_prep_args */
1.6479 -+ movq %rsp, %rdi /* stackLayout */
1.6480 -+ movq %rdx, %rsi /* ecif */
1.6481 -+ call *%rax /* ffi_prep_args(stackLayout, ecif);*/
1.6482 -+
1.6483 -+ /* ffi_prep_args have put all the register contents into the */
1.6484 -+ /* stackLayout struct. Now put the register values in place. */
1.6485 -+ movq (%rsp), %rdi
1.6486 -+ movq 8(%rsp), %rsi
1.6487 -+ movq 16(%rsp), %rdx
1.6488 -+ movq 24(%rsp), %rcx
1.6489 -+ movq 32(%rsp), %r8
1.6490 -+ movq 40(%rsp), %r9
1.6491 -+ movaps 48(%rsp), %xmm0
1.6492 -+ movaps 64(%rsp), %xmm1
1.6493 -+ movaps 80(%rsp), %xmm2
1.6494 -+ movaps 96(%rsp), %xmm3
1.6495 -+ movaps 112(%rsp), %xmm4
1.6496 -+ movaps 128(%rsp), %xmm5
1.6497 -+ movaps 144(%rsp), %xmm6
1.6498 -+ movaps 160(%rsp), %xmm7
1.6499 -+
1.6500 -+ /* Remove space for stackLayout so stack arguments are placed
1.6501 -+ correctly for the call. */
1.6502 -+.LCFI5:
1.6503 -+ addq $176, %rsp
1.6504 -+.LCFI6:
1.6505 -+ /* Call the user function. */
1.6506 -+ call *-48(%rbp)
1.6507 -+
1.6508 -+ /* Make stack space for the return_value struct. */
1.6509 -+ subq $64, %rsp
1.6510 -+
1.6511 -+ /* Fill in all potential return values to this struct. */
1.6512 -+ movq %rax, (%rsp)
1.6513 -+ movq %rdx, 8(%rsp)
1.6514 -+ movaps %xmm0, 16(%rsp)
1.6515 -+ movaps %xmm1, 32(%rsp)
1.6516 -+ fstpt 48(%rsp)
1.6517 -+
1.6518 -+ /* Now call ffi_fill_return_value. */
1.6519 -+ movq %rsp, %rdi /* struct return_value */
1.6520 -+ movq -24(%rbp), %rsi /* ecif */
1.6521 -+ movq -16(%rbp), %rax /* &ffi_fill_return_value */
1.6522 -+ call *%rax /* call it */
1.6523 -+
1.6524 -+ /* And the work is done. */
1.6525 -+ leave
1.6526 -+ ret
1.6527 -+.LFE1:
1.6528 -+.ffi_call_UNIX64_end:
1.6529 -+ .size ffi_call_UNIX64,.ffi_call_UNIX64_end-ffi_call_UNIX64
1.6530 -+
1.6531 -+.text
1.6532 -+ .align 2
1.6533 -+.globl float2sse
1.6534 -+ .type float2sse,@function
1.6535 -+float2sse:
1.6536 -+ /* Save the contents of this sse-float in a pointer. */
1.6537 -+ movaps %xmm0, (%rdi)
1.6538 -+ ret
1.6539 -+
1.6540 -+ .align 2
1.6541 -+.globl floatfloat2sse
1.6542 -+ .type floatfloat2sse,@function
1.6543 -+floatfloat2sse:
1.6544 -+ /* Save the contents of these two sse-floats in a pointer. */
1.6545 -+ movq (%rdi), %xmm0
1.6546 -+ movaps %xmm0, (%rsi)
1.6547 -+ ret
1.6548 -+
1.6549 -+ .align 2
1.6550 -+.globl double2sse
1.6551 -+ .type double2sse,@function
1.6552 -+double2sse:
1.6553 -+ /* Save the contents of this sse-double in a pointer. */
1.6554 -+ movaps %xmm0, (%rdi)
1.6555 -+ ret
1.6556 -+
1.6557 -+ .align 2
1.6558 -+.globl sse2float
1.6559 -+ .type sse2float,@function
1.6560 -+sse2float:
1.6561 -+ /* Save the contents of this sse-float in a pointer. */
1.6562 -+ movaps (%rdi), %xmm0
1.6563 -+ ret
1.6564 -+
1.6565 -+ .align 2
1.6566 -+.globl sse2double
1.6567 -+ .type sse2double,@function
1.6568 -+sse2double:
1.6569 -+ /* Save the contents of this pointer in a sse-double. */
1.6570 -+ movaps (%rdi), %xmm0
1.6571 -+ ret
1.6572 -+
1.6573 -+ .align 2
1.6574 -+.globl sse2floatfloat
1.6575 -+ .type sse2floatfloat,@function
1.6576 -+sse2floatfloat:
1.6577 -+ /* Save the contents of this pointer in two sse-floats. */
1.6578 -+ movaps (%rdi), %xmm0
1.6579 -+ movq %xmm0, (%rsi)
1.6580 -+ ret
1.6581 -+
1.6582 -+ .align 2
1.6583 -+.globl ffi_closure_UNIX64
1.6584 -+ .type ffi_closure_UNIX64,@function
1.6585 -+
1.6586 -+ffi_closure_UNIX64:
1.6587 -+.LFB2:
1.6588 -+ pushq %rbp
1.6589 -+.LCFI10:
1.6590 -+ movq %rsp, %rbp
1.6591 -+.LCFI11:
1.6592 -+ subq $240, %rsp
1.6593 -+.LCFI12:
1.6594 -+ movq %rdi, -176(%rbp)
1.6595 -+ movq %rsi, -168(%rbp)
1.6596 -+ movq %rdx, -160(%rbp)
1.6597 -+ movq %rcx, -152(%rbp)
1.6598 -+ movq %r8, -144(%rbp)
1.6599 -+ movq %r9, -136(%rbp)
1.6600 -+ /* FIXME: We can avoid all this stashing of XMM registers by
1.6601 -+ (in ffi_prep_closure) computing the number of
1.6602 -+ floating-point args and moving it into %rax before calling
1.6603 -+ this function. Once this is done, uncomment the next few
1.6604 -+ lines and only the essential XMM registers will be written
1.6605 -+ to memory. This is a significant saving. */
1.6606 -+/* movzbl %al, %eax */
1.6607 -+/* movq %rax, %rdx */
1.6608 -+/* leaq 0(,%rdx,4), %rax */
1.6609 -+/* leaq 2f(%rip), %rdx */
1.6610 -+/* subq %rax, %rdx */
1.6611 -+ leaq -1(%rbp), %rax
1.6612 -+/* jmp *%rdx */
1.6613 -+ movaps %xmm7, -15(%rax)
1.6614 -+ movaps %xmm6, -31(%rax)
1.6615 -+ movaps %xmm5, -47(%rax)
1.6616 -+ movaps %xmm4, -63(%rax)
1.6617 -+ movaps %xmm3, -79(%rax)
1.6618 -+ movaps %xmm2, -95(%rax)
1.6619 -+ movaps %xmm1, -111(%rax)
1.6620 -+ movaps %xmm0, -127(%rax)
1.6621 -+2:
1.6622 -+ movl %edi, -180(%rbp)
1.6623 -+ movl $0, -224(%rbp)
1.6624 -+ movl $48, -220(%rbp)
1.6625 -+ leaq 16(%rbp), %rax
1.6626 -+ movq %rax, -216(%rbp)
1.6627 -+ leaq -176(%rbp), %rdx
1.6628 -+ movq %rdx, -208(%rbp)
1.6629 -+ leaq -224(%rbp), %rsi
1.6630 -+ movq %r10, %rdi
1.6631 -+ movq %rsp, %rdx
1.6632 -+ call ffi_closure_UNIX64_inner@PLT
1.6633 -+
1.6634 -+ cmpl $FFI_TYPE_FLOAT, %eax
1.6635 -+ je 1f
1.6636 -+ cmpl $FFI_TYPE_DOUBLE, %eax
1.6637 -+ je 2f
1.6638 -+ cmpl $FFI_TYPE_LONGDOUBLE, %eax
1.6639 -+ je 3f
1.6640 -+ cmpl $FFI_TYPE_STRUCT, %eax
1.6641 -+ je 4f
1.6642 -+ popq %rax
1.6643 -+ leave
1.6644 -+ ret
1.6645 -+1:
1.6646 -+2:
1.6647 -+3:
1.6648 -+ movaps -240(%rbp), %xmm0
1.6649 -+ leave
1.6650 -+ ret
1.6651 -+4:
1.6652 -+ leave
1.6653 -+ ret
1.6654 -+.LFE2:
1.6655 -+
1.6656 -+ .section .eh_frame,"a",@progbits
1.6657 -+.Lframe0:
1.6658 -+ .long .LECIE1-.LSCIE1
1.6659 -+.LSCIE1:
1.6660 -+ .long 0x0
1.6661 -+ .byte 0x1
1.6662 -+ .string "zR"
1.6663 -+ .uleb128 0x1
1.6664 -+ .sleb128 -8
1.6665 -+ .byte 0x10
1.6666 -+ .uleb128 0x1
1.6667 -+ .byte 0x1b
1.6668 -+ .byte 0xc
1.6669 -+ .uleb128 0x7
1.6670 -+ .uleb128 0x8
1.6671 -+ .byte 0x90
1.6672 -+ .uleb128 0x1
1.6673 -+ .align 8
1.6674 -+.LECIE1:
1.6675 -+.LSFDE1:
1.6676 -+ .long .LEFDE1-.LASFDE1
1.6677 -+.LASFDE1:
1.6678 -+ .long .LASFDE1-.Lframe0
1.6679 -+
1.6680 -+ .long .LFB1-.
1.6681 -+ .long .LFE1-.LFB1
1.6682 -+ .uleb128 0x0
1.6683 -+ .byte 0x4 # DW_CFA_advance_loc4
1.6684 -+ .long .LCFI0-.LFB1
1.6685 -+ .byte 0xe # DW_CFA_def_cfa_offset
1.6686 -+ .uleb128 0x10
1.6687 -+ .byte 0x86 # DW_CFA_offset: r6 at cfa-16
1.6688 -+ .uleb128 0x2
1.6689 -+ .byte 0x4 # DW_CFA_advance_loc4
1.6690 -+ .long .LCFI1-.LCFI0
1.6691 -+ .byte 0x86 # DW_CFA_offset: r6 at cfa-16
1.6692 -+ .uleb128 0x2
1.6693 -+ .byte 0xd # DW_CFA_def_cfa_reg: r6
1.6694 -+ .uleb128 0x6
1.6695 -+ .align 8
1.6696 -+.LEFDE1:
1.6697 -+.LSFDE3:
1.6698 -+ .long .LEFDE3-.LASFDE3 # FDE Length
1.6699 -+.LASFDE3:
1.6700 -+ .long .LASFDE3-.Lframe0 # FDE CIE offset
1.6701 -+
1.6702 -+ .long .LFB2-. # FDE initial location
1.6703 -+ .long .LFE2-.LFB2 # FDE address range
1.6704 -+ .uleb128 0x0 # Augmentation size
1.6705 -+ .byte 0x4 # DW_CFA_advance_loc4
1.6706 -+ .long .LCFI10-.LFB2
1.6707 -+ .byte 0xe # DW_CFA_def_cfa_offset
1.6708 -+ .uleb128 0x10
1.6709 -+ .byte 0x86 # DW_CFA_offset, column 0x6
1.6710 -+ .uleb128 0x2
1.6711 -+ .byte 0x4 # DW_CFA_advance_loc4
1.6712 -+ .long .LCFI11-.LCFI10
1.6713 -+ .byte 0xd # DW_CFA_def_cfa_register
1.6714 -+ .uleb128 0x6
1.6715 -+ .align 8
1.6716 -+.LEFDE3:
1.6717 -+
1.6718 -+#endif /* __x86_64__ */
1.6719 -diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/win32.S gcc/libffi/src/x86/win32.S
1.6720 ---- gcc-3.2.2.orig/libffi/src/x86/win32.S Tue Mar 27 11:39:16 2001
1.6721 -+++ gcc/libffi/src/x86/win32.S Fri Dec 6 10:16:45 2002
1.6722 -@@ -1,5 +1,8 @@
1.6723 - /* -----------------------------------------------------------------------
1.6724 -- win32.S - Copyright (c) 1996, 1998, 2001 Cygnus Solutions
1.6725 -+ win32.S - Copyright (c) 1996, 1998, 2001, 2002 Red Hat, Inc.
1.6726 -+ Copyright (c) 2001 John Beniton
1.6727 -+ Copyright (c) 2002 Ranjit Mathew
1.6728 -+
1.6729 -
1.6730 - X86 Foreign Function Interface
1.6731 -
1.6732 -@@ -52,7 +55,10 @@
1.6733 - # Return stack to previous state and call the function
1.6734 - addl $8,%esp
1.6735 -
1.6736 -- call *28(%ebp)
1.6737 -+ # FIXME: Align the stack to a 128-bit boundary to avoid
1.6738 -+ # potential performance hits.
1.6739 -+
1.6740 -+ call *28(%ebp)
1.6741 -
1.6742 - # Remove the space we pushed for the args
1.6743 - movl 16(%ebp),%ecx
1.6744 -@@ -123,3 +129,98 @@
1.6745 - ret
1.6746 -
1.6747 - .ffi_call_SYSV_end:
1.6748 -+
1.6749 -+ # This assumes we are using gas.
1.6750 -+ .balign 16
1.6751 -+.globl _ffi_call_STDCALL
1.6752 -+
1.6753 -+_ffi_call_STDCALL:
1.6754 -+ pushl %ebp
1.6755 -+ movl %esp,%ebp
1.6756 -+
1.6757 -+ # Make room for all of the new args.
1.6758 -+ movl 16(%ebp),%ecx
1.6759 -+ subl %ecx,%esp
1.6760 -+
1.6761 -+ movl %esp,%eax
1.6762 -+
1.6763 -+ # Place all of the ffi_prep_args in position
1.6764 -+ pushl 12(%ebp)
1.6765 -+ pushl %eax
1.6766 -+ call *8(%ebp)
1.6767 -+
1.6768 -+ # Return stack to previous state and call the function
1.6769 -+ addl $8,%esp
1.6770 -+
1.6771 -+ # FIXME: Align the stack to a 128-bit boundary to avoid
1.6772 -+ # potential performance hits.
1.6773 -+
1.6774 -+ call *28(%ebp)
1.6775 -+
1.6776 -+ # stdcall functions pop arguments off the stack themselves
1.6777 -+
1.6778 -+ # Load %ecx with the return type code
1.6779 -+ movl 20(%ebp),%ecx
1.6780 -+
1.6781 -+ # If the return value pointer is NULL, assume no return value.
1.6782 -+ cmpl $0,24(%ebp)
1.6783 -+ jne sc_retint
1.6784 -+
1.6785 -+ # Even if there is no space for the return value, we are
1.6786 -+ # obliged to handle floating-point values.
1.6787 -+ cmpl $FFI_TYPE_FLOAT,%ecx
1.6788 -+ jne sc_noretval
1.6789 -+ fstp %st(0)
1.6790 -+
1.6791 -+ jmp sc_epilogue
1.6792 -+
1.6793 -+sc_retint:
1.6794 -+ cmpl $FFI_TYPE_INT,%ecx
1.6795 -+ jne sc_retfloat
1.6796 -+ # Load %ecx with the pointer to storage for the return value
1.6797 -+ movl 24(%ebp),%ecx
1.6798 -+ movl %eax,0(%ecx)
1.6799 -+ jmp sc_epilogue
1.6800 -+
1.6801 -+sc_retfloat:
1.6802 -+ cmpl $FFI_TYPE_FLOAT,%ecx
1.6803 -+ jne sc_retdouble
1.6804 -+ # Load %ecx with the pointer to storage for the return value
1.6805 -+ movl 24(%ebp),%ecx
1.6806 -+ fstps (%ecx)
1.6807 -+ jmp sc_epilogue
1.6808 -+
1.6809 -+sc_retdouble:
1.6810 -+ cmpl $FFI_TYPE_DOUBLE,%ecx
1.6811 -+ jne sc_retlongdouble
1.6812 -+ # Load %ecx with the pointer to storage for the return value
1.6813 -+ movl 24(%ebp),%ecx
1.6814 -+ fstpl (%ecx)
1.6815 -+ jmp sc_epilogue
1.6816 -+
1.6817 -+sc_retlongdouble:
1.6818 -+ cmpl $FFI_TYPE_LONGDOUBLE,%ecx
1.6819 -+ jne sc_retint64
1.6820 -+ # Load %ecx with the pointer to storage for the return value
1.6821 -+ movl 24(%ebp),%ecx
1.6822 -+ fstpt (%ecx)
1.6823 -+ jmp sc_epilogue
1.6824 -+
1.6825 -+sc_retint64:
1.6826 -+ cmpl $FFI_TYPE_SINT64,%ecx
1.6827 -+ jne sc_retstruct
1.6828 -+ # Load %ecx with the pointer to storage for the return value
1.6829 -+ movl 24(%ebp),%ecx
1.6830 -+ movl %eax,0(%ecx)
1.6831 -+ movl %edx,4(%ecx)
1.6832 -+
1.6833 -+sc_retstruct:
1.6834 -+ # Nothing to do!
1.6835 -+
1.6836 -+sc_noretval:
1.6837 -+sc_epilogue:
1.6838 -+ movl %ebp,%esp
1.6839 -+ popl %ebp
1.6840 -+ ret
1.6841 -+
1.6842 -+.ffi_call_STDCALL_end:
1.6843 ---- gcc-3.2.2.orig/libjava/configure.host Mon Jun 10 13:15:26 2002
1.6844 -+++ gcc-3.2.2/libjava/configure.host Sat Feb 15 19:57:25 2003
1.6845 -@@ -115,6 +115,12 @@
1.6846 - enable_getenv_properties_default=no
1.6847 - enable_main_args_default=no
1.6848 - ;;
1.6849 -+ sh-* | sh[34]*-*)
1.6850 -+ sysdeps_dir=sh
1.6851 -+ libgcj_flags="${libgcj_flags} -mieee"
1.6852 -+ libgcj_interpreter=yes
1.6853 -+ enable_hash_synchronization_default=yes
1.6854 -+ ;;
1.6855 - esac
1.6856 -
1.6857 - # This case statement supports generic port properties and may refine
1.6858 -@@ -126,7 +132,8 @@
1.6859 - powerpc*-linux* | \
1.6860 - alpha*-linux* | \
1.6861 - sparc*-linux* | \
1.6862 -- ia64-*)
1.6863 -+ ia64-* | \
1.6864 -+ sh-linux* | sh[34]*-linux*)
1.6865 - can_unwind_signal=yes
1.6866 - ;;
1.6867 - *-*-darwin*)