summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc/gcc-4.3.0
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-04-07 20:32:31 +0000
committerRichard Purdie <richard@openedhand.com>2008-04-07 20:32:31 +0000
commit0b0cf026cf665aa9192842f36fee7a48acbc22f0 (patch)
tree0502f899d975823f7473e86c5b63d0250186c869 /meta/packages/gcc/gcc-4.3.0
parent1f8b96909c61e8bed1bc2e904ac28d9232f1ab81 (diff)
downloadpoky-0b0cf026cf665aa9192842f36fee7a48acbc22f0.tar.gz
gcc: Add 4.3.0 from OE.dev (not default)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4188 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gcc/gcc-4.3.0')
-rw-r--r--meta/packages/gcc/gcc-4.3.0/100-uclibc-conf.patch200
-rw-r--r--meta/packages/gcc/gcc-4.3.0/103-uclibc-conf-noupstream.patch11
-rw-r--r--meta/packages/gcc/gcc-4.3.0/110-arm-eabi.patch27
-rw-r--r--meta/packages/gcc/gcc-4.3.0/200-uclibc-locale.patch2790
-rw-r--r--meta/packages/gcc/gcc-4.3.0/203-uclibc-locale-no__x.patch213
-rw-r--r--meta/packages/gcc/gcc-4.3.0/204-uclibc-locale-wchar_fix.patch48
-rw-r--r--meta/packages/gcc/gcc-4.3.0/205-uclibc-locale-update.patch347
-rw-r--r--meta/packages/gcc/gcc-4.3.0/300-libstdc++-pic.patch46
-rw-r--r--meta/packages/gcc/gcc-4.3.0/301-missing-execinfo_h.patch11
-rw-r--r--meta/packages/gcc/gcc-4.3.0/302-c99-snprintf.patch11
-rw-r--r--meta/packages/gcc/gcc-4.3.0/303-c99-complex-ugly-hack.patch12
-rw-r--r--meta/packages/gcc/gcc-4.3.0/304-index_macro.patch24
-rw-r--r--meta/packages/gcc/gcc-4.3.0/305-libmudflap-susv3-legacy.patch49
-rw-r--r--meta/packages/gcc/gcc-4.3.0/306-libstdc++-namespace.patch36
-rw-r--r--meta/packages/gcc/gcc-4.3.0/307-locale_facets.patch26
-rw-r--r--meta/packages/gcc/gcc-4.3.0/402-libbackend_dep_gcov-iov.h.patch13
-rw-r--r--meta/packages/gcc/gcc-4.3.0/602-sdk-libstdc++-includes.patch20
-rw-r--r--meta/packages/gcc/gcc-4.3.0/740-sh-pr24836.patch25
-rw-r--r--meta/packages/gcc/gcc-4.3.0/800-arm-bigendian.patch67
-rw-r--r--meta/packages/gcc/gcc-4.3.0/801-arm-bigendian-eabi.patch14
-rw-r--r--meta/packages/gcc/gcc-4.3.0/904-flatten-switch-stmt-00.patch153
-rw-r--r--meta/packages/gcc/gcc-4.3.0/arm-nolibfloat.patch24
-rw-r--r--meta/packages/gcc/gcc-4.3.0/arm-softfloat.patch16
-rw-r--r--meta/packages/gcc/gcc-4.3.0/arm-thumb-cache.patch29
-rw-r--r--meta/packages/gcc/gcc-4.3.0/arm-thumb.patch64
-rw-r--r--meta/packages/gcc/gcc-4.3.0/cache-amnesia.patch13
-rw-r--r--meta/packages/gcc/gcc-4.3.0/fix-ICE-in-arm_unwind_emit_set.diff28
-rw-r--r--meta/packages/gcc/gcc-4.3.0/fortran-cross-compile-hack.patch30
-rw-r--r--meta/packages/gcc/gcc-4.3.0/fortran-static-linking.patch48
-rw-r--r--meta/packages/gcc/gcc-4.3.0/gcc-4.0.2-e300c2c3.patch311
-rw-r--r--meta/packages/gcc/gcc-4.3.0/gcc41-configure.in.patch22
-rw-r--r--meta/packages/gcc/gcc-4.3.0/intermask-bigendian.patch24
-rw-r--r--meta/packages/gcc/gcc-4.3.0/ldflags.patch22
-rw-r--r--meta/packages/gcc/gcc-4.3.0/pr34130.patch16
-rw-r--r--meta/packages/gcc/gcc-4.3.0/sdk-libstdc++-includes.patch22
-rw-r--r--meta/packages/gcc/gcc-4.3.0/sh3-installfix-fixheaders.patch11
-rw-r--r--meta/packages/gcc/gcc-4.3.0/unbreak-armv4t.patch12
-rw-r--r--meta/packages/gcc/gcc-4.3.0/zecke-no-host-includes.patch31
-rw-r--r--meta/packages/gcc/gcc-4.3.0/zecke-xgcc-cpp.patch16
39 files changed, 4882 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.3.0/100-uclibc-conf.patch b/meta/packages/gcc/gcc-4.3.0/100-uclibc-conf.patch
new file mode 100644
index 0000000000..4243ff7b91
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/103-uclibc-conf-noupstream.patch b/meta/packages/gcc/gcc-4.3.0/103-uclibc-conf-noupstream.patch
new file mode 100644
index 0000000000..09c9bbecfb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/110-arm-eabi.patch b/meta/packages/gcc/gcc-4.3.0/110-arm-eabi.patch
new file mode 100644
index 0000000000..acebe5308f
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/200-uclibc-locale.patch b/meta/packages/gcc/gcc-4.3.0/200-uclibc-locale.patch
new file mode 100644
index 0000000000..ea21388b75
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/203-uclibc-locale-no__x.patch b/meta/packages/gcc/gcc-4.3.0/203-uclibc-locale-no__x.patch
new file mode 100644
index 0000000000..6ba47003b3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/204-uclibc-locale-wchar_fix.patch b/meta/packages/gcc/gcc-4.3.0/204-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000000..160ab35bb3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/205-uclibc-locale-update.patch b/meta/packages/gcc/gcc-4.3.0/205-uclibc-locale-update.patch
new file mode 100644
index 0000000000..86b2844554
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/300-libstdc++-pic.patch b/meta/packages/gcc/gcc-4.3.0/300-libstdc++-pic.patch
new file mode 100644
index 0000000000..89d03a85e5
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/301-missing-execinfo_h.patch b/meta/packages/gcc/gcc-4.3.0/301-missing-execinfo_h.patch
new file mode 100644
index 0000000000..0e2092f3fb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/302-c99-snprintf.patch b/meta/packages/gcc/gcc-4.3.0/302-c99-snprintf.patch
new file mode 100644
index 0000000000..dfb22d681b
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/303-c99-complex-ugly-hack.patch b/meta/packages/gcc/gcc-4.3.0/303-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000000..2ccc80d9bb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/304-index_macro.patch b/meta/packages/gcc/gcc-4.3.0/304-index_macro.patch
new file mode 100644
index 0000000000..d8e476555d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/305-libmudflap-susv3-legacy.patch b/meta/packages/gcc/gcc-4.3.0/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000000..374b1f8659
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/306-libstdc++-namespace.patch b/meta/packages/gcc/gcc-4.3.0/306-libstdc++-namespace.patch
new file mode 100644
index 0000000000..69587ca63a
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/307-locale_facets.patch b/meta/packages/gcc/gcc-4.3.0/307-locale_facets.patch
new file mode 100644
index 0000000000..412f8657dc
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/402-libbackend_dep_gcov-iov.h.patch b/meta/packages/gcc/gcc-4.3.0/402-libbackend_dep_gcov-iov.h.patch
new file mode 100644
index 0000000000..0bf115c45d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/602-sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-4.3.0/602-sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..23fce7544d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/740-sh-pr24836.patch b/meta/packages/gcc/gcc-4.3.0/740-sh-pr24836.patch
new file mode 100644
index 0000000000..7992282cff
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/800-arm-bigendian.patch b/meta/packages/gcc/gcc-4.3.0/800-arm-bigendian.patch
new file mode 100644
index 0000000000..07c6093379
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/801-arm-bigendian-eabi.patch b/meta/packages/gcc/gcc-4.3.0/801-arm-bigendian-eabi.patch
new file mode 100644
index 0000000000..54490fc24f
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/904-flatten-switch-stmt-00.patch b/meta/packages/gcc/gcc-4.3.0/904-flatten-switch-stmt-00.patch
new file mode 100644
index 0000000000..8fac37c4df
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/arm-nolibfloat.patch b/meta/packages/gcc/gcc-4.3.0/arm-nolibfloat.patch
new file mode 100644
index 0000000000..c4897c0330
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/arm-softfloat.patch b/meta/packages/gcc/gcc-4.3.0/arm-softfloat.patch
new file mode 100644
index 0000000000..5e1edd9208
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/arm-thumb-cache.patch b/meta/packages/gcc/gcc-4.3.0/arm-thumb-cache.patch
new file mode 100644
index 0000000000..fa63846c8c
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/arm-thumb.patch b/meta/packages/gcc/gcc-4.3.0/arm-thumb.patch
new file mode 100644
index 0000000000..016a7a550b
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/cache-amnesia.patch b/meta/packages/gcc/gcc-4.3.0/cache-amnesia.patch
new file mode 100644
index 0000000000..ef7cd111c5
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/fix-ICE-in-arm_unwind_emit_set.diff b/meta/packages/gcc/gcc-4.3.0/fix-ICE-in-arm_unwind_emit_set.diff
new file mode 100644
index 0000000000..b8a147d3d9
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/fix-ICE-in-arm_unwind_emit_set.diff
@@ -0,0 +1,28 @@
1--- /tmp/arm.c 2008-03-17 14:24:39.590464969 +0100
2+++ gcc-4.3.0/gcc/config/arm/arm.c 2008-03-17 14:12:21.614701982 +0100
3@@ -15959,6 +15959,9 @@
4 int regno;
5 int lo_mask = mask & 0xFF;
6 int pushed_words = 0;
7+ rtx e0;
8+ rtx e1;
9+ unsigned reg;
10
11 gcc_assert (mask);
12
13@@ -16025,6 +16028,15 @@
14
15 return;
16 }
17+ else if (GET_CODE (e1) == PLUS
18+ && GET_CODE (XEXP (e1, 0)) == REG
19+ && REGNO (XEXP (e1, 0)) == SP_REGNUM
20+ && GET_CODE (XEXP (e1, 1)) == CONST_INT)
21+ {
22+ /* Set reg to offset from sp. */
23+ asm_fprintf (asm_out_file, "\t.movsp %r, #%d\n",
24+ REGNO (e0), (int)INTVAL(XEXP (e1, 1)));
25+ }
26 else
27 {
28 if (mask & 0xFF)
diff --git a/meta/packages/gcc/gcc-4.3.0/fortran-cross-compile-hack.patch b/meta/packages/gcc/gcc-4.3.0/fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..b3d38ad983
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/fortran-static-linking.patch b/meta/packages/gcc/gcc-4.3.0/fortran-static-linking.patch
new file mode 100644
index 0000000000..3dd6321dc3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/gcc-4.0.2-e300c2c3.patch b/meta/packages/gcc/gcc-4.3.0/gcc-4.0.2-e300c2c3.patch
new file mode 100644
index 0000000000..736ac4b6b6
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/gcc41-configure.in.patch b/meta/packages/gcc/gcc-4.3.0/gcc41-configure.in.patch
new file mode 100644
index 0000000000..3d33bcb978
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/intermask-bigendian.patch b/meta/packages/gcc/gcc-4.3.0/intermask-bigendian.patch
new file mode 100644
index 0000000000..fdff3d3d86
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/ldflags.patch b/meta/packages/gcc/gcc-4.3.0/ldflags.patch
new file mode 100644
index 0000000000..9576f60778
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/pr34130.patch b/meta/packages/gcc/gcc-4.3.0/pr34130.patch
new file mode 100644
index 0000000000..415335f4b4
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-4.3.0/sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..4377c2143b
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/sh3-installfix-fixheaders.patch b/meta/packages/gcc/gcc-4.3.0/sh3-installfix-fixheaders.patch
new file mode 100644
index 0000000000..a06cd2e075
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/unbreak-armv4t.patch b/meta/packages/gcc/gcc-4.3.0/unbreak-armv4t.patch
new file mode 100644
index 0000000000..b3399abfdb
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/zecke-no-host-includes.patch b/meta/packages/gcc/gcc-4.3.0/zecke-no-host-includes.patch
new file mode 100644
index 0000000000..6afb10d6ef
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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.3.0/zecke-xgcc-cpp.patch b/meta/packages/gcc/gcc-4.3.0/zecke-xgcc-cpp.patch
new file mode 100644
index 0000000000..921cab6e18
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.0/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; \