summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2012-02-23 19:14:58 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-30 11:37:24 +0100
commitaafa59064b9409e3ce06bf334ca250fc2c483acb (patch)
tree1bd0f82a6812d154785f849c511771852ab1bf3a
parent173f424808b935f5db99905bf5af307990d87107 (diff)
downloadpoky-aafa59064b9409e3ce06bf334ca250fc2c483acb.tar.gz
gcc-4.7: Add recipes
Add new recipes for gcc-4_7-branch right now gcc 4.7.0 is latest release from this branch (From OE-Core rev: 3f8fee75e598ad0994acc5da0a612e6eca4f35f6) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7.inc102
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch2810
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch235
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch521
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch16
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch30
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch63
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch36
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch76
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch25
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/arm-nolibfloat.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch48
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch32
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch116
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch27
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch223
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch72
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch61
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch86
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/powerpc-e5500.patch469
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch72
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch77
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb23
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-intermediate_4.7.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_4.7.bb8
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_4.7.bb8
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.7.bb5
-rw-r--r--meta/recipes-devtools/gcc/libgcc_4.7.bb66
40 files changed, 5636 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc
new file mode 100644
index 0000000000..e61de0111f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7.inc
@@ -0,0 +1,102 @@
1require gcc-common.inc
2
3PR = "r0"
4
5# Third digit in PV should be incremented after a minor release
6# happens from this branch on gcc e.g. currently its 4.7.0
7# when 4.7.1 is releases and we bump SRCREV beyond the release
8# on branch then PV should be incremented to 4.7.1+svnr${SRCPV}
9# to reflect that change
10
11PV = "4.7.0+svnr${SRCPV}"
12
13# BINV should be incremented after updating to a revision
14# after a minor gcc release (e.g. 4.7.1 or 4.7.2) has been made
15# the value will be minor-release+1 e.g. if current minor release was
16# 4.7.1 then the value below will have 2 which will mean 4.7.2
17# which will be next minor release and so on.
18
19BINV = "4.7.1"
20
21SRCREV = "186651"
22BRANCH = "gcc-4_7-branch"
23FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-4.7' ], d)}"
24
25DEPENDS =+ "mpfr gmp libmpc"
26NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
27
28LICENSE="GPL-3.0-with-GCC-exception & GPLv3"
29
30LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
31 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
32 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
33 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
34 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
35
36SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH};proto=http \
37 file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
38 file://100-uclibc-conf.patch \
39 file://gcc-uclibc-locale-ctype_touplow_t.patch \
40 file://200-uclibc-locale.patch \
41 file://203-uclibc-locale-no__x.patch; \
42 file://204-uclibc-locale-wchar_fix.patch; \
43 file://205-uclibc-locale-update.patch; \
44 file://301-missing-execinfo_h.patch \
45 file://302-c99-snprintf.patch \
46 file://303-c99-complex-ugly-hack.patch \
47 file://304-index_macro.patch \
48 file://305-libmudflap-susv3-legacy.patch \
49 file://306-libstdc++-namespace.patch \
50 file://740-sh-pr24836.patch \
51 file://800-arm-bigendian.patch \
52 file://904-flatten-switch-stmt-00.patch \
53 file://arm-nolibfloat.patch \
54 file://gcc-poison-system-directories.patch \
55 file://gcc-poison-dir-extend.patch \
56 file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
57 file://64bithack.patch \
58 file://optional_libstdc.patch \
59 file://disable_relax_pic_calls_flag.patch \
60 file://COLLECT_GCC_OPTIONS.patch \
61 file://use-defaults.h-and-t-oe-in-B.patch \
62 file://powerpc-e5500.patch \
63 file://pr32219.patch \
64 file://fortran-cross-compile-hack.patch \
65 file://libgcc-sjlj-check.patch \
66 "
67
68S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${BRANCH}"
69B = "${WORKDIR}/${BRANCH}/build.${HOST_SYS}.${TARGET_SYS}"
70
71# Language Overrides
72FORTRAN = ""
73JAVA = ""
74
75EXTRA_OECONF_BASE = " --enable-lto \
76 --enable-libssp \
77 --disable-bootstrap \
78 --disable-libgomp \
79 --disable-libmudflap \
80 --with-system-zlib \
81 --with-linker-hash-style=${LINKER_HASH_STYLE} \
82 --enable-cheaders=c_global "
83
84EXTRA_OECONF_INITIAL = "--disable-libmudflap \
85 --disable-libgomp \
86 --disable-libssp \
87 --disable-libquadmath \
88 --with-system-zlib \
89 --disable-lto \
90 --disable-plugin \
91 --enable-decimal-float=no"
92
93EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
94 --disable-libgomp \
95 --disable-libquadmath \
96 --with-system-zlib \
97 --disable-lto \
98 --disable-plugin \
99 --disable-libssp"
100
101EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
102
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch b/meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch
new file mode 100644
index 0000000000..b2981e0791
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch
@@ -0,0 +1,39 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/contrib/regression/objs-gcc.sh
4===================================================================
5--- gcc-4.6.0.orig/contrib/regression/objs-gcc.sh
6+++ gcc-4.6.0/contrib/regression/objs-gcc.sh
7@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
8 then
9 make all-gdb all-dejagnu all-ld || exit 1
10 make install-gdb install-dejagnu install-ld || exit 1
11+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
12+ then
13+ make all-gdb all-dejagnu all-ld || exit 1
14+ make install-gdb install-dejagnu install-ld || exit 1
15 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
16 make bootstrap || exit 1
17 make install || exit 1
18Index: gcc-4.6.0/libjava/classpath/ltconfig
19===================================================================
20--- gcc-4.6.0.orig/libjava/classpath/ltconfig
21+++ gcc-4.6.0/libjava/classpath/ltconfig
22@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
23
24 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
25 case $host_os in
26-linux-gnu*) ;;
27+linux-gnu*|linux-uclibc*) ;;
28 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
29 esac
30
31@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
32 ;;
33
34 # This must be Linux ELF.
35-linux-gnu*)
36+linux*)
37 version_type=linux
38 need_lib_prefix=no
39 need_version=no
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch b/meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch
new file mode 100644
index 0000000000..df22c54406
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch
@@ -0,0 +1,2810 @@
1Upstream-Status: Pending
2
3Index: gcc-4_7-branch/libstdc++-v3/acinclude.m4
4===================================================================
5--- gcc-4_7-branch.orig/libstdc++-v3/acinclude.m4 2012-04-10 10:19:50.395337128 -0700
6+++ gcc-4_7-branch/libstdc++-v3/acinclude.m4 2012-04-10 10:30:37.327368356 -0700
7@@ -1924,6 +1924,9 @@
8 # Default to "generic".
9 if test $enable_clocale_flag = auto; then
10 case ${target_os} in
11+ *-uclibc*)
12+ enable_clocale_flag=uclibc
13+ ;;
14 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
15 enable_clocale_flag=gnu
16 ;;
17@@ -2085,6 +2088,40 @@
18 CTIME_CC=config/locale/generic/time_members.cc
19 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
20 ;;
21+ uclibc)
22+ AC_MSG_RESULT(uclibc)
23+
24+ # Declare intention to use gettext, and add support for specific
25+ # languages.
26+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
27+ ALL_LINGUAS="de fr"
28+
29+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
30+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
31+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
32+ USE_NLS=yes
33+ fi
34+ # Export the build objects.
35+ for ling in $ALL_LINGUAS; do \
36+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
37+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
38+ done
39+ AC_SUBST(glibcxx_MOFILES)
40+ AC_SUBST(glibcxx_POFILES)
41+
42+ CLOCALE_H=config/locale/uclibc/c_locale.h
43+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
44+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
45+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
46+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
47+ CMESSAGES_H=config/locale/uclibc/messages_members.h
48+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
49+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
50+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
51+ CTIME_H=config/locale/uclibc/time_members.h
52+ CTIME_CC=config/locale/uclibc/time_members.cc
53+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
54+ ;;
55 esac
56
57 # This is where the testsuite looks for locale catalogs, using the
58Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
59===================================================================
60--- /dev/null 1970-01-01 00:00:00.000000000 +0000
61+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2012-04-10 10:30:37.327368356 -0700
62@@ -0,0 +1,63 @@
63+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
64+
65+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
66+//
67+// This file is part of the GNU ISO C++ Library. This library is free
68+// software; you can redistribute it and/or modify it under the
69+// terms of the GNU General Public License as published by the
70+// Free Software Foundation; either version 2, or (at your option)
71+// any later version.
72+
73+// This library is distributed in the hope that it will be useful,
74+// but WITHOUT ANY WARRANTY; without even the implied warranty of
75+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76+// GNU General Public License for more details.
77+
78+// You should have received a copy of the GNU General Public License along
79+// with this library; see the file COPYING. If not, write to the Free
80+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
81+// USA.
82+
83+// As a special exception, you may use this file as part of a free software
84+// library without restriction. Specifically, if other files instantiate
85+// templates or use macros or inline functions from this file, or you compile
86+// this file and link it with other files to produce an executable, this
87+// file does not by itself cause the resulting executable to be covered by
88+// the GNU General Public License. This exception does not however
89+// invalidate any other reasons why the executable file might be covered by
90+// the GNU General Public License.
91+
92+// Written by Jakub Jelinek <jakub@redhat.com>
93+
94+#include <bits/c++config.h>
95+#include <clocale>
96+
97+#ifdef __UCLIBC_MJN3_ONLY__
98+#warning clean this up
99+#endif
100+
101+#ifdef __UCLIBC_HAS_XLOCALE__
102+
103+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
104+extern "C" __typeof(strcoll_l) __strcoll_l;
105+extern "C" __typeof(strftime_l) __strftime_l;
106+extern "C" __typeof(strtod_l) __strtod_l;
107+extern "C" __typeof(strtof_l) __strtof_l;
108+extern "C" __typeof(strtold_l) __strtold_l;
109+extern "C" __typeof(strxfrm_l) __strxfrm_l;
110+extern "C" __typeof(newlocale) __newlocale;
111+extern "C" __typeof(freelocale) __freelocale;
112+extern "C" __typeof(duplocale) __duplocale;
113+extern "C" __typeof(uselocale) __uselocale;
114+
115+#ifdef _GLIBCXX_USE_WCHAR_T
116+extern "C" __typeof(iswctype_l) __iswctype_l;
117+extern "C" __typeof(towlower_l) __towlower_l;
118+extern "C" __typeof(towupper_l) __towupper_l;
119+extern "C" __typeof(wcscoll_l) __wcscoll_l;
120+extern "C" __typeof(wcsftime_l) __wcsftime_l;
121+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
122+extern "C" __typeof(wctype_l) __wctype_l;
123+#endif
124+
125+#endif // GLIBC 2.3 and later
126Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.cc
127===================================================================
128--- /dev/null 1970-01-01 00:00:00.000000000 +0000
129+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.cc 2012-04-10 10:30:37.327368356 -0700
130@@ -0,0 +1,160 @@
131+// Wrapper for underlying C-language localization -*- C++ -*-
132+
133+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
134+//
135+// This file is part of the GNU ISO C++ Library. This library is free
136+// software; you can redistribute it and/or modify it under the
137+// terms of the GNU General Public License as published by the
138+// Free Software Foundation; either version 2, or (at your option)
139+// any later version.
140+
141+// This library is distributed in the hope that it will be useful,
142+// but WITHOUT ANY WARRANTY; without even the implied warranty of
143+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
144+// GNU General Public License for more details.
145+
146+// You should have received a copy of the GNU General Public License along
147+// with this library; see the file COPYING. If not, write to the Free
148+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
149+// USA.
150+
151+// As a special exception, you may use this file as part of a free software
152+// library without restriction. Specifically, if other files instantiate
153+// templates or use macros or inline functions from this file, or you compile
154+// this file and link it with other files to produce an executable, this
155+// file does not by itself cause the resulting executable to be covered by
156+// the GNU General Public License. This exception does not however
157+// invalidate any other reasons why the executable file might be covered by
158+// the GNU General Public License.
159+
160+//
161+// ISO C++ 14882: 22.8 Standard locale categories.
162+//
163+
164+// Written by Benjamin Kosnik <bkoz@redhat.com>
165+
166+#include <cerrno> // For errno
167+#include <locale>
168+#include <stdexcept>
169+#include <langinfo.h>
170+#include <bits/c++locale_internal.h>
171+
172+#ifndef __UCLIBC_HAS_XLOCALE__
173+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
174+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
175+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
176+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
177+#define __strtof_l(S, E, L) strtof((S), (E))
178+#define __strtod_l(S, E, L) strtod((S), (E))
179+#define __strtold_l(S, E, L) strtold((S), (E))
180+#warning should dummy __newlocale check for C|POSIX ?
181+#define __newlocale(a, b, c) NULL
182+#define __freelocale(a) ((void)0)
183+#define __duplocale(a) __c_locale()
184+#endif
185+
186+namespace std
187+{
188+ template<>
189+ void
190+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
191+ const __c_locale& __cloc)
192+ {
193+ if (!(__err & ios_base::failbit))
194+ {
195+ char* __sanity;
196+ errno = 0;
197+ float __f = __strtof_l(__s, &__sanity, __cloc);
198+ if (__sanity != __s && errno != ERANGE)
199+ __v = __f;
200+ else
201+ __err |= ios_base::failbit;
202+ }
203+ }
204+
205+ template<>
206+ void
207+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
208+ const __c_locale& __cloc)
209+ {
210+ if (!(__err & ios_base::failbit))
211+ {
212+ char* __sanity;
213+ errno = 0;
214+ double __d = __strtod_l(__s, &__sanity, __cloc);
215+ if (__sanity != __s && errno != ERANGE)
216+ __v = __d;
217+ else
218+ __err |= ios_base::failbit;
219+ }
220+ }
221+
222+ template<>
223+ void
224+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
225+ const __c_locale& __cloc)
226+ {
227+ if (!(__err & ios_base::failbit))
228+ {
229+ char* __sanity;
230+ errno = 0;
231+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
232+ if (__sanity != __s && errno != ERANGE)
233+ __v = __ld;
234+ else
235+ __err |= ios_base::failbit;
236+ }
237+ }
238+
239+ void
240+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
241+ __c_locale __old)
242+ {
243+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
244+#ifdef __UCLIBC_HAS_XLOCALE__
245+ if (!__cloc)
246+ {
247+ // This named locale is not supported by the underlying OS.
248+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
249+ "name not valid"));
250+ }
251+#endif
252+ }
253+
254+ void
255+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
256+ {
257+ if (_S_get_c_locale() != __cloc)
258+ __freelocale(__cloc);
259+ }
260+
261+ __c_locale
262+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
263+ { return __duplocale(__cloc); }
264+} // namespace std
265+
266+namespace __gnu_cxx
267+{
268+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
269+ {
270+ "LC_CTYPE",
271+ "LC_NUMERIC",
272+ "LC_TIME",
273+ "LC_COLLATE",
274+ "LC_MONETARY",
275+ "LC_MESSAGES",
276+#if _GLIBCXX_NUM_CATEGORIES != 0
277+ "LC_PAPER",
278+ "LC_NAME",
279+ "LC_ADDRESS",
280+ "LC_TELEPHONE",
281+ "LC_MEASUREMENT",
282+ "LC_IDENTIFICATION"
283+#endif
284+ };
285+}
286+
287+namespace std
288+{
289+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
290+} // namespace std
291Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.h
292===================================================================
293--- /dev/null 1970-01-01 00:00:00.000000000 +0000
294+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.h 2012-04-10 10:30:37.327368356 -0700
295@@ -0,0 +1,117 @@
296+// Wrapper for underlying C-language localization -*- C++ -*-
297+
298+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
299+//
300+// This file is part of the GNU ISO C++ Library. This library is free
301+// software; you can redistribute it and/or modify it under the
302+// terms of the GNU General Public License as published by the
303+// Free Software Foundation; either version 2, or (at your option)
304+// any later version.
305+
306+// This library is distributed in the hope that it will be useful,
307+// but WITHOUT ANY WARRANTY; without even the implied warranty of
308+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
309+// GNU General Public License for more details.
310+
311+// You should have received a copy of the GNU General Public License along
312+// with this library; see the file COPYING. If not, write to the Free
313+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
314+// USA.
315+
316+// As a special exception, you may use this file as part of a free software
317+// library without restriction. Specifically, if other files instantiate
318+// templates or use macros or inline functions from this file, or you compile
319+// this file and link it with other files to produce an executable, this
320+// file does not by itself cause the resulting executable to be covered by
321+// the GNU General Public License. This exception does not however
322+// invalidate any other reasons why the executable file might be covered by
323+// the GNU General Public License.
324+
325+//
326+// ISO C++ 14882: 22.8 Standard locale categories.
327+//
328+
329+// Written by Benjamin Kosnik <bkoz@redhat.com>
330+
331+#ifndef _C_LOCALE_H
332+#define _C_LOCALE_H 1
333+
334+#pragma GCC system_header
335+
336+#include <cstring> // get std::strlen
337+#include <cstdio> // get std::snprintf or std::sprintf
338+#include <clocale>
339+#include <langinfo.h> // For codecvt
340+#ifdef __UCLIBC_MJN3_ONLY__
341+#warning fix this
342+#endif
343+#ifdef __UCLIBC_HAS_LOCALE__
344+#include <iconv.h> // For codecvt using iconv, iconv_t
345+#endif
346+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
347+#include <libintl.h> // For messages
348+#endif
349+
350+#ifdef __UCLIBC_MJN3_ONLY__
351+#warning what is _GLIBCXX_C_LOCALE_GNU for
352+#endif
353+#define _GLIBCXX_C_LOCALE_GNU 1
354+
355+#ifdef __UCLIBC_MJN3_ONLY__
356+#warning fix categories
357+#endif
358+// #define _GLIBCXX_NUM_CATEGORIES 6
359+#define _GLIBCXX_NUM_CATEGORIES 0
360+
361+#ifdef __UCLIBC_HAS_XLOCALE__
362+namespace __gnu_cxx
363+{
364+ extern "C" __typeof(uselocale) __uselocale;
365+}
366+#endif
367+
368+namespace std
369+{
370+#ifdef __UCLIBC_HAS_XLOCALE__
371+ typedef __locale_t __c_locale;
372+#else
373+ typedef int* __c_locale;
374+#endif
375+
376+ // Convert numeric value of type _Tv to string and return length of
377+ // string. If snprintf is available use it, otherwise fall back to
378+ // the unsafe sprintf which, in general, can be dangerous and should
379+ // be avoided.
380+ template<typename _Tv>
381+ int
382+ __convert_from_v(char* __out,
383+ const int __size __attribute__ ((__unused__)),
384+ const char* __fmt,
385+#ifdef __UCLIBC_HAS_XCLOCALE__
386+ _Tv __v, const __c_locale& __cloc, int __prec)
387+ {
388+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
389+#else
390+ _Tv __v, const __c_locale&, int __prec)
391+ {
392+# ifdef __UCLIBC_HAS_LOCALE__
393+ char* __old = std::setlocale(LC_ALL, NULL);
394+ char* __sav = new char[std::strlen(__old) + 1];
395+ std::strcpy(__sav, __old);
396+ std::setlocale(LC_ALL, "C");
397+# endif
398+#endif
399+
400+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
401+
402+#ifdef __UCLIBC_HAS_XCLOCALE__
403+ __gnu_cxx::__uselocale(__old);
404+#elif defined __UCLIBC_HAS_LOCALE__
405+ std::setlocale(LC_ALL, __sav);
406+ delete [] __sav;
407+#endif
408+ return __ret;
409+ }
410+}
411+
412+#endif
413Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
414===================================================================
415--- /dev/null 1970-01-01 00:00:00.000000000 +0000
416+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2012-04-10 10:30:37.327368356 -0700
417@@ -0,0 +1,308 @@
418+// std::codecvt implementation details, GNU version -*- C++ -*-
419+
420+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
421+//
422+// This file is part of the GNU ISO C++ Library. This library is free
423+// software; you can redistribute it and/or modify it under the
424+// terms of the GNU General Public License as published by the
425+// Free Software Foundation; either version 2, or (at your option)
426+// any later version.
427+
428+// This library is distributed in the hope that it will be useful,
429+// but WITHOUT ANY WARRANTY; without even the implied warranty of
430+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
431+// GNU General Public License for more details.
432+
433+// You should have received a copy of the GNU General Public License along
434+// with this library; see the file COPYING. If not, write to the Free
435+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
436+// USA.
437+
438+// As a special exception, you may use this file as part of a free software
439+// library without restriction. Specifically, if other files instantiate
440+// templates or use macros or inline functions from this file, or you compile
441+// this file and link it with other files to produce an executable, this
442+// file does not by itself cause the resulting executable to be covered by
443+// the GNU General Public License. This exception does not however
444+// invalidate any other reasons why the executable file might be covered by
445+// the GNU General Public License.
446+
447+//
448+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
449+//
450+
451+// Written by Benjamin Kosnik <bkoz@redhat.com>
452+
453+#include <locale>
454+#include <cstdlib> // For MB_CUR_MAX
455+#include <climits> // For MB_LEN_MAX
456+#include <bits/c++locale_internal.h>
457+
458+namespace std
459+{
460+ // Specializations.
461+#ifdef _GLIBCXX_USE_WCHAR_T
462+ codecvt_base::result
463+ codecvt<wchar_t, char, mbstate_t>::
464+ do_out(state_type& __state, const intern_type* __from,
465+ const intern_type* __from_end, const intern_type*& __from_next,
466+ extern_type* __to, extern_type* __to_end,
467+ extern_type*& __to_next) const
468+ {
469+ result __ret = ok;
470+ state_type __tmp_state(__state);
471+
472+#ifdef __UCLIBC_HAS_XLOCALE__
473+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
474+#endif
475+
476+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
477+ // in case we fall back to wcrtomb and then continue, in a loop.
478+ // NB: wcsnrtombs is a GNU extension
479+ for (__from_next = __from, __to_next = __to;
480+ __from_next < __from_end && __to_next < __to_end
481+ && __ret == ok;)
482+ {
483+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
484+ __from_end - __from_next);
485+ if (!__from_chunk_end)
486+ __from_chunk_end = __from_end;
487+
488+ __from = __from_next;
489+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
490+ __from_chunk_end - __from_next,
491+ __to_end - __to_next, &__state);
492+ if (__conv == static_cast<size_t>(-1))
493+ {
494+ // In case of error, in order to stop at the exact place we
495+ // have to start again from the beginning with a series of
496+ // wcrtomb.
497+ for (; __from < __from_next; ++__from)
498+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
499+ __state = __tmp_state;
500+ __ret = error;
501+ }
502+ else if (__from_next && __from_next < __from_chunk_end)
503+ {
504+ __to_next += __conv;
505+ __ret = partial;
506+ }
507+ else
508+ {
509+ __from_next = __from_chunk_end;
510+ __to_next += __conv;
511+ }
512+
513+ if (__from_next < __from_end && __ret == ok)
514+ {
515+ extern_type __buf[MB_LEN_MAX];
516+ __tmp_state = __state;
517+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
518+ if (__conv > static_cast<size_t>(__to_end - __to_next))
519+ __ret = partial;
520+ else
521+ {
522+ memcpy(__to_next, __buf, __conv);
523+ __state = __tmp_state;
524+ __to_next += __conv;
525+ ++__from_next;
526+ }
527+ }
528+ }
529+
530+#ifdef __UCLIBC_HAS_XLOCALE__
531+ __uselocale(__old);
532+#endif
533+
534+ return __ret;
535+ }
536+
537+ codecvt_base::result
538+ codecvt<wchar_t, char, mbstate_t>::
539+ do_in(state_type& __state, const extern_type* __from,
540+ const extern_type* __from_end, const extern_type*& __from_next,
541+ intern_type* __to, intern_type* __to_end,
542+ intern_type*& __to_next) const
543+ {
544+ result __ret = ok;
545+ state_type __tmp_state(__state);
546+
547+#ifdef __UCLIBC_HAS_XLOCALE__
548+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
549+#endif
550+
551+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
552+ // in case we store a L'\0' and then continue, in a loop.
553+ // NB: mbsnrtowcs is a GNU extension
554+ for (__from_next = __from, __to_next = __to;
555+ __from_next < __from_end && __to_next < __to_end
556+ && __ret == ok;)
557+ {
558+ const extern_type* __from_chunk_end;
559+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
560+ __from_end
561+ - __from_next));
562+ if (!__from_chunk_end)
563+ __from_chunk_end = __from_end;
564+
565+ __from = __from_next;
566+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
567+ __from_chunk_end - __from_next,
568+ __to_end - __to_next, &__state);
569+ if (__conv == static_cast<size_t>(-1))
570+ {
571+ // In case of error, in order to stop at the exact place we
572+ // have to start again from the beginning with a series of
573+ // mbrtowc.
574+ for (;; ++__to_next, __from += __conv)
575+ {
576+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
577+ &__tmp_state);
578+ if (__conv == static_cast<size_t>(-1)
579+ || __conv == static_cast<size_t>(-2))
580+ break;
581+ }
582+ __from_next = __from;
583+ __state = __tmp_state;
584+ __ret = error;
585+ }
586+ else if (__from_next && __from_next < __from_chunk_end)
587+ {
588+ // It is unclear what to return in this case (see DR 382).
589+ __to_next += __conv;
590+ __ret = partial;
591+ }
592+ else
593+ {
594+ __from_next = __from_chunk_end;
595+ __to_next += __conv;
596+ }
597+
598+ if (__from_next < __from_end && __ret == ok)
599+ {
600+ if (__to_next < __to_end)
601+ {
602+ // XXX Probably wrong for stateful encodings
603+ __tmp_state = __state;
604+ ++__from_next;
605+ *__to_next++ = L'\0';
606+ }
607+ else
608+ __ret = partial;
609+ }
610+ }
611+
612+#ifdef __UCLIBC_HAS_XLOCALE__
613+ __uselocale(__old);
614+#endif
615+
616+ return __ret;
617+ }
618+
619+ int
620+ codecvt<wchar_t, char, mbstate_t>::
621+ do_encoding() const throw()
622+ {
623+ // XXX This implementation assumes that the encoding is
624+ // stateless and is either single-byte or variable-width.
625+ int __ret = 0;
626+#ifdef __UCLIBC_HAS_XLOCALE__
627+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
628+#endif
629+ if (MB_CUR_MAX == 1)
630+ __ret = 1;
631+#ifdef __UCLIBC_HAS_XLOCALE__
632+ __uselocale(__old);
633+#endif
634+ return __ret;
635+ }
636+
637+ int
638+ codecvt<wchar_t, char, mbstate_t>::
639+ do_max_length() const throw()
640+ {
641+#ifdef __UCLIBC_HAS_XLOCALE__
642+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
643+#endif
644+ // XXX Probably wrong for stateful encodings.
645+ int __ret = MB_CUR_MAX;
646+#ifdef __UCLIBC_HAS_XLOCALE__
647+ __uselocale(__old);
648+#endif
649+ return __ret;
650+ }
651+
652+ int
653+ codecvt<wchar_t, char, mbstate_t>::
654+ do_length(state_type& __state, const extern_type* __from,
655+ const extern_type* __end, size_t __max) const
656+ {
657+ int __ret = 0;
658+ state_type __tmp_state(__state);
659+
660+#ifdef __UCLIBC_HAS_XLOCALE__
661+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
662+#endif
663+
664+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
665+ // in case we advance past it and then continue, in a loop.
666+ // NB: mbsnrtowcs is a GNU extension
667+
668+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
669+ // its fourth parameter (it wouldn't with NULL as first parameter).
670+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
671+ * __max));
672+ while (__from < __end && __max)
673+ {
674+ const extern_type* __from_chunk_end;
675+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
676+ __end
677+ - __from));
678+ if (!__from_chunk_end)
679+ __from_chunk_end = __end;
680+
681+ const extern_type* __tmp_from = __from;
682+ size_t __conv = mbsnrtowcs(__to, &__from,
683+ __from_chunk_end - __from,
684+ __max, &__state);
685+ if (__conv == static_cast<size_t>(-1))
686+ {
687+ // In case of error, in order to stop at the exact place we
688+ // have to start again from the beginning with a series of
689+ // mbrtowc.
690+ for (__from = __tmp_from;; __from += __conv)
691+ {
692+ __conv = mbrtowc(NULL, __from, __end - __from,
693+ &__tmp_state);
694+ if (__conv == static_cast<size_t>(-1)
695+ || __conv == static_cast<size_t>(-2))
696+ break;
697+ }
698+ __state = __tmp_state;
699+ __ret += __from - __tmp_from;
700+ break;
701+ }
702+ if (!__from)
703+ __from = __from_chunk_end;
704+
705+ __ret += __from - __tmp_from;
706+ __max -= __conv;
707+
708+ if (__from < __end && __max)
709+ {
710+ // XXX Probably wrong for stateful encodings
711+ __tmp_state = __state;
712+ ++__from;
713+ ++__ret;
714+ --__max;
715+ }
716+ }
717+
718+#ifdef __UCLIBC_HAS_XLOCALE__
719+ __uselocale(__old);
720+#endif
721+
722+ return __ret;
723+ }
724+#endif
725+}
726Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/collate_members.cc
727===================================================================
728--- /dev/null 1970-01-01 00:00:00.000000000 +0000
729+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/collate_members.cc 2012-04-10 10:30:37.327368356 -0700
730@@ -0,0 +1,80 @@
731+// std::collate implementation details, GNU version -*- C++ -*-
732+
733+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
734+//
735+// This file is part of the GNU ISO C++ Library. This library is free
736+// software; you can redistribute it and/or modify it under the
737+// terms of the GNU General Public License as published by the
738+// Free Software Foundation; either version 2, or (at your option)
739+// any later version.
740+
741+// This library is distributed in the hope that it will be useful,
742+// but WITHOUT ANY WARRANTY; without even the implied warranty of
743+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
744+// GNU General Public License for more details.
745+
746+// You should have received a copy of the GNU General Public License along
747+// with this library; see the file COPYING. If not, write to the Free
748+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
749+// USA.
750+
751+// As a special exception, you may use this file as part of a free software
752+// library without restriction. Specifically, if other files instantiate
753+// templates or use macros or inline functions from this file, or you compile
754+// this file and link it with other files to produce an executable, this
755+// file does not by itself cause the resulting executable to be covered by
756+// the GNU General Public License. This exception does not however
757+// invalidate any other reasons why the executable file might be covered by
758+// the GNU General Public License.
759+
760+//
761+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
762+//
763+
764+// Written by Benjamin Kosnik <bkoz@redhat.com>
765+
766+#include <locale>
767+#include <bits/c++locale_internal.h>
768+
769+#ifndef __UCLIBC_HAS_XLOCALE__
770+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
771+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
772+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
773+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
774+#endif
775+
776+namespace std
777+{
778+ // These are basically extensions to char_traits, and perhaps should
779+ // be put there instead of here.
780+ template<>
781+ int
782+ collate<char>::_M_compare(const char* __one, const char* __two) const
783+ {
784+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
785+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
786+ }
787+
788+ template<>
789+ size_t
790+ collate<char>::_M_transform(char* __to, const char* __from,
791+ size_t __n) const
792+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
793+
794+#ifdef _GLIBCXX_USE_WCHAR_T
795+ template<>
796+ int
797+ collate<wchar_t>::_M_compare(const wchar_t* __one,
798+ const wchar_t* __two) const
799+ {
800+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
801+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
802+ }
803+
804+ template<>
805+ size_t
806+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
807+ size_t __n) const
808+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
809+#endif
810+}
811Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/ctype_members.cc
812===================================================================
813--- /dev/null 1970-01-01 00:00:00.000000000 +0000
814+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2012-04-10 10:30:37.331368420 -0700
815@@ -0,0 +1,300 @@
816+// std::ctype implementation details, GNU version -*- C++ -*-
817+
818+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
819+//
820+// This file is part of the GNU ISO C++ Library. This library is free
821+// software; you can redistribute it and/or modify it under the
822+// terms of the GNU General Public License as published by the
823+// Free Software Foundation; either version 2, or (at your option)
824+// any later version.
825+
826+// This library is distributed in the hope that it will be useful,
827+// but WITHOUT ANY WARRANTY; without even the implied warranty of
828+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
829+// GNU General Public License for more details.
830+
831+// You should have received a copy of the GNU General Public License along
832+// with this library; see the file COPYING. If not, write to the Free
833+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
834+// USA.
835+
836+// As a special exception, you may use this file as part of a free software
837+// library without restriction. Specifically, if other files instantiate
838+// templates or use macros or inline functions from this file, or you compile
839+// this file and link it with other files to produce an executable, this
840+// file does not by itself cause the resulting executable to be covered by
841+// the GNU General Public License. This exception does not however
842+// invalidate any other reasons why the executable file might be covered by
843+// the GNU General Public License.
844+
845+//
846+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
847+//
848+
849+// Written by Benjamin Kosnik <bkoz@redhat.com>
850+
851+#define _LIBC
852+#include <locale>
853+#undef _LIBC
854+#include <bits/c++locale_internal.h>
855+
856+#ifndef __UCLIBC_HAS_XLOCALE__
857+#define __wctype_l(S, L) wctype((S))
858+#define __towupper_l(C, L) towupper((C))
859+#define __towlower_l(C, L) towlower((C))
860+#define __iswctype_l(C, M, L) iswctype((C), (M))
861+#endif
862+
863+namespace std
864+{
865+ // NB: The other ctype<char> specializations are in src/locale.cc and
866+ // various /config/os/* files.
867+ template<>
868+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
869+ : ctype<char>(0, false, __refs)
870+ {
871+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
872+ {
873+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
874+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
875+#ifdef __UCLIBC_HAS_XLOCALE__
876+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
877+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
878+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
879+#endif
880+ }
881+ }
882+
883+#ifdef _GLIBCXX_USE_WCHAR_T
884+ ctype<wchar_t>::__wmask_type
885+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
886+ {
887+ __wmask_type __ret;
888+ switch (__m)
889+ {
890+ case space:
891+ __ret = __wctype_l("space", _M_c_locale_ctype);
892+ break;
893+ case print:
894+ __ret = __wctype_l("print", _M_c_locale_ctype);
895+ break;
896+ case cntrl:
897+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
898+ break;
899+ case upper:
900+ __ret = __wctype_l("upper", _M_c_locale_ctype);
901+ break;
902+ case lower:
903+ __ret = __wctype_l("lower", _M_c_locale_ctype);
904+ break;
905+ case alpha:
906+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
907+ break;
908+ case digit:
909+ __ret = __wctype_l("digit", _M_c_locale_ctype);
910+ break;
911+ case punct:
912+ __ret = __wctype_l("punct", _M_c_locale_ctype);
913+ break;
914+ case xdigit:
915+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
916+ break;
917+ case alnum:
918+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
919+ break;
920+ case graph:
921+ __ret = __wctype_l("graph", _M_c_locale_ctype);
922+ break;
923+ default:
924+ __ret = __wmask_type();
925+ }
926+ return __ret;
927+ }
928+
929+ wchar_t
930+ ctype<wchar_t>::do_toupper(wchar_t __c) const
931+ { return __towupper_l(__c, _M_c_locale_ctype); }
932+
933+ const wchar_t*
934+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
935+ {
936+ while (__lo < __hi)
937+ {
938+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
939+ ++__lo;
940+ }
941+ return __hi;
942+ }
943+
944+ wchar_t
945+ ctype<wchar_t>::do_tolower(wchar_t __c) const
946+ { return __towlower_l(__c, _M_c_locale_ctype); }
947+
948+ const wchar_t*
949+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
950+ {
951+ while (__lo < __hi)
952+ {
953+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
954+ ++__lo;
955+ }
956+ return __hi;
957+ }
958+
959+ bool
960+ ctype<wchar_t>::
961+ do_is(mask __m, wchar_t __c) const
962+ {
963+ // Highest bitmask in ctype_base == 10, but extra in "C"
964+ // library for blank.
965+ bool __ret = false;
966+ const size_t __bitmasksize = 11;
967+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
968+ if (__m & _M_bit[__bitcur]
969+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
970+ {
971+ __ret = true;
972+ break;
973+ }
974+ return __ret;
975+ }
976+
977+ const wchar_t*
978+ ctype<wchar_t>::
979+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
980+ {
981+ for (; __lo < __hi; ++__vec, ++__lo)
982+ {
983+ // Highest bitmask in ctype_base == 10, but extra in "C"
984+ // library for blank.
985+ const size_t __bitmasksize = 11;
986+ mask __m = 0;
987+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
988+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
989+ __m |= _M_bit[__bitcur];
990+ *__vec = __m;
991+ }
992+ return __hi;
993+ }
994+
995+ const wchar_t*
996+ ctype<wchar_t>::
997+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
998+ {
999+ while (__lo < __hi && !this->do_is(__m, *__lo))
1000+ ++__lo;
1001+ return __lo;
1002+ }
1003+
1004+ const wchar_t*
1005+ ctype<wchar_t>::
1006+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1007+ {
1008+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1009+ ++__lo;
1010+ return __lo;
1011+ }
1012+
1013+ wchar_t
1014+ ctype<wchar_t>::
1015+ do_widen(char __c) const
1016+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1017+
1018+ const char*
1019+ ctype<wchar_t>::
1020+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1021+ {
1022+ while (__lo < __hi)
1023+ {
1024+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1025+ ++__lo;
1026+ ++__dest;
1027+ }
1028+ return __hi;
1029+ }
1030+
1031+ char
1032+ ctype<wchar_t>::
1033+ do_narrow(wchar_t __wc, char __dfault) const
1034+ {
1035+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1036+ return _M_narrow[__wc];
1037+#ifdef __UCLIBC_HAS_XLOCALE__
1038+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1039+#endif
1040+ const int __c = wctob(__wc);
1041+#ifdef __UCLIBC_HAS_XLOCALE__
1042+ __uselocale(__old);
1043+#endif
1044+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1045+ }
1046+
1047+ const wchar_t*
1048+ ctype<wchar_t>::
1049+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1050+ char* __dest) const
1051+ {
1052+#ifdef __UCLIBC_HAS_XLOCALE__
1053+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1054+#endif
1055+ if (_M_narrow_ok)
1056+ while (__lo < __hi)
1057+ {
1058+ if (*__lo >= 0 && *__lo < 128)
1059+ *__dest = _M_narrow[*__lo];
1060+ else
1061+ {
1062+ const int __c = wctob(*__lo);
1063+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1064+ }
1065+ ++__lo;
1066+ ++__dest;
1067+ }
1068+ else
1069+ while (__lo < __hi)
1070+ {
1071+ const int __c = wctob(*__lo);
1072+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1073+ ++__lo;
1074+ ++__dest;
1075+ }
1076+#ifdef __UCLIBC_HAS_XLOCALE__
1077+ __uselocale(__old);
1078+#endif
1079+ return __hi;
1080+ }
1081+
1082+ void
1083+ ctype<wchar_t>::_M_initialize_ctype()
1084+ {
1085+#ifdef __UCLIBC_HAS_XLOCALE__
1086+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1087+#endif
1088+ wint_t __i;
1089+ for (__i = 0; __i < 128; ++__i)
1090+ {
1091+ const int __c = wctob(__i);
1092+ if (__c == EOF)
1093+ break;
1094+ else
1095+ _M_narrow[__i] = static_cast<char>(__c);
1096+ }
1097+ if (__i == 128)
1098+ _M_narrow_ok = true;
1099+ else
1100+ _M_narrow_ok = false;
1101+ for (size_t __j = 0;
1102+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1103+ _M_widen[__j] = btowc(__j);
1104+
1105+ for (size_t __k = 0; __k <= 11; ++__k)
1106+ {
1107+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1108+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1109+ }
1110+#ifdef __UCLIBC_HAS_XLOCALE__
1111+ __uselocale(__old);
1112+#endif
1113+ }
1114+#endif // _GLIBCXX_USE_WCHAR_T
1115+}
1116Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.cc
1117===================================================================
1118--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1119+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.cc 2012-04-10 10:30:37.331368420 -0700
1120@@ -0,0 +1,100 @@
1121+// std::messages implementation details, GNU version -*- C++ -*-
1122+
1123+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1124+//
1125+// This file is part of the GNU ISO C++ Library. This library is free
1126+// software; you can redistribute it and/or modify it under the
1127+// terms of the GNU General Public License as published by the
1128+// Free Software Foundation; either version 2, or (at your option)
1129+// any later version.
1130+
1131+// This library is distributed in the hope that it will be useful,
1132+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1133+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1134+// GNU General Public License for more details.
1135+
1136+// You should have received a copy of the GNU General Public License along
1137+// with this library; see the file COPYING. If not, write to the Free
1138+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1139+// USA.
1140+
1141+// As a special exception, you may use this file as part of a free software
1142+// library without restriction. Specifically, if other files instantiate
1143+// templates or use macros or inline functions from this file, or you compile
1144+// this file and link it with other files to produce an executable, this
1145+// file does not by itself cause the resulting executable to be covered by
1146+// the GNU General Public License. This exception does not however
1147+// invalidate any other reasons why the executable file might be covered by
1148+// the GNU General Public License.
1149+
1150+//
1151+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1152+//
1153+
1154+// Written by Benjamin Kosnik <bkoz@redhat.com>
1155+
1156+#include <locale>
1157+#include <bits/c++locale_internal.h>
1158+
1159+#ifdef __UCLIBC_MJN3_ONLY__
1160+#warning fix gettext stuff
1161+#endif
1162+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1163+extern "C" char *__dcgettext(const char *domainname,
1164+ const char *msgid, int category);
1165+#undef gettext
1166+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1167+#else
1168+#undef gettext
1169+#define gettext(msgid) (msgid)
1170+#endif
1171+
1172+namespace std
1173+{
1174+ // Specializations.
1175+ template<>
1176+ string
1177+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1178+ {
1179+#ifdef __UCLIBC_HAS_XLOCALE__
1180+ __c_locale __old = __uselocale(_M_c_locale_messages);
1181+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1182+ __uselocale(__old);
1183+ return string(__msg);
1184+#elif defined __UCLIBC_HAS_LOCALE__
1185+ char* __old = strdup(setlocale(LC_ALL, NULL));
1186+ setlocale(LC_ALL, _M_name_messages);
1187+ const char* __msg = gettext(__dfault.c_str());
1188+ setlocale(LC_ALL, __old);
1189+ free(__old);
1190+ return string(__msg);
1191+#else
1192+ const char* __msg = gettext(__dfault.c_str());
1193+ return string(__msg);
1194+#endif
1195+ }
1196+
1197+#ifdef _GLIBCXX_USE_WCHAR_T
1198+ template<>
1199+ wstring
1200+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1201+ {
1202+# ifdef __UCLIBC_HAS_XLOCALE__
1203+ __c_locale __old = __uselocale(_M_c_locale_messages);
1204+ char* __msg = gettext(_M_convert_to_char(__dfault));
1205+ __uselocale(__old);
1206+ return _M_convert_from_char(__msg);
1207+# elif defined __UCLIBC_HAS_LOCALE__
1208+ char* __old = strdup(setlocale(LC_ALL, NULL));
1209+ setlocale(LC_ALL, _M_name_messages);
1210+ char* __msg = gettext(_M_convert_to_char(__dfault));
1211+ setlocale(LC_ALL, __old);
1212+ free(__old);
1213+ return _M_convert_from_char(__msg);
1214+# else
1215+ char* __msg = gettext(_M_convert_to_char(__dfault));
1216+ return _M_convert_from_char(__msg);
1217+# endif
1218+ }
1219+#endif
1220+}
1221Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.h
1222===================================================================
1223--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1224+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.h 2012-04-10 10:30:37.331368420 -0700
1225@@ -0,0 +1,118 @@
1226+// std::messages implementation details, GNU version -*- C++ -*-
1227+
1228+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1229+//
1230+// This file is part of the GNU ISO C++ Library. This library is free
1231+// software; you can redistribute it and/or modify it under the
1232+// terms of the GNU General Public License as published by the
1233+// Free Software Foundation; either version 2, or (at your option)
1234+// any later version.
1235+
1236+// This library is distributed in the hope that it will be useful,
1237+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1238+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1239+// GNU General Public License for more details.
1240+
1241+// You should have received a copy of the GNU General Public License along
1242+// with this library; see the file COPYING. If not, write to the Free
1243+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1244+// USA.
1245+
1246+// As a special exception, you may use this file as part of a free software
1247+// library without restriction. Specifically, if other files instantiate
1248+// templates or use macros or inline functions from this file, or you compile
1249+// this file and link it with other files to produce an executable, this
1250+// file does not by itself cause the resulting executable to be covered by
1251+// the GNU General Public License. This exception does not however
1252+// invalidate any other reasons why the executable file might be covered by
1253+// the GNU General Public License.
1254+
1255+//
1256+// ISO C++ 14882: 22.2.7.1.2 messages functions
1257+//
1258+
1259+// Written by Benjamin Kosnik <bkoz@redhat.com>
1260+
1261+#ifdef __UCLIBC_MJN3_ONLY__
1262+#warning fix prototypes for *textdomain funcs
1263+#endif
1264+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1265+extern "C" char *__textdomain(const char *domainname);
1266+extern "C" char *__bindtextdomain(const char *domainname,
1267+ const char *dirname);
1268+#else
1269+#undef __textdomain
1270+#undef __bindtextdomain
1271+#define __textdomain(D) ((void)0)
1272+#define __bindtextdomain(D,P) ((void)0)
1273+#endif
1274+
1275+ // Non-virtual member functions.
1276+ template<typename _CharT>
1277+ messages<_CharT>::messages(size_t __refs)
1278+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1279+ _M_name_messages(_S_get_c_name())
1280+ { }
1281+
1282+ template<typename _CharT>
1283+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1284+ size_t __refs)
1285+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1286+ _M_name_messages(__s)
1287+ {
1288+ char* __tmp = new char[std::strlen(__s) + 1];
1289+ std::strcpy(__tmp, __s);
1290+ _M_name_messages = __tmp;
1291+ }
1292+
1293+ template<typename _CharT>
1294+ typename messages<_CharT>::catalog
1295+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1296+ const char* __dir) const
1297+ {
1298+ __bindtextdomain(__s.c_str(), __dir);
1299+ return this->do_open(__s, __loc);
1300+ }
1301+
1302+ // Virtual member functions.
1303+ template<typename _CharT>
1304+ messages<_CharT>::~messages()
1305+ {
1306+ if (_M_name_messages != _S_get_c_name())
1307+ delete [] _M_name_messages;
1308+ _S_destroy_c_locale(_M_c_locale_messages);
1309+ }
1310+
1311+ template<typename _CharT>
1312+ typename messages<_CharT>::catalog
1313+ messages<_CharT>::do_open(const basic_string<char>& __s,
1314+ const locale&) const
1315+ {
1316+ // No error checking is done, assume the catalog exists and can
1317+ // be used.
1318+ __textdomain(__s.c_str());
1319+ return 0;
1320+ }
1321+
1322+ template<typename _CharT>
1323+ void
1324+ messages<_CharT>::do_close(catalog) const
1325+ { }
1326+
1327+ // messages_byname
1328+ template<typename _CharT>
1329+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1330+ : messages<_CharT>(__refs)
1331+ {
1332+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1333+ delete [] this->_M_name_messages;
1334+ char* __tmp = new char[std::strlen(__s) + 1];
1335+ std::strcpy(__tmp, __s);
1336+ this->_M_name_messages = __tmp;
1337+
1338+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1339+ {
1340+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1341+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1342+ }
1343+ }
1344Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1345===================================================================
1346--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1347+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2012-04-10 10:30:37.331368420 -0700
1348@@ -0,0 +1,692 @@
1349+// std::moneypunct implementation details, GNU version -*- C++ -*-
1350+
1351+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1352+//
1353+// This file is part of the GNU ISO C++ Library. This library is free
1354+// software; you can redistribute it and/or modify it under the
1355+// terms of the GNU General Public License as published by the
1356+// Free Software Foundation; either version 2, or (at your option)
1357+// any later version.
1358+
1359+// This library is distributed in the hope that it will be useful,
1360+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1361+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1362+// GNU General Public License for more details.
1363+
1364+// You should have received a copy of the GNU General Public License along
1365+// with this library; see the file COPYING. If not, write to the Free
1366+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1367+// USA.
1368+
1369+// As a special exception, you may use this file as part of a free software
1370+// library without restriction. Specifically, if other files instantiate
1371+// templates or use macros or inline functions from this file, or you compile
1372+// this file and link it with other files to produce an executable, this
1373+// file does not by itself cause the resulting executable to be covered by
1374+// the GNU General Public License. This exception does not however
1375+// invalidate any other reasons why the executable file might be covered by
1376+// the GNU General Public License.
1377+
1378+//
1379+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1380+//
1381+
1382+// Written by Benjamin Kosnik <bkoz@redhat.com>
1383+
1384+#define _LIBC
1385+#include <locale>
1386+#undef _LIBC
1387+#include <bits/c++locale_internal.h>
1388+
1389+#ifdef __UCLIBC_MJN3_ONLY__
1390+#warning optimize this for uclibc
1391+#warning tailor for stub locale support
1392+#endif
1393+
1394+#ifndef __UCLIBC_HAS_XLOCALE__
1395+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1396+#endif
1397+
1398+namespace std
1399+{
1400+ // Construct and return valid pattern consisting of some combination of:
1401+ // space none symbol sign value
1402+ money_base::pattern
1403+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1404+ {
1405+ pattern __ret;
1406+
1407+ // This insanely complicated routine attempts to construct a valid
1408+ // pattern for use with monyepunct. A couple of invariants:
1409+
1410+ // if (__precedes) symbol -> value
1411+ // else value -> symbol
1412+
1413+ // if (__space) space
1414+ // else none
1415+
1416+ // none == never first
1417+ // space never first or last
1418+
1419+ // Any elegant implementations of this are welcome.
1420+ switch (__posn)
1421+ {
1422+ case 0:
1423+ case 1:
1424+ // 1 The sign precedes the value and symbol.
1425+ __ret.field[0] = sign;
1426+ if (__space)
1427+ {
1428+ // Pattern starts with sign.
1429+ if (__precedes)
1430+ {
1431+ __ret.field[1] = symbol;
1432+ __ret.field[3] = value;
1433+ }
1434+ else
1435+ {
1436+ __ret.field[1] = value;
1437+ __ret.field[3] = symbol;
1438+ }
1439+ __ret.field[2] = space;
1440+ }
1441+ else
1442+ {
1443+ // Pattern starts with sign and ends with none.
1444+ if (__precedes)
1445+ {
1446+ __ret.field[1] = symbol;
1447+ __ret.field[2] = value;
1448+ }
1449+ else
1450+ {
1451+ __ret.field[1] = value;
1452+ __ret.field[2] = symbol;
1453+ }
1454+ __ret.field[3] = none;
1455+ }
1456+ break;
1457+ case 2:
1458+ // 2 The sign follows the value and symbol.
1459+ if (__space)
1460+ {
1461+ // Pattern either ends with sign.
1462+ if (__precedes)
1463+ {
1464+ __ret.field[0] = symbol;
1465+ __ret.field[2] = value;
1466+ }
1467+ else
1468+ {
1469+ __ret.field[0] = value;
1470+ __ret.field[2] = symbol;
1471+ }
1472+ __ret.field[1] = space;
1473+ __ret.field[3] = sign;
1474+ }
1475+ else
1476+ {
1477+ // Pattern ends with sign then none.
1478+ if (__precedes)
1479+ {
1480+ __ret.field[0] = symbol;
1481+ __ret.field[1] = value;
1482+ }
1483+ else
1484+ {
1485+ __ret.field[0] = value;
1486+ __ret.field[1] = symbol;
1487+ }
1488+ __ret.field[2] = sign;
1489+ __ret.field[3] = none;
1490+ }
1491+ break;
1492+ case 3:
1493+ // 3 The sign immediately precedes the symbol.
1494+ if (__precedes)
1495+ {
1496+ __ret.field[0] = sign;
1497+ __ret.field[1] = symbol;
1498+ if (__space)
1499+ {
1500+ __ret.field[2] = space;
1501+ __ret.field[3] = value;
1502+ }
1503+ else
1504+ {
1505+ __ret.field[2] = value;
1506+ __ret.field[3] = none;
1507+ }
1508+ }
1509+ else
1510+ {
1511+ __ret.field[0] = value;
1512+ if (__space)
1513+ {
1514+ __ret.field[1] = space;
1515+ __ret.field[2] = sign;
1516+ __ret.field[3] = symbol;
1517+ }
1518+ else
1519+ {
1520+ __ret.field[1] = sign;
1521+ __ret.field[2] = symbol;
1522+ __ret.field[3] = none;
1523+ }
1524+ }
1525+ break;
1526+ case 4:
1527+ // 4 The sign immediately follows the symbol.
1528+ if (__precedes)
1529+ {
1530+ __ret.field[0] = symbol;
1531+ __ret.field[1] = sign;
1532+ if (__space)
1533+ {
1534+ __ret.field[2] = space;
1535+ __ret.field[3] = value;
1536+ }
1537+ else
1538+ {
1539+ __ret.field[2] = value;
1540+ __ret.field[3] = none;
1541+ }
1542+ }
1543+ else
1544+ {
1545+ __ret.field[0] = value;
1546+ if (__space)
1547+ {
1548+ __ret.field[1] = space;
1549+ __ret.field[2] = symbol;
1550+ __ret.field[3] = sign;
1551+ }
1552+ else
1553+ {
1554+ __ret.field[1] = symbol;
1555+ __ret.field[2] = sign;
1556+ __ret.field[3] = none;
1557+ }
1558+ }
1559+ break;
1560+ default:
1561+ ;
1562+ }
1563+ return __ret;
1564+ }
1565+
1566+ template<>
1567+ void
1568+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1569+ const char*)
1570+ {
1571+ if (!_M_data)
1572+ _M_data = new __moneypunct_cache<char, true>;
1573+
1574+ if (!__cloc)
1575+ {
1576+ // "C" locale
1577+ _M_data->_M_decimal_point = '.';
1578+ _M_data->_M_thousands_sep = ',';
1579+ _M_data->_M_grouping = "";
1580+ _M_data->_M_grouping_size = 0;
1581+ _M_data->_M_curr_symbol = "";
1582+ _M_data->_M_curr_symbol_size = 0;
1583+ _M_data->_M_positive_sign = "";
1584+ _M_data->_M_positive_sign_size = 0;
1585+ _M_data->_M_negative_sign = "";
1586+ _M_data->_M_negative_sign_size = 0;
1587+ _M_data->_M_frac_digits = 0;
1588+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1589+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1590+
1591+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1592+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1593+ }
1594+ else
1595+ {
1596+ // Named locale.
1597+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1598+ __cloc));
1599+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1600+ __cloc));
1601+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1602+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1603+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1604+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1605+
1606+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1607+ if (!__nposn)
1608+ _M_data->_M_negative_sign = "()";
1609+ else
1610+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1611+ __cloc);
1612+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1613+
1614+ // _Intl == true
1615+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1616+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1617+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1618+ __cloc));
1619+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1620+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1621+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1622+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1623+ __pposn);
1624+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1625+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1626+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1627+ __nposn);
1628+ }
1629+ }
1630+
1631+ template<>
1632+ void
1633+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1634+ const char*)
1635+ {
1636+ if (!_M_data)
1637+ _M_data = new __moneypunct_cache<char, false>;
1638+
1639+ if (!__cloc)
1640+ {
1641+ // "C" locale
1642+ _M_data->_M_decimal_point = '.';
1643+ _M_data->_M_thousands_sep = ',';
1644+ _M_data->_M_grouping = "";
1645+ _M_data->_M_grouping_size = 0;
1646+ _M_data->_M_curr_symbol = "";
1647+ _M_data->_M_curr_symbol_size = 0;
1648+ _M_data->_M_positive_sign = "";
1649+ _M_data->_M_positive_sign_size = 0;
1650+ _M_data->_M_negative_sign = "";
1651+ _M_data->_M_negative_sign_size = 0;
1652+ _M_data->_M_frac_digits = 0;
1653+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1654+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1655+
1656+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1657+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1658+ }
1659+ else
1660+ {
1661+ // Named locale.
1662+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1663+ __cloc));
1664+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1665+ __cloc));
1666+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1667+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1668+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1669+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1670+
1671+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1672+ if (!__nposn)
1673+ _M_data->_M_negative_sign = "()";
1674+ else
1675+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1676+ __cloc);
1677+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1678+
1679+ // _Intl == false
1680+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1681+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1682+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1683+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1684+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1685+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1686+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1687+ __pposn);
1688+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1689+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1690+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1691+ __nposn);
1692+ }
1693+ }
1694+
1695+ template<>
1696+ moneypunct<char, true>::~moneypunct()
1697+ { delete _M_data; }
1698+
1699+ template<>
1700+ moneypunct<char, false>::~moneypunct()
1701+ { delete _M_data; }
1702+
1703+#ifdef _GLIBCXX_USE_WCHAR_T
1704+ template<>
1705+ void
1706+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1707+#ifdef __UCLIBC_HAS_XLOCALE__
1708+ const char*)
1709+#else
1710+ const char* __name)
1711+#endif
1712+ {
1713+ if (!_M_data)
1714+ _M_data = new __moneypunct_cache<wchar_t, true>;
1715+
1716+ if (!__cloc)
1717+ {
1718+ // "C" locale
1719+ _M_data->_M_decimal_point = L'.';
1720+ _M_data->_M_thousands_sep = L',';
1721+ _M_data->_M_grouping = "";
1722+ _M_data->_M_grouping_size = 0;
1723+ _M_data->_M_curr_symbol = L"";
1724+ _M_data->_M_curr_symbol_size = 0;
1725+ _M_data->_M_positive_sign = L"";
1726+ _M_data->_M_positive_sign_size = 0;
1727+ _M_data->_M_negative_sign = L"";
1728+ _M_data->_M_negative_sign_size = 0;
1729+ _M_data->_M_frac_digits = 0;
1730+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1731+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1732+
1733+ // Use ctype::widen code without the facet...
1734+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1735+ _M_data->_M_atoms[__i] =
1736+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1737+ }
1738+ else
1739+ {
1740+ // Named locale.
1741+#ifdef __UCLIBC_HAS_XLOCALE__
1742+ __c_locale __old = __uselocale(__cloc);
1743+#else
1744+ // Switch to named locale so that mbsrtowcs will work.
1745+ char* __old = strdup(setlocale(LC_ALL, NULL));
1746+ setlocale(LC_ALL, __name);
1747+#endif
1748+
1749+#ifdef __UCLIBC_MJN3_ONLY__
1750+#warning fix this... should be monetary
1751+#endif
1752+#ifdef __UCLIBC__
1753+# ifdef __UCLIBC_HAS_XLOCALE__
1754+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1755+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1756+# else
1757+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1758+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1759+# endif
1760+#else
1761+ union { char *__s; wchar_t __w; } __u;
1762+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1763+ _M_data->_M_decimal_point = __u.__w;
1764+
1765+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1766+ _M_data->_M_thousands_sep = __u.__w;
1767+#endif
1768+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1769+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1770+
1771+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1772+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1773+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1774+
1775+ wchar_t* __wcs_ps = 0;
1776+ wchar_t* __wcs_ns = 0;
1777+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1778+ try
1779+ {
1780+ mbstate_t __state;
1781+ size_t __len = strlen(__cpossign);
1782+ if (__len)
1783+ {
1784+ ++__len;
1785+ memset(&__state, 0, sizeof(mbstate_t));
1786+ __wcs_ps = new wchar_t[__len];
1787+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1788+ _M_data->_M_positive_sign = __wcs_ps;
1789+ }
1790+ else
1791+ _M_data->_M_positive_sign = L"";
1792+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1793+
1794+ __len = strlen(__cnegsign);
1795+ if (!__nposn)
1796+ _M_data->_M_negative_sign = L"()";
1797+ else if (__len)
1798+ {
1799+ ++__len;
1800+ memset(&__state, 0, sizeof(mbstate_t));
1801+ __wcs_ns = new wchar_t[__len];
1802+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1803+ _M_data->_M_negative_sign = __wcs_ns;
1804+ }
1805+ else
1806+ _M_data->_M_negative_sign = L"";
1807+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1808+
1809+ // _Intl == true.
1810+ __len = strlen(__ccurr);
1811+ if (__len)
1812+ {
1813+ ++__len;
1814+ memset(&__state, 0, sizeof(mbstate_t));
1815+ wchar_t* __wcs = new wchar_t[__len];
1816+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1817+ _M_data->_M_curr_symbol = __wcs;
1818+ }
1819+ else
1820+ _M_data->_M_curr_symbol = L"";
1821+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1822+ }
1823+ catch (...)
1824+ {
1825+ delete _M_data;
1826+ _M_data = 0;
1827+ delete __wcs_ps;
1828+ delete __wcs_ns;
1829+#ifdef __UCLIBC_HAS_XLOCALE__
1830+ __uselocale(__old);
1831+#else
1832+ setlocale(LC_ALL, __old);
1833+ free(__old);
1834+#endif
1835+ __throw_exception_again;
1836+ }
1837+
1838+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1839+ __cloc));
1840+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1841+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1842+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1843+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1844+ __pposn);
1845+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1846+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1847+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1848+ __nposn);
1849+
1850+#ifdef __UCLIBC_HAS_XLOCALE__
1851+ __uselocale(__old);
1852+#else
1853+ setlocale(LC_ALL, __old);
1854+ free(__old);
1855+#endif
1856+ }
1857+ }
1858+
1859+ template<>
1860+ void
1861+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1862+#ifdef __UCLIBC_HAS_XLOCALE__
1863+ const char*)
1864+#else
1865+ const char* __name)
1866+#endif
1867+ {
1868+ if (!_M_data)
1869+ _M_data = new __moneypunct_cache<wchar_t, false>;
1870+
1871+ if (!__cloc)
1872+ {
1873+ // "C" locale
1874+ _M_data->_M_decimal_point = L'.';
1875+ _M_data->_M_thousands_sep = L',';
1876+ _M_data->_M_grouping = "";
1877+ _M_data->_M_grouping_size = 0;
1878+ _M_data->_M_curr_symbol = L"";
1879+ _M_data->_M_curr_symbol_size = 0;
1880+ _M_data->_M_positive_sign = L"";
1881+ _M_data->_M_positive_sign_size = 0;
1882+ _M_data->_M_negative_sign = L"";
1883+ _M_data->_M_negative_sign_size = 0;
1884+ _M_data->_M_frac_digits = 0;
1885+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1886+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1887+
1888+ // Use ctype::widen code without the facet...
1889+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1890+ _M_data->_M_atoms[__i] =
1891+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1892+ }
1893+ else
1894+ {
1895+ // Named locale.
1896+#ifdef __UCLIBC_HAS_XLOCALE__
1897+ __c_locale __old = __uselocale(__cloc);
1898+#else
1899+ // Switch to named locale so that mbsrtowcs will work.
1900+ char* __old = strdup(setlocale(LC_ALL, NULL));
1901+ setlocale(LC_ALL, __name);
1902+#endif
1903+
1904+#ifdef __UCLIBC_MJN3_ONLY__
1905+#warning fix this... should be monetary
1906+#endif
1907+#ifdef __UCLIBC__
1908+# ifdef __UCLIBC_HAS_XLOCALE__
1909+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1910+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1911+# else
1912+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1913+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1914+# endif
1915+#else
1916+ union { char *__s; wchar_t __w; } __u;
1917+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1918+ _M_data->_M_decimal_point = __u.__w;
1919+
1920+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1921+ _M_data->_M_thousands_sep = __u.__w;
1922+#endif
1923+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1924+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1925+
1926+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1927+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1928+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1929+
1930+ wchar_t* __wcs_ps = 0;
1931+ wchar_t* __wcs_ns = 0;
1932+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1933+ try
1934+ {
1935+ mbstate_t __state;
1936+ size_t __len;
1937+ __len = strlen(__cpossign);
1938+ if (__len)
1939+ {
1940+ ++__len;
1941+ memset(&__state, 0, sizeof(mbstate_t));
1942+ __wcs_ps = new wchar_t[__len];
1943+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1944+ _M_data->_M_positive_sign = __wcs_ps;
1945+ }
1946+ else
1947+ _M_data->_M_positive_sign = L"";
1948+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1949+
1950+ __len = strlen(__cnegsign);
1951+ if (!__nposn)
1952+ _M_data->_M_negative_sign = L"()";
1953+ else if (__len)
1954+ {
1955+ ++__len;
1956+ memset(&__state, 0, sizeof(mbstate_t));
1957+ __wcs_ns = new wchar_t[__len];
1958+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1959+ _M_data->_M_negative_sign = __wcs_ns;
1960+ }
1961+ else
1962+ _M_data->_M_negative_sign = L"";
1963+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1964+
1965+ // _Intl == true.
1966+ __len = strlen(__ccurr);
1967+ if (__len)
1968+ {
1969+ ++__len;
1970+ memset(&__state, 0, sizeof(mbstate_t));
1971+ wchar_t* __wcs = new wchar_t[__len];
1972+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1973+ _M_data->_M_curr_symbol = __wcs;
1974+ }
1975+ else
1976+ _M_data->_M_curr_symbol = L"";
1977+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1978+ }
1979+ catch (...)
1980+ {
1981+ delete _M_data;
1982+ _M_data = 0;
1983+ delete __wcs_ps;
1984+ delete __wcs_ns;
1985+#ifdef __UCLIBC_HAS_XLOCALE__
1986+ __uselocale(__old);
1987+#else
1988+ setlocale(LC_ALL, __old);
1989+ free(__old);
1990+#endif
1991+ __throw_exception_again;
1992+ }
1993+
1994+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1995+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1996+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1997+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1998+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1999+ __pposn);
2000+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2001+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2002+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2003+ __nposn);
2004+
2005+#ifdef __UCLIBC_HAS_XLOCALE__
2006+ __uselocale(__old);
2007+#else
2008+ setlocale(LC_ALL, __old);
2009+ free(__old);
2010+#endif
2011+ }
2012+ }
2013+
2014+ template<>
2015+ moneypunct<wchar_t, true>::~moneypunct()
2016+ {
2017+ if (_M_data->_M_positive_sign_size)
2018+ delete [] _M_data->_M_positive_sign;
2019+ if (_M_data->_M_negative_sign_size
2020+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2021+ delete [] _M_data->_M_negative_sign;
2022+ if (_M_data->_M_curr_symbol_size)
2023+ delete [] _M_data->_M_curr_symbol;
2024+ delete _M_data;
2025+ }
2026+
2027+ template<>
2028+ moneypunct<wchar_t, false>::~moneypunct()
2029+ {
2030+ if (_M_data->_M_positive_sign_size)
2031+ delete [] _M_data->_M_positive_sign;
2032+ if (_M_data->_M_negative_sign_size
2033+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2034+ delete [] _M_data->_M_negative_sign;
2035+ if (_M_data->_M_curr_symbol_size)
2036+ delete [] _M_data->_M_curr_symbol;
2037+ delete _M_data;
2038+ }
2039+#endif
2040+}
2041Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2042===================================================================
2043--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2044+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2012-04-10 10:30:37.331368420 -0700
2045@@ -0,0 +1,160 @@
2046+// std::numpunct implementation details, GNU version -*- C++ -*-
2047+
2048+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2049+//
2050+// This file is part of the GNU ISO C++ Library. This library is free
2051+// software; you can redistribute it and/or modify it under the
2052+// terms of the GNU General Public License as published by the
2053+// Free Software Foundation; either version 2, or (at your option)
2054+// any later version.
2055+
2056+// This library is distributed in the hope that it will be useful,
2057+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2058+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2059+// GNU General Public License for more details.
2060+
2061+// You should have received a copy of the GNU General Public License along
2062+// with this library; see the file COPYING. If not, write to the Free
2063+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2064+// USA.
2065+
2066+// As a special exception, you may use this file as part of a free software
2067+// library without restriction. Specifically, if other files instantiate
2068+// templates or use macros or inline functions from this file, or you compile
2069+// this file and link it with other files to produce an executable, this
2070+// file does not by itself cause the resulting executable to be covered by
2071+// the GNU General Public License. This exception does not however
2072+// invalidate any other reasons why the executable file might be covered by
2073+// the GNU General Public License.
2074+
2075+//
2076+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2077+//
2078+
2079+// Written by Benjamin Kosnik <bkoz@redhat.com>
2080+
2081+#define _LIBC
2082+#include <locale>
2083+#undef _LIBC
2084+#include <bits/c++locale_internal.h>
2085+
2086+#ifdef __UCLIBC_MJN3_ONLY__
2087+#warning tailor for stub locale support
2088+#endif
2089+#ifndef __UCLIBC_HAS_XLOCALE__
2090+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2091+#endif
2092+
2093+namespace std
2094+{
2095+ template<>
2096+ void
2097+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2098+ {
2099+ if (!_M_data)
2100+ _M_data = new __numpunct_cache<char>;
2101+
2102+ if (!__cloc)
2103+ {
2104+ // "C" locale
2105+ _M_data->_M_grouping = "";
2106+ _M_data->_M_grouping_size = 0;
2107+ _M_data->_M_use_grouping = false;
2108+
2109+ _M_data->_M_decimal_point = '.';
2110+ _M_data->_M_thousands_sep = ',';
2111+
2112+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2113+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2114+
2115+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2116+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2117+ }
2118+ else
2119+ {
2120+ // Named locale.
2121+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2122+ __cloc));
2123+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2124+ __cloc));
2125+
2126+ // Check for NULL, which implies no grouping.
2127+ if (_M_data->_M_thousands_sep == '\0')
2128+ _M_data->_M_grouping = "";
2129+ else
2130+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2131+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2132+ }
2133+
2134+ // NB: There is no way to extact this info from posix locales.
2135+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2136+ _M_data->_M_truename = "true";
2137+ _M_data->_M_truename_size = 4;
2138+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2139+ _M_data->_M_falsename = "false";
2140+ _M_data->_M_falsename_size = 5;
2141+ }
2142+
2143+ template<>
2144+ numpunct<char>::~numpunct()
2145+ { delete _M_data; }
2146+
2147+#ifdef _GLIBCXX_USE_WCHAR_T
2148+ template<>
2149+ void
2150+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2151+ {
2152+ if (!_M_data)
2153+ _M_data = new __numpunct_cache<wchar_t>;
2154+
2155+ if (!__cloc)
2156+ {
2157+ // "C" locale
2158+ _M_data->_M_grouping = "";
2159+ _M_data->_M_grouping_size = 0;
2160+ _M_data->_M_use_grouping = false;
2161+
2162+ _M_data->_M_decimal_point = L'.';
2163+ _M_data->_M_thousands_sep = L',';
2164+
2165+ // Use ctype::widen code without the facet...
2166+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2167+ _M_data->_M_atoms_out[__i] =
2168+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2169+
2170+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2171+ _M_data->_M_atoms_in[__j] =
2172+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2173+ }
2174+ else
2175+ {
2176+ // Named locale.
2177+ // NB: In the GNU model wchar_t is always 32 bit wide.
2178+ union { char *__s; wchar_t __w; } __u;
2179+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2180+ _M_data->_M_decimal_point = __u.__w;
2181+
2182+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2183+ _M_data->_M_thousands_sep = __u.__w;
2184+
2185+ if (_M_data->_M_thousands_sep == L'\0')
2186+ _M_data->_M_grouping = "";
2187+ else
2188+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2189+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2190+ }
2191+
2192+ // NB: There is no way to extact this info from posix locales.
2193+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2194+ _M_data->_M_truename = L"true";
2195+ _M_data->_M_truename_size = 4;
2196+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2197+ _M_data->_M_falsename = L"false";
2198+ _M_data->_M_falsename_size = 5;
2199+ }
2200+
2201+ template<>
2202+ numpunct<wchar_t>::~numpunct()
2203+ { delete _M_data; }
2204+ #endif
2205+}
2206Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.cc
2207===================================================================
2208--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2209+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.cc 2012-04-10 10:30:37.331368420 -0700
2210@@ -0,0 +1,406 @@
2211+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2212+
2213+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2214+//
2215+// This file is part of the GNU ISO C++ Library. This library is free
2216+// software; you can redistribute it and/or modify it under the
2217+// terms of the GNU General Public License as published by the
2218+// Free Software Foundation; either version 2, or (at your option)
2219+// any later version.
2220+
2221+// This library is distributed in the hope that it will be useful,
2222+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2223+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2224+// GNU General Public License for more details.
2225+
2226+// You should have received a copy of the GNU General Public License along
2227+// with this library; see the file COPYING. If not, write to the Free
2228+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2229+// USA.
2230+
2231+// As a special exception, you may use this file as part of a free software
2232+// library without restriction. Specifically, if other files instantiate
2233+// templates or use macros or inline functions from this file, or you compile
2234+// this file and link it with other files to produce an executable, this
2235+// file does not by itself cause the resulting executable to be covered by
2236+// the GNU General Public License. This exception does not however
2237+// invalidate any other reasons why the executable file might be covered by
2238+// the GNU General Public License.
2239+
2240+//
2241+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2242+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2243+//
2244+
2245+// Written by Benjamin Kosnik <bkoz@redhat.com>
2246+
2247+#include <locale>
2248+#include <bits/c++locale_internal.h>
2249+
2250+#ifdef __UCLIBC_MJN3_ONLY__
2251+#warning tailor for stub locale support
2252+#endif
2253+#ifndef __UCLIBC_HAS_XLOCALE__
2254+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2255+#endif
2256+
2257+namespace std
2258+{
2259+ template<>
2260+ void
2261+ __timepunct<char>::
2262+ _M_put(char* __s, size_t __maxlen, const char* __format,
2263+ const tm* __tm) const
2264+ {
2265+#ifdef __UCLIBC_HAS_XLOCALE__
2266+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2267+ _M_c_locale_timepunct);
2268+#else
2269+ char* __old = strdup(setlocale(LC_ALL, NULL));
2270+ setlocale(LC_ALL, _M_name_timepunct);
2271+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2272+ setlocale(LC_ALL, __old);
2273+ free(__old);
2274+#endif
2275+ // Make sure __s is null terminated.
2276+ if (__len == 0)
2277+ __s[0] = '\0';
2278+ }
2279+
2280+ template<>
2281+ void
2282+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2283+ {
2284+ if (!_M_data)
2285+ _M_data = new __timepunct_cache<char>;
2286+
2287+ if (!__cloc)
2288+ {
2289+ // "C" locale
2290+ _M_c_locale_timepunct = _S_get_c_locale();
2291+
2292+ _M_data->_M_date_format = "%m/%d/%y";
2293+ _M_data->_M_date_era_format = "%m/%d/%y";
2294+ _M_data->_M_time_format = "%H:%M:%S";
2295+ _M_data->_M_time_era_format = "%H:%M:%S";
2296+ _M_data->_M_date_time_format = "";
2297+ _M_data->_M_date_time_era_format = "";
2298+ _M_data->_M_am = "AM";
2299+ _M_data->_M_pm = "PM";
2300+ _M_data->_M_am_pm_format = "";
2301+
2302+ // Day names, starting with "C"'s Sunday.
2303+ _M_data->_M_day1 = "Sunday";
2304+ _M_data->_M_day2 = "Monday";
2305+ _M_data->_M_day3 = "Tuesday";
2306+ _M_data->_M_day4 = "Wednesday";
2307+ _M_data->_M_day5 = "Thursday";
2308+ _M_data->_M_day6 = "Friday";
2309+ _M_data->_M_day7 = "Saturday";
2310+
2311+ // Abbreviated day names, starting with "C"'s Sun.
2312+ _M_data->_M_aday1 = "Sun";
2313+ _M_data->_M_aday2 = "Mon";
2314+ _M_data->_M_aday3 = "Tue";
2315+ _M_data->_M_aday4 = "Wed";
2316+ _M_data->_M_aday5 = "Thu";
2317+ _M_data->_M_aday6 = "Fri";
2318+ _M_data->_M_aday7 = "Sat";
2319+
2320+ // Month names, starting with "C"'s January.
2321+ _M_data->_M_month01 = "January";
2322+ _M_data->_M_month02 = "February";
2323+ _M_data->_M_month03 = "March";
2324+ _M_data->_M_month04 = "April";
2325+ _M_data->_M_month05 = "May";
2326+ _M_data->_M_month06 = "June";
2327+ _M_data->_M_month07 = "July";
2328+ _M_data->_M_month08 = "August";
2329+ _M_data->_M_month09 = "September";
2330+ _M_data->_M_month10 = "October";
2331+ _M_data->_M_month11 = "November";
2332+ _M_data->_M_month12 = "December";
2333+
2334+ // Abbreviated month names, starting with "C"'s Jan.
2335+ _M_data->_M_amonth01 = "Jan";
2336+ _M_data->_M_amonth02 = "Feb";
2337+ _M_data->_M_amonth03 = "Mar";
2338+ _M_data->_M_amonth04 = "Apr";
2339+ _M_data->_M_amonth05 = "May";
2340+ _M_data->_M_amonth06 = "Jun";
2341+ _M_data->_M_amonth07 = "Jul";
2342+ _M_data->_M_amonth08 = "Aug";
2343+ _M_data->_M_amonth09 = "Sep";
2344+ _M_data->_M_amonth10 = "Oct";
2345+ _M_data->_M_amonth11 = "Nov";
2346+ _M_data->_M_amonth12 = "Dec";
2347+ }
2348+ else
2349+ {
2350+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2351+
2352+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2353+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2354+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2355+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2356+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2357+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2358+ __cloc);
2359+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2360+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2361+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2362+
2363+ // Day names, starting with "C"'s Sunday.
2364+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2365+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2366+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2367+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2368+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2369+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2370+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2371+
2372+ // Abbreviated day names, starting with "C"'s Sun.
2373+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2374+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2375+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2376+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2377+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2378+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2379+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2380+
2381+ // Month names, starting with "C"'s January.
2382+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2383+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2384+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2385+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2386+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2387+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2388+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2389+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2390+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2391+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2392+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2393+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2394+
2395+ // Abbreviated month names, starting with "C"'s Jan.
2396+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2397+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2398+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2399+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2400+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2401+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2402+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2403+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2404+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2405+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2406+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2407+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2408+ }
2409+ }
2410+
2411+#ifdef _GLIBCXX_USE_WCHAR_T
2412+ template<>
2413+ void
2414+ __timepunct<wchar_t>::
2415+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2416+ const tm* __tm) const
2417+ {
2418+#ifdef __UCLIBC_HAS_XLOCALE__
2419+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2420+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2421+ _M_c_locale_timepunct);
2422+#else
2423+ char* __old = strdup(setlocale(LC_ALL, NULL));
2424+ setlocale(LC_ALL, _M_name_timepunct);
2425+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2426+ setlocale(LC_ALL, __old);
2427+ free(__old);
2428+#endif
2429+ // Make sure __s is null terminated.
2430+ if (__len == 0)
2431+ __s[0] = L'\0';
2432+ }
2433+
2434+ template<>
2435+ void
2436+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2437+ {
2438+ if (!_M_data)
2439+ _M_data = new __timepunct_cache<wchar_t>;
2440+
2441+#warning wide time stuff
2442+// if (!__cloc)
2443+ {
2444+ // "C" locale
2445+ _M_c_locale_timepunct = _S_get_c_locale();
2446+
2447+ _M_data->_M_date_format = L"%m/%d/%y";
2448+ _M_data->_M_date_era_format = L"%m/%d/%y";
2449+ _M_data->_M_time_format = L"%H:%M:%S";
2450+ _M_data->_M_time_era_format = L"%H:%M:%S";
2451+ _M_data->_M_date_time_format = L"";
2452+ _M_data->_M_date_time_era_format = L"";
2453+ _M_data->_M_am = L"AM";
2454+ _M_data->_M_pm = L"PM";
2455+ _M_data->_M_am_pm_format = L"";
2456+
2457+ // Day names, starting with "C"'s Sunday.
2458+ _M_data->_M_day1 = L"Sunday";
2459+ _M_data->_M_day2 = L"Monday";
2460+ _M_data->_M_day3 = L"Tuesday";
2461+ _M_data->_M_day4 = L"Wednesday";
2462+ _M_data->_M_day5 = L"Thursday";
2463+ _M_data->_M_day6 = L"Friday";
2464+ _M_data->_M_day7 = L"Saturday";
2465+
2466+ // Abbreviated day names, starting with "C"'s Sun.
2467+ _M_data->_M_aday1 = L"Sun";
2468+ _M_data->_M_aday2 = L"Mon";
2469+ _M_data->_M_aday3 = L"Tue";
2470+ _M_data->_M_aday4 = L"Wed";
2471+ _M_data->_M_aday5 = L"Thu";
2472+ _M_data->_M_aday6 = L"Fri";
2473+ _M_data->_M_aday7 = L"Sat";
2474+
2475+ // Month names, starting with "C"'s January.
2476+ _M_data->_M_month01 = L"January";
2477+ _M_data->_M_month02 = L"February";
2478+ _M_data->_M_month03 = L"March";
2479+ _M_data->_M_month04 = L"April";
2480+ _M_data->_M_month05 = L"May";
2481+ _M_data->_M_month06 = L"June";
2482+ _M_data->_M_month07 = L"July";
2483+ _M_data->_M_month08 = L"August";
2484+ _M_data->_M_month09 = L"September";
2485+ _M_data->_M_month10 = L"October";
2486+ _M_data->_M_month11 = L"November";
2487+ _M_data->_M_month12 = L"December";
2488+
2489+ // Abbreviated month names, starting with "C"'s Jan.
2490+ _M_data->_M_amonth01 = L"Jan";
2491+ _M_data->_M_amonth02 = L"Feb";
2492+ _M_data->_M_amonth03 = L"Mar";
2493+ _M_data->_M_amonth04 = L"Apr";
2494+ _M_data->_M_amonth05 = L"May";
2495+ _M_data->_M_amonth06 = L"Jun";
2496+ _M_data->_M_amonth07 = L"Jul";
2497+ _M_data->_M_amonth08 = L"Aug";
2498+ _M_data->_M_amonth09 = L"Sep";
2499+ _M_data->_M_amonth10 = L"Oct";
2500+ _M_data->_M_amonth11 = L"Nov";
2501+ _M_data->_M_amonth12 = L"Dec";
2502+ }
2503+#if 0
2504+ else
2505+ {
2506+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2507+
2508+ union { char *__s; wchar_t *__w; } __u;
2509+
2510+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2511+ _M_data->_M_date_format = __u.__w;
2512+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2513+ _M_data->_M_date_era_format = __u.__w;
2514+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2515+ _M_data->_M_time_format = __u.__w;
2516+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2517+ _M_data->_M_time_era_format = __u.__w;
2518+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2519+ _M_data->_M_date_time_format = __u.__w;
2520+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2521+ _M_data->_M_date_time_era_format = __u.__w;
2522+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2523+ _M_data->_M_am = __u.__w;
2524+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2525+ _M_data->_M_pm = __u.__w;
2526+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2527+ _M_data->_M_am_pm_format = __u.__w;
2528+
2529+ // Day names, starting with "C"'s Sunday.
2530+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2531+ _M_data->_M_day1 = __u.__w;
2532+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2533+ _M_data->_M_day2 = __u.__w;
2534+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2535+ _M_data->_M_day3 = __u.__w;
2536+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2537+ _M_data->_M_day4 = __u.__w;
2538+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2539+ _M_data->_M_day5 = __u.__w;
2540+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2541+ _M_data->_M_day6 = __u.__w;
2542+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2543+ _M_data->_M_day7 = __u.__w;
2544+
2545+ // Abbreviated day names, starting with "C"'s Sun.
2546+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2547+ _M_data->_M_aday1 = __u.__w;
2548+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2549+ _M_data->_M_aday2 = __u.__w;
2550+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2551+ _M_data->_M_aday3 = __u.__w;
2552+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2553+ _M_data->_M_aday4 = __u.__w;
2554+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2555+ _M_data->_M_aday5 = __u.__w;
2556+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2557+ _M_data->_M_aday6 = __u.__w;
2558+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2559+ _M_data->_M_aday7 = __u.__w;
2560+
2561+ // Month names, starting with "C"'s January.
2562+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2563+ _M_data->_M_month01 = __u.__w;
2564+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2565+ _M_data->_M_month02 = __u.__w;
2566+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2567+ _M_data->_M_month03 = __u.__w;
2568+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2569+ _M_data->_M_month04 = __u.__w;
2570+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2571+ _M_data->_M_month05 = __u.__w;
2572+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2573+ _M_data->_M_month06 = __u.__w;
2574+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2575+ _M_data->_M_month07 = __u.__w;
2576+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2577+ _M_data->_M_month08 = __u.__w;
2578+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2579+ _M_data->_M_month09 = __u.__w;
2580+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2581+ _M_data->_M_month10 = __u.__w;
2582+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2583+ _M_data->_M_month11 = __u.__w;
2584+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2585+ _M_data->_M_month12 = __u.__w;
2586+
2587+ // Abbreviated month names, starting with "C"'s Jan.
2588+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2589+ _M_data->_M_amonth01 = __u.__w;
2590+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2591+ _M_data->_M_amonth02 = __u.__w;
2592+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2593+ _M_data->_M_amonth03 = __u.__w;
2594+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2595+ _M_data->_M_amonth04 = __u.__w;
2596+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2597+ _M_data->_M_amonth05 = __u.__w;
2598+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2599+ _M_data->_M_amonth06 = __u.__w;
2600+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2601+ _M_data->_M_amonth07 = __u.__w;
2602+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2603+ _M_data->_M_amonth08 = __u.__w;
2604+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2605+ _M_data->_M_amonth09 = __u.__w;
2606+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2607+ _M_data->_M_amonth10 = __u.__w;
2608+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2609+ _M_data->_M_amonth11 = __u.__w;
2610+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2611+ _M_data->_M_amonth12 = __u.__w;
2612+ }
2613+#endif // 0
2614+ }
2615+#endif
2616+}
2617Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.h
2618===================================================================
2619--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2620+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.h 2012-04-10 10:30:37.331368420 -0700
2621@@ -0,0 +1,68 @@
2622+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2623+
2624+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2625+//
2626+// This file is part of the GNU ISO C++ Library. This library is free
2627+// software; you can redistribute it and/or modify it under the
2628+// terms of the GNU General Public License as published by the
2629+// Free Software Foundation; either version 2, or (at your option)
2630+// any later version.
2631+
2632+// This library is distributed in the hope that it will be useful,
2633+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2634+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2635+// GNU General Public License for more details.
2636+
2637+// You should have received a copy of the GNU General Public License along
2638+// with this library; see the file COPYING. If not, write to the Free
2639+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2640+// USA.
2641+
2642+// As a special exception, you may use this file as part of a free software
2643+// library without restriction. Specifically, if other files instantiate
2644+// templates or use macros or inline functions from this file, or you compile
2645+// this file and link it with other files to produce an executable, this
2646+// file does not by itself cause the resulting executable to be covered by
2647+// the GNU General Public License. This exception does not however
2648+// invalidate any other reasons why the executable file might be covered by
2649+// the GNU General Public License.
2650+
2651+//
2652+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2653+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2654+//
2655+
2656+// Written by Benjamin Kosnik <bkoz@redhat.com>
2657+
2658+ template<typename _CharT>
2659+ __timepunct<_CharT>::__timepunct(size_t __refs)
2660+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2661+ _M_name_timepunct(_S_get_c_name())
2662+ { _M_initialize_timepunct(); }
2663+
2664+ template<typename _CharT>
2665+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2666+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2667+ _M_name_timepunct(_S_get_c_name())
2668+ { _M_initialize_timepunct(); }
2669+
2670+ template<typename _CharT>
2671+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2672+ size_t __refs)
2673+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2674+ _M_name_timepunct(__s)
2675+ {
2676+ char* __tmp = new char[std::strlen(__s) + 1];
2677+ std::strcpy(__tmp, __s);
2678+ _M_name_timepunct = __tmp;
2679+ _M_initialize_timepunct(__cloc);
2680+ }
2681+
2682+ template<typename _CharT>
2683+ __timepunct<_CharT>::~__timepunct()
2684+ {
2685+ if (_M_name_timepunct != _S_get_c_name())
2686+ delete [] _M_name_timepunct;
2687+ delete _M_data;
2688+ _S_destroy_c_locale(_M_c_locale_timepunct);
2689+ }
2690Index: gcc-4_7-branch/libstdc++-v3/configure
2691===================================================================
2692--- gcc-4_7-branch.orig/libstdc++-v3/configure 2012-04-10 10:19:50.383337127 -0700
2693+++ gcc-4_7-branch/libstdc++-v3/configure 2012-04-10 10:30:37.347368481 -0700
2694@@ -15736,6 +15736,9 @@
2695 # Default to "generic".
2696 if test $enable_clocale_flag = auto; then
2697 case ${target_os} in
2698+ *-uclibc*)
2699+ enable_clocale_flag=uclibc
2700+ ;;
2701 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2702 enable_clocale_flag=gnu
2703 ;;
2704@@ -15990,6 +15993,78 @@
2705 CTIME_CC=config/locale/generic/time_members.cc
2706 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2707 ;;
2708+ uclibc)
2709+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: uclibc" >&5
2710+$as_echo "uclibc" >&6; }
2711+
2712+ # Declare intention to use gettext, and add support for specific
2713+ # languages.
2714+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2715+ ALL_LINGUAS="de fr"
2716+
2717+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2718+ # Extract the first word of "msgfmt", so it can be a program name with args.
2719+set dummy msgfmt; ac_word=$2
2720+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2721+$as_echo_n "checking for $ac_word... " >&6; }
2722+if test "${ac_cv_prog_check_msgfmt+set}" = set; then :
2723+ $as_echo_n "(cached) " >&6
2724+else
2725+ if test -n "$check_msgfmt"; then
2726+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2727+else
2728+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2729+for as_dir in $PATH
2730+do
2731+ IFS=$as_save_IFS
2732+ test -z "$as_dir" && as_dir=.
2733+ for ac_exec_ext in '' $ac_executable_extensions; do
2734+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2735+ ac_cv_prog_check_msgfmt="yes"
2736+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2737+ break 2
2738+ fi
2739+done
2740+ done
2741+IFS=$as_save_IFS
2742+
2743+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2744+fi
2745+fi
2746+check_msgfmt=$ac_cv_prog_check_msgfmt
2747+if test -n "$check_msgfmt"; then
2748+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $check_msgfmt" >&5
2749+$as_echo "$check_msgfmt" >&6; }
2750+else
2751+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2752+$as_echo "no" >&6; }
2753+fi
2754+
2755+
2756+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2757+ USE_NLS=yes
2758+ fi
2759+ # Export the build objects.
2760+ for ling in $ALL_LINGUAS; do \
2761+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2762+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2763+ done
2764+
2765+
2766+
2767+ CLOCALE_H=config/locale/uclibc/c_locale.h
2768+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2769+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2770+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2771+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2772+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2773+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2774+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2775+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2776+ CTIME_H=config/locale/uclibc/time_members.h
2777+ CTIME_CC=config/locale/uclibc/time_members.cc
2778+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2779+ ;;
2780 esac
2781
2782 # This is where the testsuite looks for locale catalogs, using the
2783Index: gcc-4_7-branch/libstdc++-v3/include/c_compatibility/wchar.h
2784===================================================================
2785--- gcc-4_7-branch.orig/libstdc++-v3/include/c_compatibility/wchar.h 2012-04-10 10:19:50.303337124 -0700
2786+++ gcc-4_7-branch/libstdc++-v3/include/c_compatibility/wchar.h 2012-04-10 10:30:37.347368481 -0700
2787@@ -101,7 +101,9 @@
2788 using std::wmemcpy;
2789 using std::wmemmove;
2790 using std::wmemset;
2791+#if _GLIBCXX_HAVE_WCSFTIME
2792 using std::wcsftime;
2793+#endif
2794
2795 #if _GLIBCXX_USE_C99
2796 using std::wcstold;
2797Index: gcc-4_7-branch/libstdc++-v3/include/c_std/cwchar
2798===================================================================
2799--- gcc-4_7-branch.orig/libstdc++-v3/include/c_std/cwchar 2012-04-10 10:19:50.295337124 -0700
2800+++ gcc-4_7-branch/libstdc++-v3/include/c_std/cwchar 2012-04-10 10:30:37.347368481 -0700
2801@@ -177,7 +177,9 @@
2802 using ::wcscoll;
2803 using ::wcscpy;
2804 using ::wcscspn;
2805+#if _GLIBCXX_HAVE_WCSFTIME
2806 using ::wcsftime;
2807+#endif
2808 using ::wcslen;
2809 using ::wcsncat;
2810 using ::wcsncmp;
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch b/meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch
new file mode 100644
index 0000000000..c602e913e9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch
@@ -0,0 +1,235 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
7@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm
8 extern "C" __typeof(wctype_l) __wctype_l;
9 #endif
10
11+# define __nl_langinfo_l nl_langinfo_l
12+# define __strcoll_l strcoll_l
13+# define __strftime_l strftime_l
14+# define __strtod_l strtod_l
15+# define __strtof_l strtof_l
16+# define __strtold_l strtold_l
17+# define __strxfrm_l strxfrm_l
18+# define __newlocale newlocale
19+# define __freelocale freelocale
20+# define __duplocale duplocale
21+# define __uselocale uselocale
22+
23+# ifdef _GLIBCXX_USE_WCHAR_T
24+# define __iswctype_l iswctype_l
25+# define __towlower_l towlower_l
26+# define __towupper_l towupper_l
27+# define __wcscoll_l wcscoll_l
28+# define __wcsftime_l wcsftime_l
29+# define __wcsxfrm_l wcsxfrm_l
30+# define __wctype_l wctype_l
31+# endif
32+
33+#else
34+# define __nl_langinfo_l(N, L) nl_langinfo((N))
35+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
36+# define __strtod_l(S, E, L) strtod((S), (E))
37+# define __strtof_l(S, E, L) strtof((S), (E))
38+# define __strtold_l(S, E, L) strtold((S), (E))
39+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
40+# warning should dummy __newlocale check for C|POSIX ?
41+# define __newlocale(a, b, c) NULL
42+# define __freelocale(a) ((void)0)
43+# define __duplocale(a) __c_locale()
44+//# define __uselocale ?
45+//
46+# ifdef _GLIBCXX_USE_WCHAR_T
47+# define __iswctype_l(C, M, L) iswctype((C), (M))
48+# define __towlower_l(C, L) towlower((C))
49+# define __towupper_l(C, L) towupper((C))
50+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
51+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
52+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
53+# define __wctype_l(S, L) wctype((S))
54+# endif
55+
56 #endif // GLIBC 2.3 and later
57Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
58===================================================================
59--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
60+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
61@@ -39,20 +39,6 @@
62 #include <langinfo.h>
63 #include <bits/c++locale_internal.h>
64
65-#ifndef __UCLIBC_HAS_XLOCALE__
66-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
67-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
68-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
69-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
70-#define __strtof_l(S, E, L) strtof((S), (E))
71-#define __strtod_l(S, E, L) strtod((S), (E))
72-#define __strtold_l(S, E, L) strtold((S), (E))
73-#warning should dummy __newlocale check for C|POSIX ?
74-#define __newlocale(a, b, c) NULL
75-#define __freelocale(a) ((void)0)
76-#define __duplocale(a) __c_locale()
77-#endif
78-
79 namespace std
80 {
81 template<>
82Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
83===================================================================
84--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc
85+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
86@@ -36,13 +36,6 @@
87 #include <locale>
88 #include <bits/c++locale_internal.h>
89
90-#ifndef __UCLIBC_HAS_XLOCALE__
91-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
92-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
93-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
94-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
95-#endif
96-
97 namespace std
98 {
99 // These are basically extensions to char_traits, and perhaps should
100Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
101===================================================================
102--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
103+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
104@@ -43,10 +43,6 @@
105 #warning tailor for stub locale support
106 #endif
107
108-#ifndef __UCLIBC_HAS_XLOCALE__
109-#define __nl_langinfo_l(N, L) nl_langinfo((N))
110-#endif
111-
112 namespace std
113 {
114 // Construct and return valid pattern consisting of some combination of:
115Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
116===================================================================
117--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
118+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
119@@ -41,9 +41,6 @@
120 #ifdef __UCLIBC_MJN3_ONLY__
121 #warning tailor for stub locale support
122 #endif
123-#ifndef __UCLIBC_HAS_XLOCALE__
124-#define __nl_langinfo_l(N, L) nl_langinfo((N))
125-#endif
126
127 namespace std
128 {
129Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
130===================================================================
131--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
132+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
133@@ -40,9 +40,6 @@
134 #ifdef __UCLIBC_MJN3_ONLY__
135 #warning tailor for stub locale support
136 #endif
137-#ifndef __UCLIBC_HAS_XLOCALE__
138-#define __nl_langinfo_l(N, L) nl_langinfo((N))
139-#endif
140
141 namespace std
142 {
143Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
144===================================================================
145--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
146+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
147@@ -38,13 +38,6 @@
148 #undef _LIBC
149 #include <bits/c++locale_internal.h>
150
151-#ifndef __UCLIBC_HAS_XLOCALE__
152-#define __wctype_l(S, L) wctype((S))
153-#define __towupper_l(C, L) towupper((C))
154-#define __towlower_l(C, L) towlower((C))
155-#define __iswctype_l(C, M, L) iswctype((C), (M))
156-#endif
157-
158 namespace std
159 {
160 // NB: The other ctype<char> specializations are in src/locale.cc and
161Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
162===================================================================
163--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc
164+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
165@@ -39,13 +39,10 @@
166 #ifdef __UCLIBC_MJN3_ONLY__
167 #warning fix gettext stuff
168 #endif
169-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
170-extern "C" char *__dcgettext(const char *domainname,
171- const char *msgid, int category);
172 #undef gettext
173-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
174+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
175+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
176 #else
177-#undef gettext
178 #define gettext(msgid) (msgid)
179 #endif
180
181Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
182===================================================================
183--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
184+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
185@@ -36,15 +36,11 @@
186 #ifdef __UCLIBC_MJN3_ONLY__
187 #warning fix prototypes for *textdomain funcs
188 #endif
189-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
190-extern "C" char *__textdomain(const char *domainname);
191-extern "C" char *__bindtextdomain(const char *domainname,
192- const char *dirname);
193-#else
194-#undef __textdomain
195-#undef __bindtextdomain
196-#define __textdomain(D) ((void)0)
197-#define __bindtextdomain(D,P) ((void)0)
198+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
199+#undef textdomain
200+#undef bindtextdomain
201+#define textdomain(D) ((void)0)
202+#define bindtextdomain(D,P) ((void)0)
203 #endif
204
205 // Non-virtual member functions.
206@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const
207 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
208 const char* __dir) const
209 {
210- __bindtextdomain(__s.c_str(), __dir);
211+ bindtextdomain(__s.c_str(), __dir);
212 return this->do_open(__s, __loc);
213 }
214
215@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const
216 {
217 // No error checking is done, assume the catalog exists and can
218 // be used.
219- __textdomain(__s.c_str());
220+ textdomain(__s.c_str());
221 return 0;
222 }
223
224Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
225===================================================================
226--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
227+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
228@@ -68,6 +68,7 @@ namespace __gnu_cxx
229 {
230 extern "C" __typeof(uselocale) __uselocale;
231 }
232+#define __uselocale uselocale
233 #endif
234
235 namespace std
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch b/meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000000..896d2a57c7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,54 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
7@@ -401,7 +401,7 @@ namespace std
8 # ifdef __UCLIBC_HAS_XLOCALE__
9 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
10 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
11-# else
12+# elif defined __UCLIBC_HAS_LOCALE__
13 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
14 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
15 # endif
16@@ -556,7 +556,7 @@ namespace std
17 # ifdef __UCLIBC_HAS_XLOCALE__
18 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
19 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
20-# else
21+# elif defined __UCLIBC_HAS_LOCALE__
22 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
23 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
24 # endif
25Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
26===================================================================
27--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
28+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
29@@ -127,12 +127,25 @@ namespace std
30 {
31 // Named locale.
32 // NB: In the GNU model wchar_t is always 32 bit wide.
33+#ifdef __UCLIBC_MJN3_ONLY__
34+#warning fix this... should be numeric
35+#endif
36+#ifdef __UCLIBC__
37+# ifdef __UCLIBC_HAS_XLOCALE__
38+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
39+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
40+# elif defined __UCLIBC_HAS_LOCALE__
41+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
42+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
43+# endif
44+#else
45 union { char *__s; wchar_t __w; } __u;
46 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
47 _M_data->_M_decimal_point = __u.__w;
48
49 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
50 _M_data->_M_thousands_sep = __u.__w;
51+#endif
52
53 if (_M_data->_M_thousands_sep == L'\0')
54 _M_data->_M_grouping = "";
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch b/meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch
new file mode 100644
index 0000000000..743017b4d3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch
@@ -0,0 +1,521 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
7@@ -39,23 +39,20 @@
8 #include <langinfo.h>
9 #include <bits/c++locale_internal.h>
10
11-namespace std
12-{
13+_GLIBCXX_BEGIN_NAMESPACE(std)
14+
15 template<>
16 void
17 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
18 const __c_locale& __cloc)
19 {
20- if (!(__err & ios_base::failbit))
21- {
22- char* __sanity;
23- errno = 0;
24- float __f = __strtof_l(__s, &__sanity, __cloc);
25- if (__sanity != __s && errno != ERANGE)
26- __v = __f;
27- else
28- __err |= ios_base::failbit;
29- }
30+ char* __sanity;
31+ errno = 0;
32+ float __f = __strtof_l(__s, &__sanity, __cloc);
33+ if (__sanity != __s && errno != ERANGE)
34+ __v = __f;
35+ else
36+ __err |= ios_base::failbit;
37 }
38
39 template<>
40@@ -63,16 +60,13 @@ namespace std
41 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
42 const __c_locale& __cloc)
43 {
44- if (!(__err & ios_base::failbit))
45- {
46- char* __sanity;
47- errno = 0;
48- double __d = __strtod_l(__s, &__sanity, __cloc);
49- if (__sanity != __s && errno != ERANGE)
50- __v = __d;
51- else
52- __err |= ios_base::failbit;
53- }
54+ char* __sanity;
55+ errno = 0;
56+ double __d = __strtod_l(__s, &__sanity, __cloc);
57+ if (__sanity != __s && errno != ERANGE)
58+ __v = __d;
59+ else
60+ __err |= ios_base::failbit;
61 }
62
63 template<>
64@@ -80,16 +74,13 @@ namespace std
65 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
66 const __c_locale& __cloc)
67 {
68- if (!(__err & ios_base::failbit))
69- {
70- char* __sanity;
71- errno = 0;
72- long double __ld = __strtold_l(__s, &__sanity, __cloc);
73- if (__sanity != __s && errno != ERANGE)
74- __v = __ld;
75- else
76- __err |= ios_base::failbit;
77- }
78+ char* __sanity;
79+ errno = 0;
80+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
81+ if (__sanity != __s && errno != ERANGE)
82+ __v = __ld;
83+ else
84+ __err |= ios_base::failbit;
85 }
86
87 void
88@@ -110,17 +101,18 @@ namespace std
89 void
90 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
91 {
92- if (_S_get_c_locale() != __cloc)
93+ if (__cloc && _S_get_c_locale() != __cloc)
94 __freelocale(__cloc);
95 }
96
97 __c_locale
98 locale::facet::_S_clone_c_locale(__c_locale& __cloc)
99 { return __duplocale(__cloc); }
100-} // namespace std
101
102-namespace __gnu_cxx
103-{
104+_GLIBCXX_END_NAMESPACE
105+
106+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
107+
108 const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
109 {
110 "LC_CTYPE",
111@@ -138,9 +130,11 @@ namespace __gnu_cxx
112 "LC_IDENTIFICATION"
113 #endif
114 };
115-}
116
117-namespace std
118-{
119+_GLIBCXX_END_NAMESPACE
120+
121+_GLIBCXX_BEGIN_NAMESPACE(std)
122+
123 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
124-} // namespace std
125+
126+_GLIBCXX_END_NAMESPACE
127Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
128===================================================================
129--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
130+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
131@@ -33,16 +33,20 @@
132
133 // Written by Benjamin Kosnik <bkoz@redhat.com>
134
135+#include <features.h>
136+#ifdef __UCLIBC_HAS_LOCALE__
137 #define _LIBC
138 #include <locale>
139 #undef _LIBC
140+#else
141+#include <locale>
142+#endif
143 #include <bits/c++locale_internal.h>
144
145-namespace std
146-{
147+_GLIBCXX_BEGIN_NAMESPACE(std)
148+
149 // NB: The other ctype<char> specializations are in src/locale.cc and
150 // various /config/os/* files.
151- template<>
152 ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
153 : ctype<char>(0, false, __refs)
154 {
155@@ -57,6 +61,8 @@ namespace std
156 #endif
157 }
158 }
159+ ctype_byname<char>::~ctype_byname()
160+ { }
161
162 #ifdef _GLIBCXX_USE_WCHAR_T
163 ctype<wchar_t>::__wmask_type
164@@ -138,17 +144,33 @@ namespace std
165 ctype<wchar_t>::
166 do_is(mask __m, wchar_t __c) const
167 {
168- // Highest bitmask in ctype_base == 10, but extra in "C"
169- // library for blank.
170+ // The case of __m == ctype_base::space is particularly important,
171+ // due to its use in many istream functions. Therefore we deal with
172+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
173+ // is the mask corresponding to ctype_base::space. NB: an encoding
174+ // change would not affect correctness!
175+
176 bool __ret = false;
177- const size_t __bitmasksize = 11;
178- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
179- if (__m & _M_bit[__bitcur]
180- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
181- {
182- __ret = true;
183- break;
184- }
185+ if (__m == _M_bit[5])
186+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
187+ else
188+ {
189+ // Highest bitmask in ctype_base == 10, but extra in "C"
190+ // library for blank.
191+ const size_t __bitmasksize = 11;
192+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
193+ if (__m & _M_bit[__bitcur])
194+ {
195+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
196+ {
197+ __ret = true;
198+ break;
199+ }
200+ else if (__m == _M_bit[__bitcur])
201+ break;
202+ }
203+ }
204+
205 return __ret;
206 }
207
208@@ -290,4 +312,5 @@ namespace std
209 #endif
210 }
211 #endif // _GLIBCXX_USE_WCHAR_T
212-}
213+
214+_GLIBCXX_END_NAMESPACE
215Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
216===================================================================
217--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
218+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
219@@ -53,12 +53,16 @@
220 template<typename _CharT>
221 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
222 size_t __refs)
223- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
224- _M_name_messages(__s)
225+ : facet(__refs), _M_c_locale_messages(NULL),
226+ _M_name_messages(NULL)
227 {
228- char* __tmp = new char[std::strlen(__s) + 1];
229- std::strcpy(__tmp, __s);
230+ const size_t __len = std::strlen(__s) + 1;
231+ char* __tmp = new char[__len];
232+ std::memcpy(__tmp, __s, __len);
233 _M_name_messages = __tmp;
234+
235+ // Last to avoid leaking memory if new throws.
236+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
237 }
238
239 template<typename _CharT>
240Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
241===================================================================
242--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
243+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
244@@ -33,9 +33,14 @@
245
246 // Written by Benjamin Kosnik <bkoz@redhat.com>
247
248+#include <features.h>
249+#ifdef __UCLIBC_HAS_LOCALE__
250 #define _LIBC
251 #include <locale>
252 #undef _LIBC
253+#else
254+#include <locale>
255+#endif
256 #include <bits/c++locale_internal.h>
257
258 #ifdef __UCLIBC_MJN3_ONLY__
259@@ -206,7 +211,7 @@ namespace std
260 }
261 break;
262 default:
263- ;
264+ __ret = pattern();
265 }
266 return __ret;
267 }
268@@ -390,7 +395,9 @@ namespace std
269 __c_locale __old = __uselocale(__cloc);
270 #else
271 // Switch to named locale so that mbsrtowcs will work.
272- char* __old = strdup(setlocale(LC_ALL, NULL));
273+ char* __old = setlocale(LC_ALL, NULL);
274+ const size_t __llen = strlen(__old) + 1;
275+ char* __sav = new char[__llen];
276 setlocale(LC_ALL, __name);
277 #endif
278
279@@ -477,8 +484,8 @@ namespace std
280 #ifdef __UCLIBC_HAS_XLOCALE__
281 __uselocale(__old);
282 #else
283- setlocale(LC_ALL, __old);
284- free(__old);
285+ setlocale(LC_ALL, __sav);
286+ delete [] __sav;
287 #endif
288 __throw_exception_again;
289 }
290@@ -498,8 +505,8 @@ namespace std
291 #ifdef __UCLIBC_HAS_XLOCALE__
292 __uselocale(__old);
293 #else
294- setlocale(LC_ALL, __old);
295- free(__old);
296+ setlocale(LC_ALL, __sav);
297+ delete [] __sav;
298 #endif
299 }
300 }
301@@ -545,8 +552,11 @@ namespace std
302 __c_locale __old = __uselocale(__cloc);
303 #else
304 // Switch to named locale so that mbsrtowcs will work.
305- char* __old = strdup(setlocale(LC_ALL, NULL));
306- setlocale(LC_ALL, __name);
307+ char* __old = setlocale(LC_ALL, NULL);
308+ const size_t __llen = strlen(__old) + 1;
309+ char* __sav = new char[__llen];
310+ memcpy(__sav, __old, __llen);
311+ setlocale(LC_ALL, __name);
312 #endif
313
314 #ifdef __UCLIBC_MJN3_ONLY__
315@@ -633,8 +643,8 @@ namespace std
316 #ifdef __UCLIBC_HAS_XLOCALE__
317 __uselocale(__old);
318 #else
319- setlocale(LC_ALL, __old);
320- free(__old);
321+ setlocale(LC_ALL, __sav);
322+ delete [] __sav;
323 #endif
324 __throw_exception_again;
325 }
326@@ -653,8 +663,8 @@ namespace std
327 #ifdef __UCLIBC_HAS_XLOCALE__
328 __uselocale(__old);
329 #else
330- setlocale(LC_ALL, __old);
331- free(__old);
332+ setlocale(LC_ALL, __sav);
333+ delete [] __sav;
334 #endif
335 }
336 }
337Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
338===================================================================
339--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
340+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
341@@ -33,9 +33,14 @@
342
343 // Written by Benjamin Kosnik <bkoz@redhat.com>
344
345+#include <features.h>
346+#ifdef __UCLIBC_HAS_LOCALE__
347 #define _LIBC
348 #include <locale>
349 #undef _LIBC
350+#else
351+#include <locale>
352+#endif
353 #include <bits/c++locale_internal.h>
354
355 #ifdef __UCLIBC_MJN3_ONLY__
356Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
357===================================================================
358--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
359+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
360@@ -50,12 +50,21 @@
361 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
362 size_t __refs)
363 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
364- _M_name_timepunct(__s)
365+ _M_name_timepunct(NULL)
366 {
367- char* __tmp = new char[std::strlen(__s) + 1];
368- std::strcpy(__tmp, __s);
369+ const size_t __len = std::strlen(__s) + 1;
370+ char* __tmp = new char[__len];
371+ std::memcpy(__tmp, __s, __len);
372 _M_name_timepunct = __tmp;
373- _M_initialize_timepunct(__cloc);
374+
375+ try
376+ { _M_initialize_timepunct(__cloc); }
377+ catch(...)
378+ {
379+ delete [] _M_name_timepunct;
380+ __throw_exception_again;
381+ }
382+
383 }
384
385 template<typename _CharT>
386Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
387===================================================================
388--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
389+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
390@@ -39,21 +39,23 @@
391 #pragma GCC system_header
392
393 #include <cstring> // get std::strlen
394-#include <cstdio> // get std::snprintf or std::sprintf
395+#include <cstdio> // get std::vsnprintf or std::vsprintf
396 #include <clocale>
397 #include <langinfo.h> // For codecvt
398 #ifdef __UCLIBC_MJN3_ONLY__
399 #warning fix this
400 #endif
401-#ifdef __UCLIBC_HAS_LOCALE__
402+#ifdef _GLIBCXX_USE_ICONV
403 #include <iconv.h> // For codecvt using iconv, iconv_t
404 #endif
405-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
406-#include <libintl.h> // For messages
407+#ifdef HAVE_LIBINTL_H
408+#include <libintl.h> // For messages
409 #endif
410+#include <cstdarg>
411
412 #ifdef __UCLIBC_MJN3_ONLY__
413 #warning what is _GLIBCXX_C_LOCALE_GNU for
414+// psm: used in os/gnu-linux/ctype_noninline.h
415 #endif
416 #define _GLIBCXX_C_LOCALE_GNU 1
417
418@@ -78,23 +80,25 @@ namespace std
419 #else
420 typedef int* __c_locale;
421 #endif
422-
423- // Convert numeric value of type _Tv to string and return length of
424- // string. If snprintf is available use it, otherwise fall back to
425- // the unsafe sprintf which, in general, can be dangerous and should
426+ // Convert numeric value of type double to string and return length of
427+ // string. If vsnprintf is available use it, otherwise fall back to
428+ // the unsafe vsprintf which, in general, can be dangerous and should
429 // be avoided.
430- template<typename _Tv>
431- int
432- __convert_from_v(char* __out,
433- const int __size __attribute__ ((__unused__)),
434- const char* __fmt,
435-#ifdef __UCLIBC_HAS_XCLOCALE__
436- _Tv __v, const __c_locale& __cloc, int __prec)
437+ inline int
438+ __convert_from_v(const __c_locale&
439+#ifndef __UCLIBC_HAS_XCLOCALE__
440+ __cloc __attribute__ ((__unused__))
441+#endif
442+ ,
443+ char* __out,
444+ const int __size,
445+ const char* __fmt, ...)
446 {
447+ va_list __args;
448+#ifdef __UCLIBC_HAS_XCLOCALE__
449+
450 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
451 #else
452- _Tv __v, const __c_locale&, int __prec)
453- {
454 # ifdef __UCLIBC_HAS_LOCALE__
455 char* __old = std::setlocale(LC_ALL, NULL);
456 char* __sav = new char[std::strlen(__old) + 1];
457@@ -103,7 +107,9 @@ namespace std
458 # endif
459 #endif
460
461- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
462+ va_start(__args, __fmt);
463+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
464+ va_end(__args);
465
466 #ifdef __UCLIBC_HAS_XCLOCALE__
467 __gnu_cxx::__uselocale(__old);
468Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
469===================================================================
470--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
471+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
472@@ -53,11 +53,14 @@ namespace std
473 const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
474 _M_c_locale_timepunct);
475 #else
476- char* __old = strdup(setlocale(LC_ALL, NULL));
477+ char* __old = setlocale(LC_ALL, NULL);
478+ const size_t __llen = strlen(__old) + 1;
479+ char* __sav = new char[__llen];
480+ memcpy(__sav, __old, __llen);
481 setlocale(LC_ALL, _M_name_timepunct);
482 const size_t __len = strftime(__s, __maxlen, __format, __tm);
483- setlocale(LC_ALL, __old);
484- free(__old);
485+ setlocale(LC_ALL, __sav);
486+ delete [] __sav;
487 #endif
488 // Make sure __s is null terminated.
489 if (__len == 0)
490@@ -207,11 +210,14 @@ namespace std
491 const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
492 _M_c_locale_timepunct);
493 #else
494- char* __old = strdup(setlocale(LC_ALL, NULL));
495+ char* __old = setlocale(LC_ALL, NULL);
496+ const size_t __llen = strlen(__old) + 1;
497+ char* __sav = new char[__llen];
498+ memcpy(__sav, __old, __llen);
499 setlocale(LC_ALL, _M_name_timepunct);
500 const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
501- setlocale(LC_ALL, __old);
502- free(__old);
503+ setlocale(LC_ALL, __sav);
504+ delete [] __sav;
505 #endif
506 // Make sure __s is null terminated.
507 if (__len == 0)
508Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
509===================================================================
510--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
511+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
512@@ -31,6 +31,9 @@
513
514 #include <bits/c++config.h>
515 #include <clocale>
516+#include <cstdlib>
517+#include <cstring>
518+#include <cstddef>
519
520 #ifdef __UCLIBC_MJN3_ONLY__
521 #warning clean this up
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch b/meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch
new file mode 100644
index 0000000000..9589822b8d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/boehm-gc/include/gc.h
4===================================================================
5--- gcc-4.6.0.orig/boehm-gc/include/gc.h
6+++ gcc-4.6.0/boehm-gc/include/gc.h
7@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
8 #if defined(__linux__) || defined(__GLIBC__)
9 # include <features.h>
10 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
11- && !defined(__ia64__)
12+ && !defined(__ia64__) && !defined(__UCLIBC__)
13 # ifndef GC_HAVE_BUILTIN_BACKTRACE
14 # define GC_HAVE_BUILTIN_BACKTRACE
15 # endif
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch
new file mode 100644
index 0000000000..9becc15e11
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Pending
2
3Index: gcc-4_7-branch/libstdc++-v3/include/c_std/cstdio
4===================================================================
5--- gcc-4_7-branch.orig/libstdc++-v3/include/c_std/cstdio 2012-04-10 10:19:49.603337089 -0700
6+++ gcc-4_7-branch/libstdc++-v3/include/c_std/cstdio 2012-04-10 10:30:59.863369565 -0700
7@@ -140,7 +140,7 @@
8 using ::vsprintf;
9 } // namespace std
10
11-#if _GLIBCXX_USE_C99
12+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
13
14 #undef snprintf
15 #undef vfscanf
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch b/meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000000..d69c54696a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch
@@ -0,0 +1,16 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: gcc-4_7-branch/libstdc++-v3/configure
4===================================================================
5--- gcc-4_7-branch.orig/libstdc++-v3/configure 2012-04-10 10:30:37.347368481 -0700
6+++ gcc-4_7-branch/libstdc++-v3/configure 2012-04-10 10:31:22.787370652 -0700
7@@ -18767,6 +18767,9 @@
8 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9 /* end confdefs.h. */
10 #include <complex.h>
11+#ifdef __UCLIBC__
12+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
13+#endif
14 int
15 main ()
16 {
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch b/meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch
new file mode 100644
index 0000000000..f103765233
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch
@@ -0,0 +1,30 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/include/ext/rope
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/include/ext/rope
6+++ gcc-4.6.0/libstdc++-v3/include/ext/rope
7@@ -54,6 +54,9 @@
8 #include <bits/gthr.h>
9 #include <tr1/functional>
10
11+/* cope w/ index defined as macro, SuSv3 proposal */
12+#undef index
13+
14 # ifdef __GC
15 # define __GC_CONST const
16 # else
17Index: gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
18===================================================================
19--- gcc-4.6.0.orig/libstdc++-v3/include/ext/ropeimpl.h
20+++ gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
21@@ -49,6 +49,9 @@
22 #include <ext/memory> // For uninitialized_copy_n
23 #include <ext/numeric> // For power
24
25+/* cope w/ index defined as macro, SuSv3 proposal */
26+#undef index
27+
28 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
29 {
30 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch b/meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000000..10d09a7fb9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch
@@ -0,0 +1,51 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: gcc-4_7-branch/libmudflap/mf-hooks2.c
4===================================================================
5--- gcc-4_7-branch.orig/libmudflap/mf-hooks2.c 2012-04-10 10:19:49.391337079 -0700
6+++ gcc-4_7-branch/libmudflap/mf-hooks2.c 2012-04-10 10:31:53.191372119 -0700
7@@ -424,7 +424,7 @@
8 {
9 TRACE ("%s\n", __PRETTY_FUNCTION__);
10 MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
11- bzero (s, n);
12+ memset (s, 0, n);
13 }
14
15
16@@ -434,7 +434,7 @@
17 TRACE ("%s\n", __PRETTY_FUNCTION__);
18 MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
19 MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
20- bcopy (src, dest, n);
21+ memmove (dest, src, n);
22 }
23
24
25@@ -444,7 +444,7 @@
26 TRACE ("%s\n", __PRETTY_FUNCTION__);
27 MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
28 MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
29- return bcmp (s1, s2, n);
30+ return n == 0 ? 0 : memcmp (s1, s2, n);
31 }
32
33
34@@ -453,7 +453,7 @@
35 size_t n = strlen (s);
36 TRACE ("%s\n", __PRETTY_FUNCTION__);
37 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
38- return index (s, c);
39+ return strchr (s, c);
40 }
41
42
43@@ -462,7 +462,7 @@
44 size_t n = strlen (s);
45 TRACE ("%s\n", __PRETTY_FUNCTION__);
46 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
47- return rindex (s, c);
48+ return strrchr (s, c);
49 }
50
51 /* XXX: stpcpy, memccpy */
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch b/meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch
new file mode 100644
index 0000000000..e99bf9602d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch
@@ -0,0 +1,40 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
7@@ -32,7 +32,8 @@
8 //
9
10 // Written by Benjamin Kosnik <bkoz@redhat.com>
11-
12+namespace std
13+{
14 #ifdef __UCLIBC_MJN3_ONLY__
15 #warning fix prototypes for *textdomain funcs
16 #endif
17@@ -116,3 +117,4 @@
18 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
19 }
20 }
21+}
22Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
23===================================================================
24--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
25+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
26@@ -33,7 +33,8 @@
27 //
28
29 // Written by Benjamin Kosnik <bkoz@redhat.com>
30-
31+namespace std
32+{
33 template<typename _CharT>
34 __timepunct<_CharT>::__timepunct(size_t __refs)
35 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
36@@ -75,3 +76,4 @@
37 delete _M_data;
38 _S_destroy_c_locale(_M_c_locale_timepunct);
39 }
40+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch b/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
new file mode 100644
index 0000000000..f47566951b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
@@ -0,0 +1,63 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3GCC has internal multilib handling code but it assumes a very specific rigid directory
4layout. The build system implementation of multilib layout is very generic and allows
5complete customisation of the library directories.
6
7This patch is a partial solution to allow any custom directories to be passed into gcc
8and handled correctly. It forces gcc to use the base_libdir (which is the current
9directory, "."). We need to do this for each multilib that is configured as we don't
10know which compiler options may be being passed into the compiler. Since we have a compiler
11per mulitlib at this point that isn't an issue.
12
13The one problem is the target compiler is only going to work for the default multlilib at
14this point. Ideally we'd figure out which multilibs were being enabled with which paths
15and be able to patch these entries with a complete set of correct paths but this we
16don't have such code at this point. This is something the target gcc recipe should do
17and override these platform defaults in its build config.
18
19RP 15/8/11
20
21Index: trunk/gcc/config/i386/t-linux64
22===================================================================
23--- trunk.orig/gcc/config/i386/t-linux64 2012-02-22 09:44:48.000000000 -0800
24+++ trunk/gcc/config/i386/t-linux64 2012-02-22 12:31:01.836462957 -0800
25@@ -33,7 +33,6 @@
26 #
27 comma=,
28 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
29-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
30-MULTILIB_OSDIRNAMES = m64=../lib64
31-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
32-MULTILIB_OSDIRNAMES+= mx32=../libx32
33+MULTILIB_DIRNAMES = . .
34+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
35+
36Index: trunk/gcc/config/mips/t-linux64
37===================================================================
38--- trunk.orig/gcc/config/mips/t-linux64 2012-02-22 09:44:58.000000000 -0800
39+++ trunk/gcc/config/mips/t-linux64 2012-02-22 12:32:01.132465823 -0800
40@@ -17,5 +17,5 @@
41 # <http://www.gnu.org/licenses/>.
42
43 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
44-MULTILIB_DIRNAMES = n32 32 64
45-MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
46+MULTILIB_DIRNAMES = . . .
47+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
48Index: trunk/gcc/config/rs6000/t-linux64
49===================================================================
50--- trunk.orig/gcc/config/rs6000/t-linux64 2012-02-22 09:44:54.000000000 -0800
51+++ trunk/gcc/config/rs6000/t-linux64 2012-02-22 12:28:17.960454968 -0800
52@@ -27,9 +27,9 @@
53 # MULTILIB_OSDIRNAMES according to what is found on the target.
54
55 MULTILIB_OPTIONS = m64/m32 msoft-float
56-MULTILIB_DIRNAMES = 64 32 nof
57+MULTILIB_DIRNAMES = . . .
58 MULTILIB_EXTRA_OPTS = fPIC mstrict-align
59 MULTILIB_EXCEPTIONS = m64/msoft-float
60 MULTILIB_EXCLUSIONS = m64/!m32/msoft-float
61-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
62+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
63 MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT)
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch b/meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch
new file mode 100644
index 0000000000..1406f87f1c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Pending
2
3http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
4http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
5
6Index: gcc-4_7-branch/gcc/configure.ac
7===================================================================
8--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:22:05.787343661 -0700
9+++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:32:18.415373343 -0700
10@@ -3065,7 +3065,7 @@
11 tls_first_minor=14
12 tls_as_opt="-m64 -Aesame --fatal-warnings"
13 ;;
14- sh-*-* | sh[34]-*-*)
15+ sh-*-* | sh[34]*-*-*)
16 conftest_s='
17 .section ".tdata","awT",@progbits
18 foo: .long 25
19Index: gcc-4_7-branch/gcc/configure
20===================================================================
21--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:22:05.803343691 -0700
22+++ gcc-4_7-branch/gcc/configure 2012-04-10 10:32:18.419373328 -0700
23@@ -23481,7 +23481,7 @@
24 tls_first_minor=14
25 tls_as_opt="-m64 -Aesame --fatal-warnings"
26 ;;
27- sh-*-* | sh[34]-*-*)
28+ sh-*-* | sh[34]*-*-*)
29 conftest_s='
30 .section ".tdata","awT",@progbits
31 foo: .long 25
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch b/meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch
new file mode 100644
index 0000000000..ac301bd844
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch
@@ -0,0 +1,36 @@
1Upstream-Status: Pending
2
3By Lennert Buytenhek <buytenh@wantstofly.org>
4Adds support for arm*b-linux* big-endian ARM targets
5
6See http://gcc.gnu.org/PR16350
7
8Index: gcc-4_7-branch/gcc/config/arm/linux-elf.h
9===================================================================
10--- gcc-4_7-branch.orig/gcc/config/arm/linux-elf.h 2012-04-10 10:19:49.171337068 -0700
11+++ gcc-4_7-branch/gcc/config/arm/linux-elf.h 2012-04-10 10:32:36.819374226 -0700
12@@ -48,7 +48,7 @@
13
14 #undef MULTILIB_DEFAULTS
15 #define MULTILIB_DEFAULTS \
16- { "marm", "mlittle-endian", "mfloat-abi=hard", "mno-thumb-interwork" }
17+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=hard", "mno-thumb-interwork" }
18
19 /* Now we define the strings used to build the spec file. */
20 #undef LIB_SPEC
21Index: gcc-4_7-branch/gcc/config.gcc
22===================================================================
23--- gcc-4_7-branch.orig/gcc/config.gcc 2012-04-10 10:19:49.159337069 -0700
24+++ gcc-4_7-branch/gcc/config.gcc 2012-04-10 10:32:36.823374222 -0700
25@@ -842,6 +842,11 @@
26 esac
27 tmake_file="${tmake_file} arm/t-arm"
28 case ${target} in
29+ arm*b-*)
30+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
31+ ;;
32+ esac
33+ case ${target} in
34 arm*-*-linux-*eabi)
35 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
36 tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch b/meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch
new file mode 100644
index 0000000000..e790e06dcb
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch
@@ -0,0 +1,76 @@
1Upstream-Status: Pending
2
3Hi,
4
5The attached patch makes sure that we create smaller object code for
6simple switch statements. We just make sure to flatten the switch
7statement into an if-else chain, basically.
8
9This fixes a size-regression as compared to gcc-3.4, as can be seen
10below.
11
122007-04-15 Bernhard Fischer <..>
13
14 * stmt.c (expand_case): Do not create a complex binary tree when
15 optimizing for size but rather use the simple ordered list.
16 (emit_case_nodes): do not emit jumps to the default_label when
17 optimizing for size.
18
19Not regtested so far.
20Comments?
21
22Attached is the test switch.c mentioned below.
23
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 -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done
26$ 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
27gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done
28
29$ size switch-*.o
30 text data bss dec hex filename
31 169 0 0 169 a9 switch-2.95.o
32 115 0 0 115 73 switch-3.3.o
33 103 0 0 103 67 switch-3.4.o
34 124 0 0 124 7c switch-4.0.o
35 124 0 0 124 7c switch-4.1.o
36 124 0 0 124 7c switch-4.2.orig-HEAD.o
37 95 0 0 95 5f switch-4.3-HEAD.o
38 124 0 0 124 7c switch-4.3.orig-HEAD.o
39 166 0 0 166 a6 switch-CHAIN-2.95.o
40 111 0 0 111 6f switch-CHAIN-3.3.o
41 95 0 0 95 5f switch-CHAIN-3.4.o
42 95 0 0 95 5f switch-CHAIN-4.0.o
43 95 0 0 95 5f switch-CHAIN-4.1.o
44 95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o
45 95 0 0 95 5f switch-CHAIN-4.3-HEAD.o
46 95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o
47
48
49Content-Type: text/x-diff; charset=us-ascii
50Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff"
51
52Index: gcc-4_7-branch/gcc/stmt.c
53===================================================================
54--- gcc-4_7-branch.orig/gcc/stmt.c 2012-04-10 10:19:49.095337065 -0700
55+++ gcc-4_7-branch/gcc/stmt.c 2012-04-10 10:32:52.219375048 -0700
56@@ -2397,7 +2397,11 @@
57 default code is emitted. */
58
59 use_cost_table = estimate_case_costs (case_list);
60- balance_case_nodes (&case_list, NULL);
61+ /* When optimizing for size, we want a straight list to avoid
62+ jumps as much as possible. This basically creates an if-else
63+ chain. */
64+ if (!optimize_size)
65+ balance_case_nodes (&case_list, NULL);
66 emit_case_nodes (index, case_list, default_label, index_type);
67 if (default_label)
68 emit_jump (default_label);
69@@ -2965,6 +2969,7 @@
70 {
71 if (!node_has_low_bound (node, index_type))
72 {
73+ if (!optimize_size) /* don't jl to the .default_label. */
74 emit_cmp_and_jump_insns (index,
75 convert_modes
76 (mode, imode,
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000000..f5982983f2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,25 @@
1Upstream-Status: Pending
2
3#This patck added --sysroot into COLLECT_GCC_OPTIONS which is used to
4#invoke collect2.
5
6Index: gcc-4_7-branch/gcc/gcc.c
7===================================================================
8--- gcc-4_7-branch.orig/gcc/gcc.c 2012-04-10 10:37:49.487389409 -0700
9+++ gcc-4_7-branch/gcc/gcc.c 2012-04-10 10:38:50.831392259 -0700
10@@ -3995,6 +3995,15 @@
11 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
12
13 first_time = TRUE;
14+#ifdef HAVE_LD_SYSROOT
15+ if (target_system_root_changed && target_system_root)
16+ {
17+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
18+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
19+ obstack_grow (&collect_obstack, "'", 1);
20+ first_time = FALSE;
21+ }
22+#endif
23 for (i = 0; (int) i < n_switches; i++)
24 {
25 const char *const *args;
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/arm-nolibfloat.patch b/meta/recipes-devtools/gcc/gcc-4.7/arm-nolibfloat.patch
new file mode 100644
index 0000000000..901f014ed7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/arm-nolibfloat.patch
@@ -0,0 +1,40 @@
1Upstream-Status: Pending
2
3# Dimitry Andric <dimitry@andric.com>, 2004-05-01
4#
5# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
6# anymore. (The required functions are now in libgcc.)
7#
8# Fixes errors like
9# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat
10# collect2: ld returned 1 exit status
11# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1
12# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat
13
14Index: trunk/gcc/config/arm/linux-elf.h
15===================================================================
16--- trunk.orig/gcc/config/arm/linux-elf.h 2012-02-22 12:04:30.644385926 -0800
17+++ trunk/gcc/config/arm/linux-elf.h 2012-02-22 12:04:30.764385931 -0800
18@@ -57,7 +57,7 @@
19 %{shared:-lc} \
20 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
21
22-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
23+#define LIBGCC_SPEC "-lgcc"
24
25 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
26
27Index: trunk/libgcc/config/arm/t-linux
28===================================================================
29--- trunk.orig/libgcc/config/arm/t-linux 2012-02-22 12:11:48.372407121 -0800
30+++ trunk/libgcc/config/arm/t-linux 2012-02-22 12:13:19.868411588 -0800
31@@ -1,6 +1,8 @@
32 LIB1ASMSRC = arm/lib1funcs.S
33 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
34- _arm_addsubdf3 _arm_addsubsf3
35+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
36+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
37+ _fixsfsi _fixunssfsi _floatdidf _floatundidf _floatdisf _floatundisf
38
39 # Just for these, we omit the frame pointer since it makes such a big
40 # difference.
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch b/meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch
new file mode 100644
index 0000000000..bc01cd9103
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch
@@ -0,0 +1,48 @@
1Upstream-Status: Inappropriate [configuration]
2
3GCC: disable MASK_RELAX_PIC_CALLS bit
4
5The new feature added after 4.3.3
6"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
7will cause cc1plus eat up all the system memory when build webkit-gtk.
8The function mips_get_pic_call_symbol keeps on recursively calling itself.
9Disable this feature to walk aside the bug.
10
11Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
12
13Index: gcc-4_7-branch/gcc/configure
14===================================================================
15--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:37:09.351387437 -0700
16+++ gcc-4_7-branch/gcc/configure 2012-04-10 10:37:57.211389779 -0700
17@@ -25837,13 +25837,6 @@
18 rm -f conftest.*
19 fi
20 fi
21- if test $gcc_cv_as_ld_jalr_reloc = yes; then
22- if test x$target_cpu_default = x; then
23- target_cpu_default=MASK_RELAX_PIC_CALLS
24- else
25- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
26- fi
27- fi
28 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
29 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
30
31Index: gcc-4_7-branch/gcc/configure.ac
32===================================================================
33--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:37:09.339387366 -0700
34+++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:37:57.215389769 -0700
35@@ -4027,13 +4027,6 @@
36 rm -f conftest.*
37 fi
38 fi
39- if test $gcc_cv_as_ld_jalr_reloc = yes; then
40- if test x$target_cpu_default = x; then
41- target_cpu_default=MASK_RELAX_PIC_CALLS
42- else
43- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
44- fi
45- fi
46 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
47
48 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..2773b42cca
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch
@@ -0,0 +1,32 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
4 used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
5 directory.
6
7Index: gcc-4_7-branch/libgfortran/configure
8===================================================================
9--- gcc-4_7-branch.orig/libgfortran/configure 2012-04-10 10:17:24.055330044 -0700
10+++ gcc-4_7-branch/libgfortran/configure 2012-04-10 10:42:26.159402591 -0700
11@@ -12689,7 +12689,7 @@
12
13 # We need gfortran to compile parts of the library
14 #AC_PROG_FC(gfortran)
15-FC="$GFORTRAN"
16+#FC="$GFORTRAN"
17 ac_ext=${ac_fc_srcext-f}
18 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
19 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
20Index: gcc-4_7-branch/libgfortran/configure.ac
21===================================================================
22--- gcc-4_7-branch.orig/libgfortran/configure.ac 2012-04-10 10:17:24.063330046 -0700
23+++ gcc-4_7-branch/libgfortran/configure.ac 2012-04-10 10:42:26.159402591 -0700
24@@ -227,7 +227,7 @@
25
26 # We need gfortran to compile parts of the library
27 #AC_PROG_FC(gfortran)
28-FC="$GFORTRAN"
29+#FC="$GFORTRAN"
30 AC_PROG_FC(gfortran)
31
32 # extra LD Flags which are required for targets
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..964c4bbbf2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,33 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3---
4 configure | 2 +-
5 configure.ac | 2 +-
6 2 files changed, 2 insertions(+), 2 deletions(-)
7
8Index: gcc-4_7-branch/configure.ac
9===================================================================
10--- gcc-4_7-branch.orig/configure.ac 2012-04-10 10:19:50.923337154 -0700
11+++ gcc-4_7-branch/configure.ac 2012-04-10 10:19:54.911337344 -0700
12@@ -2825,7 +2825,7 @@
13 # for target_alias and gcc doesn't manage it consistently.
14 target_configargs="--cache-file=./config.cache ${target_configargs}"
15
16-FLAGS_FOR_TARGET=
17+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
18 case " $target_configdirs " in
19 *" newlib "*)
20 case " $target_configargs " in
21Index: gcc-4_7-branch/configure
22===================================================================
23--- gcc-4_7-branch.orig/configure 2012-04-10 10:19:50.911337153 -0700
24+++ gcc-4_7-branch/configure 2012-04-10 10:19:54.915337349 -0700
25@@ -7368,7 +7368,7 @@
26 # for target_alias and gcc doesn't manage it consistently.
27 target_configargs="--cache-file=./config.cache ${target_configargs}"
28
29-FLAGS_FOR_TARGET=
30+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
31 case " $target_configdirs " in
32 *" newlib "*)
33 case " $target_configargs " in
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..ff136e19aa
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,116 @@
1Upstream-Status: Pending
2
3Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
4
5This 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.
6
7Other changes I had to do include:
8
9- 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.
10
11- passing the right CFLAGS to configure scripts as exported environment variables
12
13I 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.
14
15Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
16
17Paolo
18
192008-02-19 Paolo Bonzini <bonzini@gnu.org>
20
21 PR bootstrap/32009
22 PR bootstrap/32161
23
24 * configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Compute here.
25 * configure: Regenerate.
26
27 * Makefile.def: Define stage_libcflags for all bootstrap stages.
28 * Makefile.tpl (BOOT_LIBCFLAGS, STAGE2_LIBCFLAGS, STAGE3_LIBCFLAGS,
29 STAGE4_LIBCFLAGS): New.
30 (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Subst from autoconf, without
31 $(SYSROOT_CFLAGS_FOR_TARGET) and $(DEBUG_PREFIX_CFLAGS_FOR_TARGET).
32 (BASE_TARGET_EXPORTS): Append them here to C{,XX}FLAGS.
33 (EXTRA_TARGET_FLAGS): Append them here to {LIB,}C{,XX}FLAGS.
34 (configure-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags
35 for target modules. Don't export LIBCFLAGS.
36 (all-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags; pass
37 $(BASE_FLAGS_TO_PASS) where [+args+] was passed, and [+args+] after
38 the overridden CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
39 (invocations of `all'): Replace $(TARGET_FLAGS_TO_PASS) with
40 $(EXTRA_TARGET_FLAGS), $(FLAGS_TO_PASS) with $(EXTRA_HOST_FLAGS).
41 * Makefile.in: Regenerate.
42
43config:
442008-02-19 Paolo Bonzini <bonzini@gnu.org>
45
46 PR bootstrap/32009
47 * mh-ppc-darwin (BOOT_CFLAGS): Reenable.
48
49gcc:
502008-02-19 Paolo Bonzini <bonzini@gnu.org>
51
52 PR bootstrap/32009
53 * doc/install.texi: Correct references to CFLAGS, replacing them
54 with BOOT_CFLAGS. Document flags used during bootstrap for
55 target libraries.
56
57
58---
59 Makefile.def | 25
60 Makefile.in | 1845 ++++++++++++++++++++++++++++++-------------------
61 Makefile.tpl | 91 +-
62 config/mh-ppc-darwin | 3
63 configure | 36
64 configure.ac | 32
65 gcc/Makefile.in | 2
66 gcc/configure | 6
67 gcc/configure.ac | 3
68 gcc/doc/install.texi | 56 -
69 libiberty/Makefile.in | 162 ++--
70 libiberty/configure | 46 -
71 libiberty/configure.ac | 43 -
72 13 files changed, 1454 insertions(+), 896 deletions(-)
73
74Index: gcc-4_7-branch/configure
75===================================================================
76--- gcc-4_7-branch.orig/configure 2012-04-10 10:22:05.807343683 -0700
77+++ gcc-4_7-branch/configure 2012-04-10 10:37:24.243388086 -0700
78@@ -6695,6 +6695,38 @@
79
80
81
82+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
83+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
84+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
85+# We want to ensure that TARGET libraries (which we know are built with
86+# gcc) are built with "-O2 -g", so include those options when setting
87+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
88+if test "x$CFLAGS_FOR_TARGET" = x; then
89+ CFLAGS_FOR_TARGET=$CFLAGS
90+ case " $CFLAGS " in
91+ *" -O2 "*) ;;
92+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
93+ esac
94+ case " $CFLAGS " in
95+ *" -g "* | *" -g3 "*) ;;
96+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
97+ esac
98+fi
99+
100+
101+if test "x$CXXFLAGS_FOR_TARGET" = x; then
102+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
103+ case " $CXXFLAGS " in
104+ *" -O2 "*) ;;
105+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
106+ esac
107+ case " $CXXFLAGS " in
108+ *" -g "* | *" -g3 "*) ;;
109+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
110+ esac
111+fi
112+
113+
114 # Handle --with-headers=XXX. If the value is not "yes", the contents of
115 # the named directory are copied to $(tooldir)/sys-include.
116 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch
new file mode 100644
index 0000000000..607129a6fe
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch
@@ -0,0 +1,27 @@
1Upstream-Status: Pending
2
3Add /sw/include and /opt/include based on the original
4zecke-no-host-includes.patch patch. The original patch checked for
5/usr/include, /sw/include and /opt/include and then triggered a failure and
6aborted.
7
8Instead, we add the two missing items to the current scan. If the user
9wants this to be a failure, they can add "-Werror=poison-system-directories".
10
11Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
12
13Index: gcc-4_7-branch/gcc/incpath.c
14===================================================================
15--- gcc-4_7-branch.orig/gcc/incpath.c 2012-04-10 10:37:09.343387385 -0700
16+++ gcc-4_7-branch/gcc/incpath.c 2012-04-10 10:37:18.975387919 -0700
17@@ -371,7 +371,9 @@
18 {
19 if ((!strncmp (p->name, "/usr/include", 12))
20 || (!strncmp (p->name, "/usr/local/include", 18))
21- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
22+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
23+ || (!strncmp (p->name, "/sw/include", 11))
24+ || (!strncmp (p->name, "/opt/include", 12)))
25 warning (OPT_Wpoison_system_directories,
26 "include location \"%s\" is unsafe for "
27 "cross-compilation",
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..b66b23b308
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch
@@ -0,0 +1,223 @@
1Upstream-Status: Inappropriate [distribution: codesourcery]
2
3 gcc/
4 2008-07-02 Joseph Myers <joseph@codesourcery.com>
5 * c-incpath.c: Include toplev.h.
6 (merge_include_chains): Use warning instead of cpp_error for
7 system directory poisoning diagnostic.
8 * Makefile.in (c-incpath.o): Depend on toplev.h.
9 * gcc.c (LINK_COMMAND_SPEC): Pass
10 --error-poison-system-directories if
11 -Werror=poison-system-directories.
12
13 2007-06-13 Joseph Myers <joseph@codesourcery.com>
14 * common.opt (--Wno-poison-system-directories): New.
15 * doc/invoke.texi (-Wno-poison-system-directories): Document.
16 * c-incpath.c: Include flags.h.
17 (merge_include_chains): Check flag_poison_system_directories.
18 * gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
19 to linker if -Wno-poison-system-directories.
20 * Makefile.in (c-incpath.o): Depend on $(FLAGS_H).
21
22 2007-03-20 Daniel Jacobowitz <dan@codesourcery.com>
23 Joseph Myers <joseph@codesourcery.com>
24 * configure.ac (--enable-poison-system-directories): New option.
25 * configure, config.in: Regenerate.
26 * c-incpath.c (merge_include_chains): If
27 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of
28 /usr/include, /usr/local/include or /usr/X11R6/include.
29
30Index: gcc-4_7-branch/gcc/common.opt
31===================================================================
32--- gcc-4_7-branch.orig/gcc/common.opt 2012-04-10 10:54:04.000000000 -0700
33+++ gcc-4_7-branch/gcc/common.opt 2012-04-10 10:56:02.259442274 -0700
34@@ -582,6 +582,10 @@
35 Common Var(warn_padded) Warning
36 Warn when padding is required to align structure members
37
38+Wpoison-system-directories
39+Common Var(flag_poison_system_directories) Init(1) Warning
40+Warn for -I and -L options using system directories if cross compiling
41+
42 Wshadow
43 Common Var(warn_shadow) Warning
44 Warn when one local variable shadows another
45Index: gcc-4_7-branch/gcc/config.in
46===================================================================
47--- gcc-4_7-branch.orig/gcc/config.in 2012-04-10 10:54:04.000000000 -0700
48+++ gcc-4_7-branch/gcc/config.in 2012-04-10 10:56:02.259442274 -0700
49@@ -144,6 +144,12 @@
50 #endif
51
52
53+/* Define to warn for use of native system header directories */
54+#ifndef USED_FOR_TARGET
55+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
56+#endif
57+
58+
59 /* Define if you want all operations on RTL (the basic data structure of the
60 optimizer and back end) to be checked for dynamic type safety at runtime.
61 This is quite expensive. */
62Index: gcc-4_7-branch/gcc/configure.ac
63===================================================================
64--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:55:32.000000000 -0700
65+++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:56:02.259442274 -0700
66@@ -4959,6 +4959,16 @@
67 [specify that runtime libraries should be
68 installed in a compiler-specific directory])])
69
70+AC_ARG_ENABLE([poison-system-directories],
71+ AS_HELP_STRING([--enable-poison-system-directories],
72+ [warn for use of native system header directories]),,
73+ [enable_poison_system_directories=no])
74+if test "x${enable_poison_system_directories}" = "xyes"; then
75+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
76+ [1],
77+ [Define to warn for use of native system header directories])
78+fi
79+
80 # Substitute configuration variables
81 AC_SUBST(subdirs)
82 AC_SUBST(srcdir)
83Index: gcc-4_7-branch/gcc/doc/invoke.texi
84===================================================================
85--- gcc-4_7-branch.orig/gcc/doc/invoke.texi 2012-04-10 10:54:04.000000000 -0700
86+++ gcc-4_7-branch/gcc/doc/invoke.texi 2012-04-10 10:56:02.263442231 -0700
87@@ -260,6 +260,7 @@
88 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
89 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
90 -Wpointer-arith -Wno-pointer-to-int-cast @gol
91+-Wno-poison-system-directories @gol
92 -Wredundant-decls @gol
93 -Wreturn-type -Wsequence-point -Wshadow @gol
94 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
95@@ -3878,6 +3879,14 @@
96 for most targets, it is made up of code and thus requires the stack
97 to be made executable in order for the program to work properly.
98
99+@item -Wno-poison-system-directories
100+@opindex Wno-poison-system-directories
101+Do not warn for @option{-I} or @option{-L} options using system
102+directories such as @file{/usr/include} when cross compiling. This
103+option is intended for use in chroot environments when such
104+directories contain the correct headers and libraries for the target
105+system rather than the host.
106+
107 @item -Wfloat-equal
108 @opindex Wfloat-equal
109 @opindex Wno-float-equal
110Index: gcc-4_7-branch/gcc/gcc.c
111===================================================================
112--- gcc-4_7-branch.orig/gcc/gcc.c 2012-04-10 10:54:04.000000000 -0700
113+++ gcc-4_7-branch/gcc/gcc.c 2012-04-10 10:56:02.267442207 -0700
114@@ -673,6 +673,8 @@
115 %{flto} %{flto=*} %l " LINK_PIE_SPEC \
116 "%X %{o*} %{e*} %{N} %{n} %{r}\
117 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
118+ %{Wno-poison-system-directories:--no-poison-system-directories}\
119+ %{Werror=poison-system-directories:--error-poison-system-directories}\
120 %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
121 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
122 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
123Index: gcc-4_7-branch/gcc/incpath.c
124===================================================================
125--- gcc-4_7-branch.orig/gcc/incpath.c 2012-04-10 10:54:04.000000000 -0700
126+++ gcc-4_7-branch/gcc/incpath.c 2012-04-10 10:56:02.267442207 -0700
127@@ -361,6 +361,24 @@
128 }
129 fprintf (stderr, _("End of search list.\n"));
130 }
131+
132+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
133+ if (flag_poison_system_directories)
134+ {
135+ struct cpp_dir *p;
136+
137+ for (p = heads[QUOTE]; p; p = p->next)
138+ {
139+ if ((!strncmp (p->name, "/usr/include", 12))
140+ || (!strncmp (p->name, "/usr/local/include", 18))
141+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
142+ warning (OPT_Wpoison_system_directories,
143+ "include location \"%s\" is unsafe for "
144+ "cross-compilation",
145+ p->name);
146+ }
147+ }
148+#endif
149 }
150
151 /* Use given -I paths for #include "..." but not #include <...>, and
152Index: gcc-4_7-branch/gcc/Makefile.in
153===================================================================
154--- gcc-4_7-branch.orig/gcc/Makefile.in 2012-04-10 10:54:05.000000000 -0700
155+++ gcc-4_7-branch/gcc/Makefile.in 2012-04-10 10:56:02.267442207 -0700
156@@ -2065,7 +2065,7 @@
157
158 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
159 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
160- $(MACHMODE_H)
161+ $(MACHMODE_H) $(FLAGS_H) toplev.h
162
163 CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
164 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
165Index: gcc-4_7-branch/gcc/configure
166===================================================================
167--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:55:32.000000000 -0700
168+++ gcc-4_7-branch/gcc/configure 2012-04-10 10:56:12.183442720 -0700
169@@ -914,6 +914,7 @@
170 with_system_zlib
171 enable_maintainer_mode
172 enable_version_specific_runtime_libs
173+enable_poison_system_directories
174 enable_plugin
175 enable_libquadmath_support
176 with_linker_hash_style
177@@ -1627,6 +1628,8 @@
178 --enable-version-specific-runtime-libs
179 specify that runtime libraries should be installed
180 in a compiler-specific directory
181+ --enable-poison-system-directories
182+ warn for use of native system header directories
183 --enable-plugin enable plugin support
184 --disable-libquadmath-support
185 disable libquadmath support for Fortran
186@@ -17970,7 +17973,7 @@
187 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
188 lt_status=$lt_dlunknown
189 cat > conftest.$ac_ext <<_LT_EOF
190-#line 17973 "configure"
191+#line 17976 "configure"
192 #include "confdefs.h"
193
194 #if HAVE_DLFCN_H
195@@ -18076,7 +18079,7 @@
196 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
197 lt_status=$lt_dlunknown
198 cat > conftest.$ac_ext <<_LT_EOF
199-#line 18079 "configure"
200+#line 18082 "configure"
201 #include "confdefs.h"
202
203 #if HAVE_DLFCN_H
204@@ -27075,6 +27078,19 @@
205 fi
206
207
208+# Check whether --enable-poison-system-directories was given.
209+if test "${enable_poison_system_directories+set}" = set; then :
210+ enableval=$enable_poison_system_directories;
211+else
212+ enable_poison_system_directories=no
213+fi
214+
215+if test "x${enable_poison_system_directories}" = "xyes"; then
216+
217+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
218+
219+fi
220+
221 # Substitute configuration variables
222
223
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 0000000000..1648b3b98c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,72 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.h
6+++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
7@@ -41,13 +41,22 @@
8
9 #include <clocale>
10
11+#ifdef __UCLIBC__
12+#include <features.h>
13+#include <ctype.h>
14+#endif
15+
16 #define _GLIBCXX_NUM_CATEGORIES 0
17
18 namespace std _GLIBCXX_VISIBILITY(default)
19 {
20 _GLIBCXX_BEGIN_NAMESPACE_VERSION
21
22+#ifdef __UCLIBC__
23+ typedef __ctype_touplow_t* __c_locale;
24+#else
25 typedef int* __c_locale;
26+#endif
27
28 // Convert numeric value of type double and long double to string and
29 // return length of string. If vsnprintf is available use it, otherwise
30Index: gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
31===================================================================
32--- gcc-4.6.0.orig/libstdc++-v3/config/os/gnu-linux/ctype_base.h
33+++ gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
34@@ -34,6 +34,11 @@
35
36 // Information as gleaned from /usr/include/ctype.h
37
38+#ifdef __UCLIBC__
39+#include <features.h>
40+#include <ctype.h>
41+#endif
42+
43 namespace std _GLIBCXX_VISIBILITY(default)
44 {
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
46@@ -42,7 +47,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 struct ctype_base
48 {
49 // Non-standard typedefs.
50+#ifdef __UCLIBC__
51+ typedef const __ctype_touplow_t* __to_type;
52+#else
53 typedef const int* __to_type;
54+#endif
55
56 // NB: Offsets into ctype<char>::_M_table force a particular size
57 // on the mask type. Because of this, we don't use an enum.
58Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
59===================================================================
60--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.cc
61+++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
62@@ -264,5 +264,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
63 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
64 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
65 extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
66+#ifdef __UCLIBC__
67+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
68+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
69+#else
70 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
71+#endif
72 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch b/meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch
new file mode 100644
index 0000000000..c2fe79217c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch
@@ -0,0 +1,61 @@
1ac_fn_c_try_compile doesnt seem to keep the intermediate files
2which are needed for sjlj test to pass since it greps into the
3generated file. So we run the compiler command using AC_TRY_COMMAND
4which then generates the needed .s file
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9Index: trunk/libgcc/configure
10===================================================================
11--- trunk.orig/libgcc/configure 2012-03-01 22:59:10.112444433 -0800
12+++ trunk/libgcc/configure 2012-03-01 22:59:50.424446325 -0800
13@@ -4525,17 +4525,19 @@
14 }
15
16 _ACEOF
17-CFLAGS_hold=$CFLAGS
18-CFLAGS="--save-temps -fexceptions"
19 libgcc_cv_lib_sjlj_exceptions=unknown
20-if ac_fn_c_try_compile; then :
21+if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
22+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
23+ (eval $ac_try) 2>&5
24+ ac_status=$?
25+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
26+ test $ac_status = 0; }; }; then
27 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
28 libgcc_cv_lib_sjlj_exceptions=yes
29 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
30 libgcc_cv_lib_sjlj_exceptions=no
31 fi
32 fi
33-CFLAGS=$CFLAGS_hold
34 rm -f conftest*
35
36 fi
37Index: trunk/libgcc/configure.ac
38===================================================================
39--- trunk.orig/libgcc/configure.ac 2012-03-01 22:59:10.128444406 -0800
40+++ trunk/libgcc/configure.ac 2012-03-01 22:59:50.428446373 -0800
41@@ -209,16 +209,14 @@
42 bar();
43 }
44 ])])
45-CFLAGS_hold=$CFLAGS
46-CFLAGS="--save-temps -fexceptions"
47 libgcc_cv_lib_sjlj_exceptions=unknown
48-AS_IF([ac_fn_c_try_compile],
49- [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
50+if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
51+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
52 libgcc_cv_lib_sjlj_exceptions=yes
53 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
54 libgcc_cv_lib_sjlj_exceptions=no
55- fi])
56-CFLAGS=$CFLAGS_hold
57+ fi
58+fi
59 rm -f conftest*
60 ])
61
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch b/meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch
new file mode 100644
index 0000000000..6e7536b693
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch
@@ -0,0 +1,86 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
4will not run correctly since by default the linker will try to link against libstdc++
5which shouldn't exist yet. We need an option to disable -lstdc++
6option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
7driver. This patch adds such an option which only disables the -lstdc++.
8
9A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
10do this officially, the likely answer is don't build libstdc++ separately.
11
12RP 29/6/10
13
14Index: gcc-4_7-branch/gcc/cp/g++spec.c
15===================================================================
16--- gcc-4_7-branch.orig/gcc/cp/g++spec.c 2012-04-10 10:17:24.647330074 -0700
17+++ gcc-4_7-branch/gcc/cp/g++spec.c 2012-04-10 10:37:49.479389235 -0700
18@@ -127,6 +127,7 @@
19 switch (decoded_options[i].opt_index)
20 {
21 case OPT_nostdlib:
22+ case OPT_nostdlib__:
23 case OPT_nodefaultlibs:
24 library = -1;
25 break;
26Index: gcc-4_7-branch/gcc/doc/invoke.texi
27===================================================================
28--- gcc-4_7-branch.orig/gcc/doc/invoke.texi 2012-04-10 10:37:09.343387385 -0700
29+++ gcc-4_7-branch/gcc/doc/invoke.texi 2012-04-10 10:37:49.483389340 -0700
30@@ -194,7 +194,7 @@
31 -fno-pretty-templates @gol
32 -frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
33 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
34--fno-default-inline -fvisibility-inlines-hidden @gol
35+-nostdlib++ -fno-default-inline -fvisibility-inlines-hidden @gol
36 -fvisibility-ms-compat @gol
37 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
38 -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
39@@ -445,7 +445,7 @@
40 @gccoptlist{@var{object-file-name} -l@var{library} @gol
41 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
42 -s -static -static-libgcc -static-libstdc++ -shared @gol
43--shared-libgcc -symbolic @gol
44+-shared-libgcc -symbolic -nostdlib++ @gol
45 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
46 -u @var{symbol}}
47
48@@ -9438,6 +9438,11 @@
49 libc. These entry points should be supplied through some other
50 mechanism when this option is specified.
51
52+@item -nostdlib++
53+@opindex nostdlib++
54+Do not use the standard system C++ runtime libraries when linking.
55+Only the libraries you specify will be passed to the linker.
56+
57 @cindex @option{-lgcc}, use with @option{-nostdlib}
58 @cindex @option{-nostdlib} and unresolved references
59 @cindex unresolved references and @option{-nostdlib}
60Index: gcc-4_7-branch/gcc/c-family/c.opt
61===================================================================
62--- gcc-4_7-branch.orig/gcc/c-family/c.opt 2012-04-10 10:17:24.667330076 -0700
63+++ gcc-4_7-branch/gcc/c-family/c.opt 2012-04-10 10:37:49.483389340 -0700
64@@ -1171,6 +1171,10 @@
65 C++ ObjC++
66 Do not search standard system include directories for C++
67
68+nostdlib++
69+Driver
70+Do not link standard C++ runtime library
71+
72 o
73 C ObjC C++ ObjC++ Joined Separate
74 ; Documented in common.opt
75Index: gcc-4_7-branch/gcc/gcc.c
76===================================================================
77--- gcc-4_7-branch.orig/gcc/gcc.c 2012-04-10 10:37:09.343387385 -0700
78+++ gcc-4_7-branch/gcc/gcc.c 2012-04-10 10:37:49.487389409 -0700
79@@ -681,6 +681,7 @@
80 %(mflib) " STACK_SPLIT_SPEC "\
81 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
82 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
83+ %{!nostdlib++:}\
84 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
85 #endif
86
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/powerpc-e5500.patch b/meta/recipes-devtools/gcc/gcc-4.7/powerpc-e5500.patch
new file mode 100644
index 0000000000..1c9736b326
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/powerpc-e5500.patch
@@ -0,0 +1,469 @@
1Upstream-Status: Pending
2
3Implements basic e5500 enablement in gcc, with a scheduler, -mcpu
4flag, etc...
5
6Also splits the masks for popcntb, popcntd, and cmpb. Originally those
7masks would also control other instructions that e5500 does not
8support (so, we either get none or all).
9
10For the lack of means to do tests, those instructions were never
11enabled until now. The new instructions enabled with this patch are:
12popcntb, popcntw, popcntd, bpermd, prtyw, prtyd, cmpb, ldbrx, and
13stdbrx.
14
15Signed-off-by: Edmar Wienskoski <edmar@freescale.com>
16Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
17
18Index: gcc-4_7-branch/gcc/config.gcc
19===================================================================
20--- gcc-4_7-branch.orig/gcc/config.gcc 2012-04-10 10:32:36.823374222 -0700
21+++ gcc-4_7-branch/gcc/config.gcc 2012-04-10 10:39:32.543394369 -0700
22@@ -413,7 +413,7 @@
23 extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
24 need_64bit_hwint=yes
25 case x$with_cpu in
26- xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell|xa2|xe500mc64)
27+ xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500)
28 cpu_is_64bit=yes
29 ;;
30 esac
31@@ -3342,7 +3342,7 @@
32 | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
33 | 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \
34 | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
35- | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | titan\
36+ | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | e5500 | titan\
37 | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
38 # OK
39 ;;
40Index: gcc-4_7-branch/gcc/config/rs6000/e5500.md
41===================================================================
42--- /dev/null 1970-01-01 00:00:00.000000000 +0000
43+++ gcc-4_7-branch/gcc/config/rs6000/e5500.md 2012-04-10 10:39:32.543394369 -0700
44@@ -0,0 +1,176 @@
45+;; Pipeline description for Freescale PowerPC e5500 core.
46+;; Copyright (C) 2011 Free Software Foundation, Inc.
47+;; Contributed by Edmar Wienskoski (edmar@freescale.com)
48+;;
49+;; This file is part of GCC.
50+;;
51+;; GCC is free software; you can redistribute it and/or modify it
52+;; under the terms of the GNU General Public License as published
53+;; by the Free Software Foundation; either version 3, or (at your
54+;; option) any later version.
55+;;
56+;; GCC is distributed in the hope that it will be useful, but WITHOUT
57+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
58+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
59+;; License for more details.
60+;;
61+;; You should have received a copy of the GNU General Public License
62+;; along with GCC; see the file COPYING3. If not see
63+;; <http://www.gnu.org/licenses/>.
64+;;
65+;; e5500 64-bit SFX(2), CFX, LSU, FPU, BU
66+;; Max issue 3 insns/clock cycle (includes 1 branch)
67+
68+(define_automaton "e5500_most,e5500_long")
69+(define_cpu_unit "e5500_decode_0,e5500_decode_1" "e5500_most")
70+
71+;; SFX.
72+(define_cpu_unit "e5500_sfx_0,e5500_sfx_1" "e5500_most")
73+
74+;; CFX.
75+(define_cpu_unit "e5500_cfx_stage0,e5500_cfx_stage1" "e5500_most")
76+
77+;; Non-pipelined division.
78+(define_cpu_unit "e5500_cfx_div" "e5500_long")
79+
80+;; LSU.
81+(define_cpu_unit "e5500_lsu" "e5500_most")
82+
83+;; FPU.
84+(define_cpu_unit "e5500_fpu" "e5500_long")
85+
86+;; BU.
87+(define_cpu_unit "e5500_bu" "e5500_most")
88+
89+;; The following units are used to make the automata deterministic.
90+(define_cpu_unit "present_e5500_decode_0" "e5500_most")
91+(define_cpu_unit "present_e5500_sfx_0" "e5500_most")
92+(presence_set "present_e5500_decode_0" "e5500_decode_0")
93+(presence_set "present_e5500_sfx_0" "e5500_sfx_0")
94+
95+;; Some useful abbreviations.
96+(define_reservation "e5500_decode"
97+ "e5500_decode_0|e5500_decode_1+present_e5500_decode_0")
98+(define_reservation "e5500_sfx"
99+ "e5500_sfx_0|e5500_sfx_1+present_e5500_sfx_0")
100+
101+;; SFX.
102+(define_insn_reservation "e5500_sfx" 1
103+ (and (eq_attr "type" "integer,insert_word,insert_dword,delayed_compare,\
104+ shift,cntlz,exts")
105+ (eq_attr "cpu" "ppce5500"))
106+ "e5500_decode,e5500_sfx")
107+
108+(define_insn_reservation "e5500_sfx2" 2
109+ (and (eq_attr "type" "cmp,compare,fast_compare,trap")
110+ (eq_attr "cpu" "ppce5500"))
111+ "e5500_decode,e5500_sfx")
112+
113+(define_insn_reservation "e5500_delayed" 2
114+ (and (eq_attr "type" "var_shift_rotate,var_delayed_compare,popcnt")
115+ (eq_attr "cpu" "ppce5500"))
116+ "e5500_decode,e5500_sfx*2")
117+
118+(define_insn_reservation "e5500_two" 2
119+ (and (eq_attr "type" "two")
120+ (eq_attr "cpu" "ppce5500"))
121+ "e5500_decode,e5500_decode+e5500_sfx,e5500_sfx")
122+
123+(define_insn_reservation "e5500_three" 3
124+ (and (eq_attr "type" "three")
125+ (eq_attr "cpu" "ppce5500"))
126+ "e5500_decode,(e5500_decode+e5500_sfx)*2,e5500_sfx")
127+
128+;; SFX - Mfcr.
129+(define_insn_reservation "e5500_mfcr" 4
130+ (and (eq_attr "type" "mfcr")
131+ (eq_attr "cpu" "ppce5500"))
132+ "e5500_decode,e5500_sfx_0*4")
133+
134+;; SFX - Mtcrf.
135+(define_insn_reservation "e5500_mtcrf" 1
136+ (and (eq_attr "type" "mtcr")
137+ (eq_attr "cpu" "ppce5500"))
138+ "e5500_decode,e5500_sfx_0")
139+
140+;; SFX - Mtjmpr.
141+(define_insn_reservation "e5500_mtjmpr" 1
142+ (and (eq_attr "type" "mtjmpr,mfjmpr")
143+ (eq_attr "cpu" "ppce5500"))
144+ "e5500_decode,e5500_sfx")
145+
146+;; CFX - Multiply.
147+(define_insn_reservation "e5500_multiply" 4
148+ (and (eq_attr "type" "imul")
149+ (eq_attr "cpu" "ppce5500"))
150+ "e5500_decode,e5500_cfx_stage0,e5500_cfx_stage1")
151+
152+(define_insn_reservation "e5500_multiply_i" 5
153+ (and (eq_attr "type" "imul2,imul3,imul_compare")
154+ (eq_attr "cpu" "ppce5500"))
155+ "e5500_decode,e5500_cfx_stage0,\
156+ e5500_cfx_stage0+e5500_cfx_stage1,e5500_cfx_stage1")
157+
158+;; CFX - Divide.
159+(define_insn_reservation "e5500_divide" 16
160+ (and (eq_attr "type" "idiv")
161+ (eq_attr "cpu" "ppce5500"))
162+ "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
163+ e5500_cfx_div*15")
164+
165+(define_insn_reservation "e5500_divide_d" 26
166+ (and (eq_attr "type" "ldiv")
167+ (eq_attr "cpu" "ppce5500"))
168+ "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
169+ e5500_cfx_div*25")
170+
171+;; LSU - Loads.
172+(define_insn_reservation "e5500_load" 3
173+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
174+ load_l,sync")
175+ (eq_attr "cpu" "ppce5500"))
176+ "e5500_decode,e5500_lsu")
177+
178+(define_insn_reservation "e5500_fpload" 4
179+ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
180+ (eq_attr "cpu" "ppce5500"))
181+ "e5500_decode,e5500_lsu")
182+
183+;; LSU - Stores.
184+(define_insn_reservation "e5500_store" 3
185+ (and (eq_attr "type" "store,store_ux,store_u,store_c")
186+ (eq_attr "cpu" "ppce5500"))
187+ "e5500_decode,e5500_lsu")
188+
189+(define_insn_reservation "e5500_fpstore" 3
190+ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
191+ (eq_attr "cpu" "ppce5500"))
192+ "e5500_decode,e5500_lsu")
193+
194+;; FP.
195+(define_insn_reservation "e5500_float" 7
196+ (and (eq_attr "type" "fpsimple,fp,fpcompare,dmul")
197+ (eq_attr "cpu" "ppce5500"))
198+ "e5500_decode,e5500_fpu")
199+
200+(define_insn_reservation "e5500_sdiv" 20
201+ (and (eq_attr "type" "sdiv")
202+ (eq_attr "cpu" "ppce5500"))
203+ "e5500_decode,e5500_fpu*20")
204+
205+(define_insn_reservation "e5500_ddiv" 35
206+ (and (eq_attr "type" "ddiv")
207+ (eq_attr "cpu" "ppce5500"))
208+ "e5500_decode,e5500_fpu*35")
209+
210+;; BU.
211+(define_insn_reservation "e5500_branch" 1
212+ (and (eq_attr "type" "jmpreg,branch,isync")
213+ (eq_attr "cpu" "ppce5500"))
214+ "e5500_decode,e5500_bu")
215+
216+;; BU - CR logical.
217+(define_insn_reservation "e5500_cr_logical" 1
218+ (and (eq_attr "type" "cr_logical,delayed_cr")
219+ (eq_attr "cpu" "ppce5500"))
220+ "e5500_decode,e5500_bu")
221Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h
222===================================================================
223--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-opts.h 2012-04-10 10:17:24.283330056 -0700
224+++ gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h 2012-04-10 10:39:32.543394369 -0700
225@@ -53,6 +53,7 @@
226 PROCESSOR_PPCE300C3,
227 PROCESSOR_PPCE500MC,
228 PROCESSOR_PPCE500MC64,
229+ PROCESSOR_PPCE5500,
230 PROCESSOR_POWER4,
231 PROCESSOR_POWER5,
232 PROCESSOR_POWER6,
233Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.c
234===================================================================
235--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.c 2012-04-10 10:17:24.263330055 -0700
236+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.c 2012-04-10 10:39:32.547394389 -0700
237@@ -755,6 +755,25 @@
238 1, /* prefetch streams /*/
239 };
240
241+/* Instruction costs on PPCE5500 processors. */
242+static const
243+struct processor_costs ppce5500_cost = {
244+ COSTS_N_INSNS (5), /* mulsi */
245+ COSTS_N_INSNS (5), /* mulsi_const */
246+ COSTS_N_INSNS (5), /* mulsi_const9 */
247+ COSTS_N_INSNS (5), /* muldi */
248+ COSTS_N_INSNS (14), /* divsi */
249+ COSTS_N_INSNS (14), /* divdi */
250+ COSTS_N_INSNS (7), /* fp */
251+ COSTS_N_INSNS (10), /* dmul */
252+ COSTS_N_INSNS (36), /* sdiv */
253+ COSTS_N_INSNS (66), /* ddiv */
254+ 64, /* cache line size */
255+ 32, /* l1 cache */
256+ 128, /* l2 cache */
257+ 1, /* prefetch streams /*/
258+};
259+
260 /* Instruction costs on AppliedMicro Titan processors. */
261 static const
262 struct processor_costs titan_cost = {
263@@ -2704,7 +2723,8 @@
264 rs6000_cpu = processor_target_table[tune_index].processor;
265
266 if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3
267- || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64)
268+ || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64
269+ || rs6000_cpu == PROCESSOR_PPCE5500)
270 {
271 if (TARGET_ALTIVEC)
272 error ("AltiVec not supported in this target");
273@@ -2805,9 +2825,14 @@
274 user's opinion, though. */
275 if (rs6000_block_move_inline_limit == 0
276 && (rs6000_cpu == PROCESSOR_PPCE500MC
277- || rs6000_cpu == PROCESSOR_PPCE500MC64))
278+ || rs6000_cpu == PROCESSOR_PPCE500MC64
279+ || rs6000_cpu == PROCESSOR_PPCE5500))
280 rs6000_block_move_inline_limit = 128;
281
282+ /* Those machines does not have fsqrt instruction */
283+ if (rs6000_cpu == PROCESSOR_PPCE5500)
284+ target_flags &= ~MASK_PPC_GPOPT;
285+
286 /* store_one_arg depends on expand_block_move to handle at least the
287 size of reg_parm_stack_space. */
288 if (rs6000_block_move_inline_limit < (TARGET_POWERPC64 ? 64 : 32))
289@@ -2939,7 +2964,8 @@
290 #endif
291
292 if (TARGET_E500 || rs6000_cpu == PROCESSOR_PPCE500MC
293- || rs6000_cpu == PROCESSOR_PPCE500MC64)
294+ || rs6000_cpu == PROCESSOR_PPCE500MC64
295+ || rs6000_cpu == PROCESSOR_PPCE5500)
296 {
297 /* The e500 and e500mc do not have string instructions, and we set
298 MASK_STRING above when optimizing for size. */
299@@ -2987,7 +3013,8 @@
300 || rs6000_cpu == PROCESSOR_POWER6
301 || rs6000_cpu == PROCESSOR_POWER7
302 || rs6000_cpu == PROCESSOR_PPCE500MC
303- || rs6000_cpu == PROCESSOR_PPCE500MC64);
304+ || rs6000_cpu == PROCESSOR_PPCE500MC64
305+ || rs6000_cpu == PROCESSOR_PPCE5500);
306
307 /* Allow debug switches to override the above settings. These are set to -1
308 in rs6000.opt to indicate the user hasn't directly set the switch. */
309@@ -3209,6 +3236,10 @@
310 rs6000_cost = &ppce500mc64_cost;
311 break;
312
313+ case PROCESSOR_PPCE5500:
314+ rs6000_cost = &ppce5500_cost;
315+ break;
316+
317 case PROCESSOR_TITAN:
318 rs6000_cost = &titan_cost;
319 break;
320@@ -22295,6 +22326,7 @@
321 || rs6000_cpu_attr == CPU_PPC750
322 || rs6000_cpu_attr == CPU_PPC7400
323 || rs6000_cpu_attr == CPU_PPC7450
324+ || rs6000_cpu_attr == CPU_PPCE5500
325 || rs6000_cpu_attr == CPU_POWER4
326 || rs6000_cpu_attr == CPU_POWER5
327 || rs6000_cpu_attr == CPU_POWER7
328@@ -22839,6 +22871,7 @@
329 case CPU_PPCE300C3:
330 case CPU_PPCE500MC:
331 case CPU_PPCE500MC64:
332+ case CPU_PPCE5500:
333 case CPU_TITAN:
334 return 2;
335 case CPU_RIOS2:
336Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.h
337===================================================================
338--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.h 2012-04-10 10:17:24.251330055 -0700
339+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.h 2012-04-10 10:39:32.551394375 -0700
340@@ -168,6 +168,7 @@
341 %{mcpu=e300c3: -me300} \
342 %{mcpu=e500mc: -me500mc} \
343 %{mcpu=e500mc64: -me500mc64} \
344+%{mcpu=e5500: -me5500} \
345 %{maltivec: -maltivec} \
346 %{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \
347 -many"
348@@ -475,13 +476,13 @@
349
350 #define TARGET_FCTIDZ TARGET_FCFID
351 #define TARGET_STFIWX TARGET_PPC_GFXOPT
352-#define TARGET_LFIWAX TARGET_CMPB
353-#define TARGET_LFIWZX TARGET_POPCNTD
354-#define TARGET_FCFIDS TARGET_POPCNTD
355-#define TARGET_FCFIDU TARGET_POPCNTD
356-#define TARGET_FCFIDUS TARGET_POPCNTD
357-#define TARGET_FCTIDUZ TARGET_POPCNTD
358-#define TARGET_FCTIWUZ TARGET_POPCNTD
359+#define TARGET_LFIWAX (TARGET_CMPB && rs6000_cpu != PROCESSOR_PPCE5500)
360+#define TARGET_LFIWZX (TARGET_POPCNTD && rs6000_cpu != PROCESSOR_PPCE5500)
361+#define TARGET_FCFIDS TARGET_LFIWZX
362+#define TARGET_FCFIDU TARGET_LFIWZX
363+#define TARGET_FCFIDUS TARGET_LFIWZX
364+#define TARGET_FCTIDUZ TARGET_LFIWZX
365+#define TARGET_FCTIWUZ TARGET_LFIWZX
366
367 /* For power systems, we want to enable Altivec and VSX builtins even if the
368 user did not use -maltivec or -mvsx to allow the builtins to be used inside
369@@ -510,10 +511,12 @@
370
371 #define TARGET_FRE (TARGET_HARD_FLOAT && TARGET_FPRS \
372 && TARGET_DOUBLE_FLOAT \
373- && (TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)))
374+ && (TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)) \
375+ && rs6000_cpu != PROCESSOR_PPCE5500)
376
377 #define TARGET_FRSQRTES (TARGET_HARD_FLOAT && TARGET_POPCNTB \
378- && TARGET_FPRS && TARGET_SINGLE_FLOAT)
379+ && TARGET_FPRS && TARGET_SINGLE_FLOAT \
380+ && rs6000_cpu != PROCESSOR_PPCE5500)
381
382 #define TARGET_FRSQRTE (TARGET_HARD_FLOAT && TARGET_FPRS \
383 && TARGET_DOUBLE_FLOAT \
384Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.md
385===================================================================
386--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.md 2012-04-10 10:17:24.275330056 -0700
387+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.md 2012-04-10 10:39:32.555394355 -0700
388@@ -144,7 +144,7 @@
389
390 ;; Define an insn type attribute. This is used in function unit delay
391 ;; computations.
392-(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel"
393+(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt"
394 (const_string "integer"))
395
396 ;; Define floating point instruction sub-types for use with Xfpu.md
397@@ -166,7 +166,7 @@
398 ;; Processor type -- this attribute must exactly match the processor_type
399 ;; enumeration in rs6000.h.
400
401-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
402+(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,power4,power5,power6,power7,cell,ppca2,titan"
403 (const (symbol_ref "rs6000_cpu_attr")))
404
405
406@@ -194,6 +194,7 @@
407 (include "e300c2c3.md")
408 (include "e500mc.md")
409 (include "e500mc64.md")
410+(include "e5500.md")
411 (include "power4.md")
412 (include "power5.md")
413 (include "power6.md")
414@@ -2329,13 +2330,17 @@
415 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
416 UNSPEC_POPCNTB))]
417 "TARGET_POPCNTB"
418- "popcntb %0,%1")
419+ "popcntb %0,%1"
420+ [(set_attr "length" "4")
421+ (set_attr "type" "popcnt")])
422
423 (define_insn "popcntd<mode>2"
424 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
425 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
426 "TARGET_POPCNTD"
427- "popcnt<wd> %0,%1")
428+ "popcnt<wd> %0,%1"
429+ [(set_attr "length" "4")
430+ (set_attr "type" "popcnt")])
431
432 (define_expand "popcount<mode>2"
433 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
434@@ -5984,10 +5989,10 @@
435 && ((TARGET_PPC_GFXOPT
436 && !HONOR_NANS (<MODE>mode)
437 && !HONOR_SIGNED_ZEROS (<MODE>mode))
438- || TARGET_CMPB
439+ || TARGET_LFIWAX
440 || VECTOR_UNIT_VSX_P (<MODE>mode))"
441 {
442- if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
443+ if (TARGET_LFIWAX || VECTOR_UNIT_VSX_P (<MODE>mode))
444 {
445 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
446 operands[2]));
447@@ -6006,7 +6011,7 @@
448 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
449 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
450 UNSPEC_COPYSIGN))]
451- "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
452+ "TARGET_LFIWAX && !VECTOR_UNIT_VSX_P (<MODE>mode)"
453 "fcpsgn %0,%2,%1"
454 [(set_attr "type" "fp")])
455
456Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def
457===================================================================
458--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-cpus.def 2012-04-10 10:17:24.295330058 -0700
459+++ gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def 2012-04-10 10:39:32.555394355 -0700
460@@ -88,6 +88,9 @@
461 | MASK_ISEL)
462 RS6000_CPU ("e500mc64", PROCESSOR_PPCE500MC64,
463 POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT | MASK_ISEL)
464+RS6000_CPU ("e5500", PROCESSOR_PPCE5500,
465+ POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT | MASK_ISEL
466+ | MASK_CMPB | MASK_POPCNTB | MASK_POPCNTD)
467 RS6000_CPU ("860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT)
468 RS6000_CPU ("970", PROCESSOR_POWER4,
469 POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64)
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch b/meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch
new file mode 100644
index 0000000000..bea2063049
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch
@@ -0,0 +1,72 @@
1Upstream-Status:Backport
2Hi,
3
4As suggested by richi.
5regtested on i686-linux-gnu with all default languages and no regressions.
6Ok for trunk?
7
8gcc/ChangeLog
92010-03-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10
11 PR target/32219
12 * varasm.c (default_binds_local_p_1): Weak data is not local.
13
14gcc/testsuite/ChangeLog
152010-03-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
16
17 PR target/32219
18 * gcc.dg/visibility-21.c: New test.
19
20Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
21---
22 gcc/testsuite/gcc.dg/visibility-21.c | 14 ++++++++++++++
23 gcc/varasm.c | 8 ++++----
24 2 files changed, 18 insertions(+), 4 deletions(-)
25 create mode 100644 gcc/testsuite/gcc.dg/visibility-21.c
26
27Index: gcc-4_7-branch/gcc/testsuite/gcc.dg/visibility-21.c
28===================================================================
29--- /dev/null 1970-01-01 00:00:00.000000000 +0000
30+++ gcc-4_7-branch/gcc/testsuite/gcc.dg/visibility-21.c 2012-04-10 10:39:38.083396738 -0700
31@@ -0,0 +1,14 @@
32+/* PR target/32219 */
33+/* { dg-do run } */
34+/* { dg-require-visibility "" } */
35+/* { dg-options "-fPIC" { target fpic } } */
36+
37+extern void f() __attribute__((weak,visibility("hidden")));
38+extern int puts( char const* );
39+int main()
40+{
41+ if (f)
42+ f();
43+ return 0;
44+}
45+
46Index: gcc-4_7-branch/gcc/varasm.c
47===================================================================
48--- gcc-4_7-branch.orig/gcc/varasm.c 2012-04-10 10:17:24.127330049 -0700
49+++ gcc-4_7-branch/gcc/varasm.c 2012-04-10 10:39:38.087396414 -0700
50@@ -6937,6 +6937,10 @@
51 /* Static variables are always local. */
52 else if (! TREE_PUBLIC (exp))
53 local_p = true;
54+ /* hidden weak can't be overridden by something non-local, all
55+ that is possible is that it is not defined at all. */
56+ else if (DECL_WEAK (exp))
57+ local_p = false;
58 /* A variable is local if the user has said explicitly that it will
59 be. */
60 else if ((DECL_VISIBILITY_SPECIFIED (exp)
61@@ -6950,11 +6954,6 @@
62 local. */
63 else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
64 local_p = true;
65- /* Default visibility weak data can be overridden by a strong symbol
66- in another module and so are not local. */
67- else if (DECL_WEAK (exp)
68- && !resolved_locally)
69- local_p = false;
70 /* If PIC, then assume that any global name can be overridden by
71 symbols resolved from other modules. */
72 else if (shlib)
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch
new file mode 100644
index 0000000000..212c26324c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch
@@ -0,0 +1,77 @@
1Upstream-Status: Pending
2
3Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
4the source can be shared between gcc-cross-initial,
5gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
6---
7 gcc/Makefile.in | 2 +-
8 gcc/configure | 4 ++--
9 gcc/configure.ac | 4 ++--
10 gcc/mkconfig.sh | 4 ++--
11 4 files changed, 7 insertions(+), 7 deletions(-)
12
13Index: gcc-4_7-branch/gcc/Makefile.in
14===================================================================
15--- gcc-4_7-branch.orig/gcc/Makefile.in 2012-04-10 10:37:09.347387424 -0700
16+++ gcc-4_7-branch/gcc/Makefile.in 2012-04-10 10:39:24.019393881 -0700
17@@ -481,7 +481,7 @@
18 TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
19
20 xmake_file=@xmake_file@
21-tmake_file=@tmake_file@
22+tmake_file=@tmake_file@ ./t-oe
23 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
24 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
25 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
26Index: gcc-4_7-branch/gcc/configure
27===================================================================
28--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:37:57.211389779 -0700
29+++ gcc-4_7-branch/gcc/configure 2012-04-10 10:39:24.027393938 -0700
30@@ -11692,8 +11692,8 @@
31 tm_include_list="${tm_include_list} $f"
32 ;;
33 defaults.h )
34- tm_file_list="${tm_file_list} \$(srcdir)/$f"
35- tm_include_list="${tm_include_list} $f"
36+ tm_file_list="${tm_file_list} ./$f"
37+ tm_include_list="${tm_include_list} ./$f"
38 ;;
39 * )
40 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
41Index: gcc-4_7-branch/gcc/configure.ac
42===================================================================
43--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:37:57.215389769 -0700
44+++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:39:24.027393938 -0700
45@@ -1699,8 +1699,8 @@
46 tm_include_list="${tm_include_list} $f"
47 ;;
48 defaults.h )
49- tm_file_list="${tm_file_list} \$(srcdir)/$f"
50- tm_include_list="${tm_include_list} $f"
51+ tm_file_list="${tm_file_list} ./$f"
52+ tm_include_list="${tm_include_list} ./$f"
53 ;;
54 * )
55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
56Index: gcc-4_7-branch/gcc/mkconfig.sh
57===================================================================
58--- gcc-4_7-branch.orig/gcc/mkconfig.sh 2012-04-10 10:17:24.383330061 -0700
59+++ gcc-4_7-branch/gcc/mkconfig.sh 2012-04-10 10:39:24.027393938 -0700
60@@ -78,7 +78,7 @@
61 if [ $# -ge 1 ]; then
62 echo '#ifdef IN_GCC' >> ${output}T
63 for file in "$@"; do
64- if test x"$file" = x"defaults.h"; then
65+ if test x"$file" = x"./defaults.h"; then
66 postpone_defaults_h="yes"
67 else
68 echo "# include \"$file\"" >> ${output}T
69@@ -104,7 +104,7 @@
70
71 # If we postponed including defaults.h, add the #include now.
72 if test x"$postpone_defaults_h" = x"yes"; then
73- echo "# include \"defaults.h\"" >> ${output}T
74+ echo "# include \"./defaults.h\"" >> ${output}T
75 fi
76
77 # Add multiple inclusion protection guard, part two.
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb
new file mode 100644
index 0000000000..da3210fc35
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb
@@ -0,0 +1,23 @@
1inherit cross-canadian
2
3require gcc-${PV}.inc
4require gcc-cross-canadian.inc
5require gcc-configure-sdk.inc
6require gcc-package-sdk.inc
7
8DEPENDS += "gmp-nativesdk mpfr-nativesdk libmpc-nativesdk elfutils-nativesdk"
9RDEPENDS_${PN} += "mpfr-nativesdk libmpc-nativesdk elfutils-nativesdk"
10
11SYSTEMHEADERS = "/usr/include"
12SYSTEMLIBS = "/lib/"
13SYSTEMLIBS1 = "/usr/lib/"
14
15EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
16 --disable-libgomp --disable-libmudflap \
17 --with-mpfr=${STAGING_DIR_HOST}${layout_exec_prefix} \
18 --with-mpc=${STAGING_DIR_HOST}${layout_exec_prefix}"
19
20# to find libmpfr
21# export LD_LIBRARY_PATH = "{STAGING_DIR_HOST}${layout_exec_prefix}"
22
23PARALLEL_MAKE = ""
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.7.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.7.bb
new file mode 100644
index 0000000000..1639511362
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.7.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.7.bb b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.7.bb
new file mode 100644
index 0000000000..42fd0f0f59
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.7.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.7.bb b/meta/recipes-devtools/gcc/gcc-cross_4.7.bb
new file mode 100644
index 0000000000..97a0c81920
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross_4.7.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.7.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.7.bb
new file mode 100644
index 0000000000..0c9fdd3449
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.7.bb
@@ -0,0 +1,2 @@
1require gcc-cross-initial_${PV}.bb
2require gcc-crosssdk-initial.inc
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.7.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.7.bb
new file mode 100644
index 0000000000..1aa588ac9f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.7.bb
@@ -0,0 +1,2 @@
1require gcc-cross-intermediate_${PV}.bb
2require gcc-crosssdk-intermediate.inc
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb
new file mode 100644
index 0000000000..7430888ed7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb
@@ -0,0 +1,2 @@
1require gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.7.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.7.bb
new file mode 100644
index 0000000000..a2fb200ef5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-runtime_4.7.bb
@@ -0,0 +1,8 @@
1require gcc-${PV}.inc
2require gcc-configure-runtime.inc
3require gcc-package-runtime.inc
4
5ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
6
7EXTRA_OECONF += "--disable-libunwind-exceptions"
8EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
diff --git a/meta/recipes-devtools/gcc/gcc_4.7.bb b/meta/recipes-devtools/gcc/gcc_4.7.bb
new file mode 100644
index 0000000000..3751516648
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc_4.7.bb
@@ -0,0 +1,5 @@
1require gcc-${PV}.inc
2require gcc-configure-target.inc
3require gcc-package-target.inc
4
5ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
diff --git a/meta/recipes-devtools/gcc/libgcc_4.7.bb b/meta/recipes-devtools/gcc/libgcc_4.7.bb
new file mode 100644
index 0000000000..0370a5a56f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/libgcc_4.7.bb
@@ -0,0 +1,66 @@
1require gcc-${PV}.inc
2
3INHIBIT_DEFAULT_DEPS = "1"
4DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
5
6PACKAGES = "\
7 ${PN} \
8 ${PN}-dev \
9 ${PN}-dbg \
10 libgcov-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*"
18FILES_libgcov-dev = " \
19 ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \
20 "
21FILES_${PN}-dbg += "${base_libdir}/.debug/"
22
23do_configure () {
24 target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-nativesdk##`
25 install -d ${D}${base_libdir} ${D}${libdir}
26 cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$target/* ${B}
27 mkdir -p ${B}/${BPN}
28 cd ${B}/${BPN}
29 chmod a+x ${S}/${BPN}/configure
30 ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
31}
32
33do_compile () {
34 target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
35 cd ${B}/${BPN}
36 oe_runmake MULTIBUILDTOP=${B}/$target/${BPN}/
37}
38
39do_install () {
40 target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
41 cd ${B}/${BPN}
42 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/${BPN}/ install
43
44 # Move libgcc_s into /lib
45 mkdir -p ${D}${base_libdir}
46 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
47 mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
48 else
49 mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
50 fi
51
52 # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
53 # so that cross-gcc can find it in the sysroot
54
55 mv ${D}${libdir}/gcc/* ${D}${libdir}
56 rm -rf ${D}${libdir}/gcc/
57}
58
59do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_package"
60do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_package"
61do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_package"
62
63BBCLASSEXTEND = "nativesdk"
64
65INSANE_SKIP_libgcc-dev = "staticdev"
66INSANE_SKIP_libgcov-dev = "staticdev"