summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/packages/gcc/gcc-4.2.2/100-uclibc-conf.patch200
-rw-r--r--meta/packages/gcc/gcc-4.2.2/103-uclibc-conf-noupstream.patch11
-rw-r--r--meta/packages/gcc/gcc-4.2.2/110-arm-eabi.patch27
-rw-r--r--meta/packages/gcc/gcc-4.2.2/200-uclibc-locale.patch2790
-rw-r--r--meta/packages/gcc/gcc-4.2.2/203-uclibc-locale-no__x.patch213
-rw-r--r--meta/packages/gcc/gcc-4.2.2/204-uclibc-locale-wchar_fix.patch48
-rw-r--r--meta/packages/gcc/gcc-4.2.2/205-uclibc-locale-update.patch347
-rw-r--r--meta/packages/gcc/gcc-4.2.2/300-libstdc++-pic.patch46
-rw-r--r--meta/packages/gcc/gcc-4.2.2/301-missing-execinfo_h.patch11
-rw-r--r--meta/packages/gcc/gcc-4.2.2/302-c99-snprintf.patch11
-rw-r--r--meta/packages/gcc/gcc-4.2.2/303-c99-complex-ugly-hack.patch12
-rw-r--r--meta/packages/gcc/gcc-4.2.2/304-index_macro.patch24
-rw-r--r--meta/packages/gcc/gcc-4.2.2/305-libmudflap-susv3-legacy.patch49
-rw-r--r--meta/packages/gcc/gcc-4.2.2/306-libstdc++-namespace.patch36
-rw-r--r--meta/packages/gcc/gcc-4.2.2/307-locale_facets.patch26
-rw-r--r--meta/packages/gcc/gcc-4.2.2/402-libbackend_dep_gcov-iov.h.patch13
-rw-r--r--meta/packages/gcc/gcc-4.2.2/602-sdk-libstdc++-includes.patch20
-rw-r--r--meta/packages/gcc/gcc-4.2.2/740-sh-pr24836.patch25
-rw-r--r--meta/packages/gcc/gcc-4.2.2/800-arm-bigendian.patch67
-rw-r--r--meta/packages/gcc/gcc-4.2.2/801-arm-bigendian-eabi.patch14
-rw-r--r--meta/packages/gcc/gcc-4.2.2/904-flatten-switch-stmt-00.patch153
-rw-r--r--meta/packages/gcc/gcc-4.2.2/README4
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-20000320.patch11
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-32bit-disable.patch85
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable-4.2.0.patch169
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable0.patch47
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-and-or.patch67
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvt64-disable.patch19
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvtds-disable.patch32
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-cirrus-bugfixes.patch573
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-geu.patch48
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch98
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch-z-eq98
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch400
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch-z-eq400
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-dominance.patch12
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754-div.patch139
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754.patch100
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi.patch64
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable-single.patch38
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable.patch61
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-floatunsidf.patch37
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-fp_consts.patch13
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-neg.patch30
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-neg2.patch25
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-offset.patch20
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates.patch20
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates2.patch10
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates3.patch116
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-saveregs.patch153
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-scc.patch38
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable-new.patch33
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable.patch56
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-nolibfloat.patch24
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-softfloat.patch16
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-thumb-cache.patch29
-rw-r--r--meta/packages/gcc/gcc-4.2.2/arm-thumb.patch64
-rw-r--r--meta/packages/gcc/gcc-4.2.2/cache-amnesia.patch13
-rw-r--r--meta/packages/gcc/gcc-4.2.2/fix-ICE-in-arm_unwind_emit_set.diff18
-rw-r--r--meta/packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch30
-rw-r--r--meta/packages/gcc/gcc-4.2.2/fortran-static-linking.patch48
-rw-r--r--meta/packages/gcc/gcc-4.2.2/gcc-4.0.2-e300c2c3.patch311
-rw-r--r--meta/packages/gcc/gcc-4.2.2/gcc41-configure.in.patch22
-rw-r--r--meta/packages/gcc/gcc-4.2.2/gfortran.patch40
-rw-r--r--meta/packages/gcc/gcc-4.2.2/intermask-bigendian.patch24
-rw-r--r--meta/packages/gcc/gcc-4.2.2/ldflags.patch22
-rw-r--r--meta/packages/gcc/gcc-4.2.2/pr34130.patch16
-rw-r--r--meta/packages/gcc/gcc-4.2.2/sdk-libstdc++-includes.patch22
-rw-r--r--meta/packages/gcc/gcc-4.2.2/sh3-installfix-fixheaders.patch11
-rw-r--r--meta/packages/gcc/gcc-4.2.2/unbreak-armv4t.patch12
-rw-r--r--meta/packages/gcc/gcc-4.2.2/zecke-no-host-includes.patch31
-rw-r--r--meta/packages/gcc/gcc-4.2.2/zecke-xgcc-cpp.patch16
-rw-r--r--meta/packages/gcc/gcc-cross-initial_4.2.2.bb5
-rw-r--r--meta/packages/gcc/gcc-cross-sdk_4.2.2.bb21
-rw-r--r--meta/packages/gcc/gcc-cross_4.2.2.bb22
-rw-r--r--meta/packages/gcc/gcc_4.2.2.bb96
76 files changed, 8072 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.2.2/100-uclibc-conf.patch b/meta/packages/gcc/gcc-4.2.2/100-uclibc-conf.patch
new file mode 100644
index 0000000000..4243ff7b91
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/100-uclibc-conf.patch
@@ -0,0 +1,200 @@
1--- gcc/libgomp/configure
2+++ gcc/libgomp/configure
3@@ -3771,7 +3771,7 @@
4 ;;
5
6 # This must be Linux ELF.
7-linux-gnu*)
8+linux*)
9 lt_cv_deplibs_check_method=pass_all
10 ;;
11
12--- gcc/gcc/config/cris/linux.h
13+++ gcc/gcc/config/cris/linux.h
14@@ -74,7 +74,11 @@
15 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
16
17 #undef CRIS_SUBTARGET_VERSION
18-#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
19+#if UCLIBC_DEFAULT
20+# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
21+#else
22+# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
23+#endif
24
25 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
26
27--- gcc/libstdc++-v3/configure
28+++ gcc/libstdc++-v3/configure
29@@ -4276,7 +4276,7 @@
30 ;;
31
32 # This must be Linux ELF.
33-linux-gnu*)
34+linux*)
35 lt_cv_deplibs_check_method=pass_all
36 ;;
37
38--- gcc/zlib/configure
39+++ gcc/zlib/configure
40@@ -3422,7 +3422,7 @@
41 ;;
42
43 # This must be Linux ELF.
44-linux-gnu*)
45+linux*)
46 lt_cv_deplibs_check_method=pass_all
47 ;;
48
49--- gcc/libobjc/configure
50+++ gcc/libobjc/configure
51@@ -3309,7 +3309,7 @@
52 ;;
53
54 # This must be Linux ELF.
55-linux-gnu*)
56+linux*)
57 lt_cv_deplibs_check_method=pass_all
58 ;;
59
60--- gcc/libgfortran/configure
61+++ gcc/libgfortran/configure
62@@ -3695,7 +3695,7 @@
63 ;;
64
65 # This must be Linux ELF.
66-linux-gnu*)
67+linux*)
68 lt_cv_deplibs_check_method=pass_all
69 ;;
70
71--- gcc/libmudflap/configure
72+++ gcc/libmudflap/configure
73@@ -5378,7 +5378,7 @@
74 ;;
75
76 # This must be Linux ELF.
77-linux-gnu*)
78+linux*)
79 lt_cv_deplibs_check_method=pass_all
80 ;;
81
82--- gcc/boehm-gc/configure
83+++ gcc/boehm-gc/configure
84@@ -4316,7 +4316,7 @@
85 ;;
86
87 # This must be Linux ELF.
88-linux-gnu*)
89+linux*)
90 lt_cv_deplibs_check_method=pass_all
91 ;;
92
93--- gcc/libffi/configure
94+++ gcc/libffi/configure
95@@ -3453,7 +3453,7 @@
96 ;;
97
98 # This must be Linux ELF.
99-linux-gnu*)
100+linux*)
101 lt_cv_deplibs_check_method=pass_all
102 ;;
103
104--- gcc/libssp/configure
105+++ gcc/libssp/configure
106@@ -4409,7 +4409,7 @@
107 ;;
108
109 # This must be Linux ELF.
110-linux-gnu*)
111+linux*)
112 lt_cv_deplibs_check_method=pass_all
113 ;;
114
115--- gcc/contrib/regression/objs-gcc.sh
116+++ gcc/contrib/regression/objs-gcc.sh
117@@ -105,6 +105,10 @@
118 then
119 make all-gdb all-dejagnu all-ld || exit 1
120 make install-gdb install-dejagnu install-ld || exit 1
121+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
122+ then
123+ make all-gdb all-dejagnu all-ld || exit 1
124+ make install-gdb install-dejagnu install-ld || exit 1
125 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
126 make bootstrap || exit 1
127 make install || exit 1
128--- gcc/libjava/classpath/ltconfig
129+++ gcc/libjava/classpath/ltconfig
130@@ -603,7 +603,7 @@
131
132 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
133 case $host_os in
134-linux-gnu*) ;;
135+linux-gnu*|linux-uclibc*) ;;
136 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
137 esac
138
139@@ -1251,7 +1251,7 @@
140 ;;
141
142 # This must be Linux ELF.
143-linux-gnu*)
144+linux*)
145 version_type=linux
146 need_lib_prefix=no
147 need_version=no
148--- gcc/libjava/classpath/configure
149+++ gcc/libjava/classpath/configure
150@@ -4665,7 +4665,7 @@
151 ;;
152
153 # This must be Linux ELF.
154-linux-gnu*)
155+linux*)
156 lt_cv_deplibs_check_method=pass_all
157 ;;
158
159--- gcc/libjava/configure
160+++ gcc/libjava/configure
161@@ -5212,7 +5212,7 @@
162 ;;
163
164 # This must be Linux ELF.
165-linux-gnu*)
166+linux*)
167 lt_cv_deplibs_check_method=pass_all
168 ;;
169
170--- gcc/libtool.m4
171+++ gcc/libtool.m4
172@@ -739,7 +739,7 @@
173 ;;
174
175 # This must be Linux ELF.
176-linux-gnu*)
177+linux*)
178 lt_cv_deplibs_check_method=pass_all
179 ;;
180
181--- gcc/ltconfig
182+++ gcc/ltconfig
183@@ -603,7 +603,7 @@
184
185 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
186 case $host_os in
187-linux-gnu*) ;;
188+linux-gnu*|linux-uclibc*) ;;
189 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
190 esac
191
192@@ -1251,7 +1251,7 @@
193 ;;
194
195 # This must be Linux ELF.
196-linux-gnu*)
197+linux*)
198 version_type=linux
199 need_lib_prefix=no
200 need_version=no
diff --git a/meta/packages/gcc/gcc-4.2.2/103-uclibc-conf-noupstream.patch b/meta/packages/gcc/gcc-4.2.2/103-uclibc-conf-noupstream.patch
new file mode 100644
index 0000000000..09c9bbecfb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/103-uclibc-conf-noupstream.patch
@@ -0,0 +1,11 @@
1--- gcc/gcc/config.gcc.uclibc100-sh~ 2006-03-06 20:46:56 +0100
2+++ gcc/gcc/config.gcc 2006-03-10 15:02:41 +0100
3@@ -1905,7 +1905,7 @@
4 ;;
5 sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
6 sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
7- sh-*-linux* | sh[346lbe]*-*-linux* | \
8+ sh*-*-linux* | sh[346lbe]*-*-linux* | \
9 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
10 sh64-*-netbsd* | sh64l*-*-netbsd*)
11 tmake_file="${tmake_file} sh/t-sh sh/t-elf"
diff --git a/meta/packages/gcc/gcc-4.2.2/110-arm-eabi.patch b/meta/packages/gcc/gcc-4.2.2/110-arm-eabi.patch
new file mode 100644
index 0000000000..acebe5308f
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/110-arm-eabi.patch
@@ -0,0 +1,27 @@
1--- gcc-2005q3-1.orig/gcc/config.gcc 2005-10-31 19:02:54.000000000 +0300
2+++ gcc-2005q3-1/gcc/config.gcc 2006-01-27 01:09:09.000000000 +0300
3@@ -674,7 +674,7 @@
4 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
5 tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm"
6 case ${target} in
7- arm*-*-linux-gnueabi)
8+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
9 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
10 tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
11 # The BPABI long long divmod functions return a 128-bit value in
12
13diff -urN gcc-2005q3-2/gcc/config/arm/linux-eabi.h gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h
14--- gcc-2005q3-2/gcc/config/arm/linux-eabi.h 2005-12-07 23:14:16.000000000 +0300
15+++ gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h 2006-03-29 19:02:34.000000000 +0400
16@@ -53,7 +53,11 @@
17 /* Use ld-linux.so.3 so that it will be possible to run "classic"
18 GNU/Linux binaries on an EABI system. */
19 #undef LINUX_TARGET_INTERPRETER
20+#ifdef USE_UCLIBC
21+#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
22+#else
23 #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3"
24+#endif
25
26 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
27 use the GNU/Linux version, not the generic BPABI version. */
diff --git a/meta/packages/gcc/gcc-4.2.2/200-uclibc-locale.patch b/meta/packages/gcc/gcc-4.2.2/200-uclibc-locale.patch
new file mode 100644
index 0000000000..ea21388b75
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/200-uclibc-locale.patch
@@ -0,0 +1,2790 @@
1--- gcc/libstdc++-v3/acinclude.m4
2+++ gcc/libstdc++-v3/acinclude.m4
3@@ -1369,7 +1369,7 @@
4 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
5 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
6 [use MODEL for target locale package],
7- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
8+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
9
10 # Deal with gettext issues. Default to not using it (=no) until we detect
11 # support for it later. Let the user turn it off via --e/d, but let that
12@@ -1385,6 +1385,9 @@
13 # Default to "generic".
14 if test $enable_clocale_flag = auto; then
15 case ${target_os} in
16+ *-uclibc*)
17+ enable_clocale_flag=uclibc
18+ ;;
19 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
20 AC_EGREP_CPP([_GLIBCXX_ok], [
21 #include <features.h>
22@@ -1528,6 +1531,40 @@
23 CTIME_CC=config/locale/generic/time_members.cc
24 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
25 ;;
26+ uclibc)
27+ AC_MSG_RESULT(uclibc)
28+
29+ # Declare intention to use gettext, and add support for specific
30+ # languages.
31+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
32+ ALL_LINGUAS="de fr"
33+
34+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
35+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
36+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
37+ USE_NLS=yes
38+ fi
39+ # Export the build objects.
40+ for ling in $ALL_LINGUAS; do \
41+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
42+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
43+ done
44+ AC_SUBST(glibcxx_MOFILES)
45+ AC_SUBST(glibcxx_POFILES)
46+
47+ CLOCALE_H=config/locale/uclibc/c_locale.h
48+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
49+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
50+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
51+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
52+ CMESSAGES_H=config/locale/uclibc/messages_members.h
53+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
54+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
55+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
56+ CTIME_H=config/locale/uclibc/time_members.h
57+ CTIME_CC=config/locale/uclibc/time_members.cc
58+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
59+ ;;
60 esac
61
62 # This is where the testsuite looks for locale catalogs, using the
63--- gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
64+++ gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
65@@ -0,0 +1,63 @@
66+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
67+
68+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
69+//
70+// This file is part of the GNU ISO C++ Library. This library is free
71+// software; you can redistribute it and/or modify it under the
72+// terms of the GNU General Public License as published by the
73+// Free Software Foundation; either version 2, or (at your option)
74+// any later version.
75+
76+// This library is distributed in the hope that it will be useful,
77+// but WITHOUT ANY WARRANTY; without even the implied warranty of
78+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79+// GNU General Public License for more details.
80+
81+// You should have received a copy of the GNU General Public License along
82+// with this library; see the file COPYING. If not, write to the Free
83+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
84+// USA.
85+
86+// As a special exception, you may use this file as part of a free software
87+// library without restriction. Specifically, if other files instantiate
88+// templates or use macros or inline functions from this file, or you compile
89+// this file and link it with other files to produce an executable, this
90+// file does not by itself cause the resulting executable to be covered by
91+// the GNU General Public License. This exception does not however
92+// invalidate any other reasons why the executable file might be covered by
93+// the GNU General Public License.
94+
95+// Written by Jakub Jelinek <jakub@redhat.com>
96+
97+#include <bits/c++config.h>
98+#include <clocale>
99+
100+#ifdef __UCLIBC_MJN3_ONLY__
101+#warning clean this up
102+#endif
103+
104+#ifdef __UCLIBC_HAS_XLOCALE__
105+
106+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
107+extern "C" __typeof(strcoll_l) __strcoll_l;
108+extern "C" __typeof(strftime_l) __strftime_l;
109+extern "C" __typeof(strtod_l) __strtod_l;
110+extern "C" __typeof(strtof_l) __strtof_l;
111+extern "C" __typeof(strtold_l) __strtold_l;
112+extern "C" __typeof(strxfrm_l) __strxfrm_l;
113+extern "C" __typeof(newlocale) __newlocale;
114+extern "C" __typeof(freelocale) __freelocale;
115+extern "C" __typeof(duplocale) __duplocale;
116+extern "C" __typeof(uselocale) __uselocale;
117+
118+#ifdef _GLIBCXX_USE_WCHAR_T
119+extern "C" __typeof(iswctype_l) __iswctype_l;
120+extern "C" __typeof(towlower_l) __towlower_l;
121+extern "C" __typeof(towupper_l) __towupper_l;
122+extern "C" __typeof(wcscoll_l) __wcscoll_l;
123+extern "C" __typeof(wcsftime_l) __wcsftime_l;
124+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
125+extern "C" __typeof(wctype_l) __wctype_l;
126+#endif
127+
128+#endif // GLIBC 2.3 and later
129--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc
130+++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc
131@@ -0,0 +1,160 @@
132+// Wrapper for underlying C-language localization -*- C++ -*-
133+
134+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
135+//
136+// This file is part of the GNU ISO C++ Library. This library is free
137+// software; you can redistribute it and/or modify it under the
138+// terms of the GNU General Public License as published by the
139+// Free Software Foundation; either version 2, or (at your option)
140+// any later version.
141+
142+// This library is distributed in the hope that it will be useful,
143+// but WITHOUT ANY WARRANTY; without even the implied warranty of
144+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145+// GNU General Public License for more details.
146+
147+// You should have received a copy of the GNU General Public License along
148+// with this library; see the file COPYING. If not, write to the Free
149+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
150+// USA.
151+
152+// As a special exception, you may use this file as part of a free software
153+// library without restriction. Specifically, if other files instantiate
154+// templates or use macros or inline functions from this file, or you compile
155+// this file and link it with other files to produce an executable, this
156+// file does not by itself cause the resulting executable to be covered by
157+// the GNU General Public License. This exception does not however
158+// invalidate any other reasons why the executable file might be covered by
159+// the GNU General Public License.
160+
161+//
162+// ISO C++ 14882: 22.8 Standard locale categories.
163+//
164+
165+// Written by Benjamin Kosnik <bkoz@redhat.com>
166+
167+#include <cerrno> // For errno
168+#include <locale>
169+#include <stdexcept>
170+#include <langinfo.h>
171+#include <bits/c++locale_internal.h>
172+
173+#ifndef __UCLIBC_HAS_XLOCALE__
174+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
175+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
176+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
177+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
178+#define __strtof_l(S, E, L) strtof((S), (E))
179+#define __strtod_l(S, E, L) strtod((S), (E))
180+#define __strtold_l(S, E, L) strtold((S), (E))
181+#warning should dummy __newlocale check for C|POSIX ?
182+#define __newlocale(a, b, c) NULL
183+#define __freelocale(a) ((void)0)
184+#define __duplocale(a) __c_locale()
185+#endif
186+
187+namespace std
188+{
189+ template<>
190+ void
191+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
192+ const __c_locale& __cloc)
193+ {
194+ if (!(__err & ios_base::failbit))
195+ {
196+ char* __sanity;
197+ errno = 0;
198+ float __f = __strtof_l(__s, &__sanity, __cloc);
199+ if (__sanity != __s && errno != ERANGE)
200+ __v = __f;
201+ else
202+ __err |= ios_base::failbit;
203+ }
204+ }
205+
206+ template<>
207+ void
208+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
209+ const __c_locale& __cloc)
210+ {
211+ if (!(__err & ios_base::failbit))
212+ {
213+ char* __sanity;
214+ errno = 0;
215+ double __d = __strtod_l(__s, &__sanity, __cloc);
216+ if (__sanity != __s && errno != ERANGE)
217+ __v = __d;
218+ else
219+ __err |= ios_base::failbit;
220+ }
221+ }
222+
223+ template<>
224+ void
225+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
226+ const __c_locale& __cloc)
227+ {
228+ if (!(__err & ios_base::failbit))
229+ {
230+ char* __sanity;
231+ errno = 0;
232+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
233+ if (__sanity != __s && errno != ERANGE)
234+ __v = __ld;
235+ else
236+ __err |= ios_base::failbit;
237+ }
238+ }
239+
240+ void
241+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
242+ __c_locale __old)
243+ {
244+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
245+#ifdef __UCLIBC_HAS_XLOCALE__
246+ if (!__cloc)
247+ {
248+ // This named locale is not supported by the underlying OS.
249+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
250+ "name not valid"));
251+ }
252+#endif
253+ }
254+
255+ void
256+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
257+ {
258+ if (_S_get_c_locale() != __cloc)
259+ __freelocale(__cloc);
260+ }
261+
262+ __c_locale
263+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
264+ { return __duplocale(__cloc); }
265+} // namespace std
266+
267+namespace __gnu_cxx
268+{
269+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
270+ {
271+ "LC_CTYPE",
272+ "LC_NUMERIC",
273+ "LC_TIME",
274+ "LC_COLLATE",
275+ "LC_MONETARY",
276+ "LC_MESSAGES",
277+#if _GLIBCXX_NUM_CATEGORIES != 0
278+ "LC_PAPER",
279+ "LC_NAME",
280+ "LC_ADDRESS",
281+ "LC_TELEPHONE",
282+ "LC_MEASUREMENT",
283+ "LC_IDENTIFICATION"
284+#endif
285+ };
286+}
287+
288+namespace std
289+{
290+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
291+} // namespace std
292--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.h
293+++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.h
294@@ -0,0 +1,117 @@
295+// Wrapper for underlying C-language localization -*- C++ -*-
296+
297+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
298+//
299+// This file is part of the GNU ISO C++ Library. This library is free
300+// software; you can redistribute it and/or modify it under the
301+// terms of the GNU General Public License as published by the
302+// Free Software Foundation; either version 2, or (at your option)
303+// any later version.
304+
305+// This library is distributed in the hope that it will be useful,
306+// but WITHOUT ANY WARRANTY; without even the implied warranty of
307+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
308+// GNU General Public License for more details.
309+
310+// You should have received a copy of the GNU General Public License along
311+// with this library; see the file COPYING. If not, write to the Free
312+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
313+// USA.
314+
315+// As a special exception, you may use this file as part of a free software
316+// library without restriction. Specifically, if other files instantiate
317+// templates or use macros or inline functions from this file, or you compile
318+// this file and link it with other files to produce an executable, this
319+// file does not by itself cause the resulting executable to be covered by
320+// the GNU General Public License. This exception does not however
321+// invalidate any other reasons why the executable file might be covered by
322+// the GNU General Public License.
323+
324+//
325+// ISO C++ 14882: 22.8 Standard locale categories.
326+//
327+
328+// Written by Benjamin Kosnik <bkoz@redhat.com>
329+
330+#ifndef _C_LOCALE_H
331+#define _C_LOCALE_H 1
332+
333+#pragma GCC system_header
334+
335+#include <cstring> // get std::strlen
336+#include <cstdio> // get std::snprintf or std::sprintf
337+#include <clocale>
338+#include <langinfo.h> // For codecvt
339+#ifdef __UCLIBC_MJN3_ONLY__
340+#warning fix this
341+#endif
342+#ifdef __UCLIBC_HAS_LOCALE__
343+#include <iconv.h> // For codecvt using iconv, iconv_t
344+#endif
345+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
346+#include <libintl.h> // For messages
347+#endif
348+
349+#ifdef __UCLIBC_MJN3_ONLY__
350+#warning what is _GLIBCXX_C_LOCALE_GNU for
351+#endif
352+#define _GLIBCXX_C_LOCALE_GNU 1
353+
354+#ifdef __UCLIBC_MJN3_ONLY__
355+#warning fix categories
356+#endif
357+// #define _GLIBCXX_NUM_CATEGORIES 6
358+#define _GLIBCXX_NUM_CATEGORIES 0
359+
360+#ifdef __UCLIBC_HAS_XLOCALE__
361+namespace __gnu_cxx
362+{
363+ extern "C" __typeof(uselocale) __uselocale;
364+}
365+#endif
366+
367+namespace std
368+{
369+#ifdef __UCLIBC_HAS_XLOCALE__
370+ typedef __locale_t __c_locale;
371+#else
372+ typedef int* __c_locale;
373+#endif
374+
375+ // Convert numeric value of type _Tv to string and return length of
376+ // string. If snprintf is available use it, otherwise fall back to
377+ // the unsafe sprintf which, in general, can be dangerous and should
378+ // be avoided.
379+ template<typename _Tv>
380+ int
381+ __convert_from_v(char* __out,
382+ const int __size __attribute__ ((__unused__)),
383+ const char* __fmt,
384+#ifdef __UCLIBC_HAS_XCLOCALE__
385+ _Tv __v, const __c_locale& __cloc, int __prec)
386+ {
387+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
388+#else
389+ _Tv __v, const __c_locale&, int __prec)
390+ {
391+# ifdef __UCLIBC_HAS_LOCALE__
392+ char* __old = std::setlocale(LC_ALL, NULL);
393+ char* __sav = new char[std::strlen(__old) + 1];
394+ std::strcpy(__sav, __old);
395+ std::setlocale(LC_ALL, "C");
396+# endif
397+#endif
398+
399+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
400+
401+#ifdef __UCLIBC_HAS_XCLOCALE__
402+ __gnu_cxx::__uselocale(__old);
403+#elif defined __UCLIBC_HAS_LOCALE__
404+ std::setlocale(LC_ALL, __sav);
405+ delete [] __sav;
406+#endif
407+ return __ret;
408+ }
409+}
410+
411+#endif
412--- gcc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
413+++ gcc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
414@@ -0,0 +1,306 @@
415+// std::codecvt implementation details, GNU version -*- C++ -*-
416+
417+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
418+//
419+// This file is part of the GNU ISO C++ Library. This library is free
420+// software; you can redistribute it and/or modify it under the
421+// terms of the GNU General Public License as published by the
422+// Free Software Foundation; either version 2, or (at your option)
423+// any later version.
424+
425+// This library is distributed in the hope that it will be useful,
426+// but WITHOUT ANY WARRANTY; without even the implied warranty of
427+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
428+// GNU General Public License for more details.
429+
430+// You should have received a copy of the GNU General Public License along
431+// with this library; see the file COPYING. If not, write to the Free
432+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
433+// USA.
434+
435+// As a special exception, you may use this file as part of a free software
436+// library without restriction. Specifically, if other files instantiate
437+// templates or use macros or inline functions from this file, or you compile
438+// this file and link it with other files to produce an executable, this
439+// file does not by itself cause the resulting executable to be covered by
440+// the GNU General Public License. This exception does not however
441+// invalidate any other reasons why the executable file might be covered by
442+// the GNU General Public License.
443+
444+//
445+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
446+//
447+
448+// Written by Benjamin Kosnik <bkoz@redhat.com>
449+
450+#include <locale>
451+#include <bits/c++locale_internal.h>
452+
453+namespace std
454+{
455+ // Specializations.
456+#ifdef _GLIBCXX_USE_WCHAR_T
457+ codecvt_base::result
458+ codecvt<wchar_t, char, mbstate_t>::
459+ do_out(state_type& __state, const intern_type* __from,
460+ const intern_type* __from_end, const intern_type*& __from_next,
461+ extern_type* __to, extern_type* __to_end,
462+ extern_type*& __to_next) const
463+ {
464+ result __ret = ok;
465+ state_type __tmp_state(__state);
466+
467+#ifdef __UCLIBC_HAS_XLOCALE__
468+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
469+#endif
470+
471+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
472+ // in case we fall back to wcrtomb and then continue, in a loop.
473+ // NB: wcsnrtombs is a GNU extension
474+ for (__from_next = __from, __to_next = __to;
475+ __from_next < __from_end && __to_next < __to_end
476+ && __ret == ok;)
477+ {
478+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
479+ __from_end - __from_next);
480+ if (!__from_chunk_end)
481+ __from_chunk_end = __from_end;
482+
483+ __from = __from_next;
484+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
485+ __from_chunk_end - __from_next,
486+ __to_end - __to_next, &__state);
487+ if (__conv == static_cast<size_t>(-1))
488+ {
489+ // In case of error, in order to stop at the exact place we
490+ // have to start again from the beginning with a series of
491+ // wcrtomb.
492+ for (; __from < __from_next; ++__from)
493+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
494+ __state = __tmp_state;
495+ __ret = error;
496+ }
497+ else if (__from_next && __from_next < __from_chunk_end)
498+ {
499+ __to_next += __conv;
500+ __ret = partial;
501+ }
502+ else
503+ {
504+ __from_next = __from_chunk_end;
505+ __to_next += __conv;
506+ }
507+
508+ if (__from_next < __from_end && __ret == ok)
509+ {
510+ extern_type __buf[MB_LEN_MAX];
511+ __tmp_state = __state;
512+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
513+ if (__conv > static_cast<size_t>(__to_end - __to_next))
514+ __ret = partial;
515+ else
516+ {
517+ memcpy(__to_next, __buf, __conv);
518+ __state = __tmp_state;
519+ __to_next += __conv;
520+ ++__from_next;
521+ }
522+ }
523+ }
524+
525+#ifdef __UCLIBC_HAS_XLOCALE__
526+ __uselocale(__old);
527+#endif
528+
529+ return __ret;
530+ }
531+
532+ codecvt_base::result
533+ codecvt<wchar_t, char, mbstate_t>::
534+ do_in(state_type& __state, const extern_type* __from,
535+ const extern_type* __from_end, const extern_type*& __from_next,
536+ intern_type* __to, intern_type* __to_end,
537+ intern_type*& __to_next) const
538+ {
539+ result __ret = ok;
540+ state_type __tmp_state(__state);
541+
542+#ifdef __UCLIBC_HAS_XLOCALE__
543+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
544+#endif
545+
546+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
547+ // in case we store a L'\0' and then continue, in a loop.
548+ // NB: mbsnrtowcs is a GNU extension
549+ for (__from_next = __from, __to_next = __to;
550+ __from_next < __from_end && __to_next < __to_end
551+ && __ret == ok;)
552+ {
553+ const extern_type* __from_chunk_end;
554+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
555+ __from_end
556+ - __from_next));
557+ if (!__from_chunk_end)
558+ __from_chunk_end = __from_end;
559+
560+ __from = __from_next;
561+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
562+ __from_chunk_end - __from_next,
563+ __to_end - __to_next, &__state);
564+ if (__conv == static_cast<size_t>(-1))
565+ {
566+ // In case of error, in order to stop at the exact place we
567+ // have to start again from the beginning with a series of
568+ // mbrtowc.
569+ for (;; ++__to_next, __from += __conv)
570+ {
571+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
572+ &__tmp_state);
573+ if (__conv == static_cast<size_t>(-1)
574+ || __conv == static_cast<size_t>(-2))
575+ break;
576+ }
577+ __from_next = __from;
578+ __state = __tmp_state;
579+ __ret = error;
580+ }
581+ else if (__from_next && __from_next < __from_chunk_end)
582+ {
583+ // It is unclear what to return in this case (see DR 382).
584+ __to_next += __conv;
585+ __ret = partial;
586+ }
587+ else
588+ {
589+ __from_next = __from_chunk_end;
590+ __to_next += __conv;
591+ }
592+
593+ if (__from_next < __from_end && __ret == ok)
594+ {
595+ if (__to_next < __to_end)
596+ {
597+ // XXX Probably wrong for stateful encodings
598+ __tmp_state = __state;
599+ ++__from_next;
600+ *__to_next++ = L'\0';
601+ }
602+ else
603+ __ret = partial;
604+ }
605+ }
606+
607+#ifdef __UCLIBC_HAS_XLOCALE__
608+ __uselocale(__old);
609+#endif
610+
611+ return __ret;
612+ }
613+
614+ int
615+ codecvt<wchar_t, char, mbstate_t>::
616+ do_encoding() const throw()
617+ {
618+ // XXX This implementation assumes that the encoding is
619+ // stateless and is either single-byte or variable-width.
620+ int __ret = 0;
621+#ifdef __UCLIBC_HAS_XLOCALE__
622+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
623+#endif
624+ if (MB_CUR_MAX == 1)
625+ __ret = 1;
626+#ifdef __UCLIBC_HAS_XLOCALE__
627+ __uselocale(__old);
628+#endif
629+ return __ret;
630+ }
631+
632+ int
633+ codecvt<wchar_t, char, mbstate_t>::
634+ do_max_length() const throw()
635+ {
636+#ifdef __UCLIBC_HAS_XLOCALE__
637+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
638+#endif
639+ // XXX Probably wrong for stateful encodings.
640+ int __ret = MB_CUR_MAX;
641+#ifdef __UCLIBC_HAS_XLOCALE__
642+ __uselocale(__old);
643+#endif
644+ return __ret;
645+ }
646+
647+ int
648+ codecvt<wchar_t, char, mbstate_t>::
649+ do_length(state_type& __state, const extern_type* __from,
650+ const extern_type* __end, size_t __max) const
651+ {
652+ int __ret = 0;
653+ state_type __tmp_state(__state);
654+
655+#ifdef __UCLIBC_HAS_XLOCALE__
656+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
657+#endif
658+
659+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
660+ // in case we advance past it and then continue, in a loop.
661+ // NB: mbsnrtowcs is a GNU extension
662+
663+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
664+ // its fourth parameter (it wouldn't with NULL as first parameter).
665+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
666+ * __max));
667+ while (__from < __end && __max)
668+ {
669+ const extern_type* __from_chunk_end;
670+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
671+ __end
672+ - __from));
673+ if (!__from_chunk_end)
674+ __from_chunk_end = __end;
675+
676+ const extern_type* __tmp_from = __from;
677+ size_t __conv = mbsnrtowcs(__to, &__from,
678+ __from_chunk_end - __from,
679+ __max, &__state);
680+ if (__conv == static_cast<size_t>(-1))
681+ {
682+ // In case of error, in order to stop at the exact place we
683+ // have to start again from the beginning with a series of
684+ // mbrtowc.
685+ for (__from = __tmp_from;; __from += __conv)
686+ {
687+ __conv = mbrtowc(NULL, __from, __end - __from,
688+ &__tmp_state);
689+ if (__conv == static_cast<size_t>(-1)
690+ || __conv == static_cast<size_t>(-2))
691+ break;
692+ }
693+ __state = __tmp_state;
694+ __ret += __from - __tmp_from;
695+ break;
696+ }
697+ if (!__from)
698+ __from = __from_chunk_end;
699+
700+ __ret += __from - __tmp_from;
701+ __max -= __conv;
702+
703+ if (__from < __end && __max)
704+ {
705+ // XXX Probably wrong for stateful encodings
706+ __tmp_state = __state;
707+ ++__from;
708+ ++__ret;
709+ --__max;
710+ }
711+ }
712+
713+#ifdef __UCLIBC_HAS_XLOCALE__
714+ __uselocale(__old);
715+#endif
716+
717+ return __ret;
718+ }
719+#endif
720+}
721--- gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc
722+++ gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc
723@@ -0,0 +1,80 @@
724+// std::collate implementation details, GNU version -*- C++ -*-
725+
726+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
727+//
728+// This file is part of the GNU ISO C++ Library. This library is free
729+// software; you can redistribute it and/or modify it under the
730+// terms of the GNU General Public License as published by the
731+// Free Software Foundation; either version 2, or (at your option)
732+// any later version.
733+
734+// This library is distributed in the hope that it will be useful,
735+// but WITHOUT ANY WARRANTY; without even the implied warranty of
736+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
737+// GNU General Public License for more details.
738+
739+// You should have received a copy of the GNU General Public License along
740+// with this library; see the file COPYING. If not, write to the Free
741+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
742+// USA.
743+
744+// As a special exception, you may use this file as part of a free software
745+// library without restriction. Specifically, if other files instantiate
746+// templates or use macros or inline functions from this file, or you compile
747+// this file and link it with other files to produce an executable, this
748+// file does not by itself cause the resulting executable to be covered by
749+// the GNU General Public License. This exception does not however
750+// invalidate any other reasons why the executable file might be covered by
751+// the GNU General Public License.
752+
753+//
754+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
755+//
756+
757+// Written by Benjamin Kosnik <bkoz@redhat.com>
758+
759+#include <locale>
760+#include <bits/c++locale_internal.h>
761+
762+#ifndef __UCLIBC_HAS_XLOCALE__
763+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
764+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
765+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
766+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
767+#endif
768+
769+namespace std
770+{
771+ // These are basically extensions to char_traits, and perhaps should
772+ // be put there instead of here.
773+ template<>
774+ int
775+ collate<char>::_M_compare(const char* __one, const char* __two) const
776+ {
777+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
778+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
779+ }
780+
781+ template<>
782+ size_t
783+ collate<char>::_M_transform(char* __to, const char* __from,
784+ size_t __n) const
785+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
786+
787+#ifdef _GLIBCXX_USE_WCHAR_T
788+ template<>
789+ int
790+ collate<wchar_t>::_M_compare(const wchar_t* __one,
791+ const wchar_t* __two) const
792+ {
793+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
794+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
795+ }
796+
797+ template<>
798+ size_t
799+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
800+ size_t __n) const
801+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
802+#endif
803+}
804--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc
805+++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc
806@@ -0,0 +1,300 @@
807+// std::ctype implementation details, GNU version -*- C++ -*-
808+
809+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
810+//
811+// This file is part of the GNU ISO C++ Library. This library is free
812+// software; you can redistribute it and/or modify it under the
813+// terms of the GNU General Public License as published by the
814+// Free Software Foundation; either version 2, or (at your option)
815+// any later version.
816+
817+// This library is distributed in the hope that it will be useful,
818+// but WITHOUT ANY WARRANTY; without even the implied warranty of
819+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
820+// GNU General Public License for more details.
821+
822+// You should have received a copy of the GNU General Public License along
823+// with this library; see the file COPYING. If not, write to the Free
824+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
825+// USA.
826+
827+// As a special exception, you may use this file as part of a free software
828+// library without restriction. Specifically, if other files instantiate
829+// templates or use macros or inline functions from this file, or you compile
830+// this file and link it with other files to produce an executable, this
831+// file does not by itself cause the resulting executable to be covered by
832+// the GNU General Public License. This exception does not however
833+// invalidate any other reasons why the executable file might be covered by
834+// the GNU General Public License.
835+
836+//
837+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
838+//
839+
840+// Written by Benjamin Kosnik <bkoz@redhat.com>
841+
842+#define _LIBC
843+#include <locale>
844+#undef _LIBC
845+#include <bits/c++locale_internal.h>
846+
847+#ifndef __UCLIBC_HAS_XLOCALE__
848+#define __wctype_l(S, L) wctype((S))
849+#define __towupper_l(C, L) towupper((C))
850+#define __towlower_l(C, L) towlower((C))
851+#define __iswctype_l(C, M, L) iswctype((C), (M))
852+#endif
853+
854+namespace std
855+{
856+ // NB: The other ctype<char> specializations are in src/locale.cc and
857+ // various /config/os/* files.
858+ template<>
859+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
860+ : ctype<char>(0, false, __refs)
861+ {
862+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
863+ {
864+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
865+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
866+#ifdef __UCLIBC_HAS_XLOCALE__
867+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
868+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
869+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
870+#endif
871+ }
872+ }
873+
874+#ifdef _GLIBCXX_USE_WCHAR_T
875+ ctype<wchar_t>::__wmask_type
876+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
877+ {
878+ __wmask_type __ret;
879+ switch (__m)
880+ {
881+ case space:
882+ __ret = __wctype_l("space", _M_c_locale_ctype);
883+ break;
884+ case print:
885+ __ret = __wctype_l("print", _M_c_locale_ctype);
886+ break;
887+ case cntrl:
888+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
889+ break;
890+ case upper:
891+ __ret = __wctype_l("upper", _M_c_locale_ctype);
892+ break;
893+ case lower:
894+ __ret = __wctype_l("lower", _M_c_locale_ctype);
895+ break;
896+ case alpha:
897+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
898+ break;
899+ case digit:
900+ __ret = __wctype_l("digit", _M_c_locale_ctype);
901+ break;
902+ case punct:
903+ __ret = __wctype_l("punct", _M_c_locale_ctype);
904+ break;
905+ case xdigit:
906+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
907+ break;
908+ case alnum:
909+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
910+ break;
911+ case graph:
912+ __ret = __wctype_l("graph", _M_c_locale_ctype);
913+ break;
914+ default:
915+ __ret = __wmask_type();
916+ }
917+ return __ret;
918+ }
919+
920+ wchar_t
921+ ctype<wchar_t>::do_toupper(wchar_t __c) const
922+ { return __towupper_l(__c, _M_c_locale_ctype); }
923+
924+ const wchar_t*
925+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
926+ {
927+ while (__lo < __hi)
928+ {
929+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
930+ ++__lo;
931+ }
932+ return __hi;
933+ }
934+
935+ wchar_t
936+ ctype<wchar_t>::do_tolower(wchar_t __c) const
937+ { return __towlower_l(__c, _M_c_locale_ctype); }
938+
939+ const wchar_t*
940+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
941+ {
942+ while (__lo < __hi)
943+ {
944+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
945+ ++__lo;
946+ }
947+ return __hi;
948+ }
949+
950+ bool
951+ ctype<wchar_t>::
952+ do_is(mask __m, wchar_t __c) const
953+ {
954+ // Highest bitmask in ctype_base == 10, but extra in "C"
955+ // library for blank.
956+ bool __ret = false;
957+ const size_t __bitmasksize = 11;
958+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
959+ if (__m & _M_bit[__bitcur]
960+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
961+ {
962+ __ret = true;
963+ break;
964+ }
965+ return __ret;
966+ }
967+
968+ const wchar_t*
969+ ctype<wchar_t>::
970+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
971+ {
972+ for (; __lo < __hi; ++__vec, ++__lo)
973+ {
974+ // Highest bitmask in ctype_base == 10, but extra in "C"
975+ // library for blank.
976+ const size_t __bitmasksize = 11;
977+ mask __m = 0;
978+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
979+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
980+ __m |= _M_bit[__bitcur];
981+ *__vec = __m;
982+ }
983+ return __hi;
984+ }
985+
986+ const wchar_t*
987+ ctype<wchar_t>::
988+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
989+ {
990+ while (__lo < __hi && !this->do_is(__m, *__lo))
991+ ++__lo;
992+ return __lo;
993+ }
994+
995+ const wchar_t*
996+ ctype<wchar_t>::
997+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
998+ {
999+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1000+ ++__lo;
1001+ return __lo;
1002+ }
1003+
1004+ wchar_t
1005+ ctype<wchar_t>::
1006+ do_widen(char __c) const
1007+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1008+
1009+ const char*
1010+ ctype<wchar_t>::
1011+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1012+ {
1013+ while (__lo < __hi)
1014+ {
1015+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1016+ ++__lo;
1017+ ++__dest;
1018+ }
1019+ return __hi;
1020+ }
1021+
1022+ char
1023+ ctype<wchar_t>::
1024+ do_narrow(wchar_t __wc, char __dfault) const
1025+ {
1026+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1027+ return _M_narrow[__wc];
1028+#ifdef __UCLIBC_HAS_XLOCALE__
1029+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1030+#endif
1031+ const int __c = wctob(__wc);
1032+#ifdef __UCLIBC_HAS_XLOCALE__
1033+ __uselocale(__old);
1034+#endif
1035+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1036+ }
1037+
1038+ const wchar_t*
1039+ ctype<wchar_t>::
1040+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1041+ char* __dest) const
1042+ {
1043+#ifdef __UCLIBC_HAS_XLOCALE__
1044+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1045+#endif
1046+ if (_M_narrow_ok)
1047+ while (__lo < __hi)
1048+ {
1049+ if (*__lo >= 0 && *__lo < 128)
1050+ *__dest = _M_narrow[*__lo];
1051+ else
1052+ {
1053+ const int __c = wctob(*__lo);
1054+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1055+ }
1056+ ++__lo;
1057+ ++__dest;
1058+ }
1059+ else
1060+ while (__lo < __hi)
1061+ {
1062+ const int __c = wctob(*__lo);
1063+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1064+ ++__lo;
1065+ ++__dest;
1066+ }
1067+#ifdef __UCLIBC_HAS_XLOCALE__
1068+ __uselocale(__old);
1069+#endif
1070+ return __hi;
1071+ }
1072+
1073+ void
1074+ ctype<wchar_t>::_M_initialize_ctype()
1075+ {
1076+#ifdef __UCLIBC_HAS_XLOCALE__
1077+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1078+#endif
1079+ wint_t __i;
1080+ for (__i = 0; __i < 128; ++__i)
1081+ {
1082+ const int __c = wctob(__i);
1083+ if (__c == EOF)
1084+ break;
1085+ else
1086+ _M_narrow[__i] = static_cast<char>(__c);
1087+ }
1088+ if (__i == 128)
1089+ _M_narrow_ok = true;
1090+ else
1091+ _M_narrow_ok = false;
1092+ for (size_t __j = 0;
1093+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1094+ _M_widen[__j] = btowc(__j);
1095+
1096+ for (size_t __k = 0; __k <= 11; ++__k)
1097+ {
1098+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1099+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1100+ }
1101+#ifdef __UCLIBC_HAS_XLOCALE__
1102+ __uselocale(__old);
1103+#endif
1104+ }
1105+#endif // _GLIBCXX_USE_WCHAR_T
1106+}
1107--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc
1108+++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc
1109@@ -0,0 +1,100 @@
1110+// std::messages implementation details, GNU version -*- C++ -*-
1111+
1112+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1113+//
1114+// This file is part of the GNU ISO C++ Library. This library is free
1115+// software; you can redistribute it and/or modify it under the
1116+// terms of the GNU General Public License as published by the
1117+// Free Software Foundation; either version 2, or (at your option)
1118+// any later version.
1119+
1120+// This library is distributed in the hope that it will be useful,
1121+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1122+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1123+// GNU General Public License for more details.
1124+
1125+// You should have received a copy of the GNU General Public License along
1126+// with this library; see the file COPYING. If not, write to the Free
1127+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1128+// USA.
1129+
1130+// As a special exception, you may use this file as part of a free software
1131+// library without restriction. Specifically, if other files instantiate
1132+// templates or use macros or inline functions from this file, or you compile
1133+// this file and link it with other files to produce an executable, this
1134+// file does not by itself cause the resulting executable to be covered by
1135+// the GNU General Public License. This exception does not however
1136+// invalidate any other reasons why the executable file might be covered by
1137+// the GNU General Public License.
1138+
1139+//
1140+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1141+//
1142+
1143+// Written by Benjamin Kosnik <bkoz@redhat.com>
1144+
1145+#include <locale>
1146+#include <bits/c++locale_internal.h>
1147+
1148+#ifdef __UCLIBC_MJN3_ONLY__
1149+#warning fix gettext stuff
1150+#endif
1151+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1152+extern "C" char *__dcgettext(const char *domainname,
1153+ const char *msgid, int category);
1154+#undef gettext
1155+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1156+#else
1157+#undef gettext
1158+#define gettext(msgid) (msgid)
1159+#endif
1160+
1161+namespace std
1162+{
1163+ // Specializations.
1164+ template<>
1165+ string
1166+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1167+ {
1168+#ifdef __UCLIBC_HAS_XLOCALE__
1169+ __c_locale __old = __uselocale(_M_c_locale_messages);
1170+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1171+ __uselocale(__old);
1172+ return string(__msg);
1173+#elif defined __UCLIBC_HAS_LOCALE__
1174+ char* __old = strdup(setlocale(LC_ALL, NULL));
1175+ setlocale(LC_ALL, _M_name_messages);
1176+ const char* __msg = gettext(__dfault.c_str());
1177+ setlocale(LC_ALL, __old);
1178+ free(__old);
1179+ return string(__msg);
1180+#else
1181+ const char* __msg = gettext(__dfault.c_str());
1182+ return string(__msg);
1183+#endif
1184+ }
1185+
1186+#ifdef _GLIBCXX_USE_WCHAR_T
1187+ template<>
1188+ wstring
1189+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1190+ {
1191+# ifdef __UCLIBC_HAS_XLOCALE__
1192+ __c_locale __old = __uselocale(_M_c_locale_messages);
1193+ char* __msg = gettext(_M_convert_to_char(__dfault));
1194+ __uselocale(__old);
1195+ return _M_convert_from_char(__msg);
1196+# elif defined __UCLIBC_HAS_LOCALE__
1197+ char* __old = strdup(setlocale(LC_ALL, NULL));
1198+ setlocale(LC_ALL, _M_name_messages);
1199+ char* __msg = gettext(_M_convert_to_char(__dfault));
1200+ setlocale(LC_ALL, __old);
1201+ free(__old);
1202+ return _M_convert_from_char(__msg);
1203+# else
1204+ char* __msg = gettext(_M_convert_to_char(__dfault));
1205+ return _M_convert_from_char(__msg);
1206+# endif
1207+ }
1208+#endif
1209+}
1210--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h
1211+++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h
1212@@ -0,0 +1,118 @@
1213+// std::messages implementation details, GNU version -*- C++ -*-
1214+
1215+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1216+//
1217+// This file is part of the GNU ISO C++ Library. This library is free
1218+// software; you can redistribute it and/or modify it under the
1219+// terms of the GNU General Public License as published by the
1220+// Free Software Foundation; either version 2, or (at your option)
1221+// any later version.
1222+
1223+// This library is distributed in the hope that it will be useful,
1224+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1225+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1226+// GNU General Public License for more details.
1227+
1228+// You should have received a copy of the GNU General Public License along
1229+// with this library; see the file COPYING. If not, write to the Free
1230+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1231+// USA.
1232+
1233+// As a special exception, you may use this file as part of a free software
1234+// library without restriction. Specifically, if other files instantiate
1235+// templates or use macros or inline functions from this file, or you compile
1236+// this file and link it with other files to produce an executable, this
1237+// file does not by itself cause the resulting executable to be covered by
1238+// the GNU General Public License. This exception does not however
1239+// invalidate any other reasons why the executable file might be covered by
1240+// the GNU General Public License.
1241+
1242+//
1243+// ISO C++ 14882: 22.2.7.1.2 messages functions
1244+//
1245+
1246+// Written by Benjamin Kosnik <bkoz@redhat.com>
1247+
1248+#ifdef __UCLIBC_MJN3_ONLY__
1249+#warning fix prototypes for *textdomain funcs
1250+#endif
1251+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1252+extern "C" char *__textdomain(const char *domainname);
1253+extern "C" char *__bindtextdomain(const char *domainname,
1254+ const char *dirname);
1255+#else
1256+#undef __textdomain
1257+#undef __bindtextdomain
1258+#define __textdomain(D) ((void)0)
1259+#define __bindtextdomain(D,P) ((void)0)
1260+#endif
1261+
1262+ // Non-virtual member functions.
1263+ template<typename _CharT>
1264+ messages<_CharT>::messages(size_t __refs)
1265+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1266+ _M_name_messages(_S_get_c_name())
1267+ { }
1268+
1269+ template<typename _CharT>
1270+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1271+ size_t __refs)
1272+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1273+ _M_name_messages(__s)
1274+ {
1275+ char* __tmp = new char[std::strlen(__s) + 1];
1276+ std::strcpy(__tmp, __s);
1277+ _M_name_messages = __tmp;
1278+ }
1279+
1280+ template<typename _CharT>
1281+ typename messages<_CharT>::catalog
1282+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1283+ const char* __dir) const
1284+ {
1285+ __bindtextdomain(__s.c_str(), __dir);
1286+ return this->do_open(__s, __loc);
1287+ }
1288+
1289+ // Virtual member functions.
1290+ template<typename _CharT>
1291+ messages<_CharT>::~messages()
1292+ {
1293+ if (_M_name_messages != _S_get_c_name())
1294+ delete [] _M_name_messages;
1295+ _S_destroy_c_locale(_M_c_locale_messages);
1296+ }
1297+
1298+ template<typename _CharT>
1299+ typename messages<_CharT>::catalog
1300+ messages<_CharT>::do_open(const basic_string<char>& __s,
1301+ const locale&) const
1302+ {
1303+ // No error checking is done, assume the catalog exists and can
1304+ // be used.
1305+ __textdomain(__s.c_str());
1306+ return 0;
1307+ }
1308+
1309+ template<typename _CharT>
1310+ void
1311+ messages<_CharT>::do_close(catalog) const
1312+ { }
1313+
1314+ // messages_byname
1315+ template<typename _CharT>
1316+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1317+ : messages<_CharT>(__refs)
1318+ {
1319+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1320+ delete [] this->_M_name_messages;
1321+ char* __tmp = new char[std::strlen(__s) + 1];
1322+ std::strcpy(__tmp, __s);
1323+ this->_M_name_messages = __tmp;
1324+
1325+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1326+ {
1327+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1328+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1329+ }
1330+ }
1331--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1332+++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1333@@ -0,0 +1,692 @@
1334+// std::moneypunct implementation details, GNU version -*- C++ -*-
1335+
1336+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1337+//
1338+// This file is part of the GNU ISO C++ Library. This library is free
1339+// software; you can redistribute it and/or modify it under the
1340+// terms of the GNU General Public License as published by the
1341+// Free Software Foundation; either version 2, or (at your option)
1342+// any later version.
1343+
1344+// This library is distributed in the hope that it will be useful,
1345+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1346+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1347+// GNU General Public License for more details.
1348+
1349+// You should have received a copy of the GNU General Public License along
1350+// with this library; see the file COPYING. If not, write to the Free
1351+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1352+// USA.
1353+
1354+// As a special exception, you may use this file as part of a free software
1355+// library without restriction. Specifically, if other files instantiate
1356+// templates or use macros or inline functions from this file, or you compile
1357+// this file and link it with other files to produce an executable, this
1358+// file does not by itself cause the resulting executable to be covered by
1359+// the GNU General Public License. This exception does not however
1360+// invalidate any other reasons why the executable file might be covered by
1361+// the GNU General Public License.
1362+
1363+//
1364+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1365+//
1366+
1367+// Written by Benjamin Kosnik <bkoz@redhat.com>
1368+
1369+#define _LIBC
1370+#include <locale>
1371+#undef _LIBC
1372+#include <bits/c++locale_internal.h>
1373+
1374+#ifdef __UCLIBC_MJN3_ONLY__
1375+#warning optimize this for uclibc
1376+#warning tailor for stub locale support
1377+#endif
1378+
1379+#ifndef __UCLIBC_HAS_XLOCALE__
1380+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1381+#endif
1382+
1383+namespace std
1384+{
1385+ // Construct and return valid pattern consisting of some combination of:
1386+ // space none symbol sign value
1387+ money_base::pattern
1388+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1389+ {
1390+ pattern __ret;
1391+
1392+ // This insanely complicated routine attempts to construct a valid
1393+ // pattern for use with monyepunct. A couple of invariants:
1394+
1395+ // if (__precedes) symbol -> value
1396+ // else value -> symbol
1397+
1398+ // if (__space) space
1399+ // else none
1400+
1401+ // none == never first
1402+ // space never first or last
1403+
1404+ // Any elegant implementations of this are welcome.
1405+ switch (__posn)
1406+ {
1407+ case 0:
1408+ case 1:
1409+ // 1 The sign precedes the value and symbol.
1410+ __ret.field[0] = sign;
1411+ if (__space)
1412+ {
1413+ // Pattern starts with sign.
1414+ if (__precedes)
1415+ {
1416+ __ret.field[1] = symbol;
1417+ __ret.field[3] = value;
1418+ }
1419+ else
1420+ {
1421+ __ret.field[1] = value;
1422+ __ret.field[3] = symbol;
1423+ }
1424+ __ret.field[2] = space;
1425+ }
1426+ else
1427+ {
1428+ // Pattern starts with sign and ends with none.
1429+ if (__precedes)
1430+ {
1431+ __ret.field[1] = symbol;
1432+ __ret.field[2] = value;
1433+ }
1434+ else
1435+ {
1436+ __ret.field[1] = value;
1437+ __ret.field[2] = symbol;
1438+ }
1439+ __ret.field[3] = none;
1440+ }
1441+ break;
1442+ case 2:
1443+ // 2 The sign follows the value and symbol.
1444+ if (__space)
1445+ {
1446+ // Pattern either ends with sign.
1447+ if (__precedes)
1448+ {
1449+ __ret.field[0] = symbol;
1450+ __ret.field[2] = value;
1451+ }
1452+ else
1453+ {
1454+ __ret.field[0] = value;
1455+ __ret.field[2] = symbol;
1456+ }
1457+ __ret.field[1] = space;
1458+ __ret.field[3] = sign;
1459+ }
1460+ else
1461+ {
1462+ // Pattern ends with sign then none.
1463+ if (__precedes)
1464+ {
1465+ __ret.field[0] = symbol;
1466+ __ret.field[1] = value;
1467+ }
1468+ else
1469+ {
1470+ __ret.field[0] = value;
1471+ __ret.field[1] = symbol;
1472+ }
1473+ __ret.field[2] = sign;
1474+ __ret.field[3] = none;
1475+ }
1476+ break;
1477+ case 3:
1478+ // 3 The sign immediately precedes the symbol.
1479+ if (__precedes)
1480+ {
1481+ __ret.field[0] = sign;
1482+ __ret.field[1] = symbol;
1483+ if (__space)
1484+ {
1485+ __ret.field[2] = space;
1486+ __ret.field[3] = value;
1487+ }
1488+ else
1489+ {
1490+ __ret.field[2] = value;
1491+ __ret.field[3] = none;
1492+ }
1493+ }
1494+ else
1495+ {
1496+ __ret.field[0] = value;
1497+ if (__space)
1498+ {
1499+ __ret.field[1] = space;
1500+ __ret.field[2] = sign;
1501+ __ret.field[3] = symbol;
1502+ }
1503+ else
1504+ {
1505+ __ret.field[1] = sign;
1506+ __ret.field[2] = symbol;
1507+ __ret.field[3] = none;
1508+ }
1509+ }
1510+ break;
1511+ case 4:
1512+ // 4 The sign immediately follows the symbol.
1513+ if (__precedes)
1514+ {
1515+ __ret.field[0] = symbol;
1516+ __ret.field[1] = sign;
1517+ if (__space)
1518+ {
1519+ __ret.field[2] = space;
1520+ __ret.field[3] = value;
1521+ }
1522+ else
1523+ {
1524+ __ret.field[2] = value;
1525+ __ret.field[3] = none;
1526+ }
1527+ }
1528+ else
1529+ {
1530+ __ret.field[0] = value;
1531+ if (__space)
1532+ {
1533+ __ret.field[1] = space;
1534+ __ret.field[2] = symbol;
1535+ __ret.field[3] = sign;
1536+ }
1537+ else
1538+ {
1539+ __ret.field[1] = symbol;
1540+ __ret.field[2] = sign;
1541+ __ret.field[3] = none;
1542+ }
1543+ }
1544+ break;
1545+ default:
1546+ ;
1547+ }
1548+ return __ret;
1549+ }
1550+
1551+ template<>
1552+ void
1553+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1554+ const char*)
1555+ {
1556+ if (!_M_data)
1557+ _M_data = new __moneypunct_cache<char, true>;
1558+
1559+ if (!__cloc)
1560+ {
1561+ // "C" locale
1562+ _M_data->_M_decimal_point = '.';
1563+ _M_data->_M_thousands_sep = ',';
1564+ _M_data->_M_grouping = "";
1565+ _M_data->_M_grouping_size = 0;
1566+ _M_data->_M_curr_symbol = "";
1567+ _M_data->_M_curr_symbol_size = 0;
1568+ _M_data->_M_positive_sign = "";
1569+ _M_data->_M_positive_sign_size = 0;
1570+ _M_data->_M_negative_sign = "";
1571+ _M_data->_M_negative_sign_size = 0;
1572+ _M_data->_M_frac_digits = 0;
1573+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1574+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1575+
1576+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1577+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1578+ }
1579+ else
1580+ {
1581+ // Named locale.
1582+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1583+ __cloc));
1584+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1585+ __cloc));
1586+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1587+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1588+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1589+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1590+
1591+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1592+ if (!__nposn)
1593+ _M_data->_M_negative_sign = "()";
1594+ else
1595+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1596+ __cloc);
1597+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1598+
1599+ // _Intl == true
1600+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1601+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1602+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1603+ __cloc));
1604+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1605+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1606+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1607+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1608+ __pposn);
1609+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1610+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1611+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1612+ __nposn);
1613+ }
1614+ }
1615+
1616+ template<>
1617+ void
1618+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1619+ const char*)
1620+ {
1621+ if (!_M_data)
1622+ _M_data = new __moneypunct_cache<char, false>;
1623+
1624+ if (!__cloc)
1625+ {
1626+ // "C" locale
1627+ _M_data->_M_decimal_point = '.';
1628+ _M_data->_M_thousands_sep = ',';
1629+ _M_data->_M_grouping = "";
1630+ _M_data->_M_grouping_size = 0;
1631+ _M_data->_M_curr_symbol = "";
1632+ _M_data->_M_curr_symbol_size = 0;
1633+ _M_data->_M_positive_sign = "";
1634+ _M_data->_M_positive_sign_size = 0;
1635+ _M_data->_M_negative_sign = "";
1636+ _M_data->_M_negative_sign_size = 0;
1637+ _M_data->_M_frac_digits = 0;
1638+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1639+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1640+
1641+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1642+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1643+ }
1644+ else
1645+ {
1646+ // Named locale.
1647+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1648+ __cloc));
1649+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1650+ __cloc));
1651+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1652+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1653+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1654+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1655+
1656+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1657+ if (!__nposn)
1658+ _M_data->_M_negative_sign = "()";
1659+ else
1660+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1661+ __cloc);
1662+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1663+
1664+ // _Intl == false
1665+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1666+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1667+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1668+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1669+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1670+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1671+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1672+ __pposn);
1673+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1674+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1675+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1676+ __nposn);
1677+ }
1678+ }
1679+
1680+ template<>
1681+ moneypunct<char, true>::~moneypunct()
1682+ { delete _M_data; }
1683+
1684+ template<>
1685+ moneypunct<char, false>::~moneypunct()
1686+ { delete _M_data; }
1687+
1688+#ifdef _GLIBCXX_USE_WCHAR_T
1689+ template<>
1690+ void
1691+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1692+#ifdef __UCLIBC_HAS_XLOCALE__
1693+ const char*)
1694+#else
1695+ const char* __name)
1696+#endif
1697+ {
1698+ if (!_M_data)
1699+ _M_data = new __moneypunct_cache<wchar_t, true>;
1700+
1701+ if (!__cloc)
1702+ {
1703+ // "C" locale
1704+ _M_data->_M_decimal_point = L'.';
1705+ _M_data->_M_thousands_sep = L',';
1706+ _M_data->_M_grouping = "";
1707+ _M_data->_M_grouping_size = 0;
1708+ _M_data->_M_curr_symbol = L"";
1709+ _M_data->_M_curr_symbol_size = 0;
1710+ _M_data->_M_positive_sign = L"";
1711+ _M_data->_M_positive_sign_size = 0;
1712+ _M_data->_M_negative_sign = L"";
1713+ _M_data->_M_negative_sign_size = 0;
1714+ _M_data->_M_frac_digits = 0;
1715+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1716+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1717+
1718+ // Use ctype::widen code without the facet...
1719+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1720+ _M_data->_M_atoms[__i] =
1721+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1722+ }
1723+ else
1724+ {
1725+ // Named locale.
1726+#ifdef __UCLIBC_HAS_XLOCALE__
1727+ __c_locale __old = __uselocale(__cloc);
1728+#else
1729+ // Switch to named locale so that mbsrtowcs will work.
1730+ char* __old = strdup(setlocale(LC_ALL, NULL));
1731+ setlocale(LC_ALL, __name);
1732+#endif
1733+
1734+#ifdef __UCLIBC_MJN3_ONLY__
1735+#warning fix this... should be monetary
1736+#endif
1737+#ifdef __UCLIBC__
1738+# ifdef __UCLIBC_HAS_XLOCALE__
1739+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1740+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1741+# else
1742+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1743+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1744+# endif
1745+#else
1746+ union { char *__s; wchar_t __w; } __u;
1747+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1748+ _M_data->_M_decimal_point = __u.__w;
1749+
1750+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1751+ _M_data->_M_thousands_sep = __u.__w;
1752+#endif
1753+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1754+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1755+
1756+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1757+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1758+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1759+
1760+ wchar_t* __wcs_ps = 0;
1761+ wchar_t* __wcs_ns = 0;
1762+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1763+ try
1764+ {
1765+ mbstate_t __state;
1766+ size_t __len = strlen(__cpossign);
1767+ if (__len)
1768+ {
1769+ ++__len;
1770+ memset(&__state, 0, sizeof(mbstate_t));
1771+ __wcs_ps = new wchar_t[__len];
1772+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1773+ _M_data->_M_positive_sign = __wcs_ps;
1774+ }
1775+ else
1776+ _M_data->_M_positive_sign = L"";
1777+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1778+
1779+ __len = strlen(__cnegsign);
1780+ if (!__nposn)
1781+ _M_data->_M_negative_sign = L"()";
1782+ else if (__len)
1783+ {
1784+ ++__len;
1785+ memset(&__state, 0, sizeof(mbstate_t));
1786+ __wcs_ns = new wchar_t[__len];
1787+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1788+ _M_data->_M_negative_sign = __wcs_ns;
1789+ }
1790+ else
1791+ _M_data->_M_negative_sign = L"";
1792+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1793+
1794+ // _Intl == true.
1795+ __len = strlen(__ccurr);
1796+ if (__len)
1797+ {
1798+ ++__len;
1799+ memset(&__state, 0, sizeof(mbstate_t));
1800+ wchar_t* __wcs = new wchar_t[__len];
1801+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1802+ _M_data->_M_curr_symbol = __wcs;
1803+ }
1804+ else
1805+ _M_data->_M_curr_symbol = L"";
1806+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1807+ }
1808+ catch (...)
1809+ {
1810+ delete _M_data;
1811+ _M_data = 0;
1812+ delete __wcs_ps;
1813+ delete __wcs_ns;
1814+#ifdef __UCLIBC_HAS_XLOCALE__
1815+ __uselocale(__old);
1816+#else
1817+ setlocale(LC_ALL, __old);
1818+ free(__old);
1819+#endif
1820+ __throw_exception_again;
1821+ }
1822+
1823+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1824+ __cloc));
1825+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1826+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1827+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1828+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1829+ __pposn);
1830+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1831+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1832+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1833+ __nposn);
1834+
1835+#ifdef __UCLIBC_HAS_XLOCALE__
1836+ __uselocale(__old);
1837+#else
1838+ setlocale(LC_ALL, __old);
1839+ free(__old);
1840+#endif
1841+ }
1842+ }
1843+
1844+ template<>
1845+ void
1846+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1847+#ifdef __UCLIBC_HAS_XLOCALE__
1848+ const char*)
1849+#else
1850+ const char* __name)
1851+#endif
1852+ {
1853+ if (!_M_data)
1854+ _M_data = new __moneypunct_cache<wchar_t, false>;
1855+
1856+ if (!__cloc)
1857+ {
1858+ // "C" locale
1859+ _M_data->_M_decimal_point = L'.';
1860+ _M_data->_M_thousands_sep = L',';
1861+ _M_data->_M_grouping = "";
1862+ _M_data->_M_grouping_size = 0;
1863+ _M_data->_M_curr_symbol = L"";
1864+ _M_data->_M_curr_symbol_size = 0;
1865+ _M_data->_M_positive_sign = L"";
1866+ _M_data->_M_positive_sign_size = 0;
1867+ _M_data->_M_negative_sign = L"";
1868+ _M_data->_M_negative_sign_size = 0;
1869+ _M_data->_M_frac_digits = 0;
1870+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1871+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1872+
1873+ // Use ctype::widen code without the facet...
1874+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1875+ _M_data->_M_atoms[__i] =
1876+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1877+ }
1878+ else
1879+ {
1880+ // Named locale.
1881+#ifdef __UCLIBC_HAS_XLOCALE__
1882+ __c_locale __old = __uselocale(__cloc);
1883+#else
1884+ // Switch to named locale so that mbsrtowcs will work.
1885+ char* __old = strdup(setlocale(LC_ALL, NULL));
1886+ setlocale(LC_ALL, __name);
1887+#endif
1888+
1889+#ifdef __UCLIBC_MJN3_ONLY__
1890+#warning fix this... should be monetary
1891+#endif
1892+#ifdef __UCLIBC__
1893+# ifdef __UCLIBC_HAS_XLOCALE__
1894+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1895+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1896+# else
1897+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1898+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1899+# endif
1900+#else
1901+ union { char *__s; wchar_t __w; } __u;
1902+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1903+ _M_data->_M_decimal_point = __u.__w;
1904+
1905+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1906+ _M_data->_M_thousands_sep = __u.__w;
1907+#endif
1908+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1909+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1910+
1911+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1912+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1913+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1914+
1915+ wchar_t* __wcs_ps = 0;
1916+ wchar_t* __wcs_ns = 0;
1917+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1918+ try
1919+ {
1920+ mbstate_t __state;
1921+ size_t __len;
1922+ __len = strlen(__cpossign);
1923+ if (__len)
1924+ {
1925+ ++__len;
1926+ memset(&__state, 0, sizeof(mbstate_t));
1927+ __wcs_ps = new wchar_t[__len];
1928+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1929+ _M_data->_M_positive_sign = __wcs_ps;
1930+ }
1931+ else
1932+ _M_data->_M_positive_sign = L"";
1933+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1934+
1935+ __len = strlen(__cnegsign);
1936+ if (!__nposn)
1937+ _M_data->_M_negative_sign = L"()";
1938+ else if (__len)
1939+ {
1940+ ++__len;
1941+ memset(&__state, 0, sizeof(mbstate_t));
1942+ __wcs_ns = new wchar_t[__len];
1943+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1944+ _M_data->_M_negative_sign = __wcs_ns;
1945+ }
1946+ else
1947+ _M_data->_M_negative_sign = L"";
1948+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1949+
1950+ // _Intl == true.
1951+ __len = strlen(__ccurr);
1952+ if (__len)
1953+ {
1954+ ++__len;
1955+ memset(&__state, 0, sizeof(mbstate_t));
1956+ wchar_t* __wcs = new wchar_t[__len];
1957+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1958+ _M_data->_M_curr_symbol = __wcs;
1959+ }
1960+ else
1961+ _M_data->_M_curr_symbol = L"";
1962+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1963+ }
1964+ catch (...)
1965+ {
1966+ delete _M_data;
1967+ _M_data = 0;
1968+ delete __wcs_ps;
1969+ delete __wcs_ns;
1970+#ifdef __UCLIBC_HAS_XLOCALE__
1971+ __uselocale(__old);
1972+#else
1973+ setlocale(LC_ALL, __old);
1974+ free(__old);
1975+#endif
1976+ __throw_exception_again;
1977+ }
1978+
1979+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1980+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1981+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1982+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1983+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1984+ __pposn);
1985+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1986+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1987+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1988+ __nposn);
1989+
1990+#ifdef __UCLIBC_HAS_XLOCALE__
1991+ __uselocale(__old);
1992+#else
1993+ setlocale(LC_ALL, __old);
1994+ free(__old);
1995+#endif
1996+ }
1997+ }
1998+
1999+ template<>
2000+ moneypunct<wchar_t, true>::~moneypunct()
2001+ {
2002+ if (_M_data->_M_positive_sign_size)
2003+ delete [] _M_data->_M_positive_sign;
2004+ if (_M_data->_M_negative_sign_size
2005+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2006+ delete [] _M_data->_M_negative_sign;
2007+ if (_M_data->_M_curr_symbol_size)
2008+ delete [] _M_data->_M_curr_symbol;
2009+ delete _M_data;
2010+ }
2011+
2012+ template<>
2013+ moneypunct<wchar_t, false>::~moneypunct()
2014+ {
2015+ if (_M_data->_M_positive_sign_size)
2016+ delete [] _M_data->_M_positive_sign;
2017+ if (_M_data->_M_negative_sign_size
2018+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2019+ delete [] _M_data->_M_negative_sign;
2020+ if (_M_data->_M_curr_symbol_size)
2021+ delete [] _M_data->_M_curr_symbol;
2022+ delete _M_data;
2023+ }
2024+#endif
2025+}
2026--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2027+++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2028@@ -0,0 +1,160 @@
2029+// std::numpunct implementation details, GNU version -*- C++ -*-
2030+
2031+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2032+//
2033+// This file is part of the GNU ISO C++ Library. This library is free
2034+// software; you can redistribute it and/or modify it under the
2035+// terms of the GNU General Public License as published by the
2036+// Free Software Foundation; either version 2, or (at your option)
2037+// any later version.
2038+
2039+// This library is distributed in the hope that it will be useful,
2040+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2041+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2042+// GNU General Public License for more details.
2043+
2044+// You should have received a copy of the GNU General Public License along
2045+// with this library; see the file COPYING. If not, write to the Free
2046+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2047+// USA.
2048+
2049+// As a special exception, you may use this file as part of a free software
2050+// library without restriction. Specifically, if other files instantiate
2051+// templates or use macros or inline functions from this file, or you compile
2052+// this file and link it with other files to produce an executable, this
2053+// file does not by itself cause the resulting executable to be covered by
2054+// the GNU General Public License. This exception does not however
2055+// invalidate any other reasons why the executable file might be covered by
2056+// the GNU General Public License.
2057+
2058+//
2059+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2060+//
2061+
2062+// Written by Benjamin Kosnik <bkoz@redhat.com>
2063+
2064+#define _LIBC
2065+#include <locale>
2066+#undef _LIBC
2067+#include <bits/c++locale_internal.h>
2068+
2069+#ifdef __UCLIBC_MJN3_ONLY__
2070+#warning tailor for stub locale support
2071+#endif
2072+#ifndef __UCLIBC_HAS_XLOCALE__
2073+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2074+#endif
2075+
2076+namespace std
2077+{
2078+ template<>
2079+ void
2080+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2081+ {
2082+ if (!_M_data)
2083+ _M_data = new __numpunct_cache<char>;
2084+
2085+ if (!__cloc)
2086+ {
2087+ // "C" locale
2088+ _M_data->_M_grouping = "";
2089+ _M_data->_M_grouping_size = 0;
2090+ _M_data->_M_use_grouping = false;
2091+
2092+ _M_data->_M_decimal_point = '.';
2093+ _M_data->_M_thousands_sep = ',';
2094+
2095+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2096+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2097+
2098+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2099+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2100+ }
2101+ else
2102+ {
2103+ // Named locale.
2104+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2105+ __cloc));
2106+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2107+ __cloc));
2108+
2109+ // Check for NULL, which implies no grouping.
2110+ if (_M_data->_M_thousands_sep == '\0')
2111+ _M_data->_M_grouping = "";
2112+ else
2113+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2114+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2115+ }
2116+
2117+ // NB: There is no way to extact this info from posix locales.
2118+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2119+ _M_data->_M_truename = "true";
2120+ _M_data->_M_truename_size = 4;
2121+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2122+ _M_data->_M_falsename = "false";
2123+ _M_data->_M_falsename_size = 5;
2124+ }
2125+
2126+ template<>
2127+ numpunct<char>::~numpunct()
2128+ { delete _M_data; }
2129+
2130+#ifdef _GLIBCXX_USE_WCHAR_T
2131+ template<>
2132+ void
2133+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2134+ {
2135+ if (!_M_data)
2136+ _M_data = new __numpunct_cache<wchar_t>;
2137+
2138+ if (!__cloc)
2139+ {
2140+ // "C" locale
2141+ _M_data->_M_grouping = "";
2142+ _M_data->_M_grouping_size = 0;
2143+ _M_data->_M_use_grouping = false;
2144+
2145+ _M_data->_M_decimal_point = L'.';
2146+ _M_data->_M_thousands_sep = L',';
2147+
2148+ // Use ctype::widen code without the facet...
2149+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2150+ _M_data->_M_atoms_out[__i] =
2151+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2152+
2153+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2154+ _M_data->_M_atoms_in[__j] =
2155+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2156+ }
2157+ else
2158+ {
2159+ // Named locale.
2160+ // NB: In the GNU model wchar_t is always 32 bit wide.
2161+ union { char *__s; wchar_t __w; } __u;
2162+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2163+ _M_data->_M_decimal_point = __u.__w;
2164+
2165+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2166+ _M_data->_M_thousands_sep = __u.__w;
2167+
2168+ if (_M_data->_M_thousands_sep == L'\0')
2169+ _M_data->_M_grouping = "";
2170+ else
2171+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2172+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2173+ }
2174+
2175+ // NB: There is no way to extact this info from posix locales.
2176+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2177+ _M_data->_M_truename = L"true";
2178+ _M_data->_M_truename_size = 4;
2179+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2180+ _M_data->_M_falsename = L"false";
2181+ _M_data->_M_falsename_size = 5;
2182+ }
2183+
2184+ template<>
2185+ numpunct<wchar_t>::~numpunct()
2186+ { delete _M_data; }
2187+ #endif
2188+}
2189--- gcc/libstdc++-v3/config/locale/uclibc/time_members.cc
2190+++ gcc/libstdc++-v3/config/locale/uclibc/time_members.cc
2191@@ -0,0 +1,406 @@
2192+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2193+
2194+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2195+//
2196+// This file is part of the GNU ISO C++ Library. This library is free
2197+// software; you can redistribute it and/or modify it under the
2198+// terms of the GNU General Public License as published by the
2199+// Free Software Foundation; either version 2, or (at your option)
2200+// any later version.
2201+
2202+// This library is distributed in the hope that it will be useful,
2203+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2204+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2205+// GNU General Public License for more details.
2206+
2207+// You should have received a copy of the GNU General Public License along
2208+// with this library; see the file COPYING. If not, write to the Free
2209+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2210+// USA.
2211+
2212+// As a special exception, you may use this file as part of a free software
2213+// library without restriction. Specifically, if other files instantiate
2214+// templates or use macros or inline functions from this file, or you compile
2215+// this file and link it with other files to produce an executable, this
2216+// file does not by itself cause the resulting executable to be covered by
2217+// the GNU General Public License. This exception does not however
2218+// invalidate any other reasons why the executable file might be covered by
2219+// the GNU General Public License.
2220+
2221+//
2222+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2223+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2224+//
2225+
2226+// Written by Benjamin Kosnik <bkoz@redhat.com>
2227+
2228+#include <locale>
2229+#include <bits/c++locale_internal.h>
2230+
2231+#ifdef __UCLIBC_MJN3_ONLY__
2232+#warning tailor for stub locale support
2233+#endif
2234+#ifndef __UCLIBC_HAS_XLOCALE__
2235+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2236+#endif
2237+
2238+namespace std
2239+{
2240+ template<>
2241+ void
2242+ __timepunct<char>::
2243+ _M_put(char* __s, size_t __maxlen, const char* __format,
2244+ const tm* __tm) const
2245+ {
2246+#ifdef __UCLIBC_HAS_XLOCALE__
2247+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2248+ _M_c_locale_timepunct);
2249+#else
2250+ char* __old = strdup(setlocale(LC_ALL, NULL));
2251+ setlocale(LC_ALL, _M_name_timepunct);
2252+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2253+ setlocale(LC_ALL, __old);
2254+ free(__old);
2255+#endif
2256+ // Make sure __s is null terminated.
2257+ if (__len == 0)
2258+ __s[0] = '\0';
2259+ }
2260+
2261+ template<>
2262+ void
2263+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2264+ {
2265+ if (!_M_data)
2266+ _M_data = new __timepunct_cache<char>;
2267+
2268+ if (!__cloc)
2269+ {
2270+ // "C" locale
2271+ _M_c_locale_timepunct = _S_get_c_locale();
2272+
2273+ _M_data->_M_date_format = "%m/%d/%y";
2274+ _M_data->_M_date_era_format = "%m/%d/%y";
2275+ _M_data->_M_time_format = "%H:%M:%S";
2276+ _M_data->_M_time_era_format = "%H:%M:%S";
2277+ _M_data->_M_date_time_format = "";
2278+ _M_data->_M_date_time_era_format = "";
2279+ _M_data->_M_am = "AM";
2280+ _M_data->_M_pm = "PM";
2281+ _M_data->_M_am_pm_format = "";
2282+
2283+ // Day names, starting with "C"'s Sunday.
2284+ _M_data->_M_day1 = "Sunday";
2285+ _M_data->_M_day2 = "Monday";
2286+ _M_data->_M_day3 = "Tuesday";
2287+ _M_data->_M_day4 = "Wednesday";
2288+ _M_data->_M_day5 = "Thursday";
2289+ _M_data->_M_day6 = "Friday";
2290+ _M_data->_M_day7 = "Saturday";
2291+
2292+ // Abbreviated day names, starting with "C"'s Sun.
2293+ _M_data->_M_aday1 = "Sun";
2294+ _M_data->_M_aday2 = "Mon";
2295+ _M_data->_M_aday3 = "Tue";
2296+ _M_data->_M_aday4 = "Wed";
2297+ _M_data->_M_aday5 = "Thu";
2298+ _M_data->_M_aday6 = "Fri";
2299+ _M_data->_M_aday7 = "Sat";
2300+
2301+ // Month names, starting with "C"'s January.
2302+ _M_data->_M_month01 = "January";
2303+ _M_data->_M_month02 = "February";
2304+ _M_data->_M_month03 = "March";
2305+ _M_data->_M_month04 = "April";
2306+ _M_data->_M_month05 = "May";
2307+ _M_data->_M_month06 = "June";
2308+ _M_data->_M_month07 = "July";
2309+ _M_data->_M_month08 = "August";
2310+ _M_data->_M_month09 = "September";
2311+ _M_data->_M_month10 = "October";
2312+ _M_data->_M_month11 = "November";
2313+ _M_data->_M_month12 = "December";
2314+
2315+ // Abbreviated month names, starting with "C"'s Jan.
2316+ _M_data->_M_amonth01 = "Jan";
2317+ _M_data->_M_amonth02 = "Feb";
2318+ _M_data->_M_amonth03 = "Mar";
2319+ _M_data->_M_amonth04 = "Apr";
2320+ _M_data->_M_amonth05 = "May";
2321+ _M_data->_M_amonth06 = "Jun";
2322+ _M_data->_M_amonth07 = "Jul";
2323+ _M_data->_M_amonth08 = "Aug";
2324+ _M_data->_M_amonth09 = "Sep";
2325+ _M_data->_M_amonth10 = "Oct";
2326+ _M_data->_M_amonth11 = "Nov";
2327+ _M_data->_M_amonth12 = "Dec";
2328+ }
2329+ else
2330+ {
2331+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2332+
2333+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2334+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2335+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2336+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2337+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2338+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2339+ __cloc);
2340+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2341+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2342+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2343+
2344+ // Day names, starting with "C"'s Sunday.
2345+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2346+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2347+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2348+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2349+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2350+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2351+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2352+
2353+ // Abbreviated day names, starting with "C"'s Sun.
2354+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2355+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2356+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2357+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2358+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2359+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2360+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2361+
2362+ // Month names, starting with "C"'s January.
2363+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2364+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2365+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2366+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2367+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2368+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2369+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2370+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2371+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2372+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2373+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2374+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2375+
2376+ // Abbreviated month names, starting with "C"'s Jan.
2377+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2378+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2379+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2380+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2381+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2382+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2383+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2384+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2385+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2386+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2387+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2388+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2389+ }
2390+ }
2391+
2392+#ifdef _GLIBCXX_USE_WCHAR_T
2393+ template<>
2394+ void
2395+ __timepunct<wchar_t>::
2396+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2397+ const tm* __tm) const
2398+ {
2399+#ifdef __UCLIBC_HAS_XLOCALE__
2400+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2401+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2402+ _M_c_locale_timepunct);
2403+#else
2404+ char* __old = strdup(setlocale(LC_ALL, NULL));
2405+ setlocale(LC_ALL, _M_name_timepunct);
2406+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2407+ setlocale(LC_ALL, __old);
2408+ free(__old);
2409+#endif
2410+ // Make sure __s is null terminated.
2411+ if (__len == 0)
2412+ __s[0] = L'\0';
2413+ }
2414+
2415+ template<>
2416+ void
2417+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2418+ {
2419+ if (!_M_data)
2420+ _M_data = new __timepunct_cache<wchar_t>;
2421+
2422+#warning wide time stuff
2423+// if (!__cloc)
2424+ {
2425+ // "C" locale
2426+ _M_c_locale_timepunct = _S_get_c_locale();
2427+
2428+ _M_data->_M_date_format = L"%m/%d/%y";
2429+ _M_data->_M_date_era_format = L"%m/%d/%y";
2430+ _M_data->_M_time_format = L"%H:%M:%S";
2431+ _M_data->_M_time_era_format = L"%H:%M:%S";
2432+ _M_data->_M_date_time_format = L"";
2433+ _M_data->_M_date_time_era_format = L"";
2434+ _M_data->_M_am = L"AM";
2435+ _M_data->_M_pm = L"PM";
2436+ _M_data->_M_am_pm_format = L"";
2437+
2438+ // Day names, starting with "C"'s Sunday.
2439+ _M_data->_M_day1 = L"Sunday";
2440+ _M_data->_M_day2 = L"Monday";
2441+ _M_data->_M_day3 = L"Tuesday";
2442+ _M_data->_M_day4 = L"Wednesday";
2443+ _M_data->_M_day5 = L"Thursday";
2444+ _M_data->_M_day6 = L"Friday";
2445+ _M_data->_M_day7 = L"Saturday";
2446+
2447+ // Abbreviated day names, starting with "C"'s Sun.
2448+ _M_data->_M_aday1 = L"Sun";
2449+ _M_data->_M_aday2 = L"Mon";
2450+ _M_data->_M_aday3 = L"Tue";
2451+ _M_data->_M_aday4 = L"Wed";
2452+ _M_data->_M_aday5 = L"Thu";
2453+ _M_data->_M_aday6 = L"Fri";
2454+ _M_data->_M_aday7 = L"Sat";
2455+
2456+ // Month names, starting with "C"'s January.
2457+ _M_data->_M_month01 = L"January";
2458+ _M_data->_M_month02 = L"February";
2459+ _M_data->_M_month03 = L"March";
2460+ _M_data->_M_month04 = L"April";
2461+ _M_data->_M_month05 = L"May";
2462+ _M_data->_M_month06 = L"June";
2463+ _M_data->_M_month07 = L"July";
2464+ _M_data->_M_month08 = L"August";
2465+ _M_data->_M_month09 = L"September";
2466+ _M_data->_M_month10 = L"October";
2467+ _M_data->_M_month11 = L"November";
2468+ _M_data->_M_month12 = L"December";
2469+
2470+ // Abbreviated month names, starting with "C"'s Jan.
2471+ _M_data->_M_amonth01 = L"Jan";
2472+ _M_data->_M_amonth02 = L"Feb";
2473+ _M_data->_M_amonth03 = L"Mar";
2474+ _M_data->_M_amonth04 = L"Apr";
2475+ _M_data->_M_amonth05 = L"May";
2476+ _M_data->_M_amonth06 = L"Jun";
2477+ _M_data->_M_amonth07 = L"Jul";
2478+ _M_data->_M_amonth08 = L"Aug";
2479+ _M_data->_M_amonth09 = L"Sep";
2480+ _M_data->_M_amonth10 = L"Oct";
2481+ _M_data->_M_amonth11 = L"Nov";
2482+ _M_data->_M_amonth12 = L"Dec";
2483+ }
2484+#if 0
2485+ else
2486+ {
2487+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2488+
2489+ union { char *__s; wchar_t *__w; } __u;
2490+
2491+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2492+ _M_data->_M_date_format = __u.__w;
2493+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2494+ _M_data->_M_date_era_format = __u.__w;
2495+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2496+ _M_data->_M_time_format = __u.__w;
2497+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2498+ _M_data->_M_time_era_format = __u.__w;
2499+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2500+ _M_data->_M_date_time_format = __u.__w;
2501+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2502+ _M_data->_M_date_time_era_format = __u.__w;
2503+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2504+ _M_data->_M_am = __u.__w;
2505+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2506+ _M_data->_M_pm = __u.__w;
2507+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2508+ _M_data->_M_am_pm_format = __u.__w;
2509+
2510+ // Day names, starting with "C"'s Sunday.
2511+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2512+ _M_data->_M_day1 = __u.__w;
2513+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2514+ _M_data->_M_day2 = __u.__w;
2515+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2516+ _M_data->_M_day3 = __u.__w;
2517+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2518+ _M_data->_M_day4 = __u.__w;
2519+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2520+ _M_data->_M_day5 = __u.__w;
2521+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2522+ _M_data->_M_day6 = __u.__w;
2523+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2524+ _M_data->_M_day7 = __u.__w;
2525+
2526+ // Abbreviated day names, starting with "C"'s Sun.
2527+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2528+ _M_data->_M_aday1 = __u.__w;
2529+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2530+ _M_data->_M_aday2 = __u.__w;
2531+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2532+ _M_data->_M_aday3 = __u.__w;
2533+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2534+ _M_data->_M_aday4 = __u.__w;
2535+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2536+ _M_data->_M_aday5 = __u.__w;
2537+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2538+ _M_data->_M_aday6 = __u.__w;
2539+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2540+ _M_data->_M_aday7 = __u.__w;
2541+
2542+ // Month names, starting with "C"'s January.
2543+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2544+ _M_data->_M_month01 = __u.__w;
2545+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2546+ _M_data->_M_month02 = __u.__w;
2547+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2548+ _M_data->_M_month03 = __u.__w;
2549+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2550+ _M_data->_M_month04 = __u.__w;
2551+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2552+ _M_data->_M_month05 = __u.__w;
2553+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2554+ _M_data->_M_month06 = __u.__w;
2555+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2556+ _M_data->_M_month07 = __u.__w;
2557+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2558+ _M_data->_M_month08 = __u.__w;
2559+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2560+ _M_data->_M_month09 = __u.__w;
2561+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2562+ _M_data->_M_month10 = __u.__w;
2563+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2564+ _M_data->_M_month11 = __u.__w;
2565+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2566+ _M_data->_M_month12 = __u.__w;
2567+
2568+ // Abbreviated month names, starting with "C"'s Jan.
2569+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2570+ _M_data->_M_amonth01 = __u.__w;
2571+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2572+ _M_data->_M_amonth02 = __u.__w;
2573+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2574+ _M_data->_M_amonth03 = __u.__w;
2575+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2576+ _M_data->_M_amonth04 = __u.__w;
2577+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2578+ _M_data->_M_amonth05 = __u.__w;
2579+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2580+ _M_data->_M_amonth06 = __u.__w;
2581+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2582+ _M_data->_M_amonth07 = __u.__w;
2583+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2584+ _M_data->_M_amonth08 = __u.__w;
2585+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2586+ _M_data->_M_amonth09 = __u.__w;
2587+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2588+ _M_data->_M_amonth10 = __u.__w;
2589+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2590+ _M_data->_M_amonth11 = __u.__w;
2591+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2592+ _M_data->_M_amonth12 = __u.__w;
2593+ }
2594+#endif // 0
2595+ }
2596+#endif
2597+}
2598--- gcc/libstdc++-v3/config/locale/uclibc/time_members.h
2599+++ gcc/libstdc++-v3/config/locale/uclibc/time_members.h
2600@@ -0,0 +1,68 @@
2601+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2602+
2603+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2604+//
2605+// This file is part of the GNU ISO C++ Library. This library is free
2606+// software; you can redistribute it and/or modify it under the
2607+// terms of the GNU General Public License as published by the
2608+// Free Software Foundation; either version 2, or (at your option)
2609+// any later version.
2610+
2611+// This library is distributed in the hope that it will be useful,
2612+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2613+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2614+// GNU General Public License for more details.
2615+
2616+// You should have received a copy of the GNU General Public License along
2617+// with this library; see the file COPYING. If not, write to the Free
2618+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2619+// USA.
2620+
2621+// As a special exception, you may use this file as part of a free software
2622+// library without restriction. Specifically, if other files instantiate
2623+// templates or use macros or inline functions from this file, or you compile
2624+// this file and link it with other files to produce an executable, this
2625+// file does not by itself cause the resulting executable to be covered by
2626+// the GNU General Public License. This exception does not however
2627+// invalidate any other reasons why the executable file might be covered by
2628+// the GNU General Public License.
2629+
2630+//
2631+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2632+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2633+//
2634+
2635+// Written by Benjamin Kosnik <bkoz@redhat.com>
2636+
2637+ template<typename _CharT>
2638+ __timepunct<_CharT>::__timepunct(size_t __refs)
2639+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2640+ _M_name_timepunct(_S_get_c_name())
2641+ { _M_initialize_timepunct(); }
2642+
2643+ template<typename _CharT>
2644+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2645+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2646+ _M_name_timepunct(_S_get_c_name())
2647+ { _M_initialize_timepunct(); }
2648+
2649+ template<typename _CharT>
2650+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2651+ size_t __refs)
2652+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2653+ _M_name_timepunct(__s)
2654+ {
2655+ char* __tmp = new char[std::strlen(__s) + 1];
2656+ std::strcpy(__tmp, __s);
2657+ _M_name_timepunct = __tmp;
2658+ _M_initialize_timepunct(__cloc);
2659+ }
2660+
2661+ template<typename _CharT>
2662+ __timepunct<_CharT>::~__timepunct()
2663+ {
2664+ if (_M_name_timepunct != _S_get_c_name())
2665+ delete [] _M_name_timepunct;
2666+ delete _M_data;
2667+ _S_destroy_c_locale(_M_c_locale_timepunct);
2668+ }
2669--- gcc/libstdc++-v3/configure
2670+++ gcc/libstdc++-v3/configure
2671@@ -5764,7 +5764,7 @@
2672 enableval="$enable_clocale"
2673
2674 case "$enableval" in
2675- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
2676+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
2677 *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
2678 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
2679 { (exit 1); exit 1; }; } ;;
2680@@ -5789,6 +5789,9 @@
2681 # Default to "generic".
2682 if test $enable_clocale_flag = auto; then
2683 case ${target_os} in
2684+ linux-uclibc*)
2685+ enable_clocale_flag=uclibc
2686+ ;;
2687 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2688 cat >conftest.$ac_ext <<_ACEOF
2689 /* confdefs.h. */
2690@@ -6019,6 +6022,76 @@
2691 CTIME_CC=config/locale/generic/time_members.cc
2692 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2693 ;;
2694+ uclibc)
2695+ echo "$as_me:$LINENO: result: uclibc" >&5
2696+echo "${ECHO_T}uclibc" >&6
2697+
2698+ # Declare intention to use gettext, and add support for specific
2699+ # languages.
2700+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2701+ ALL_LINGUAS="de fr"
2702+
2703+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2704+ # Extract the first word of "msgfmt", so it can be a program name with args.
2705+set dummy msgfmt; ac_word=$2
2706+echo "$as_me:$LINENO: checking for $ac_word" >&5
2707+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2708+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
2709+ echo $ECHO_N "(cached) $ECHO_C" >&6
2710+else
2711+ if test -n "$check_msgfmt"; then
2712+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2713+else
2714+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2715+for as_dir in $PATH
2716+do
2717+ IFS=$as_save_IFS
2718+ test -z "$as_dir" && as_dir=.
2719+ for ac_exec_ext in '' $ac_executable_extensions; do
2720+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2721+ ac_cv_prog_check_msgfmt="yes"
2722+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2723+ break 2
2724+ fi
2725+done
2726+done
2727+
2728+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2729+fi
2730+fi
2731+check_msgfmt=$ac_cv_prog_check_msgfmt
2732+if test -n "$check_msgfmt"; then
2733+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
2734+echo "${ECHO_T}$check_msgfmt" >&6
2735+else
2736+ echo "$as_me:$LINENO: result: no" >&5
2737+echo "${ECHO_T}no" >&6
2738+fi
2739+
2740+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2741+ USE_NLS=yes
2742+ fi
2743+ # Export the build objects.
2744+ for ling in $ALL_LINGUAS; do \
2745+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2746+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2747+ done
2748+
2749+
2750+
2751+ CLOCALE_H=config/locale/uclibc/c_locale.h
2752+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2753+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2754+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2755+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2756+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2757+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2758+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2759+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2760+ CTIME_H=config/locale/uclibc/time_members.h
2761+ CTIME_CC=config/locale/uclibc/time_members.cc
2762+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2763+ ;;
2764 esac
2765
2766 # This is where the testsuite looks for locale catalogs, using the
2767--- gcc/libstdc++-v3/include/c_compatibility/wchar.h
2768+++ gcc/libstdc++-v3/include/c_compatibility/wchar.h
2769@@ -101,7 +101,9 @@
2770 using std::wmemcpy;
2771 using std::wmemmove;
2772 using std::wmemset;
2773+#if _GLIBCXX_HAVE_WCSFTIME
2774 using std::wcsftime;
2775+#endif
2776
2777 #if _GLIBCXX_USE_C99
2778 using std::wcstold;
2779--- gcc/libstdc++-v3/include/c_std/std_cwchar.h
2780+++ gcc/libstdc++-v3/include/c_std/std_cwchar.h
2781@@ -182,7 +182,9 @@
2782 using ::wcscoll;
2783 using ::wcscpy;
2784 using ::wcscspn;
2785+#if _GLIBCXX_HAVE_WCSFTIME
2786 using ::wcsftime;
2787+#endif
2788 using ::wcslen;
2789 using ::wcsncat;
2790 using ::wcsncmp;
diff --git a/meta/packages/gcc/gcc-4.2.2/203-uclibc-locale-no__x.patch b/meta/packages/gcc/gcc-4.2.2/203-uclibc-locale-no__x.patch
new file mode 100644
index 0000000000..6ba47003b3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/203-uclibc-locale-no__x.patch
@@ -0,0 +1,213 @@
1--- gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100
2+++ gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2006-03-10 15:32:37 +0100
3@@ -60,4 +60,49 @@
4 extern "C" __typeof(wctype_l) __wctype_l;
5 #endif
6
7+# define __nl_langinfo_l nl_langinfo_l
8+# define __strcoll_l strcoll_l
9+# define __strftime_l strftime_l
10+# define __strtod_l strtod_l
11+# define __strtof_l strtof_l
12+# define __strtold_l strtold_l
13+# define __strxfrm_l strxfrm_l
14+# define __newlocale newlocale
15+# define __freelocale freelocale
16+# define __duplocale duplocale
17+# define __uselocale uselocale
18+
19+# ifdef _GLIBCXX_USE_WCHAR_T
20+# define __iswctype_l iswctype_l
21+# define __towlower_l towlower_l
22+# define __towupper_l towupper_l
23+# define __wcscoll_l wcscoll_l
24+# define __wcsftime_l wcsftime_l
25+# define __wcsxfrm_l wcsxfrm_l
26+# define __wctype_l wctype_l
27+# endif
28+
29+#else
30+# define __nl_langinfo_l(N, L) nl_langinfo((N))
31+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
32+# define __strtod_l(S, E, L) strtod((S), (E))
33+# define __strtof_l(S, E, L) strtof((S), (E))
34+# define __strtold_l(S, E, L) strtold((S), (E))
35+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
36+# warning should dummy __newlocale check for C|POSIX ?
37+# define __newlocale(a, b, c) NULL
38+# define __freelocale(a) ((void)0)
39+# define __duplocale(a) __c_locale()
40+//# define __uselocale ?
41+//
42+# ifdef _GLIBCXX_USE_WCHAR_T
43+# define __iswctype_l(C, M, L) iswctype((C), (M))
44+# define __towlower_l(C, L) towlower((C))
45+# define __towupper_l(C, L) towupper((C))
46+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
47+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
48+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
49+# define __wctype_l(S, L) wctype((S))
50+# endif
51+
52 #endif // GLIBC 2.3 and later
53--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
54+++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-10 15:32:37 +0100
55@@ -39,20 +39,6 @@
56 #include <langinfo.h>
57 #include <bits/c++locale_internal.h>
58
59-#ifndef __UCLIBC_HAS_XLOCALE__
60-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
61-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
62-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
63-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
64-#define __strtof_l(S, E, L) strtof((S), (E))
65-#define __strtod_l(S, E, L) strtod((S), (E))
66-#define __strtold_l(S, E, L) strtold((S), (E))
67-#warning should dummy __newlocale check for C|POSIX ?
68-#define __newlocale(a, b, c) NULL
69-#define __freelocale(a) ((void)0)
70-#define __duplocale(a) __c_locale()
71-#endif
72-
73 namespace std
74 {
75 template<>
76--- gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
77+++ gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc 2006-03-10 15:32:37 +0100
78@@ -36,13 +36,6 @@
79 #include <locale>
80 #include <bits/c++locale_internal.h>
81
82-#ifndef __UCLIBC_HAS_XLOCALE__
83-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
84-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
85-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
86-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
87-#endif
88-
89 namespace std
90 {
91 // These are basically extensions to char_traits, and perhaps should
92--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
93+++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:32:37 +0100
94@@ -43,10 +43,6 @@
95 #warning tailor for stub locale support
96 #endif
97
98-#ifndef __UCLIBC_HAS_XLOCALE__
99-#define __nl_langinfo_l(N, L) nl_langinfo((N))
100-#endif
101-
102 namespace std
103 {
104 // Construct and return valid pattern consisting of some combination of:
105--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
106+++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:32:37 +0100
107@@ -41,9 +41,6 @@
108 #ifdef __UCLIBC_MJN3_ONLY__
109 #warning tailor for stub locale support
110 #endif
111-#ifndef __UCLIBC_HAS_XLOCALE__
112-#define __nl_langinfo_l(N, L) nl_langinfo((N))
113-#endif
114
115 namespace std
116 {
117--- gcc/libstdc++-v3/config/locale/uclibc/time_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
118+++ gcc/libstdc++-v3/config/locale/uclibc/time_members.cc 2006-03-10 15:32:37 +0100
119@@ -40,9 +40,6 @@
120 #ifdef __UCLIBC_MJN3_ONLY__
121 #warning tailor for stub locale support
122 #endif
123-#ifndef __UCLIBC_HAS_XLOCALE__
124-#define __nl_langinfo_l(N, L) nl_langinfo((N))
125-#endif
126
127 namespace std
128 {
129--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
130+++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-10 15:32:37 +0100
131@@ -38,13 +38,6 @@
132 #undef _LIBC
133 #include <bits/c++locale_internal.h>
134
135-#ifndef __UCLIBC_HAS_XLOCALE__
136-#define __wctype_l(S, L) wctype((S))
137-#define __towupper_l(C, L) towupper((C))
138-#define __towlower_l(C, L) towlower((C))
139-#define __iswctype_l(C, M, L) iswctype((C), (M))
140-#endif
141-
142 namespace std
143 {
144 // NB: The other ctype<char> specializations are in src/locale.cc and
145--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
146+++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc 2006-03-10 15:32:37 +0100
147@@ -39,13 +39,10 @@
148 #ifdef __UCLIBC_MJN3_ONLY__
149 #warning fix gettext stuff
150 #endif
151-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
152-extern "C" char *__dcgettext(const char *domainname,
153- const char *msgid, int category);
154 #undef gettext
155-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
156+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
157+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
158 #else
159-#undef gettext
160 #define gettext(msgid) (msgid)
161 #endif
162
163--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100
164+++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-10 15:32:37 +0100
165@@ -36,15 +36,11 @@
166 #ifdef __UCLIBC_MJN3_ONLY__
167 #warning fix prototypes for *textdomain funcs
168 #endif
169-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
170-extern "C" char *__textdomain(const char *domainname);
171-extern "C" char *__bindtextdomain(const char *domainname,
172- const char *dirname);
173-#else
174-#undef __textdomain
175-#undef __bindtextdomain
176-#define __textdomain(D) ((void)0)
177-#define __bindtextdomain(D,P) ((void)0)
178+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
179+#undef textdomain
180+#undef bindtextdomain
181+#define textdomain(D) ((void)0)
182+#define bindtextdomain(D,P) ((void)0)
183 #endif
184
185 // Non-virtual member functions.
186@@ -70,7 +66,7 @@
187 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
188 const char* __dir) const
189 {
190- __bindtextdomain(__s.c_str(), __dir);
191+ bindtextdomain(__s.c_str(), __dir);
192 return this->do_open(__s, __loc);
193 }
194
195@@ -90,7 +86,7 @@
196 {
197 // No error checking is done, assume the catalog exists and can
198 // be used.
199- __textdomain(__s.c_str());
200+ textdomain(__s.c_str());
201 return 0;
202 }
203
204--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100
205+++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-03-10 15:32:37 +0100
206@@ -68,6 +68,7 @@
207 {
208 extern "C" __typeof(uselocale) __uselocale;
209 }
210+#define __uselocale uselocale
211 #endif
212
213 namespace std
diff --git a/meta/packages/gcc/gcc-4.2.2/204-uclibc-locale-wchar_fix.patch b/meta/packages/gcc/gcc-4.2.2/204-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000000..160ab35bb3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/204-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,48 @@
1--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
2+++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:37:27 +0100
3@@ -401,7 +401,7 @@
4 # ifdef __UCLIBC_HAS_XLOCALE__
5 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
6 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
7-# else
8+# elif defined __UCLIBC_HAS_LOCALE__
9 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
10 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
11 # endif
12@@ -556,7 +556,7 @@
13 # ifdef __UCLIBC_HAS_XLOCALE__
14 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
15 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
16-# else
17+# elif defined __UCLIBC_HAS_LOCALE__
18 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
19 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
20 # endif
21--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
22+++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:37:27 +0100
23@@ -127,12 +127,25 @@
24 {
25 // Named locale.
26 // NB: In the GNU model wchar_t is always 32 bit wide.
27+#ifdef __UCLIBC_MJN3_ONLY__
28+#warning fix this... should be numeric
29+#endif
30+#ifdef __UCLIBC__
31+# ifdef __UCLIBC_HAS_XLOCALE__
32+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
33+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
34+# elif defined __UCLIBC_HAS_LOCALE__
35+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
36+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
37+# endif
38+#else
39 union { char *__s; wchar_t __w; } __u;
40 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
41 _M_data->_M_decimal_point = __u.__w;
42
43 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
44 _M_data->_M_thousands_sep = __u.__w;
45+#endif
46
47 if (_M_data->_M_thousands_sep == L'\0')
48 _M_data->_M_grouping = "";
diff --git a/meta/packages/gcc/gcc-4.2.2/205-uclibc-locale-update.patch b/meta/packages/gcc/gcc-4.2.2/205-uclibc-locale-update.patch
new file mode 100644
index 0000000000..86b2844554
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/205-uclibc-locale-update.patch
@@ -0,0 +1,347 @@
1--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc.uclibc200_update~ 2006-03-10 15:32:37 +0100
2+++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-10 15:39:14 +0100
3@@ -46,16 +47,13 @@
4 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
5 const __c_locale& __cloc)
6 {
7- if (!(__err & ios_base::failbit))
8- {
9- char* __sanity;
10- errno = 0;
11- float __f = __strtof_l(__s, &__sanity, __cloc);
12- if (__sanity != __s && errno != ERANGE)
13- __v = __f;
14- else
15- __err |= ios_base::failbit;
16- }
17+ char* __sanity;
18+ errno = 0;
19+ float __f = __strtof_l(__s, &__sanity, __cloc);
20+ if (__sanity != __s && errno != ERANGE)
21+ __v = __f;
22+ else
23+ __err |= ios_base::failbit;
24 }
25
26 template<>
27@@ -63,16 +61,13 @@
28 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
29 const __c_locale& __cloc)
30 {
31- if (!(__err & ios_base::failbit))
32- {
33- char* __sanity;
34- errno = 0;
35- double __d = __strtod_l(__s, &__sanity, __cloc);
36- if (__sanity != __s && errno != ERANGE)
37- __v = __d;
38- else
39- __err |= ios_base::failbit;
40- }
41+ char* __sanity;
42+ errno = 0;
43+ double __d = __strtod_l(__s, &__sanity, __cloc);
44+ if (__sanity != __s && errno != ERANGE)
45+ __v = __d;
46+ else
47+ __err |= ios_base::failbit;
48 }
49
50 template<>
51@@ -80,16 +75,13 @@
52 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
53 const __c_locale& __cloc)
54 {
55- if (!(__err & ios_base::failbit))
56- {
57- char* __sanity;
58- errno = 0;
59- long double __ld = __strtold_l(__s, &__sanity, __cloc);
60- if (__sanity != __s && errno != ERANGE)
61- __v = __ld;
62- else
63- __err |= ios_base::failbit;
64- }
65+ char* __sanity;
66+ errno = 0;
67+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
68+ if (__sanity != __s && errno != ERANGE)
69+ __v = __ld;
70+ else
71+ __err |= ios_base::failbit;
72 }
73
74 void
75@@ -110,7 +102,7 @@
76 void
77 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
78 {
79- if (_S_get_c_locale() != __cloc)
80+ if (__cloc && _S_get_c_locale() != __cloc)
81 __freelocale(__cloc);
82 }
83
84--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc.uclibc200_update~ 2006-03-10 15:32:37 +0100
85+++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-10 15:39:14 +0100
86@@ -33,9 +33,14 @@
87
88 // Written by Benjamin Kosnik <bkoz@redhat.com>
89
90+#include <features.h>
91+#ifdef __UCLIBC_HAS_LOCALE__
92 #define _LIBC
93 #include <locale>
94 #undef _LIBC
95+#else
96+#include <locale>
97+#endif
98 #include <bits/c++locale_internal.h>
99
100 namespace std
101@@ -138,20 +143,34 @@
102 ctype<wchar_t>::
103 do_is(mask __m, wchar_t __c) const
104 {
105- // Highest bitmask in ctype_base == 10, but extra in "C"
106- // library for blank.
107+ // The case of __m == ctype_base::space is particularly important,
108+ // due to its use in many istream functions. Therefore we deal with
109+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
110+ // is the mask corresponding to ctype_base::space. NB: an encoding
111+ // change would not affect correctness!
112 bool __ret = false;
113- const size_t __bitmasksize = 11;
114- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
115- if (__m & _M_bit[__bitcur]
116- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
117- {
118- __ret = true;
119- break;
120- }
121+ if (__m == _M_bit[5])
122+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
123+ else
124+ {
125+ // Highest bitmask in ctype_base == 10, but extra in "C"
126+ // library for blank.
127+ const size_t __bitmasksize = 11;
128+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
129+ if (__m & _M_bit[__bitcur])
130+ {
131+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
132+ {
133+ __ret = true;
134+ break;
135+ }
136+ else if (__m == _M_bit[__bitcur])
137+ break;
138+ }
139+ }
140 return __ret;
141 }
142-
143+
144 const wchar_t*
145 ctype<wchar_t>::
146 do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
147--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h.uclibc200_update~ 2006-03-10 15:32:37 +0100
148+++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-10 15:39:14 +0100
149@@ -47,18 +47,21 @@
150 template<typename _CharT>
151 messages<_CharT>::messages(size_t __refs)
152 : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
153- _M_name_messages(_S_get_c_name())
154+ _M_name_messages(_S_get_c_name())
155 { }
156
157 template<typename _CharT>
158 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
159 size_t __refs)
160- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
161- _M_name_messages(__s)
162+ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
163 {
164- char* __tmp = new char[std::strlen(__s) + 1];
165- std::strcpy(__tmp, __s);
166+ const size_t __len = std::strlen(__s) + 1;
167+ char* __tmp = new char[__len];
168+ std::memcpy(__tmp, __s, __len);
169 _M_name_messages = __tmp;
170+
171+ // Last to avoid leaking memory if new throws.
172+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
173 }
174
175 template<typename _CharT>
176--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_update~ 2006-03-10 15:37:27 +0100
177+++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:39:14 +0100
178@@ -33,9 +33,14 @@
179
180 // Written by Benjamin Kosnik <bkoz@redhat.com>
181
182+#include <features.h>
183+#ifdef __UCLIBC_HAS_LOCALE__
184 #define _LIBC
185 #include <locale>
186 #undef _LIBC
187+#else
188+#include <locale>
189+#endif
190 #include <bits/c++locale_internal.h>
191
192 #ifdef __UCLIBC_MJN3_ONLY__
193@@ -206,7 +211,7 @@
194 }
195 break;
196 default:
197- ;
198+ __ret = pattern();
199 }
200 return __ret;
201 }
202--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_update~ 2006-03-10 15:37:27 +0100
203+++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:39:14 +0100
204@@ -33,9 +33,14 @@
205
206 // Written by Benjamin Kosnik <bkoz@redhat.com>
207
208+#include <features.h>
209+#ifdef __UCLIBC_HAS_LOCALE__
210 #define _LIBC
211 #include <locale>
212 #undef _LIBC
213+#else
214+#include <locale>
215+#endif
216 #include <bits/c++locale_internal.h>
217
218 #ifdef __UCLIBC_MJN3_ONLY__
219--- gcc/libstdc++-v3/config/locale/uclibc/time_members.h.uclibc200_update~ 2006-03-10 15:06:17 +0100
220+++ gcc/libstdc++-v3/config/locale/uclibc/time_members.h 2006-03-10 15:39:14 +0100
221@@ -37,25 +37,33 @@
222 template<typename _CharT>
223 __timepunct<_CharT>::__timepunct(size_t __refs)
224 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
225- _M_name_timepunct(_S_get_c_name())
226+ _M_name_timepunct(_S_get_c_name())
227 { _M_initialize_timepunct(); }
228
229 template<typename _CharT>
230 __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
231 : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
232- _M_name_timepunct(_S_get_c_name())
233+ _M_name_timepunct(_S_get_c_name())
234 { _M_initialize_timepunct(); }
235
236 template<typename _CharT>
237 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
238 size_t __refs)
239 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
240- _M_name_timepunct(__s)
241+ _M_name_timepunct(NULL)
242 {
243- char* __tmp = new char[std::strlen(__s) + 1];
244- std::strcpy(__tmp, __s);
245+ const size_t __len = std::strlen(__s) + 1;
246+ char* __tmp = new char[__len];
247+ std::memcpy(__tmp, __s, __len);
248 _M_name_timepunct = __tmp;
249- _M_initialize_timepunct(__cloc);
250+
251+ try
252+ { _M_initialize_timepunct(__cloc); }
253+ catch(...)
254+ {
255+ delete [] _M_name_timepunct;
256+ __throw_exception_again;
257+ }
258 }
259
260 template<typename _CharT>
261--- gcc-4.2/libstdc++-v3/config/locale/uclibc/c_locale.h.old 2006-09-28 11:39:00.000000000 +0200
262+++ gcc-4.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-09-28 12:10:41.000000000 +0200
263@@ -39,21 +39,23 @@
264 #pragma GCC system_header
265
266 #include <cstring> // get std::strlen
267-#include <cstdio> // get std::snprintf or std::sprintf
268+#include <cstdio> // get std::vsnprintf or std::vsprintf
269 #include <clocale>
270 #include <langinfo.h> // For codecvt
271 #ifdef __UCLIBC_MJN3_ONLY__
272 #warning fix this
273 #endif
274-#ifdef __UCLIBC_HAS_LOCALE__
275+#ifdef _GLIBCXX_USE_ICONV
276 #include <iconv.h> // For codecvt using iconv, iconv_t
277 #endif
278-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
279-#include <libintl.h> // For messages
280+#ifdef HAVE_LIBINTL_H
281+#include <libintl.h> // For messages
282 #endif
283+#include <cstdarg>
284
285 #ifdef __UCLIBC_MJN3_ONLY__
286 #warning what is _GLIBCXX_C_LOCALE_GNU for
287+// psm: used in os/gnu-linux/ctype_noninline.h
288 #endif
289 #define _GLIBCXX_C_LOCALE_GNU 1
290
291@@ -62,7 +64,7 @@
292 #endif
293 // #define _GLIBCXX_NUM_CATEGORIES 6
294 #define _GLIBCXX_NUM_CATEGORIES 0
295-
296+
297 #ifdef __UCLIBC_HAS_XLOCALE__
298 namespace __gnu_cxx
299 {
300@@ -79,22 +81,24 @@
301 typedef int* __c_locale;
302 #endif
303
304- // Convert numeric value of type _Tv to string and return length of
305- // string. If snprintf is available use it, otherwise fall back to
306- // the unsafe sprintf which, in general, can be dangerous and should
307+ // Convert numeric value of type double to string and return length of
308+ // string. If vsnprintf is available use it, otherwise fall back to
309+ // the unsafe vsprintf which, in general, can be dangerous and should
310 // be avoided.
311- template<typename _Tv>
312- int
313- __convert_from_v(char* __out,
314- const int __size __attribute__ ((__unused__)),
315- const char* __fmt,
316-#ifdef __UCLIBC_HAS_XCLOCALE__
317- _Tv __v, const __c_locale& __cloc, int __prec)
318+ inline int
319+ __convert_from_v(const __c_locale&
320+#ifndef __UCLIBC_HAS_XCLOCALE__
321+ __cloc __attribute__ ((__unused__))
322+#endif
323+ ,
324+ char* __out,
325+ const int __size,
326+ const char* __fmt, ...)
327 {
328+ va_list __args;
329+#ifdef __UCLIBC_HAS_XCLOCALE__
330 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
331 #else
332- _Tv __v, const __c_locale&, int __prec)
333- {
334 # ifdef __UCLIBC_HAS_LOCALE__
335 char* __old = std::setlocale(LC_ALL, NULL);
336 char* __sav = new char[std::strlen(__old) + 1];
337@@ -103,7 +107,9 @@
338 # endif
339 #endif
340
341- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
342+ va_start(__args, __fmt);
343+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
344+ va_end(__args);
345
346 #ifdef __UCLIBC_HAS_XCLOCALE__
347 __gnu_cxx::__uselocale(__old);
diff --git a/meta/packages/gcc/gcc-4.2.2/300-libstdc++-pic.patch b/meta/packages/gcc/gcc-4.2.2/300-libstdc++-pic.patch
new file mode 100644
index 0000000000..89d03a85e5
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/300-libstdc++-pic.patch
@@ -0,0 +1,46 @@
1# DP: Build and install libstdc++_pic.a library.
2
3--- gcc-4.1.0/libstdc++-v3/src/Makefile.am 2004-11-15 17:33:05.000000000 -0600
4+++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.am 2005-04-25 20:05:59.186930896 -0500
5@@ -214,6 +214,10 @@
6 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
7
8
9+install-exec-local:
10+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
11+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
12+
13 # Added bits to build debug library.
14 if GLIBCXX_BUILD_DEBUG
15 all-local: build_debug
16--- gcc-4.1.0/libstdc++-v3/src/Makefile.in 2005-04-11 19:13:08.000000000 -0500
17+++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.in 2005-04-25 20:12:33.284316275 -0500
18@@ -627,7 +627,7 @@
19
20 install-data-am: install-data-local
21
22-install-exec-am: install-toolexeclibLTLIBRARIES
23+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
24
25 install-info: install-info-am
26
27@@ -660,6 +660,7 @@
28 distclean-libtool distclean-tags distdir dvi dvi-am html \
29 html-am info info-am install install-am install-data \
30 install-data-am install-data-local install-exec \
31+ install-exec-local \
32 install-exec-am install-info install-info-am install-man \
33 install-strip install-toolexeclibLTLIBRARIES installcheck \
34 installcheck-am installdirs maintainer-clean \
35@@ -745,6 +746,11 @@
36 install_debug:
37 (cd ${debugdir} && $(MAKE) \
38 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
39+
40+install-exec-local:
41+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
42+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
43+
44 # Tell versions [3.59,3.63) of GNU make to not export all variables.
45 # Otherwise a system limit (for SysV at least) may be exceeded.
46 .NOEXPORT:
diff --git a/meta/packages/gcc/gcc-4.2.2/301-missing-execinfo_h.patch b/meta/packages/gcc/gcc-4.2.2/301-missing-execinfo_h.patch
new file mode 100644
index 0000000000..0e2092f3fb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/301-missing-execinfo_h.patch
@@ -0,0 +1,11 @@
1--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500
2+++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500
3@@ -500,7 +500,7 @@
4 #ifdef __linux__
5 # include <features.h>
6 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
7- && !defined(__ia64__)
8+ && !defined(__ia64__) && !defined(__UCLIBC__)
9 # ifndef GC_HAVE_BUILTIN_BACKTRACE
10 # define GC_HAVE_BUILTIN_BACKTRACE
11 # endif
diff --git a/meta/packages/gcc/gcc-4.2.2/302-c99-snprintf.patch b/meta/packages/gcc/gcc-4.2.2/302-c99-snprintf.patch
new file mode 100644
index 0000000000..dfb22d681b
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/302-c99-snprintf.patch
@@ -0,0 +1,11 @@
1--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500
2+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500
3@@ -142,7 +142,7 @@
4 using ::vsprintf;
5 }
6
7-#if _GLIBCXX_USE_C99
8+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
9
10 #undef snprintf
11 #undef vfscanf
diff --git a/meta/packages/gcc/gcc-4.2.2/303-c99-complex-ugly-hack.patch b/meta/packages/gcc/gcc-4.2.2/303-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000000..2ccc80d9bb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/303-c99-complex-ugly-hack.patch
@@ -0,0 +1,12 @@
1--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500
2+++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500
3@@ -7194,6 +7194,9 @@
4 cat >>conftest.$ac_ext <<_ACEOF
5 /* end confdefs.h. */
6 #include <complex.h>
7+#ifdef __UCLIBC__
8+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
9+#endif
10 int
11 main ()
12 {
diff --git a/meta/packages/gcc/gcc-4.2.2/304-index_macro.patch b/meta/packages/gcc/gcc-4.2.2/304-index_macro.patch
new file mode 100644
index 0000000000..d8e476555d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/304-index_macro.patch
@@ -0,0 +1,24 @@
1--- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100
2+++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100
3@@ -59,6 +59,9 @@
4 #include <bits/allocator.h>
5 #include <ext/hash_fun.h>
6
7+/* cope w/ index defined as macro, SuSv3 proposal */
8+#undef index
9+
10 # ifdef __GC
11 # define __GC_CONST const
12 # else
13--- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100
14+++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100
15@@ -53,6 +53,9 @@
16 #include <ext/memory> // For uninitialized_copy_n
17 #include <ext/numeric> // For power
18
19+/* cope w/ index defined as macro, SuSv3 proposal */
20+#undef index
21+
22 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
23
24 using std::size_t;
diff --git a/meta/packages/gcc/gcc-4.2.2/305-libmudflap-susv3-legacy.patch b/meta/packages/gcc/gcc-4.2.2/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000000..374b1f8659
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/305-libmudflap-susv3-legacy.patch
@@ -0,0 +1,49 @@
1Index: gcc-4.2/libmudflap/mf-hooks2.c
2===================================================================
3--- gcc-4.2/libmudflap/mf-hooks2.c (revision 119834)
4+++ gcc-4.2/libmudflap/mf-hooks2.c (working copy)
5@@ -427,7 +427,7 @@
6 {
7 TRACE ("%s\n", __PRETTY_FUNCTION__);
8 MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
9- bzero (s, n);
10+ memset (s, 0, n);
11 }
12
13
14@@ -437,7 +437,7 @@
15 TRACE ("%s\n", __PRETTY_FUNCTION__);
16 MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
17 MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
18- bcopy (src, dest, n);
19+ memmove (dest, src, n);
20 }
21
22
23@@ -447,7 +447,7 @@
24 TRACE ("%s\n", __PRETTY_FUNCTION__);
25 MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
26 MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
27- return bcmp (s1, s2, n);
28+ return n == 0 ? 0 : memcmp (s1, s2, n);
29 }
30
31
32@@ -456,7 +456,7 @@
33 size_t n = strlen (s);
34 TRACE ("%s\n", __PRETTY_FUNCTION__);
35 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
36- return index (s, c);
37+ return strchr (s, c);
38 }
39
40
41@@ -465,7 +465,7 @@
42 size_t n = strlen (s);
43 TRACE ("%s\n", __PRETTY_FUNCTION__);
44 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
45- return rindex (s, c);
46+ return strrchr (s, c);
47 }
48
49 /* XXX: stpcpy, memccpy */
diff --git a/meta/packages/gcc/gcc-4.2.2/306-libstdc++-namespace.patch b/meta/packages/gcc/gcc-4.2.2/306-libstdc++-namespace.patch
new file mode 100644
index 0000000000..69587ca63a
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/306-libstdc++-namespace.patch
@@ -0,0 +1,36 @@
1diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h
2--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 13:06:56.000000000 +0100
3+++ gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 15:23:41.000000000 +0100
4@@ -32,7 +32,8 @@
5 //
6
7 // Written by Benjamin Kosnik <bkoz@redhat.com>
8-
9+namespace std
10+{
11 #ifdef __UCLIBC_MJN3_ONLY__
12 #warning fix prototypes for *textdomain funcs
13 #endif
14@@ -115,3 +116,4 @@
15 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
16 }
17 }
18+}
19diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h
20--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 13:06:56.000000000 +0100
21+++ gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 15:20:31.000000000 +0100
22@@ -33,7 +33,8 @@
23 //
24
25 // Written by Benjamin Kosnik <bkoz@redhat.com>
26-
27+namespace std
28+{
29 template<typename _CharT>
30 __timepunct<_CharT>::__timepunct(size_t __refs)
31 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
32@@ -74,3 +75,4 @@
33 delete _M_data;
34 _S_destroy_c_locale(_M_c_locale_timepunct);
35 }
36+}
diff --git a/meta/packages/gcc/gcc-4.2.2/307-locale_facets.patch b/meta/packages/gcc/gcc-4.2.2/307-locale_facets.patch
new file mode 100644
index 0000000000..412f8657dc
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/307-locale_facets.patch
@@ -0,0 +1,26 @@
1This patch fixes a bug into ostream::operator<<(double) due to the wrong size
2passed into the __convert_from_v method. The wrong size is then passed to
3std::snprintf function, that, on uClibc, doens't handle sized 0 buffer.
4
5Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
6
7--- gcc-4.2.1/libstdc++-v3/include/bits/locale_facets.tcc 2006-10-17 18:43:47.000000000 +0200
8+++ gcc-4.2.1-st/libstdc++-v3/include/bits/locale_facets.tcc 2007-08-22 18:54:23.000000000 +0200
9@@ -1143,7 +1143,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
10 const int __cs_size = __fixed ? __max_exp + __prec + 4
11 : __max_digits * 2 + __prec;
12 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
13- __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
14+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
15 __prec, __v);
16 #endif
17
18@@ -1777,7 +1777,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
19 // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
20 const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;
21 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
22- int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf",
23+ int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf",
24 0, __units);
25 #endif
26 string_type __digits(__len, char_type());
diff --git a/meta/packages/gcc/gcc-4.2.2/402-libbackend_dep_gcov-iov.h.patch b/meta/packages/gcc/gcc-4.2.2/402-libbackend_dep_gcov-iov.h.patch
new file mode 100644
index 0000000000..0bf115c45d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/402-libbackend_dep_gcov-iov.h.patch
@@ -0,0 +1,13 @@
1Index: gcc-4.2/gcc/Makefile.in
2===================================================================
3--- gcc-4.2/gcc/Makefile.in (revision 121758)
4+++ gcc-4.2/gcc/Makefile.in (working copy)
5@@ -2658,7 +2658,7 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H)
6 # FIXME: writing proper dependencies for this is a *LOT* of work.
7 libbackend.o : $(OBJS-common:.o=.c) $(out_file) \
8 insn-config.h insn-flags.h insn-codes.h insn-constants.h \
9- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
10+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
11 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
12 -DTARGET_NAME=\"$(target_noncanonical)\" \
13 -DLOCALEDIR=\"$(localedir)\" \
diff --git a/meta/packages/gcc/gcc-4.2.2/602-sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-4.2.2/602-sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..23fce7544d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/602-sdk-libstdc++-includes.patch
@@ -0,0 +1,20 @@
1--- gcc-4.1.0/libstdc++-v3/fragment.am 2005-03-21 11:40:14.000000000 -0600
2+++ gcc-4.1.0-patched/libstdc++-v3/fragment.am 2005-04-25 20:14:39.856251785 -0500
3@@ -21,5 +21,5 @@
4 $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
5
6 # -I/-D flags to pass when compiling.
7-AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
8+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include
9
10--- gcc-4.1.0/libstdc++-v3/libmath/Makefile.am 2005-03-21 11:40:18.000000000 -0600
11+++ gcc-4.1.0-patched/libstdc++-v3/libmath/Makefile.am 2005-04-25 20:14:39.682280735 -0500
12@@ -35,7 +35,7 @@
13
14 libmath_la_SOURCES = stubs.c
15
16-AM_CPPFLAGS = $(CANADIAN_INCLUDES)
17+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include
18
19 # Only compiling "C" sources in this directory.
20 LIBTOOL = @LIBTOOL@ --tag CC
diff --git a/meta/packages/gcc/gcc-4.2.2/740-sh-pr24836.patch b/meta/packages/gcc/gcc-4.2.2/740-sh-pr24836.patch
new file mode 100644
index 0000000000..7992282cff
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/740-sh-pr24836.patch
@@ -0,0 +1,25 @@
1http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
2http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
3
4--- gcc/gcc/configure.ac (revision 106699)
5+++ gcc/gcc/configure.ac (working copy)
6@@ -2446,7 +2446,7 @@
7 tls_first_minor=14
8 tls_as_opt="-m64 -Aesame --fatal-warnings"
9 ;;
10- sh-*-* | sh[34]-*-*)
11+ sh-*-* | sh[34]*-*-*)
12 conftest_s='
13 .section ".tdata","awT",@progbits
14 foo: .long 25
15--- gcc/gcc/configure
16+++ gcc/gcc/configure
17@@ -14846,7 +14846,7 @@
18 tls_first_minor=14
19 tls_as_opt="-m64 -Aesame --fatal-warnings"
20 ;;
21- sh-*-* | sh[34]-*-*)
22+ sh-*-* | sh[34]*-*-*)
23 conftest_s='
24 .section ".tdata","awT",@progbits
25 foo: .long 25
diff --git a/meta/packages/gcc/gcc-4.2.2/800-arm-bigendian.patch b/meta/packages/gcc/gcc-4.2.2/800-arm-bigendian.patch
new file mode 100644
index 0000000000..07c6093379
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/800-arm-bigendian.patch
@@ -0,0 +1,67 @@
1By Lennert Buytenhek <buytenh@wantstofly.org>
2Adds support for arm*b-linux* big-endian ARM targets
3
4See http://gcc.gnu.org/PR16350
5
6--- gcc-4.2.0/gcc/config/arm/linux-elf.h
7+++ gcc-4.2.0/gcc/config/arm/linux-elf.h
8@@ -28,19 +28,33 @@
9 #undef TARGET_VERSION
10 #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
11
12+/*
13+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
14+ * (big endian) configurations.
15+ */
16+#if TARGET_BIG_ENDIAN_DEFAULT
17+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
18+#define TARGET_ENDIAN_OPTION "mbig-endian"
19+#define TARGET_LINKER_EMULATION "armelfb_linux"
20+#else
21+#define TARGET_ENDIAN_DEFAULT 0
22+#define TARGET_ENDIAN_OPTION "mlittle-endian"
23+#define TARGET_LINKER_EMULATION "armelf_linux"
24+#endif
25+
26 #undef TARGET_DEFAULT_FLOAT_ABI
27 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
28
29 #undef TARGET_DEFAULT
30-#define TARGET_DEFAULT (0)
31+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
32
33 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
34
35-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
36+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
37
38 #undef MULTILIB_DEFAULTS
39 #define MULTILIB_DEFAULTS \
40- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
41+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
42
43 /* Now we define the strings used to build the spec file. */
44 #undef LIB_SPEC
45@@ -61,7 +75,7 @@
46 %{rdynamic:-export-dynamic} \
47 %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
48 -X \
49- %{mbig-endian:-EB}" \
50+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
51 SUBTARGET_EXTRA_LINK_SPEC
52
53 #undef LINK_SPEC
54--- gcc-4.2.0/gcc/config.gcc.orig 2006-09-22 14:53:41.000000000 +0200
55+++ gcc-4.2.0/gcc/config.gcc 2006-09-25 10:45:21.000000000 +0200
56@@ -696,6 +696,11 @@
57 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
58 tmake_file="${tmake_file} t-linux arm/t-arm"
59 case ${target} in
60+ arm*b-*)
61+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
62+ ;;
63+ esac
64+ case ${target} in
65 arm*-*-linux-*eabi)
66 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
67 tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
diff --git a/meta/packages/gcc/gcc-4.2.2/801-arm-bigendian-eabi.patch b/meta/packages/gcc/gcc-4.2.2/801-arm-bigendian-eabi.patch
new file mode 100644
index 0000000000..54490fc24f
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/801-arm-bigendian-eabi.patch
@@ -0,0 +1,14 @@
1Index: gcc-4.1.1/gcc/config/arm/linux-eabi.h
2===================================================================
3--- gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h 2007-02-20 14:51:33.416193250 +0100
4+++ gcc-4.1.1/gcc/config/arm/linux-eabi.h 2007-02-20 14:52:11.622581000 +0100
5@@ -48,7 +48,8 @@
6 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
7
8 #undef SUBTARGET_EXTRA_LINK_SPEC
9-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
10+#define SUBTARGET_EXTRA_LINK_SPEC \
11+ " %{mbig-endian:-m armelfb_linux_eabi} %{mlittle-endian:-m armelf_linux_eabi} "
12
13 /* Use ld-linux.so.3 so that it will be possible to run "classic"
14 GNU/Linux binaries on an EABI system. */
diff --git a/meta/packages/gcc/gcc-4.2.2/904-flatten-switch-stmt-00.patch b/meta/packages/gcc/gcc-4.2.2/904-flatten-switch-stmt-00.patch
new file mode 100644
index 0000000000..8fac37c4df
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/904-flatten-switch-stmt-00.patch
@@ -0,0 +1,153 @@
1Hi,
2
3The attached patch makes sure that we create smaller object code for
4simple switch statements. We just make sure to flatten the switch
5statement into an if-else chain, basically.
6
7This fixes a size-regression as compared to gcc-3.4, as can be seen
8below.
9
102007-04-15 Bernhard Fischer <..>
11
12 * stmt.c (expand_case): Do not create a complex binary tree when
13 optimizing for size but rather use the simple ordered list.
14 (emit_case_nodes): do not emit jumps to the default_label when
15 optimizing for size.
16
17Not regtested so far.
18Comments?
19
20Attached is the test switch.c mentioned below.
21
22$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
23gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done
24$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
25gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done
26
27$ size switch-*.o
28 text data bss dec hex filename
29 169 0 0 169 a9 switch-2.95.o
30 115 0 0 115 73 switch-3.3.o
31 103 0 0 103 67 switch-3.4.o
32 124 0 0 124 7c switch-4.0.o
33 124 0 0 124 7c switch-4.1.o
34 124 0 0 124 7c switch-4.2.orig-HEAD.o
35 95 0 0 95 5f switch-4.3-HEAD.o
36 124 0 0 124 7c switch-4.3.orig-HEAD.o
37 166 0 0 166 a6 switch-CHAIN-2.95.o
38 111 0 0 111 6f switch-CHAIN-3.3.o
39 95 0 0 95 5f switch-CHAIN-3.4.o
40 95 0 0 95 5f switch-CHAIN-4.0.o
41 95 0 0 95 5f switch-CHAIN-4.1.o
42 95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o
43 95 0 0 95 5f switch-CHAIN-4.3-HEAD.o
44 95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o
45
46
47Content-Type: text/x-diff; charset=us-ascii
48Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff"
49
50Index: gcc-4.2.0/gcc/stmt.c
51===================================================================
52--- gcc-4.2.0.orig/gcc/stmt.c (revision 123843)
53+++ gcc-4.2.0/gcc/stmt.c (working copy)
54@@ -2517,7 +2517,11 @@ expand_case (tree exp)
55 use_cost_table
56 = (TREE_CODE (orig_type) != ENUMERAL_TYPE
57 && estimate_case_costs (case_list));
58- balance_case_nodes (&case_list, NULL);
59+ /* When optimizing for size, we want a straight list to avoid
60+ jumps as much as possible. This basically creates an if-else
61+ chain. */
62+ if (!optimize_size)
63+ balance_case_nodes (&case_list, NULL);
64 emit_case_nodes (index, case_list, default_label, index_type);
65 emit_jump (default_label);
66 }
67@@ -3075,6 +3079,7 @@ emit_case_nodes (rtx index, case_node_pt
68 {
69 if (!node_has_low_bound (node, index_type))
70 {
71+ if (!optimize_size) /* don't jl to the .default_label. */
72 emit_cmp_and_jump_insns (index,
73 convert_modes
74 (mode, imode,
75
76
77Content-Type: text/x-csrc; charset=us-ascii
78Content-Disposition: attachment; filename="switch.c"
79
80int
81commutative_tree_code (int code)
82{
83#define CASE(val, ret) case val:/* __asm__("# val="#val ",ret="#ret);*/ return ret;
84#ifndef CHAIN
85 switch (code)
86 {
87# if 1
88 CASE(1,3)
89 CASE(3,2)
90 CASE(5,8)
91 CASE(7,1)
92 CASE(33,4)
93 CASE(44,9)
94 CASE(55,10)
95 CASE(66,-1)
96 CASE(77,99)
97 CASE(666,0)
98# else
99 case 1:
100 return 3;
101 case 3:
102 return 2;
103 case 5:
104 return 8;
105 case 7:
106 return 1;
107 case 33:
108 return 4;
109 case 44:
110 return 9;
111 case 55:
112 return 10;
113 case 66:
114 return -1;
115 case 77:
116 return 99;
117 case 666:
118 return 0;
119# endif
120 default:
121 break;
122 }
123 return 4711;
124
125#else
126 if (code == 1)
127 return 3;
128 else if (code == 3)
129 return 2;
130 else if (code == 5)
131 return 8;
132 else if (code == 7)
133 return 1;
134 else if (code == 33)
135 return 4;
136 else if (code == 44)
137 return 9;
138 else if (code == 55)
139 return 10;
140 else if (code == 66)
141 return -1;
142 else if (code == 77)
143 return 99;
144 else if (code == 666)
145 return 0;
146 else
147 return 4711;
148#endif
149}
150
151
152--AhhlLboLdkugWU4S--
153
diff --git a/meta/packages/gcc/gcc-4.2.2/README b/meta/packages/gcc/gcc-4.2.2/README
new file mode 100644
index 0000000000..b85840dc20
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/README
@@ -0,0 +1,4 @@
1The numbered patches come from
2http://www.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/gcc/4.1.1/
3Other patches are locally added to fix things (mostly inherited and reapplied
4from gcc 3.4.4 where applicable)
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-20000320.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-20000320.patch
new file mode 100644
index 0000000000..3fb0da7670
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-20000320.patch
@@ -0,0 +1,11 @@
1--- gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c.original 2007-06-07 16:33:44.000000000 +1000
2+++ gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c 2007-06-07 16:34:05.000000000 +1000
3@@ -49,7 +49,7 @@
4 exit (0);
5
6 c(0x3690000000000000ULL, 0x00000000U);
7-#if (defined __arm__ || defined __thumb__) && ! (defined __ARMEB__ || defined __VFP_FP__)
8+#if (defined __arm__ || defined __thumb__) && ! (defined __ARMEB__ || defined __VFP_FP__) && ! (defined __MAVERICK__)
9 /* The ARM always stores FP numbers in big-wordian format,
10 even when running in little-byteian mode. */
11 c(0x0000000136900000ULL, 0x00000001U);
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-32bit-disable.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-32bit-disable.patch
new file mode 100644
index 0000000000..88eaee322d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-32bit-disable.patch
@@ -0,0 +1,85 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-integer 2007-06-15 09:01:37.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-15 09:04:45.000000000 +1000
3@@ -149,7 +149,7 @@
4 (match_operand:SI 1 "cirrus_fp_register" "0")
5 (mult:SI (match_operand:SI 2 "cirrus_fp_register" "v")
6 (match_operand:SI 3 "cirrus_fp_register" "v"))))]
7- "0 && TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
8+ "0 && TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
9 "cfmsc32%?\\t%V0, %V2, %V3"
10 [(set_attr "type" "mav_farith")
11 (set_attr "cirrus" "normal")]
12@@ -305,7 +305,7 @@
13 [(set (match_operand:SF 0 "cirrus_fp_register" "=v")
14 (float:SF (match_operand:SI 1 "s_register_operand" "r")))
15 (clobber (match_scratch:DF 2 "=v"))]
16- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
17+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
18 "cfmv64lr%?\\t%Z2, %1\;cfcvt32s%?\\t%V0, %Y2"
19 [(set_attr "length" "8")
20 (set_attr "cirrus" "move")]
21@@ -315,7 +315,7 @@
22 [(set (match_operand:DF 0 "cirrus_fp_register" "=v")
23 (float:DF (match_operand:SI 1 "s_register_operand" "r")))
24 (clobber (match_scratch:DF 2 "=v"))]
25- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
26+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
27 "cfmv64lr%?\\t%Z2, %1\;cfcvt32d%?\\t%V0, %Y2"
28 [(set_attr "length" "8")
29 (set_attr "cirrus" "move")]
30@@ -339,7 +339,7 @@
31 [(set (match_operand:SI 0 "s_register_operand" "=r")
32 (fix:SI (fix:SF (match_operand:SF 1 "cirrus_fp_register" "v"))))
33 (clobber (match_scratch:DF 2 "=v"))]
34- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
35+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
36 "cftruncs32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2"
37 [(set_attr "length" "8")
38 (set_attr "cirrus" "normal")]
39@@ -349,7 +349,7 @@
40 [(set (match_operand:SI 0 "s_register_operand" "=r")
41 (fix:SI (fix:DF (match_operand:DF 1 "cirrus_fp_register" "v"))))
42 (clobber (match_scratch:DF 2 "=v"))]
43- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
44+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
45 "cftruncd32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2"
46 [(set_attr "length" "8")
47 (set_attr "cirrus" "normal")]
48--- gcc-4.1.2/gcc/config/arm/arm.md-trunc 2007-06-15 10:56:13.000000000 +1000
49+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-15 11:01:22.000000000 +1000
50@@ -3130,7 +3130,7 @@
51 (float:SF (match_operand:SI 1 "s_register_operand" "")))]
52 "TARGET_ARM && TARGET_HARD_FLOAT"
53 "
54- if (TARGET_MAVERICK)
55+ if (TARGET_MAVERICK && 0)
56 {
57 emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1]));
58 DONE;
59@@ -3142,7 +3142,7 @@
60 (float:DF (match_operand:SI 1 "s_register_operand" "")))]
61 "TARGET_ARM && TARGET_HARD_FLOAT"
62 "
63- if (TARGET_MAVERICK)
64+ if (TARGET_MAVERICK && 0)
65 {
66 emit_insn (gen_cirrus_floatsidf2 (operands[0], operands[1]));
67 DONE;
68@@ -3154,7 +3154,7 @@
69 (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))]
70 "TARGET_ARM && TARGET_HARD_FLOAT"
71 "
72- if (TARGET_MAVERICK)
73+ if (TARGET_MAVERICK && 0)
74 {
75 if (!cirrus_fp_register (operands[0], SImode))
76 operands[0] = force_reg (SImode, operands[0]);
77@@ -3170,7 +3170,7 @@
78 (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" ""))))]
79 "TARGET_ARM && TARGET_HARD_FLOAT"
80 "
81- if (TARGET_MAVERICK)
82+ if (TARGET_MAVERICK && 0)
83 {
84 if (!cirrus_fp_register (operands[1], DFmode))
85 operands[1] = force_reg (DFmode, operands[0]);
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable-4.2.0.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable-4.2.0.patch
new file mode 100644
index 0000000000..60b17852bd
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable-4.2.0.patch
@@ -0,0 +1,169 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-integer 2007-06-15 09:01:37.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-15 09:04:45.000000000 +1000
3@@ -34,7 +34,7 @@
4 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
5 (plus:DI (match_operand:DI 1 "cirrus_fp_register" "v")
6 (match_operand:DI 2 "cirrus_fp_register" "v")))]
7- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
8+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
9 "cfadd64%?\\t%V0, %V1, %V2"
10 [(set_attr "type" "mav_farith")
11 (set_attr "cirrus" "normal")]
12@@ -74,7 +74,7 @@
13 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
14 (minus:DI (match_operand:DI 1 "cirrus_fp_register" "v")
15 (match_operand:DI 2 "cirrus_fp_register" "v")))]
16- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
17+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
18 "cfsub64%?\\t%V0, %V1, %V2"
19 [(set_attr "type" "mav_farith")
20 (set_attr "cirrus" "normal")]
21@@ -124,7 +124,7 @@
22 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
23 (mult:DI (match_operand:DI 2 "cirrus_fp_register" "v")
24 (match_operand:DI 1 "cirrus_fp_register" "v")))]
25- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
26+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
27 "cfmul64%?\\t%V0, %V1, %V2"
28 [(set_attr "type" "mav_dmult")
29 (set_attr "cirrus" "normal")]
30@@ -206,7 +206,7 @@
31 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
32 (ashift:DI (match_operand:DI 1 "cirrus_fp_register" "v")
33 (match_operand:SI 2 "register_operand" "r")))]
34- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
35+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
36 "cfrshl64%?\\t%V1, %V0, %s2"
37 [(set_attr "cirrus" "normal")]
38 )
39@@ -215,7 +215,7 @@
40 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
41 (ashift:DI (match_operand:DI 1 "cirrus_fp_register" "v")
42 (match_operand:SI 2 "cirrus_shift_const" "")))]
43- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
44+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
45 "cfsh64%?\\t%V0, %V1, #%s2"
46 [(set_attr "cirrus" "normal")]
47 )
48@@ -224,7 +224,7 @@
49 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
50 (ashiftrt:DI (match_operand:DI 1 "cirrus_fp_register" "v")
51 (match_operand:SI 2 "cirrus_shift_const" "")))]
52- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
53+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
54 "cfsh64%?\\t%V0, %V1, #-%s2"
55 [(set_attr "cirrus" "normal")]
56 )
57@@ -232,7 +232,7 @@
58 (define_insn "*cirrus_absdi2"
59 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
60 (abs:DI (match_operand:DI 1 "cirrus_fp_register" "v")))]
61- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
62+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
63 "cfabs64%?\\t%V0, %V1"
64 [(set_attr "cirrus" "normal")]
65 )
66@@ -238,11 +238,12 @@
67 )
68
69 ;; This doesn't really clobber ``cc''. Fixme: aldyh.
70+;; maybe buggy?
71 (define_insn "*cirrus_negdi2"
72 [(set (match_operand:DI 0 "cirrus_fp_register" "=v")
73 (neg:DI (match_operand:DI 1 "cirrus_fp_register" "v")))
74 (clobber (reg:CC CC_REGNUM))]
75- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
76+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
77 "cfneg64%?\\t%V0, %V1"
78 [(set_attr "cirrus" "normal")]
79 )
80@@ -324,14 +324,14 @@
81 (define_insn "floatdisf2"
82 [(set (match_operand:SF 0 "cirrus_fp_register" "=v")
83 (float:SF (match_operand:DI 1 "cirrus_fp_register" "v")))]
84- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
85+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
86 "cfcvt64s%?\\t%V0, %V1"
87 [(set_attr "cirrus" "normal")])
88
89 (define_insn "floatdidf2"
90 [(set (match_operand:DF 0 "cirrus_fp_register" "=v")
91 (float:DF (match_operand:DI 1 "cirrus_fp_register" "v")))]
92- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
93+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
94 "cfcvt64d%?\\t%V0, %V1"
95 [(set_attr "cirrus" "normal")])
96
97@@ -376,7 +376,7 @@
98 (define_insn "*cirrus_arm_movdi"
99 [(set (match_operand:DI 0 "nonimmediate_di_operand" "=r,r,o<>,v,r,v,m,v")
100 (match_operand:DI 1 "di_operand" "rIK,mi,r,r,v,mi,v,v"))]
101- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
102+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
103 "*
104 {
105 switch (which_alternative)
106--- gcc-4.1.2/gcc/config/arm/arm.md-64 2007-06-15 11:37:42.000000000 +1000
107+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-15 11:40:45.000000000 +1000
108@@ -357,7 +357,7 @@
109 (clobber (reg:CC CC_REGNUM))])]
110 "TARGET_EITHER"
111 "
112- if (TARGET_HARD_FLOAT && TARGET_MAVERICK)
113+ if (TARGET_HARD_FLOAT && TARGET_MAVERICK && 0)
114 {
115 if (!cirrus_fp_register (operands[0], DImode))
116 operands[0] = force_reg (DImode, operands[0]);
117@@ -393,7 +393,7 @@
118 (plus:DI (match_operand:DI 1 "s_register_operand" "%0, 0")
119 (match_operand:DI 2 "s_register_operand" "r, 0")))
120 (clobber (reg:CC CC_REGNUM))]
121- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
122+ "TARGET_ARM"
123 "#"
124 "TARGET_ARM && reload_completed"
125 [(parallel [(set (reg:CC_C CC_REGNUM)
126@@ -421,7 +421,7 @@
127 (match_operand:SI 2 "s_register_operand" "r,r"))
128 (match_operand:DI 1 "s_register_operand" "r,0")))
129 (clobber (reg:CC CC_REGNUM))]
130- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
131+ "TARGET_ARM"
132 "#"
133 "TARGET_ARM && reload_completed"
134 [(parallel [(set (reg:CC_C CC_REGNUM)
135@@ -450,7 +450,7 @@
136 (match_operand:SI 2 "s_register_operand" "r,r"))
137 (match_operand:DI 1 "s_register_operand" "r,0")))
138 (clobber (reg:CC CC_REGNUM))]
139- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
140+ "TARGET_ARM"
141 "#"
142 "TARGET_ARM && reload_completed"
143 [(parallel [(set (reg:CC_C CC_REGNUM)
144@@ -838,7 +838,7 @@
145 if (TARGET_HARD_FLOAT && TARGET_MAVERICK
146 && TARGET_ARM
147 && cirrus_fp_register (operands[0], DImode)
148- && cirrus_fp_register (operands[1], DImode))
149+ && cirrus_fp_register (operands[1], DImode) && 0)
150 {
151 emit_insn (gen_cirrus_subdi3 (operands[0], operands[1], operands[2]));
152 DONE;
153@@ -2599,7 +2599,7 @@
154 values to iwmmxt regs and back. */
155 FAIL;
156 }
157- else if (!TARGET_REALLY_IWMMXT && !(TARGET_HARD_FLOAT && TARGET_MAVERICK))
158+ else if (!TARGET_REALLY_IWMMXT)
159 FAIL;
160 "
161 )
162@@ -4215,7 +4215,6 @@
163 [(set (match_operand:DI 0 "nonimmediate_operand" "=l,l,l,l,>,l, m,*r")
164 (match_operand:DI 1 "general_operand" "l, I,J,>,l,mi,l,*r"))]
165 "TARGET_THUMB
166- && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)
167 && ( register_operand (operands[0], DImode)
168 || register_operand (operands[1], DImode))"
169 "*
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable0.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable0.patch
new file mode 100644
index 0000000000..95abf68a60
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-64bit-disable0.patch
@@ -0,0 +1,47 @@
1diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.md gcc-4.1.2/gcc/config/arm/arm.md
2--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.md 2006-09-28 03:10:22.000000000 +1000
3+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-05-15 09:53:21.000000000 +1000
4@@ -6865,10 +6877,12 @@
5 )
6
7 ;; Cirrus DI compare instruction
8+;; This is disabled and left go through ARM core registers, because currently
9+;; Crunch coprocessor does only signed comparison.
10 (define_expand "cmpdi"
11 [(match_operand:DI 0 "cirrus_fp_register" "")
12 (match_operand:DI 1 "cirrus_fp_register" "")]
13- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
14+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK & 0"
15 "{
16 arm_compare_op0 = operands[0];
17 arm_compare_op1 = operands[1];
18@@ -6879,7 +6893,7 @@
19 [(set (reg:CC CC_REGNUM)
20 (compare:CC (match_operand:DI 0 "cirrus_fp_register" "v")
21 (match_operand:DI 1 "cirrus_fp_register" "v")))]
22- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
23+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK & 0"
24 "cfcmp64%?\\tr15, %V0, %V1"
25 [(set_attr "type" "mav_farith")
26 (set_attr "cirrus" "compare")]
27@@ -10105,6 +10119,7 @@
28 [(unspec:SI [(match_operand:SI 0 "register_operand" "")] UNSPEC_PROLOGUE_USE)]
29 ""
30 "%@ %0 needed for prologue"
31+ [(set_attr "length" "0")]
32 )
33
34
35diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/cirrus.md gcc-4.1.2/gcc/config/arm/cirrus.md
36--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/cirrus.md 2005-06-25 11:22:41.000000000 +1000
37+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-05-15 09:55:29.000000000 +1000
38@@ -348,7 +348,8 @@
39 (clobber (match_scratch:DF 2 "=v"))]
40 "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
41 "cftruncd32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2"
42- [(set_attr "length" "8")]
43+ [(set_attr "length" "8")
44+ (set_attr "cirrus" "normal")]
45 )
46
47 (define_insn "*cirrus_truncdfsf2"
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-and-or.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-and-or.patch
new file mode 100644
index 0000000000..24357d316e
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-and-or.patch
@@ -0,0 +1,67 @@
1--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-13 17:16:38.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-13 17:35:19.000000000 +1000
3@@ -8455,7 +8455,7 @@
4 (and:SI (match_operator:SI 1 "arm_comparison_operator"
5 [(match_operand 3 "cc_register" "") (const_int 0)])
6 (match_operand:SI 2 "s_register_operand" "r")))]
7- "TARGET_ARM"
8+ "TARGET_ARM && !TARGET_MAVERICK"
9 "mov%D1\\t%0, #0\;and%d1\\t%0, %2, #1"
10 [(set_attr "conds" "use")
11 (set_attr "length" "8")]
12@@ -8466,7 +8466,7 @@
13 (ior:SI (match_operator:SI 2 "arm_comparison_operator"
14 [(match_operand 3 "cc_register" "") (const_int 0)])
15 (match_operand:SI 1 "s_register_operand" "0,?r")))]
16- "TARGET_ARM"
17+ "TARGET_ARM && !TARGET_MAVERICK"
18 "@
19 orr%d2\\t%0, %1, #1
20 mov%D2\\t%0, %1\;orr%d2\\t%0, %1, #1"
21@@ -8734,7 +8734,8 @@
22 (clobber (reg:CC CC_REGNUM))]
23 "TARGET_ARM
24 && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_OR_Y)
25- != CCmode)"
26+ != CCmode)
27+ && !TARGET_MAVERICK"
28 "#"
29 "TARGET_ARM && reload_completed"
30 [(set (match_dup 7)
31@@ -8765,7 +8766,7 @@
32 (set (match_operand:SI 7 "s_register_operand" "=r")
33 (ior:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)])
34 (match_op_dup 6 [(match_dup 4) (match_dup 5)])))]
35- "TARGET_ARM"
36+ "TARGET_ARM && !TARGET_MAVERICK"
37 "#"
38 "TARGET_ARM && reload_completed"
39 [(set (match_dup 0)
40@@ -8790,7 +8791,8 @@
41 (clobber (reg:CC CC_REGNUM))]
42 "TARGET_ARM
43 && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y)
44- != CCmode)"
45+ != CCmode)
46+ && !TARGET_MAVERICK"
47 "#"
48 "TARGET_ARM && reload_completed
49 && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y)
50@@ -8823,7 +8825,7 @@
51 (set (match_operand:SI 7 "s_register_operand" "=r")
52 (and:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)])
53 (match_op_dup 6 [(match_dup 4) (match_dup 5)])))]
54- "TARGET_ARM"
55+ "TARGET_ARM && !TARGET_MAVERICK"
56 "#"
57 "TARGET_ARM && reload_completed"
58 [(set (match_dup 0)
59@@ -8850,7 +8852,7 @@
60 [(match_operand:SI 4 "s_register_operand" "r,r,r")
61 (match_operand:SI 5 "arm_add_operand" "rIL,rIL,rIL")])))
62 (clobber (reg:CC CC_REGNUM))]
63- "TARGET_ARM
64+ "TARGET_ARM && !TARGET_MAVERICK
65 && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y)
66 == CCmode)"
67 "#"
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvt64-disable.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvt64-disable.patch
new file mode 100644
index 0000000000..f9280b18b5
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvt64-disable.patch
@@ -0,0 +1,19 @@
1--- gcc-4.2.0/gcc/config/arm/cirrus.md-original 2007-06-25 15:32:01.000000000 +1000
2+++ gcc-4.2.0/gcc/config/arm/cirrus.md 2007-06-25 15:32:14.000000000 +1000
3@@ -325,14 +325,14 @@
4 (define_insn "floatdisf2"
5 [(set (match_operand:SF 0 "cirrus_fp_register" "=v")
6 (float:SF (match_operand:DI 1 "cirrus_fp_register" "v")))]
7- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
8+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
9 "cfcvt64s%?\\t%V0, %V1"
10 [(set_attr "cirrus" "normal")])
11
12 (define_insn "floatdidf2"
13 [(set (match_operand:DF 0 "cirrus_fp_register" "=v")
14 (float:DF (match_operand:DI 1 "cirrus_fp_register" "v")))]
15- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
16+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
17 "cfcvt64d%?\\t%V0, %V1"
18 [(set_attr "cirrus" "normal")])
19
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvtds-disable.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvtds-disable.patch
new file mode 100644
index 0000000000..ec09ea16a1
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-cfcvtds-disable.patch
@@ -0,0 +1,32 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-15 10:06:24.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-15 10:07:21.000000000 +1000
3@@ -355,11 +355,12 @@
4 (set_attr "cirrus" "normal")]
5 )
6
7+; appears to be buggy - causes 20000320-1.c to fail in execute/ieee
8 (define_insn "*cirrus_truncdfsf2"
9 [(set (match_operand:SF 0 "cirrus_fp_register" "=v")
10 (float_truncate:SF
11 (match_operand:DF 1 "cirrus_fp_register" "v")))]
12- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
13+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
14 "cfcvtds%?\\t%V0, %V1"
15 [(set_attr "cirrus" "normal")]
16 )
17--- gcc-4.1.2/gcc/config/arm/arm.md-truncdfsf2 2007-06-15 10:25:43.000000000 +1000
18+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-15 10:27:01.000000000 +1000
19@@ -3181,11 +3181,12 @@
20
21 ;; Truncation insns
22
23+;; Maverick Crunch truncdfsf2 is buggy - see cirrus.md
24 (define_expand "truncdfsf2"
25 [(set (match_operand:SF 0 "s_register_operand" "")
26 (float_truncate:SF
27 (match_operand:DF 1 "s_register_operand" "")))]
28- "TARGET_ARM && TARGET_HARD_FLOAT"
29+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
30 ""
31 )
32
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-cirrus-bugfixes.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-cirrus-bugfixes.patch
new file mode 100644
index 0000000000..cb0af8546d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-cirrus-bugfixes.patch
@@ -0,0 +1,573 @@
1diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c gcc-4.1.2/gcc/config/arm/arm.c
2--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c 2007-05-09 16:32:29.000000000 +1000
3+++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-15 09:39:41.000000000 +1000
4@@ -4,6 +4,7 @@
5 Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
6 and Martin Simmons (@harleqn.co.uk).
7 More major hacks by Richard Earnshaw (rearnsha@arm.com).
8+ Cirrus Crunch bugfixes by Vladimir Ivanov (vladit@nucleusys.com)
9
10 This file is part of GCC.
11
12@@ -131,9 +132,17 @@
13 static bool arm_xscale_rtx_costs (rtx, int, int, int *);
14 static bool arm_9e_rtx_costs (rtx, int, int, int *);
15 static int arm_address_cost (rtx);
16-static bool arm_memory_load_p (rtx);
17+// static bool arm_memory_load_p (rtx);
18 static bool arm_cirrus_insn_p (rtx);
19-static void cirrus_reorg (rtx);
20+// static void cirrus_reorg (rtx);
21+static bool arm_mem_access_p (rtx);
22+static bool cirrus_dest_regn_p (rtx, int);
23+static rtx cirrus_prev_next_mach_insn (rtx, int *, int);
24+static rtx cirrus_prev_mach_insn (rtx, int *);
25+static rtx cirrus_next_mach_insn (rtx, int *);
26+static void cirrus_reorg_branch (rtx);
27+static void cirrus_reorg_bug1 (rtx);
28+static void cirrus_reorg_bug10_12 (rtx);
29 static void arm_init_builtins (void);
30 static rtx arm_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
31 static void arm_init_iwmmxt_builtins (void);
32@@ -5399,41 +5412,6 @@
33 || TREE_CODE (valtype) == COMPLEX_TYPE));
34 }
35
36-/* Returns TRUE if INSN is an "LDR REG, ADDR" instruction.
37- Use by the Cirrus Maverick code which has to workaround
38- a hardware bug triggered by such instructions. */
39-static bool
40-arm_memory_load_p (rtx insn)
41-{
42- rtx body, lhs, rhs;;
43-
44- if (insn == NULL_RTX || GET_CODE (insn) != INSN)
45- return false;
46-
47- body = PATTERN (insn);
48-
49- if (GET_CODE (body) != SET)
50- return false;
51-
52- lhs = XEXP (body, 0);
53- rhs = XEXP (body, 1);
54-
55- lhs = REG_OR_SUBREG_RTX (lhs);
56-
57- /* If the destination is not a general purpose
58- register we do not have to worry. */
59- if (GET_CODE (lhs) != REG
60- || REGNO_REG_CLASS (REGNO (lhs)) != GENERAL_REGS)
61- return false;
62-
63- /* As well as loads from memory we also have to react
64- to loads of invalid constants which will be turned
65- into loads from the minipool. */
66- return (GET_CODE (rhs) == MEM
67- || GET_CODE (rhs) == SYMBOL_REF
68- || note_invalid_constants (insn, -1, false));
69-}
70-
71 /* Return TRUE if INSN is a Cirrus instruction. */
72 static bool
73 arm_cirrus_insn_p (rtx insn)
74@@ -5452,124 +5433,218 @@
75 return attr != CIRRUS_NOT;
76 }
77
78-/* Cirrus reorg for invalid instruction combinations. */
79-static void
80-cirrus_reorg (rtx first)
81+/* Return TRUE if ISN does memory access. */
82+static bool
83+arm_mem_access_p (rtx insn)
84 {
85- enum attr_cirrus attr;
86- rtx body = PATTERN (first);
87- rtx t;
88- int nops;
89+ enum attr_type attr;
90
91- /* Any branch must be followed by 2 non Cirrus instructions. */
92- if (GET_CODE (first) == JUMP_INSN && GET_CODE (body) != RETURN)
93- {
94- nops = 0;
95- t = next_nonnote_insn (first);
96+ /* get_attr aborts on USE and CLOBBER. */
97+ if (!insn
98+ || GET_CODE (insn) != INSN
99+ || GET_CODE (PATTERN (insn)) == USE
100+ || GET_CODE (PATTERN (insn)) == CLOBBER)
101+ return 0;
102
103- if (arm_cirrus_insn_p (t))
104- ++ nops;
105+ attr = get_attr_type (insn);
106
107- if (arm_cirrus_insn_p (next_nonnote_insn (t)))
108- ++ nops;
109+ return attr == TYPE_LOAD_BYTE
110+ || attr == TYPE_LOAD1 || attr == TYPE_LOAD2 || attr == TYPE_LOAD3 || attr == TYPE_LOAD4
111+ || attr == TYPE_F_CVT
112+ || attr == TYPE_F_MEM_R || attr == TYPE_R_MEM_F || attr == TYPE_F_2_R || attr == TYPE_R_2_F
113+ || attr == TYPE_F_LOAD || attr == TYPE_F_LOADS || attr == TYPE_F_LOADD
114+ || attr == TYPE_F_STORE || attr == TYPE_F_STORES || attr == TYPE_F_STORED
115+ || attr == TYPE_STORE1 || attr == TYPE_STORE2 || attr == TYPE_STORE3 || attr == TYPE_STORE4;
116+
117+}
118
119- while (nops --)
120- emit_insn_after (gen_nop (), first);
121+/* Return TRUE if destination is certain Cirrus register. */
122+static bool
123+cirrus_dest_regn_p (rtx body, int regn)
124+{
125+ rtx lhs;
126+ int reg;
127+ lhs = XEXP (body, 0);
128+ if (GET_CODE (lhs) != REG)
129+ return 0;
130
131- return;
132- }
133+ reg = REGNO (lhs);
134+ if (REGNO_REG_CLASS (reg) != CIRRUS_REGS)
135+ return 0;
136
137- /* (float (blah)) is in parallel with a clobber. */
138- if (GET_CODE (body) == PARALLEL && XVECLEN (body, 0) > 0)
139- body = XVECEXP (body, 0, 0);
140+ return reg == regn;
141+}
142+
143+/* Get previous/next machine instruction during Cirrus workaround scans.
144+ Assume worst case (for the purpose of Cirrus workarounds)
145+ for JUMP / CALL instructions. */
146+static rtx
147+cirrus_prev_next_mach_insn (rtx insn, int *len, int next)
148+{
149+ rtx t;
150+ int l = 0;
151
152- if (GET_CODE (body) == SET)
153+ /* It seems that we can count only on INSN length. */
154+ for ( ; ; )
155 {
156- rtx lhs = XEXP (body, 0), rhs = XEXP (body, 1);
157+ if (next)
158+ insn = NEXT_INSN (insn);
159+ else
160+ insn = PREV_INSN (insn);
161+ if (!insn)
162+ break;
163
164- /* cfldrd, cfldr64, cfstrd, cfstr64 must
165- be followed by a non Cirrus insn. */
166- if (get_attr_cirrus (first) == CIRRUS_DOUBLE)
167- {
168- if (arm_cirrus_insn_p (next_nonnote_insn (first)))
169- emit_insn_after (gen_nop (), first);
170+ if (GET_CODE (insn) == INSN)
171+ {
172+ l = get_attr_length (insn) / 4;
173+ if (l)
174+ break;
175+ }
176+ else if (GET_CODE (insn) == JUMP_INSN)
177+ {
178+ l = 1;
179+ t = is_jump_table (insn);
180+ if (t)
181+ l += get_jump_table_size (t) / 4;
182+ break;
183+ }
184+ else if (GET_CODE (insn) == CALL_INSN)
185+ {
186+ l = 1;
187+ break;
188+ }
189+ }
190
191- return;
192- }
193- else if (arm_memory_load_p (first))
194- {
195- unsigned int arm_regno;
196+ if (len)
197+ *len = l;
198
199- /* Any ldr/cfmvdlr, ldr/cfmvdhr, ldr/cfmvsr, ldr/cfmv64lr,
200- ldr/cfmv64hr combination where the Rd field is the same
201- in both instructions must be split with a non Cirrus
202- insn. Example:
203-
204- ldr r0, blah
205- nop
206- cfmvsr mvf0, r0. */
207-
208- /* Get Arm register number for ldr insn. */
209- if (GET_CODE (lhs) == REG)
210- arm_regno = REGNO (lhs);
211- else
212- {
213- gcc_assert (GET_CODE (rhs) == REG);
214- arm_regno = REGNO (rhs);
215- }
216+ return insn;
217+}
218
219- /* Next insn. */
220- first = next_nonnote_insn (first);
221+static rtx
222+cirrus_prev_mach_insn (rtx insn, int *len)
223+{
224+ return cirrus_prev_next_mach_insn (insn, len, 0);
225+}
226
227- if (! arm_cirrus_insn_p (first))
228- return;
229+static rtx
230+cirrus_next_mach_insn (rtx insn, int *len)
231+{
232+ return cirrus_prev_next_mach_insn (insn, len, 1);
233+}
234
235- body = PATTERN (first);
236+/* Cirrus reorg for branch slots. */
237+static void
238+cirrus_reorg_branch (rtx insn)
239+{
240+ rtx t;
241+ int nops, l;
242
243- /* (float (blah)) is in parallel with a clobber. */
244- if (GET_CODE (body) == PARALLEL && XVECLEN (body, 0))
245- body = XVECEXP (body, 0, 0);
246-
247- if (GET_CODE (body) == FLOAT)
248- body = XEXP (body, 0);
249-
250- if (get_attr_cirrus (first) == CIRRUS_MOVE
251- && GET_CODE (XEXP (body, 1)) == REG
252- && arm_regno == REGNO (XEXP (body, 1)))
253- emit_insn_after (gen_nop (), first);
254+ /* TODO: handle jump-tables. */
255+ t = is_jump_table (insn);
256+ if (t)
257+ return;
258+
259+ /* Any branch must be followed by 2 non Cirrus instructions. */
260+ t = insn;
261+ for (nops = 2; nops > 0; )
262+ {
263+ if (!cirrus_next_mach_insn (t, 0))
264+ {
265+ insn = t;
266+ break;
267+ }
268+ t = cirrus_next_mach_insn (t, &l);
269+ if (arm_cirrus_insn_p (t))
270+ break;
271+ nops -= l;
272
273- return;
274- }
275 }
276
277- /* get_attr cannot accept USE or CLOBBER. */
278- if (!first
279- || GET_CODE (first) != INSN
280- || GET_CODE (PATTERN (first)) == USE
281- || GET_CODE (PATTERN (first)) == CLOBBER)
282- return;
283+ while (nops-- > 0)
284+ emit_insn_after (gen_nop (), insn); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */
285+}
286
287- attr = get_attr_cirrus (first);
288+/* Cirrus reorg for bug #1 (cirrus + cfcmpxx). */
289+static void
290+cirrus_reorg_bug1 (rtx insn)
291+{
292+ rtx body = PATTERN (insn), body2;
293+ rtx t;
294+ int i, nops, l;
295+ enum attr_cirrus attr;
296
297- /* Any coprocessor compare instruction (cfcmps, cfcmpd, ...)
298- must be followed by a non-coprocessor instruction. */
299- if (attr == CIRRUS_COMPARE)
300+ /* Check if destination or clobber is Cirrus register. */
301+ if (GET_CODE (body) == PARALLEL)
302 {
303- nops = 0;
304-
305- t = next_nonnote_insn (first);
306+ for (i = 0; i < XVECLEN (body, 0); i++)
307+ {
308+ body2 = XVECEXP (body, 0, i);
309+ if (GET_CODE (body2) == SET)
310+ {
311+ if (cirrus_dest_regn_p (body2, LAST_CIRRUS_FP_REGNUM))
312+ {
313+ nops = 5;
314+ goto fix;
315+ }
316+ }
317+ else if (GET_CODE (body2) == CLOBBER)
318+ {
319+ if (cirrus_dest_regn_p (body2, LAST_CIRRUS_FP_REGNUM))
320+ {
321+ nops = 4;
322+ goto fix;
323+ }
324+ }
325+ }
326+ }
327+ else if (GET_CODE (body) == SET)
328+ {
329+ if (cirrus_dest_regn_p (body, LAST_CIRRUS_FP_REGNUM))
330+ {
331+ nops = 5;
332+ goto fix;
333+ }
334+ }
335+ return;
336
337- if (arm_cirrus_insn_p (t))
338- ++ nops;
339+fix:
340+ t = insn;
341+ for ( ; nops > 0; )
342+ {
343+ t = cirrus_next_mach_insn (t, &l);
344+ if (!t)
345+ break;
346+ if (GET_CODE (t) == JUMP_INSN
347+ || GET_CODE (t) == CALL_INSN)
348+ {
349+ nops -= l;
350+ break;
351+ }
352+ else if (arm_cirrus_insn_p (t))
353+ {
354+ attr = get_attr_cirrus (t);
355+ if (attr == CIRRUS_COMPARE)
356+ break;
357+ }
358+ nops -= l;
359+ }
360
361- if (arm_cirrus_insn_p (next_nonnote_insn (t)))
362- ++ nops;
363+ while (nops-- > 0)
364+ emit_insn_after (gen_nop (), insn); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */
365+}
366
367- while (nops --)
368- emit_insn_after (gen_nop (), first);
369+/* Cirrus reorg for bugs #10 and #12 (data aborts). */
370+static void
371+cirrus_reorg_bug10_12 (rtx insn)
372+{
373+ rtx t;
374
375- return;
376- }
377+ t = cirrus_next_mach_insn (insn, 0);
378+ if (arm_cirrus_insn_p (t))
379+ if (TARGET_CIRRUS_D0 ||
380+ get_attr_cirrus (t) == CIRRUS_DOUBLE)
381+ emit_insn_after (gen_nop (), insn); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */
382 }
383
384 /* Return TRUE if X references a SYMBOL_REF. */
385@@ -7727,7 +7796,7 @@
386 {
387 Mnode * mp;
388 Mnode * nmp;
389- int align64 = 0;
390+ int align64 = 0, stuffnop = 0;
391
392 if (ARM_DOUBLEWORD_ALIGN)
393 for (mp = minipool_vector_head; mp != NULL; mp = mp->next)
394@@ -7742,8 +7811,27 @@
395 ";; Emitting minipool after insn %u; address %ld; align %d (bytes)\n",
396 INSN_UID (scan), (unsigned long) minipool_barrier->address, align64 ? 8 : 4);
397
398+ /* Check if branch before minipool is already stuffed with nops. */
399+ if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1)
400+ {
401+ rtx t;
402+
403+ t = prev_active_insn (scan);
404+ if (GET_CODE (t) != INSN
405+ || PATTERN (t) != const0_rtx)
406+ stuffnop = 1;
407+ }
408 scan = emit_label_after (gen_label_rtx (), scan);
409 scan = emit_insn_after (align64 ? gen_align_8 () : gen_align_4 (), scan);
410+ /* Last instruction was branch, so put two non-Cirrus opcodes. */
411+ if (stuffnop)
412+ {
413+#if TARGET_CIRRUS /* This is doubling up on nops, so I don't think this is a good idea */
414+ emit_insn_before (gen_nop (), scan); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */
415+ emit_insn_before (gen_nop (), scan); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */
416+#endif
417+ }
418+
419 scan = emit_label_after (minipool_vector_label, scan);
420
421 for (mp = minipool_vector_head; mp != NULL; mp = nmp)
422@@ -8151,15 +8239,38 @@
423 gcc_assert (GET_CODE (insn) == NOTE);
424 minipool_pad = 0;
425
426+#if TARGET_CIRRUS /* I think this is a double-up */
427+ /* Scan all the insn and fix Cirrus issues. */
428+ if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1)
429+ {
430+ rtx t, s;
431+
432+ for (t = cirrus_next_mach_insn (insn, 0); t; t = cirrus_next_mach_insn (t, 0))
433+ if (arm_mem_access_p (t))
434+ cirrus_reorg_bug10_12 (t);
435+
436+ if (TARGET_CIRRUS_D0)
437+ for (t = cirrus_next_mach_insn (insn, 0); t; t = cirrus_next_mach_insn (t, 0))
438+ if (arm_cirrus_insn_p (t))
439+ cirrus_reorg_bug1 (t);
440+
441+ /* Find last insn. */
442+ for (t = insn; ; t = s)
443+ {
444+ s = cirrus_next_mach_insn (t, 0);
445+ if (!s)
446+ break;
447+ }
448+ /* Scan backward and fix branches. - WARNING: appears to cause "bad immediate value for offset" problems! */
449+ for ( ; t; t = cirrus_prev_mach_insn (t, 0))
450+ if (GET_CODE (t) == JUMP_INSN
451+ || GET_CODE (t) == CALL_INSN)
452+ cirrus_reorg_branch (t);
453+ }
454+#endif
455 /* Scan all the insns and record the operands that will need fixing. */
456 for (insn = next_nonnote_insn (insn); insn; insn = next_nonnote_insn (insn))
457 {
458- if (TARGET_CIRRUS_FIX_INVALID_INSNS
459- && (arm_cirrus_insn_p (insn)
460- || GET_CODE (insn) == JUMP_INSN
461- || arm_memory_load_p (insn)))
462- cirrus_reorg (insn);
463-
464 if (GET_CODE (insn) == BARRIER)
465 push_minipool_barrier (insn, address);
466 else if (INSN_P (insn))
467@@ -11755,16 +11910,10 @@
468 || get_attr_conds (this_insn) != CONDS_NOCOND)
469 fail = TRUE;
470
471- /* A conditional cirrus instruction must be followed by
472- a non Cirrus instruction. However, since we
473- conditionalize instructions in this function and by
474- the time we get here we can't add instructions
475- (nops), because shorten_branches() has already been
476- called, we will disable conditionalizing Cirrus
477- instructions to be safe. */
478- if (GET_CODE (scanbody) != USE
479- && GET_CODE (scanbody) != CLOBBER
480- && get_attr_cirrus (this_insn) != CIRRUS_NOT)
481+ /* To avoid erratic behaviour, we avoid conditional Cirrus
482+ instructions when doing workarounds. */
483+ if (arm_cirrus_insn_p(this_insn)
484+ && (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1))
485 fail = TRUE;
486 break;
487
488diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.h gcc-4.1.2/gcc/config/arm/arm.h
489--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.h 2005-11-05 01:02:51.000000000 +1000
490+++ gcc-4.1.2/gcc/config/arm/arm.h 2007-05-15 10:15:05.000000000 +1000
491@@ -5,6 +5,7 @@
492 and Martin Simmons (@harleqn.co.uk).
493 More major hacks by Richard Earnshaw (rearnsha@arm.com)
494 Minor hacks by Nick Clifton (nickc@cygnus.com)
495+ Cirrus Crunch fixes by Vladimir Ivanov (vladitx@nucleusys.com)
496
497 This file is part of GCC.
498
499@@ -140,7 +141,9 @@
500 %{msoft-float:%{mhard-float: \
501 %e-msoft-float and -mhard_float may not be used together}} \
502 %{mbig-endian:%{mlittle-endian: \
503- %e-mbig-endian and -mlittle-endian may not be used together}}"
504+ %e-mbig-endian and -mlittle-endian may not be used together}} \
505+%{mfix-crunch-d0:%{mfix-crunch-d1: \
506+ %e-mfix-crunch-d0 and -mfix-crunch-d1 may not be used together}}"
507
508 #ifndef CC1_SPEC
509 #define CC1_SPEC ""
510@@ -179,6 +182,9 @@
511 #define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD)
512 #define TARGET_FPA (arm_fp_model == ARM_FP_MODEL_FPA)
513 #define TARGET_MAVERICK (arm_fp_model == ARM_FP_MODEL_MAVERICK)
514+#define TARGET_CIRRUS (arm_arch_cirrus)
515+#define TARGET_CIRRUS_D0 0 /* (target_flags & ARM_FLAG_CIRRUS_D0) */
516+#define TARGET_CIRRUS_D1 1 /* (target_flags & ARM_FLAG_CIRRUS_D1) */
517 #define TARGET_VFP (arm_fp_model == ARM_FP_MODEL_VFP)
518 #define TARGET_IWMMXT (arm_arch_iwmmxt)
519 #define TARGET_REALLY_IWMMXT (TARGET_IWMMXT && TARGET_ARM)
520diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.opt gcc-4.1.2/gcc/config/arm/arm.opt
521--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.opt 2005-11-05 01:02:51.000000000 +1000
522+++ gcc-4.1.2/gcc/config/arm/arm.opt 2007-05-15 10:09:31.000000000 +1000
523@@ -68,6 +68,14 @@
524 Target Report Mask(CIRRUS_FIX_INVALID_INSNS)
525 Cirrus: Place NOPs to avoid invalid instruction combinations
526
527+fix-crunch-d0
528+Target Report Mask(ARM_FLAG_CIRRUS_D0)
529+Cirrus: workarounds for Crunch coprocessor revision D0
530+
531+fix-crunch-d1
532+Target Report Mask(ARM_FLAG_CIRRUS_D1)
533+Cirrus: workarounds for Crunch coprocessor revision D1
534+
535 mcpu=
536 Target RejectNegative Joined
537 Specify the name of the target CPU
538diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/doc/invoke.texi gcc-4.1.2/gcc/doc/invoke.texi
539--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/doc/invoke.texi 2006-09-26 07:21:58.000000000 +1000
540+++ gcc-4.1.2/gcc/doc/invoke.texi 2007-05-15 10:07:04.000000000 +1000
541@@ -408,7 +408,7 @@
542 -msingle-pic-base -mno-single-pic-base @gol
543 -mpic-register=@var{reg} @gol
544 -mnop-fun-dllimport @gol
545--mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
546+-mfix-crunch-d0 -mfix-crunch-d1 @gol
547 -mpoke-function-name @gol
548 -mthumb -marm @gol
549 -mtpcs-frame -mtpcs-leaf-frame @gol
550@@ -7435,17 +7435,12 @@
551 Specify the register to be used for PIC addressing. The default is R10
552 unless stack-checking is enabled, when R9 is used.
553
554-@item -mcirrus-fix-invalid-insns
555-@opindex mcirrus-fix-invalid-insns
556-@opindex mno-cirrus-fix-invalid-insns
557-Insert NOPs into the instruction stream to in order to work around
558-problems with invalid Maverick instruction combinations. This option
559-is only valid if the @option{-mcpu=ep9312} option has been used to
560-enable generation of instructions for the Cirrus Maverick floating
561-point co-processor. This option is not enabled by default, since the
562-problem is only present in older Maverick implementations. The default
563-can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
564-switch.
565+@item -mfix-crunch-d0
566+@itemx -mfix-crunch-d1
567+@opindex mfix-crunch-d0
568+@opindex mfix-crunch-d1
569+Enable workarounds for the Cirrus MaverickCrunch coprocessor revisions
570+D0 and D1 respectively.
571
572 @item -mpoke-function-name
573 @opindex mpoke-function-name
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-geu.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-geu.patch
new file mode 100644
index 0000000000..3d27cc1d9d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-geu.patch
@@ -0,0 +1,48 @@
1--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-08 06:39:41.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-08 06:41:00.000000000 +1000
3@@ -7125,6 +7125,22 @@
4 (set_attr "length" "8")]
5 )
6
7+; Special pattern to match GEU for MAVERICK.
8+(define_insn "*arm_bgeu"
9+ [(set (pc)
10+ (if_then_else (geu (match_operand 1 "cc_register" "") (const_int 0))
11+ (label_ref (match_operand 0 "" ""))
12+ (pc)))]
13+ "TARGET_ARM && (TARGET_MAVERICK)"
14+ "*
15+ gcc_assert (!arm_ccfsm_state);
16+ if (get_attr_cirrus (prev_active_insn(insn)) == CIRRUS_COMPARE)
17+ return \"beq\\t%l0\;bvs\\t%l0\"; else return \"bge\\t%l0\;nop\";
18+ "
19+ [(set_attr "conds" "jump_clob")
20+ (set_attr "length" "8")]
21+)
22+
23 ; Special pattern to match UNLT for MAVERICK - UGLY since we need to test for Z=0 && V=0.
24 (define_insn "*arm_bunlt"
25 [(set (pc)
26@@ -7240,6 +7256,22 @@
27 (set_attr "length" "8")]
28 )
29
30+; Special pattern to match reversed GEU for MAVERICK.
31+(define_insn "*arm_bgeu_reversed"
32+ [(set (pc)
33+ (if_then_else (geu (match_operand 1 "cc_register" "") (const_int 0))
34+ (pc)
35+ (label_ref (match_operand 0 "" ""))))]
36+ "TARGET_ARM && (TARGET_MAVERICK)"
37+ "*
38+ gcc_assert (!arm_ccfsm_state);
39+
40+ return \"beq\\t.+12\;bvs\\t.+8\;b\\t%l0\";
41+ "
42+ [(set_attr "conds" "jump_clob")
43+ (set_attr "length" "12")]
44+)
45+
46 ; Special pattern to match reversed UNLT for MAVERICK.
47 (define_insn "*arm_bunlt_reversed"
48 [(set (pc)
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch
new file mode 100644
index 0000000000..c4fcdb3746
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch
@@ -0,0 +1,98 @@
1--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-07 14:45:22.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-07 15:13:58.000000000 +1000
3@@ -7001,16 +7001,16 @@
4 (if_then_else (unordered (match_dup 1) (const_int 0))
5 (label_ref (match_operand 0 "" ""))
6 (pc)))]
7- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
8+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
9 "operands[1] = arm_gen_compare_reg (UNORDERED, arm_compare_op0,
10 arm_compare_op1);"
11 )
12
13 (define_expand "bordered"
14 [(set (pc)
15 (if_then_else (ordered (match_dup 1) (const_int 0))
16 (label_ref (match_operand 0 "" ""))
17 (pc)))]
18- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
19+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
20 "operands[1] = arm_gen_compare_reg (ORDERED, arm_compare_op0,
21 arm_compare_op1);"
22@@ -7141,6 +7141,38 @@
23 (set_attr "length" "8")]
24 )
25
26+; Special pattern to match UNORDERED for MAVERICK - UGLY since we need to test for Z=0 && N=0.
27+(define_insn "*arm_bunordered"
28+ [(set (pc)
29+ (if_then_else (unordered (match_operand:CCFP 1 "cc_register" "") (const_int 0))
30+ (label_ref (match_operand 0 "" ""))
31+ (pc)))]
32+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
33+ "*
34+ gcc_assert (!arm_ccfsm_state);
35+
36+ return \"beq\\t.+12\;bmi\\t.+8\;b\\t%l0\";
37+ "
38+ [(set_attr "conds" "jump_clob")
39+ (set_attr "length" "12")]
40+)
41+
42+; Special pattern to match ORDERED for MAVERICK.
43+(define_insn "*arm_bordered"
44+ [(set (pc)
45+ (if_then_else (ordered (match_operand:CCFP 1 "cc_register" "") (const_int 0))
46+ (label_ref (match_operand 0 "" ""))
47+ (pc)))]
48+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
49+ "*
50+ gcc_assert (!arm_ccfsm_state);
51+
52+ return \"beq\\t%l0\;bmi\\t%l0\";
53+ "
54+ [(set_attr "conds" "jump_clob")
55+ (set_attr "length" "8")]
56+)
57+
58 (define_insn "*arm_cond_branch"
59 [(set (pc)
60 (if_then_else (match_operator 1 "arm_comparison_operator"
61@@ -7224,6 +7256,37 @@
62 (set_attr "length" "8")]
63 )
64
65+; Special pattern to match reversed UNORDERED for MAVERICK.
66+(define_insn "*arm_bunordered_reversed"
67+ [(set (pc)
68+ (if_then_else (unordered (match_operand:CCFP 1 "cc_register" "") (const_int 0))
69+ (pc)
70+ (label_ref (match_operand 0 "" ""))))]
71+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
72+ "*
73+ gcc_assert (!arm_ccfsm_state);
74+
75+ return \"beq\\t%l0\;bmi\\t%l0\";
76+ "
77+ [(set_attr "conds" "jump_clob")
78+ (set_attr "length" "8")]
79+)
80+
81+; Special pattern to match reversed ORDERED for MAVERICK - UGLY since we need to test for Z=0 && N=0.
82+(define_insn "*arm_bordered_reversed"
83+ [(set (pc)
84+ (if_then_else (ordered (match_operand:CCFP 1 "cc_register" "") (const_int 0))
85+ (pc)
86+ (label_ref (match_operand 0 "" ""))))]
87+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
88+ "*
89+ gcc_assert (!arm_ccfsm_state);
90+
91+ return \"beq\\t.+12\;bmi\\t.+8\;b\\t%l0\";
92+ "
93+ [(set_attr "conds" "jump_clob")
94+ (set_attr "length" "12")]
95+)
96
97 (define_insn "*arm_cond_branch_reversed"
98 [(set (pc)
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch-z-eq b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch-z-eq
new file mode 100644
index 0000000000..715fb95086
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare-unordered.patch-z-eq
@@ -0,0 +1,98 @@
1--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-07 14:45:22.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-07 15:13:58.000000000 +1000
3@@ -7001,16 +7001,16 @@
4 (if_then_else (unordered (match_dup 1) (const_int 0))
5 (label_ref (match_operand 0 "" ""))
6 (pc)))]
7- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
8+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
9 "operands[1] = arm_gen_compare_reg (UNORDERED, arm_compare_op0,
10 arm_compare_op1);"
11 )
12
13 (define_expand "bordered"
14 [(set (pc)
15 (if_then_else (ordered (match_dup 1) (const_int 0))
16 (label_ref (match_operand 0 "" ""))
17 (pc)))]
18- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
19+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
20 "operands[1] = arm_gen_compare_reg (ORDERED, arm_compare_op0,
21 arm_compare_op1);"
22@@ -7141,6 +7141,38 @@
23 (set_attr "length" "8")]
24 )
25
26+; Special pattern to match UNORDERED for MAVERICK - UGLY since we need to test for C=0 && N=0
27+(define_insn "*arm_bunordered"
28+ [(set (pc)
29+ (if_then_else (unordered (match_operand 1 "cc_register" "") (const_int 0))
30+ (label_ref (match_operand 0 "" ""))
31+ (pc)))]
32+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
33+ "*
34+ gcc_assert (!arm_ccfsm_state);
35+
36+ return \"bcs\\t.+12\;bmi\\t.+8\;b\\t%l0\";
37+ "
38+ [(set_attr "conds" "jump_clob")
39+ (set_attr "length" "12")]
40+)
41+
42+; Special pattern to match ORDERED for MAVERICK.
43+(define_insn "*arm_bordered"
44+ [(set (pc)
45+ (if_then_else (ordered (match_operand 1 "cc_register" "") (const_int 0))
46+ (label_ref (match_operand 0 "" ""))
47+ (pc)))]
48+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
49+ "*
50+ gcc_assert (!arm_ccfsm_state);
51+
52+ return \"bcs\\t%l0\;bmi\\t%l0\";
53+ "
54+ [(set_attr "conds" "jump_clob")
55+ (set_attr "length" "8")]
56+)
57+
58 (define_insn "*arm_cond_branch"
59 [(set (pc)
60 (if_then_else (match_operator 1 "arm_comparison_operator"
61@@ -7224,6 +7256,37 @@
62 (set_attr "length" "8")]
63 )
64
65+; Special pattern to match reversed UNORDERED for MAVERICK.
66+(define_insn "*arm_bunordered_reversed"
67+ [(set (pc)
68+ (if_then_else (unordered (match_operand 1 "cc_register" "") (const_int 0))
69+ (pc)
70+ (label_ref (match_operand 0 "" ""))))]
71+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
72+ "*
73+ gcc_assert (!arm_ccfsm_state);
74+
75+ return \"bcs\\t%l0\;bmi\\t%l0\";
76+ "
77+ [(set_attr "conds" "jump_clob")
78+ (set_attr "length" "8")]
79+)
80+
81+; Special pattern to match reversed ORDERED for MAVERICK - UGLY since we need to test for C=0 && N=0
82+(define_insn "*arm_bordered_reversed"
83+ [(set (pc)
84+ (if_then_else (ordered (match_operand 1 "cc_register" "") (const_int 0))
85+ (pc)
86+ (label_ref (match_operand 0 "" ""))))]
87+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
88+ "*
89+ gcc_assert (!arm_ccfsm_state);
90+
91+ return \"bcs\\t.+12\;bmi\\t.+8\;b\\t%l0\";
92+ "
93+ [(set_attr "conds" "jump_clob")
94+ (set_attr "length" "12")]
95+)
96
97 (define_insn "*arm_cond_branch_reversed"
98 [(set (pc)
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch
new file mode 100644
index 0000000000..ccbb4854c3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch
@@ -0,0 +1,400 @@
1diff -urN gcc-4.1.2/gcc/config/arm/arm.c ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.c
2--- gcc-4.1.2/gcc/config/arm/arm.c 2007-05-31 12:39:48.000000000 +1000
3+++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-29 17:19:38.000000000 +1000
4@@ -11427,26 +11427,53 @@
5 /* These encodings assume that AC=1 in the FPA system control
6 byte. This allows us to handle all cases except UNEQ and
7 LTGT. */
8- switch (comp_code)
9- {
10- case GE: return ARM_GE;
11- case GT: return ARM_GT;
12- case LE: return ARM_LS;
13- case LT: return ARM_MI;
14- case NE: return ARM_NE;
15- case EQ: return ARM_EQ;
16- case ORDERED: return ARM_VC;
17- case UNORDERED: return ARM_VS;
18- case UNLT: return ARM_LT;
19- case UNLE: return ARM_LE;
20- case UNGT: return ARM_HI;
21- case UNGE: return ARM_PL;
22- /* UNEQ and LTGT do not have a representation. */
23- case UNEQ: /* Fall through. */
24- case LTGT: /* Fall through. */
25- default: gcc_unreachable ();
26- }
27-
28+ if (!TARGET_MAVERICK)
29+ {
30+ switch (comp_code)
31+ {
32+ case GE: return ARM_GE;
33+ case GT: return ARM_GT;
34+ case LE: return ARM_LS;
35+ case LT: return ARM_MI;
36+ case NE: return ARM_NE;
37+ case EQ: return ARM_EQ;
38+ case ORDERED: return ARM_VC;
39+ case UNORDERED: return ARM_VS;
40+ case UNLT: return ARM_LT;
41+ case UNLE: return ARM_LE;
42+ case UNGT: return ARM_HI;
43+ case UNGE: return ARM_PL;
44+ /* UNEQ and LTGT do not have a representation. */
45+ case UNEQ: /* Fall through. */
46+ case LTGT: /* Fall through. */
47+ default: gcc_unreachable ();
48+ }
49+ }
50+ else
51+ {
52+ /* CIRRUS */
53+ switch (comp_code)
54+ {
55+#if 1
56+ case GT: return ARM_VS;
57+ case LE: return ARM_LE;
58+ case LT: return ARM_LT;
59+ case NE: return ARM_NE;
60+ case EQ: return ARM_EQ;
61+ case UNLE: return ARM_VC;
62+ case UNGT: return ARM_GT;
63+ case UNGE: return ARM_GE;
64+ case UNEQ: return ARM_PL;
65+ case LTGT: return ARM_MI;
66+ /* These do not have a representation. */
67+ case GE: /* Fall through. -UNGE wrong atm */
68+ case UNLT: /* Fall through. -LT wrong atm */
69+ case ORDERED: /* Fall through. -AL wrong atm */
70+ case UNORDERED: /* Fall through. -AL wrong atm */
71+#endif
72+ default: gcc_unreachable ();
73+ }
74+ }
75 case CC_SWPmode:
76 switch (comp_code)
77 {
78diff -urN gcc-4.1.2/gcc/config/arm/arm.md ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.md
79--- gcc-4.1.2/gcc/config/arm/arm.md 2007-05-31 12:39:48.000000000 +1000
80+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-05-29 15:17:18.000000000 +1000
81@@ -6952,10 +6952,11 @@
82 "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);"
83 )
84
85+;broken on cirrus
86 (define_expand "bge"
87 [(set (pc)
88 (if_then_else (ge (match_dup 1) (const_int 0))
89 (label_ref (match_operand 0 "" ""))
90 (pc)))]
91- "TARGET_ARM"
92+ "TARGET_ARM" ;; && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)
93 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
94@@ -6988,6 +6989,7 @@
95 "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);"
96 )
97
98+; broken on cirrus?
99 (define_expand "bgeu"
100 [(set (pc)
101 (if_then_else (geu (match_dup 1) (const_int 0))
102@@ -7031,14 +7033,15 @@
103 (if_then_else (ungt (match_dup 1) (const_int 0))
104 (label_ref (match_operand 0 "" ""))
105 (pc)))]
106- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
107+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
108 "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0, arm_compare_op1);"
109 )
110
111-(define_expand "bunlt"
112+; broken for cirrus
113+(define_expand "bunlt"
114 [(set (pc)
115 (if_then_else (unlt (match_dup 1) (const_int 0))
116 (label_ref (match_operand 0 "" ""))
117 (pc)))]
118- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
119+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
120 "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0, arm_compare_op1);"
121@@ -7049,7 +7052,7 @@
122 (if_then_else (unge (match_dup 1) (const_int 0))
123 (label_ref (match_operand 0 "" ""))
124 (pc)))]
125- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
126+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
127 "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0, arm_compare_op1);"
128 )
129
130@@ -7058,7 +7061,7 @@
131 (if_then_else (unle (match_dup 1) (const_int 0))
132 (label_ref (match_operand 0 "" ""))
133 (pc)))]
134- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
135+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
136 "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0, arm_compare_op1);"
137 )
138
139@@ -7069,7 +7072,7 @@
140 (if_then_else (uneq (match_dup 1) (const_int 0))
141 (label_ref (match_operand 0 "" ""))
142 (pc)))]
143- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
144+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK)"
145 "operands[1] = arm_gen_compare_reg (UNEQ, arm_compare_op0, arm_compare_op1);"
146 )
147
148@@ -7078,7 +7081,7 @@
149 (if_then_else (ltgt (match_dup 1) (const_int 0))
150 (label_ref (match_operand 0 "" ""))
151 (pc)))]
152- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
153+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK)"
154 "operands[1] = arm_gen_compare_reg (LTGT, arm_compare_op0, arm_compare_op1);"
155 )
156
157@@ -7086,7 +7089,7 @@
158 ;; Patterns to match conditional branch insns.
159 ;;
160
161-; Special pattern to match UNEQ.
162+; Special pattern to match UNEQ for FPA and VFP.
163 (define_insn "*arm_buneq"
164 [(set (pc)
165 (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0))
166@@ -7102,7 +7105,7 @@
167 (set_attr "length" "8")]
168 )
169
170-; Special pattern to match LTGT.
171+; Special pattern to match LTGT for FPA and VFP.
172 (define_insn "*arm_bltgt"
173 [(set (pc)
174 (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0))
175@@ -7118,6 +7121,38 @@
176 (set_attr "length" "8")]
177 )
178
179+; Special pattern to match GE for MAVERICK.
180+(define_insn "*arm_bge"
181+ [(set (pc)
182+ (if_then_else (ge (match_operand:CCFP 1 "cc_register" "") (const_int 0))
183+ (label_ref (match_operand 0 "" ""))
184+ (pc)))]
185+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
186+ "*
187+ gcc_assert (!arm_ccfsm_state);
188+
189+ return \"beq\\t%l0\;bvs\\t%l0\";
190+ "
191+ [(set_attr "conds" "jump_clob")
192+ (set_attr "length" "8")]
193+)
194+
195+; Special pattern to match UNLT for MAVERICK - UGLY since we need to test for Z=0 && V=0.
196+(define_insn "*arm_bunlt"
197+ [(set (pc)
198+ (if_then_else (unlt (match_operand:CCFP 1 "cc_register" "") (const_int 0))
199+ (label_ref (match_operand 0 "" ""))
200+ (pc)))]
201+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
202+ "*
203+ gcc_assert (!arm_ccfsm_state);
204+
205+ return \"beq\\t.+12\;bvs\\t.+8\;b\\t%l0\";
206+ "
207+ [(set_attr "conds" "jump_clob")
208+ (set_attr "length" "12")]
209+)
210+
211 (define_insn "*arm_cond_branch"
212 [(set (pc)
213 (if_then_else (match_operator 1 "arm_comparison_operator"
214@@ -7137,7 +7172,7 @@
215 (set_attr "type" "branch")]
216 )
217
218-; Special pattern to match reversed UNEQ.
219+; Special pattern to match reversed UNEQ for FPA and VFP.
220 (define_insn "*arm_buneq_reversed"
221 [(set (pc)
222 (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0))
223@@ -7153,7 +7188,7 @@
224 (set_attr "length" "8")]
225 )
226
227-; Special pattern to match reversed LTGT.
228+; Special pattern to match reversed LTGT for FPA and VFP.
229 (define_insn "*arm_bltgt_reversed"
230 [(set (pc)
231 (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0))
232@@ -7169,6 +7204,39 @@
233 (set_attr "length" "8")]
234 )
235
236+; Special pattern to match reversed GE for MAVERICK - UGLY since we need to tst for Z=0 && N=0.
237+(define_insn "*arm_bge_reversed"
238+ [(set (pc)
239+ (if_then_else (ge (match_operand:CCFP 1 "cc_register" "") (const_int 0))
240+ (pc)
241+ (label_ref (match_operand 0 "" ""))))]
242+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
243+ "*
244+ gcc_assert (!arm_ccfsm_state);
245+
246+ return \"beq\\t.+12\;bvs\\t.+8\;b\\t%l0\";
247+ "
248+ [(set_attr "conds" "jump_clob")
249+ (set_attr "length" "12")]
250+)
251+
252+; Special pattern to match reversed UNLT for MAVERICK.
253+(define_insn "*arm_bunlt_reversed"
254+ [(set (pc)
255+ (if_then_else (unlt (match_operand:CCFP 1 "cc_register" "") (const_int 0))
256+ (pc)
257+ (label_ref (match_operand 0 "" ""))))]
258+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
259+ "*
260+ gcc_assert (!arm_ccfsm_state);
261+
262+ return \"beq\\t%l0\;bvs\\t%l0\";
263+ "
264+ [(set_attr "conds" "jump_clob")
265+ (set_attr "length" "8")]
266+)
267+
268+
269 (define_insn "*arm_cond_branch_reversed"
270 [(set (pc)
271 (if_then_else (match_operator 1 "arm_comparison_operator"
272@@ -7220,8 +7288,9 @@
273 "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);"
274 )
275
276+;; broken for cirrus - definitely
277 (define_expand "sge"
278 [(set (match_operand:SI 0 "s_register_operand" "")
279 (ge:SI (match_dup 1) (const_int 0)))]
280- "TARGET_ARM"
281+ "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
282 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
283@@ -7227,6 +7296,14 @@
284 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
285 )
286
287+;;; DO NOT add patterns for SGE these can not be represented with MAVERICK
288+; (define_expand "sge"
289+; [(set (match_operand:SI 0 "s_register_operand" "")
290+; (ge:SI (match_dup 1) (const_int 0)))]
291+; "TARGET_ARM && (TARGET_MAVERICK)"
292+; "gcc_unreachable ();"
293+; )
294+
295 (define_expand "slt"
296 [(set (match_operand:SI 0 "s_register_operand" "")
297 (lt:SI (match_dup 1) (const_int 0)))]
298@@ -7248,6 +7325,7 @@
299 "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);"
300 )
301
302+;; broken for cirrus - maybe
303 (define_expand "sgeu"
304 [(set (match_operand:SI 0 "s_register_operand" "")
305 (geu:SI (match_dup 1) (const_int 0)))]
306@@ -7255,6 +7333,14 @@
307 "operands[1] = arm_gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1);"
308 )
309
310+;;; DO NOT add patterns for SGEU these may not be represented with MAVERICK?
311+; (define_expand "sgeu"
312+; [(set (match_operand:SI 0 "s_register_operand" "")
313+; (ge:SI (match_dup 1) (const_int 0)))]
314+; "TARGET_ARM && (TARGET_MAVERICK)"
315+; "gcc_unreachable ();"
316+; )
317+
318 (define_expand "sltu"
319 [(set (match_operand:SI 0 "s_register_operand" "")
320 (ltu:SI (match_dup 1) (const_int 0)))]
321@@ -7281,7 +7367,7 @@
322 (define_expand "sungt"
323 [(set (match_operand:SI 0 "s_register_operand" "")
324 (ungt:SI (match_dup 1) (const_int 0)))]
325- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
326+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
327 "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0,
328 arm_compare_op1);"
329 )
330@@ -7289,23 +7375,32 @@
331 (define_expand "sunge"
332 [(set (match_operand:SI 0 "s_register_operand" "")
333 (unge:SI (match_dup 1) (const_int 0)))]
334- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
335+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
336 "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0,
337 arm_compare_op1);"
338 )
339
340+; broken for cirrus
341 (define_expand "sunlt"
342 [(set (match_operand:SI 0 "s_register_operand" "")
343 (unlt:SI (match_dup 1) (const_int 0)))]
344- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
345+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
346 "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0,
347 arm_compare_op1);"
348 )
349
350+;;; DO NOT add patterns for SUNLT these can't be represented with MAVERICK
351+; (define_expand "sunlt"
352+; [(set (match_operand:SI 0 "s_register_operand" "")
353+; (unlt:SI (match_dup 1) (const_int 0)))]
354+; "TARGET_ARM && (TARGET_MAVERICK)"
355+; "gcc_unreachable ();"
356+; )
357+
358 (define_expand "sunle"
359 [(set (match_operand:SI 0 "s_register_operand" "")
360 (unle:SI (match_dup 1) (const_int 0)))]
361- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
362+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
363 "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0,
364 arm_compare_op1);"
365 )
366@@ -7371,7 +7466,7 @@
367 enum rtx_code code = GET_CODE (operands[1]);
368 rtx ccreg;
369
370- if (code == UNEQ || code == LTGT)
371+ if ((code == UNEQ || code == LTGT) || (TARGET_MAVERICK && (code == GE || code == UNLT || code == ORDERED || code == UNORDERED)))
372 FAIL;
373
374 ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1);
375@@ -7390,7 +7485,8 @@
376 enum rtx_code code = GET_CODE (operands[1]);
377 rtx ccreg;
378
379- if (code == UNEQ || code == LTGT)
380+ if ((code == UNEQ || code == LTGT) || (TARGET_MAVERICK && (code == GE || code == UNLT || code == ORDERED || code == UNORDERED)))
381+
382 FAIL;
383
384 /* When compiling for SOFT_FLOAT, ensure both arms are in registers.
385@@ -7409,13 +7505,13 @@
386 (if_then_else:DF (match_operand 1 "arm_comparison_operator" "")
387 (match_operand:DF 2 "s_register_operand" "")
388 (match_operand:DF 3 "arm_float_add_operand" "")))]
389- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
390+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
391 "
392 {
393 enum rtx_code code = GET_CODE (operands[1]);
394 rtx ccreg;
395
396- if (code == UNEQ || code == LTGT)
397+ if ((code == UNEQ || code == LTGT) || (TARGET_MAVERICK && (code==GE || code == UNLT || code == ORDERED || code == UNORDERED)))
398 FAIL;
399
400 ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1);
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch-z-eq b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch-z-eq
new file mode 100644
index 0000000000..bc40411be4
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-compare.patch-z-eq
@@ -0,0 +1,400 @@
1diff -urN gcc-4.1.2/gcc/config/arm/arm.c ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.c
2--- gcc-4.1.2/gcc/config/arm/arm.c 2007-05-31 12:39:48.000000000 +1000
3+++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-29 17:19:38.000000000 +1000
4@@ -11427,26 +11427,53 @@
5 /* These encodings assume that AC=1 in the FPA system control
6 byte. This allows us to handle all cases except UNEQ and
7 LTGT. */
8- switch (comp_code)
9- {
10- case GE: return ARM_GE;
11- case GT: return ARM_GT;
12- case LE: return ARM_LS;
13- case LT: return ARM_MI;
14- case NE: return ARM_NE;
15- case EQ: return ARM_EQ;
16- case ORDERED: return ARM_VC;
17- case UNORDERED: return ARM_VS;
18- case UNLT: return ARM_LT;
19- case UNLE: return ARM_LE;
20- case UNGT: return ARM_HI;
21- case UNGE: return ARM_PL;
22- /* UNEQ and LTGT do not have a representation. */
23- case UNEQ: /* Fall through. */
24- case LTGT: /* Fall through. */
25- default: gcc_unreachable ();
26- }
27-
28+ if (!TARGET_MAVERICK)
29+ {
30+ switch (comp_code)
31+ {
32+ case GE: return ARM_GE;
33+ case GT: return ARM_GT;
34+ case LE: return ARM_LS;
35+ case LT: return ARM_MI;
36+ case NE: return ARM_NE;
37+ case EQ: return ARM_EQ;
38+ case ORDERED: return ARM_VC;
39+ case UNORDERED: return ARM_VS;
40+ case UNLT: return ARM_LT;
41+ case UNLE: return ARM_LE;
42+ case UNGT: return ARM_HI;
43+ case UNGE: return ARM_PL;
44+ /* UNEQ and LTGT do not have a representation. */
45+ case UNEQ: /* Fall through. */
46+ case LTGT: /* Fall through. */
47+ default: gcc_unreachable ();
48+ }
49+ }
50+ else
51+ {
52+ /* CIRRUS */
53+ switch (comp_code)
54+ {
55+#if 1
56+ case GT: return ARM_VS;
57+ case LE: return ARM_LE;
58+ case LT: return ARM_LT;
59+ case NE: return ARM_NE;
60+ case EQ: return ARM_EQ;
61+ case UNLE: return ARM_VC;
62+ case UNGT: return ARM_GT;
63+ case UNGE: return ARM_GE;
64+ case UNEQ: return ARM_PL;
65+ case LTGT: return ARM_MI;
66+ /* These do not have a representation. */
67+ case GE: /* Fall through. -UNGE wrong atm */
68+ case UNLT: /* Fall through. -LT wrong atm */
69+ case ORDERED: /* Fall through. -AL wrong atm */
70+ case UNORDERED: /* Fall through. -AL wrong atm */
71+#endif
72+ default: gcc_unreachable ();
73+ }
74+ }
75 case CC_SWPmode:
76 switch (comp_code)
77 {
78diff -urN gcc-4.1.2/gcc/config/arm/arm.md ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.md
79--- gcc-4.1.2/gcc/config/arm/arm.md 2007-05-31 12:39:48.000000000 +1000
80+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-05-29 15:17:18.000000000 +1000
81@@ -6952,10 +6952,11 @@
82 "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);"
83 )
84
85+;broken on cirrus
86 (define_expand "bge"
87 [(set (pc)
88 (if_then_else (ge (match_dup 1) (const_int 0))
89 (label_ref (match_operand 0 "" ""))
90 (pc)))]
91- "TARGET_ARM"
92+ "TARGET_ARM"
93 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
94@@ -6988,6 +6989,7 @@
95 "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);"
96 )
97
98+; broken on cirrus?
99 (define_expand "bgeu"
100 [(set (pc)
101 (if_then_else (geu (match_dup 1) (const_int 0))
102@@ -7031,14 +7033,15 @@
103 (if_then_else (ungt (match_dup 1) (const_int 0))
104 (label_ref (match_operand 0 "" ""))
105 (pc)))]
106- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
107+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
108 "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0, arm_compare_op1);"
109 )
110
111-(define_expand "bunlt"
112+; broken for cirrus
113+(define_expand "bunlt"
114 [(set (pc)
115 (if_then_else (unlt (match_dup 1) (const_int 0))
116 (label_ref (match_operand 0 "" ""))
117 (pc)))]
118- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
119+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
120 "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0, arm_compare_op1);"
121@@ -7049,7 +7052,7 @@
122 (if_then_else (unge (match_dup 1) (const_int 0))
123 (label_ref (match_operand 0 "" ""))
124 (pc)))]
125- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
126+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
127 "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0, arm_compare_op1);"
128 )
129
130@@ -7058,7 +7061,7 @@
131 (if_then_else (unle (match_dup 1) (const_int 0))
132 (label_ref (match_operand 0 "" ""))
133 (pc)))]
134- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
135+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
136 "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0, arm_compare_op1);"
137 )
138
139@@ -7069,7 +7072,7 @@
140 (if_then_else (uneq (match_dup 1) (const_int 0))
141 (label_ref (match_operand 0 "" ""))
142 (pc)))]
143- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
144+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK
145 "operands[1] = arm_gen_compare_reg (UNEQ, arm_compare_op0, arm_compare_op1);"
146 )
147
148@@ -7078,7 +7081,7 @@
149 (if_then_else (ltgt (match_dup 1) (const_int 0))
150 (label_ref (match_operand 0 "" ""))
151 (pc)))]
152- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
153+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK
154 "operands[1] = arm_gen_compare_reg (LTGT, arm_compare_op0, arm_compare_op1);"
155 )
156
157@@ -7086,7 +7089,7 @@
158 ;; Patterns to match conditional branch insns.
159 ;;
160
161-; Special pattern to match UNEQ.
162+; Special pattern to match UNEQ for FPA and VFP.
163 (define_insn "*arm_buneq"
164 [(set (pc)
165 (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0))
166@@ -7102,7 +7105,7 @@
167 (set_attr "length" "8")]
168 )
169
170-; Special pattern to match LTGT.
171+; Special pattern to match LTGT for FPA and VFP.
172 (define_insn "*arm_bltgt"
173 [(set (pc)
174 (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0))
175@@ -7118,6 +7121,38 @@
176 (set_attr "length" "8")]
177 )
178
179+; Special pattern to match GE for MAVERICK.
180+(define_insn "*arm_bge"
181+ [(set (pc)
182+ (if_then_else (ge (match_operand 1 "cc_register" "") (const_int 0))
183+ (label_ref (match_operand 0 "" ""))
184+ (pc)))]
185+ "TARGET_ARM && (TARGET_MAVERICK)"
186+ "*
187+ gcc_assert (!arm_ccfsm_state);
188+
189+ return \"beq\\t%l0\;bvs\\t%l0\";
190+ "
191+ [(set_attr "conds" "jump_clob")
192+ (set_attr "length" "8")]
193+)
194+
195+; Special pattern to match UNLT for MAVERICK.
196+(define_insn "*arm_bunlt"
197+ [(set (pc)
198+ (if_then_else (unlt (match_operand 1 "cc_register" "") (const_int 0))
199+ (label_ref (match_operand 0 "" ""))
200+ (pc)))]
201+ "TARGET_ARM && (TARGET_MAVERICK)"
202+ "*
203+ gcc_assert (!arm_ccfsm_state);
204+
205+ return \"bne\\t%l0\;bvc\\t%l0\";
206+ "
207+ [(set_attr "conds" "jump_clob")
208+ (set_attr "length" "8")]
209+)
210+
211 (define_insn "*arm_cond_branch"
212 [(set (pc)
213 (if_then_else (match_operator 1 "arm_comparison_operator"
214@@ -7137,7 +7172,7 @@
215 (set_attr "type" "branch")]
216 )
217
218-; Special pattern to match reversed UNEQ.
219+; Special pattern to match reversed UNEQ for FPA and VFP.
220 (define_insn "*arm_buneq_reversed"
221 [(set (pc)
222 (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0))
223@@ -7153,7 +7188,7 @@
224 (set_attr "length" "8")]
225 )
226
227-; Special pattern to match reversed LTGT.
228+; Special pattern to match reversed LTGT for FPA and VFP.
229 (define_insn "*arm_bltgt_reversed"
230 [(set (pc)
231 (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0))
232@@ -7169,6 +7204,39 @@
233 (set_attr "length" "8")]
234 )
235
236+; Special pattern to match reversed GE for MAVERICK.
237+(define_insn "*arm_bge_reversed"
238+ [(set (pc)
239+ (if_then_else (ge (match_operand 1 "cc_register" "") (const_int 0))
240+ (pc)
241+ (label_ref (match_operand 0 "" ""))))]
242+ "TARGET_ARM && (TARGET_MAVERICK)"
243+ "*
244+ gcc_assert (!arm_ccfsm_state);
245+
246+ return \"bne\\t%l0\;bvc\\t%l0\";
247+ "
248+ [(set_attr "conds" "jump_clob")
249+ (set_attr "length" "8")]
250+)
251+
252+; Special pattern to match reversed UNLT for MAVERICK.
253+(define_insn "*arm_bunlt_reversed"
254+ [(set (pc)
255+ (if_then_else (unlt (match_operand 1 "cc_register" "") (const_int 0))
256+ (pc)
257+ (label_ref (match_operand 0 "" ""))))]
258+ "TARGET_ARM && (TARGET_MAVERICK)"
259+ "*
260+ gcc_assert (!arm_ccfsm_state);
261+
262+ return \"beq\\t%l0\;bvs\\t%l0\";
263+ "
264+ [(set_attr "conds" "jump_clob")
265+ (set_attr "length" "8")]
266+)
267+
268+
269 (define_insn "*arm_cond_branch_reversed"
270 [(set (pc)
271 (if_then_else (match_operator 1 "arm_comparison_operator"
272@@ -7220,8 +7288,9 @@
273 "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);"
274 )
275
276+;; broken for cirrus - definitely
277 (define_expand "sge"
278 [(set (match_operand:SI 0 "s_register_operand" "")
279 (ge:SI (match_dup 1) (const_int 0)))]
280- "TARGET_ARM"
281+ "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
282 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
283@@ -7227,6 +7296,14 @@
284 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
285 )
286
287+;;; DO NOT add patterns for SGE these can not be represented with MAVERICK
288+; (define_expand "sge"
289+; [(set (match_operand:SI 0 "s_register_operand" "")
290+; (ge:SI (match_dup 1) (const_int 0)))]
291+; "TARGET_ARM && (TARGET_MAVERICK)"
292+; "gcc_unreachable ();"
293+; )
294+
295 (define_expand "slt"
296 [(set (match_operand:SI 0 "s_register_operand" "")
297 (lt:SI (match_dup 1) (const_int 0)))]
298@@ -7248,6 +7325,7 @@
299 "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);"
300 )
301
302+;; broken for cirrus - maybe
303 (define_expand "sgeu"
304 [(set (match_operand:SI 0 "s_register_operand" "")
305 (geu:SI (match_dup 1) (const_int 0)))]
306@@ -7255,6 +7333,14 @@
307 "operands[1] = arm_gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1);"
308 )
309
310+;;; DO NOT add patterns for SGEU these may not be represented with MAVERICK?
311+; (define_expand "sgeu"
312+; [(set (match_operand:SI 0 "s_register_operand" "")
313+; (ge:SI (match_dup 1) (const_int 0)))]
314+; "TARGET_ARM && (TARGET_MAVERICK)"
315+; "gcc_unreachable ();"
316+; )
317+
318 (define_expand "sltu"
319 [(set (match_operand:SI 0 "s_register_operand" "")
320 (ltu:SI (match_dup 1) (const_int 0)))]
321@@ -7281,7 +7367,7 @@
322 (define_expand "sungt"
323 [(set (match_operand:SI 0 "s_register_operand" "")
324 (ungt:SI (match_dup 1) (const_int 0)))]
325- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
326+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
327 "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0,
328 arm_compare_op1);"
329 )
330@@ -7289,23 +7375,32 @@
331 (define_expand "sunge"
332 [(set (match_operand:SI 0 "s_register_operand" "")
333 (unge:SI (match_dup 1) (const_int 0)))]
334- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
335+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
336 "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0,
337 arm_compare_op1);"
338 )
339
340+; broken for cirrus
341 (define_expand "sunlt"
342 [(set (match_operand:SI 0 "s_register_operand" "")
343 (unlt:SI (match_dup 1) (const_int 0)))]
344- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
345+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
346 "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0,
347 arm_compare_op1);"
348 )
349
350+;;; DO NOT add patterns for SUNLT these can't be represented with MAVERICK
351+; (define_expand "sunlt"
352+; [(set (match_operand:SI 0 "s_register_operand" "")
353+; (unlt:SI (match_dup 1) (const_int 0)))]
354+; "TARGET_ARM && (TARGET_MAVERICK)"
355+; "gcc_unreachable ();"
356+; )
357+
358 (define_expand "sunle"
359 [(set (match_operand:SI 0 "s_register_operand" "")
360 (unle:SI (match_dup 1) (const_int 0)))]
361- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
362+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
363 "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0,
364 arm_compare_op1);"
365 )
366@@ -7371,7 +7466,7 @@
367 enum rtx_code code = GET_CODE (operands[1]);
368 rtx ccreg;
369
370- if (code == UNEQ || code == LTGT)
371+ if (code == UNEQ || code == LTGT || code == GE || code == UNLT || code == ORDERED || code == UNORDERED)
372 FAIL;
373
374 ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1);
375@@ -7390,7 +7485,8 @@
376 enum rtx_code code = GET_CODE (operands[1]);
377 rtx ccreg;
378
379- if (code == UNEQ || code == LTGT)
380+ if (code == UNEQ || code == LTGT || code == GE || code == UNLT || code == ORDERED || code == UNORDERED)
381+
382 FAIL;
383
384 /* When compiling for SOFT_FLOAT, ensure both arms are in registers.
385@@ -7409,13 +7505,13 @@
386 (if_then_else:DF (match_operand 1 "arm_comparison_operator" "")
387 (match_operand:DF 2 "s_register_operand" "")
388 (match_operand:DF 3 "arm_float_add_operand" "")))]
389- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
390+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
391 "
392 {
393 enum rtx_code code = GET_CODE (operands[1]);
394 rtx ccreg;
395
396- if (code == UNEQ || code == LTGT)
397+ if (code == UNEQ || code == LTGT || code == GE || code == UNLT || code == ORDERED || code == UNORDERED)
398 FAIL;
399
400 ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1);
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-dominance.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-dominance.patch
new file mode 100644
index 0000000000..517ca8d80e
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-dominance.patch
@@ -0,0 +1,12 @@
1--- gcc-4.1.2/gcc/config/arm/arm.c-original 2007-06-13 11:50:10.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.c 2007-06-13 11:50:56.000000000 +1000
3@@ -6556,6 +6556,9 @@
4 enum rtx_code cond1, cond2;
5 int swapped = 0;
6
7+ if (TARGET_MAVERICK) // Simple hack for MAVERICK
8+ return CCmode;
9+
10 /* Currently we will probably get the wrong result if the individual
11 comparisons are not simple. This also ensures that it is safe to
12 reverse a comparison if necessary. */
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754-div.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754-div.patch
new file mode 100644
index 0000000000..940f4a65ae
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754-div.patch
@@ -0,0 +1,139 @@
1--- gcc-4.1.2/gcc/config/arm/ieee754-df-original.S 2007-06-25 10:22:06.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-25 10:27:17.000000000 +1000
3@@ -717,6 +717,10 @@
4 cmn r4, #(53 + 1)
5 movle xl, #0
6 bicle xh, xh, #0x7fffffff
7+#ifdef __MAVERICK__
8+ cfmvdlr mvd0, xl
9+ cfmvdhr mvd0, xh
10+#endif
11 RETLDM "r4, r5, r6" le
12
13 @ Find out proper shift value.
14@@ -738,6 +742,10 @@
15 adc xh, r2, xh, lsr r4
16 orrs lr, lr, r3, lsl #1
17 biceq xl, xl, r3, lsr #31
18+#ifdef __MAVERICK__
19+ cfmvdlr mvd0, xl
20+ cfmvdhr mvd0, xh
21+#endif
22 RETLDM "r4, r5, r6"
23
24 @ shift result right of 21 to 31 bits, or left 11 to 1 bits after
25@@ -752,6 +760,10 @@
26 adc xh, xh, #0
27 orrs lr, lr, r3, lsl #1
28 biceq xl, xl, r3, lsr #31
29+#ifdef __MAVERICK__
30+ cfmvdlr mvd0, xl
31+ cfmvdhr mvd0, xh
32+#endif
33 RETLDM "r4, r5, r6"
34
35 @ Shift value right of 32 to 64 bits, or 0 to 32 bits after a switch
36@@ -766,6 +778,10 @@
37 add xl, xl, r3, lsr #31
38 orrs lr, lr, r3, lsl #1
39 biceq xl, xl, r3, lsr #31
40+#ifdef __MAVERICK__
41+ cfmvdlr mvd0, xl
42+ cfmvdhr mvd0, xh
43+#endif
44 RETLDM "r4, r5, r6"
45
46 @ One or both arguments are denormalized.
47@@ -808,6 +824,10 @@
48 eor xh, xh, yh
49 bic xh, xh, #0x7fffffff
50 mov xl, #0
51+#ifdef __MAVERICK__
52+ cfmvdlr mvd0, xl
53+ cfmvdhr mvd0, xh
54+#endif
55 RETLDM "r4, r5, r6"
56
57 1: @ One or both args are INF or NAN.
58@@ -837,12 +857,20 @@
59 orr xh, xh, #0x7f000000
60 orr xh, xh, #0x00f00000
61 mov xl, #0
62+#ifdef __MAVERICK__
63+ cfmvdlr mvd0, xl
64+ cfmvdhr mvd0, xh
65+#endif
66 RETLDM "r4, r5, r6"
67
68 @ Return a quiet NAN.
69 LSYM(Lml_n):
70 orr xh, xh, #0x7f000000
71 orr xh, xh, #0x00f80000
72+#ifdef __MAVERICK__
73+ cfmvdlr mvd0, xl
74+ cfmvdhr mvd0, xh
75+#endif
76 RETLDM "r4, r5, r6"
77
78 FUNC_END aeabi_dmul
79--- gcc-4.1.2/gcc/config/arm/ieee754-sf-original.S 2007-06-25 10:18:52.000000000 +1000
80+++ gcc-4.1.2/gcc/config/arm/ieee754-sf.S 2007-06-25 10:40:25.000000000 +1000
81@@ -518,6 +518,9 @@
82 @ Check if denormalized result is possible, otherwise return signed 0.
83 cmn r2, #(24 + 1)
84 bicle r0, r0, #0x7fffffff
85+#ifdef __MAVERICK__
86+ cfmvsr mvf0, r0
87+#endif
88 RETc(le)
89
90 @ Shift value right, round, etc.
91@@ -530,6 +533,9 @@
92 adc r0, r0, #0
93 orrs r3, r3, ip, lsl #1
94 biceq r0, r0, ip, lsr #31
95+#ifdef __MAVERICK__
96+ cfmvsr mvf0, r0
97+#endif
98 RET
99
100 @ One or both arguments are denormalized.
101@@ -567,6 +573,9 @@
102 LSYM(Lml_z):
103 eor r0, r0, r1
104 bic r0, r0, #0x7fffffff
105+#ifdef __MAVERICK__
106+ cfmvsr mvf0, r0
107+#endif
108 RET
109
110 1: @ One or both args are INF or NAN.
111@@ -595,12 +604,18 @@
112 and r0, r0, #0x80000000
113 orr r0, r0, #0x7f000000
114 orr r0, r0, #0x00800000
115+#ifdef __MAVERICK__
116+ cfmvsr mvf0, r0
117+#endif
118 RET
119
120 @ Return a quiet NAN.
121 LSYM(Lml_n):
122 orr r0, r0, #0x7f000000
123 orr r0, r0, #0x00c00000
124+#ifdef __MAVERICK__
125+ cfmvsr mvf0, r0
126+#endif
127 RET
128
129 FUNC_END aeabi_fmul
130@@ -677,6 +692,9 @@
131 adds r2, r2, #127
132 rsbgts r3, r2, #255
133 orrgt r0, r0, r2, lsl #23
134+#ifdef __MAVERICK__
135+ cfmvsr mvf0, r0
136+#endif
137 RETc(gt)
138
139 orr r0, r0, #0x00800000
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754.patch
new file mode 100644
index 0000000000..e4929fa20e
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi-ieee754.patch
@@ -0,0 +1,100 @@
1--- ../gcc-cross-4.1.2-r4-unpatched/gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-07 13:06:52.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-07 13:15:49.000000000 +1000
3@@ -42,8 +42,9 @@
4
5
6 @ For FPA, float words are always big-endian.
7+@ For MAVERICK, float words are always little-endian.
8 @ For VFP, floats words follow the memory system mode.
9-#if defined(__VFP_FP__) && !defined(__ARMEB__)
10+#if ((defined(__VFP_FP__) && !defined(__ARMEB__)) || defined(__MAVERICK__))
11 #define xl r0
12 #define xh r1
13 #define yl r2
14@@ -451,8 +452,13 @@
15
16 orrs r2, r0, r1
17 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
18+#if defined (__FPA_FP__)
19 mvfeqd f0, #0.0
20 #endif
21+#if defined (__MAVERICK__)
22+ cfstrd mvd0, #0.0
23+#endif
24+#endif
25 RETc(eq)
26
27 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
28@@ -473,8 +479,13 @@
29
30 orrs r2, r0, r1
31 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
32+#if defined (__FPA_FP__)
33 mvfeqd f0, #0.0
34 #endif
35+#if defined (__MAVERICK__)
36+ cfstrd mvd0, #0.0
37+#endif
38+#endif
39 RETc(eq)
40
41 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
42@@ -526,8 +537,14 @@
43 @ Legacy code expects the result to be returned in f0. Copy it
44 @ there as well.
45 LSYM(f0_ret):
46+#if defined (__FPA_FP__)
47 stmfd sp!, {r0, r1}
48 ldfd f0, [sp], #8
49+#endif
50+#if defined (__MAVERICK__)
51+ cfmvdlr mvd0, xl
52+ cfmvdhr mvd0, xh
53+#endif
54 RETLDM
55
56 #endif
57--- ../gcc-cross-4.1.2-r4-unpatched/gcc-4.1.2/gcc/config/arm/ieee754-sf.S 2007-06-07 13:06:52.000000000 +1000
58+++ gcc-4.1.2/gcc/config/arm/ieee754-sf.S 2007-06-07 13:21:43.000000000 +1000
59@@ -302,8 +302,13 @@
60
61 orrs r2, r0, r1
62 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
63+#if defined (__FPA_FP__)
64 mvfeqs f0, #0.0
65 #endif
66+#if defined (__MAVERICK__)
67+ cfmvsr mvf0, #0.0
68+#endif
69+#endif
70 RETc(eq)
71
72 mov r3, #0
73@@ -314,8 +319,13 @@
74
75 orrs r2, r0, r1
76 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
77+#if defined (__FPA_FP__)
78 mvfeqs f0, #0.0
79 #endif
80+#if defined (__MAVERICK__)
81+ cfmvsr mvf0, #0.0
82+#endif
83+#endif
84 RETc(eq)
85
86 ands r3, ah, #0x80000000 @ sign bit in r3
87@@ -387,8 +397,13 @@
88 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
89
90 LSYM(f0_ret):
91+#if defined (__FPA_FP__)
92 str r0, [sp, #-4]!
93 ldfs f0, [sp], #4
94+#endif
95+#if defined (__MAVERICK__)
96+ cfmvsr mvf0, r0
97+#endif
98 RETLDM
99
100 #endif
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi.patch
new file mode 100644
index 0000000000..f8992ed499
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-eabi.patch
@@ -0,0 +1,64 @@
1--- /home/hwilliams/original/gcc-4.1.2/gcc/config/arm/t-linux-eabi 2005-10-10 11:04:31.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/t-linux-eabi 2007-05-15 13:53:05.000000000 +1000
3@@ -1,11 +1,21 @@
4 # These functions are included in shared libraries.
5 TARGET_LIBGCC2_CFLAGS = -fPIC
6+TARGET_LIBGCC2_CFLAGS += -mcpu=ep9312 -mfpu=maverick
7+LIBGCC2_DEBUG_CFLAGS = -g0
8
9 # We do not build a Thumb multilib for Linux because the definition of
10 # CLEAR_INSN_CACHE in linux-gas.h does not work in Thumb mode.
11 MULTILIB_OPTIONS =
12 MULTILIB_DIRNAMES =
13
14+LIB1ASMSRC = arm/lib1funcs.asm
15+LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
16+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
17+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
18+ _fixsfsi _fixunssfsi
19+
20+CRTSTUFF_T_CFLAGS += -mcpu=ep9312 -mfpu=maverick
21+
22 # Use a version of div0 which raises SIGFPE.
23 LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx
24
25diff -ruN arm/elf.h gcc-3.4.3/gcc/config/arm/elf.h
26--- ../gcc-4.1.2-orig/gcc/config/arm/elf.h 2004-02-24 16:25:22.000000000 +0200
27+++ gcc-4.1.2/gcc/config/arm/elf.h 2005-02-10 00:31:28.000000000 +0200
28@@ -46,7 +46,7 @@
29
30 #ifndef SUBTARGET_ASM_FLOAT_SPEC
31 #define SUBTARGET_ASM_FLOAT_SPEC "\
32-%{mapcs-float:-mfloat}"
33+%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa} %{mcpu=ep9312:-mfpu=maverick}"
34 #endif
35
36 #ifndef ASM_SPEC
37diff -ruN t-linux gcc-4.1.2/gcc/config/arm/t-linux
38--- t-linux 2007-05-09 16:32:28.000000000 +1000
39+++ gcc-4.1.2/gcc/config/arm/t-linux 2007-05-25 11:02:17.000000000 +1000
40@@ -1,19 +1,22 @@
41 # Just for these, we omit the frame pointer since it makes such a big
42 # difference. It is then pointless adding debugging.
43 TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
44+TARGET_LIBGCC2_CFLAGS += -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -D__MAVERICK__
45 LIBGCC2_DEBUG_CFLAGS = -g0
46
47 LIB1ASMSRC = arm/lib1funcs.asm
48 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
49 _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
50 _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
51- _call_via_rX \
52- _fixsfsi _fixunssfsi _floatdidf _floatdisf
53+ _fixsfsi _fixunssfsi
54
55 # MULTILIB_OPTIONS = mhard-float/msoft-float
56 # MULTILIB_DIRNAMES = hard-float soft-float
57
58 # EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
59
60+# EXTRA_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o
61+CRTSTUFF_T_CFLAGS += -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -D__MAVERICK__
62+
63 # LIBGCC = stmp-multilib
64 # INSTALL_LIBGCC = install-multilib
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable-single.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable-single.patch
new file mode 100644
index 0000000000..cdd52244a6
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable-single.patch
@@ -0,0 +1,38 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:12:39.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:16:13.000000000 +1000
3@@ -301,13 +301,14 @@
4 )
5
6 ;; Convert Cirrus-SI to Cirrus-SF
7+; appears to be buggy
8 (define_insn "cirrus_floatsisf2"
9 [(set (match_operand:SF 0 "cirrus_fp_register" "=v")
10 (float:SF (match_operand:SI 1 "s_register_operand" "r")))
11 (clobber (match_scratch:DF 2 "=v"))]
12- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
13+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
14 "cfmv64lr%?\\t%Z2, %1\;cfcvt32s%?\\t%V0, %Y2"
15 [(set_attr "length" "8")
16 (set_attr "cirrus" "move")]
17 )
18
19--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:16:53.000000000 +1000
20+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:18:20.000000000 +1000
21@@ -3125,14 +3125,15 @@
22
23 ;; Fixed <--> Floating conversion insns
24
25+;; Maverick Crunch floatsisf2 is buggy - see cirrus.md
26 (define_expand "floatsisf2"
27 [(set (match_operand:SF 0 "s_register_operand" "")
28 (float:SF (match_operand:SI 1 "s_register_operand" "")))]
29- "TARGET_ARM && TARGET_HARD_FLOAT"
30+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
31 "
32- if (TARGET_MAVERICK)
33+ if (TARGET_MAVERICK && 0)
34 {
35 emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1]));
36 DONE;
37 }
38 ")
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable.patch
new file mode 100644
index 0000000000..aa54ec3e04
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatsi-disable.patch
@@ -0,0 +1,61 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:12:39.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:16:13.000000000 +1000
3@@ -301,21 +301,23 @@
4 )
5
6 ;; Convert Cirrus-SI to Cirrus-SF
7+; appears to be buggy
8 (define_insn "cirrus_floatsisf2"
9 [(set (match_operand:SF 0 "cirrus_fp_register" "=v")
10 (float:SF (match_operand:SI 1 "s_register_operand" "r")))
11 (clobber (match_scratch:DF 2 "=v"))]
12- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
13+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
14 "cfmv64lr%?\\t%Z2, %1\;cfcvt32s%?\\t%V0, %Y2"
15 [(set_attr "length" "8")
16 (set_attr "cirrus" "move")]
17 )
18
19+;appears to be buggy
20 (define_insn "cirrus_floatsidf2"
21 [(set (match_operand:DF 0 "cirrus_fp_register" "=v")
22 (float:DF (match_operand:SI 1 "s_register_operand" "r")))
23 (clobber (match_scratch:DF 2 "=v"))]
24- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
25+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
26 "cfmv64lr%?\\t%Z2, %1\;cfcvt32d%?\\t%V0, %Y2"
27 [(set_attr "length" "8")
28 (set_attr "cirrus" "move")]
29--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:16:53.000000000 +1000
30+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:18:20.000000000 +1000
31@@ -3125,24 +3125,26 @@
32
33 ;; Fixed <--> Floating conversion insns
34
35+;; Maverick Crunch floatsisf2 is buggy - see cirrus.md
36 (define_expand "floatsisf2"
37 [(set (match_operand:SF 0 "s_register_operand" "")
38 (float:SF (match_operand:SI 1 "s_register_operand" "")))]
39- "TARGET_ARM && TARGET_HARD_FLOAT"
40+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
41 "
42- if (TARGET_MAVERICK)
43+ if (TARGET_MAVERICK && 0)
44 {
45 emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1]));
46 DONE;
47 }
48 ")
49
50+;; Maverick Crunch floatsidf2 is buggy - see cirrus.md
51 (define_expand "floatsidf2"
52 [(set (match_operand:DF 0 "s_register_operand" "")
53 (float:DF (match_operand:SI 1 "s_register_operand" "")))]
54- "TARGET_ARM && TARGET_HARD_FLOAT"
55+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
56 "
57- if (TARGET_MAVERICK)
58+ if (TARGET_MAVERICK && 0)
59 {
60 emit_insn (gen_cirrus_floatsidf2 (operands[0], operands[1]));
61 DONE;
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatunsidf.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatunsidf.patch
new file mode 100644
index 0000000000..2fe2254db9
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-floatunsidf.patch
@@ -0,0 +1,37 @@
1--- gcc-4.1.2/gcc/config/arm/ieee754-df-original.S 2007-06-25 14:05:35.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-25 14:08:03.000000000 +1000
3@@ -382,6 +382,8 @@
4 FUNC_END aeabi_dadd
5 FUNC_END adddf3
6
7+#ifndef __MAVERICK__ /* THIS IS A BAD HACK */
8+
9 ARM_FUNC_START floatunsidf
10 ARM_FUNC_ALIAS aeabi_ui2d floatunsidf
11
12@@ -401,8 +403,14 @@
13 FUNC_END aeabi_ui2d
14 FUNC_END floatunsidf
15
16+#endif
17+
18 ARM_FUNC_START floatsidf
19 ARM_FUNC_ALIAS aeabi_i2d floatsidf
20+#ifdef __MAVERICK__ /* THIS IS A BAD HACK */
21+ARM_FUNC_ALIAS floatunsidf floatsidf
22+ARM_FUNC_ALIAS aeabi_ui2d floatsidf
23+#endif
24
25 teq r0, #0
26 moveq r1, #0
27@@ -418,6 +426,10 @@
28 mov xh, #0
29 b LSYM(Lad_l)
30
31+#ifdef __MAVERICK__ /* THIS IS A BAD HACK */
32+ FUNC_END aeabi_ui2d floatsidf
33+ FUNC_END floatunsidf floatsidf
34+#endif
35 FUNC_END aeabi_i2d
36 FUNC_END floatsidf
37
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-fp_consts.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-fp_consts.patch
new file mode 100644
index 0000000000..5f289bbebe
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-fp_consts.patch
@@ -0,0 +1,13 @@
1--- gcc-4.1.2/gcc/config/arm/arm.c-original 2007-06-12 16:17:14.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.c 2007-06-12 16:17:28.000000000 +1000
3@@ -5218,7 +5218,9 @@
4 int i;
5 REAL_VALUE_TYPE r;
6
7+ if (TARGET_MAVERICK)
8+ fp_consts_inited = 0;
9- if (TARGET_VFP)
10+ else if (TARGET_VFP)
11 fp_consts_inited = 1;
12 else
13 fp_consts_inited = 8;
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-neg.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-neg.patch
new file mode 100644
index 0000000000..f14ae0190e
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-neg.patch
@@ -0,0 +1,30 @@
1WARNING: adding this patch causes copysign1.c and mzero3.c to fail...
2diff -urN gcc-4.1.2/gcc/config/arm/arm.md-original gcc-4.1.2/gcc/config/arm/arm.md
3--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-12 12:48:14.000000000 +1000
4+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-12 12:49:53.000000000 +1000
5@@ -2985,14 +2985,14 @@
6 (define_expand "negsf2"
7 [(set (match_operand:SF 0 "s_register_operand" "")
8 (neg:SF (match_operand:SF 1 "s_register_operand" "")))]
9- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
10+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
11 ""
12 )
13
14 (define_expand "negdf2"
15 [(set (match_operand:DF 0 "s_register_operand" "")
16 (neg:DF (match_operand:DF 1 "s_register_operand" "")))]
17- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
18+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
19 "")
20
21 ;; abssi2 doesn't really clobber the condition codes if a different register
22@@ -4097,7 +4097,7 @@
23 [(set (match_operand:DI 0 "nonimmediate_di_operand" "=r, r, r, r, m")
24 (match_operand:DI 1 "di_operand" "rDa,Db,Dc,mi,r"))]
25 "TARGET_ARM
26- && !(TARGET_HARD_FLOAT && (TARGET_MAVERICK || TARGET_VFP))
27+ && !(TARGET_HARD_FLOAT && (TARGET_MAVERICK || TARGET_VFP || TARGET_MAVERICK))
28 && !TARGET_IWMMXT"
29 "*
30 switch (which_alternative)
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-neg2.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-neg2.patch
new file mode 100644
index 0000000000..4fd91f3215
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-neg2.patch
@@ -0,0 +1,25 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-original 2007-06-12 17:01:24.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-12 17:03:26.000000000 +1000
3@@ -255,18 +256,20 @@
4 [(set_attr "cirrus" "normal")]
5 )
6
7+;; appears to be buggy: neg 0 != -0
8 (define_insn "*cirrus_negsf2"
9 [(set (match_operand:SF 0 "cirrus_fp_register" "=v")
10 (neg:SF (match_operand:SF 1 "cirrus_fp_register" "v")))]
11- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
12+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
13 "cfnegs%?\\t%V0, %V1"
14 [(set_attr "cirrus" "normal")]
15 )
16
17+;; appears to be buggy: neg 0 != -0
18 (define_insn "*cirrus_negdf2"
19 [(set (match_operand:DF 0 "cirrus_fp_register" "=v")
20 (neg:DF (match_operand:DF 1 "cirrus_fp_register" "v")))]
21- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
22+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
23 "cfnegd%?\\t%V0, %V1"
24 [(set_attr "cirrus" "normal")]
25 )
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-offset.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-offset.patch
new file mode 100644
index 0000000000..3a40f0d224
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-offset.patch
@@ -0,0 +1,20 @@
1--- gcc-4.1.2/gcc/config/arm/arm.c-original 2007-06-12 14:46:20.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.c 2007-06-12 14:48:06.000000000 +1000
3@@ -3460,7 +3460,7 @@
4
5 use_ldrd = (TARGET_LDRD
6 && (mode == DImode
7- || (mode == DFmode && (TARGET_SOFT_FLOAT || TARGET_VFP))));
8+ || (mode == DFmode && (TARGET_SOFT_FLOAT || TARGET_MAVERICK || TARGET_VFP))));
9
10 if (code == POST_INC || code == PRE_DEC
11 || ((code == PRE_INC || code == POST_DEC)
12@@ -3960,7 +3960,7 @@
13 /* VFP addressing modes actually allow greater offsets, but for
14 now we just stick with the lowest common denominator. */
15 if (mode == DImode
16- || ((TARGET_SOFT_FLOAT || TARGET_VFP) && mode == DFmode))
17+ || ((TARGET_SOFT_FLOAT || TARGET_MAVERICK || TARGET_VFP) && mode == DFmode))
18 {
19 low_n = n & 0x0f;
20 n &= ~0x0f;
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates.patch
new file mode 100644
index 0000000000..4841ff8178
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates.patch
@@ -0,0 +1,20 @@
1diff -urN gcc-4.1.2/gcc/config/arm/predicates.md ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/predicates.md
2--- gcc-4.1.2/gcc/config/arm/predicates.md 2005-09-11 17:38:02.000000000 +1000
3+++ gcc-4.1.2/gcc/config/arm/predicates.md 2007-05-30 12:15:54.000000000 +1000
4@@ -171,8 +171,14 @@
5 (match_code "eq,ne"))
6
7 ;; True for comparisons other than LTGT or UNEQ.
8+(define_special_predicate "arm_comparison_operator"
9+; (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt")) ;; original - no LTGT or UNEQ
10+; (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltgt,ltu,unordered,ordered,uneq,unlt,unle,unge,ungt")) ;; everything?
11+;; True for comparisons other than GE, GEU, UNLT, unordered or ordered. - Cirrus Version - must include ge?
12-(define_special_predicate "arm_comparison_operator"
13+;(define_special_predicate "arm_comparison_operator"
14- (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt"))
15+(match_code "eq,ne,le,lt,ge,geu,gt,gtu,leu,ltgt,ltu,uneq,unle,unge,ungt")) ;; bad codes removed?
16+;(match_code "eq,ne,le,lt,gt,gtu,leu,ltgt,ltu,uneq,unle,unge,ungt")) ;; bad codes removed + ge / geu removed
17+
18
19 (define_special_predicate "minmax_operator"
20 (and (match_code "smin,smax,umin,umax")
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates2.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates2.patch
new file mode 100644
index 0000000000..3e01158fe1
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates2.patch
@@ -0,0 +1,10 @@
1--- gcc-4.1.2/gcc/config/arm/predicates.md-original 2007-06-13 12:25:35.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/predicates.md 2007-06-13 12:25:42.000000000 +1000
3@@ -206,7 +206,6 @@
4 || mode == CC_DEQmode
5 || mode == CC_DLEmode
6 || mode == CC_DLTmode
7- || mode == CC_DGEmode
8 || mode == CC_DGTmode
9 || mode == CC_DLEUmode
10 || mode == CC_DLTUmode
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates3.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates3.patch
new file mode 100644
index 0000000000..99e1e6c88c
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-predicates3.patch
@@ -0,0 +1,116 @@
1diff -urN ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/arm.md gcc-4.1.2/gcc/config/arm/arm.md
2--- ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/arm.md 2007-06-14 11:50:53.000000000 +1000
3+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-14 11:43:17.000000000 +1000
4@@ -7488,6 +7488,22 @@
5 arm_compare_op1);"
6 )
7
8+;(define_expand "suneq"
9+; [(set (match_operand:SI 0 "s_register_operand" "")
10+; (uneq:SI (match_dup 1) (const_int 0)))]
11+; "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
12+; "operands[1] = arm_gen_compare_reg (UNEQ, arm_compare_op0,
13+; arm_compare_op1);"
14+;)
15+
16+;(define_expand "sltgt"
17+; [(set (match_operand:SI 0 "s_register_operand" "")
18+; (ltgt:SI (match_dup 1) (const_int 0)))]
19+; "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)"
20+; "operands[1] = arm_gen_compare_reg (LTGT, arm_compare_op0,
21+; arm_compare_op1);"
22+;)
23+
24 ;;; DO NOT add patterns for SUNEQ or SLTGT, these can't be represented with
25 ;;; simple ARM instructions.
26 ;
27@@ -10284,13 +10284,73 @@
28 "TARGET_ARM && arm_arch5e"
29 "pld\\t%a0")
30
31+;; Special predication pattern for Maverick Crunch floating-point
32+
33+(define_cond_exec
34+ [(match_operator 0 "maverick_comparison_operator"
35+ [(match_operand:CCFP 1 "cc_register" "")
36+ (const_int 0)])]
37+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
38+ ""
39+)
40+
41+;; Special predication pattern for Maverick Crunch - !CCFP
42+
43+(define_cond_exec
44+ [(match_operator 0 "arm_comparison_operator"
45+ [(match_operand:CC_NOOV 1 "cc_register" "")
46+ (const_int 0)])]
47+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
48+ ""
49+)
50+
51+(define_cond_exec
52+ [(match_operator 0 "arm_comparison_operator"
53+ [(match_operand:CC_Z 1 "cc_register" "")
54+ (const_int 0)])]
55+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
56+ ""
57+)
58+
59+(define_cond_exec
60+ [(match_operator 0 "arm_comparison_operator"
61+ [(match_operand:CC_SWP 1 "cc_register" "")
62+ (const_int 0)])]
63+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
64+ ""
65+)
66+
67+(define_cond_exec
68+ [(match_operator 0 "arm_comparison_operator"
69+ [(match_operand:CC_C 1 "cc_register" "")
70+ (const_int 0)])]
71+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
72+ ""
73+)
74+
75+(define_cond_exec
76+ [(match_operator 0 "arm_comparison_operator"
77+ [(match_operand:CC_N 1 "cc_register" "")
78+ (const_int 0)])]
79+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
80+ ""
81+)
82+
83+(define_cond_exec
84+ [(match_operator 0 "arm_comparison_operator"
85+ [(match_operand:CC 1 "cc_register" "")
86+ (const_int 0)])]
87+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
88+ ""
89+)
90+
91 ;; General predication pattern
92
93 (define_cond_exec
94 [(match_operator 0 "arm_comparison_operator"
95 [(match_operand 1 "cc_register" "")
96 (const_int 0)])]
97- "TARGET_ARM"
98+ "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
99 ""
100 )
101
102diff -urN ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/predicates.md gcc-4.1.2/gcc/config/arm/predicates.md
103--- ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/predicates.md 2005-09-11 17:38:02.000000000 +1000
104+++ gcc-4.1.2/gcc/config/arm/predicates.md 2007-06-14 11:46:13.000000000 +1000
105@@ -172,7 +172,11 @@
106
107 ;; True for comparisons other than LTGT or UNEQ.
108 (define_special_predicate "arm_comparison_operator"
109 (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt"))
110+
111+;; True for comparisons other than GE, GEU, UNLT, UNORDERED or ORDERED - TODO add LTGT and UNEQ - needs extra support elsewhere
112+(define_special_predicate "maverick_comparison_operator"
113+(match_code "eq,ne,le,lt,gt,gtu,leu,ltu,unle,unge,ungt"))
114
115 (define_special_predicate "minmax_operator"
116 (and (match_code "smin,smax,umin,umax")
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-saveregs.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-saveregs.patch
new file mode 100644
index 0000000000..531ae86610
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-saveregs.patch
@@ -0,0 +1,153 @@
1diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c gcc-4.1.2/gcc/config/arm/arm.c
2--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c 2007-05-09 16:32:29.000000000 +1000
3+++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-15 09:39:41.000000000 +1000
4@@ -426,7 +435,7 @@
5 #define FL_STRONG (1 << 8) /* StrongARM */
6 #define FL_ARCH5E (1 << 9) /* DSP extensions to v5 */
7 #define FL_XSCALE (1 << 10) /* XScale */
8-#define FL_CIRRUS (1 << 11) /* Cirrus/DSP. */
9+#define FL_CIRRUS (1 << 11) /* Cirrus Crunch coprocessor. */
10 #define FL_ARCH6 (1 << 12) /* Architecture rel 6. Adds
11 media instructions. */
12 #define FL_VFPV2 (1 << 13) /* Vector Floating Point V2. */
13@@ -490,7 +499,7 @@
14 /* Nonzero if this chip is a StrongARM. */
15 int arm_tune_strongarm = 0;
16
17-/* Nonzero if this chip is a Cirrus variant. */
18+/* Nonzero if this chip supports Cirrus Crunch coprocessor. */
19 int arm_arch_cirrus = 0;
20
21 /* Nonzero if this chip supports Intel Wireless MMX technology. */
22@@ -1184,7 +1193,8 @@
23 else
24 */
25 if (arm_arch_cirrus)
26- arm_fpu_arch = FPUTYPE_MAVERICK;
27+ /* Cirrus crunch coprocessor still requires soft-float division. */
28+ arm_fpu_arch = FPUTYPE_MAVERICK;
29 else
30 arm_fpu_arch = FPUTYPE_FPA_EMU2;
31 #endif
32@@ -1567,6 +1577,9 @@
33 if (regs_ever_live[regno] && !call_used_regs[regno])
34 return 0;
35
36+ if (TARGET_MAVERICK)
37+ return 0;
38+
39 if (TARGET_REALLY_IWMMXT)
40 for (regno = FIRST_IWMMXT_REGNUM; regno <= LAST_IWMMXT_REGNUM; regno++)
41 if (regs_ever_live[regno] && ! call_used_regs [regno])
42@@ -9775,7 +9886,19 @@
43 /* This variable is for the Virtual Frame Pointer, not VFP regs. */
44 int vfp_offset = offsets->frame;
45
46- if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
47+ if (arm_fpu_arch == FPUTYPE_MAVERICK)
48+ {
49+ for (reg = LAST_CIRRUS_FP_REGNUM; reg >= FIRST_CIRRUS_FP_REGNUM; reg--)
50+ if (regs_ever_live[reg] && !call_used_regs[reg])
51+ {
52+ floats_offset += 8; /* more problems - futaris? */
53+ /* if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1) */
54+ asm_fprintf (f, "\tnop\n");
55+ asm_fprintf (f, "\tcfldrd\tmvd%d, [%r, #-%d]\n",
56+ reg - FIRST_CIRRUS_FP_REGNUM, FP_REGNUM, floats_offset - vfp_offset);
57+ }
58+ }
59+ else if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
60 {
61 for (reg = LAST_FPA_REGNUM; reg >= FIRST_FPA_REGNUM; reg--)
62 if (regs_ever_live[reg] && !call_used_regs[reg])
63@@ -9924,7 +10047,18 @@
64 output_add_immediate (operands);
65 }
66
67- if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
68+ if (arm_fpu_arch == FPUTYPE_MAVERICK)
69+ { /* order changed - futaris */
70+ for (reg = FIRST_CIRRUS_FP_REGNUM; reg <= LAST_CIRRUS_FP_REGNUM; reg++)
71+ if (regs_ever_live[reg] && !call_used_regs[reg])
72+ {
73+ /* if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1) */
74+ asm_fprintf (f, "\tnop\n");
75+ asm_fprintf (f, "\tcfldrd\tmvd%u, [%r], #8\n",
76+ reg - FIRST_CIRRUS_FP_REGNUM, SP_REGNUM);
77+ } /* reg problems - futaris */
78+ }
79+ else if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
80 {
81 for (reg = FIRST_FPA_REGNUM; reg <= LAST_FPA_REGNUM; reg++)
82 if (regs_ever_live[reg] && !call_used_regs[reg])
83@@ -10429,9 +10563,19 @@
84 if (! IS_VOLATILE (func_type))
85 {
86+ /* Space for saved MAVERICK registers. */
87+ if (arm_fpu_arch == FPUTYPE_MAVERICK)
88+ {
89+ for (regno = FIRST_CIRRUS_FP_REGNUM; regno <= LAST_CIRRUS_FP_REGNUM; regno++)
90+ if (regs_ever_live[regno] && !call_used_regs[regno])
91+ saved += 8; // 8 in 3.4.3 patch - futaris;
92+ }
93+ else
94 /* Space for saved FPA registers. */
95+ {
96 for (regno = FIRST_FPA_REGNUM; regno <= LAST_FPA_REGNUM; regno++)
97 if (regs_ever_live[regno] && ! call_used_regs[regno])
98 saved += 12;
99+ }
100
101 /* Space for saved VFP registers. */
102 if (TARGET_HARD_FLOAT && TARGET_VFP)
103@@ -10739,7 +10882,19 @@
104
105 /* Save any floating point call-saved registers used by this
106 function. */
107- if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
108+ if (arm_fpu_arch == FPUTYPE_MAVERICK)
109+ {
110+ for (reg = LAST_CIRRUS_FP_REGNUM; reg >= FIRST_CIRRUS_FP_REGNUM; reg--)
111+ if (regs_ever_live[reg] && !call_used_regs[reg])
112+ {
113+ insn = gen_rtx_PRE_DEC (DFmode, stack_pointer_rtx); /* think these causes problems */
114+ insn = gen_rtx_MEM (DFmode, insn);
115+ insn = emit_insn (gen_rtx_SET (VOIDmode, insn,
116+ gen_rtx_REG (DFmode, reg)));
117+ RTX_FRAME_RELATED_P (insn) = 1; saved_regs += 8; /* added by futaris */
118+ }
119+ }
120+ else if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
121 {
122 for (reg = LAST_FPA_REGNUM; reg >= FIRST_FPA_REGNUM; reg--)
123 if (regs_ever_live[reg] && !call_used_regs[reg])
124@@ -15179,6 +15331,9 @@
125 if (IS_FPA_REGNUM (regno))
126 return (TARGET_AAPCS_BASED ? 96 : 16) + regno - FIRST_FPA_REGNUM;
127
128+ if (IS_CIRRUS_REGNUM (regno))
129+ return 28 + regno - FIRST_CIRRUS_FP_REGNUM;
130+
131 if (IS_VFP_REGNUM (regno))
132 return 64 + regno - FIRST_VFP_REGNUM;
133
134--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-28 15:42:36.000000000 +1000
135+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-28 15:42:48.000000000 +1000
136@@ -9800,7 +9800,7 @@
137 return arm_output_epilogue (next_nonnote_insn (insn));
138 "
139 ;; Length is absolute worst case
140- [(set_attr "length" "44")
141+ [(set_attr "length" "108")
142 (set_attr "type" "block")
143 ;; We don't clobber the conditions, but the potential length of this
144 ;; operation is sufficient to make conditionalizing the sequence
145@@ -9818,7 +9818,7 @@
146 return thumb_unexpanded_epilogue ();
147 "
148 ; Length is absolute worst case
149- [(set_attr "length" "44")
150+ [(set_attr "length" "108")
151 (set_attr "type" "block")
152 ;; We don't clobber the conditions, but the potential length of this
153 ;; operation is sufficient to make conditionalizing the sequence
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-scc.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-scc.patch
new file mode 100644
index 0000000000..d1330f2543
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-scc.patch
@@ -0,0 +1,38 @@
1--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-13 12:38:06.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-13 12:40:07.000000000 +1000
3@@ -7375,7 +7375,7 @@
4 (define_expand "sge"
5 [(set (match_operand:SI 0 "s_register_operand" "")
6 (ge:SI (match_dup 1) (const_int 0)))]
7- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
8+ "TARGET_ARM"
9 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
10 )
11
12@@ -7434,7 +7434,7 @@
13 (define_expand "sunordered"
14 [(set (match_operand:SI 0 "s_register_operand" "")
15 (unordered:SI (match_dup 1) (const_int 0)))]
16- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
17+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
18 "operands[1] = arm_gen_compare_reg (UNORDERED, arm_compare_op0,
19 arm_compare_op1);"
20 )
21@@ -7442,7 +7442,7 @@
22 (define_expand "sordered"
23 [(set (match_operand:SI 0 "s_register_operand" "")
24 (ordered:SI (match_dup 1) (const_int 0)))]
25- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
26+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
27 "operands[1] = arm_gen_compare_reg (ORDERED, arm_compare_op0,
28 arm_compare_op1);"
29 )
30@@ -7467,7 +7467,7 @@
31 (define_expand "sunlt"
32 [(set (match_operand:SI 0 "s_register_operand" "")
33 (unlt:SI (match_dup 1) (const_int 0)))]
34- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
35+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)"
36 "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0,
37 arm_compare_op1);"
38 )
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable-new.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable-new.patch
new file mode 100644
index 0000000000..6dea43fa7c
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable-new.patch
@@ -0,0 +1,33 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:46:22.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:46:41.000000000 +1000
3@@ -337,13 +337,14 @@
4 "cfcvt64d%?\\t%V0, %V1"
5 [(set_attr "cirrus" "normal")])
6
7+; appears to be buggy
8 (define_insn "cirrus_truncsfsi2"
9 [(set (match_operand:SI 0 "s_register_operand" "=r")
10 (fix:SI (fix:SF (match_operand:SF 1 "cirrus_fp_register" "v"))))
11 (clobber (match_scratch:DF 2 "=v"))]
12- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
13+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
14 "cftruncs32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2"
15 [(set_attr "length" "8")
16 (set_attr "cirrus" "normal")]
17 )
18
19--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:46:56.000000000 +1000
20+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:48:08.000000000 +1000
21@@ -3151,10 +3151,11 @@
22 }
23 ")
24
25+; appears to be buggy for MAVERICK
26 (define_expand "fix_truncsfsi2"
27 [(set (match_operand:SI 0 "s_register_operand" "")
28 (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))]
29- "TARGET_ARM && TARGET_HARD_FLOAT"
30+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
31 "
32 if (TARGET_MAVERICK)
33 {
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable.patch b/meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable.patch
new file mode 100644
index 0000000000..a5d791a0a4
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-crunch-truncsi-disable.patch
@@ -0,0 +1,56 @@
1--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:46:22.000000000 +1000
2+++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:46:41.000000000 +1000
3@@ -337,21 +337,23 @@
4 "cfcvt64d%?\\t%V0, %V1"
5 [(set_attr "cirrus" "normal")])
6
7+; appears to be buggy
8 (define_insn "cirrus_truncsfsi2"
9 [(set (match_operand:SI 0 "s_register_operand" "=r")
10 (fix:SI (fix:SF (match_operand:SF 1 "cirrus_fp_register" "v"))))
11 (clobber (match_scratch:DF 2 "=v"))]
12- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
13+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
14 "cftruncs32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2"
15 [(set_attr "length" "8")
16 (set_attr "cirrus" "normal")]
17 )
18
19+; appears to be buggy
20 (define_insn "cirrus_truncdfsi2"
21 [(set (match_operand:SI 0 "s_register_operand" "=r")
22 (fix:SI (fix:DF (match_operand:DF 1 "cirrus_fp_register" "v"))))
23 (clobber (match_scratch:DF 2 "=v"))]
24- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
25+ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0"
26 "cftruncd32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2"
27 [(set_attr "length" "8")
28 (set_attr "cirrus" "normal")]
29--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:46:56.000000000 +1000
30+++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:48:08.000000000 +1000
31@@ -3151,10 +3151,11 @@
32 }
33 ")
34
35+; appears to be buggy for MAVERICK
36 (define_expand "fix_truncsfsi2"
37 [(set (match_operand:SI 0 "s_register_operand" "")
38 (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))]
39- "TARGET_ARM && TARGET_HARD_FLOAT"
40+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
41 "
42 if (TARGET_MAVERICK)
43 {
44@@ -3167,10 +3168,11 @@
45 }
46 ")
47
48+; appears to be buggy for MAVERICK
49 (define_expand "fix_truncdfsi2"
50 [(set (match_operand:SI 0 "s_register_operand" "")
51 (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" ""))))]
52- "TARGET_ARM && TARGET_HARD_FLOAT"
53+ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
54 "
55 if (TARGET_MAVERICK)
56 {
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-nolibfloat.patch b/meta/packages/gcc/gcc-4.2.2/arm-nolibfloat.patch
new file mode 100644
index 0000000000..c4897c0330
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-nolibfloat.patch
@@ -0,0 +1,24 @@
1# Dimitry Andric <dimitry@andric.com>, 2004-05-01
2#
3# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
4# anymore. (The required functions are now in libgcc.)
5#
6# Fixes errors like
7# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat
8# collect2: ld returned 1 exit status
9# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1
10# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat
11
12Index: gcc-4.0.2/gcc/config/arm/linux-elf.h
13===================================================================
14--- gcc-4.0.2.orig/gcc/config/arm/linux-elf.h 2005-03-04 16:14:01.000000000 +0000
15+++ gcc-4.0.2/gcc/config/arm/linux-elf.h 2005-11-11 18:02:54.000000000 +0000
16@@ -56,7 +56,7 @@
17 %{shared:-lc} \
18 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
19
20-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
21+#define LIBGCC_SPEC "-lgcc"
22
23 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
24 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-softfloat.patch b/meta/packages/gcc/gcc-4.2.2/arm-softfloat.patch
new file mode 100644
index 0000000000..5e1edd9208
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-softfloat.patch
@@ -0,0 +1,16 @@
1Index: gcc-4.0.2/gcc/config/arm/t-linux
2===================================================================
3--- gcc-4.0.2.orig/gcc/config/arm/t-linux 2004-05-15 12:41:35.000000000 +0000
4+++ gcc-4.0.2/gcc/config/arm/t-linux 2005-11-11 16:07:53.000000000 +0000
5@@ -4,7 +4,10 @@
6 LIBGCC2_DEBUG_CFLAGS = -g0
7
8 LIB1ASMSRC = arm/lib1funcs.asm
9-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
10+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
11+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
12+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
13+ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf
14
15 # MULTILIB_OPTIONS = mhard-float/msoft-float
16 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-thumb-cache.patch b/meta/packages/gcc/gcc-4.2.2/arm-thumb-cache.patch
new file mode 100644
index 0000000000..fa63846c8c
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-thumb-cache.patch
@@ -0,0 +1,29 @@
1--- gcc-4.1.1/gcc/config/arm/linux-gas.h- 2005-06-25 03:22:41.000000000 +0200
2+++ gcc-4.1.1/gcc/config/arm/linux-gas.h 2006-06-18 10:23:46.000000000 +0200
3@@ -44,6 +44,7 @@
4
5 /* Clear the instruction cache from `beg' to `end'. This makes an
6 inline system call to SYS_cacheflush. */
7+#if !defined(__thumb__)
8 #define CLEAR_INSN_CACHE(BEG, END) \
9 { \
10 register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
11@@ -53,3 +54,18 @@
12 : "=r" (_beg) \
13 : "0" (_beg), "r" (_end), "r" (_flg)); \
14 }
15+#else
16+#define CLEAR_INSN_CACHE(BEG, END) \
17+{ \
18+ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
19+ register unsigned long _end __asm ("a2") = (unsigned long) (END); \
20+ register unsigned long _flg __asm ("a3") = 0; \
21+ register unsigned long _swi __asm ("a4") = 0xf0002; \
22+ __asm __volatile ("push {r7}\n" \
23+ " mov r7,a4\n" \
24+ " swi 0 @ sys_cacheflush\n" \
25+ " pop {r7}\n" \
26+ : "=r" (_beg) \
27+ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \
28+}
29+#endif
diff --git a/meta/packages/gcc/gcc-4.2.2/arm-thumb.patch b/meta/packages/gcc/gcc-4.2.2/arm-thumb.patch
new file mode 100644
index 0000000000..016a7a550b
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/arm-thumb.patch
@@ -0,0 +1,64 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- gcc-4.1.1/gcc/config/arm/lib1funcs.asm~gcc
7+++ gcc-4.1.1/gcc/config/arm/lib1funcs.asm
8@@ -995,10 +995,24 @@
9 .code 32
10 FUNC_START div0
11
12+#if ! defined __thumb__
13 stmfd sp!, {r1, lr}
14 mov r0, #SIGFPE
15 bl SYM(raise) __PLT__
16 RETLDM r1
17+#else
18+ push {r1, lr}
19+ mov r0, #SIGFPE
20+ bl SYM(raise) __PLT__
21+#if __ARM_ARCH__ > 4
22+ pop {r1, pc}
23+#else
24+ @ on 4T that won't work
25+ pop {r1}
26+ pop {r3}
27+ bx r3
28+#endif
29+#endif
30
31 FUNC_END div0
32
33@@ -1141,11 +1155,12 @@
34 code here switches to the correct mode before executing the function. */
35
36 .text
37- .align 0
38+ .align 1
39 .force_thumb
40
41 .macro call_via register
42 THUMB_FUNC_START _call_via_\register
43+ .hidden SYM (_call_via_\register)
44
45 bx \register
46 nop
47@@ -1242,6 +1257,7 @@
48 .code 16
49
50 THUMB_FUNC_START _interwork_call_via_\register
51+ .hidden SYM (_interwork_call_via_\register)
52
53 bx pc
54 nop
55--- gcc-4.1.1/gcc/config/arm/t-linux~gcc
56+++ gcc-4.1.1/gcc/config/arm/t-linux
57@@ -7,6 +7,7 @@
58 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
59 _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
60 _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
61+ _call_via_rX \
62 _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf
63
64 # MULTILIB_OPTIONS = mhard-float/msoft-float
diff --git a/meta/packages/gcc/gcc-4.2.2/cache-amnesia.patch b/meta/packages/gcc/gcc-4.2.2/cache-amnesia.patch
new file mode 100644
index 0000000000..ef7cd111c5
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/cache-amnesia.patch
@@ -0,0 +1,13 @@
1diff --git a/gcc/configure b/gcc/configure
2index 44620ab..6e1830c 100755
3--- a/gcc/configure
4+++ b/gcc/configure
5@@ -12272,7 +12272,7 @@ else
6 esac
7 saved_CFLAGS="${CFLAGS}"
8 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
9- ${realsrcdir}/configure \
10+ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
11 --enable-languages=${enable_languages-all} \
12 --target=$target_alias --host=$build_alias --build=$build_alias
13 CFLAGS="${saved_CFLAGS}"
diff --git a/meta/packages/gcc/gcc-4.2.2/fix-ICE-in-arm_unwind_emit_set.diff b/meta/packages/gcc/gcc-4.2.2/fix-ICE-in-arm_unwind_emit_set.diff
new file mode 100644
index 0000000000..568e15abff
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/fix-ICE-in-arm_unwind_emit_set.diff
@@ -0,0 +1,18 @@
1--- trunk/gcc/config/arm/arm.c 2006/09/19 13:18:27 117055
2+++ trunk/gcc/config/arm/arm.c 2006/09/19 13:19:24 117056
3@@ -15415,6 +15415,15 @@
4 /* Move from sp to reg. */
5 asm_fprintf (asm_out_file, "\t.movsp %r\n", REGNO (e0));
6 }
7+ else if (GET_CODE (e1) == PLUS
8+ && GET_CODE (XEXP (e1, 0)) == REG
9+ && REGNO (XEXP (e1, 0)) == SP_REGNUM
10+ && GET_CODE (XEXP (e1, 1)) == CONST_INT)
11+ {
12+ /* Set reg to offset from sp. */
13+ asm_fprintf (asm_out_file, "\t.movsp %r, #%d\n",
14+ REGNO (e0), (int)INTVAL(XEXP (e1, 1)));
15+ }
16 else
17 abort ();
18 break;
diff --git a/meta/packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch b/meta/packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..b3d38ad983
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch
@@ -0,0 +1,30 @@
1* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
2 used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
3 directory.
4
5diff --git a/libgfortran/configure b/libgfortran/configure
6index f7d86fb..d0966ec 100755
7--- a/libgfortran/configure
8+++ b/libgfortran/configure
9@@ -4475,6 +4475,6 @@ exec 5>>./config.log
10
11 # We need gfortran to compile parts of the library
12 #AC_PROG_FC(gfortran)
13-FC="$GFORTRAN"
14+#FC="$GFORTRAN"
15 ac_ext=${FC_SRCEXT-f}
16 ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5'
17\ No newline at end of file
18diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
19index 4661306..9f83e55 100644
20--- a/libgfortran/configure.ac
21+++ b/libgfortran/configure.ac
22@@ -140,7 +140,7 @@ AC_SUBST(enable_static)
23
24 # We need gfortran to compile parts of the library
25 #AC_PROG_FC(gfortran)
26-FC="$GFORTRAN"
27+#FC="$GFORTRAN"
28 AC_PROG_FC(gfortran)
29
30 # extra LD Flags which are required for targets
diff --git a/meta/packages/gcc/gcc-4.2.2/fortran-static-linking.patch b/meta/packages/gcc/gcc-4.2.2/fortran-static-linking.patch
new file mode 100644
index 0000000000..3dd6321dc3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/fortran-static-linking.patch
@@ -0,0 +1,48 @@
1f951 (fortran) links to MPFR and GMP of our staging area but when executing
2the command the libs can not be found. Use rpath like all the other apps in
3our staging bin/ directory.
4
5Patch the configure to avoid the regeneration...
6
7Index: gcc-4.2.2/configure
8===================================================================
9--- gcc-4.2.2.orig/configure 2008-01-15 23:23:41.000000000 +0100
10+++ gcc-4.2.2/configure 2008-01-15 23:25:20.000000000 +0100
11@@ -2278,14 +2278,14 @@
12
13
14 if test "x$with_mpfr" != x; then
15- gmplibs="-L$with_mpfr/lib $gmplibs"
16+ gmplibs="-static -L$with_mpfr/lib $gmplibs"
17 gmpinc="-I$with_mpfr/include"
18 fi
19 if test "x$with_mpfr_include" != x; then
20 gmpinc="-I$with_mpfr_include"
21 fi
22 if test "x$with_mpfr_lib" != x; then
23- gmplibs="-L$with_mpfr_lib $gmplibs"
24+ gmplibs="-static -L$with_mpfr_lib $gmplibs"
25 fi
26
27 # Specify a location for gmp
28Index: gcc-4.2.2/configure.in
29===================================================================
30--- gcc-4.2.2.orig/configure.in 2008-01-15 23:23:41.000000000 +0100
31+++ gcc-4.2.2/configure.in 2008-01-15 23:24:36.000000000 +0100
32@@ -1066,14 +1066,14 @@
33 AC_ARG_WITH(mpfr_lib, [ --with-mpfr-lib=PATH Specify the directory for the installed MPFR library])
34
35 if test "x$with_mpfr" != x; then
36- gmplibs="-L$with_mpfr/lib $gmplibs"
37+ gmplibs="-static -L$with_mpfr/lib $gmplibs"
38 gmpinc="-I$with_mpfr/include"
39 fi
40 if test "x$with_mpfr_include" != x; then
41 gmpinc="-I$with_mpfr_include"
42 fi
43 if test "x$with_mpfr_lib" != x; then
44- gmplibs="-L$with_mpfr_lib $gmplibs"
45+ gmplibs="-static -L$with_mpfr_lib $gmplibs"
46 fi
47
48 # Specify a location for gmp
diff --git a/meta/packages/gcc/gcc-4.2.2/gcc-4.0.2-e300c2c3.patch b/meta/packages/gcc/gcc-4.2.2/gcc-4.0.2-e300c2c3.patch
new file mode 100644
index 0000000000..736ac4b6b6
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/gcc-4.0.2-e300c2c3.patch
@@ -0,0 +1,311 @@
1Adds support for Freescale Power architecture e300c2 and e300c3 cores.
2http://www.bitshrine.org/gpp/tc-fsl-x86lnx-e300c3-nptl-4.0.2-2.src.rpm
3
4Leon Woestenberg <leonw@mailcan.com>
5
6Index: gcc-4.1.2/gcc/config/rs6000/e300c2c3.md
7===================================================================
8--- /dev/null 1970-01-01 00:00:00.000000000 +0000
9+++ gcc-4.1.2/gcc/config/rs6000/e300c2c3.md 2007-10-18 15:32:51.000000000 +0200
10@@ -0,0 +1,189 @@
11+;; Pipeline description for Motorola PowerPC e300c3 core.
12+;; Copyright (C) 2003 Free Software Foundation, Inc.
13+;;
14+;; This file is part of GCC.
15+
16+;; GCC is free software; you can redistribute it and/or modify it
17+;; under the terms of the GNU General Public License as published
18+;; by the Free Software Foundation; either version 2, or (at your
19+;; option) any later version.
20+
21+;; GCC is distributed in the hope that it will be useful, but WITHOUT
22+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24+;; License for more details.
25+
26+;; You should have received a copy of the GNU General Public License
27+;; along with GCC; see the file COPYING. If not, write to the
28+;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
29+;; MA 02111-1307, USA.
30+
31+(define_automaton "ppce300c3_most,ppce300c3_long,ppce300c3_retire")
32+(define_cpu_unit "ppce300c3_decode_0,ppce300c3_decode_1" "ppce300c3_most")
33+
34+;; We don't simulate general issue queue (GIC). If we have SU insn
35+;; and then SU1 insn, they can not be issued on the same cycle
36+;; (although SU1 insn and then SU insn can be issued) because the SU
37+;; insn will go to SU1 from GIC0 entry. Fortunately, the first cycle
38+;; multipass insn scheduling will find the situation and issue the SU1
39+;; insn and then the SU insn.
40+(define_cpu_unit "ppce300c3_issue_0,ppce300c3_issue_1" "ppce300c3_most")
41+
42+;; We could describe completion buffers slots in combination with the
43+;; retirement units and the order of completion but the result
44+;; automaton would behave in the same way because we can not describe
45+;; real latency time with taking in order completion into account.
46+;; Actually we could define the real latency time by querying reserved
47+;; automaton units but the current scheduler uses latency time before
48+;; issuing insns and making any reservations.
49+;;
50+;; So our description is aimed to achieve a insn schedule in which the
51+;; insns would not wait in the completion buffer.
52+(define_cpu_unit "ppce300c3_retire_0,ppce300c3_retire_1" "ppce300c3_retire")
53+
54+;; Branch unit:
55+(define_cpu_unit "ppce300c3_bu" "ppce300c3_most")
56+
57+;; IU:
58+(define_cpu_unit "ppce300c3_iu0_stage0,ppce300c3_iu1_stage0" "ppce300c3_most")
59+
60+;; IU: This used to describe non-pipelined division.
61+(define_cpu_unit "ppce300c3_mu_div" "ppce300c3_long")
62+
63+;; SRU:
64+(define_cpu_unit "ppce300c3_sru_stage0" "ppce300c3_most")
65+
66+;; Here we simplified LSU unit description not describing the stages.
67+(define_cpu_unit "ppce300c3_lsu" "ppce300c3_most")
68+
69+;; FPU:
70+(define_cpu_unit "ppce300c3_fpu" "ppce300c3_most")
71+
72+;; The following units are used to make automata deterministic
73+(define_cpu_unit "present_ppce300c3_decode_0" "ppce300c3_most")
74+(define_cpu_unit "present_ppce300c3_issue_0" "ppce300c3_most")
75+(define_cpu_unit "present_ppce300c3_retire_0" "ppce300c3_retire")
76+(define_cpu_unit "present_ppce300c3_iu0_stage0" "ppce300c3_most")
77+
78+;; The following sets to make automata deterministic when option ndfa is used.
79+(presence_set "present_ppce300c3_decode_0" "ppce300c3_decode_0")
80+(presence_set "present_ppce300c3_issue_0" "ppce300c3_issue_0")
81+(presence_set "present_ppce300c3_retire_0" "ppce300c3_retire_0")
82+(presence_set "present_ppce300c3_iu0_stage0" "ppce300c3_iu0_stage0")
83+
84+;; Some useful abbreviations.
85+(define_reservation "ppce300c3_decode"
86+ "ppce300c3_decode_0|ppce300c3_decode_1+present_ppce300c3_decode_0")
87+(define_reservation "ppce300c3_issue"
88+ "ppce300c3_issue_0|ppce300c3_issue_1+present_ppce300c3_issue_0")
89+(define_reservation "ppce300c3_retire"
90+ "ppce300c3_retire_0|ppce300c3_retire_1+present_ppce300c3_retire_0")
91+(define_reservation "ppce300c3_iu_stage0"
92+ "ppce300c3_iu0_stage0|ppce300c3_iu1_stage0+present_ppce300c3_iu0_stage0")
93+
94+;; Compares can be executed either one of the IU or SRU
95+(define_insn_reservation "ppce300c3_cmp" 1
96+ (and (eq_attr "type" "cmp,compare,delayed_compare,fast_compare")
97+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
98+ "ppce300c3_decode,ppce300c3_issue+(ppce300c3_iu_stage0|ppce300c3_sru_stage0) \
99+ +ppce300c3_retire")
100+
101+;; Other one cycle IU insns
102+(define_insn_reservation "ppce300c3_iu" 1
103+ (and (eq_attr "type" "integer,insert_word")
104+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
105+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_retire")
106+
107+;; Branch. Actually this latency time is not used by the scheduler.
108+(define_insn_reservation "ppce300c3_branch" 1
109+ (and (eq_attr "type" "jmpreg,branch")
110+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
111+ "ppce300c3_decode,ppce300c3_bu,ppce300c3_retire")
112+
113+;; Multiply is non-pipelined but can be executed in any IU
114+(define_insn_reservation "ppce300c3_multiply" 2
115+ (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
116+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
117+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0, \
118+ ppce300c3_iu_stage0+ppce300c3_retire")
119+
120+;; Divide. We use the average latency time here. We omit reserving a
121+;; retire unit because of the result automata will be huge.
122+(define_insn_reservation "ppce300c3_divide" 20
123+ (and (eq_attr "type" "idiv")
124+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
125+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_mu_div,\
126+ ppce300c3_mu_div*19")
127+
128+;; CR logical
129+(define_insn_reservation "ppce300c3_cr_logical" 1
130+ (and (eq_attr "type" "cr_logical,delayed_cr")
131+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
132+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
133+
134+;; Mfcr
135+(define_insn_reservation "ppce300c3_mfcr" 1
136+ (and (eq_attr "type" "mfcr")
137+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
138+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
139+
140+;; Mtcrf
141+(define_insn_reservation "ppce300c3_mtcrf" 1
142+ (and (eq_attr "type" "mtcr")
143+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
144+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
145+
146+;; Mtjmpr
147+(define_insn_reservation "ppce300c3_mtjmpr" 1
148+ (and (eq_attr "type" "mtjmpr,mfjmpr")
149+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
150+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
151+
152+;; Float point instructions
153+(define_insn_reservation "ppce300c3_fpcompare" 3
154+ (and (eq_attr "type" "fpcompare")
155+ (eq_attr "cpu" "ppce300c3"))
156+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire")
157+
158+(define_insn_reservation "ppce300c3_fp" 3
159+ (and (eq_attr "type" "fp")
160+ (eq_attr "cpu" "ppce300c3"))
161+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire")
162+
163+(define_insn_reservation "ppce300c3_dmul" 4
164+ (and (eq_attr "type" "dmul")
165+ (eq_attr "cpu" "ppce300c3"))
166+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu,nothing,ppce300c3_retire")
167+
168+; Divides are not pipelined
169+(define_insn_reservation "ppce300c3_sdiv" 18
170+ (and (eq_attr "type" "sdiv")
171+ (eq_attr "cpu" "ppce300c3"))
172+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*17")
173+
174+(define_insn_reservation "ppce300c3_ddiv" 33
175+ (and (eq_attr "type" "ddiv")
176+ (eq_attr "cpu" "ppce300c3"))
177+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*32")
178+
179+;; Loads
180+(define_insn_reservation "ppce300c3_load" 2
181+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u")
182+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
183+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
184+
185+(define_insn_reservation "ppce300c3_fpload" 2
186+ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
187+ (eq_attr "cpu" "ppce300c3"))
188+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
189+
190+;; Stores.
191+(define_insn_reservation "ppce300c3_store" 2
192+ (and (eq_attr "type" "store,store_ux,store_u")
193+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
194+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
195+
196+(define_insn_reservation "ppce300c3_fpstore" 2
197+ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
198+ (eq_attr "cpu" "ppce300c3"))
199+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
200Index: gcc-4.1.2/gcc/config/rs6000/rs6000.c
201===================================================================
202--- gcc-4.1.2.orig/gcc/config/rs6000/rs6000.c 2006-12-16 20:24:56.000000000 +0100
203+++ gcc-4.1.2/gcc/config/rs6000/rs6000.c 2007-10-18 15:34:26.000000000 +0200
204@@ -557,6 +557,21 @@
205 COSTS_N_INSNS (29), /* ddiv */
206 };
207
208+/* Instruction costs on E300C2 and E300C3 cores. */
209+static const
210+struct processor_costs ppce300c2c3_cost = {
211+ COSTS_N_INSNS (4), /* mulsi */
212+ COSTS_N_INSNS (4), /* mulsi_const */
213+ COSTS_N_INSNS (4), /* mulsi_const9 */
214+ COSTS_N_INSNS (4), /* muldi */
215+ COSTS_N_INSNS (19), /* divsi */
216+ COSTS_N_INSNS (19), /* divdi */
217+ COSTS_N_INSNS (3), /* fp */
218+ COSTS_N_INSNS (4), /* dmul */
219+ COSTS_N_INSNS (18), /* sdiv */
220+ COSTS_N_INSNS (33), /* ddiv */
221+};
222+
223 /* Instruction costs on POWER4 and POWER5 processors. */
224 static const
225 struct processor_costs power4_cost = {
226@@ -1140,6 +1155,8 @@
227 /* 8548 has a dummy entry for now. */
228 {"8548", PROCESSOR_PPC8540,
229 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN},
230+ {"e300c2", PROCESSOR_PPCE300C2, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
231+ {"e300c3", PROCESSOR_PPCE300C3, POWERPC_BASE_MASK},
232 {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
233 {"970", PROCESSOR_POWER4,
234 POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
235@@ -1529,6 +1546,11 @@
236 rs6000_cost = &ppc8540_cost;
237 break;
238
239+ case PROCESSOR_PPCE300C2:
240+ case PROCESSOR_PPCE300C3:
241+ rs6000_cost = &ppce300c2c3_cost;
242+ break;
243+
244 case PROCESSOR_POWER4:
245 case PROCESSOR_POWER5:
246 rs6000_cost = &power4_cost;
247@@ -16647,6 +16669,8 @@
248 case CPU_PPC750:
249 case CPU_PPC7400:
250 case CPU_PPC8540:
251+ case CPU_PPCE300C2:
252+ case CPU_PPCE300C3:
253 return 2;
254 case CPU_RIOS2:
255 case CPU_PPC604:
256Index: gcc-4.1.2/gcc/config/rs6000/rs6000.h
257===================================================================
258--- gcc-4.1.2.orig/gcc/config/rs6000/rs6000.h 2006-11-18 01:25:49.000000000 +0100
259+++ gcc-4.1.2/gcc/config/rs6000/rs6000.h 2007-10-18 15:32:51.000000000 +0200
260@@ -111,6 +111,8 @@
261 %{mcpu=970: -mpower4 -maltivec} \
262 %{mcpu=G5: -mpower4 -maltivec} \
263 %{mcpu=8540: -me500} \
264+%{mcpu=e300c2: -mppc} \
265+%{mcpu=e300c3: -mppc -mpmr} \
266 %{maltivec: -maltivec} \
267 -many"
268
269@@ -211,6 +213,8 @@
270 PROCESSOR_PPC7400,
271 PROCESSOR_PPC7450,
272 PROCESSOR_PPC8540,
273+ PROCESSOR_PPCE300C2,
274+ PROCESSOR_PPCE300C3,
275 PROCESSOR_POWER4,
276 PROCESSOR_POWER5
277 };
278Index: gcc-4.1.2/gcc/config/rs6000/rs6000.md
279===================================================================
280--- gcc-4.1.2.orig/gcc/config/rs6000/rs6000.md 2006-12-16 20:24:56.000000000 +0100
281+++ gcc-4.1.2/gcc/config/rs6000/rs6000.md 2007-10-18 15:32:51.000000000 +0200
282@@ -103,7 +103,7 @@
283 ;; Processor type -- this attribute must exactly match the processor_type
284 ;; enumeration in rs6000.h.
285
286-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
287+(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,power4,power5"
288 (const (symbol_ref "rs6000_cpu_attr")))
289
290 (automata_option "ndfa")
291@@ -119,6 +119,7 @@
292 (include "7xx.md")
293 (include "7450.md")
294 (include "8540.md")
295+(include "e300c2c3.md")
296 (include "power4.md")
297 (include "power5.md")
298
299Index: gcc-4.1.2/gcc/config.gcc
300===================================================================
301--- gcc-4.1.2.orig/gcc/config.gcc 2007-10-18 15:26:23.000000000 +0200
302+++ gcc-4.1.2/gcc/config.gcc 2007-10-18 15:32:51.000000000 +0200
303@@ -2710,7 +2710,7 @@
304 | rios | rios1 | rios2 | rsc | rsc1 | rs64a \
305 | 401 | 403 | 405 | 405fp | 440 | 440fp | 505 \
306 | 601 | 602 | 603 | 603e | ec603e | 604 \
307- | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
308+ | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 | e300c[23] \
309 | 854[08] | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5)
310 # OK
311 ;;
diff --git a/meta/packages/gcc/gcc-4.2.2/gcc41-configure.in.patch b/meta/packages/gcc/gcc-4.2.2/gcc41-configure.in.patch
new file mode 100644
index 0000000000..3d33bcb978
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/gcc41-configure.in.patch
@@ -0,0 +1,22 @@
1--- gcc-3.4.4/configure.in.orig 2005-08-09 19:57:51.504323183 -0700
2+++ gcc-3.4.4/configure.in 2005-08-09 20:00:12.073168623 -0700
3@@ -1907,7 +1907,7 @@
4 *) gxx_include_dir=${with_gxx_include_dir} ;;
5 esac
6
7-FLAGS_FOR_TARGET=
8+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
9 case " $target_configdirs " in
10 *" newlib "*)
11 case " $target_configargs " in
12--- gcc-3.4.4/configure.orig 2005-08-09 21:02:29.668360660 -0700
13+++ gcc-3.4.4/configure 2005-08-09 21:02:50.157649970 -0700
14@@ -2669,7 +2669,7 @@
15 *) gxx_include_dir=${with_gxx_include_dir} ;;
16 esac
17
18-FLAGS_FOR_TARGET=
19+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
20 case " $target_configdirs " in
21 *" newlib "*)
22 case " $target_configargs " in
diff --git a/meta/packages/gcc/gcc-4.2.2/gfortran.patch b/meta/packages/gcc/gcc-4.2.2/gfortran.patch
new file mode 100644
index 0000000000..96905e5d7d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/gfortran.patch
@@ -0,0 +1,40 @@
1The patch below fixes a crash building libgfortran on arm-linux-gnueabi.
2
3This target doesn't really have a 128-bit integer type, however it does use
4TImode to represent the return value of certain special ABI defined library
5functions. This results in type_for_size(TImode) being called.
6
7Because TImode deosn't correspond to any gfortran integer kind
8gfc_type_for_size returns NULL and we segfault shortly after.
9
10The patch below fixes this by making gfc_type_for_size handle TImode in the
11same way as the C frontend.
12
13Tested on x86_64-linux and arm-linux-gnueabi.
14Applied to trunk.
15
16Paul
17
182007-05-15 Paul Brook <paul@codesourcery.com>
19
20 gcc/fortran/
21 * trans-types.c (gfc_type_for_size): Handle signed TImode.
22
23Index: gcc-4.2.1/gcc/fortran/trans-types.c
24===================================================================
25--- gcc-4.2.1/gcc/fortran/trans-types.c (revision 170435)
26+++ gcc-4.2.1/gcc/fortran/trans-types.c (working copy)
27@@ -1800,6 +1800,13 @@ gfc_type_for_size (unsigned bits, int un
28 if (type && bits == TYPE_PRECISION (type))
29 return type;
30 }
31+
32+ /* Handle TImode as a special case because it is used by some backends
33+ (eg. ARM) even though it is not available for normal use. */
34+#if HOST_BITS_PER_WIDE_INT >= 64
35+ if (bits == TYPE_PRECISION (intTI_type_node))
36+ return intTI_type_node;
37+#endif
38 }
39 else
40 {
diff --git a/meta/packages/gcc/gcc-4.2.2/intermask-bigendian.patch b/meta/packages/gcc/gcc-4.2.2/intermask-bigendian.patch
new file mode 100644
index 0000000000..fdff3d3d86
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/intermask-bigendian.patch
@@ -0,0 +1,24 @@
1--- gcc-4.2.0/gcc/config/arm/bpabi.h
2+++ gcc-4.2.0/gcc/config/arm/bpabi.h
3@@ -33,9 +33,19 @@
4 #undef FPUTYPE_DEFAULT
5 #define FPUTYPE_DEFAULT FPUTYPE_VFP
6
7+/*
8+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
9+ * (big endian) configurations.
10+ */
11+#if TARGET_BIG_ENDIAN_DEFAULT
12+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
13+#else
14+#define TARGET_ENDIAN_DEFAULT 0
15+#endif
16+
17 /* EABI targets should enable interworking by default. */
18 #undef TARGET_DEFAULT
19-#define TARGET_DEFAULT MASK_INTERWORK
20+#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
21
22 /* The ARM BPABI functions return a boolean; they use no special
23 calling convention. */
24
diff --git a/meta/packages/gcc/gcc-4.2.2/ldflags.patch b/meta/packages/gcc/gcc-4.2.2/ldflags.patch
new file mode 100644
index 0000000000..9576f60778
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/ldflags.patch
@@ -0,0 +1,22 @@
1--- /tmp/Makefile.in 2006-02-23 20:56:01.399758728 +0100
2+++ gcc-4.1-20060217/Makefile.in 2006-02-23 20:56:16.874406224 +0100
3@@ -334,7 +334,7 @@
4 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
5 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
6 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
7-LDFLAGS_FOR_TARGET =
8+LDFLAGS_FOR_TARGET = @LDFLAGS@
9 PICFLAG_FOR_TARGET =
10
11 # ------------------------------------
12--- /tmp/Makefile.tpl 2006-02-23 20:50:34.077519272 +0100
13+++ gcc-4.1-20060217/Makefile.tpl 2006-02-23 21:04:31.092273688 +0100
14@@ -337,7 +337,7 @@
15 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
16 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
17 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
18-LDFLAGS_FOR_TARGET =
19+LDFLAGS_FOR_TARGET = @LDFLAGS@
20 PICFLAG_FOR_TARGET =
21
22 # ------------------------------------
diff --git a/meta/packages/gcc/gcc-4.2.2/pr34130.patch b/meta/packages/gcc/gcc-4.2.2/pr34130.patch
new file mode 100644
index 0000000000..415335f4b4
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/pr34130.patch
@@ -0,0 +1,16 @@
1Index: gcc-4.1.2/gcc/fold-const.c
2===================================================================
3--- gcc-4.1.2.orig/gcc/fold-const.c 2007-11-21 18:53:42.000000000 +0100
4+++ gcc-4.1.2/gcc/fold-const.c 2007-11-21 18:56:26.000000000 +0100
5@@ -5339,7 +5339,10 @@
6 }
7 break;
8 }
9- /* FALLTHROUGH */
10+ /* If the constant is negative, we cannot simplify this. */
11+ if (tree_int_cst_sgn (c) == -1)
12+ break;
13+ /* FALLTHROUGH */
14 case NEGATE_EXPR:
15 if ((t1 = extract_muldiv (op0, c, code, wide_type)) != 0)
16 return fold_build1 (tcode, ctype, fold_convert (ctype, t1));
diff --git a/meta/packages/gcc/gcc-4.2.2/sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-4.2.2/sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..4377c2143b
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/sdk-libstdc++-includes.patch
@@ -0,0 +1,22 @@
1--- gcc-3.4.1/libstdc++-v3/libmath/Makefile.am~ 2003-08-27 22:29:42.000000000 +0100
2+++ gcc-3.4.1/libstdc++-v3/libmath/Makefile.am 2004-07-22 16:41:45.152130128 +0100
3@@ -32,7 +32,7 @@
4
5 libmath_la_SOURCES = stubs.c
6
7-AM_CPPFLAGS = $(CANADIAN_INCLUDES)
8+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include
9
10 # Only compiling "C" sources in this directory.
11 LIBTOOL = @LIBTOOL@ --tag CC
12--- gcc-3.4.1/libstdc++-v3/fragment.am.old 2004-07-22 18:24:58.024083656 +0100
13+++ gcc-3.4.1/libstdc++-v3/fragment.am 2004-07-22 18:24:59.019932264 +0100
14@@ -18,7 +18,7 @@
15 $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
16
17 # -I/-D flags to pass when compiling.
18-AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
19+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include
20
21
22
diff --git a/meta/packages/gcc/gcc-4.2.2/sh3-installfix-fixheaders.patch b/meta/packages/gcc/gcc-4.2.2/sh3-installfix-fixheaders.patch
new file mode 100644
index 0000000000..a06cd2e075
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/sh3-installfix-fixheaders.patch
@@ -0,0 +1,11 @@
1--- gcc-4.1.1/gcc/Makefile.in_orig 2007-01-31 21:24:23.000000000 +0000
2+++ gcc-4.1.1/gcc/Makefile.in 2007-01-31 21:24:43.000000000 +0000
3@@ -3772,8 +3772,6 @@
4 $(INSTALL_SCRIPT) $(mkinstalldirs) \
5 $(DESTDIR)$(itoolsdir)/mkinstalldirs ; \
6 $(INSTALL_SCRIPT) $(srcdir)/fixproto $(DESTDIR)$(itoolsdir)/fixproto ; \
7- $(INSTALL_PROGRAM) build/fix-header$(build_exeext) \
8- $(DESTDIR)$(itoolsdir)/fix-header$(build_exeext) ; \
9 else :; fi
10 echo 'SYSTEM_HEADER_DIR="'"$(SYSTEM_HEADER_DIR)"'"' \
11 > $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
diff --git a/meta/packages/gcc/gcc-4.2.2/unbreak-armv4t.patch b/meta/packages/gcc/gcc-4.2.2/unbreak-armv4t.patch
new file mode 100644
index 0000000000..b3399abfdb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/unbreak-armv4t.patch
@@ -0,0 +1,12 @@
1diff -urN gcc-4.1.1/gcc/config/arm/linux-eabi.h gcc-4.1.1-arm9tdmi/gcc/config/arm/linux-eabi.h
2--- gcc-4.1.1/gcc/config/arm/linux-eabi.h 2006-10-22 11:11:49.000000000 -0700
3+++ gcc-4.1.1-arm9tdmi/gcc/config/arm/linux-eabi.h 2006-10-24 21:34:01.000000000 -0700
4@@ -45,7 +45,7 @@
5 The ARM10TDMI core is the default for armv5t, so set
6 SUBTARGET_CPU_DEFAULT to achieve this. */
7 #undef SUBTARGET_CPU_DEFAULT
8-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
9+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
10
11 #undef SUBTARGET_EXTRA_LINK_SPEC
12 #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
diff --git a/meta/packages/gcc/gcc-4.2.2/zecke-no-host-includes.patch b/meta/packages/gcc/gcc-4.2.2/zecke-no-host-includes.patch
new file mode 100644
index 0000000000..6afb10d6ef
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/zecke-no-host-includes.patch
@@ -0,0 +1,31 @@
1Index: gcc-4.0.2/gcc/c-incpath.c
2===================================================================
3--- gcc-4.0.2.orig/gcc/c-incpath.c 2005-01-23 16:05:27.000000000 +0100
4+++ gcc-4.0.2/gcc/c-incpath.c 2006-05-15 21:23:02.000000000 +0200
5@@ -350,6 +350,26 @@
6 p->construct = 0;
7 p->user_supplied_p = user_supplied_p;
8
9+#ifdef CROSS_COMPILE
10+ /* A common error when cross compiling is including
11+ host headers. This code below will try to fail fast
12+ for cross compiling. Currently we consider /usr/include,
13+ /opt/include and /sw/include as harmful. */
14+ {
15+ /* printf("Adding Path: %s\n", p->name ); */
16+ if( strstr(p->name, "/usr/include" ) == p->name ) {
17+ fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name);
18+ abort();
19+ } else if( strstr(p->name, "/sw/include") == p->name ) {
20+ fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name);
21+ abort();
22+ } else if( strstr(p->name, "/opt/include") == p->name ) {
23+ fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name);
24+ abort();
25+ }
26+ }
27+#endif
28+
29 add_cpp_dir_path (p, chain);
30 }
31
diff --git a/meta/packages/gcc/gcc-4.2.2/zecke-xgcc-cpp.patch b/meta/packages/gcc/gcc-4.2.2/zecke-xgcc-cpp.patch
new file mode 100644
index 0000000000..921cab6e18
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2/zecke-xgcc-cpp.patch
@@ -0,0 +1,16 @@
1upstream: n/a
2comment: Use the preprocessor we have just compiled instead the one of
3the system. There might be incompabilities between us and them.
4
5Index: gcc-4.1.1/Makefile.in
6===================================================================
7--- gcc-4.1.1.orig/Makefile.in 2006-08-06 13:32:44.000000000 +0200
8+++ gcc-4.1.1/Makefile.in 2006-08-06 13:32:46.000000000 +0200
9@@ -194,6 +194,7 @@
10 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
11 CC="$(CC_FOR_TARGET)"; export CC; \
12 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
13+ CPP="$(CC_FOR_TARGET) -E"; export CCP; \
14 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
15 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
16 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
diff --git a/meta/packages/gcc/gcc-cross-initial_4.2.2.bb b/meta/packages/gcc/gcc-cross-initial_4.2.2.bb
new file mode 100644
index 0000000000..fe326d304b
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-initial_4.2.2.bb
@@ -0,0 +1,5 @@
1require gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
3
4EXTRA_OECONF += "--disable-libmudflap --disable-libgomp \
5 --disable-libssp"
diff --git a/meta/packages/gcc/gcc-cross-sdk_4.2.2.bb b/meta/packages/gcc/gcc-cross-sdk_4.2.2.bb
new file mode 100644
index 0000000000..ba360698bd
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-sdk_4.2.2.bb
@@ -0,0 +1,21 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5PR = "r3"
6
7inherit sdk
8
9FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
10
11PACKAGES = "${PN}"
12
13require gcc_${PV}.bb
14require gcc4-build-sdk.inc
15require gcc-package-sdk.inc
16
17DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc gmp-native mpfr-native"
18
19EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
20 --disable-libgomp --disable-libmudflap \
21 --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}"
diff --git a/meta/packages/gcc/gcc-cross_4.2.2.bb b/meta/packages/gcc/gcc-cross_4.2.2.bb
new file mode 100644
index 0000000000..def16597e0
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross_4.2.2.bb
@@ -0,0 +1,22 @@
1require gcc_${PV}.bb
2# path mangling, needed by the cross packaging
3require gcc-paths-cross.inc
4inherit cross
5FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
6# NOTE: split PR. If the main .oe changes something that affects its *build*
7# remember to increment this one too.
8PR = "r6"
9
10DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc gmp-native mpfr-native"
11PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
12
13# cross build
14require gcc3-build-cross.inc
15# cross packaging
16require gcc-package-cross.inc
17SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch;patch=1 "
18# Do not build libssp libmudflap and libgomp
19# We might need them for some beefy targets
20EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
21 --disable-libgomp --disable-libmudflap \
22 --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}"
diff --git a/meta/packages/gcc/gcc_4.2.2.bb b/meta/packages/gcc/gcc_4.2.2.bb
new file mode 100644
index 0000000000..0a0e9cdd16
--- /dev/null
+++ b/meta/packages/gcc/gcc_4.2.2.bb
@@ -0,0 +1,96 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5PR = "r6"
6
7inherit autotools gettext
8
9require gcc-package.inc
10
11SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
12 file://100-uclibc-conf.patch;patch=1 \
13 file://103-uclibc-conf-noupstream.patch;patch=1 \
14 file://200-uclibc-locale.patch;patch=1 \
15 file://203-uclibc-locale-no__x.patch;patch=1 \
16 file://204-uclibc-locale-wchar_fix.patch;patch=1 \
17 file://205-uclibc-locale-update.patch;patch=1 \
18 file://300-libstdc++-pic.patch;patch=1 \
19 file://301-missing-execinfo_h.patch;patch=1 \
20 file://302-c99-snprintf.patch;patch=1 \
21 file://303-c99-complex-ugly-hack.patch;patch=1 \
22 file://304-index_macro.patch;patch=1 \
23 file://305-libmudflap-susv3-legacy.patch;patch=1 \
24 file://306-libstdc++-namespace.patch;patch=1 \
25 file://307-locale_facets.patch;patch=1 \
26 file://402-libbackend_dep_gcov-iov.h.patch;patch=1 \
27 file://602-sdk-libstdc++-includes.patch;patch=1 \
28 file://740-sh-pr24836.patch;patch=1 \
29 file://800-arm-bigendian.patch;patch=1 \
30 file://801-arm-bigendian-eabi.patch;patch=1 \
31 file://904-flatten-switch-stmt-00.patch;patch=1 \
32 file://arm-nolibfloat.patch;patch=1 \
33 file://arm-softfloat.patch;patch=1 \
34 file://gcc41-configure.in.patch;patch=1 \
35 file://arm-thumb.patch;patch=1 \
36 file://arm-thumb-cache.patch;patch=1 \
37 file://ldflags.patch;patch=1 \
38 file://zecke-xgcc-cpp.patch;patch=1 \
39 file://unbreak-armv4t.patch;patch=1 \
40 file://fix-ICE-in-arm_unwind_emit_set.diff;patch=1 \
41 file://cache-amnesia.patch;patch=1 \
42 file://gfortran.patch;patch=1 \
43 file://gcc-4.0.2-e300c2c3.patch;patch=1 \
44 file://pr34130.patch;patch=1 \
45 file://fortran-static-linking.patch;patch=1 \
46 file://intermask-bigendian.patch;patch=1 \
47"
48
49SRC_URI_append_ep93xx = " \
50 file://arm-crunch-saveregs.patch;patch=1 \
51 file://arm-crunch-20000320.patch;patch=1 \
52 file://arm-crunch-compare.patch;patch=1 \
53 file://arm-crunch-compare-unordered.patch;patch=1 \
54 file://arm-crunch-compare-geu.patch;patch=1 \
55 file://arm-crunch-eabi-ieee754.patch;patch=1 \
56 file://arm-crunch-eabi-ieee754-div.patch;patch=1 \
57 file://arm-crunch-64bit-disable0.patch;patch=1 \
58 file://arm-crunch-offset.patch;patch=1 \
59 file://arm-crunch-fp_consts.patch;patch=1 \
60 file://arm-crunch-neg2.patch;patch=1 \
61 file://arm-crunch-predicates3.patch;patch=1 \
62 file://arm-crunch-cfcvtds-disable.patch;patch=1 \
63 file://arm-crunch-floatsi-disable.patch;patch=1 \
64 file://arm-crunch-truncsi-disable.patch;patch=1 \
65 file://arm-crunch-cfcvt64-disable.patch;patch=1 \
66 file://arm-crunch-cirrus-bugfixes.patch;patch=1 \
67 "
68
69PACKAGE_ARCH_ep93xx = "${MACHINE_ARCH}"
70
71SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
72
73#Set the fortran bits
74# 'i,fortran' or '', not 'f77' like gcc3 had
75FORTRAN = ""
76FORTRAN_linux-gnueabi = ",fortran"
77
78DEPENDS += " gmp mpfr "
79
80#Set the java bits
81JAVA = ""
82JAVA_arm = ""
83
84LANGUAGES = "c,c++${FORTRAN}${JAVA}"
85require gcc3-build.inc
86ARCH_FLAGS_FOR_TARGET=-isystem${STAGING_INCDIR}
87
88
89EXTRA_OECONF += " --disable-libssp --disable-bootstrap "
90
91# We know some one is including us, but we only want to apply this fortran hack for the real gcc
92python __anonymous () {
93 import bb
94 if bb.data.getVar('PN', d, True) == "gcc":
95 bb.data.setVar('SRC_URI_append', ' file://fortran-cross-compile-hack.patch;patch=1', d)
96}