summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2011-04-19 21:27:09 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-04-28 10:44:21 +0100
commit3669de7f96100a5d4fbfc9b4e2ebc16851ba98ea (patch)
tree66743557d4203b019988970a6fa3ac603c06c991
parent07a6bec75c59fec06d0947ada708482900bf067a (diff)
downloadpoky-3669de7f96100a5d4fbfc9b4e2ebc16851ba98ea.tar.gz
gcc: Add recipes for 4.6.0
This is initial set of patches for testing them out The patches need documentation is pending Some patches especially uclibc related are not needed they must be dropped. (From OE-Core rev: 26858099bc104efc3b3d15d9298018285c551b9a) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0.inc82
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/100-uclibc-conf.patch37
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/103-uclibc-conf-noupstream.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/200-uclibc-locale.patch2840
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/203-uclibc-locale-no__x.patch233
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/204-uclibc-locale-wchar_fix.patch52
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/205-uclibc-locale-update.patch519
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/301-missing-execinfo_h.patch13
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/302-c99-snprintf.patch13
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/303-c99-complex-ugly-hack.patch14
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/304-index_macro.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/305-libmudflap-susv3-legacy.patch49
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/306-libstdc++-namespace.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/307-locale_facets.patch19
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/602-sdk-libstdc++-includes.patch20
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/64bithack.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/740-sh-pr24836.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/800-arm-bigendian.patch34
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/904-flatten-switch-stmt-00.patch74
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/COLLECT_GCC_OPTIONS.patch23
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/arm-bswapsi2.patch13
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/arm-nolibfloat.patch24
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/arm-softfloat.patch16
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/arm-unbreak-eabi-armv4t.dpatch36
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/cache-amnesia.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/disable_relax_pic_calls_flag.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/fortran-cross-compile-hack.patch30
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.0.2-e300c2c3.patch319
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch114
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-arm-frename-registers.patch25
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-flags-for-build.patch178
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-ice-hack.dpatch331
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-dir-extend.patch25
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-parameters.patch74
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch221
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-uclibc-locale-ctype_touplow_t.patch70
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/libstdc++-pic.dpatch71
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/optional_libstdc.patch84
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/pr30961.dpatch179
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/pr35942.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/zecke-xgcc-cpp.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_4.6.0.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-intermediate_4.6.0.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_4.6.0.bb8
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.6.0.bb4
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.6.0.bb4
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_4.6.0.bb10
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.6.0.bb7
-rw-r--r--meta/recipes-devtools/gcc/libgcc_4.6.0.bb46
51 files changed, 6266 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0.inc b/meta/recipes-devtools/gcc/gcc-4.6.0.inc
new file mode 100644
index 0000000000..6f319d4880
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0.inc
@@ -0,0 +1,82 @@
1require gcc-common.inc
2
3DEPENDS =+ "mpfr gmp libmpc"
4NATIVEDEPS = "mpfr-native gmp-native gettext-native libmpc-native"
5
6LICENSE="GCC RUNTIME LIBRARY EXCEPTION & GPLv3"
7
8LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
9 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
10 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
11 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
12 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
13
14SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
15 file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
16 file://100-uclibc-conf.patch \
17 file://gcc-uclibc-locale-ctype_touplow_t.patch \
18 file://cache-amnesia.patch \
19 file://gcc-flags-for-build.patch \
20 file://103-uclibc-conf-noupstream.patch \
21 file://200-uclibc-locale.patch \
22 file://203-uclibc-locale-no__x.patch;striplevel=1 \
23 file://204-uclibc-locale-wchar_fix.patch;striplevel=1 \
24 file://205-uclibc-locale-update.patch;striplevel=1 \
25 file://301-missing-execinfo_h.patch \
26 file://302-c99-snprintf.patch \
27 file://303-c99-complex-ugly-hack.patch \
28 file://304-index_macro.patch \
29 file://305-libmudflap-susv3-legacy.patch \
30 file://306-libstdc++-namespace.patch \
31 file://740-sh-pr24836.patch \
32 file://800-arm-bigendian.patch \
33 file://904-flatten-switch-stmt-00.patch \
34 file://arm-nolibfloat.patch \
35 file://arm-softfloat.patch \
36 file://zecke-xgcc-cpp.patch \
37 file://gcc-poison-system-directories.patch \
38 file://gcc-poison-dir-extend.patch \
39 file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
40 file://64bithack.patch \
41 file://optional_libstdc.patch \
42 file://disable_relax_pic_calls_flag.patch \
43 file://gcc-poison-parameters.patch \
44 file://GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch \
45 file://COLLECT_GCC_OPTIONS.patch \
46 "
47SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
48
49SRC_URI[md5sum] = "93d1c436bf991564524701259b6285a2"
50SRC_URI[sha256sum] = "23bd0013d76ac6fb4537e5e8f4e5947129362dcc32f0d08563b7d4d9e44c0e17"
51
52
53# Language Overrides
54FORTRAN = ""
55JAVA = ""
56
57#EXTRA_OECONF_BASE = " --enable-cheaders=c_std \
58# --enable-libssp \
59# --disable-bootstrap \
60# --disable-libgomp \
61# --disable-libmudflap"
62EXTRA_OECONF_BASE = " --enable-lto \
63 --enable-libssp \
64 --disable-bootstrap \
65 --disable-libgomp \
66 --disable-libmudflap \
67 --enable-cheaders=c_global "
68
69EXTRA_OECONF_INITIAL = "--disable-libmudflap \
70 --disable-libgomp \
71 --disable-libssp \
72 --disable-libquadmath \
73 --enable-decimal-float=no"
74
75EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
76 --disable-libgomp \
77 --disable-libquadmath \
78 --disable-libssp"
79
80EXTRA_OECONF_append_linux-uclibc = " --disable-decimal-float "
81EXTRA_OECONF_append_linux-uclibceabi = " --disable-decimal-float "
82EXTRA_OECONF_append_linux-uclibcspe = " --disable-decimal-float "
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/100-uclibc-conf.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/100-uclibc-conf.patch
new file mode 100644
index 0000000000..313b828df7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/100-uclibc-conf.patch
@@ -0,0 +1,37 @@
1Index: gcc-4.6.0/contrib/regression/objs-gcc.sh
2===================================================================
3--- gcc-4.6.0.orig/contrib/regression/objs-gcc.sh
4+++ gcc-4.6.0/contrib/regression/objs-gcc.sh
5@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
6 then
7 make all-gdb all-dejagnu all-ld || exit 1
8 make install-gdb install-dejagnu install-ld || exit 1
9+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
10+ then
11+ make all-gdb all-dejagnu all-ld || exit 1
12+ make install-gdb install-dejagnu install-ld || exit 1
13 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
14 make bootstrap || exit 1
15 make install || exit 1
16Index: gcc-4.6.0/libjava/classpath/ltconfig
17===================================================================
18--- gcc-4.6.0.orig/libjava/classpath/ltconfig
19+++ gcc-4.6.0/libjava/classpath/ltconfig
20@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
21
22 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
23 case $host_os in
24-linux-gnu*) ;;
25+linux-gnu*|linux-uclibc*) ;;
26 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
27 esac
28
29@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
30 ;;
31
32 # This must be Linux ELF.
33-linux-gnu*)
34+linux*)
35 version_type=linux
36 need_lib_prefix=no
37 need_version=no
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/103-uclibc-conf-noupstream.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/103-uclibc-conf-noupstream.patch
new file mode 100644
index 0000000000..b28fac2c19
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/103-uclibc-conf-noupstream.patch
@@ -0,0 +1,15 @@
1Corrects sub machine arch corectly
2
3Index: gcc-4.6.0/gcc/config.gcc
4===================================================================
5--- gcc-4.6.0.orig/gcc/config.gcc
6+++ gcc-4.6.0/gcc/config.gcc
7@@ -2316,7 +2316,7 @@ score-*-elf)
8 ;;
9 sh-*-elf* | sh[12346l]*-*-elf* | \
10 sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
11- sh-*-linux* | sh[2346lbe]*-*-linux* | \
12+ sh*-*-linux* | sh[2346lbe]*-*-linux* | \
13 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
14 sh64-*-netbsd* | sh64l*-*-netbsd*)
15 tmake_file="${tmake_file} sh/t-sh sh/t-elf"
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/200-uclibc-locale.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/200-uclibc-locale.patch
new file mode 100644
index 0000000000..0f2caffd21
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/200-uclibc-locale.patch
@@ -0,0 +1,2840 @@
1Index: gcc-4.6.0/libstdc++-v3/acinclude.m4
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/acinclude.m4
4+++ gcc-4.6.0/libstdc++-v3/acinclude.m4
5@@ -1753,7 +1753,7 @@ dnl
6 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
7 GLIBCXX_ENABLE(clocale,auto,[[[=MODEL]]],
8 [use MODEL for target locale package],
9- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
10+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
11
12 # Deal with gettext issues. Default to not using it (=no) until we detect
13 # support for it later. Let the user turn it off via --e/d, but let that
14@@ -1774,6 +1774,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
15 # Default to "generic".
16 if test $enable_clocale_flag = auto; then
17 case ${target_os} in
18+ *-uclibc*)
19+ enable_clocale_flag=uclibc
20+ ;;
21 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
22 enable_clocale_flag=gnu
23 ;;
24@@ -1915,6 +1918,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
25 CTIME_CC=config/locale/generic/time_members.cc
26 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
27 ;;
28+ uclibc)
29+ AC_MSG_RESULT(uclibc)
30+
31+ # Declare intention to use gettext, and add support for specific
32+ # languages.
33+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
34+ ALL_LINGUAS="de fr"
35+
36+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
37+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
38+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
39+ USE_NLS=yes
40+ fi
41+ # Export the build objects.
42+ for ling in $ALL_LINGUAS; do \
43+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
44+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
45+ done
46+ AC_SUBST(glibcxx_MOFILES)
47+ AC_SUBST(glibcxx_POFILES)
48+
49+ CLOCALE_H=config/locale/uclibc/c_locale.h
50+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
51+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
52+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
53+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
54+ CMESSAGES_H=config/locale/uclibc/messages_members.h
55+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
56+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
57+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
58+ CTIME_H=config/locale/uclibc/time_members.h
59+ CTIME_CC=config/locale/uclibc/time_members.cc
60+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
61+ ;;
62 esac
63
64 # This is where the testsuite looks for locale catalogs, using the
65Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
66===================================================================
67--- /dev/null
68+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
69@@ -0,0 +1,63 @@
70+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
71+
72+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
73+//
74+// This file is part of the GNU ISO C++ Library. This library is free
75+// software; you can redistribute it and/or modify it under the
76+// terms of the GNU General Public License as published by the
77+// Free Software Foundation; either version 2, or (at your option)
78+// any later version.
79+
80+// This library is distributed in the hope that it will be useful,
81+// but WITHOUT ANY WARRANTY; without even the implied warranty of
82+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83+// GNU General Public License for more details.
84+
85+// You should have received a copy of the GNU General Public License along
86+// with this library; see the file COPYING. If not, write to the Free
87+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
88+// USA.
89+
90+// As a special exception, you may use this file as part of a free software
91+// library without restriction. Specifically, if other files instantiate
92+// templates or use macros or inline functions from this file, or you compile
93+// this file and link it with other files to produce an executable, this
94+// file does not by itself cause the resulting executable to be covered by
95+// the GNU General Public License. This exception does not however
96+// invalidate any other reasons why the executable file might be covered by
97+// the GNU General Public License.
98+
99+// Written by Jakub Jelinek <jakub@redhat.com>
100+
101+#include <bits/c++config.h>
102+#include <clocale>
103+
104+#ifdef __UCLIBC_MJN3_ONLY__
105+#warning clean this up
106+#endif
107+
108+#ifdef __UCLIBC_HAS_XLOCALE__
109+
110+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
111+extern "C" __typeof(strcoll_l) __strcoll_l;
112+extern "C" __typeof(strftime_l) __strftime_l;
113+extern "C" __typeof(strtod_l) __strtod_l;
114+extern "C" __typeof(strtof_l) __strtof_l;
115+extern "C" __typeof(strtold_l) __strtold_l;
116+extern "C" __typeof(strxfrm_l) __strxfrm_l;
117+extern "C" __typeof(newlocale) __newlocale;
118+extern "C" __typeof(freelocale) __freelocale;
119+extern "C" __typeof(duplocale) __duplocale;
120+extern "C" __typeof(uselocale) __uselocale;
121+
122+#ifdef _GLIBCXX_USE_WCHAR_T
123+extern "C" __typeof(iswctype_l) __iswctype_l;
124+extern "C" __typeof(towlower_l) __towlower_l;
125+extern "C" __typeof(towupper_l) __towupper_l;
126+extern "C" __typeof(wcscoll_l) __wcscoll_l;
127+extern "C" __typeof(wcsftime_l) __wcsftime_l;
128+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
129+extern "C" __typeof(wctype_l) __wctype_l;
130+#endif
131+
132+#endif // GLIBC 2.3 and later
133Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
134===================================================================
135--- /dev/null
136+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
137@@ -0,0 +1,160 @@
138+// Wrapper for underlying C-language localization -*- C++ -*-
139+
140+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
141+//
142+// This file is part of the GNU ISO C++ Library. This library is free
143+// software; you can redistribute it and/or modify it under the
144+// terms of the GNU General Public License as published by the
145+// Free Software Foundation; either version 2, or (at your option)
146+// any later version.
147+
148+// This library is distributed in the hope that it will be useful,
149+// but WITHOUT ANY WARRANTY; without even the implied warranty of
150+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
151+// GNU General Public License for more details.
152+
153+// You should have received a copy of the GNU General Public License along
154+// with this library; see the file COPYING. If not, write to the Free
155+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
156+// USA.
157+
158+// As a special exception, you may use this file as part of a free software
159+// library without restriction. Specifically, if other files instantiate
160+// templates or use macros or inline functions from this file, or you compile
161+// this file and link it with other files to produce an executable, this
162+// file does not by itself cause the resulting executable to be covered by
163+// the GNU General Public License. This exception does not however
164+// invalidate any other reasons why the executable file might be covered by
165+// the GNU General Public License.
166+
167+//
168+// ISO C++ 14882: 22.8 Standard locale categories.
169+//
170+
171+// Written by Benjamin Kosnik <bkoz@redhat.com>
172+
173+#include <cerrno> // For errno
174+#include <locale>
175+#include <stdexcept>
176+#include <langinfo.h>
177+#include <bits/c++locale_internal.h>
178+
179+#ifndef __UCLIBC_HAS_XLOCALE__
180+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
181+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
182+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
183+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
184+#define __strtof_l(S, E, L) strtof((S), (E))
185+#define __strtod_l(S, E, L) strtod((S), (E))
186+#define __strtold_l(S, E, L) strtold((S), (E))
187+#warning should dummy __newlocale check for C|POSIX ?
188+#define __newlocale(a, b, c) NULL
189+#define __freelocale(a) ((void)0)
190+#define __duplocale(a) __c_locale()
191+#endif
192+
193+namespace std
194+{
195+ template<>
196+ void
197+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
198+ const __c_locale& __cloc)
199+ {
200+ if (!(__err & ios_base::failbit))
201+ {
202+ char* __sanity;
203+ errno = 0;
204+ float __f = __strtof_l(__s, &__sanity, __cloc);
205+ if (__sanity != __s && errno != ERANGE)
206+ __v = __f;
207+ else
208+ __err |= ios_base::failbit;
209+ }
210+ }
211+
212+ template<>
213+ void
214+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
215+ const __c_locale& __cloc)
216+ {
217+ if (!(__err & ios_base::failbit))
218+ {
219+ char* __sanity;
220+ errno = 0;
221+ double __d = __strtod_l(__s, &__sanity, __cloc);
222+ if (__sanity != __s && errno != ERANGE)
223+ __v = __d;
224+ else
225+ __err |= ios_base::failbit;
226+ }
227+ }
228+
229+ template<>
230+ void
231+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
232+ const __c_locale& __cloc)
233+ {
234+ if (!(__err & ios_base::failbit))
235+ {
236+ char* __sanity;
237+ errno = 0;
238+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
239+ if (__sanity != __s && errno != ERANGE)
240+ __v = __ld;
241+ else
242+ __err |= ios_base::failbit;
243+ }
244+ }
245+
246+ void
247+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
248+ __c_locale __old)
249+ {
250+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
251+#ifdef __UCLIBC_HAS_XLOCALE__
252+ if (!__cloc)
253+ {
254+ // This named locale is not supported by the underlying OS.
255+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
256+ "name not valid"));
257+ }
258+#endif
259+ }
260+
261+ void
262+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
263+ {
264+ if (_S_get_c_locale() != __cloc)
265+ __freelocale(__cloc);
266+ }
267+
268+ __c_locale
269+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
270+ { return __duplocale(__cloc); }
271+} // namespace std
272+
273+namespace __gnu_cxx
274+{
275+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
276+ {
277+ "LC_CTYPE",
278+ "LC_NUMERIC",
279+ "LC_TIME",
280+ "LC_COLLATE",
281+ "LC_MONETARY",
282+ "LC_MESSAGES",
283+#if _GLIBCXX_NUM_CATEGORIES != 0
284+ "LC_PAPER",
285+ "LC_NAME",
286+ "LC_ADDRESS",
287+ "LC_TELEPHONE",
288+ "LC_MEASUREMENT",
289+ "LC_IDENTIFICATION"
290+#endif
291+ };
292+}
293+
294+namespace std
295+{
296+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
297+} // namespace std
298Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
299===================================================================
300--- /dev/null
301+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
302@@ -0,0 +1,117 @@
303+// Wrapper for underlying C-language localization -*- C++ -*-
304+
305+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
306+//
307+// This file is part of the GNU ISO C++ Library. This library is free
308+// software; you can redistribute it and/or modify it under the
309+// terms of the GNU General Public License as published by the
310+// Free Software Foundation; either version 2, or (at your option)
311+// any later version.
312+
313+// This library is distributed in the hope that it will be useful,
314+// but WITHOUT ANY WARRANTY; without even the implied warranty of
315+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
316+// GNU General Public License for more details.
317+
318+// You should have received a copy of the GNU General Public License along
319+// with this library; see the file COPYING. If not, write to the Free
320+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
321+// USA.
322+
323+// As a special exception, you may use this file as part of a free software
324+// library without restriction. Specifically, if other files instantiate
325+// templates or use macros or inline functions from this file, or you compile
326+// this file and link it with other files to produce an executable, this
327+// file does not by itself cause the resulting executable to be covered by
328+// the GNU General Public License. This exception does not however
329+// invalidate any other reasons why the executable file might be covered by
330+// the GNU General Public License.
331+
332+//
333+// ISO C++ 14882: 22.8 Standard locale categories.
334+//
335+
336+// Written by Benjamin Kosnik <bkoz@redhat.com>
337+
338+#ifndef _C_LOCALE_H
339+#define _C_LOCALE_H 1
340+
341+#pragma GCC system_header
342+
343+#include <cstring> // get std::strlen
344+#include <cstdio> // get std::snprintf or std::sprintf
345+#include <clocale>
346+#include <langinfo.h> // For codecvt
347+#ifdef __UCLIBC_MJN3_ONLY__
348+#warning fix this
349+#endif
350+#ifdef __UCLIBC_HAS_LOCALE__
351+#include <iconv.h> // For codecvt using iconv, iconv_t
352+#endif
353+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
354+#include <libintl.h> // For messages
355+#endif
356+
357+#ifdef __UCLIBC_MJN3_ONLY__
358+#warning what is _GLIBCXX_C_LOCALE_GNU for
359+#endif
360+#define _GLIBCXX_C_LOCALE_GNU 1
361+
362+#ifdef __UCLIBC_MJN3_ONLY__
363+#warning fix categories
364+#endif
365+// #define _GLIBCXX_NUM_CATEGORIES 6
366+#define _GLIBCXX_NUM_CATEGORIES 0
367+
368+#ifdef __UCLIBC_HAS_XLOCALE__
369+namespace __gnu_cxx
370+{
371+ extern "C" __typeof(uselocale) __uselocale;
372+}
373+#endif
374+
375+namespace std
376+{
377+#ifdef __UCLIBC_HAS_XLOCALE__
378+ typedef __locale_t __c_locale;
379+#else
380+ typedef int* __c_locale;
381+#endif
382+
383+ // Convert numeric value of type _Tv to string and return length of
384+ // string. If snprintf is available use it, otherwise fall back to
385+ // the unsafe sprintf which, in general, can be dangerous and should
386+ // be avoided.
387+ template<typename _Tv>
388+ int
389+ __convert_from_v(char* __out,
390+ const int __size __attribute__ ((__unused__)),
391+ const char* __fmt,
392+#ifdef __UCLIBC_HAS_XCLOCALE__
393+ _Tv __v, const __c_locale& __cloc, int __prec)
394+ {
395+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
396+#else
397+ _Tv __v, const __c_locale&, int __prec)
398+ {
399+# ifdef __UCLIBC_HAS_LOCALE__
400+ char* __old = std::setlocale(LC_ALL, NULL);
401+ char* __sav = new char[std::strlen(__old) + 1];
402+ std::strcpy(__sav, __old);
403+ std::setlocale(LC_ALL, "C");
404+# endif
405+#endif
406+
407+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
408+
409+#ifdef __UCLIBC_HAS_XCLOCALE__
410+ __gnu_cxx::__uselocale(__old);
411+#elif defined __UCLIBC_HAS_LOCALE__
412+ std::setlocale(LC_ALL, __sav);
413+ delete [] __sav;
414+#endif
415+ return __ret;
416+ }
417+}
418+
419+#endif
420Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
421===================================================================
422--- /dev/null
423+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
424@@ -0,0 +1,308 @@
425+// std::codecvt implementation details, GNU version -*- C++ -*-
426+
427+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
428+//
429+// This file is part of the GNU ISO C++ Library. This library is free
430+// software; you can redistribute it and/or modify it under the
431+// terms of the GNU General Public License as published by the
432+// Free Software Foundation; either version 2, or (at your option)
433+// any later version.
434+
435+// This library is distributed in the hope that it will be useful,
436+// but WITHOUT ANY WARRANTY; without even the implied warranty of
437+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
438+// GNU General Public License for more details.
439+
440+// You should have received a copy of the GNU General Public License along
441+// with this library; see the file COPYING. If not, write to the Free
442+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
443+// USA.
444+
445+// As a special exception, you may use this file as part of a free software
446+// library without restriction. Specifically, if other files instantiate
447+// templates or use macros or inline functions from this file, or you compile
448+// this file and link it with other files to produce an executable, this
449+// file does not by itself cause the resulting executable to be covered by
450+// the GNU General Public License. This exception does not however
451+// invalidate any other reasons why the executable file might be covered by
452+// the GNU General Public License.
453+
454+//
455+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
456+//
457+
458+// Written by Benjamin Kosnik <bkoz@redhat.com>
459+
460+#include <locale>
461+#include <cstdlib> // For MB_CUR_MAX
462+#include <climits> // For MB_LEN_MAX
463+#include <bits/c++locale_internal.h>
464+
465+namespace std
466+{
467+ // Specializations.
468+#ifdef _GLIBCXX_USE_WCHAR_T
469+ codecvt_base::result
470+ codecvt<wchar_t, char, mbstate_t>::
471+ do_out(state_type& __state, const intern_type* __from,
472+ const intern_type* __from_end, const intern_type*& __from_next,
473+ extern_type* __to, extern_type* __to_end,
474+ extern_type*& __to_next) const
475+ {
476+ result __ret = ok;
477+ state_type __tmp_state(__state);
478+
479+#ifdef __UCLIBC_HAS_XLOCALE__
480+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
481+#endif
482+
483+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
484+ // in case we fall back to wcrtomb and then continue, in a loop.
485+ // NB: wcsnrtombs is a GNU extension
486+ for (__from_next = __from, __to_next = __to;
487+ __from_next < __from_end && __to_next < __to_end
488+ && __ret == ok;)
489+ {
490+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
491+ __from_end - __from_next);
492+ if (!__from_chunk_end)
493+ __from_chunk_end = __from_end;
494+
495+ __from = __from_next;
496+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
497+ __from_chunk_end - __from_next,
498+ __to_end - __to_next, &__state);
499+ if (__conv == static_cast<size_t>(-1))
500+ {
501+ // In case of error, in order to stop at the exact place we
502+ // have to start again from the beginning with a series of
503+ // wcrtomb.
504+ for (; __from < __from_next; ++__from)
505+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
506+ __state = __tmp_state;
507+ __ret = error;
508+ }
509+ else if (__from_next && __from_next < __from_chunk_end)
510+ {
511+ __to_next += __conv;
512+ __ret = partial;
513+ }
514+ else
515+ {
516+ __from_next = __from_chunk_end;
517+ __to_next += __conv;
518+ }
519+
520+ if (__from_next < __from_end && __ret == ok)
521+ {
522+ extern_type __buf[MB_LEN_MAX];
523+ __tmp_state = __state;
524+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
525+ if (__conv > static_cast<size_t>(__to_end - __to_next))
526+ __ret = partial;
527+ else
528+ {
529+ memcpy(__to_next, __buf, __conv);
530+ __state = __tmp_state;
531+ __to_next += __conv;
532+ ++__from_next;
533+ }
534+ }
535+ }
536+
537+#ifdef __UCLIBC_HAS_XLOCALE__
538+ __uselocale(__old);
539+#endif
540+
541+ return __ret;
542+ }
543+
544+ codecvt_base::result
545+ codecvt<wchar_t, char, mbstate_t>::
546+ do_in(state_type& __state, const extern_type* __from,
547+ const extern_type* __from_end, const extern_type*& __from_next,
548+ intern_type* __to, intern_type* __to_end,
549+ intern_type*& __to_next) const
550+ {
551+ result __ret = ok;
552+ state_type __tmp_state(__state);
553+
554+#ifdef __UCLIBC_HAS_XLOCALE__
555+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
556+#endif
557+
558+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
559+ // in case we store a L'\0' and then continue, in a loop.
560+ // NB: mbsnrtowcs is a GNU extension
561+ for (__from_next = __from, __to_next = __to;
562+ __from_next < __from_end && __to_next < __to_end
563+ && __ret == ok;)
564+ {
565+ const extern_type* __from_chunk_end;
566+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
567+ __from_end
568+ - __from_next));
569+ if (!__from_chunk_end)
570+ __from_chunk_end = __from_end;
571+
572+ __from = __from_next;
573+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
574+ __from_chunk_end - __from_next,
575+ __to_end - __to_next, &__state);
576+ if (__conv == static_cast<size_t>(-1))
577+ {
578+ // In case of error, in order to stop at the exact place we
579+ // have to start again from the beginning with a series of
580+ // mbrtowc.
581+ for (;; ++__to_next, __from += __conv)
582+ {
583+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
584+ &__tmp_state);
585+ if (__conv == static_cast<size_t>(-1)
586+ || __conv == static_cast<size_t>(-2))
587+ break;
588+ }
589+ __from_next = __from;
590+ __state = __tmp_state;
591+ __ret = error;
592+ }
593+ else if (__from_next && __from_next < __from_chunk_end)
594+ {
595+ // It is unclear what to return in this case (see DR 382).
596+ __to_next += __conv;
597+ __ret = partial;
598+ }
599+ else
600+ {
601+ __from_next = __from_chunk_end;
602+ __to_next += __conv;
603+ }
604+
605+ if (__from_next < __from_end && __ret == ok)
606+ {
607+ if (__to_next < __to_end)
608+ {
609+ // XXX Probably wrong for stateful encodings
610+ __tmp_state = __state;
611+ ++__from_next;
612+ *__to_next++ = L'\0';
613+ }
614+ else
615+ __ret = partial;
616+ }
617+ }
618+
619+#ifdef __UCLIBC_HAS_XLOCALE__
620+ __uselocale(__old);
621+#endif
622+
623+ return __ret;
624+ }
625+
626+ int
627+ codecvt<wchar_t, char, mbstate_t>::
628+ do_encoding() const throw()
629+ {
630+ // XXX This implementation assumes that the encoding is
631+ // stateless and is either single-byte or variable-width.
632+ int __ret = 0;
633+#ifdef __UCLIBC_HAS_XLOCALE__
634+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
635+#endif
636+ if (MB_CUR_MAX == 1)
637+ __ret = 1;
638+#ifdef __UCLIBC_HAS_XLOCALE__
639+ __uselocale(__old);
640+#endif
641+ return __ret;
642+ }
643+
644+ int
645+ codecvt<wchar_t, char, mbstate_t>::
646+ do_max_length() const throw()
647+ {
648+#ifdef __UCLIBC_HAS_XLOCALE__
649+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
650+#endif
651+ // XXX Probably wrong for stateful encodings.
652+ int __ret = MB_CUR_MAX;
653+#ifdef __UCLIBC_HAS_XLOCALE__
654+ __uselocale(__old);
655+#endif
656+ return __ret;
657+ }
658+
659+ int
660+ codecvt<wchar_t, char, mbstate_t>::
661+ do_length(state_type& __state, const extern_type* __from,
662+ const extern_type* __end, size_t __max) const
663+ {
664+ int __ret = 0;
665+ state_type __tmp_state(__state);
666+
667+#ifdef __UCLIBC_HAS_XLOCALE__
668+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
669+#endif
670+
671+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
672+ // in case we advance past it and then continue, in a loop.
673+ // NB: mbsnrtowcs is a GNU extension
674+
675+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
676+ // its fourth parameter (it wouldn't with NULL as first parameter).
677+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
678+ * __max));
679+ while (__from < __end && __max)
680+ {
681+ const extern_type* __from_chunk_end;
682+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
683+ __end
684+ - __from));
685+ if (!__from_chunk_end)
686+ __from_chunk_end = __end;
687+
688+ const extern_type* __tmp_from = __from;
689+ size_t __conv = mbsnrtowcs(__to, &__from,
690+ __from_chunk_end - __from,
691+ __max, &__state);
692+ if (__conv == static_cast<size_t>(-1))
693+ {
694+ // In case of error, in order to stop at the exact place we
695+ // have to start again from the beginning with a series of
696+ // mbrtowc.
697+ for (__from = __tmp_from;; __from += __conv)
698+ {
699+ __conv = mbrtowc(NULL, __from, __end - __from,
700+ &__tmp_state);
701+ if (__conv == static_cast<size_t>(-1)
702+ || __conv == static_cast<size_t>(-2))
703+ break;
704+ }
705+ __state = __tmp_state;
706+ __ret += __from - __tmp_from;
707+ break;
708+ }
709+ if (!__from)
710+ __from = __from_chunk_end;
711+
712+ __ret += __from - __tmp_from;
713+ __max -= __conv;
714+
715+ if (__from < __end && __max)
716+ {
717+ // XXX Probably wrong for stateful encodings
718+ __tmp_state = __state;
719+ ++__from;
720+ ++__ret;
721+ --__max;
722+ }
723+ }
724+
725+#ifdef __UCLIBC_HAS_XLOCALE__
726+ __uselocale(__old);
727+#endif
728+
729+ return __ret;
730+ }
731+#endif
732+}
733Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
734===================================================================
735--- /dev/null
736+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
737@@ -0,0 +1,80 @@
738+// std::collate implementation details, GNU version -*- C++ -*-
739+
740+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
741+//
742+// This file is part of the GNU ISO C++ Library. This library is free
743+// software; you can redistribute it and/or modify it under the
744+// terms of the GNU General Public License as published by the
745+// Free Software Foundation; either version 2, or (at your option)
746+// any later version.
747+
748+// This library is distributed in the hope that it will be useful,
749+// but WITHOUT ANY WARRANTY; without even the implied warranty of
750+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
751+// GNU General Public License for more details.
752+
753+// You should have received a copy of the GNU General Public License along
754+// with this library; see the file COPYING. If not, write to the Free
755+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
756+// USA.
757+
758+// As a special exception, you may use this file as part of a free software
759+// library without restriction. Specifically, if other files instantiate
760+// templates or use macros or inline functions from this file, or you compile
761+// this file and link it with other files to produce an executable, this
762+// file does not by itself cause the resulting executable to be covered by
763+// the GNU General Public License. This exception does not however
764+// invalidate any other reasons why the executable file might be covered by
765+// the GNU General Public License.
766+
767+//
768+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
769+//
770+
771+// Written by Benjamin Kosnik <bkoz@redhat.com>
772+
773+#include <locale>
774+#include <bits/c++locale_internal.h>
775+
776+#ifndef __UCLIBC_HAS_XLOCALE__
777+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
778+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
779+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
780+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
781+#endif
782+
783+namespace std
784+{
785+ // These are basically extensions to char_traits, and perhaps should
786+ // be put there instead of here.
787+ template<>
788+ int
789+ collate<char>::_M_compare(const char* __one, const char* __two) const
790+ {
791+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
792+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
793+ }
794+
795+ template<>
796+ size_t
797+ collate<char>::_M_transform(char* __to, const char* __from,
798+ size_t __n) const
799+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
800+
801+#ifdef _GLIBCXX_USE_WCHAR_T
802+ template<>
803+ int
804+ collate<wchar_t>::_M_compare(const wchar_t* __one,
805+ const wchar_t* __two) const
806+ {
807+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
808+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
809+ }
810+
811+ template<>
812+ size_t
813+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
814+ size_t __n) const
815+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
816+#endif
817+}
818Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
819===================================================================
820--- /dev/null
821+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
822@@ -0,0 +1,300 @@
823+// std::ctype implementation details, GNU version -*- C++ -*-
824+
825+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
826+//
827+// This file is part of the GNU ISO C++ Library. This library is free
828+// software; you can redistribute it and/or modify it under the
829+// terms of the GNU General Public License as published by the
830+// Free Software Foundation; either version 2, or (at your option)
831+// any later version.
832+
833+// This library is distributed in the hope that it will be useful,
834+// but WITHOUT ANY WARRANTY; without even the implied warranty of
835+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
836+// GNU General Public License for more details.
837+
838+// You should have received a copy of the GNU General Public License along
839+// with this library; see the file COPYING. If not, write to the Free
840+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
841+// USA.
842+
843+// As a special exception, you may use this file as part of a free software
844+// library without restriction. Specifically, if other files instantiate
845+// templates or use macros or inline functions from this file, or you compile
846+// this file and link it with other files to produce an executable, this
847+// file does not by itself cause the resulting executable to be covered by
848+// the GNU General Public License. This exception does not however
849+// invalidate any other reasons why the executable file might be covered by
850+// the GNU General Public License.
851+
852+//
853+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
854+//
855+
856+// Written by Benjamin Kosnik <bkoz@redhat.com>
857+
858+#define _LIBC
859+#include <locale>
860+#undef _LIBC
861+#include <bits/c++locale_internal.h>
862+
863+#ifndef __UCLIBC_HAS_XLOCALE__
864+#define __wctype_l(S, L) wctype((S))
865+#define __towupper_l(C, L) towupper((C))
866+#define __towlower_l(C, L) towlower((C))
867+#define __iswctype_l(C, M, L) iswctype((C), (M))
868+#endif
869+
870+namespace std
871+{
872+ // NB: The other ctype<char> specializations are in src/locale.cc and
873+ // various /config/os/* files.
874+ template<>
875+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
876+ : ctype<char>(0, false, __refs)
877+ {
878+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
879+ {
880+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
881+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
882+#ifdef __UCLIBC_HAS_XLOCALE__
883+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
884+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
885+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
886+#endif
887+ }
888+ }
889+
890+#ifdef _GLIBCXX_USE_WCHAR_T
891+ ctype<wchar_t>::__wmask_type
892+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
893+ {
894+ __wmask_type __ret;
895+ switch (__m)
896+ {
897+ case space:
898+ __ret = __wctype_l("space", _M_c_locale_ctype);
899+ break;
900+ case print:
901+ __ret = __wctype_l("print", _M_c_locale_ctype);
902+ break;
903+ case cntrl:
904+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
905+ break;
906+ case upper:
907+ __ret = __wctype_l("upper", _M_c_locale_ctype);
908+ break;
909+ case lower:
910+ __ret = __wctype_l("lower", _M_c_locale_ctype);
911+ break;
912+ case alpha:
913+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
914+ break;
915+ case digit:
916+ __ret = __wctype_l("digit", _M_c_locale_ctype);
917+ break;
918+ case punct:
919+ __ret = __wctype_l("punct", _M_c_locale_ctype);
920+ break;
921+ case xdigit:
922+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
923+ break;
924+ case alnum:
925+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
926+ break;
927+ case graph:
928+ __ret = __wctype_l("graph", _M_c_locale_ctype);
929+ break;
930+ default:
931+ __ret = __wmask_type();
932+ }
933+ return __ret;
934+ }
935+
936+ wchar_t
937+ ctype<wchar_t>::do_toupper(wchar_t __c) const
938+ { return __towupper_l(__c, _M_c_locale_ctype); }
939+
940+ const wchar_t*
941+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
942+ {
943+ while (__lo < __hi)
944+ {
945+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
946+ ++__lo;
947+ }
948+ return __hi;
949+ }
950+
951+ wchar_t
952+ ctype<wchar_t>::do_tolower(wchar_t __c) const
953+ { return __towlower_l(__c, _M_c_locale_ctype); }
954+
955+ const wchar_t*
956+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
957+ {
958+ while (__lo < __hi)
959+ {
960+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
961+ ++__lo;
962+ }
963+ return __hi;
964+ }
965+
966+ bool
967+ ctype<wchar_t>::
968+ do_is(mask __m, wchar_t __c) const
969+ {
970+ // Highest bitmask in ctype_base == 10, but extra in "C"
971+ // library for blank.
972+ bool __ret = false;
973+ const size_t __bitmasksize = 11;
974+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
975+ if (__m & _M_bit[__bitcur]
976+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
977+ {
978+ __ret = true;
979+ break;
980+ }
981+ return __ret;
982+ }
983+
984+ const wchar_t*
985+ ctype<wchar_t>::
986+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
987+ {
988+ for (; __lo < __hi; ++__vec, ++__lo)
989+ {
990+ // Highest bitmask in ctype_base == 10, but extra in "C"
991+ // library for blank.
992+ const size_t __bitmasksize = 11;
993+ mask __m = 0;
994+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
995+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
996+ __m |= _M_bit[__bitcur];
997+ *__vec = __m;
998+ }
999+ return __hi;
1000+ }
1001+
1002+ const wchar_t*
1003+ ctype<wchar_t>::
1004+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1005+ {
1006+ while (__lo < __hi && !this->do_is(__m, *__lo))
1007+ ++__lo;
1008+ return __lo;
1009+ }
1010+
1011+ const wchar_t*
1012+ ctype<wchar_t>::
1013+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1014+ {
1015+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1016+ ++__lo;
1017+ return __lo;
1018+ }
1019+
1020+ wchar_t
1021+ ctype<wchar_t>::
1022+ do_widen(char __c) const
1023+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1024+
1025+ const char*
1026+ ctype<wchar_t>::
1027+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1028+ {
1029+ while (__lo < __hi)
1030+ {
1031+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1032+ ++__lo;
1033+ ++__dest;
1034+ }
1035+ return __hi;
1036+ }
1037+
1038+ char
1039+ ctype<wchar_t>::
1040+ do_narrow(wchar_t __wc, char __dfault) const
1041+ {
1042+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1043+ return _M_narrow[__wc];
1044+#ifdef __UCLIBC_HAS_XLOCALE__
1045+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1046+#endif
1047+ const int __c = wctob(__wc);
1048+#ifdef __UCLIBC_HAS_XLOCALE__
1049+ __uselocale(__old);
1050+#endif
1051+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1052+ }
1053+
1054+ const wchar_t*
1055+ ctype<wchar_t>::
1056+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1057+ char* __dest) const
1058+ {
1059+#ifdef __UCLIBC_HAS_XLOCALE__
1060+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1061+#endif
1062+ if (_M_narrow_ok)
1063+ while (__lo < __hi)
1064+ {
1065+ if (*__lo >= 0 && *__lo < 128)
1066+ *__dest = _M_narrow[*__lo];
1067+ else
1068+ {
1069+ const int __c = wctob(*__lo);
1070+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1071+ }
1072+ ++__lo;
1073+ ++__dest;
1074+ }
1075+ else
1076+ while (__lo < __hi)
1077+ {
1078+ const int __c = wctob(*__lo);
1079+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1080+ ++__lo;
1081+ ++__dest;
1082+ }
1083+#ifdef __UCLIBC_HAS_XLOCALE__
1084+ __uselocale(__old);
1085+#endif
1086+ return __hi;
1087+ }
1088+
1089+ void
1090+ ctype<wchar_t>::_M_initialize_ctype()
1091+ {
1092+#ifdef __UCLIBC_HAS_XLOCALE__
1093+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1094+#endif
1095+ wint_t __i;
1096+ for (__i = 0; __i < 128; ++__i)
1097+ {
1098+ const int __c = wctob(__i);
1099+ if (__c == EOF)
1100+ break;
1101+ else
1102+ _M_narrow[__i] = static_cast<char>(__c);
1103+ }
1104+ if (__i == 128)
1105+ _M_narrow_ok = true;
1106+ else
1107+ _M_narrow_ok = false;
1108+ for (size_t __j = 0;
1109+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1110+ _M_widen[__j] = btowc(__j);
1111+
1112+ for (size_t __k = 0; __k <= 11; ++__k)
1113+ {
1114+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1115+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1116+ }
1117+#ifdef __UCLIBC_HAS_XLOCALE__
1118+ __uselocale(__old);
1119+#endif
1120+ }
1121+#endif // _GLIBCXX_USE_WCHAR_T
1122+}
1123Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
1124===================================================================
1125--- /dev/null
1126+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
1127@@ -0,0 +1,100 @@
1128+// std::messages implementation details, GNU version -*- C++ -*-
1129+
1130+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1131+//
1132+// This file is part of the GNU ISO C++ Library. This library is free
1133+// software; you can redistribute it and/or modify it under the
1134+// terms of the GNU General Public License as published by the
1135+// Free Software Foundation; either version 2, or (at your option)
1136+// any later version.
1137+
1138+// This library is distributed in the hope that it will be useful,
1139+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1140+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1141+// GNU General Public License for more details.
1142+
1143+// You should have received a copy of the GNU General Public License along
1144+// with this library; see the file COPYING. If not, write to the Free
1145+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1146+// USA.
1147+
1148+// As a special exception, you may use this file as part of a free software
1149+// library without restriction. Specifically, if other files instantiate
1150+// templates or use macros or inline functions from this file, or you compile
1151+// this file and link it with other files to produce an executable, this
1152+// file does not by itself cause the resulting executable to be covered by
1153+// the GNU General Public License. This exception does not however
1154+// invalidate any other reasons why the executable file might be covered by
1155+// the GNU General Public License.
1156+
1157+//
1158+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1159+//
1160+
1161+// Written by Benjamin Kosnik <bkoz@redhat.com>
1162+
1163+#include <locale>
1164+#include <bits/c++locale_internal.h>
1165+
1166+#ifdef __UCLIBC_MJN3_ONLY__
1167+#warning fix gettext stuff
1168+#endif
1169+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1170+extern "C" char *__dcgettext(const char *domainname,
1171+ const char *msgid, int category);
1172+#undef gettext
1173+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1174+#else
1175+#undef gettext
1176+#define gettext(msgid) (msgid)
1177+#endif
1178+
1179+namespace std
1180+{
1181+ // Specializations.
1182+ template<>
1183+ string
1184+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1185+ {
1186+#ifdef __UCLIBC_HAS_XLOCALE__
1187+ __c_locale __old = __uselocale(_M_c_locale_messages);
1188+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1189+ __uselocale(__old);
1190+ return string(__msg);
1191+#elif defined __UCLIBC_HAS_LOCALE__
1192+ char* __old = strdup(setlocale(LC_ALL, NULL));
1193+ setlocale(LC_ALL, _M_name_messages);
1194+ const char* __msg = gettext(__dfault.c_str());
1195+ setlocale(LC_ALL, __old);
1196+ free(__old);
1197+ return string(__msg);
1198+#else
1199+ const char* __msg = gettext(__dfault.c_str());
1200+ return string(__msg);
1201+#endif
1202+ }
1203+
1204+#ifdef _GLIBCXX_USE_WCHAR_T
1205+ template<>
1206+ wstring
1207+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1208+ {
1209+# ifdef __UCLIBC_HAS_XLOCALE__
1210+ __c_locale __old = __uselocale(_M_c_locale_messages);
1211+ char* __msg = gettext(_M_convert_to_char(__dfault));
1212+ __uselocale(__old);
1213+ return _M_convert_from_char(__msg);
1214+# elif defined __UCLIBC_HAS_LOCALE__
1215+ char* __old = strdup(setlocale(LC_ALL, NULL));
1216+ setlocale(LC_ALL, _M_name_messages);
1217+ char* __msg = gettext(_M_convert_to_char(__dfault));
1218+ setlocale(LC_ALL, __old);
1219+ free(__old);
1220+ return _M_convert_from_char(__msg);
1221+# else
1222+ char* __msg = gettext(_M_convert_to_char(__dfault));
1223+ return _M_convert_from_char(__msg);
1224+# endif
1225+ }
1226+#endif
1227+}
1228Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
1229===================================================================
1230--- /dev/null
1231+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
1232@@ -0,0 +1,118 @@
1233+// std::messages implementation details, GNU version -*- C++ -*-
1234+
1235+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1236+//
1237+// This file is part of the GNU ISO C++ Library. This library is free
1238+// software; you can redistribute it and/or modify it under the
1239+// terms of the GNU General Public License as published by the
1240+// Free Software Foundation; either version 2, or (at your option)
1241+// any later version.
1242+
1243+// This library is distributed in the hope that it will be useful,
1244+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1245+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1246+// GNU General Public License for more details.
1247+
1248+// You should have received a copy of the GNU General Public License along
1249+// with this library; see the file COPYING. If not, write to the Free
1250+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1251+// USA.
1252+
1253+// As a special exception, you may use this file as part of a free software
1254+// library without restriction. Specifically, if other files instantiate
1255+// templates or use macros or inline functions from this file, or you compile
1256+// this file and link it with other files to produce an executable, this
1257+// file does not by itself cause the resulting executable to be covered by
1258+// the GNU General Public License. This exception does not however
1259+// invalidate any other reasons why the executable file might be covered by
1260+// the GNU General Public License.
1261+
1262+//
1263+// ISO C++ 14882: 22.2.7.1.2 messages functions
1264+//
1265+
1266+// Written by Benjamin Kosnik <bkoz@redhat.com>
1267+
1268+#ifdef __UCLIBC_MJN3_ONLY__
1269+#warning fix prototypes for *textdomain funcs
1270+#endif
1271+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1272+extern "C" char *__textdomain(const char *domainname);
1273+extern "C" char *__bindtextdomain(const char *domainname,
1274+ const char *dirname);
1275+#else
1276+#undef __textdomain
1277+#undef __bindtextdomain
1278+#define __textdomain(D) ((void)0)
1279+#define __bindtextdomain(D,P) ((void)0)
1280+#endif
1281+
1282+ // Non-virtual member functions.
1283+ template<typename _CharT>
1284+ messages<_CharT>::messages(size_t __refs)
1285+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1286+ _M_name_messages(_S_get_c_name())
1287+ { }
1288+
1289+ template<typename _CharT>
1290+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1291+ size_t __refs)
1292+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1293+ _M_name_messages(__s)
1294+ {
1295+ char* __tmp = new char[std::strlen(__s) + 1];
1296+ std::strcpy(__tmp, __s);
1297+ _M_name_messages = __tmp;
1298+ }
1299+
1300+ template<typename _CharT>
1301+ typename messages<_CharT>::catalog
1302+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1303+ const char* __dir) const
1304+ {
1305+ __bindtextdomain(__s.c_str(), __dir);
1306+ return this->do_open(__s, __loc);
1307+ }
1308+
1309+ // Virtual member functions.
1310+ template<typename _CharT>
1311+ messages<_CharT>::~messages()
1312+ {
1313+ if (_M_name_messages != _S_get_c_name())
1314+ delete [] _M_name_messages;
1315+ _S_destroy_c_locale(_M_c_locale_messages);
1316+ }
1317+
1318+ template<typename _CharT>
1319+ typename messages<_CharT>::catalog
1320+ messages<_CharT>::do_open(const basic_string<char>& __s,
1321+ const locale&) const
1322+ {
1323+ // No error checking is done, assume the catalog exists and can
1324+ // be used.
1325+ __textdomain(__s.c_str());
1326+ return 0;
1327+ }
1328+
1329+ template<typename _CharT>
1330+ void
1331+ messages<_CharT>::do_close(catalog) const
1332+ { }
1333+
1334+ // messages_byname
1335+ template<typename _CharT>
1336+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1337+ : messages<_CharT>(__refs)
1338+ {
1339+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1340+ delete [] this->_M_name_messages;
1341+ char* __tmp = new char[std::strlen(__s) + 1];
1342+ std::strcpy(__tmp, __s);
1343+ this->_M_name_messages = __tmp;
1344+
1345+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1346+ {
1347+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1348+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1349+ }
1350+ }
1351Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1352===================================================================
1353--- /dev/null
1354+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1355@@ -0,0 +1,692 @@
1356+// std::moneypunct implementation details, GNU version -*- C++ -*-
1357+
1358+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1359+//
1360+// This file is part of the GNU ISO C++ Library. This library is free
1361+// software; you can redistribute it and/or modify it under the
1362+// terms of the GNU General Public License as published by the
1363+// Free Software Foundation; either version 2, or (at your option)
1364+// any later version.
1365+
1366+// This library is distributed in the hope that it will be useful,
1367+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1368+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1369+// GNU General Public License for more details.
1370+
1371+// You should have received a copy of the GNU General Public License along
1372+// with this library; see the file COPYING. If not, write to the Free
1373+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1374+// USA.
1375+
1376+// As a special exception, you may use this file as part of a free software
1377+// library without restriction. Specifically, if other files instantiate
1378+// templates or use macros or inline functions from this file, or you compile
1379+// this file and link it with other files to produce an executable, this
1380+// file does not by itself cause the resulting executable to be covered by
1381+// the GNU General Public License. This exception does not however
1382+// invalidate any other reasons why the executable file might be covered by
1383+// the GNU General Public License.
1384+
1385+//
1386+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1387+//
1388+
1389+// Written by Benjamin Kosnik <bkoz@redhat.com>
1390+
1391+#define _LIBC
1392+#include <locale>
1393+#undef _LIBC
1394+#include <bits/c++locale_internal.h>
1395+
1396+#ifdef __UCLIBC_MJN3_ONLY__
1397+#warning optimize this for uclibc
1398+#warning tailor for stub locale support
1399+#endif
1400+
1401+#ifndef __UCLIBC_HAS_XLOCALE__
1402+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1403+#endif
1404+
1405+namespace std
1406+{
1407+ // Construct and return valid pattern consisting of some combination of:
1408+ // space none symbol sign value
1409+ money_base::pattern
1410+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1411+ {
1412+ pattern __ret;
1413+
1414+ // This insanely complicated routine attempts to construct a valid
1415+ // pattern for use with monyepunct. A couple of invariants:
1416+
1417+ // if (__precedes) symbol -> value
1418+ // else value -> symbol
1419+
1420+ // if (__space) space
1421+ // else none
1422+
1423+ // none == never first
1424+ // space never first or last
1425+
1426+ // Any elegant implementations of this are welcome.
1427+ switch (__posn)
1428+ {
1429+ case 0:
1430+ case 1:
1431+ // 1 The sign precedes the value and symbol.
1432+ __ret.field[0] = sign;
1433+ if (__space)
1434+ {
1435+ // Pattern starts with sign.
1436+ if (__precedes)
1437+ {
1438+ __ret.field[1] = symbol;
1439+ __ret.field[3] = value;
1440+ }
1441+ else
1442+ {
1443+ __ret.field[1] = value;
1444+ __ret.field[3] = symbol;
1445+ }
1446+ __ret.field[2] = space;
1447+ }
1448+ else
1449+ {
1450+ // Pattern starts with sign and ends with none.
1451+ if (__precedes)
1452+ {
1453+ __ret.field[1] = symbol;
1454+ __ret.field[2] = value;
1455+ }
1456+ else
1457+ {
1458+ __ret.field[1] = value;
1459+ __ret.field[2] = symbol;
1460+ }
1461+ __ret.field[3] = none;
1462+ }
1463+ break;
1464+ case 2:
1465+ // 2 The sign follows the value and symbol.
1466+ if (__space)
1467+ {
1468+ // Pattern either ends with sign.
1469+ if (__precedes)
1470+ {
1471+ __ret.field[0] = symbol;
1472+ __ret.field[2] = value;
1473+ }
1474+ else
1475+ {
1476+ __ret.field[0] = value;
1477+ __ret.field[2] = symbol;
1478+ }
1479+ __ret.field[1] = space;
1480+ __ret.field[3] = sign;
1481+ }
1482+ else
1483+ {
1484+ // Pattern ends with sign then none.
1485+ if (__precedes)
1486+ {
1487+ __ret.field[0] = symbol;
1488+ __ret.field[1] = value;
1489+ }
1490+ else
1491+ {
1492+ __ret.field[0] = value;
1493+ __ret.field[1] = symbol;
1494+ }
1495+ __ret.field[2] = sign;
1496+ __ret.field[3] = none;
1497+ }
1498+ break;
1499+ case 3:
1500+ // 3 The sign immediately precedes the symbol.
1501+ if (__precedes)
1502+ {
1503+ __ret.field[0] = sign;
1504+ __ret.field[1] = symbol;
1505+ if (__space)
1506+ {
1507+ __ret.field[2] = space;
1508+ __ret.field[3] = value;
1509+ }
1510+ else
1511+ {
1512+ __ret.field[2] = value;
1513+ __ret.field[3] = none;
1514+ }
1515+ }
1516+ else
1517+ {
1518+ __ret.field[0] = value;
1519+ if (__space)
1520+ {
1521+ __ret.field[1] = space;
1522+ __ret.field[2] = sign;
1523+ __ret.field[3] = symbol;
1524+ }
1525+ else
1526+ {
1527+ __ret.field[1] = sign;
1528+ __ret.field[2] = symbol;
1529+ __ret.field[3] = none;
1530+ }
1531+ }
1532+ break;
1533+ case 4:
1534+ // 4 The sign immediately follows the symbol.
1535+ if (__precedes)
1536+ {
1537+ __ret.field[0] = symbol;
1538+ __ret.field[1] = sign;
1539+ if (__space)
1540+ {
1541+ __ret.field[2] = space;
1542+ __ret.field[3] = value;
1543+ }
1544+ else
1545+ {
1546+ __ret.field[2] = value;
1547+ __ret.field[3] = none;
1548+ }
1549+ }
1550+ else
1551+ {
1552+ __ret.field[0] = value;
1553+ if (__space)
1554+ {
1555+ __ret.field[1] = space;
1556+ __ret.field[2] = symbol;
1557+ __ret.field[3] = sign;
1558+ }
1559+ else
1560+ {
1561+ __ret.field[1] = symbol;
1562+ __ret.field[2] = sign;
1563+ __ret.field[3] = none;
1564+ }
1565+ }
1566+ break;
1567+ default:
1568+ ;
1569+ }
1570+ return __ret;
1571+ }
1572+
1573+ template<>
1574+ void
1575+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1576+ const char*)
1577+ {
1578+ if (!_M_data)
1579+ _M_data = new __moneypunct_cache<char, true>;
1580+
1581+ if (!__cloc)
1582+ {
1583+ // "C" locale
1584+ _M_data->_M_decimal_point = '.';
1585+ _M_data->_M_thousands_sep = ',';
1586+ _M_data->_M_grouping = "";
1587+ _M_data->_M_grouping_size = 0;
1588+ _M_data->_M_curr_symbol = "";
1589+ _M_data->_M_curr_symbol_size = 0;
1590+ _M_data->_M_positive_sign = "";
1591+ _M_data->_M_positive_sign_size = 0;
1592+ _M_data->_M_negative_sign = "";
1593+ _M_data->_M_negative_sign_size = 0;
1594+ _M_data->_M_frac_digits = 0;
1595+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1596+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1597+
1598+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1599+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1600+ }
1601+ else
1602+ {
1603+ // Named locale.
1604+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1605+ __cloc));
1606+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1607+ __cloc));
1608+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1609+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1610+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1611+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1612+
1613+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1614+ if (!__nposn)
1615+ _M_data->_M_negative_sign = "()";
1616+ else
1617+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1618+ __cloc);
1619+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1620+
1621+ // _Intl == true
1622+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1623+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1624+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1625+ __cloc));
1626+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1627+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1628+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1629+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1630+ __pposn);
1631+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1632+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1633+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1634+ __nposn);
1635+ }
1636+ }
1637+
1638+ template<>
1639+ void
1640+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1641+ const char*)
1642+ {
1643+ if (!_M_data)
1644+ _M_data = new __moneypunct_cache<char, false>;
1645+
1646+ if (!__cloc)
1647+ {
1648+ // "C" locale
1649+ _M_data->_M_decimal_point = '.';
1650+ _M_data->_M_thousands_sep = ',';
1651+ _M_data->_M_grouping = "";
1652+ _M_data->_M_grouping_size = 0;
1653+ _M_data->_M_curr_symbol = "";
1654+ _M_data->_M_curr_symbol_size = 0;
1655+ _M_data->_M_positive_sign = "";
1656+ _M_data->_M_positive_sign_size = 0;
1657+ _M_data->_M_negative_sign = "";
1658+ _M_data->_M_negative_sign_size = 0;
1659+ _M_data->_M_frac_digits = 0;
1660+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1661+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1662+
1663+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1664+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1665+ }
1666+ else
1667+ {
1668+ // Named locale.
1669+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1670+ __cloc));
1671+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1672+ __cloc));
1673+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1674+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1675+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1676+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1677+
1678+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1679+ if (!__nposn)
1680+ _M_data->_M_negative_sign = "()";
1681+ else
1682+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1683+ __cloc);
1684+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1685+
1686+ // _Intl == false
1687+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1688+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1689+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1690+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1691+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1692+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1693+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1694+ __pposn);
1695+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1696+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1697+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1698+ __nposn);
1699+ }
1700+ }
1701+
1702+ template<>
1703+ moneypunct<char, true>::~moneypunct()
1704+ { delete _M_data; }
1705+
1706+ template<>
1707+ moneypunct<char, false>::~moneypunct()
1708+ { delete _M_data; }
1709+
1710+#ifdef _GLIBCXX_USE_WCHAR_T
1711+ template<>
1712+ void
1713+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1714+#ifdef __UCLIBC_HAS_XLOCALE__
1715+ const char*)
1716+#else
1717+ const char* __name)
1718+#endif
1719+ {
1720+ if (!_M_data)
1721+ _M_data = new __moneypunct_cache<wchar_t, true>;
1722+
1723+ if (!__cloc)
1724+ {
1725+ // "C" locale
1726+ _M_data->_M_decimal_point = L'.';
1727+ _M_data->_M_thousands_sep = L',';
1728+ _M_data->_M_grouping = "";
1729+ _M_data->_M_grouping_size = 0;
1730+ _M_data->_M_curr_symbol = L"";
1731+ _M_data->_M_curr_symbol_size = 0;
1732+ _M_data->_M_positive_sign = L"";
1733+ _M_data->_M_positive_sign_size = 0;
1734+ _M_data->_M_negative_sign = L"";
1735+ _M_data->_M_negative_sign_size = 0;
1736+ _M_data->_M_frac_digits = 0;
1737+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1738+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1739+
1740+ // Use ctype::widen code without the facet...
1741+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1742+ _M_data->_M_atoms[__i] =
1743+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1744+ }
1745+ else
1746+ {
1747+ // Named locale.
1748+#ifdef __UCLIBC_HAS_XLOCALE__
1749+ __c_locale __old = __uselocale(__cloc);
1750+#else
1751+ // Switch to named locale so that mbsrtowcs will work.
1752+ char* __old = strdup(setlocale(LC_ALL, NULL));
1753+ setlocale(LC_ALL, __name);
1754+#endif
1755+
1756+#ifdef __UCLIBC_MJN3_ONLY__
1757+#warning fix this... should be monetary
1758+#endif
1759+#ifdef __UCLIBC__
1760+# ifdef __UCLIBC_HAS_XLOCALE__
1761+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1762+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1763+# else
1764+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1765+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1766+# endif
1767+#else
1768+ union { char *__s; wchar_t __w; } __u;
1769+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1770+ _M_data->_M_decimal_point = __u.__w;
1771+
1772+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1773+ _M_data->_M_thousands_sep = __u.__w;
1774+#endif
1775+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1776+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1777+
1778+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1779+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1780+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1781+
1782+ wchar_t* __wcs_ps = 0;
1783+ wchar_t* __wcs_ns = 0;
1784+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1785+ try
1786+ {
1787+ mbstate_t __state;
1788+ size_t __len = strlen(__cpossign);
1789+ if (__len)
1790+ {
1791+ ++__len;
1792+ memset(&__state, 0, sizeof(mbstate_t));
1793+ __wcs_ps = new wchar_t[__len];
1794+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1795+ _M_data->_M_positive_sign = __wcs_ps;
1796+ }
1797+ else
1798+ _M_data->_M_positive_sign = L"";
1799+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1800+
1801+ __len = strlen(__cnegsign);
1802+ if (!__nposn)
1803+ _M_data->_M_negative_sign = L"()";
1804+ else if (__len)
1805+ {
1806+ ++__len;
1807+ memset(&__state, 0, sizeof(mbstate_t));
1808+ __wcs_ns = new wchar_t[__len];
1809+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1810+ _M_data->_M_negative_sign = __wcs_ns;
1811+ }
1812+ else
1813+ _M_data->_M_negative_sign = L"";
1814+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1815+
1816+ // _Intl == true.
1817+ __len = strlen(__ccurr);
1818+ if (__len)
1819+ {
1820+ ++__len;
1821+ memset(&__state, 0, sizeof(mbstate_t));
1822+ wchar_t* __wcs = new wchar_t[__len];
1823+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1824+ _M_data->_M_curr_symbol = __wcs;
1825+ }
1826+ else
1827+ _M_data->_M_curr_symbol = L"";
1828+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1829+ }
1830+ catch (...)
1831+ {
1832+ delete _M_data;
1833+ _M_data = 0;
1834+ delete __wcs_ps;
1835+ delete __wcs_ns;
1836+#ifdef __UCLIBC_HAS_XLOCALE__
1837+ __uselocale(__old);
1838+#else
1839+ setlocale(LC_ALL, __old);
1840+ free(__old);
1841+#endif
1842+ __throw_exception_again;
1843+ }
1844+
1845+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1846+ __cloc));
1847+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1848+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1849+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1850+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1851+ __pposn);
1852+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1853+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1854+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1855+ __nposn);
1856+
1857+#ifdef __UCLIBC_HAS_XLOCALE__
1858+ __uselocale(__old);
1859+#else
1860+ setlocale(LC_ALL, __old);
1861+ free(__old);
1862+#endif
1863+ }
1864+ }
1865+
1866+ template<>
1867+ void
1868+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1869+#ifdef __UCLIBC_HAS_XLOCALE__
1870+ const char*)
1871+#else
1872+ const char* __name)
1873+#endif
1874+ {
1875+ if (!_M_data)
1876+ _M_data = new __moneypunct_cache<wchar_t, false>;
1877+
1878+ if (!__cloc)
1879+ {
1880+ // "C" locale
1881+ _M_data->_M_decimal_point = L'.';
1882+ _M_data->_M_thousands_sep = L',';
1883+ _M_data->_M_grouping = "";
1884+ _M_data->_M_grouping_size = 0;
1885+ _M_data->_M_curr_symbol = L"";
1886+ _M_data->_M_curr_symbol_size = 0;
1887+ _M_data->_M_positive_sign = L"";
1888+ _M_data->_M_positive_sign_size = 0;
1889+ _M_data->_M_negative_sign = L"";
1890+ _M_data->_M_negative_sign_size = 0;
1891+ _M_data->_M_frac_digits = 0;
1892+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1893+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1894+
1895+ // Use ctype::widen code without the facet...
1896+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1897+ _M_data->_M_atoms[__i] =
1898+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1899+ }
1900+ else
1901+ {
1902+ // Named locale.
1903+#ifdef __UCLIBC_HAS_XLOCALE__
1904+ __c_locale __old = __uselocale(__cloc);
1905+#else
1906+ // Switch to named locale so that mbsrtowcs will work.
1907+ char* __old = strdup(setlocale(LC_ALL, NULL));
1908+ setlocale(LC_ALL, __name);
1909+#endif
1910+
1911+#ifdef __UCLIBC_MJN3_ONLY__
1912+#warning fix this... should be monetary
1913+#endif
1914+#ifdef __UCLIBC__
1915+# ifdef __UCLIBC_HAS_XLOCALE__
1916+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1917+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1918+# else
1919+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1920+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1921+# endif
1922+#else
1923+ union { char *__s; wchar_t __w; } __u;
1924+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1925+ _M_data->_M_decimal_point = __u.__w;
1926+
1927+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1928+ _M_data->_M_thousands_sep = __u.__w;
1929+#endif
1930+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1931+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1932+
1933+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1934+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1935+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1936+
1937+ wchar_t* __wcs_ps = 0;
1938+ wchar_t* __wcs_ns = 0;
1939+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1940+ try
1941+ {
1942+ mbstate_t __state;
1943+ size_t __len;
1944+ __len = strlen(__cpossign);
1945+ if (__len)
1946+ {
1947+ ++__len;
1948+ memset(&__state, 0, sizeof(mbstate_t));
1949+ __wcs_ps = new wchar_t[__len];
1950+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1951+ _M_data->_M_positive_sign = __wcs_ps;
1952+ }
1953+ else
1954+ _M_data->_M_positive_sign = L"";
1955+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1956+
1957+ __len = strlen(__cnegsign);
1958+ if (!__nposn)
1959+ _M_data->_M_negative_sign = L"()";
1960+ else if (__len)
1961+ {
1962+ ++__len;
1963+ memset(&__state, 0, sizeof(mbstate_t));
1964+ __wcs_ns = new wchar_t[__len];
1965+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1966+ _M_data->_M_negative_sign = __wcs_ns;
1967+ }
1968+ else
1969+ _M_data->_M_negative_sign = L"";
1970+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1971+
1972+ // _Intl == true.
1973+ __len = strlen(__ccurr);
1974+ if (__len)
1975+ {
1976+ ++__len;
1977+ memset(&__state, 0, sizeof(mbstate_t));
1978+ wchar_t* __wcs = new wchar_t[__len];
1979+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1980+ _M_data->_M_curr_symbol = __wcs;
1981+ }
1982+ else
1983+ _M_data->_M_curr_symbol = L"";
1984+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1985+ }
1986+ catch (...)
1987+ {
1988+ delete _M_data;
1989+ _M_data = 0;
1990+ delete __wcs_ps;
1991+ delete __wcs_ns;
1992+#ifdef __UCLIBC_HAS_XLOCALE__
1993+ __uselocale(__old);
1994+#else
1995+ setlocale(LC_ALL, __old);
1996+ free(__old);
1997+#endif
1998+ __throw_exception_again;
1999+ }
2000+
2001+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2002+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2003+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2004+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2005+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2006+ __pposn);
2007+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2008+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2009+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2010+ __nposn);
2011+
2012+#ifdef __UCLIBC_HAS_XLOCALE__
2013+ __uselocale(__old);
2014+#else
2015+ setlocale(LC_ALL, __old);
2016+ free(__old);
2017+#endif
2018+ }
2019+ }
2020+
2021+ template<>
2022+ moneypunct<wchar_t, true>::~moneypunct()
2023+ {
2024+ if (_M_data->_M_positive_sign_size)
2025+ delete [] _M_data->_M_positive_sign;
2026+ if (_M_data->_M_negative_sign_size
2027+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2028+ delete [] _M_data->_M_negative_sign;
2029+ if (_M_data->_M_curr_symbol_size)
2030+ delete [] _M_data->_M_curr_symbol;
2031+ delete _M_data;
2032+ }
2033+
2034+ template<>
2035+ moneypunct<wchar_t, false>::~moneypunct()
2036+ {
2037+ if (_M_data->_M_positive_sign_size)
2038+ delete [] _M_data->_M_positive_sign;
2039+ if (_M_data->_M_negative_sign_size
2040+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2041+ delete [] _M_data->_M_negative_sign;
2042+ if (_M_data->_M_curr_symbol_size)
2043+ delete [] _M_data->_M_curr_symbol;
2044+ delete _M_data;
2045+ }
2046+#endif
2047+}
2048Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2049===================================================================
2050--- /dev/null
2051+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2052@@ -0,0 +1,160 @@
2053+// std::numpunct implementation details, GNU version -*- C++ -*-
2054+
2055+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2056+//
2057+// This file is part of the GNU ISO C++ Library. This library is free
2058+// software; you can redistribute it and/or modify it under the
2059+// terms of the GNU General Public License as published by the
2060+// Free Software Foundation; either version 2, or (at your option)
2061+// any later version.
2062+
2063+// This library is distributed in the hope that it will be useful,
2064+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2065+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2066+// GNU General Public License for more details.
2067+
2068+// You should have received a copy of the GNU General Public License along
2069+// with this library; see the file COPYING. If not, write to the Free
2070+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2071+// USA.
2072+
2073+// As a special exception, you may use this file as part of a free software
2074+// library without restriction. Specifically, if other files instantiate
2075+// templates or use macros or inline functions from this file, or you compile
2076+// this file and link it with other files to produce an executable, this
2077+// file does not by itself cause the resulting executable to be covered by
2078+// the GNU General Public License. This exception does not however
2079+// invalidate any other reasons why the executable file might be covered by
2080+// the GNU General Public License.
2081+
2082+//
2083+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2084+//
2085+
2086+// Written by Benjamin Kosnik <bkoz@redhat.com>
2087+
2088+#define _LIBC
2089+#include <locale>
2090+#undef _LIBC
2091+#include <bits/c++locale_internal.h>
2092+
2093+#ifdef __UCLIBC_MJN3_ONLY__
2094+#warning tailor for stub locale support
2095+#endif
2096+#ifndef __UCLIBC_HAS_XLOCALE__
2097+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2098+#endif
2099+
2100+namespace std
2101+{
2102+ template<>
2103+ void
2104+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2105+ {
2106+ if (!_M_data)
2107+ _M_data = new __numpunct_cache<char>;
2108+
2109+ if (!__cloc)
2110+ {
2111+ // "C" locale
2112+ _M_data->_M_grouping = "";
2113+ _M_data->_M_grouping_size = 0;
2114+ _M_data->_M_use_grouping = false;
2115+
2116+ _M_data->_M_decimal_point = '.';
2117+ _M_data->_M_thousands_sep = ',';
2118+
2119+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2120+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2121+
2122+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2123+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2124+ }
2125+ else
2126+ {
2127+ // Named locale.
2128+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2129+ __cloc));
2130+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2131+ __cloc));
2132+
2133+ // Check for NULL, which implies no grouping.
2134+ if (_M_data->_M_thousands_sep == '\0')
2135+ _M_data->_M_grouping = "";
2136+ else
2137+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2138+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2139+ }
2140+
2141+ // NB: There is no way to extact this info from posix locales.
2142+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2143+ _M_data->_M_truename = "true";
2144+ _M_data->_M_truename_size = 4;
2145+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2146+ _M_data->_M_falsename = "false";
2147+ _M_data->_M_falsename_size = 5;
2148+ }
2149+
2150+ template<>
2151+ numpunct<char>::~numpunct()
2152+ { delete _M_data; }
2153+
2154+#ifdef _GLIBCXX_USE_WCHAR_T
2155+ template<>
2156+ void
2157+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2158+ {
2159+ if (!_M_data)
2160+ _M_data = new __numpunct_cache<wchar_t>;
2161+
2162+ if (!__cloc)
2163+ {
2164+ // "C" locale
2165+ _M_data->_M_grouping = "";
2166+ _M_data->_M_grouping_size = 0;
2167+ _M_data->_M_use_grouping = false;
2168+
2169+ _M_data->_M_decimal_point = L'.';
2170+ _M_data->_M_thousands_sep = L',';
2171+
2172+ // Use ctype::widen code without the facet...
2173+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2174+ _M_data->_M_atoms_out[__i] =
2175+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2176+
2177+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2178+ _M_data->_M_atoms_in[__j] =
2179+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2180+ }
2181+ else
2182+ {
2183+ // Named locale.
2184+ // NB: In the GNU model wchar_t is always 32 bit wide.
2185+ union { char *__s; wchar_t __w; } __u;
2186+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2187+ _M_data->_M_decimal_point = __u.__w;
2188+
2189+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2190+ _M_data->_M_thousands_sep = __u.__w;
2191+
2192+ if (_M_data->_M_thousands_sep == L'\0')
2193+ _M_data->_M_grouping = "";
2194+ else
2195+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2196+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2197+ }
2198+
2199+ // NB: There is no way to extact this info from posix locales.
2200+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2201+ _M_data->_M_truename = L"true";
2202+ _M_data->_M_truename_size = 4;
2203+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2204+ _M_data->_M_falsename = L"false";
2205+ _M_data->_M_falsename_size = 5;
2206+ }
2207+
2208+ template<>
2209+ numpunct<wchar_t>::~numpunct()
2210+ { delete _M_data; }
2211+ #endif
2212+}
2213Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
2214===================================================================
2215--- /dev/null
2216+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
2217@@ -0,0 +1,406 @@
2218+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2219+
2220+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2221+//
2222+// This file is part of the GNU ISO C++ Library. This library is free
2223+// software; you can redistribute it and/or modify it under the
2224+// terms of the GNU General Public License as published by the
2225+// Free Software Foundation; either version 2, or (at your option)
2226+// any later version.
2227+
2228+// This library is distributed in the hope that it will be useful,
2229+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2230+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2231+// GNU General Public License for more details.
2232+
2233+// You should have received a copy of the GNU General Public License along
2234+// with this library; see the file COPYING. If not, write to the Free
2235+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2236+// USA.
2237+
2238+// As a special exception, you may use this file as part of a free software
2239+// library without restriction. Specifically, if other files instantiate
2240+// templates or use macros or inline functions from this file, or you compile
2241+// this file and link it with other files to produce an executable, this
2242+// file does not by itself cause the resulting executable to be covered by
2243+// the GNU General Public License. This exception does not however
2244+// invalidate any other reasons why the executable file might be covered by
2245+// the GNU General Public License.
2246+
2247+//
2248+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2249+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2250+//
2251+
2252+// Written by Benjamin Kosnik <bkoz@redhat.com>
2253+
2254+#include <locale>
2255+#include <bits/c++locale_internal.h>
2256+
2257+#ifdef __UCLIBC_MJN3_ONLY__
2258+#warning tailor for stub locale support
2259+#endif
2260+#ifndef __UCLIBC_HAS_XLOCALE__
2261+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2262+#endif
2263+
2264+namespace std
2265+{
2266+ template<>
2267+ void
2268+ __timepunct<char>::
2269+ _M_put(char* __s, size_t __maxlen, const char* __format,
2270+ const tm* __tm) const
2271+ {
2272+#ifdef __UCLIBC_HAS_XLOCALE__
2273+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2274+ _M_c_locale_timepunct);
2275+#else
2276+ char* __old = strdup(setlocale(LC_ALL, NULL));
2277+ setlocale(LC_ALL, _M_name_timepunct);
2278+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2279+ setlocale(LC_ALL, __old);
2280+ free(__old);
2281+#endif
2282+ // Make sure __s is null terminated.
2283+ if (__len == 0)
2284+ __s[0] = '\0';
2285+ }
2286+
2287+ template<>
2288+ void
2289+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2290+ {
2291+ if (!_M_data)
2292+ _M_data = new __timepunct_cache<char>;
2293+
2294+ if (!__cloc)
2295+ {
2296+ // "C" locale
2297+ _M_c_locale_timepunct = _S_get_c_locale();
2298+
2299+ _M_data->_M_date_format = "%m/%d/%y";
2300+ _M_data->_M_date_era_format = "%m/%d/%y";
2301+ _M_data->_M_time_format = "%H:%M:%S";
2302+ _M_data->_M_time_era_format = "%H:%M:%S";
2303+ _M_data->_M_date_time_format = "";
2304+ _M_data->_M_date_time_era_format = "";
2305+ _M_data->_M_am = "AM";
2306+ _M_data->_M_pm = "PM";
2307+ _M_data->_M_am_pm_format = "";
2308+
2309+ // Day names, starting with "C"'s Sunday.
2310+ _M_data->_M_day1 = "Sunday";
2311+ _M_data->_M_day2 = "Monday";
2312+ _M_data->_M_day3 = "Tuesday";
2313+ _M_data->_M_day4 = "Wednesday";
2314+ _M_data->_M_day5 = "Thursday";
2315+ _M_data->_M_day6 = "Friday";
2316+ _M_data->_M_day7 = "Saturday";
2317+
2318+ // Abbreviated day names, starting with "C"'s Sun.
2319+ _M_data->_M_aday1 = "Sun";
2320+ _M_data->_M_aday2 = "Mon";
2321+ _M_data->_M_aday3 = "Tue";
2322+ _M_data->_M_aday4 = "Wed";
2323+ _M_data->_M_aday5 = "Thu";
2324+ _M_data->_M_aday6 = "Fri";
2325+ _M_data->_M_aday7 = "Sat";
2326+
2327+ // Month names, starting with "C"'s January.
2328+ _M_data->_M_month01 = "January";
2329+ _M_data->_M_month02 = "February";
2330+ _M_data->_M_month03 = "March";
2331+ _M_data->_M_month04 = "April";
2332+ _M_data->_M_month05 = "May";
2333+ _M_data->_M_month06 = "June";
2334+ _M_data->_M_month07 = "July";
2335+ _M_data->_M_month08 = "August";
2336+ _M_data->_M_month09 = "September";
2337+ _M_data->_M_month10 = "October";
2338+ _M_data->_M_month11 = "November";
2339+ _M_data->_M_month12 = "December";
2340+
2341+ // Abbreviated month names, starting with "C"'s Jan.
2342+ _M_data->_M_amonth01 = "Jan";
2343+ _M_data->_M_amonth02 = "Feb";
2344+ _M_data->_M_amonth03 = "Mar";
2345+ _M_data->_M_amonth04 = "Apr";
2346+ _M_data->_M_amonth05 = "May";
2347+ _M_data->_M_amonth06 = "Jun";
2348+ _M_data->_M_amonth07 = "Jul";
2349+ _M_data->_M_amonth08 = "Aug";
2350+ _M_data->_M_amonth09 = "Sep";
2351+ _M_data->_M_amonth10 = "Oct";
2352+ _M_data->_M_amonth11 = "Nov";
2353+ _M_data->_M_amonth12 = "Dec";
2354+ }
2355+ else
2356+ {
2357+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2358+
2359+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2360+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2361+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2362+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2363+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2364+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2365+ __cloc);
2366+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2367+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2368+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2369+
2370+ // Day names, starting with "C"'s Sunday.
2371+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2372+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2373+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2374+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2375+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2376+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2377+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2378+
2379+ // Abbreviated day names, starting with "C"'s Sun.
2380+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2381+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2382+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2383+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2384+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2385+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2386+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2387+
2388+ // Month names, starting with "C"'s January.
2389+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2390+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2391+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2392+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2393+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2394+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2395+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2396+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2397+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2398+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2399+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2400+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2401+
2402+ // Abbreviated month names, starting with "C"'s Jan.
2403+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2404+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2405+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2406+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2407+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2408+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2409+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2410+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2411+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2412+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2413+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2414+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2415+ }
2416+ }
2417+
2418+#ifdef _GLIBCXX_USE_WCHAR_T
2419+ template<>
2420+ void
2421+ __timepunct<wchar_t>::
2422+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2423+ const tm* __tm) const
2424+ {
2425+#ifdef __UCLIBC_HAS_XLOCALE__
2426+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2427+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2428+ _M_c_locale_timepunct);
2429+#else
2430+ char* __old = strdup(setlocale(LC_ALL, NULL));
2431+ setlocale(LC_ALL, _M_name_timepunct);
2432+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2433+ setlocale(LC_ALL, __old);
2434+ free(__old);
2435+#endif
2436+ // Make sure __s is null terminated.
2437+ if (__len == 0)
2438+ __s[0] = L'\0';
2439+ }
2440+
2441+ template<>
2442+ void
2443+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2444+ {
2445+ if (!_M_data)
2446+ _M_data = new __timepunct_cache<wchar_t>;
2447+
2448+#warning wide time stuff
2449+// if (!__cloc)
2450+ {
2451+ // "C" locale
2452+ _M_c_locale_timepunct = _S_get_c_locale();
2453+
2454+ _M_data->_M_date_format = L"%m/%d/%y";
2455+ _M_data->_M_date_era_format = L"%m/%d/%y";
2456+ _M_data->_M_time_format = L"%H:%M:%S";
2457+ _M_data->_M_time_era_format = L"%H:%M:%S";
2458+ _M_data->_M_date_time_format = L"";
2459+ _M_data->_M_date_time_era_format = L"";
2460+ _M_data->_M_am = L"AM";
2461+ _M_data->_M_pm = L"PM";
2462+ _M_data->_M_am_pm_format = L"";
2463+
2464+ // Day names, starting with "C"'s Sunday.
2465+ _M_data->_M_day1 = L"Sunday";
2466+ _M_data->_M_day2 = L"Monday";
2467+ _M_data->_M_day3 = L"Tuesday";
2468+ _M_data->_M_day4 = L"Wednesday";
2469+ _M_data->_M_day5 = L"Thursday";
2470+ _M_data->_M_day6 = L"Friday";
2471+ _M_data->_M_day7 = L"Saturday";
2472+
2473+ // Abbreviated day names, starting with "C"'s Sun.
2474+ _M_data->_M_aday1 = L"Sun";
2475+ _M_data->_M_aday2 = L"Mon";
2476+ _M_data->_M_aday3 = L"Tue";
2477+ _M_data->_M_aday4 = L"Wed";
2478+ _M_data->_M_aday5 = L"Thu";
2479+ _M_data->_M_aday6 = L"Fri";
2480+ _M_data->_M_aday7 = L"Sat";
2481+
2482+ // Month names, starting with "C"'s January.
2483+ _M_data->_M_month01 = L"January";
2484+ _M_data->_M_month02 = L"February";
2485+ _M_data->_M_month03 = L"March";
2486+ _M_data->_M_month04 = L"April";
2487+ _M_data->_M_month05 = L"May";
2488+ _M_data->_M_month06 = L"June";
2489+ _M_data->_M_month07 = L"July";
2490+ _M_data->_M_month08 = L"August";
2491+ _M_data->_M_month09 = L"September";
2492+ _M_data->_M_month10 = L"October";
2493+ _M_data->_M_month11 = L"November";
2494+ _M_data->_M_month12 = L"December";
2495+
2496+ // Abbreviated month names, starting with "C"'s Jan.
2497+ _M_data->_M_amonth01 = L"Jan";
2498+ _M_data->_M_amonth02 = L"Feb";
2499+ _M_data->_M_amonth03 = L"Mar";
2500+ _M_data->_M_amonth04 = L"Apr";
2501+ _M_data->_M_amonth05 = L"May";
2502+ _M_data->_M_amonth06 = L"Jun";
2503+ _M_data->_M_amonth07 = L"Jul";
2504+ _M_data->_M_amonth08 = L"Aug";
2505+ _M_data->_M_amonth09 = L"Sep";
2506+ _M_data->_M_amonth10 = L"Oct";
2507+ _M_data->_M_amonth11 = L"Nov";
2508+ _M_data->_M_amonth12 = L"Dec";
2509+ }
2510+#if 0
2511+ else
2512+ {
2513+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2514+
2515+ union { char *__s; wchar_t *__w; } __u;
2516+
2517+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2518+ _M_data->_M_date_format = __u.__w;
2519+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2520+ _M_data->_M_date_era_format = __u.__w;
2521+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2522+ _M_data->_M_time_format = __u.__w;
2523+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2524+ _M_data->_M_time_era_format = __u.__w;
2525+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2526+ _M_data->_M_date_time_format = __u.__w;
2527+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2528+ _M_data->_M_date_time_era_format = __u.__w;
2529+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2530+ _M_data->_M_am = __u.__w;
2531+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2532+ _M_data->_M_pm = __u.__w;
2533+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2534+ _M_data->_M_am_pm_format = __u.__w;
2535+
2536+ // Day names, starting with "C"'s Sunday.
2537+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2538+ _M_data->_M_day1 = __u.__w;
2539+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2540+ _M_data->_M_day2 = __u.__w;
2541+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2542+ _M_data->_M_day3 = __u.__w;
2543+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2544+ _M_data->_M_day4 = __u.__w;
2545+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2546+ _M_data->_M_day5 = __u.__w;
2547+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2548+ _M_data->_M_day6 = __u.__w;
2549+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2550+ _M_data->_M_day7 = __u.__w;
2551+
2552+ // Abbreviated day names, starting with "C"'s Sun.
2553+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2554+ _M_data->_M_aday1 = __u.__w;
2555+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2556+ _M_data->_M_aday2 = __u.__w;
2557+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2558+ _M_data->_M_aday3 = __u.__w;
2559+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2560+ _M_data->_M_aday4 = __u.__w;
2561+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2562+ _M_data->_M_aday5 = __u.__w;
2563+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2564+ _M_data->_M_aday6 = __u.__w;
2565+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2566+ _M_data->_M_aday7 = __u.__w;
2567+
2568+ // Month names, starting with "C"'s January.
2569+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2570+ _M_data->_M_month01 = __u.__w;
2571+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2572+ _M_data->_M_month02 = __u.__w;
2573+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2574+ _M_data->_M_month03 = __u.__w;
2575+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2576+ _M_data->_M_month04 = __u.__w;
2577+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2578+ _M_data->_M_month05 = __u.__w;
2579+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2580+ _M_data->_M_month06 = __u.__w;
2581+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2582+ _M_data->_M_month07 = __u.__w;
2583+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2584+ _M_data->_M_month08 = __u.__w;
2585+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2586+ _M_data->_M_month09 = __u.__w;
2587+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2588+ _M_data->_M_month10 = __u.__w;
2589+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2590+ _M_data->_M_month11 = __u.__w;
2591+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2592+ _M_data->_M_month12 = __u.__w;
2593+
2594+ // Abbreviated month names, starting with "C"'s Jan.
2595+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2596+ _M_data->_M_amonth01 = __u.__w;
2597+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2598+ _M_data->_M_amonth02 = __u.__w;
2599+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2600+ _M_data->_M_amonth03 = __u.__w;
2601+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2602+ _M_data->_M_amonth04 = __u.__w;
2603+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2604+ _M_data->_M_amonth05 = __u.__w;
2605+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2606+ _M_data->_M_amonth06 = __u.__w;
2607+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2608+ _M_data->_M_amonth07 = __u.__w;
2609+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2610+ _M_data->_M_amonth08 = __u.__w;
2611+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2612+ _M_data->_M_amonth09 = __u.__w;
2613+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2614+ _M_data->_M_amonth10 = __u.__w;
2615+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2616+ _M_data->_M_amonth11 = __u.__w;
2617+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2618+ _M_data->_M_amonth12 = __u.__w;
2619+ }
2620+#endif // 0
2621+ }
2622+#endif
2623+}
2624Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
2625===================================================================
2626--- /dev/null
2627+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
2628@@ -0,0 +1,68 @@
2629+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2630+
2631+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2632+//
2633+// This file is part of the GNU ISO C++ Library. This library is free
2634+// software; you can redistribute it and/or modify it under the
2635+// terms of the GNU General Public License as published by the
2636+// Free Software Foundation; either version 2, or (at your option)
2637+// any later version.
2638+
2639+// This library is distributed in the hope that it will be useful,
2640+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2641+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2642+// GNU General Public License for more details.
2643+
2644+// You should have received a copy of the GNU General Public License along
2645+// with this library; see the file COPYING. If not, write to the Free
2646+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2647+// USA.
2648+
2649+// As a special exception, you may use this file as part of a free software
2650+// library without restriction. Specifically, if other files instantiate
2651+// templates or use macros or inline functions from this file, or you compile
2652+// this file and link it with other files to produce an executable, this
2653+// file does not by itself cause the resulting executable to be covered by
2654+// the GNU General Public License. This exception does not however
2655+// invalidate any other reasons why the executable file might be covered by
2656+// the GNU General Public License.
2657+
2658+//
2659+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2660+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2661+//
2662+
2663+// Written by Benjamin Kosnik <bkoz@redhat.com>
2664+
2665+ template<typename _CharT>
2666+ __timepunct<_CharT>::__timepunct(size_t __refs)
2667+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2668+ _M_name_timepunct(_S_get_c_name())
2669+ { _M_initialize_timepunct(); }
2670+
2671+ template<typename _CharT>
2672+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2673+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2674+ _M_name_timepunct(_S_get_c_name())
2675+ { _M_initialize_timepunct(); }
2676+
2677+ template<typename _CharT>
2678+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2679+ size_t __refs)
2680+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2681+ _M_name_timepunct(__s)
2682+ {
2683+ char* __tmp = new char[std::strlen(__s) + 1];
2684+ std::strcpy(__tmp, __s);
2685+ _M_name_timepunct = __tmp;
2686+ _M_initialize_timepunct(__cloc);
2687+ }
2688+
2689+ template<typename _CharT>
2690+ __timepunct<_CharT>::~__timepunct()
2691+ {
2692+ if (_M_name_timepunct != _S_get_c_name())
2693+ delete [] _M_name_timepunct;
2694+ delete _M_data;
2695+ _S_destroy_c_locale(_M_c_locale_timepunct);
2696+ }
2697Index: gcc-4.6.0/libstdc++-v3/configure
2698===================================================================
2699--- gcc-4.6.0.orig/libstdc++-v3/configure
2700+++ gcc-4.6.0/libstdc++-v3/configure
2701@@ -15642,7 +15642,7 @@ $as_echo "stdio" >&6; }
2702 if test "${enable_clocale+set}" = set; then :
2703 enableval=$enable_clocale;
2704 case "$enableval" in
2705- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
2706+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
2707 *) as_fn_error "Unknown argument to enable/disable clocale" "$LINENO" 5 ;;
2708 esac
2709
2710@@ -15674,6 +15674,9 @@ fi
2711 # Default to "generic".
2712 if test $enable_clocale_flag = auto; then
2713 case ${target_os} in
2714+ *-uclibc*)
2715+ enable_clocale_flag=uclibc
2716+ ;;
2717 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2718 enable_clocale_flag=gnu
2719 ;;
2720@@ -15907,6 +15910,76 @@ $as_echo "IEEE 1003.1" >&6; }
2721 CTIME_CC=config/locale/generic/time_members.cc
2722 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2723 ;;
2724+ uclibc)
2725+ echo "$as_me:$LINENO: result: uclibc" >&5
2726+echo "${ECHO_T}uclibc" >&6
2727+
2728+ # Declare intention to use gettext, and add support for specific
2729+ # languages.
2730+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2731+ ALL_LINGUAS="de fr"
2732+
2733+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2734+ # Extract the first word of "msgfmt", so it can be a program name with args.
2735+set dummy msgfmt; ac_word=$2
2736+echo "$as_me:$LINENO: checking for $ac_word" >&5
2737+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2738+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
2739+ echo $ECHO_N "(cached) $ECHO_C" >&6
2740+else
2741+ if test -n "$check_msgfmt"; then
2742+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2743+else
2744+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2745+for as_dir in $PATH
2746+do
2747+ IFS=$as_save_IFS
2748+ test -z "$as_dir" && as_dir=.
2749+ for ac_exec_ext in '' $ac_executable_extensions; do
2750+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2751+ ac_cv_prog_check_msgfmt="yes"
2752+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2753+ break 2
2754+ fi
2755+done
2756+done
2757+
2758+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2759+fi
2760+fi
2761+check_msgfmt=$ac_cv_prog_check_msgfmt
2762+if test -n "$check_msgfmt"; then
2763+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
2764+echo "${ECHO_T}$check_msgfmt" >&6
2765+else
2766+ echo "$as_me:$LINENO: result: no" >&5
2767+echo "${ECHO_T}no" >&6
2768+fi
2769+
2770+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2771+ USE_NLS=yes
2772+ fi
2773+ # Export the build objects.
2774+ for ling in $ALL_LINGUAS; do \
2775+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2776+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2777+ done
2778+
2779+
2780+
2781+ CLOCALE_H=config/locale/uclibc/c_locale.h
2782+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2783+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2784+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2785+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2786+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2787+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2788+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2789+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2790+ CTIME_H=config/locale/uclibc/time_members.h
2791+ CTIME_CC=config/locale/uclibc/time_members.cc
2792+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2793+ ;;
2794 esac
2795
2796 # This is where the testsuite looks for locale catalogs, using the
2797@@ -16957,6 +17030,7 @@ rm -f core conftest.err conftest.$ac_obj
2798
2799 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2800 /* end confdefs.h. */
2801+#line 17016 "configure"
2802 #include <wctype.h>
2803 int
2804 main ()
2805@@ -64172,7 +64246,6 @@ $as_echo_n "checking for shared libgcc..
2806 fi
2807 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2808 /* end confdefs.h. */
2809-
2810 int
2811 main ()
2812 {
2813Index: gcc-4.6.0/libstdc++-v3/include/c_compatibility/wchar.h
2814===================================================================
2815--- gcc-4.6.0.orig/libstdc++-v3/include/c_compatibility/wchar.h
2816+++ gcc-4.6.0/libstdc++-v3/include/c_compatibility/wchar.h
2817@@ -101,7 +101,9 @@ using std::wmemcmp;
2818 using std::wmemcpy;
2819 using std::wmemmove;
2820 using std::wmemset;
2821+#if _GLIBCXX_HAVE_WCSFTIME
2822 using std::wcsftime;
2823+#endif
2824
2825 #if _GLIBCXX_USE_C99
2826 using std::wcstold;
2827Index: gcc-4.6.0/libstdc++-v3/include/c_std/cwchar
2828===================================================================
2829--- gcc-4.6.0.orig/libstdc++-v3/include/c_std/cwchar
2830+++ gcc-4.6.0/libstdc++-v3/include/c_std/cwchar
2831@@ -177,7 +177,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
2832 using ::wcscoll;
2833 using ::wcscpy;
2834 using ::wcscspn;
2835+#if _GLIBCXX_HAVE_WCSFTIME
2836 using ::wcsftime;
2837+#endif
2838 using ::wcslen;
2839 using ::wcsncat;
2840 using ::wcsncmp;
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/203-uclibc-locale-no__x.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/203-uclibc-locale-no__x.patch
new file mode 100644
index 0000000000..78743c6c26
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/203-uclibc-locale-no__x.patch
@@ -0,0 +1,233 @@
1Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
4+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
5@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm
6 extern "C" __typeof(wctype_l) __wctype_l;
7 #endif
8
9+# define __nl_langinfo_l nl_langinfo_l
10+# define __strcoll_l strcoll_l
11+# define __strftime_l strftime_l
12+# define __strtod_l strtod_l
13+# define __strtof_l strtof_l
14+# define __strtold_l strtold_l
15+# define __strxfrm_l strxfrm_l
16+# define __newlocale newlocale
17+# define __freelocale freelocale
18+# define __duplocale duplocale
19+# define __uselocale uselocale
20+
21+# ifdef _GLIBCXX_USE_WCHAR_T
22+# define __iswctype_l iswctype_l
23+# define __towlower_l towlower_l
24+# define __towupper_l towupper_l
25+# define __wcscoll_l wcscoll_l
26+# define __wcsftime_l wcsftime_l
27+# define __wcsxfrm_l wcsxfrm_l
28+# define __wctype_l wctype_l
29+# endif
30+
31+#else
32+# define __nl_langinfo_l(N, L) nl_langinfo((N))
33+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
34+# define __strtod_l(S, E, L) strtod((S), (E))
35+# define __strtof_l(S, E, L) strtof((S), (E))
36+# define __strtold_l(S, E, L) strtold((S), (E))
37+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
38+# warning should dummy __newlocale check for C|POSIX ?
39+# define __newlocale(a, b, c) NULL
40+# define __freelocale(a) ((void)0)
41+# define __duplocale(a) __c_locale()
42+//# define __uselocale ?
43+//
44+# ifdef _GLIBCXX_USE_WCHAR_T
45+# define __iswctype_l(C, M, L) iswctype((C), (M))
46+# define __towlower_l(C, L) towlower((C))
47+# define __towupper_l(C, L) towupper((C))
48+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
49+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
50+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
51+# define __wctype_l(S, L) wctype((S))
52+# endif
53+
54 #endif // GLIBC 2.3 and later
55Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
56===================================================================
57--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
58+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
59@@ -39,20 +39,6 @@
60 #include <langinfo.h>
61 #include <bits/c++locale_internal.h>
62
63-#ifndef __UCLIBC_HAS_XLOCALE__
64-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
65-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
66-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
67-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
68-#define __strtof_l(S, E, L) strtof((S), (E))
69-#define __strtod_l(S, E, L) strtod((S), (E))
70-#define __strtold_l(S, E, L) strtold((S), (E))
71-#warning should dummy __newlocale check for C|POSIX ?
72-#define __newlocale(a, b, c) NULL
73-#define __freelocale(a) ((void)0)
74-#define __duplocale(a) __c_locale()
75-#endif
76-
77 namespace std
78 {
79 template<>
80Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
81===================================================================
82--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc
83+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
84@@ -36,13 +36,6 @@
85 #include <locale>
86 #include <bits/c++locale_internal.h>
87
88-#ifndef __UCLIBC_HAS_XLOCALE__
89-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
90-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
91-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
92-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
93-#endif
94-
95 namespace std
96 {
97 // These are basically extensions to char_traits, and perhaps should
98Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
99===================================================================
100--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
101+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
102@@ -43,10 +43,6 @@
103 #warning tailor for stub locale support
104 #endif
105
106-#ifndef __UCLIBC_HAS_XLOCALE__
107-#define __nl_langinfo_l(N, L) nl_langinfo((N))
108-#endif
109-
110 namespace std
111 {
112 // Construct and return valid pattern consisting of some combination of:
113Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
114===================================================================
115--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
116+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
117@@ -41,9 +41,6 @@
118 #ifdef __UCLIBC_MJN3_ONLY__
119 #warning tailor for stub locale support
120 #endif
121-#ifndef __UCLIBC_HAS_XLOCALE__
122-#define __nl_langinfo_l(N, L) nl_langinfo((N))
123-#endif
124
125 namespace std
126 {
127Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
128===================================================================
129--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
130+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
131@@ -40,9 +40,6 @@
132 #ifdef __UCLIBC_MJN3_ONLY__
133 #warning tailor for stub locale support
134 #endif
135-#ifndef __UCLIBC_HAS_XLOCALE__
136-#define __nl_langinfo_l(N, L) nl_langinfo((N))
137-#endif
138
139 namespace std
140 {
141Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
142===================================================================
143--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
144+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
145@@ -38,13 +38,6 @@
146 #undef _LIBC
147 #include <bits/c++locale_internal.h>
148
149-#ifndef __UCLIBC_HAS_XLOCALE__
150-#define __wctype_l(S, L) wctype((S))
151-#define __towupper_l(C, L) towupper((C))
152-#define __towlower_l(C, L) towlower((C))
153-#define __iswctype_l(C, M, L) iswctype((C), (M))
154-#endif
155-
156 namespace std
157 {
158 // NB: The other ctype<char> specializations are in src/locale.cc and
159Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
160===================================================================
161--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc
162+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
163@@ -39,13 +39,10 @@
164 #ifdef __UCLIBC_MJN3_ONLY__
165 #warning fix gettext stuff
166 #endif
167-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
168-extern "C" char *__dcgettext(const char *domainname,
169- const char *msgid, int category);
170 #undef gettext
171-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
172+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
173+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
174 #else
175-#undef gettext
176 #define gettext(msgid) (msgid)
177 #endif
178
179Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
180===================================================================
181--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
182+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
183@@ -36,15 +36,11 @@
184 #ifdef __UCLIBC_MJN3_ONLY__
185 #warning fix prototypes for *textdomain funcs
186 #endif
187-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
188-extern "C" char *__textdomain(const char *domainname);
189-extern "C" char *__bindtextdomain(const char *domainname,
190- const char *dirname);
191-#else
192-#undef __textdomain
193-#undef __bindtextdomain
194-#define __textdomain(D) ((void)0)
195-#define __bindtextdomain(D,P) ((void)0)
196+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
197+#undef textdomain
198+#undef bindtextdomain
199+#define textdomain(D) ((void)0)
200+#define bindtextdomain(D,P) ((void)0)
201 #endif
202
203 // Non-virtual member functions.
204@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const
205 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
206 const char* __dir) const
207 {
208- __bindtextdomain(__s.c_str(), __dir);
209+ bindtextdomain(__s.c_str(), __dir);
210 return this->do_open(__s, __loc);
211 }
212
213@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const
214 {
215 // No error checking is done, assume the catalog exists and can
216 // be used.
217- __textdomain(__s.c_str());
218+ textdomain(__s.c_str());
219 return 0;
220 }
221
222Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
223===================================================================
224--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
225+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
226@@ -68,6 +68,7 @@ namespace __gnu_cxx
227 {
228 extern "C" __typeof(uselocale) __uselocale;
229 }
230+#define __uselocale uselocale
231 #endif
232
233 namespace std
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/204-uclibc-locale-wchar_fix.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/204-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000000..2d8d70ae59
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/204-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,52 @@
1Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
4+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
5@@ -401,7 +401,7 @@ namespace std
6 # ifdef __UCLIBC_HAS_XLOCALE__
7 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
8 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
9-# else
10+# elif defined __UCLIBC_HAS_LOCALE__
11 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
12 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
13 # endif
14@@ -556,7 +556,7 @@ namespace std
15 # ifdef __UCLIBC_HAS_XLOCALE__
16 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
17 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
18-# else
19+# elif defined __UCLIBC_HAS_LOCALE__
20 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
21 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
22 # endif
23Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
24===================================================================
25--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
26+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
27@@ -127,12 +127,25 @@ namespace std
28 {
29 // Named locale.
30 // NB: In the GNU model wchar_t is always 32 bit wide.
31+#ifdef __UCLIBC_MJN3_ONLY__
32+#warning fix this... should be numeric
33+#endif
34+#ifdef __UCLIBC__
35+# ifdef __UCLIBC_HAS_XLOCALE__
36+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
37+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
38+# elif defined __UCLIBC_HAS_LOCALE__
39+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
40+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
41+# endif
42+#else
43 union { char *__s; wchar_t __w; } __u;
44 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
45 _M_data->_M_decimal_point = __u.__w;
46
47 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
48 _M_data->_M_thousands_sep = __u.__w;
49+#endif
50
51 if (_M_data->_M_thousands_sep == L'\0')
52 _M_data->_M_grouping = "";
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/205-uclibc-locale-update.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/205-uclibc-locale-update.patch
new file mode 100644
index 0000000000..911ad51df5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/205-uclibc-locale-update.patch
@@ -0,0 +1,519 @@
1Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
4+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
5@@ -39,23 +39,20 @@
6 #include <langinfo.h>
7 #include <bits/c++locale_internal.h>
8
9-namespace std
10-{
11+_GLIBCXX_BEGIN_NAMESPACE(std)
12+
13 template<>
14 void
15 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
16 const __c_locale& __cloc)
17 {
18- if (!(__err & ios_base::failbit))
19- {
20- char* __sanity;
21- errno = 0;
22- float __f = __strtof_l(__s, &__sanity, __cloc);
23- if (__sanity != __s && errno != ERANGE)
24- __v = __f;
25- else
26- __err |= ios_base::failbit;
27- }
28+ char* __sanity;
29+ errno = 0;
30+ float __f = __strtof_l(__s, &__sanity, __cloc);
31+ if (__sanity != __s && errno != ERANGE)
32+ __v = __f;
33+ else
34+ __err |= ios_base::failbit;
35 }
36
37 template<>
38@@ -63,16 +60,13 @@ namespace std
39 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
40 const __c_locale& __cloc)
41 {
42- if (!(__err & ios_base::failbit))
43- {
44- char* __sanity;
45- errno = 0;
46- double __d = __strtod_l(__s, &__sanity, __cloc);
47- if (__sanity != __s && errno != ERANGE)
48- __v = __d;
49- else
50- __err |= ios_base::failbit;
51- }
52+ char* __sanity;
53+ errno = 0;
54+ double __d = __strtod_l(__s, &__sanity, __cloc);
55+ if (__sanity != __s && errno != ERANGE)
56+ __v = __d;
57+ else
58+ __err |= ios_base::failbit;
59 }
60
61 template<>
62@@ -80,16 +74,13 @@ namespace std
63 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
64 const __c_locale& __cloc)
65 {
66- if (!(__err & ios_base::failbit))
67- {
68- char* __sanity;
69- errno = 0;
70- long double __ld = __strtold_l(__s, &__sanity, __cloc);
71- if (__sanity != __s && errno != ERANGE)
72- __v = __ld;
73- else
74- __err |= ios_base::failbit;
75- }
76+ char* __sanity;
77+ errno = 0;
78+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
79+ if (__sanity != __s && errno != ERANGE)
80+ __v = __ld;
81+ else
82+ __err |= ios_base::failbit;
83 }
84
85 void
86@@ -110,17 +101,18 @@ namespace std
87 void
88 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
89 {
90- if (_S_get_c_locale() != __cloc)
91+ if (__cloc && _S_get_c_locale() != __cloc)
92 __freelocale(__cloc);
93 }
94
95 __c_locale
96 locale::facet::_S_clone_c_locale(__c_locale& __cloc)
97 { return __duplocale(__cloc); }
98-} // namespace std
99
100-namespace __gnu_cxx
101-{
102+_GLIBCXX_END_NAMESPACE
103+
104+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
105+
106 const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
107 {
108 "LC_CTYPE",
109@@ -138,9 +130,11 @@ namespace __gnu_cxx
110 "LC_IDENTIFICATION"
111 #endif
112 };
113-}
114
115-namespace std
116-{
117+_GLIBCXX_END_NAMESPACE
118+
119+_GLIBCXX_BEGIN_NAMESPACE(std)
120+
121 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
122-} // namespace std
123+
124+_GLIBCXX_END_NAMESPACE
125Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
126===================================================================
127--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
128+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
129@@ -33,16 +33,20 @@
130
131 // Written by Benjamin Kosnik <bkoz@redhat.com>
132
133+#include <features.h>
134+#ifdef __UCLIBC_HAS_LOCALE__
135 #define _LIBC
136 #include <locale>
137 #undef _LIBC
138+#else
139+#include <locale>
140+#endif
141 #include <bits/c++locale_internal.h>
142
143-namespace std
144-{
145+_GLIBCXX_BEGIN_NAMESPACE(std)
146+
147 // NB: The other ctype<char> specializations are in src/locale.cc and
148 // various /config/os/* files.
149- template<>
150 ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
151 : ctype<char>(0, false, __refs)
152 {
153@@ -57,6 +61,8 @@ namespace std
154 #endif
155 }
156 }
157+ ctype_byname<char>::~ctype_byname()
158+ { }
159
160 #ifdef _GLIBCXX_USE_WCHAR_T
161 ctype<wchar_t>::__wmask_type
162@@ -138,17 +144,33 @@ namespace std
163 ctype<wchar_t>::
164 do_is(mask __m, wchar_t __c) const
165 {
166- // Highest bitmask in ctype_base == 10, but extra in "C"
167- // library for blank.
168+ // The case of __m == ctype_base::space is particularly important,
169+ // due to its use in many istream functions. Therefore we deal with
170+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
171+ // is the mask corresponding to ctype_base::space. NB: an encoding
172+ // change would not affect correctness!
173+
174 bool __ret = false;
175- const size_t __bitmasksize = 11;
176- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
177- if (__m & _M_bit[__bitcur]
178- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
179- {
180- __ret = true;
181- break;
182- }
183+ if (__m == _M_bit[5])
184+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
185+ else
186+ {
187+ // Highest bitmask in ctype_base == 10, but extra in "C"
188+ // library for blank.
189+ const size_t __bitmasksize = 11;
190+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
191+ if (__m & _M_bit[__bitcur])
192+ {
193+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
194+ {
195+ __ret = true;
196+ break;
197+ }
198+ else if (__m == _M_bit[__bitcur])
199+ break;
200+ }
201+ }
202+
203 return __ret;
204 }
205
206@@ -290,4 +312,5 @@ namespace std
207 #endif
208 }
209 #endif // _GLIBCXX_USE_WCHAR_T
210-}
211+
212+_GLIBCXX_END_NAMESPACE
213Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
214===================================================================
215--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
216+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
217@@ -53,12 +53,16 @@
218 template<typename _CharT>
219 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
220 size_t __refs)
221- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
222- _M_name_messages(__s)
223+ : facet(__refs), _M_c_locale_messages(NULL),
224+ _M_name_messages(NULL)
225 {
226- char* __tmp = new char[std::strlen(__s) + 1];
227- std::strcpy(__tmp, __s);
228+ const size_t __len = std::strlen(__s) + 1;
229+ char* __tmp = new char[__len];
230+ std::memcpy(__tmp, __s, __len);
231 _M_name_messages = __tmp;
232+
233+ // Last to avoid leaking memory if new throws.
234+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
235 }
236
237 template<typename _CharT>
238Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
239===================================================================
240--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
241+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
242@@ -33,9 +33,14 @@
243
244 // Written by Benjamin Kosnik <bkoz@redhat.com>
245
246+#include <features.h>
247+#ifdef __UCLIBC_HAS_LOCALE__
248 #define _LIBC
249 #include <locale>
250 #undef _LIBC
251+#else
252+#include <locale>
253+#endif
254 #include <bits/c++locale_internal.h>
255
256 #ifdef __UCLIBC_MJN3_ONLY__
257@@ -206,7 +211,7 @@ namespace std
258 }
259 break;
260 default:
261- ;
262+ __ret = pattern();
263 }
264 return __ret;
265 }
266@@ -390,7 +395,9 @@ namespace std
267 __c_locale __old = __uselocale(__cloc);
268 #else
269 // Switch to named locale so that mbsrtowcs will work.
270- char* __old = strdup(setlocale(LC_ALL, NULL));
271+ char* __old = setlocale(LC_ALL, NULL);
272+ const size_t __llen = strlen(__old) + 1;
273+ char* __sav = new char[__llen];
274 setlocale(LC_ALL, __name);
275 #endif
276
277@@ -477,8 +484,8 @@ namespace std
278 #ifdef __UCLIBC_HAS_XLOCALE__
279 __uselocale(__old);
280 #else
281- setlocale(LC_ALL, __old);
282- free(__old);
283+ setlocale(LC_ALL, __sav);
284+ delete [] __sav;
285 #endif
286 __throw_exception_again;
287 }
288@@ -498,8 +505,8 @@ namespace std
289 #ifdef __UCLIBC_HAS_XLOCALE__
290 __uselocale(__old);
291 #else
292- setlocale(LC_ALL, __old);
293- free(__old);
294+ setlocale(LC_ALL, __sav);
295+ delete [] __sav;
296 #endif
297 }
298 }
299@@ -545,8 +552,11 @@ namespace std
300 __c_locale __old = __uselocale(__cloc);
301 #else
302 // Switch to named locale so that mbsrtowcs will work.
303- char* __old = strdup(setlocale(LC_ALL, NULL));
304- setlocale(LC_ALL, __name);
305+ char* __old = setlocale(LC_ALL, NULL);
306+ const size_t __llen = strlen(__old) + 1;
307+ char* __sav = new char[__llen];
308+ memcpy(__sav, __old, __llen);
309+ setlocale(LC_ALL, __name);
310 #endif
311
312 #ifdef __UCLIBC_MJN3_ONLY__
313@@ -633,8 +643,8 @@ namespace std
314 #ifdef __UCLIBC_HAS_XLOCALE__
315 __uselocale(__old);
316 #else
317- setlocale(LC_ALL, __old);
318- free(__old);
319+ setlocale(LC_ALL, __sav);
320+ delete [] __sav;
321 #endif
322 __throw_exception_again;
323 }
324@@ -653,8 +663,8 @@ namespace std
325 #ifdef __UCLIBC_HAS_XLOCALE__
326 __uselocale(__old);
327 #else
328- setlocale(LC_ALL, __old);
329- free(__old);
330+ setlocale(LC_ALL, __sav);
331+ delete [] __sav;
332 #endif
333 }
334 }
335Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
336===================================================================
337--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
338+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
339@@ -33,9 +33,14 @@
340
341 // Written by Benjamin Kosnik <bkoz@redhat.com>
342
343+#include <features.h>
344+#ifdef __UCLIBC_HAS_LOCALE__
345 #define _LIBC
346 #include <locale>
347 #undef _LIBC
348+#else
349+#include <locale>
350+#endif
351 #include <bits/c++locale_internal.h>
352
353 #ifdef __UCLIBC_MJN3_ONLY__
354Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
355===================================================================
356--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
357+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
358@@ -50,12 +50,21 @@
359 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
360 size_t __refs)
361 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
362- _M_name_timepunct(__s)
363+ _M_name_timepunct(NULL)
364 {
365- char* __tmp = new char[std::strlen(__s) + 1];
366- std::strcpy(__tmp, __s);
367+ const size_t __len = std::strlen(__s) + 1;
368+ char* __tmp = new char[__len];
369+ std::memcpy(__tmp, __s, __len);
370 _M_name_timepunct = __tmp;
371- _M_initialize_timepunct(__cloc);
372+
373+ try
374+ { _M_initialize_timepunct(__cloc); }
375+ catch(...)
376+ {
377+ delete [] _M_name_timepunct;
378+ __throw_exception_again;
379+ }
380+
381 }
382
383 template<typename _CharT>
384Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
385===================================================================
386--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
387+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
388@@ -39,21 +39,23 @@
389 #pragma GCC system_header
390
391 #include <cstring> // get std::strlen
392-#include <cstdio> // get std::snprintf or std::sprintf
393+#include <cstdio> // get std::vsnprintf or std::vsprintf
394 #include <clocale>
395 #include <langinfo.h> // For codecvt
396 #ifdef __UCLIBC_MJN3_ONLY__
397 #warning fix this
398 #endif
399-#ifdef __UCLIBC_HAS_LOCALE__
400+#ifdef _GLIBCXX_USE_ICONV
401 #include <iconv.h> // For codecvt using iconv, iconv_t
402 #endif
403-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
404-#include <libintl.h> // For messages
405+#ifdef HAVE_LIBINTL_H
406+#include <libintl.h> // For messages
407 #endif
408+#include <cstdarg>
409
410 #ifdef __UCLIBC_MJN3_ONLY__
411 #warning what is _GLIBCXX_C_LOCALE_GNU for
412+// psm: used in os/gnu-linux/ctype_noninline.h
413 #endif
414 #define _GLIBCXX_C_LOCALE_GNU 1
415
416@@ -78,23 +80,25 @@ namespace std
417 #else
418 typedef int* __c_locale;
419 #endif
420-
421- // Convert numeric value of type _Tv to string and return length of
422- // string. If snprintf is available use it, otherwise fall back to
423- // the unsafe sprintf which, in general, can be dangerous and should
424+ // Convert numeric value of type double to string and return length of
425+ // string. If vsnprintf is available use it, otherwise fall back to
426+ // the unsafe vsprintf which, in general, can be dangerous and should
427 // be avoided.
428- template<typename _Tv>
429- int
430- __convert_from_v(char* __out,
431- const int __size __attribute__ ((__unused__)),
432- const char* __fmt,
433-#ifdef __UCLIBC_HAS_XCLOCALE__
434- _Tv __v, const __c_locale& __cloc, int __prec)
435+ inline int
436+ __convert_from_v(const __c_locale&
437+#ifndef __UCLIBC_HAS_XCLOCALE__
438+ __cloc __attribute__ ((__unused__))
439+#endif
440+ ,
441+ char* __out,
442+ const int __size,
443+ const char* __fmt, ...)
444 {
445+ va_list __args;
446+#ifdef __UCLIBC_HAS_XCLOCALE__
447+
448 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
449 #else
450- _Tv __v, const __c_locale&, int __prec)
451- {
452 # ifdef __UCLIBC_HAS_LOCALE__
453 char* __old = std::setlocale(LC_ALL, NULL);
454 char* __sav = new char[std::strlen(__old) + 1];
455@@ -103,7 +107,9 @@ namespace std
456 # endif
457 #endif
458
459- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
460+ va_start(__args, __fmt);
461+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
462+ va_end(__args);
463
464 #ifdef __UCLIBC_HAS_XCLOCALE__
465 __gnu_cxx::__uselocale(__old);
466Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
467===================================================================
468--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
469+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
470@@ -53,11 +53,14 @@ namespace std
471 const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
472 _M_c_locale_timepunct);
473 #else
474- char* __old = strdup(setlocale(LC_ALL, NULL));
475+ char* __old = setlocale(LC_ALL, NULL);
476+ const size_t __llen = strlen(__old) + 1;
477+ char* __sav = new char[__llen];
478+ memcpy(__sav, __old, __llen);
479 setlocale(LC_ALL, _M_name_timepunct);
480 const size_t __len = strftime(__s, __maxlen, __format, __tm);
481- setlocale(LC_ALL, __old);
482- free(__old);
483+ setlocale(LC_ALL, __sav);
484+ delete [] __sav;
485 #endif
486 // Make sure __s is null terminated.
487 if (__len == 0)
488@@ -207,11 +210,14 @@ namespace std
489 const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
490 _M_c_locale_timepunct);
491 #else
492- char* __old = strdup(setlocale(LC_ALL, NULL));
493+ char* __old = setlocale(LC_ALL, NULL);
494+ const size_t __llen = strlen(__old) + 1;
495+ char* __sav = new char[__llen];
496+ memcpy(__sav, __old, __llen);
497 setlocale(LC_ALL, _M_name_timepunct);
498 const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
499- setlocale(LC_ALL, __old);
500- free(__old);
501+ setlocale(LC_ALL, __sav);
502+ delete [] __sav;
503 #endif
504 // Make sure __s is null terminated.
505 if (__len == 0)
506Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
507===================================================================
508--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
509+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
510@@ -31,6 +31,9 @@
511
512 #include <bits/c++config.h>
513 #include <clocale>
514+#include <cstdlib>
515+#include <cstring>
516+#include <cstddef>
517
518 #ifdef __UCLIBC_MJN3_ONLY__
519 #warning clean this up
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/301-missing-execinfo_h.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/301-missing-execinfo_h.patch
new file mode 100644
index 0000000000..99bd229d1d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/301-missing-execinfo_h.patch
@@ -0,0 +1,13 @@
1Index: gcc-4.6.0/boehm-gc/include/gc.h
2===================================================================
3--- gcc-4.6.0.orig/boehm-gc/include/gc.h
4+++ gcc-4.6.0/boehm-gc/include/gc.h
5@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
6 #if defined(__linux__) || defined(__GLIBC__)
7 # include <features.h>
8 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
9- && !defined(__ia64__)
10+ && !defined(__ia64__) && !defined(__UCLIBC__)
11 # ifndef GC_HAVE_BUILTIN_BACKTRACE
12 # define GC_HAVE_BUILTIN_BACKTRACE
13 # endif
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/302-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/302-c99-snprintf.patch
new file mode 100644
index 0000000000..9f841ae735
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/302-c99-snprintf.patch
@@ -0,0 +1,13 @@
1Index: gcc-4.6.0/libstdc++-v3/include/c_std/cstdio
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/include/c_std/cstdio
4+++ gcc-4.6.0/libstdc++-v3/include/c_std/cstdio
5@@ -136,7 +136,7 @@ namespace std
6 using ::vsprintf;
7 } // namespace std
8
9-#if _GLIBCXX_USE_C99
10+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
11
12 #undef snprintf
13 #undef vfscanf
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/303-c99-complex-ugly-hack.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/303-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000000..47ae88e6b2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/303-c99-complex-ugly-hack.patch
@@ -0,0 +1,14 @@
1Index: gcc-4.6.0/libstdc++-v3/configure
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/configure
4+++ gcc-4.6.0/libstdc++-v3/configure
5@@ -18302,6 +18302,9 @@ $as_echo_n "checking for ISO C99 support
6 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7 /* end confdefs.h. */
8 #include <complex.h>
9+#ifdef __UCLIBC__
10+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
11+#endif
12 int
13 main ()
14 {
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/304-index_macro.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/304-index_macro.patch
new file mode 100644
index 0000000000..f6eedb3096
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/304-index_macro.patch
@@ -0,0 +1,28 @@
1Index: gcc-4.6.0/libstdc++-v3/include/ext/rope
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/include/ext/rope
4+++ gcc-4.6.0/libstdc++-v3/include/ext/rope
5@@ -54,6 +54,9 @@
6 #include <bits/gthr.h>
7 #include <tr1/functional>
8
9+/* cope w/ index defined as macro, SuSv3 proposal */
10+#undef index
11+
12 # ifdef __GC
13 # define __GC_CONST const
14 # else
15Index: gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
16===================================================================
17--- gcc-4.6.0.orig/libstdc++-v3/include/ext/ropeimpl.h
18+++ gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
19@@ -49,6 +49,9 @@
20 #include <ext/memory> // For uninitialized_copy_n
21 #include <ext/numeric> // For power
22
23+/* cope w/ index defined as macro, SuSv3 proposal */
24+#undef index
25+
26 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
27 {
28 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/305-libmudflap-susv3-legacy.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000000..4cabb36a3a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/305-libmudflap-susv3-legacy.patch
@@ -0,0 +1,49 @@
1Index: gcc-4.6.0/libmudflap/mf-hooks2.c
2===================================================================
3--- gcc-4.6.0.orig/libmudflap/mf-hooks2.c
4+++ gcc-4.6.0/libmudflap/mf-hooks2.c
5@@ -421,7 +421,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
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@@ -431,7 +431,7 @@ WRAPPER2(void, bcopy, const void *src, v
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@@ -441,7 +441,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
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@@ -450,7 +450,7 @@ WRAPPER2(char *, index, const char *s, i
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@@ -459,7 +459,7 @@ WRAPPER2(char *, rindex, const char *s,
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/recipes-devtools/gcc/gcc-4.6.0/306-libstdc++-namespace.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/306-libstdc++-namespace.patch
new file mode 100644
index 0000000000..1fbf043f09
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/306-libstdc++-namespace.patch
@@ -0,0 +1,38 @@
1Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
4+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
5@@ -32,7 +32,8 @@
6 //
7
8 // Written by Benjamin Kosnik <bkoz@redhat.com>
9-
10+namespace std
11+{
12 #ifdef __UCLIBC_MJN3_ONLY__
13 #warning fix prototypes for *textdomain funcs
14 #endif
15@@ -116,3 +117,4 @@
16 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
17 }
18 }
19+}
20Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
21===================================================================
22--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
23+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
24@@ -33,7 +33,8 @@
25 //
26
27 // Written by Benjamin Kosnik <bkoz@redhat.com>
28-
29+namespace std
30+{
31 template<typename _CharT>
32 __timepunct<_CharT>::__timepunct(size_t __refs)
33 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
34@@ -75,3 +76,4 @@
35 delete _M_data;
36 _S_destroy_c_locale(_M_c_locale_timepunct);
37 }
38+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/307-locale_facets.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/307-locale_facets.patch
new file mode 100644
index 0000000000..774fcfa2ca
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/307-locale_facets.patch
@@ -0,0 +1,19 @@
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
7Index: gcc-4.3.1/libstdc++-v3/include/bits/locale_facets.tcc
8===================================================================
9--- gcc-4.3.1.orig/libstdc++-v3/include/bits/locale_facets.tcc 2007-11-26 17:59:41.000000000 -0800
10+++ gcc-4.3.1/libstdc++-v3/include/bits/locale_facets.tcc 2008-08-16 02:14:48.000000000 -0700
11@@ -1004,7 +1004,7 @@
12 const int __cs_size = __fixed ? __max_exp + __prec + 4
13 : __max_digits * 2 + __prec;
14 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
15- __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
16+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
17 __prec, __v);
18 #endif
19
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/602-sdk-libstdc++-includes.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/602-sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..23fce7544d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.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/recipes-devtools/gcc/gcc-4.6.0/64bithack.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/64bithack.patch
new file mode 100644
index 0000000000..11cbbed4a7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/64bithack.patch
@@ -0,0 +1,33 @@
1By default gcc places 64 bit libs in a lib64 directory. This makes it use
2"lib" instead.
3
4RP 25/7/10
5
6Index: gcc-4.6.0/gcc/config/i386/t-linux64
7===================================================================
8--- gcc-4.6.0.orig/gcc/config/i386/t-linux64
9+++ gcc-4.6.0/gcc/config/i386/t-linux64
10@@ -24,8 +24,8 @@
11 # MULTILIB_OSDIRNAMES according to what is found on the target.
12
13 MULTILIB_OPTIONS = m64/m32
14-MULTILIB_DIRNAMES = 64 32
15-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
16+MULTILIB_DIRNAMES = . 32
17+MULTILIB_OSDIRNAMES = . $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
18
19 LIBGCC = stmp-multilib
20 INSTALL_LIBGCC = install-multilib
21Index: gcc-4.6.0/gcc/config/i386/linux64.h
22===================================================================
23--- gcc-4.6.0.orig/gcc/config/i386/linux64.h
24+++ gcc-4.6.0/gcc/config/i386/linux64.h
25@@ -63,7 +63,7 @@ see the files COPYING3 and COPYING.RUNTI
26 done. */
27
28 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
29-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
30+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
31
32 #if TARGET_64BIT_DEFAULT
33 #define SPEC_32 "m32"
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/740-sh-pr24836.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/740-sh-pr24836.patch
new file mode 100644
index 0000000000..89a3934d99
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/740-sh-pr24836.patch
@@ -0,0 +1,29 @@
1http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
2http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
3
4Index: gcc-4.6.0/gcc/configure.ac
5===================================================================
6--- gcc-4.6.0.orig/gcc/configure.ac
7+++ gcc-4.6.0/gcc/configure.ac
8@@ -2926,7 +2926,7 @@ foo: .long 25
9 tls_first_minor=14
10 tls_as_opt="-m64 -Aesame --fatal-warnings"
11 ;;
12- sh-*-* | sh[34]-*-*)
13+ sh-*-* | sh[34]*-*-*)
14 conftest_s='
15 .section ".tdata","awT",@progbits
16 foo: .long 25
17Index: gcc-4.6.0/gcc/configure
18===================================================================
19--- gcc-4.6.0.orig/gcc/configure
20+++ gcc-4.6.0/gcc/configure
21@@ -22756,7 +22756,7 @@ foo: .long 25
22 tls_first_minor=14
23 tls_as_opt="-m64 -Aesame --fatal-warnings"
24 ;;
25- sh-*-* | sh[34]-*-*)
26+ sh-*-* | sh[34]*-*-*)
27 conftest_s='
28 .section ".tdata","awT",@progbits
29 foo: .long 25
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/800-arm-bigendian.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/800-arm-bigendian.patch
new file mode 100644
index 0000000000..50088cfc9f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/800-arm-bigendian.patch
@@ -0,0 +1,34 @@
1By Lennert Buytenhek <buytenh@wantstofly.org>
2Adds support for arm*b-linux* big-endian ARM targets
3
4See http://gcc.gnu.org/PR16350
5
6Index: gcc-4.6.0/gcc/config/arm/linux-elf.h
7===================================================================
8--- gcc-4.6.0.orig/gcc/config/arm/linux-elf.h
9+++ gcc-4.6.0/gcc/config/arm/linux-elf.h
10@@ -51,7 +51,7 @@
11
12 #undef MULTILIB_DEFAULTS
13 #define MULTILIB_DEFAULTS \
14- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
15+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
16
17 /* Now we define the strings used to build the spec file. */
18 #undef LIB_SPEC
19Index: gcc-4.6.0/gcc/config.gcc
20===================================================================
21--- gcc-4.6.0.orig/gcc/config.gcc
22+++ gcc-4.6.0/gcc/config.gcc
23@@ -822,6 +822,11 @@ arm*-*-linux*) # ARM GNU/Linux with EL
24 esac
25 tmake_file="${tmake_file} t-linux arm/t-arm"
26 case ${target} in
27+ arm*b-*)
28+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
29+ ;;
30+ esac
31+ case ${target} in
32 arm*-*-linux-*eabi)
33 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
34 tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h"
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/904-flatten-switch-stmt-00.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/904-flatten-switch-stmt-00.patch
new file mode 100644
index 0000000000..2623313853
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/904-flatten-switch-stmt-00.patch
@@ -0,0 +1,74 @@
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.6.0/gcc/stmt.c
51===================================================================
52--- gcc-4.6.0.orig/gcc/stmt.c
53+++ gcc-4.6.0/gcc/stmt.c
54@@ -2478,7 +2478,11 @@ expand_case (gimple stmt)
55 default code is emitted. */
56
57 use_cost_table = 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 if (default_label)
66 emit_jump (default_label);
67@@ -3046,6 +3050,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,
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000000..8b53b839cf
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,23 @@
1#This patck added --sysroot into COLLECT_GCC_OPTIONS which is used to
2#invoke collect2.
3
4Index: gcc-4.6.0/gcc/gcc.c
5===================================================================
6--- gcc-4.6.0.orig/gcc/gcc.c
7+++ gcc-4.6.0/gcc/gcc.c
8@@ -3948,6 +3948,15 @@ set_collect_gcc_options (void)
9 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
10
11 first_time = TRUE;
12+#ifdef HAVE_LD_SYSROOT
13+ if (target_system_root_changed && target_system_root)
14+ {
15+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
16+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
17+ obstack_grow (&collect_obstack, "'", 1);
18+ first_time = FALSE;
19+ }
20+#endif
21 for (i = 0; (int) i < n_switches; i++)
22 {
23 const char *const *args;
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch
new file mode 100644
index 0000000000..ffb226743d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch
@@ -0,0 +1,33 @@
1# by default c++ include directories are not relative to "--sysroot"
2# which brings one trouble when using the toolchain in an environment
3# where the build directory generating that toolchain doesn't exist,
4# e.g. in sstate, machine specific sysroot and relocatable SDK
5# toolchain. This patch now enables c++ include paths under sysroot.
6# This way it's enough as long as "--sysroot" is correctly enabled
7# in the new environment.
8#
9# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-12-30
10
11Index: gcc-4.6.0/gcc/cppdefault.c
12===================================================================
13--- gcc-4.6.0.orig/gcc/cppdefault.c
14+++ gcc-4.6.0/gcc/cppdefault.c
15@@ -48,15 +48,15 @@ const struct default_include cpp_include
16 = {
17 #ifdef GPLUSPLUS_INCLUDE_DIR
18 /* Pick up GNU C++ generic include files. */
19- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 },
20+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 1, 0 },
21 #endif
22 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
23 /* Pick up GNU C++ target-dependent include files. */
24- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 1 },
25+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 1, 1 },
26 #endif
27 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
28 /* Pick up GNU C++ backward and deprecated include files. */
29- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 0 },
30+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 1, 0 },
31 #endif
32 #ifdef GCC_INCLUDE_DIR
33 /* This is the dir for gcc's private headers. */
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/arm-bswapsi2.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/arm-bswapsi2.patch
new file mode 100644
index 0000000000..7ac61a6d63
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/arm-bswapsi2.patch
@@ -0,0 +1,13 @@
1Index: gcc-4.5/gcc/config/arm/arm.md
2===================================================================
3--- gcc-4.5.orig/gcc/config/arm/arm.md 2010-06-17 09:13:07.000000000 -0700
4+++ gcc-4.5/gcc/config/arm/arm.md 2010-06-22 08:08:45.397212002 -0700
5@@ -11267,7 +11267,7 @@
6 (define_expand "bswapsi2"
7 [(set (match_operand:SI 0 "s_register_operand" "=r")
8 (bswap:SI (match_operand:SI 1 "s_register_operand" "r")))]
9-"TARGET_EITHER"
10+"TARGET_EITHER && (arm_arch6 && !optimize_size)"
11 "
12 if (!arm_arch6)
13 {
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/arm-nolibfloat.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/arm-nolibfloat.patch
new file mode 100644
index 0000000000..217551994c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.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.6.0/gcc/config/arm/linux-elf.h
13===================================================================
14--- gcc-4.6.0.orig/gcc/config/arm/linux-elf.h
15+++ gcc-4.6.0/gcc/config/arm/linux-elf.h
16@@ -60,7 +60,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 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
24
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/arm-softfloat.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/arm-softfloat.patch
new file mode 100644
index 0000000000..908e2d87be
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/arm-softfloat.patch
@@ -0,0 +1,16 @@
1Index: gcc-4.6.0/gcc/config/arm/t-linux
2===================================================================
3--- gcc-4.6.0.orig/gcc/config/arm/t-linux
4+++ gcc-4.6.0/gcc/config/arm/t-linux
5@@ -23,7 +23,10 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
6
7 LIB1ASMSRC = arm/lib1funcs.asm
8 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
9- _arm_addsubdf3 _arm_addsubsf3
10+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
11+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
12+ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf
13+# _arm_addsubdf3 _arm_addsubsf3
14
15 # MULTILIB_OPTIONS = mhard-float/msoft-float
16 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/arm-unbreak-eabi-armv4t.dpatch b/meta/recipes-devtools/gcc/gcc-4.6.0/arm-unbreak-eabi-armv4t.dpatch
new file mode 100644
index 0000000000..7bb8887068
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/arm-unbreak-eabi-armv4t.dpatch
@@ -0,0 +1,36 @@
1#! /bin/sh -e
2
3# DP: Fix armv4t build on ARM
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p1 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26--- src/gcc/config/arm/linux-eabi.h.orig 2007-11-24 12:37:38.000000000 +0000
27+++ src/gcc/config/arm/linux-eabi.h 2007-11-24 12:39:41.000000000 +0000
28@@ -44,7 +44,7 @@
29 The ARM10TDMI core is the default for armv5t, so set
30 SUBTARGET_CPU_DEFAULT to achieve this. */
31 #undef SUBTARGET_CPU_DEFAULT
32-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
33+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
34
35 /* TARGET_BIG_ENDIAN_DEFAULT is set in
36 config.gcc for big endian configurations. */
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/cache-amnesia.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/cache-amnesia.patch
new file mode 100644
index 0000000000..3a98b02cbc
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/cache-amnesia.patch
@@ -0,0 +1,31 @@
1---
2 gcc/configure | 2 +-
3 gcc/configure.ac | 2 +-
4 2 files changed, 2 insertions(+), 2 deletions(-)
5
6Index: gcc-4.6.0/gcc/configure
7===================================================================
8--- gcc-4.6.0.orig/gcc/configure
9+++ gcc-4.6.0/gcc/configure
10@@ -10898,7 +10898,7 @@ else
11 saved_CFLAGS="${CFLAGS}"
12 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
13 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
14- ${realsrcdir}/configure \
15+ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
16 --enable-languages=${enable_languages-all} \
17 --target=$target_alias --host=$build_alias --build=$build_alias
18 CFLAGS="${saved_CFLAGS}"
19Index: gcc-4.6.0/gcc/configure.ac
20===================================================================
21--- gcc-4.6.0.orig/gcc/configure.ac
22+++ gcc-4.6.0/gcc/configure.ac
23@@ -1435,7 +1435,7 @@ else
24 saved_CFLAGS="${CFLAGS}"
25 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
26 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
27- ${realsrcdir}/configure \
28+ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
29 --enable-languages=${enable_languages-all} \
30 --target=$target_alias --host=$build_alias --build=$build_alias
31 CFLAGS="${saved_CFLAGS}"
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/disable_relax_pic_calls_flag.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/disable_relax_pic_calls_flag.patch
new file mode 100644
index 0000000000..4f73cc8ecf
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/disable_relax_pic_calls_flag.patch
@@ -0,0 +1,46 @@
1GCC: disable MASK_RELAX_PIC_CALLS bit
2
3The new feature added after 4.3.3
4"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
5will cause cc1plus eat up all the system memory when build webkit-gtk.
6The function mips_get_pic_call_symbol keeps on recursively calling itself.
7Disable this feature to walk aside the bug.
8
9Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
10
11Index: gcc-4.6.0/gcc/configure
12===================================================================
13--- gcc-4.6.0.orig/gcc/configure
14+++ gcc-4.6.0/gcc/configure
15@@ -24887,13 +24887,6 @@ $as_echo_n "checking assembler and linke
16 rm -f conftest.*
17 fi
18 fi
19- if test $gcc_cv_as_ld_jalr_reloc = yes; then
20- if test x$target_cpu_default = x; then
21- target_cpu_default=MASK_RELAX_PIC_CALLS
22- else
23- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
24- fi
25- fi
26 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
27 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
28
29Index: gcc-4.6.0/gcc/configure.ac
30===================================================================
31--- gcc-4.6.0.orig/gcc/configure.ac
32+++ gcc-4.6.0/gcc/configure.ac
33@@ -3764,13 +3764,6 @@ x:
34 rm -f conftest.*
35 fi
36 fi
37- if test $gcc_cv_as_ld_jalr_reloc = yes; then
38- if test x$target_cpu_default = x; then
39- target_cpu_default=MASK_RELAX_PIC_CALLS
40- else
41- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
42- fi
43- fi
44 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
45
46 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..348c77006f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.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
5Index: gcc-4.5+svnr155514/libgfortran/configure
6===================================================================
7--- gcc-4.5+svnr155514.orig/libgfortran/configure 2009-12-29 22:02:01.000000000 -0800
8+++ gcc-4.5+svnr155514/libgfortran/configure 2009-12-30 08:12:40.889091657 -0800
9@@ -11655,7 +11655,7 @@ CC="$lt_save_CC"
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=${ac_fc_srcext-f}
16 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
17 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
18Index: gcc-4.5+svnr155514/libgfortran/configure.ac
19===================================================================
20--- gcc-4.5+svnr155514.orig/libgfortran/configure.ac 2009-12-29 22:02:01.000000000 -0800
21+++ gcc-4.5+svnr155514/libgfortran/configure.ac 2009-12-30 08:12:13.453094218 -0800
22@@ -187,7 +187,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/recipes-devtools/gcc/gcc-4.6.0/gcc-4.0.2-e300c2c3.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.0.2-e300c2c3.patch
new file mode 100644
index 0000000000..d1df8b2716
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.0.2-e300c2c3.patch
@@ -0,0 +1,319 @@
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
6---
7 gcc/config.gcc | 2
8 gcc/config/rs6000/e300c2c3.md | 189 ++++++++++++++++++++++++++++++++++++++++++
9 gcc/config/rs6000/rs6000.c | 24 +++++
10 gcc/config/rs6000/rs6000.h | 4
11 gcc/config/rs6000/rs6000.md | 3
12 5 files changed, 220 insertions(+), 2 deletions(-)
13
14Index: gcc-4.3.1/gcc/config/rs6000/e300c2c3.md
15===================================================================
16--- /dev/null 1970-01-01 00:00:00.000000000 +0000
17+++ gcc-4.3.1/gcc/config/rs6000/e300c2c3.md 2008-08-23 16:51:33.000000000 -0700
18@@ -0,0 +1,189 @@
19+;; Pipeline description for Motorola PowerPC e300c3 core.
20+;; Copyright (C) 2003 Free Software Foundation, Inc.
21+;;
22+;; This file is part of GCC.
23+
24+;; GCC is free software; you can redistribute it and/or modify it
25+;; under the terms of the GNU General Public License as published
26+;; by the Free Software Foundation; either version 2, or (at your
27+;; option) any later version.
28+
29+;; GCC is distributed in the hope that it will be useful, but WITHOUT
30+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
31+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
32+;; License for more details.
33+
34+;; You should have received a copy of the GNU General Public License
35+;; along with GCC; see the file COPYING. If not, write to the
36+;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
37+;; MA 02111-1307, USA.
38+
39+(define_automaton "ppce300c3_most,ppce300c3_long,ppce300c3_retire")
40+(define_cpu_unit "ppce300c3_decode_0,ppce300c3_decode_1" "ppce300c3_most")
41+
42+;; We don't simulate general issue queue (GIC). If we have SU insn
43+;; and then SU1 insn, they can not be issued on the same cycle
44+;; (although SU1 insn and then SU insn can be issued) because the SU
45+;; insn will go to SU1 from GIC0 entry. Fortunately, the first cycle
46+;; multipass insn scheduling will find the situation and issue the SU1
47+;; insn and then the SU insn.
48+(define_cpu_unit "ppce300c3_issue_0,ppce300c3_issue_1" "ppce300c3_most")
49+
50+;; We could describe completion buffers slots in combination with the
51+;; retirement units and the order of completion but the result
52+;; automaton would behave in the same way because we can not describe
53+;; real latency time with taking in order completion into account.
54+;; Actually we could define the real latency time by querying reserved
55+;; automaton units but the current scheduler uses latency time before
56+;; issuing insns and making any reservations.
57+;;
58+;; So our description is aimed to achieve a insn schedule in which the
59+;; insns would not wait in the completion buffer.
60+(define_cpu_unit "ppce300c3_retire_0,ppce300c3_retire_1" "ppce300c3_retire")
61+
62+;; Branch unit:
63+(define_cpu_unit "ppce300c3_bu" "ppce300c3_most")
64+
65+;; IU:
66+(define_cpu_unit "ppce300c3_iu0_stage0,ppce300c3_iu1_stage0" "ppce300c3_most")
67+
68+;; IU: This used to describe non-pipelined division.
69+(define_cpu_unit "ppce300c3_mu_div" "ppce300c3_long")
70+
71+;; SRU:
72+(define_cpu_unit "ppce300c3_sru_stage0" "ppce300c3_most")
73+
74+;; Here we simplified LSU unit description not describing the stages.
75+(define_cpu_unit "ppce300c3_lsu" "ppce300c3_most")
76+
77+;; FPU:
78+(define_cpu_unit "ppce300c3_fpu" "ppce300c3_most")
79+
80+;; The following units are used to make automata deterministic
81+(define_cpu_unit "present_ppce300c3_decode_0" "ppce300c3_most")
82+(define_cpu_unit "present_ppce300c3_issue_0" "ppce300c3_most")
83+(define_cpu_unit "present_ppce300c3_retire_0" "ppce300c3_retire")
84+(define_cpu_unit "present_ppce300c3_iu0_stage0" "ppce300c3_most")
85+
86+;; The following sets to make automata deterministic when option ndfa is used.
87+(presence_set "present_ppce300c3_decode_0" "ppce300c3_decode_0")
88+(presence_set "present_ppce300c3_issue_0" "ppce300c3_issue_0")
89+(presence_set "present_ppce300c3_retire_0" "ppce300c3_retire_0")
90+(presence_set "present_ppce300c3_iu0_stage0" "ppce300c3_iu0_stage0")
91+
92+;; Some useful abbreviations.
93+(define_reservation "ppce300c3_decode"
94+ "ppce300c3_decode_0|ppce300c3_decode_1+present_ppce300c3_decode_0")
95+(define_reservation "ppce300c3_issue"
96+ "ppce300c3_issue_0|ppce300c3_issue_1+present_ppce300c3_issue_0")
97+(define_reservation "ppce300c3_retire"
98+ "ppce300c3_retire_0|ppce300c3_retire_1+present_ppce300c3_retire_0")
99+(define_reservation "ppce300c3_iu_stage0"
100+ "ppce300c3_iu0_stage0|ppce300c3_iu1_stage0+present_ppce300c3_iu0_stage0")
101+
102+;; Compares can be executed either one of the IU or SRU
103+(define_insn_reservation "ppce300c3_cmp" 1
104+ (and (eq_attr "type" "cmp,compare,delayed_compare,fast_compare")
105+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
106+ "ppce300c3_decode,ppce300c3_issue+(ppce300c3_iu_stage0|ppce300c3_sru_stage0) \
107+ +ppce300c3_retire")
108+
109+;; Other one cycle IU insns
110+(define_insn_reservation "ppce300c3_iu" 1
111+ (and (eq_attr "type" "integer,insert_word")
112+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
113+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_retire")
114+
115+;; Branch. Actually this latency time is not used by the scheduler.
116+(define_insn_reservation "ppce300c3_branch" 1
117+ (and (eq_attr "type" "jmpreg,branch")
118+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
119+ "ppce300c3_decode,ppce300c3_bu,ppce300c3_retire")
120+
121+;; Multiply is non-pipelined but can be executed in any IU
122+(define_insn_reservation "ppce300c3_multiply" 2
123+ (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
124+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
125+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0, \
126+ ppce300c3_iu_stage0+ppce300c3_retire")
127+
128+;; Divide. We use the average latency time here. We omit reserving a
129+;; retire unit because of the result automata will be huge.
130+(define_insn_reservation "ppce300c3_divide" 20
131+ (and (eq_attr "type" "idiv")
132+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
133+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_mu_div,\
134+ ppce300c3_mu_div*19")
135+
136+;; CR logical
137+(define_insn_reservation "ppce300c3_cr_logical" 1
138+ (and (eq_attr "type" "cr_logical,delayed_cr")
139+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
140+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
141+
142+;; Mfcr
143+(define_insn_reservation "ppce300c3_mfcr" 1
144+ (and (eq_attr "type" "mfcr")
145+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
146+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
147+
148+;; Mtcrf
149+(define_insn_reservation "ppce300c3_mtcrf" 1
150+ (and (eq_attr "type" "mtcr")
151+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
152+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
153+
154+;; Mtjmpr
155+(define_insn_reservation "ppce300c3_mtjmpr" 1
156+ (and (eq_attr "type" "mtjmpr,mfjmpr")
157+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
158+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
159+
160+;; Float point instructions
161+(define_insn_reservation "ppce300c3_fpcompare" 3
162+ (and (eq_attr "type" "fpcompare")
163+ (eq_attr "cpu" "ppce300c3"))
164+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire")
165+
166+(define_insn_reservation "ppce300c3_fp" 3
167+ (and (eq_attr "type" "fp")
168+ (eq_attr "cpu" "ppce300c3"))
169+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire")
170+
171+(define_insn_reservation "ppce300c3_dmul" 4
172+ (and (eq_attr "type" "dmul")
173+ (eq_attr "cpu" "ppce300c3"))
174+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu,nothing,ppce300c3_retire")
175+
176+; Divides are not pipelined
177+(define_insn_reservation "ppce300c3_sdiv" 18
178+ (and (eq_attr "type" "sdiv")
179+ (eq_attr "cpu" "ppce300c3"))
180+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*17")
181+
182+(define_insn_reservation "ppce300c3_ddiv" 33
183+ (and (eq_attr "type" "ddiv")
184+ (eq_attr "cpu" "ppce300c3"))
185+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*32")
186+
187+;; Loads
188+(define_insn_reservation "ppce300c3_load" 2
189+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u")
190+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
191+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
192+
193+(define_insn_reservation "ppce300c3_fpload" 2
194+ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
195+ (eq_attr "cpu" "ppce300c3"))
196+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
197+
198+;; Stores.
199+(define_insn_reservation "ppce300c3_store" 2
200+ (and (eq_attr "type" "store,store_ux,store_u")
201+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
202+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
203+
204+(define_insn_reservation "ppce300c3_fpstore" 2
205+ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
206+ (eq_attr "cpu" "ppce300c3"))
207+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
208Index: gcc-4.3.1/gcc/config/rs6000/rs6000.c
209===================================================================
210--- gcc-4.3.1.orig/gcc/config/rs6000/rs6000.c 2008-08-23 16:49:39.000000000 -0700
211+++ gcc-4.3.1/gcc/config/rs6000/rs6000.c 2008-08-23 16:54:25.000000000 -0700
212@@ -669,6 +669,21 @@ struct processor_costs ppc8540_cost = {
213 1, /* prefetch streams /*/
214 };
215
216+/* Instruction costs on E300C2 and E300C3 cores. */
217+static const
218+struct processor_costs ppce300c2c3_cost = {
219+ COSTS_N_INSNS (4), /* mulsi */
220+ COSTS_N_INSNS (4), /* mulsi_const */
221+ COSTS_N_INSNS (4), /* mulsi_const9 */
222+ COSTS_N_INSNS (4), /* muldi */
223+ COSTS_N_INSNS (19), /* divsi */
224+ COSTS_N_INSNS (19), /* divdi */
225+ COSTS_N_INSNS (3), /* fp */
226+ COSTS_N_INSNS (4), /* dmul */
227+ COSTS_N_INSNS (18), /* sdiv */
228+ COSTS_N_INSNS (33), /* ddiv */
229+};
230+
231 /* Instruction costs on POWER4 and POWER5 processors. */
232 static const
233 struct processor_costs power4_cost = {
234@@ -1420,6 +1435,8 @@ rs6000_override_options (const char *def
235 {"8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN},
236 /* 8548 has a dummy entry for now. */
237 {"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN},
238+ {"e300c2", PROCESSOR_PPCE300C2, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
239+ {"e300c3", PROCESSOR_PPCE300C3, POWERPC_BASE_MASK},
240 {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
241 {"970", PROCESSOR_POWER4,
242 POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
243@@ -1845,6 +1862,11 @@ rs6000_override_options (const char *def
244 rs6000_cost = &ppc8540_cost;
245 break;
246
247+ case PROCESSOR_PPCE300C2:
248+ case PROCESSOR_PPCE300C3:
249+ rs6000_cost = &ppce300c2c3_cost;
250+ break;
251+
252 case PROCESSOR_POWER4:
253 case PROCESSOR_POWER5:
254 rs6000_cost = &power4_cost;
255@@ -18606,6 +18628,8 @@ rs6000_issue_rate (void)
256 case CPU_PPC7400:
257 case CPU_PPC8540:
258 case CPU_CELL:
259+ case CPU_PPCE300C2:
260+ case CPU_PPCE300C3:
261 return 2;
262 case CPU_RIOS2:
263 case CPU_PPC604:
264Index: gcc-4.3.1/gcc/config/rs6000/rs6000.h
265===================================================================
266--- gcc-4.3.1.orig/gcc/config/rs6000/rs6000.h 2008-01-26 09:18:35.000000000 -0800
267+++ gcc-4.3.1/gcc/config/rs6000/rs6000.h 2008-08-23 16:55:30.000000000 -0700
268@@ -117,6 +117,8 @@
269 %{mcpu=G5: -mpower4 -maltivec} \
270 %{mcpu=8540: -me500} \
271 %{mcpu=8548: -me500} \
272+%{mcpu=e300c2: -mppc} \
273+%{mcpu=e300c3: -mppc -mpmr} \
274 %{maltivec: -maltivec} \
275 -many"
276
277@@ -262,6 +264,8 @@ enum processor_type
278 PROCESSOR_PPC7400,
279 PROCESSOR_PPC7450,
280 PROCESSOR_PPC8540,
281+ PROCESSOR_PPCE300C2,
282+ PROCESSOR_PPCE300C3,
283 PROCESSOR_POWER4,
284 PROCESSOR_POWER5,
285 PROCESSOR_POWER6,
286Index: gcc-4.3.1/gcc/config/rs6000/rs6000.md
287===================================================================
288--- gcc-4.3.1.orig/gcc/config/rs6000/rs6000.md 2008-02-13 16:14:45.000000000 -0800
289+++ gcc-4.3.1/gcc/config/rs6000/rs6000.md 2008-08-23 16:57:29.000000000 -0700
290@@ -133,7 +133,7 @@
291 ;; Processor type -- this attribute must exactly match the processor_type
292 ;; enumeration in rs6000.h.
293
294-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell"
295+(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell,ppce300c2,ppce300c3"
296 (const (symbol_ref "rs6000_cpu_attr")))
297
298
299@@ -166,6 +166,7 @@
300 (include "7xx.md")
301 (include "7450.md")
302 (include "8540.md")
303+(include "e300c2c3.md")
304 (include "power4.md")
305 (include "power5.md")
306 (include "power6.md")
307Index: gcc-4.3.1/gcc/config.gcc
308===================================================================
309--- gcc-4.3.1.orig/gcc/config.gcc 2008-08-23 16:49:43.000000000 -0700
310+++ gcc-4.3.1/gcc/config.gcc 2008-08-23 17:03:55.000000000 -0700
311@@ -3144,7 +3144,7 @@ case "${target}" in
312 | rios | rios1 | rios2 | rsc | rsc1 | rs64a \
313 | 401 | 403 | 405 | 405fp | 440 | 440fp | 505 \
314 | 601 | 602 | 603 | 603e | ec603e | 604 \
315- | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
316+ | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 | e300c[23] \
317 | 854[08] | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
318 # OK
319 ;;
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..d249c1c158
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,31 @@
1---
2 configure | 2 +-
3 configure.ac | 2 +-
4 2 files changed, 2 insertions(+), 2 deletions(-)
5
6Index: gcc-4.6.0/configure.ac
7===================================================================
8--- gcc-4.6.0.orig/configure.ac
9+++ gcc-4.6.0/configure.ac
10@@ -3073,7 +3073,7 @@ fi
11 # for target_alias and gcc doesn't manage it consistently.
12 target_configargs="--cache-file=./config.cache ${target_configargs}"
13
14-FLAGS_FOR_TARGET=
15+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
16 case " $target_configdirs " in
17 *" newlib "*)
18 case " $target_configargs " in
19Index: gcc-4.6.0/configure
20===================================================================
21--- gcc-4.6.0.orig/configure
22+++ gcc-4.6.0/configure
23@@ -7594,7 +7594,7 @@ fi
24 # for target_alias and gcc doesn't manage it consistently.
25 target_configargs="--cache-file=./config.cache ${target_configargs}"
26
27-FLAGS_FOR_TARGET=
28+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
29 case " $target_configdirs " in
30 *" newlib "*)
31 case " $target_configargs " in
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..428dd08d59
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,114 @@
1Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
2
3This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
4
5Other changes I had to do include:
6
7- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
8
9- passing the right CFLAGS to configure scripts as exported environment variables
10
11I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
12
13Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
14
15Paolo
16
172008-02-19 Paolo Bonzini <bonzini@gnu.org>
18
19 PR bootstrap/32009
20 PR bootstrap/32161
21
22 * configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Compute here.
23 * configure: Regenerate.
24
25 * Makefile.def: Define stage_libcflags for all bootstrap stages.
26 * Makefile.tpl (BOOT_LIBCFLAGS, STAGE2_LIBCFLAGS, STAGE3_LIBCFLAGS,
27 STAGE4_LIBCFLAGS): New.
28 (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Subst from autoconf, without
29 $(SYSROOT_CFLAGS_FOR_TARGET) and $(DEBUG_PREFIX_CFLAGS_FOR_TARGET).
30 (BASE_TARGET_EXPORTS): Append them here to C{,XX}FLAGS.
31 (EXTRA_TARGET_FLAGS): Append them here to {LIB,}C{,XX}FLAGS.
32 (configure-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags
33 for target modules. Don't export LIBCFLAGS.
34 (all-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags; pass
35 $(BASE_FLAGS_TO_PASS) where [+args+] was passed, and [+args+] after
36 the overridden CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
37 (invocations of `all'): Replace $(TARGET_FLAGS_TO_PASS) with
38 $(EXTRA_TARGET_FLAGS), $(FLAGS_TO_PASS) with $(EXTRA_HOST_FLAGS).
39 * Makefile.in: Regenerate.
40
41config:
422008-02-19 Paolo Bonzini <bonzini@gnu.org>
43
44 PR bootstrap/32009
45 * mh-ppc-darwin (BOOT_CFLAGS): Reenable.
46
47gcc:
482008-02-19 Paolo Bonzini <bonzini@gnu.org>
49
50 PR bootstrap/32009
51 * doc/install.texi: Correct references to CFLAGS, replacing them
52 with BOOT_CFLAGS. Document flags used during bootstrap for
53 target libraries.
54
55
56---
57 Makefile.def | 25
58 Makefile.in | 1845 ++++++++++++++++++++++++++++++-------------------
59 Makefile.tpl | 91 +-
60 config/mh-ppc-darwin | 3
61 configure | 36
62 configure.ac | 32
63 gcc/Makefile.in | 2
64 gcc/configure | 6
65 gcc/configure.ac | 3
66 gcc/doc/install.texi | 56 -
67 libiberty/Makefile.in | 162 ++--
68 libiberty/configure | 46 -
69 libiberty/configure.ac | 43 -
70 13 files changed, 1454 insertions(+), 896 deletions(-)
71
72Index: gcc-4.6.0/configure
73===================================================================
74--- gcc-4.6.0.orig/configure
75+++ gcc-4.6.0/configure
76@@ -6785,6 +6785,38 @@ if test "x$CXXFLAGS_FOR_TARGET" = x; the
77 fi
78
79
80+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
81+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
82+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
83+# We want to ensure that TARGET libraries (which we know are built with
84+# gcc) are built with "-O2 -g", so include those options when setting
85+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
86+if test "x$CFLAGS_FOR_TARGET" = x; then
87+ CFLAGS_FOR_TARGET=$CFLAGS
88+ case " $CFLAGS " in
89+ *" -O2 "*) ;;
90+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
91+ esac
92+ case " $CFLAGS " in
93+ *" -g "* | *" -g3 "*) ;;
94+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
95+ esac
96+fi
97+
98+
99+if test "x$CXXFLAGS_FOR_TARGET" = x; then
100+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
101+ case " $CXXFLAGS " in
102+ *" -O2 "*) ;;
103+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
104+ esac
105+ case " $CXXFLAGS " in
106+ *" -g "* | *" -g3 "*) ;;
107+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
108+ esac
109+fi
110+
111+
112 # Handle --with-headers=XXX. If the value is not "yes", the contents of
113 # the named directory are copied to $(tooldir)/sys-include.
114 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-arm-frename-registers.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-arm-frename-registers.patch
new file mode 100644
index 0000000000..280b90358e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-arm-frename-registers.patch
@@ -0,0 +1,25 @@
1http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35964
2Index: gcc-4.3.0/gcc/regrename.c
3===================================================================
4--- gcc-4.3.0.orig/gcc/regrename.c 2008-05-28 08:31:15.000000000 -0700
5+++ gcc-4.3.0/gcc/regrename.c 2008-05-28 08:34:00.000000000 -0700
6@@ -782,6 +782,10 @@
7 || (predicated && recog_data.operand_type[i] == OP_OUT))
8 recog_data.operand_type[i] = OP_INOUT;
9 }
10+ /* Unshare dup_loc RTL */
11+ for (i = 0; i < recog_data.n_dups; i++)
12+ *recog_data.dup_loc[i] = copy_rtx(*recog_data.dup_loc[i]);
13+
14
15 /* Step 1: Close chains for which we have overlapping reads. */
16 for (i = 0; i < n_ops; i++)
17@@ -813,7 +817,7 @@
18 OP_IN, 0);
19
20 for (i = 0; i < recog_data.n_dups; i++)
21- *recog_data.dup_loc[i] = copy_rtx (old_dups[i]);
22+ *recog_data.dup_loc[i] = old_dups[i];
23 for (i = 0; i < n_ops; i++)
24 *recog_data.operand_loc[i] = old_operands[i];
25 if (recog_data.n_dups)
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-flags-for-build.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-flags-for-build.patch
new file mode 100644
index 0000000000..f7beb7826f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-flags-for-build.patch
@@ -0,0 +1,178 @@
1Index: gcc-4.6.0/Makefile.def
2===================================================================
3--- gcc-4.6.0.orig/Makefile.def
4+++ gcc-4.6.0/Makefile.def
5@@ -243,6 +243,7 @@ flags_to_pass = { flag= AWK ; };
6 flags_to_pass = { flag= BISON ; };
7 flags_to_pass = { flag= CC_FOR_BUILD ; };
8 flags_to_pass = { flag= CFLAGS_FOR_BUILD ; };
9+flags_to_pass = { flag= CPPFLAGS_FOR_BUILD ; };
10 flags_to_pass = { flag= CXX_FOR_BUILD ; };
11 flags_to_pass = { flag= EXPECT ; };
12 flags_to_pass = { flag= FLEX ; };
13Index: gcc-4.6.0/gcc/Makefile.in
14===================================================================
15--- gcc-4.6.0.orig/gcc/Makefile.in
16+++ gcc-4.6.0/gcc/Makefile.in
17@@ -770,7 +770,7 @@ BUILD_LINKERFLAGS = $(BUILD_CFLAGS)
18
19 # Native linker and preprocessor flags. For x-fragment overrides.
20 BUILD_LDFLAGS=@BUILD_LDFLAGS@
21-BUILD_CPPFLAGS=$(ALL_CPPFLAGS)
22+BUILD_CPPFLAGS=$(INCLUDES) @BUILD_CPPFLAGS@ $(X_CPPFLAGS)
23
24 # Actual name to use when installing a native compiler.
25 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
26Index: gcc-4.6.0/gcc/configure.ac
27===================================================================
28--- gcc-4.6.0.orig/gcc/configure.ac
29+++ gcc-4.6.0/gcc/configure.ac
30@@ -1784,16 +1784,18 @@ AC_SUBST(inhibit_libc)
31 # Also, we cannot run fixincludes.
32
33 # These are the normal (build=host) settings:
34-CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
35-BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
36-BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
37-STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
38+CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
39+BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
40+BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
41+BUILD_CPPFLAGS='$(ALL_CPPFLAGS)' AC_SUBST(BUILD_CPPFLAGS)
42+STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
43
44 # And these apply if build != host, or we are generating coverage data
45 if test x$build != x$host || test "x$coverage_flags" != x
46 then
47 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
48 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
49+ BUILD_CPPFLAGS='$(CPPFLAGS_FOR_BUILD)'
50 fi
51
52 # Expand extra_headers to include complete path.
53Index: gcc-4.6.0/Makefile.in
54===================================================================
55--- gcc-4.6.0.orig/Makefile.in
56+++ gcc-4.6.0/Makefile.in
57@@ -338,6 +338,7 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
58 AS_FOR_BUILD = @AS_FOR_BUILD@
59 CC_FOR_BUILD = @CC_FOR_BUILD@
60 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
61+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
62 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
63 CXX_FOR_BUILD = @CXX_FOR_BUILD@
64 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
65@@ -691,6 +692,7 @@ BASE_FLAGS_TO_PASS = \
66 "BISON=$(BISON)" \
67 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
68 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
69+ "CPPFLAGS_FOR_BUILD=$(CPPFLAGS_FOR_BUILD)" \
70 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
71 "EXPECT=$(EXPECT)" \
72 "FLEX=$(FLEX)" \
73Index: gcc-4.6.0/gcc/configure
74===================================================================
75--- gcc-4.6.0.orig/gcc/configure
76+++ gcc-4.6.0/gcc/configure
77@@ -703,6 +703,7 @@ SED
78 LIBTOOL
79 collect2
80 STMP_FIXINC
81+BUILD_CPPFLAGS
82 BUILD_LDFLAGS
83 BUILD_CFLAGS
84 CC_FOR_BUILD
85@@ -11382,6 +11383,7 @@ fi
86 CC_FOR_BUILD='$(CC)'
87 BUILD_CFLAGS='$(ALL_CFLAGS)'
88 BUILD_LDFLAGS='$(LDFLAGS)'
89+BUILD_CPPFLAGS='$(ALL_CPPFLAGS)'
90 STMP_FIXINC=stmp-fixinc
91
92 # And these apply if build != host, or we are generating coverage data
93@@ -11389,6 +11391,7 @@ if test x$build != x$host || test "x$cov
94 then
95 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
96 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
97+ BUILD_CPPFLAGS='$(CPPFLAGS_FOR_BUILD)'
98 fi
99
100 # Expand extra_headers to include complete path.
101@@ -17505,7 +17508,7 @@ else
102 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
103 lt_status=$lt_dlunknown
104 cat > conftest.$ac_ext <<_LT_EOF
105-#line 17508 "configure"
106+#line 17511 "configure"
107 #include "confdefs.h"
108
109 #if HAVE_DLFCN_H
110@@ -17611,7 +17614,7 @@ else
111 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
112 lt_status=$lt_dlunknown
113 cat > conftest.$ac_ext <<_LT_EOF
114-#line 17614 "configure"
115+#line 17617 "configure"
116 #include "confdefs.h"
117
118 #if HAVE_DLFCN_H
119Index: gcc-4.6.0/Makefile.tpl
120===================================================================
121--- gcc-4.6.0.orig/Makefile.tpl
122+++ gcc-4.6.0/Makefile.tpl
123@@ -341,6 +341,7 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
124 AS_FOR_BUILD = @AS_FOR_BUILD@
125 CC_FOR_BUILD = @CC_FOR_BUILD@
126 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
127+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
128 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
129 CXX_FOR_BUILD = @CXX_FOR_BUILD@
130 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
131Index: gcc-4.6.0/configure.ac
132===================================================================
133--- gcc-4.6.0.orig/configure.ac
134+++ gcc-4.6.0/configure.ac
135@@ -3154,6 +3154,7 @@ esac
136 # our build compiler if desired.
137 if test x"${build}" = x"${host}" ; then
138 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
139+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
140 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
141 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
142 fi
143@@ -3220,6 +3221,7 @@ AC_SUBST(AR_FOR_BUILD)
144 AC_SUBST(AS_FOR_BUILD)
145 AC_SUBST(CC_FOR_BUILD)
146 AC_SUBST(CFLAGS_FOR_BUILD)
147+AC_SUBST(CPPFLAGS_FOR_BUILD)
148 AC_SUBST(CXXFLAGS_FOR_BUILD)
149 AC_SUBST(CXX_FOR_BUILD)
150 AC_SUBST(DLLTOOL_FOR_BUILD)
151Index: gcc-4.6.0/configure
152===================================================================
153--- gcc-4.6.0.orig/configure
154+++ gcc-4.6.0/configure
155@@ -617,6 +617,7 @@ GCJ_FOR_BUILD
156 DLLTOOL_FOR_BUILD
157 CXX_FOR_BUILD
158 CXXFLAGS_FOR_BUILD
159+CPPFLAGS_FOR_BUILD
160 CFLAGS_FOR_BUILD
161 CC_FOR_BUILD
162 AS_FOR_BUILD
163@@ -7675,6 +7676,7 @@ esac
164 # our build compiler if desired.
165 if test x"${build}" = x"${host}" ; then
166 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
167+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
168 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
169 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
170 fi
171@@ -7740,6 +7742,7 @@ done
172
173
174
175+
176
177
178
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-ice-hack.dpatch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-ice-hack.dpatch
new file mode 100644
index 0000000000..84c5ef2ebd
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-ice-hack.dpatch
@@ -0,0 +1,331 @@
1#! /bin/sh -e
2
3# DP: Retry the build on an ice, save the calling options and preprocessed
4# DP: source when the ice is reproducible.
5
6dir=
7if [ $# -eq 3 -a "$2" = '-d' ]; then
8 pdir="-d $3"
9 dir="$3/"
10elif [ $# -ne 1 ]; then
11 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
12 exit 1
13fi
14case "$1" in
15 -patch)
16 patch $pdir -f --no-backup-if-mismatch -p0 < $0
17 ;;
18 -unpatch)
19 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
20 ;;
21 *)
22 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
23 exit 1
24esac
25exit 0
26
272004-01-23 Jakub Jelinek <jakub@redhat.com>
28
29 * system.h (ICE_EXIT_CODE): Define.
30 * gcc.c (execute): Don't free first string early, but at the end
31 of the function. Call retry_ice if compiler exited with
32 ICE_EXIT_CODE.
33 (retry_ice): New function.
34 * diagnostic.c (diagnostic_count_diagnostic,
35 diagnostic_action_after_output, error_recursion): Exit with
36 ICE_EXIT_CODE instead of FATAL_EXIT_CODE.
37
38--- gcc/diagnostic.c.orig 2007-09-30 10:48:13.000000000 +0000
39+++ gcc/diagnostic.c 2007-09-30 10:49:57.000000000 +0000
40@@ -244,7 +244,7 @@
41 fnotice (stderr, "Please submit a full bug report,\n"
42 "with preprocessed source if appropriate.\n"
43 "See %s for instructions.\n", bug_report_url);
44- exit (ICE_EXIT_CODE);
45+ exit (FATAL_EXIT_CODE);
46
47 case DK_FATAL:
48 if (context->abort_on_error)
49--- gcc/gcc.c.orig 2007-09-30 10:48:13.000000000 +0000
50+++ gcc/gcc.c 2007-09-30 10:48:39.000000000 +0000
51@@ -357,6 +357,9 @@
52 #if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
53 static const char *convert_filename (const char *, int, int);
54 #endif
55+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
56+static void retry_ice (const char *prog, const char **argv);
57+#endif
58
59 static const char *getenv_spec_function (int, const char **);
60 static const char *if_exists_spec_function (int, const char **);
61@@ -2999,7 +3002,7 @@
62 }
63 }
64
65- if (string != commands[i].prog)
66+ if (i && string != commands[i].prog)
67 free (CONST_CAST (char *, string));
68 }
69
70@@ -3056,6 +3059,16 @@
71 else if (WIFEXITED (status)
72 && WEXITSTATUS (status) >= MIN_FATAL_STATUS)
73 {
74+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
75+ /* For ICEs in cc1, cc1obj, cc1plus see if it is
76+ reproducible or not. */
77+ char *p;
78+ if (WEXITSTATUS (status) == ICE_EXIT_CODE
79+ && i == 0
80+ && (p = strrchr (commands[0].argv[0], DIR_SEPARATOR))
81+ && ! strncmp (p + 1, "cc1", 3))
82+ retry_ice (commands[0].prog, commands[0].argv);
83+#endif
84 if (WEXITSTATUS (status) > greatest_status)
85 greatest_status = WEXITSTATUS (status);
86 ret_code = -1;
87@@ -3076,6 +3089,9 @@
88 }
89 }
90
91+ if (commands[0].argv[0] != commands[0].prog)
92+ free ((PTR) commands[0].argv[0]);
93+
94 return ret_code;
95 }
96 }
97@@ -6016,6 +6032,224 @@
98 switches[switchnum].validated = 1;
99 }
100
101+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
102+#define RETRY_ICE_ATTEMPTS 2
103+
104+static void
105+retry_ice (const char *prog, const char **argv)
106+{
107+ int nargs, out_arg = -1, quiet = 0, attempt;
108+ int pid, retries, sleep_interval;
109+ const char **new_argv;
110+ char *temp_filenames[RETRY_ICE_ATTEMPTS * 2 + 2];
111+
112+ if (input_filename == NULL || ! strcmp (input_filename, "-"))
113+ return;
114+
115+ for (nargs = 0; argv[nargs] != NULL; ++nargs)
116+ /* Only retry compiler ICEs, not preprocessor ones. */
117+ if (! strcmp (argv[nargs], "-E"))
118+ return;
119+ else if (argv[nargs][0] == '-' && argv[nargs][1] == 'o')
120+ {
121+ if (out_arg == -1)
122+ out_arg = nargs;
123+ else
124+ return;
125+ }
126+ /* If the compiler is going to output any time information,
127+ it might vary between invocations. */
128+ else if (! strcmp (argv[nargs], "-quiet"))
129+ quiet = 1;
130+ else if (! strcmp (argv[nargs], "-ftime-report"))
131+ return;
132+
133+ if (out_arg == -1 || !quiet)
134+ return;
135+
136+ memset (temp_filenames, '\0', sizeof (temp_filenames));
137+ new_argv = alloca ((nargs + 3) * sizeof (const char *));
138+ memcpy (new_argv, argv, (nargs + 1) * sizeof (const char *));
139+ new_argv[nargs++] = "-frandom-seed=0";
140+ new_argv[nargs] = NULL;
141+ if (new_argv[out_arg][2] == '\0')
142+ new_argv[out_arg + 1] = "-";
143+ else
144+ new_argv[out_arg] = "-o-";
145+
146+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS + 1; ++attempt)
147+ {
148+ int fd = -1;
149+ int status;
150+
151+ temp_filenames[attempt * 2] = make_temp_file (".out");
152+ temp_filenames[attempt * 2 + 1] = make_temp_file (".err");
153+
154+ if (attempt == RETRY_ICE_ATTEMPTS)
155+ {
156+ int i;
157+ int fd1, fd2;
158+ struct stat st1, st2;
159+ size_t n, len;
160+ char *buf;
161+
162+ buf = xmalloc (8192);
163+
164+ for (i = 0; i < 2; ++i)
165+ {
166+ fd1 = open (temp_filenames[i], O_RDONLY);
167+ fd2 = open (temp_filenames[2 + i], O_RDONLY);
168+
169+ if (fd1 < 0 || fd2 < 0)
170+ {
171+ i = -1;
172+ close (fd1);
173+ close (fd2);
174+ break;
175+ }
176+
177+ if (fstat (fd1, &st1) < 0 || fstat (fd2, &st2) < 0)
178+ {
179+ i = -1;
180+ close (fd1);
181+ close (fd2);
182+ break;
183+ }
184+
185+ if (st1.st_size != st2.st_size)
186+ {
187+ close (fd1);
188+ close (fd2);
189+ break;
190+ }
191+
192+ len = 0;
193+ for (n = st1.st_size; n; n -= len)
194+ {
195+ len = n;
196+ if (len > 4096)
197+ len = 4096;
198+
199+ if (read (fd1, buf, len) != (int) len
200+ || read (fd2, buf + 4096, len) != (int) len)
201+ {
202+ i = -1;
203+ break;
204+ }
205+
206+ if (memcmp (buf, buf + 4096, len) != 0)
207+ break;
208+ }
209+
210+ close (fd1);
211+ close (fd2);
212+
213+ if (n)
214+ break;
215+ }
216+
217+ free (buf);
218+ if (i == -1)
219+ break;
220+
221+ if (i != 2)
222+ {
223+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
224+ break;
225+ }
226+
227+ fd = open (temp_filenames[attempt * 2], O_RDWR);
228+ if (fd < 0)
229+ break;
230+ write (fd, "//", 2);
231+ for (i = 0; i < nargs; i++)
232+ {
233+ write (fd, " ", 1);
234+ write (fd, new_argv[i], strlen (new_argv[i]));
235+ }
236+ write (fd, "\n", 1);
237+ new_argv[nargs] = "-E";
238+ new_argv[nargs + 1] = NULL;
239+ }
240+
241+ /* Fork a subprocess; wait and retry if it fails. */
242+ sleep_interval = 1;
243+ pid = -1;
244+ for (retries = 0; retries < 4; retries++)
245+ {
246+ pid = fork ();
247+ if (pid >= 0)
248+ break;
249+ sleep (sleep_interval);
250+ sleep_interval *= 2;
251+ }
252+
253+ if (pid < 0)
254+ break;
255+ else if (pid == 0)
256+ {
257+ if (attempt != RETRY_ICE_ATTEMPTS)
258+ fd = open (temp_filenames[attempt * 2], O_RDWR);
259+ if (fd < 0)
260+ exit (-1);
261+ if (fd != 1)
262+ {
263+ close (1);
264+ dup (fd);
265+ close (fd);
266+ }
267+
268+ fd = open (temp_filenames[attempt * 2 + 1], O_RDWR);
269+ if (fd < 0)
270+ exit (-1);
271+ if (fd != 2)
272+ {
273+ close (2);
274+ dup (fd);
275+ close (fd);
276+ }
277+
278+ if (prog == new_argv[0])
279+ execvp (prog, (char *const *) new_argv);
280+ else
281+ execv (new_argv[0], (char *const *) new_argv);
282+ exit (-1);
283+ }
284+
285+ if (waitpid (pid, &status, 0) < 0)
286+ break;
287+
288+ if (attempt < RETRY_ICE_ATTEMPTS
289+ && (! WIFEXITED (status) || WEXITSTATUS (status) != ICE_EXIT_CODE))
290+ {
291+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
292+ break;
293+ }
294+ else if (attempt == RETRY_ICE_ATTEMPTS)
295+ {
296+ close (fd);
297+ if (WIFEXITED (status)
298+ && WEXITSTATUS (status) == SUCCESS_EXIT_CODE)
299+ {
300+ notice ("Preprocessed source stored into %s file, please attach this to your bugreport.\n",
301+ temp_filenames[attempt * 2]);
302+ /* Make sure it is not deleted. */
303+ free (temp_filenames[attempt * 2]);
304+ temp_filenames[attempt * 2] = NULL;
305+ break;
306+ }
307+ }
308+ }
309+
310+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS * 2 + 2; attempt++)
311+ if (temp_filenames[attempt])
312+ {
313+ unlink (temp_filenames[attempt]);
314+ free (temp_filenames[attempt]);
315+ }
316+}
317+#endif
318+
319 /* Search for a file named NAME trying various prefixes including the
320 user's -B prefix and some standard ones.
321 Return the absolute file name found. If nothing is found, return NAME. */
322--- gcc/Makefile.in.orig 2007-09-30 10:48:13.000000000 +0000
323+++ gcc/Makefile.in 2007-09-30 10:48:39.000000000 +0000
324@@ -192,6 +192,7 @@
325 build/gengtype-lex.o-warn = -Wno-error
326 # SYSCALLS.c misses prototypes
327 SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error
328+build/gcc.o-warn = -Wno-error
329
330 # All warnings have to be shut off in stage1 if the compiler used then
331 # isn't gcc; configure determines that. WARN_CFLAGS will be either
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-dir-extend.patch
new file mode 100644
index 0000000000..d4771057c5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-dir-extend.patch
@@ -0,0 +1,25 @@
1Add /sw/include and /opt/include based on the original
2zecke-no-host-includes.patch patch. The original patch checked for
3/usr/include, /sw/include and /opt/include and then triggered a failure and
4aborted.
5
6Instead, we add the two missing items to the current scan. If the user
7wants this to be a failure, they can add "-Werror=poison-system-directories".
8
9Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
10
11Index: gcc-4.6.0/gcc/incpath.c
12===================================================================
13--- gcc-4.6.0.orig/gcc/incpath.c
14+++ gcc-4.6.0/gcc/incpath.c
15@@ -363,7 +363,9 @@ merge_include_chains (const char *sysroo
16 {
17 if ((!strncmp (p->name, "/usr/include", 12))
18 || (!strncmp (p->name, "/usr/local/include", 18))
19- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
20+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
21+ || (!strncmp (p->name, "/sw/include", 11))
22+ || (!strncmp (p->name, "/opt/include", 12)))
23 warning (OPT_Wpoison_system_directories,
24 "include location \"%s\" is unsafe for "
25 "cross-compilation",
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-parameters.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-parameters.patch
new file mode 100644
index 0000000000..f36fa8195e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-parameters.patch
@@ -0,0 +1,74 @@
1gcc: add poison parameters detection
2
3Add the logic that, if not configured with "--enable-target-optspace",
4gcc will meet error when build target app with "-Os" option.
5This could avoid potential binary crash.
6
7Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
8
9Index: gcc-4.6.0/gcc/config.in
10===================================================================
11--- gcc-4.6.0.orig/gcc/config.in
12+++ gcc-4.6.0/gcc/config.in
13@@ -150,6 +150,12 @@
14 #endif
15
16
17+/* Define to enable target optspace support. */
18+#ifndef USED_FOR_TARGET
19+#undef ENABLE_TARGET_OPTSPACE
20+#endif
21+
22+
23 /* Define if you want all operations on RTL (the basic data structure of the
24 optimizer and back end) to be checked for dynamic type safety at runtime.
25 This is quite expensive. */
26Index: gcc-4.6.0/gcc/configure
27===================================================================
28--- gcc-4.6.0.orig/gcc/configure
29+++ gcc-4.6.0/gcc/configure
30@@ -26434,6 +26434,13 @@ $as_echo "#define ENABLE_LIBQUADMATH_SUP
31 fi
32
33
34+if test x"$enable_target_optspace" != x; then :
35+
36+$as_echo "#define ENABLE_TARGET_OPTSPACE 1" >>confdefs.h
37+
38+fi
39+
40+
41 # Configure the subdirectories
42 # AC_CONFIG_SUBDIRS($subdirs)
43
44Index: gcc-4.6.0/gcc/configure.ac
45===================================================================
46--- gcc-4.6.0.orig/gcc/configure.ac
47+++ gcc-4.6.0/gcc/configure.ac
48@@ -4907,6 +4907,11 @@ if test "${ENABLE_LIBQUADMATH_SUPPORT}"
49 fi
50
51
52+AC_SUBST(enable_target_optspace)
53+if test x"$enable_target_optspace" != x; then
54+ AC_DEFINE(ENABLE_TARGET_OPTSPACE, 1, [Define to enable target optspace support.])
55+fi
56+
57 # Configure the subdirectories
58 # AC_CONFIG_SUBDIRS($subdirs)
59
60Index: gcc-4.6.0/gcc/opts.c
61===================================================================
62--- gcc-4.6.0.orig/gcc/opts.c
63+++ gcc-4.6.0/gcc/opts.c
64@@ -605,6 +605,10 @@ default_options_optimization (struct gcc
65 maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS,
66 default_param_value (PARAM_MIN_CROSSJUMP_INSNS),
67 opts->x_param_values, opts_set->x_param_values);
68+#ifndef ENABLE_TARGET_OPTSPACE
69+ if (optimize_size == 1)
70+ error ("Do not use -Os option if --enable-target-optspace is not set.");
71+#endif
72
73 /* Allow default optimizations to be specified on a per-machine basis. */
74 maybe_default_options (opts, opts_set,
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..e1b7131a81
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch
@@ -0,0 +1,221 @@
1 gcc/
2 2008-07-02 Joseph Myers <joseph@codesourcery.com>
3 * c-incpath.c: Include toplev.h.
4 (merge_include_chains): Use warning instead of cpp_error for
5 system directory poisoning diagnostic.
6 * Makefile.in (c-incpath.o): Depend on toplev.h.
7 * gcc.c (LINK_COMMAND_SPEC): Pass
8 --error-poison-system-directories if
9 -Werror=poison-system-directories.
10
11 2007-06-13 Joseph Myers <joseph@codesourcery.com>
12 * common.opt (--Wno-poison-system-directories): New.
13 * doc/invoke.texi (-Wno-poison-system-directories): Document.
14 * c-incpath.c: Include flags.h.
15 (merge_include_chains): Check flag_poison_system_directories.
16 * gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
17 to linker if -Wno-poison-system-directories.
18 * Makefile.in (c-incpath.o): Depend on $(FLAGS_H).
19
20 2007-03-20 Daniel Jacobowitz <dan@codesourcery.com>
21 Joseph Myers <joseph@codesourcery.com>
22 * configure.ac (--enable-poison-system-directories): New option.
23 * configure, config.in: Regenerate.
24 * c-incpath.c (merge_include_chains): If
25 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of
26 /usr/include, /usr/local/include or /usr/X11R6/include.
27
28Index: gcc-4.6.0/gcc/common.opt
29===================================================================
30--- gcc-4.6.0.orig/gcc/common.opt
31+++ gcc-4.6.0/gcc/common.opt
32@@ -558,6 +558,10 @@ Wpadded
33 Common Var(warn_padded) Warning
34 Warn when padding is required to align structure members
35
36+Wpoison-system-directories
37+Common Var(flag_poison_system_directories) Init(1) Warning
38+Warn for -I and -L options using system directories if cross compiling
39+
40 Wshadow
41 Common Var(warn_shadow) Warning
42 Warn when one local variable shadows another
43Index: gcc-4.6.0/gcc/config.in
44===================================================================
45--- gcc-4.6.0.orig/gcc/config.in
46+++ gcc-4.6.0/gcc/config.in
47@@ -144,6 +144,12 @@
48 #endif
49
50
51+/* Define to warn for use of native system header directories */
52+#ifndef USED_FOR_TARGET
53+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
54+#endif
55+
56+
57 /* Define if you want all operations on RTL (the basic data structure of the
58 optimizer and back end) to be checked for dynamic type safety at runtime.
59 This is quite expensive. */
60Index: gcc-4.6.0/gcc/configure.ac
61===================================================================
62--- gcc-4.6.0.orig/gcc/configure.ac
63+++ gcc-4.6.0/gcc/configure.ac
64@@ -4694,6 +4694,16 @@ else
65 fi)
66 AC_SUBST(slibdir)
67
68+AC_ARG_ENABLE([poison-system-directories],
69+ AS_HELP_STRING([--enable-poison-system-directories],
70+ [warn for use of native system header directories]),,
71+ [enable_poison_system_directories=no])
72+if test "x${enable_poison_system_directories}" = "xyes"; then
73+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
74+ [1],
75+ [Define to warn for use of native system header directories])
76+fi
77+
78 # Substitute configuration variables
79 AC_SUBST(subdirs)
80 AC_SUBST(srcdir)
81Index: gcc-4.6.0/gcc/doc/invoke.texi
82===================================================================
83--- gcc-4.6.0.orig/gcc/doc/invoke.texi
84+++ gcc-4.6.0/gcc/doc/invoke.texi
85@@ -257,6 +257,7 @@ Objective-C and Objective-C++ Dialects}.
86 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
87 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
88 -Wpointer-arith -Wno-pointer-to-int-cast @gol
89+-Wno-poison-system-directories @gol
90 -Wredundant-decls @gol
91 -Wreturn-type -Wsequence-point -Wshadow @gol
92 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
93@@ -3773,6 +3774,14 @@ headers---for that, @option{-Wunknown-pr
94 for most targets, it is made up of code and thus requires the stack
95 to be made executable in order for the program to work properly.
96
97+@item -Wno-poison-system-directories
98+@opindex Wno-poison-system-directories
99+Do not warn for @option{-I} or @option{-L} options using system
100+directories such as @file{/usr/include} when cross compiling. This
101+option is intended for use in chroot environments when such
102+directories contain the correct headers and libraries for the target
103+system rather than the host.
104+
105 @item -Wfloat-equal
106 @opindex Wfloat-equal
107 @opindex Wno-float-equal
108Index: gcc-4.6.0/gcc/gcc.c
109===================================================================
110--- gcc-4.6.0.orig/gcc/gcc.c
111+++ gcc-4.6.0/gcc/gcc.c
112@@ -659,6 +659,8 @@ proper position among the other output f
113 %{flto} %{flto=*} %l " LINK_PIE_SPEC \
114 "%X %{o*} %{e*} %{N} %{n} %{r}\
115 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
116+ %{Wno-poison-system-directories:--no-poison-system-directories}\
117+ %{Werror=poison-system-directories:--error-poison-system-directories}\
118 %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
119 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
120 %(mflib) " STACK_SPLIT_SPEC "\
121Index: gcc-4.6.0/gcc/incpath.c
122===================================================================
123--- gcc-4.6.0.orig/gcc/incpath.c
124+++ gcc-4.6.0/gcc/incpath.c
125@@ -353,6 +353,24 @@ merge_include_chains (const char *sysroo
126 }
127 fprintf (stderr, _("End of search list.\n"));
128 }
129+
130+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
131+ if (flag_poison_system_directories)
132+ {
133+ struct cpp_dir *p;
134+
135+ for (p = heads[QUOTE]; p; p = p->next)
136+ {
137+ if ((!strncmp (p->name, "/usr/include", 12))
138+ || (!strncmp (p->name, "/usr/local/include", 18))
139+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
140+ warning (OPT_Wpoison_system_directories,
141+ "include location \"%s\" is unsafe for "
142+ "cross-compilation",
143+ p->name);
144+ }
145+ }
146+#endif
147 }
148
149 /* Use given -I paths for #include "..." but not #include <...>, and
150Index: gcc-4.6.0/gcc/Makefile.in
151===================================================================
152--- gcc-4.6.0.orig/gcc/Makefile.in
153+++ gcc-4.6.0/gcc/Makefile.in
154@@ -2179,7 +2179,7 @@ attribs.o : attribs.c $(CONFIG_H) $(SYST
155
156 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
157 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
158- $(MACHMODE_H)
159+ $(MACHMODE_H) $(FLAGS_H) toplev.h
160
161 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) prefix.h \
162 Makefile $(BASEVER)
163Index: gcc-4.6.0/gcc/configure
164===================================================================
165--- gcc-4.6.0.orig/gcc/configure
166+++ gcc-4.6.0/gcc/configure
167@@ -912,6 +912,7 @@ with_system_zlib
168 enable_maintainer_mode
169 enable_version_specific_runtime_libs
170 with_slibdir
171+enable_poison_system_directories
172 enable_plugin
173 enable_libquadmath_support
174 '
175@@ -1623,6 +1624,8 @@ Optional Features:
176 --enable-version-specific-runtime-libs
177 specify that runtime libraries should be
178 installed in a compiler-specific directory
179+ --enable-poison-system-directories
180+ warn for use of native system header directories
181 --enable-plugin enable plugin support
182 --disable-libquadmath-support
183 disable libquadmath support for Fortran
184@@ -17508,7 +17511,7 @@ else
185 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
186 lt_status=$lt_dlunknown
187 cat > conftest.$ac_ext <<_LT_EOF
188-#line 17511 "configure"
189+#line 17514 "configure"
190 #include "confdefs.h"
191
192 #if HAVE_DLFCN_H
193@@ -17614,7 +17617,7 @@ else
194 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
195 lt_status=$lt_dlunknown
196 cat > conftest.$ac_ext <<_LT_EOF
197-#line 17617 "configure"
198+#line 17620 "configure"
199 #include "confdefs.h"
200
201 #if HAVE_DLFCN_H
202@@ -26127,6 +26130,19 @@ fi
203
204
205
206+# Check whether --enable-poison-system-directories was given.
207+if test "${enable_poison_system_directories+set}" = set; then :
208+ enableval=$enable_poison_system_directories;
209+else
210+ enable_poison_system_directories=no
211+fi
212+
213+if test "x${enable_poison_system_directories}" = "xyes"; then
214+
215+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
216+
217+fi
218+
219 # Substitute configuration variables
220
221
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-uclibc-locale-ctype_touplow_t.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 0000000000..8b71e313d9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,70 @@
1Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
2===================================================================
3--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.h
4+++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
5@@ -41,13 +41,22 @@
6
7 #include <clocale>
8
9+#ifdef __UCLIBC__
10+#include <features.h>
11+#include <ctype.h>
12+#endif
13+
14 #define _GLIBCXX_NUM_CATEGORIES 0
15
16 namespace std _GLIBCXX_VISIBILITY(default)
17 {
18 _GLIBCXX_BEGIN_NAMESPACE_VERSION
19
20+#ifdef __UCLIBC__
21+ typedef __ctype_touplow_t* __c_locale;
22+#else
23 typedef int* __c_locale;
24+#endif
25
26 // Convert numeric value of type double and long double to string and
27 // return length of string. If vsnprintf is available use it, otherwise
28Index: gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
29===================================================================
30--- gcc-4.6.0.orig/libstdc++-v3/config/os/gnu-linux/ctype_base.h
31+++ gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
32@@ -34,6 +34,11 @@
33
34 // Information as gleaned from /usr/include/ctype.h
35
36+#ifdef __UCLIBC__
37+#include <features.h>
38+#include <ctype.h>
39+#endif
40+
41 namespace std _GLIBCXX_VISIBILITY(default)
42 {
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
44@@ -42,7 +47,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 struct ctype_base
46 {
47 // Non-standard typedefs.
48+#ifdef __UCLIBC__
49+ typedef const __ctype_touplow_t* __to_type;
50+#else
51 typedef const int* __to_type;
52+#endif
53
54 // NB: Offsets into ctype<char>::_M_table force a particular size
55 // on the mask type. Because of this, we don't use an enum.
56Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
57===================================================================
58--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.cc
59+++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
60@@ -264,5 +264,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
61 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
62 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
63 extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
64+#ifdef __UCLIBC__
65+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
66+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
67+#else
68 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
69+#endif
70 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/libstdc++-pic.dpatch b/meta/recipes-devtools/gcc/gcc-4.6.0/libstdc++-pic.dpatch
new file mode 100644
index 0000000000..70c9e81542
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/libstdc++-pic.dpatch
@@ -0,0 +1,71 @@
1#! /bin/sh -e
2
3# DP: Build and install libstdc++_pic.a library.
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p0 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26diff -ur libstdc++-v3/src/Makefile.am libstdc++-v3/src/Makefile.am
27--- libstdc++-v3/src/Makefile.am~ 2004-04-16 21:04:05.000000000 +0200
28+++ libstdc++-v3/src/Makefile.am 2004-07-03 20:22:43.000000000 +0200
29@@ -210,6 +210,10 @@
30 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
31
32
33+install-exec-local:
34+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o || touch libstdc++_pic.a
35+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
36+
37 # Added bits to build debug library.
38 if GLIBCXX_BUILD_DEBUG
39 all-local: build_debug
40diff -ur libstdc++-v3/src/Makefile.in libstdc++-v3/src/Makefile.in
41--- libstdc++-v3/src/Makefile.in 2004-07-03 06:41:13.000000000 +0200
42+++ libstdc++-v3/src/Makefile.in 2004-07-03 20:25:05.000000000 +0200
43@@ -611,7 +611,7 @@
44
45 install-data-am: install-data-local
46
47-install-exec-am: install-toolexeclibLTLIBRARIES
48+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
49
50 install-info: install-info-am
51
52@@ -644,6 +644,7 @@
53 distclean-libtool distclean-tags distdir dvi dvi-am html \
54 html-am info info-am install install-am install-data \
55 install-data-am install-data-local install-exec \
56+ install-exec-local \
57 install-exec-am install-info install-info-am install-man \
58 install-strip install-toolexeclibLTLIBRARIES installcheck \
59 installcheck-am installdirs maintainer-clean \
60@@ -729,6 +730,11 @@
61 install_debug:
62 (cd ${debugdir} && $(MAKE) \
63 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
64+
65+install-exec-local:
66+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o || touch libstdc++_pic.a
67+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
68+
69 # Tell versions [3.59,3.63) of GNU make to not export all variables.
70 # Otherwise a system limit (for SysV at least) may be exceeded.
71 .NOEXPORT:
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/optional_libstdc.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/optional_libstdc.patch
new file mode 100644
index 0000000000..f132fbf3e5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/optional_libstdc.patch
@@ -0,0 +1,84 @@
1gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
2will not run correctly since by default the linker will try to link against libstdc++
3which shouldn't exist yet. We need an option to disable -lstdc++
4option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
5driver. This patch adds such an option which only disables the -lstdc++.
6
7A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
8do this officially, the likely answer is don't build libstdc++ separately.
9
10RP 29/6/10
11
12Index: gcc-4.6.0/gcc/cp/g++spec.c
13===================================================================
14--- gcc-4.6.0.orig/gcc/cp/g++spec.c
15+++ gcc-4.6.0/gcc/cp/g++spec.c
16@@ -127,6 +127,7 @@ lang_specific_driver (struct cl_decoded_
17 switch (decoded_options[i].opt_index)
18 {
19 case OPT_nostdlib:
20+ case OPT_nostdlib__:
21 case OPT_nodefaultlibs:
22 library = -1;
23 break;
24Index: gcc-4.6.0/gcc/doc/invoke.texi
25===================================================================
26--- gcc-4.6.0.orig/gcc/doc/invoke.texi
27+++ gcc-4.6.0/gcc/doc/invoke.texi
28@@ -193,7 +193,7 @@ in the following sections.
29 -fno-pretty-templates @gol
30 -frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
31 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
32--fno-default-inline -fvisibility-inlines-hidden @gol
33+-nostdlib++ -fno-default-inline -fvisibility-inlines-hidden @gol
34 -fvisibility-ms-compat @gol
35 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
36 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
37@@ -431,7 +431,7 @@ Objective-C and Objective-C++ Dialects}.
38 @gccoptlist{@var{object-file-name} -l@var{library} @gol
39 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
40 -s -static -static-libgcc -static-libstdc++ -shared @gol
41--shared-libgcc -symbolic @gol
42+-shared-libgcc -symbolic -nostdlib++ @gol
43 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
44 -u @var{symbol}}
45
46@@ -9069,6 +9069,11 @@ These entries are usually resolved by en
47 libc. These entry points should be supplied through some other
48 mechanism when this option is specified.
49
50+@item -nostdlib++
51+@opindex nostdlib++
52+Do not use the standard system C++ runtime libraries when linking.
53+Only the libraries you specify will be passed to the linker.
54+
55 @cindex @option{-lgcc}, use with @option{-nostdlib}
56 @cindex @option{-nostdlib} and unresolved references
57 @cindex unresolved references and @option{-nostdlib}
58Index: gcc-4.6.0/gcc/c-family/c.opt
59===================================================================
60--- gcc-4.6.0.orig/gcc/c-family/c.opt
61+++ gcc-4.6.0/gcc/c-family/c.opt
62@@ -1111,6 +1111,10 @@ nostdinc++
63 C++ ObjC++
64 Do not search standard system include directories for C++
65
66+nostdlib++
67+Driver
68+Do not link standard C++ runtime library
69+
70 o
71 C ObjC C++ ObjC++ Joined Separate
72 ; Documented in common.opt
73Index: gcc-4.6.0/gcc/gcc.c
74===================================================================
75--- gcc-4.6.0.orig/gcc/gcc.c
76+++ gcc-4.6.0/gcc/gcc.c
77@@ -666,6 +666,7 @@ proper position among the other output f
78 %(mflib) " STACK_SPLIT_SPEC "\
79 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
80 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
81+ %{!nostdlib++:}\
82 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
83 #endif
84
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/pr30961.dpatch b/meta/recipes-devtools/gcc/gcc-4.6.0/pr30961.dpatch
new file mode 100644
index 0000000000..b20fdf5bf5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/pr30961.dpatch
@@ -0,0 +1,179 @@
1#! /bin/sh -e
2
3# DP: <your description>
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p0 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26From: "H.J. Lu" <hjl@lucon.org>
27Sender: gcc-patches-owner@gcc.gnu.org
28To: gcc-patches@gcc.gnu.org
29Subject: PATCH: PR target/30961: [4.1/4.2/4.3 regression] redundant reg/mem stores/moves
30Date: Mon, 27 Aug 2007 11:34:12 -0700
31
32We start with
33
34(note:HI 3 4 22 2 NOTE_INSN_FUNCTION_BEG)
35
36(insn:HI 6 3 10 2 c.c:3 (set (reg:DF 58 [ <result> ])
37 (subreg:DF (reg/v:DI 59 [ in ]) 0)) 102 {*movdf_integer_rex64} (expr_list:REG_DEAD (reg/v:DI 59 [ in ])
38 (nil)))
39
40(insn:HI 10 6 16 2 c.c:7 (set (reg/i:DF 21 xmm0 [ <result> ])
41 (reg:DF 58 [ <result> ])) 102 {*movdf_integer_rex64} (expr_list:REG_DEAD (reg:DF 58 [ <result> ])
42 (nil)))
43
44(insn:HI 16 10 0 2 c.c:7 (use (reg/i:DF 21 xmm0 [ <result> ])) -1 (nil))
45
46we are trying to allocate registers for insn 6 and we allocate
47xmm0 for the return value. Reload doesn't check if xmm0 can be used for
48DF 59, it allocates xmm1 for DF 59 and generates:
49
50Reloads for insn # 6
51Reload 0: reload_in (DF) = (reg:DF 5 di)
52 SSE_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine
53 reload_in_reg: (subreg:DF (reg/v:DI 5 di [orig:59 in ] [59]) 0)
54 reload_reg_rtx: (reg:DF 22 xmm1)
55...
56
57(note:HI 4 1 3 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
58
59(note:HI 3 4 22 2 NOTE_INSN_FUNCTION_BEG)
60
61(insn 22 3 23 2 c.c:3 (set (mem/c:DF (plus:DI (reg/f:DI 7 sp)
62 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])
63 (reg:DF 5 di)) 102 {*movdf_integer_rex64} (nil))
64
65(insn 23 22 6 2 c.c:3 (set (reg:DF 22 xmm1)
66 (mem/c:DF (plus:DI (reg/f:DI 7 sp)
67 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])) 102 {*movdf_integer_rex64} (nil))
68
69(insn:HI 6 23 16 2 c.c:3 (set (reg:DF 21 xmm0 [orig:58 <result> ] [58])
70 (reg:DF 22 xmm1)) 102 {*movdf_integer_rex64} (nil))
71
72(insn 16 6 21 2 c.c:7 (use (reg/i:DF 21 xmm0 [ <result> ])) -1 (nil))
73
74This patch tries to use the destination register when reloading for input. It
75generates
76
77Reloads for insn # 6
78Reload 0: reload_in (DF) = (reg:DF 5 di)
79 SSE_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine
80 reload_in_reg: (subreg:DF (reg/v:DI 5 di [orig:59 in ] [59]) 0)
81 reload_reg_rtx: (reg:DF 21 xmm0)
82...
83(note:HI 4 1 3 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
84
85(note:HI 3 4 22 2 NOTE_INSN_FUNCTION_BEG)
86
87(insn 22 3 23 2 c.c:3 (set (mem/c:DF (plus:DI (reg/f:DI 7 sp)
88 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])
89 (reg:DF 5 di)) 102 {*movdf_integer_rex64} (nil))
90
91(insn 23 22 6 2 c.c:3 (set (reg:DF 21 xmm0)
92 (mem/c:DF (plus:DI (reg/f:DI 7 sp)
93 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])) 102 {*movdf_integer_rex64} (nil))
94
95(insn:HI 6 23 10 2 c.c:3 (set (reg:DF 22 xmm1 [orig:58 <result> ] [58])
96 (reg:DF 21 xmm0)) 102 {*movdf_integer_rex64} (nil))
97
98(insn:HI 10 6 16 2 c.c:7 (set (reg/i:DF 21 xmm0 [ <result> ])
99 (reg:DF 22 xmm1 [orig:58 <result> ] [58])) 102 {*movdf_integer_rex64} (nil))
100
101(insn 16 10 21 2 c.c:7 (use (reg/i:DF 21 xmm0 [ <result> ])) -1 (nil))
102
103
104H.J.
105----
106gcc/
107
1082007-08-27 H.J. Lu <hongjiu.lu@intel.com>
109
110 PR target/30961
111 * reload1.c (find_reg): Favor the hard register in destination
112 if it is usable and a memory location is needed for reload
113 input.
114
115gcc/testsuite/
116
1172007-08-27 H.J. Lu <hongjiu.lu@intel.com>
118
119 PR target/30961
120 * gcc.target/i386/pr30961-1.c: New.
121
122--- gcc/reload1.c.second 2007-08-27 09:35:08.000000000 -0700
123+++ gcc/reload1.c 2007-08-27 09:36:33.000000000 -0700
124@@ -1781,6 +1781,20 @@ find_reg (struct insn_chain *chain, int
125 HARD_REG_SET not_usable;
126 HARD_REG_SET used_by_other_reload;
127 reg_set_iterator rsi;
128+#ifdef SECONDARY_MEMORY_NEEDED
129+ rtx body = PATTERN (chain->insn);
130+ unsigned int dest_reg = FIRST_PSEUDO_REGISTER;
131+
132+ if (GET_CODE (body) == SET)
133+ {
134+ rtx dest = SET_DEST (body);
135+
136+ if ((REG_P (dest)
137+ || (GET_CODE (dest) == SUBREG
138+ && REG_P (SUBREG_REG (dest)))))
139+ dest_reg = reg_or_subregno (dest);
140+ }
141+#endif
142
143 COPY_HARD_REG_SET (not_usable, bad_spill_regs);
144 IOR_HARD_REG_SET (not_usable, bad_spill_regs_global);
145@@ -1821,6 +1835,18 @@ find_reg (struct insn_chain *chain, int
146 this_cost--;
147 if (rl->out && REG_P (rl->out) && REGNO (rl->out) == regno)
148 this_cost--;
149+#ifdef SECONDARY_MEMORY_NEEDED
150+ /* If a memory location is needed for rl->in and dest_reg
151+ is usable, we will favor it. */
152+ else if (dest_reg == regno
153+ && rl->in
154+ && REG_P (rl->in)
155+ && REGNO (rl->in) < FIRST_PSEUDO_REGISTER
156+ && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (rl->in)),
157+ rl->class,
158+ rl->mode))
159+ this_cost = 0;
160+#endif
161 if (this_cost < best_cost
162 /* Among registers with equal cost, prefer caller-saved ones, or
163 use REG_ALLOC_ORDER if it is defined. */
164--- gcc/testsuite/gcc.target/i386/pr30961-1.c.second 2007-08-27 11:01:59.000000000 -0700
165+++ gcc/testsuite/gcc.target/i386/pr30961-1.c 2007-08-27 11:02:51.000000000 -0700
166@@ -0,0 +1,13 @@
167+/* { dg-do compile } */
168+/* { dg-require-effective-target lp64 } */
169+/* { dg-options "-O2" } */
170+
171+double
172+convert (long long in)
173+{
174+ double f;
175+ __builtin_memcpy( &f, &in, sizeof( in ) );
176+ return f;
177+}
178+
179+/* { dg-final { scan-assembler-not "movapd" } } */
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/pr35942.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/pr35942.patch
new file mode 100644
index 0000000000..da610f5189
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/pr35942.patch
@@ -0,0 +1,38 @@
1Fix PR 35942: remove -lstdc++ from libtool postdeps for CXX.
2
3libstdc++-v3/ChangeLog:
42010-01-04 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5
6 PR libstdc++/35942
7 * configure.ac: Remove -lstdc++ from libtool's postdeps_CXX.
8 * configure: Regenerate.
9
10
11Index: gcc-4.3.3/libstdc++-v3/configure
12===================================================================
13--- gcc-4.3.3.orig/libstdc++-v3/configure 2010-03-26 17:57:51.000000000 +0000
14+++ gcc-4.3.3/libstdc++-v3/configure 2010-03-26 17:57:58.000000000 +0000
15@@ -13759,6 +13759,9 @@
16
17
18
19+# Eliminate -lstdc++ addition to postdeps for cross compiles.
20+postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ ,,g'`
21+
22 # Possibly disable most of the library.
23 ## TODO: Consider skipping unncessary tests altogether in this case, rather
24 ## than just ignoring the results. Faster /and/ more correct, win win.
25Index: gcc-4.3.3/libstdc++-v3/configure.ac
26===================================================================
27--- gcc-4.3.3.orig/libstdc++-v3/configure.ac 2010-03-26 17:57:54.000000000 +0000
28+++ gcc-4.3.3/libstdc++-v3/configure.ac 2010-03-26 17:57:58.000000000 +0000
29@@ -89,6 +89,9 @@
30 AC_SUBST(enable_shared)
31 AC_SUBST(enable_static)
32
33+# Eliminate -lstdc++ addition to postdeps for cross compiles.
34+postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ ,,g'`
35+
36 # Possibly disable most of the library.
37 ## TODO: Consider skipping unncessary tests altogether in this case, rather
38 ## than just ignoring the results. Faster /and/ more correct, win win.
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/zecke-xgcc-cpp.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/zecke-xgcc-cpp.patch
new file mode 100644
index 0000000000..b3f02dca35
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/zecke-xgcc-cpp.patch
@@ -0,0 +1,28 @@
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.6.0/Makefile.in
6===================================================================
7--- gcc-4.6.0.orig/Makefile.in
8+++ gcc-4.6.0/Makefile.in
9@@ -270,6 +270,7 @@ BASE_TARGET_EXPORTS = \
10 AR="$(AR_FOR_TARGET)"; export AR; \
11 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
12 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
13+ CPP="$(CC_FOR_TARGET) -E"; export CPP; \
14 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
15 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
16 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
17Index: gcc-4.6.0/Makefile.tpl
18===================================================================
19--- gcc-4.6.0.orig/Makefile.tpl
20+++ gcc-4.6.0/Makefile.tpl
21@@ -273,6 +273,7 @@ BASE_TARGET_EXPORTS = \
22 AR="$(AR_FOR_TARGET)"; export AR; \
23 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
24 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
25+ CPP="$(CC_FOR_TARGET) -E"; export CPP; \
26 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
27 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
28 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.6.0.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.6.0.bb
new file mode 100644
index 0000000000..1639511362
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.6.0.bb
@@ -0,0 +1,2 @@
1require gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.6.0.bb b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.6.0.bb
new file mode 100644
index 0000000000..42fd0f0f59
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.6.0.bb
@@ -0,0 +1,3 @@
1require gcc-cross_${PV}.bb
2require gcc-cross-intermediate.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.6.0.bb b/meta/recipes-devtools/gcc/gcc-cross_4.6.0.bb
new file mode 100644
index 0000000000..97a0c81920
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross_4.6.0.bb
@@ -0,0 +1,8 @@
1require gcc-${PV}.inc
2require gcc-cross4.inc
3
4EXTRA_OECONF += "--disable-libunwind-exceptions \
5 --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \
6 --with-system-zlib "
7
8ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.6.0.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.6.0.bb
new file mode 100644
index 0000000000..970824805f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.6.0.bb
@@ -0,0 +1,4 @@
1require gcc-cross-initial_${PV}.bb
2require gcc-crosssdk-initial.inc
3
4PR = "r4"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.6.0.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.6.0.bb
new file mode 100644
index 0000000000..d235969591
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.6.0.bb
@@ -0,0 +1,4 @@
1require gcc-cross-intermediate_${PV}.bb
2require gcc-crosssdk-intermediate.inc
3
4PR = "r4"
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.6.0.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.6.0.bb
new file mode 100644
index 0000000000..568b5afaa9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-runtime_4.6.0.bb
@@ -0,0 +1,10 @@
1require gcc-${PV}.inc
2require gcc-configure-runtime.inc
3require gcc-package-runtime.inc
4
5SRC_URI_append = "file://fortran-cross-compile-hack.patch"
6
7ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
8
9EXTRA_OECONF += "--disable-libunwind-exceptions"
10EXTRA_OECONF_append_poky-lsb = " --enable-clocale=gnu"
diff --git a/meta/recipes-devtools/gcc/gcc_4.6.0.bb b/meta/recipes-devtools/gcc/gcc_4.6.0.bb
new file mode 100644
index 0000000000..bfaec86422
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc_4.6.0.bb
@@ -0,0 +1,7 @@
1require gcc-${PV}.inc
2require gcc-configure-target.inc
3require gcc-package-target.inc
4
5SRC_URI_append = "file://fortran-cross-compile-hack.patch"
6
7ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
diff --git a/meta/recipes-devtools/gcc/libgcc_4.6.0.bb b/meta/recipes-devtools/gcc/libgcc_4.6.0.bb
new file mode 100644
index 0000000000..b6cf2685e5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/libgcc_4.6.0.bb
@@ -0,0 +1,46 @@
1require gcc-${PV}.inc
2
3PR = "r0"
4
5INHIBIT_DEFAULT_DEPS = "1"
6DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
7
8PACKAGES = "\
9 ${PN} \
10 ${PN}-dev \
11 "
12
13FILES_${PN} = "${base_libdir}/libgcc*.so.*"
14FILES_${PN}-dev = " \
15 ${base_libdir}/libgcc*.so \
16 ${libdir}/${TARGET_SYS}/${BINV}/crt* \
17 ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
18
19do_fetch[noexec] = "1"
20do_unpack[noexec] = "1"
21do_patch[noexec] = "1"
22do_configure[noexec] = "1"
23do_compile[noexec] = "1"
24
25do_install () {
26 target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-nativesdk##`
27
28 # Install libgcc from our gcc-cross saved data
29 install -d ${D}${base_libdir} ${D}${libdir}
30 cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$target/* ${D}
31
32 # Move libgcc_s into /lib
33 mkdir -p ${D}${base_libdir}
34 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
35 mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
36 else
37 mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
38 fi
39}
40
41do_package_write_ipk[depends] += "virtual/libc:do_package"
42do_package_write_deb[depends] += "virtual/libc:do_package"
43do_package_write_rpm[depends] += "virtual/libc:do_package"
44
45BBCLASSEXTEND = "nativesdk"
46