summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-10-07 10:51:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-10-12 14:12:09 +0100
commitd2b4818c5cca291f90c5acc9a2316d807ef9fa26 (patch)
treed6e9042b98366e4e3fe8fe397cc18958bebf847d /meta/recipes-devtools
parent9167557fb94b94f4fca8cf2cdfacbc0cf783b49d (diff)
downloadpoky-d2b4818c5cca291f90c5acc9a2316d807ef9fa26.tar.gz
gcc: Drop old version 4.5.1
(From OE-Core rev: 59443380286010eda07f1434e918a3af8c8a31a9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1.inc100
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/100-uclibc-conf.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/103-uclibc-conf-noupstream.patch17
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/200-uclibc-locale.patch2842
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/203-uclibc-locale-no__x.patch235
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/204-uclibc-locale-wchar_fix.patch50
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/205-uclibc-locale-update.patch521
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/301-missing-execinfo_h.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/302-c99-snprintf.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/303-c99-complex-ugly-hack.patch16
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/304-index_macro.patch30
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/305-libmudflap-susv3-legacy.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/306-libstdc++-namespace.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/64bithack.patch22
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/740-sh-pr24836.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/800-arm-bigendian.patch36
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/904-flatten-switch-stmt-00.patch76
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch24
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch35
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/arm-bswapsi2.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/arm-nolibfloat.patch26
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/arm-softfloat.patch18
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/cache-amnesia.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/disable_relax_pic_calls_flag.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch115
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-cpp-pragma.patch285
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-i386-libgomp.patch66
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ia64-libunwind.patch551
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-debug-iface-type.patch20
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-nomulti.patch49
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-libgomp-speedup.patch2798
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ppc32-retaddr.patch91
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr27898.patch17
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr32139.patch20
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr33763.patch160
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh251682.patch90
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh330771.patch32
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh341221.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc45-no-add-needed.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fortran-cross-compile-hack.patch32
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch116
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/gcc-flags-for-build.patch180
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-dir-extend.patch26
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-system-directories.patch203
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/gcc-uclibc-locale-ctype_touplow_t.patch69
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/libstdc++-emit-__cxa_end_cleanup-in-text.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/optional_libstdc.patch25
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr43810.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch119
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr44606.patch106
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr44618.patch314
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr45052.patch30
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr45094.patch75
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr45886.patch55
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/use-defaults.h-and-t-oe-in-B.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/zecke-xgcc-cpp.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb23
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb8
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb10
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.5.1.bb11
-rw-r--r--meta/recipes-devtools/gcc/libgcc_4.5.1.bb44
67 files changed, 0 insertions, 10389 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1.inc b/meta/recipes-devtools/gcc/gcc-4.5.1.inc
deleted file mode 100644
index 839529e5b9..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1.inc
+++ /dev/null
@@ -1,100 +0,0 @@
1require gcc-common.inc
2
3PR = "r12"
4
5DEPENDS =+ "mpfr gmp libmpc elfutils"
6NATIVEDEPS = "mpfr-native gmp-native gettext-native libmpc-native elfutils-native"
7
8LICENSE="GPL-3.0-with-GCC-exception & GPLv2 & GPLv3 & LGPLv2.1 & LGPLv3"
9
10LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
11 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
12 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
13 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
14 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
15
16SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
17 file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
18 file://100-uclibc-conf.patch \
19 file://gcc-uclibc-locale-ctype_touplow_t.patch \
20 file://cache-amnesia.patch \
21 file://gcc-flags-for-build.patch \
22 file://libstdc++-emit-__cxa_end_cleanup-in-text.patch \
23 file://arm-bswapsi2.patch \
24 \
25 file://fedora/gcc43-c++-builtin-redecl.patch;striplevel=0 \
26 file://fedora/gcc43-ia64-libunwind.patch;striplevel=0 \
27 file://fedora/gcc43-java-nomulti.patch;striplevel=0 \
28 file://fedora/gcc43-ppc32-retaddr.patch;striplevel=0 \
29 file://fedora/gcc43-pr32139.patch;striplevel=0 \
30 file://fedora/gcc43-pr33763.patch;striplevel=0 \
31 file://fedora/gcc43-rh330771.patch;striplevel=0 \
32 file://fedora/gcc43-rh341221.patch;striplevel=0 \
33 file://fedora/gcc43-java-debug-iface-type.patch;striplevel=0 \
34 file://fedora/gcc43-i386-libgomp.patch;striplevel=0 \
35 file://fedora/gcc45-no-add-needed.patch;striplevel=0 \
36 file://103-uclibc-conf-noupstream.patch \
37 file://200-uclibc-locale.patch \
38 file://203-uclibc-locale-no__x.patch; \
39 file://204-uclibc-locale-wchar_fix.patch; \
40 file://205-uclibc-locale-update.patch; \
41 file://301-missing-execinfo_h.patch \
42 file://302-c99-snprintf.patch \
43 file://303-c99-complex-ugly-hack.patch \
44 file://304-index_macro.patch \
45 file://305-libmudflap-susv3-legacy.patch \
46 file://306-libstdc++-namespace.patch \
47 file://740-sh-pr24836.patch \
48 file://800-arm-bigendian.patch \
49 file://904-flatten-switch-stmt-00.patch \
50 file://arm-nolibfloat.patch \
51 file://arm-softfloat.patch \
52 file://zecke-xgcc-cpp.patch \
53 file://gcc-poison-system-directories.patch \
54 file://gcc-poison-dir-extend.patch \
55 file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
56 file://64bithack.patch \
57 file://optional_libstdc.patch \
58 file://disable_relax_pic_calls_flag.patch \
59 file://GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch \
60 file://COLLECT_GCC_OPTIONS.patch \
61 file://use-defaults.h-and-t-oe-in-B.patch \
62 file://pr43810.patch \
63 file://pr44290.patch \
64 file://pr44606.patch \
65 file://pr45094.patch \
66 file://pr45052.patch \
67 file://pr45886.patch \
68 file://pr44618.patch \
69 "
70
71SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch "
72
73# Language Overrides
74FORTRAN = ""
75JAVA = ""
76
77#EXTRA_OECONF_BASE = " --enable-cheaders=c_std \
78# --enable-libssp \
79# --disable-bootstrap \
80# --disable-libgomp \
81# --disable-libmudflap"
82EXTRA_OECONF_BASE = " --enable-lto \
83 --enable-libssp \
84 --disable-bootstrap \
85 --disable-libgomp \
86 --disable-libmudflap \
87 --enable-cheaders=c_global "
88
89EXTRA_OECONF_INITIAL = "--disable-libmudflap \
90 --disable-libgomp \
91 --disable-libssp \
92 --enable-decimal-float=no"
93
94EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
95 --disable-libgomp \
96 --disable-libssp"
97
98EXTRA_OECONF_append_linux-uclibc = " --disable-decimal-float "
99EXTRA_OECONF_append_linux-uclibceabi = " --disable-decimal-float "
100EXTRA_OECONF_append_linux-uclibcspe = " --disable-decimal-float "
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/100-uclibc-conf.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/100-uclibc-conf.patch
deleted file mode 100644
index 38ae167bf3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/100-uclibc-conf.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.3.1/contrib/regression/objs-gcc.sh
4===================================================================
5--- gcc-4.3.1.orig/contrib/regression/objs-gcc.sh 2007-12-24 15:18:57.000000000 -0800
6+++ gcc-4.3.1/contrib/regression/objs-gcc.sh 2008-08-16 01:15:12.000000000 -0700
7@@ -105,6 +105,10 @@
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.3.1/libjava/classpath/ltconfig
19===================================================================
20--- gcc-4.3.1.orig/libjava/classpath/ltconfig 2007-06-03 16:18:43.000000000 -0700
21+++ gcc-4.3.1/libjava/classpath/ltconfig 2008-08-16 01:15:12.000000000 -0700
22@@ -603,7 +603,7 @@
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@@ -1251,7 +1251,7 @@
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.5.1/103-uclibc-conf-noupstream.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/103-uclibc-conf-noupstream.patch
deleted file mode 100644
index abed09565d..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/103-uclibc-conf-noupstream.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Upstream-Status: Pending
2
3Corrects sub machine arch corectly
4
5Index: gcc-4.5.0/gcc/config.gcc
6===================================================================
7--- gcc-4.5.0.orig/gcc/config.gcc 2010-06-25 10:17:43.809880847 -0700
8+++ gcc-4.5.0/gcc/config.gcc 2010-06-25 10:38:09.689882136 -0700
9@@ -2171,7 +2171,7 @@
10 ;;
11 sh-*-elf* | sh[12346l]*-*-elf* | \
12 sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
13- sh-*-linux* | sh[2346lbe]*-*-linux* | \
14+ sh*-*-linux* | sh[2346lbe]*-*-linux* | \
15 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
16 sh64-*-netbsd* | sh64l*-*-netbsd*)
17 tmake_file="${tmake_file} sh/t-sh sh/t-elf"
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/200-uclibc-locale.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/200-uclibc-locale.patch
deleted file mode 100644
index d2ba65cd64..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/200-uclibc-locale.patch
+++ /dev/null
@@ -1,2842 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5.0/libstdc++-v3/acinclude.m4
4===================================================================
5--- gcc-4.5.0.orig/libstdc++-v3/acinclude.m4 2010-04-05 18:27:44.000000000 -0700
6+++ gcc-4.5.0/libstdc++-v3/acinclude.m4 2010-06-25 10:42:34.913881064 -0700
7@@ -1703,7 +1703,7 @@
8 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
9 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
10 [use MODEL for target locale package],
11- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
12+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
13
14 # Deal with gettext issues. Default to not using it (=no) until we detect
15 # support for it later. Let the user turn it off via --e/d, but let that
16@@ -1724,6 +1724,9 @@
17 # Default to "generic".
18 if test $enable_clocale_flag = auto; then
19 case ${target_os} in
20+ *-uclibc*)
21+ enable_clocale_flag=uclibc
22+ ;;
23 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
24 enable_clocale_flag=gnu
25 ;;
26@@ -1895,6 +1898,40 @@
27 CTIME_CC=config/locale/generic/time_members.cc
28 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
29 ;;
30+ uclibc)
31+ AC_MSG_RESULT(uclibc)
32+
33+ # Declare intention to use gettext, and add support for specific
34+ # languages.
35+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
36+ ALL_LINGUAS="de fr"
37+
38+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
39+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
40+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
41+ USE_NLS=yes
42+ fi
43+ # Export the build objects.
44+ for ling in $ALL_LINGUAS; do \
45+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
46+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
47+ done
48+ AC_SUBST(glibcxx_MOFILES)
49+ AC_SUBST(glibcxx_POFILES)
50+
51+ CLOCALE_H=config/locale/uclibc/c_locale.h
52+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
53+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
54+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
55+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
56+ CMESSAGES_H=config/locale/uclibc/messages_members.h
57+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
58+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
59+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
60+ CTIME_H=config/locale/uclibc/time_members.h
61+ CTIME_CC=config/locale/uclibc/time_members.cc
62+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
63+ ;;
64 esac
65
66 # This is where the testsuite looks for locale catalogs, using the
67Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
68===================================================================
69--- /dev/null 1970-01-01 00:00:00.000000000 +0000
70+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2010-06-25 10:42:34.913881064 -0700
71@@ -0,0 +1,63 @@
72+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
73+
74+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
75+//
76+// This file is part of the GNU ISO C++ Library. This library is free
77+// software; you can redistribute it and/or modify it under the
78+// terms of the GNU General Public License as published by the
79+// Free Software Foundation; either version 2, or (at your option)
80+// any later version.
81+
82+// This library is distributed in the hope that it will be useful,
83+// but WITHOUT ANY WARRANTY; without even the implied warranty of
84+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85+// GNU General Public License for more details.
86+
87+// You should have received a copy of the GNU General Public License along
88+// with this library; see the file COPYING. If not, write to the Free
89+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
90+// USA.
91+
92+// As a special exception, you may use this file as part of a free software
93+// library without restriction. Specifically, if other files instantiate
94+// templates or use macros or inline functions from this file, or you compile
95+// this file and link it with other files to produce an executable, this
96+// file does not by itself cause the resulting executable to be covered by
97+// the GNU General Public License. This exception does not however
98+// invalidate any other reasons why the executable file might be covered by
99+// the GNU General Public License.
100+
101+// Written by Jakub Jelinek <jakub@redhat.com>
102+
103+#include <bits/c++config.h>
104+#include <clocale>
105+
106+#ifdef __UCLIBC_MJN3_ONLY__
107+#warning clean this up
108+#endif
109+
110+#ifdef __UCLIBC_HAS_XLOCALE__
111+
112+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
113+extern "C" __typeof(strcoll_l) __strcoll_l;
114+extern "C" __typeof(strftime_l) __strftime_l;
115+extern "C" __typeof(strtod_l) __strtod_l;
116+extern "C" __typeof(strtof_l) __strtof_l;
117+extern "C" __typeof(strtold_l) __strtold_l;
118+extern "C" __typeof(strxfrm_l) __strxfrm_l;
119+extern "C" __typeof(newlocale) __newlocale;
120+extern "C" __typeof(freelocale) __freelocale;
121+extern "C" __typeof(duplocale) __duplocale;
122+extern "C" __typeof(uselocale) __uselocale;
123+
124+#ifdef _GLIBCXX_USE_WCHAR_T
125+extern "C" __typeof(iswctype_l) __iswctype_l;
126+extern "C" __typeof(towlower_l) __towlower_l;
127+extern "C" __typeof(towupper_l) __towupper_l;
128+extern "C" __typeof(wcscoll_l) __wcscoll_l;
129+extern "C" __typeof(wcsftime_l) __wcsftime_l;
130+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
131+extern "C" __typeof(wctype_l) __wctype_l;
132+#endif
133+
134+#endif // GLIBC 2.3 and later
135Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
136===================================================================
137--- /dev/null 1970-01-01 00:00:00.000000000 +0000
138+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2010-06-25 10:42:34.913881064 -0700
139@@ -0,0 +1,160 @@
140+// Wrapper for underlying C-language localization -*- C++ -*-
141+
142+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
143+//
144+// This file is part of the GNU ISO C++ Library. This library is free
145+// software; you can redistribute it and/or modify it under the
146+// terms of the GNU General Public License as published by the
147+// Free Software Foundation; either version 2, or (at your option)
148+// any later version.
149+
150+// This library is distributed in the hope that it will be useful,
151+// but WITHOUT ANY WARRANTY; without even the implied warranty of
152+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
153+// GNU General Public License for more details.
154+
155+// You should have received a copy of the GNU General Public License along
156+// with this library; see the file COPYING. If not, write to the Free
157+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
158+// USA.
159+
160+// As a special exception, you may use this file as part of a free software
161+// library without restriction. Specifically, if other files instantiate
162+// templates or use macros or inline functions from this file, or you compile
163+// this file and link it with other files to produce an executable, this
164+// file does not by itself cause the resulting executable to be covered by
165+// the GNU General Public License. This exception does not however
166+// invalidate any other reasons why the executable file might be covered by
167+// the GNU General Public License.
168+
169+//
170+// ISO C++ 14882: 22.8 Standard locale categories.
171+//
172+
173+// Written by Benjamin Kosnik <bkoz@redhat.com>
174+
175+#include <cerrno> // For errno
176+#include <locale>
177+#include <stdexcept>
178+#include <langinfo.h>
179+#include <bits/c++locale_internal.h>
180+
181+#ifndef __UCLIBC_HAS_XLOCALE__
182+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
183+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
184+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
185+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
186+#define __strtof_l(S, E, L) strtof((S), (E))
187+#define __strtod_l(S, E, L) strtod((S), (E))
188+#define __strtold_l(S, E, L) strtold((S), (E))
189+#warning should dummy __newlocale check for C|POSIX ?
190+#define __newlocale(a, b, c) NULL
191+#define __freelocale(a) ((void)0)
192+#define __duplocale(a) __c_locale()
193+#endif
194+
195+namespace std
196+{
197+ template<>
198+ void
199+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
200+ const __c_locale& __cloc)
201+ {
202+ if (!(__err & ios_base::failbit))
203+ {
204+ char* __sanity;
205+ errno = 0;
206+ float __f = __strtof_l(__s, &__sanity, __cloc);
207+ if (__sanity != __s && errno != ERANGE)
208+ __v = __f;
209+ else
210+ __err |= ios_base::failbit;
211+ }
212+ }
213+
214+ template<>
215+ void
216+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
217+ const __c_locale& __cloc)
218+ {
219+ if (!(__err & ios_base::failbit))
220+ {
221+ char* __sanity;
222+ errno = 0;
223+ double __d = __strtod_l(__s, &__sanity, __cloc);
224+ if (__sanity != __s && errno != ERANGE)
225+ __v = __d;
226+ else
227+ __err |= ios_base::failbit;
228+ }
229+ }
230+
231+ template<>
232+ void
233+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
234+ const __c_locale& __cloc)
235+ {
236+ if (!(__err & ios_base::failbit))
237+ {
238+ char* __sanity;
239+ errno = 0;
240+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
241+ if (__sanity != __s && errno != ERANGE)
242+ __v = __ld;
243+ else
244+ __err |= ios_base::failbit;
245+ }
246+ }
247+
248+ void
249+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
250+ __c_locale __old)
251+ {
252+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
253+#ifdef __UCLIBC_HAS_XLOCALE__
254+ if (!__cloc)
255+ {
256+ // This named locale is not supported by the underlying OS.
257+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
258+ "name not valid"));
259+ }
260+#endif
261+ }
262+
263+ void
264+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
265+ {
266+ if (_S_get_c_locale() != __cloc)
267+ __freelocale(__cloc);
268+ }
269+
270+ __c_locale
271+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
272+ { return __duplocale(__cloc); }
273+} // namespace std
274+
275+namespace __gnu_cxx
276+{
277+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
278+ {
279+ "LC_CTYPE",
280+ "LC_NUMERIC",
281+ "LC_TIME",
282+ "LC_COLLATE",
283+ "LC_MONETARY",
284+ "LC_MESSAGES",
285+#if _GLIBCXX_NUM_CATEGORIES != 0
286+ "LC_PAPER",
287+ "LC_NAME",
288+ "LC_ADDRESS",
289+ "LC_TELEPHONE",
290+ "LC_MEASUREMENT",
291+ "LC_IDENTIFICATION"
292+#endif
293+ };
294+}
295+
296+namespace std
297+{
298+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
299+} // namespace std
300Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/c_locale.h
301===================================================================
302--- /dev/null 1970-01-01 00:00:00.000000000 +0000
303+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2010-06-25 10:42:34.913881064 -0700
304@@ -0,0 +1,117 @@
305+// Wrapper for underlying C-language localization -*- C++ -*-
306+
307+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
308+//
309+// This file is part of the GNU ISO C++ Library. This library is free
310+// software; you can redistribute it and/or modify it under the
311+// terms of the GNU General Public License as published by the
312+// Free Software Foundation; either version 2, or (at your option)
313+// any later version.
314+
315+// This library is distributed in the hope that it will be useful,
316+// but WITHOUT ANY WARRANTY; without even the implied warranty of
317+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
318+// GNU General Public License for more details.
319+
320+// You should have received a copy of the GNU General Public License along
321+// with this library; see the file COPYING. If not, write to the Free
322+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
323+// USA.
324+
325+// As a special exception, you may use this file as part of a free software
326+// library without restriction. Specifically, if other files instantiate
327+// templates or use macros or inline functions from this file, or you compile
328+// this file and link it with other files to produce an executable, this
329+// file does not by itself cause the resulting executable to be covered by
330+// the GNU General Public License. This exception does not however
331+// invalidate any other reasons why the executable file might be covered by
332+// the GNU General Public License.
333+
334+//
335+// ISO C++ 14882: 22.8 Standard locale categories.
336+//
337+
338+// Written by Benjamin Kosnik <bkoz@redhat.com>
339+
340+#ifndef _C_LOCALE_H
341+#define _C_LOCALE_H 1
342+
343+#pragma GCC system_header
344+
345+#include <cstring> // get std::strlen
346+#include <cstdio> // get std::snprintf or std::sprintf
347+#include <clocale>
348+#include <langinfo.h> // For codecvt
349+#ifdef __UCLIBC_MJN3_ONLY__
350+#warning fix this
351+#endif
352+#ifdef __UCLIBC_HAS_LOCALE__
353+#include <iconv.h> // For codecvt using iconv, iconv_t
354+#endif
355+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
356+#include <libintl.h> // For messages
357+#endif
358+
359+#ifdef __UCLIBC_MJN3_ONLY__
360+#warning what is _GLIBCXX_C_LOCALE_GNU for
361+#endif
362+#define _GLIBCXX_C_LOCALE_GNU 1
363+
364+#ifdef __UCLIBC_MJN3_ONLY__
365+#warning fix categories
366+#endif
367+// #define _GLIBCXX_NUM_CATEGORIES 6
368+#define _GLIBCXX_NUM_CATEGORIES 0
369+
370+#ifdef __UCLIBC_HAS_XLOCALE__
371+namespace __gnu_cxx
372+{
373+ extern "C" __typeof(uselocale) __uselocale;
374+}
375+#endif
376+
377+namespace std
378+{
379+#ifdef __UCLIBC_HAS_XLOCALE__
380+ typedef __locale_t __c_locale;
381+#else
382+ typedef int* __c_locale;
383+#endif
384+
385+ // Convert numeric value of type _Tv to string and return length of
386+ // string. If snprintf is available use it, otherwise fall back to
387+ // the unsafe sprintf which, in general, can be dangerous and should
388+ // be avoided.
389+ template<typename _Tv>
390+ int
391+ __convert_from_v(char* __out,
392+ const int __size __attribute__ ((__unused__)),
393+ const char* __fmt,
394+#ifdef __UCLIBC_HAS_XCLOCALE__
395+ _Tv __v, const __c_locale& __cloc, int __prec)
396+ {
397+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
398+#else
399+ _Tv __v, const __c_locale&, int __prec)
400+ {
401+# ifdef __UCLIBC_HAS_LOCALE__
402+ char* __old = std::setlocale(LC_ALL, NULL);
403+ char* __sav = new char[std::strlen(__old) + 1];
404+ std::strcpy(__sav, __old);
405+ std::setlocale(LC_ALL, "C");
406+# endif
407+#endif
408+
409+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
410+
411+#ifdef __UCLIBC_HAS_XCLOCALE__
412+ __gnu_cxx::__uselocale(__old);
413+#elif defined __UCLIBC_HAS_LOCALE__
414+ std::setlocale(LC_ALL, __sav);
415+ delete [] __sav;
416+#endif
417+ return __ret;
418+ }
419+}
420+
421+#endif
422Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
423===================================================================
424--- /dev/null 1970-01-01 00:00:00.000000000 +0000
425+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2010-06-25 10:42:34.913881064 -0700
426@@ -0,0 +1,308 @@
427+// std::codecvt implementation details, GNU version -*- C++ -*-
428+
429+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
430+//
431+// This file is part of the GNU ISO C++ Library. This library is free
432+// software; you can redistribute it and/or modify it under the
433+// terms of the GNU General Public License as published by the
434+// Free Software Foundation; either version 2, or (at your option)
435+// any later version.
436+
437+// This library is distributed in the hope that it will be useful,
438+// but WITHOUT ANY WARRANTY; without even the implied warranty of
439+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
440+// GNU General Public License for more details.
441+
442+// You should have received a copy of the GNU General Public License along
443+// with this library; see the file COPYING. If not, write to the Free
444+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
445+// USA.
446+
447+// As a special exception, you may use this file as part of a free software
448+// library without restriction. Specifically, if other files instantiate
449+// templates or use macros or inline functions from this file, or you compile
450+// this file and link it with other files to produce an executable, this
451+// file does not by itself cause the resulting executable to be covered by
452+// the GNU General Public License. This exception does not however
453+// invalidate any other reasons why the executable file might be covered by
454+// the GNU General Public License.
455+
456+//
457+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
458+//
459+
460+// Written by Benjamin Kosnik <bkoz@redhat.com>
461+
462+#include <locale>
463+#include <cstdlib> // For MB_CUR_MAX
464+#include <climits> // For MB_LEN_MAX
465+#include <bits/c++locale_internal.h>
466+
467+namespace std
468+{
469+ // Specializations.
470+#ifdef _GLIBCXX_USE_WCHAR_T
471+ codecvt_base::result
472+ codecvt<wchar_t, char, mbstate_t>::
473+ do_out(state_type& __state, const intern_type* __from,
474+ const intern_type* __from_end, const intern_type*& __from_next,
475+ extern_type* __to, extern_type* __to_end,
476+ extern_type*& __to_next) const
477+ {
478+ result __ret = ok;
479+ state_type __tmp_state(__state);
480+
481+#ifdef __UCLIBC_HAS_XLOCALE__
482+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
483+#endif
484+
485+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
486+ // in case we fall back to wcrtomb and then continue, in a loop.
487+ // NB: wcsnrtombs is a GNU extension
488+ for (__from_next = __from, __to_next = __to;
489+ __from_next < __from_end && __to_next < __to_end
490+ && __ret == ok;)
491+ {
492+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
493+ __from_end - __from_next);
494+ if (!__from_chunk_end)
495+ __from_chunk_end = __from_end;
496+
497+ __from = __from_next;
498+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
499+ __from_chunk_end - __from_next,
500+ __to_end - __to_next, &__state);
501+ if (__conv == static_cast<size_t>(-1))
502+ {
503+ // In case of error, in order to stop at the exact place we
504+ // have to start again from the beginning with a series of
505+ // wcrtomb.
506+ for (; __from < __from_next; ++__from)
507+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
508+ __state = __tmp_state;
509+ __ret = error;
510+ }
511+ else if (__from_next && __from_next < __from_chunk_end)
512+ {
513+ __to_next += __conv;
514+ __ret = partial;
515+ }
516+ else
517+ {
518+ __from_next = __from_chunk_end;
519+ __to_next += __conv;
520+ }
521+
522+ if (__from_next < __from_end && __ret == ok)
523+ {
524+ extern_type __buf[MB_LEN_MAX];
525+ __tmp_state = __state;
526+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
527+ if (__conv > static_cast<size_t>(__to_end - __to_next))
528+ __ret = partial;
529+ else
530+ {
531+ memcpy(__to_next, __buf, __conv);
532+ __state = __tmp_state;
533+ __to_next += __conv;
534+ ++__from_next;
535+ }
536+ }
537+ }
538+
539+#ifdef __UCLIBC_HAS_XLOCALE__
540+ __uselocale(__old);
541+#endif
542+
543+ return __ret;
544+ }
545+
546+ codecvt_base::result
547+ codecvt<wchar_t, char, mbstate_t>::
548+ do_in(state_type& __state, const extern_type* __from,
549+ const extern_type* __from_end, const extern_type*& __from_next,
550+ intern_type* __to, intern_type* __to_end,
551+ intern_type*& __to_next) const
552+ {
553+ result __ret = ok;
554+ state_type __tmp_state(__state);
555+
556+#ifdef __UCLIBC_HAS_XLOCALE__
557+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
558+#endif
559+
560+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
561+ // in case we store a L'\0' and then continue, in a loop.
562+ // NB: mbsnrtowcs is a GNU extension
563+ for (__from_next = __from, __to_next = __to;
564+ __from_next < __from_end && __to_next < __to_end
565+ && __ret == ok;)
566+ {
567+ const extern_type* __from_chunk_end;
568+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
569+ __from_end
570+ - __from_next));
571+ if (!__from_chunk_end)
572+ __from_chunk_end = __from_end;
573+
574+ __from = __from_next;
575+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
576+ __from_chunk_end - __from_next,
577+ __to_end - __to_next, &__state);
578+ if (__conv == static_cast<size_t>(-1))
579+ {
580+ // In case of error, in order to stop at the exact place we
581+ // have to start again from the beginning with a series of
582+ // mbrtowc.
583+ for (;; ++__to_next, __from += __conv)
584+ {
585+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
586+ &__tmp_state);
587+ if (__conv == static_cast<size_t>(-1)
588+ || __conv == static_cast<size_t>(-2))
589+ break;
590+ }
591+ __from_next = __from;
592+ __state = __tmp_state;
593+ __ret = error;
594+ }
595+ else if (__from_next && __from_next < __from_chunk_end)
596+ {
597+ // It is unclear what to return in this case (see DR 382).
598+ __to_next += __conv;
599+ __ret = partial;
600+ }
601+ else
602+ {
603+ __from_next = __from_chunk_end;
604+ __to_next += __conv;
605+ }
606+
607+ if (__from_next < __from_end && __ret == ok)
608+ {
609+ if (__to_next < __to_end)
610+ {
611+ // XXX Probably wrong for stateful encodings
612+ __tmp_state = __state;
613+ ++__from_next;
614+ *__to_next++ = L'\0';
615+ }
616+ else
617+ __ret = partial;
618+ }
619+ }
620+
621+#ifdef __UCLIBC_HAS_XLOCALE__
622+ __uselocale(__old);
623+#endif
624+
625+ return __ret;
626+ }
627+
628+ int
629+ codecvt<wchar_t, char, mbstate_t>::
630+ do_encoding() const throw()
631+ {
632+ // XXX This implementation assumes that the encoding is
633+ // stateless and is either single-byte or variable-width.
634+ int __ret = 0;
635+#ifdef __UCLIBC_HAS_XLOCALE__
636+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
637+#endif
638+ if (MB_CUR_MAX == 1)
639+ __ret = 1;
640+#ifdef __UCLIBC_HAS_XLOCALE__
641+ __uselocale(__old);
642+#endif
643+ return __ret;
644+ }
645+
646+ int
647+ codecvt<wchar_t, char, mbstate_t>::
648+ do_max_length() const throw()
649+ {
650+#ifdef __UCLIBC_HAS_XLOCALE__
651+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
652+#endif
653+ // XXX Probably wrong for stateful encodings.
654+ int __ret = MB_CUR_MAX;
655+#ifdef __UCLIBC_HAS_XLOCALE__
656+ __uselocale(__old);
657+#endif
658+ return __ret;
659+ }
660+
661+ int
662+ codecvt<wchar_t, char, mbstate_t>::
663+ do_length(state_type& __state, const extern_type* __from,
664+ const extern_type* __end, size_t __max) const
665+ {
666+ int __ret = 0;
667+ state_type __tmp_state(__state);
668+
669+#ifdef __UCLIBC_HAS_XLOCALE__
670+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
671+#endif
672+
673+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
674+ // in case we advance past it and then continue, in a loop.
675+ // NB: mbsnrtowcs is a GNU extension
676+
677+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
678+ // its fourth parameter (it wouldn't with NULL as first parameter).
679+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
680+ * __max));
681+ while (__from < __end && __max)
682+ {
683+ const extern_type* __from_chunk_end;
684+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
685+ __end
686+ - __from));
687+ if (!__from_chunk_end)
688+ __from_chunk_end = __end;
689+
690+ const extern_type* __tmp_from = __from;
691+ size_t __conv = mbsnrtowcs(__to, &__from,
692+ __from_chunk_end - __from,
693+ __max, &__state);
694+ if (__conv == static_cast<size_t>(-1))
695+ {
696+ // In case of error, in order to stop at the exact place we
697+ // have to start again from the beginning with a series of
698+ // mbrtowc.
699+ for (__from = __tmp_from;; __from += __conv)
700+ {
701+ __conv = mbrtowc(NULL, __from, __end - __from,
702+ &__tmp_state);
703+ if (__conv == static_cast<size_t>(-1)
704+ || __conv == static_cast<size_t>(-2))
705+ break;
706+ }
707+ __state = __tmp_state;
708+ __ret += __from - __tmp_from;
709+ break;
710+ }
711+ if (!__from)
712+ __from = __from_chunk_end;
713+
714+ __ret += __from - __tmp_from;
715+ __max -= __conv;
716+
717+ if (__from < __end && __max)
718+ {
719+ // XXX Probably wrong for stateful encodings
720+ __tmp_state = __state;
721+ ++__from;
722+ ++__ret;
723+ --__max;
724+ }
725+ }
726+
727+#ifdef __UCLIBC_HAS_XLOCALE__
728+ __uselocale(__old);
729+#endif
730+
731+ return __ret;
732+ }
733+#endif
734+}
735Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
736===================================================================
737--- /dev/null 1970-01-01 00:00:00.000000000 +0000
738+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2010-06-25 10:42:34.913881064 -0700
739@@ -0,0 +1,80 @@
740+// std::collate implementation details, GNU version -*- C++ -*-
741+
742+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
743+//
744+// This file is part of the GNU ISO C++ Library. This library is free
745+// software; you can redistribute it and/or modify it under the
746+// terms of the GNU General Public License as published by the
747+// Free Software Foundation; either version 2, or (at your option)
748+// any later version.
749+
750+// This library is distributed in the hope that it will be useful,
751+// but WITHOUT ANY WARRANTY; without even the implied warranty of
752+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
753+// GNU General Public License for more details.
754+
755+// You should have received a copy of the GNU General Public License along
756+// with this library; see the file COPYING. If not, write to the Free
757+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
758+// USA.
759+
760+// As a special exception, you may use this file as part of a free software
761+// library without restriction. Specifically, if other files instantiate
762+// templates or use macros or inline functions from this file, or you compile
763+// this file and link it with other files to produce an executable, this
764+// file does not by itself cause the resulting executable to be covered by
765+// the GNU General Public License. This exception does not however
766+// invalidate any other reasons why the executable file might be covered by
767+// the GNU General Public License.
768+
769+//
770+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
771+//
772+
773+// Written by Benjamin Kosnik <bkoz@redhat.com>
774+
775+#include <locale>
776+#include <bits/c++locale_internal.h>
777+
778+#ifndef __UCLIBC_HAS_XLOCALE__
779+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
780+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
781+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
782+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
783+#endif
784+
785+namespace std
786+{
787+ // These are basically extensions to char_traits, and perhaps should
788+ // be put there instead of here.
789+ template<>
790+ int
791+ collate<char>::_M_compare(const char* __one, const char* __two) const
792+ {
793+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
794+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
795+ }
796+
797+ template<>
798+ size_t
799+ collate<char>::_M_transform(char* __to, const char* __from,
800+ size_t __n) const
801+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
802+
803+#ifdef _GLIBCXX_USE_WCHAR_T
804+ template<>
805+ int
806+ collate<wchar_t>::_M_compare(const wchar_t* __one,
807+ const wchar_t* __two) const
808+ {
809+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
810+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
811+ }
812+
813+ template<>
814+ size_t
815+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
816+ size_t __n) const
817+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
818+#endif
819+}
820Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
821===================================================================
822--- /dev/null 1970-01-01 00:00:00.000000000 +0000
823+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2010-06-25 10:42:34.913881064 -0700
824@@ -0,0 +1,300 @@
825+// std::ctype implementation details, GNU version -*- C++ -*-
826+
827+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
828+//
829+// This file is part of the GNU ISO C++ Library. This library is free
830+// software; you can redistribute it and/or modify it under the
831+// terms of the GNU General Public License as published by the
832+// Free Software Foundation; either version 2, or (at your option)
833+// any later version.
834+
835+// This library is distributed in the hope that it will be useful,
836+// but WITHOUT ANY WARRANTY; without even the implied warranty of
837+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
838+// GNU General Public License for more details.
839+
840+// You should have received a copy of the GNU General Public License along
841+// with this library; see the file COPYING. If not, write to the Free
842+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
843+// USA.
844+
845+// As a special exception, you may use this file as part of a free software
846+// library without restriction. Specifically, if other files instantiate
847+// templates or use macros or inline functions from this file, or you compile
848+// this file and link it with other files to produce an executable, this
849+// file does not by itself cause the resulting executable to be covered by
850+// the GNU General Public License. This exception does not however
851+// invalidate any other reasons why the executable file might be covered by
852+// the GNU General Public License.
853+
854+//
855+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
856+//
857+
858+// Written by Benjamin Kosnik <bkoz@redhat.com>
859+
860+#define _LIBC
861+#include <locale>
862+#undef _LIBC
863+#include <bits/c++locale_internal.h>
864+
865+#ifndef __UCLIBC_HAS_XLOCALE__
866+#define __wctype_l(S, L) wctype((S))
867+#define __towupper_l(C, L) towupper((C))
868+#define __towlower_l(C, L) towlower((C))
869+#define __iswctype_l(C, M, L) iswctype((C), (M))
870+#endif
871+
872+namespace std
873+{
874+ // NB: The other ctype<char> specializations are in src/locale.cc and
875+ // various /config/os/* files.
876+ template<>
877+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
878+ : ctype<char>(0, false, __refs)
879+ {
880+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
881+ {
882+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
883+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
884+#ifdef __UCLIBC_HAS_XLOCALE__
885+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
886+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
887+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
888+#endif
889+ }
890+ }
891+
892+#ifdef _GLIBCXX_USE_WCHAR_T
893+ ctype<wchar_t>::__wmask_type
894+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
895+ {
896+ __wmask_type __ret;
897+ switch (__m)
898+ {
899+ case space:
900+ __ret = __wctype_l("space", _M_c_locale_ctype);
901+ break;
902+ case print:
903+ __ret = __wctype_l("print", _M_c_locale_ctype);
904+ break;
905+ case cntrl:
906+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
907+ break;
908+ case upper:
909+ __ret = __wctype_l("upper", _M_c_locale_ctype);
910+ break;
911+ case lower:
912+ __ret = __wctype_l("lower", _M_c_locale_ctype);
913+ break;
914+ case alpha:
915+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
916+ break;
917+ case digit:
918+ __ret = __wctype_l("digit", _M_c_locale_ctype);
919+ break;
920+ case punct:
921+ __ret = __wctype_l("punct", _M_c_locale_ctype);
922+ break;
923+ case xdigit:
924+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
925+ break;
926+ case alnum:
927+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
928+ break;
929+ case graph:
930+ __ret = __wctype_l("graph", _M_c_locale_ctype);
931+ break;
932+ default:
933+ __ret = __wmask_type();
934+ }
935+ return __ret;
936+ }
937+
938+ wchar_t
939+ ctype<wchar_t>::do_toupper(wchar_t __c) const
940+ { return __towupper_l(__c, _M_c_locale_ctype); }
941+
942+ const wchar_t*
943+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
944+ {
945+ while (__lo < __hi)
946+ {
947+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
948+ ++__lo;
949+ }
950+ return __hi;
951+ }
952+
953+ wchar_t
954+ ctype<wchar_t>::do_tolower(wchar_t __c) const
955+ { return __towlower_l(__c, _M_c_locale_ctype); }
956+
957+ const wchar_t*
958+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
959+ {
960+ while (__lo < __hi)
961+ {
962+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
963+ ++__lo;
964+ }
965+ return __hi;
966+ }
967+
968+ bool
969+ ctype<wchar_t>::
970+ do_is(mask __m, wchar_t __c) const
971+ {
972+ // Highest bitmask in ctype_base == 10, but extra in "C"
973+ // library for blank.
974+ bool __ret = false;
975+ const size_t __bitmasksize = 11;
976+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
977+ if (__m & _M_bit[__bitcur]
978+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
979+ {
980+ __ret = true;
981+ break;
982+ }
983+ return __ret;
984+ }
985+
986+ const wchar_t*
987+ ctype<wchar_t>::
988+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
989+ {
990+ for (; __lo < __hi; ++__vec, ++__lo)
991+ {
992+ // Highest bitmask in ctype_base == 10, but extra in "C"
993+ // library for blank.
994+ const size_t __bitmasksize = 11;
995+ mask __m = 0;
996+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
997+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
998+ __m |= _M_bit[__bitcur];
999+ *__vec = __m;
1000+ }
1001+ return __hi;
1002+ }
1003+
1004+ const wchar_t*
1005+ ctype<wchar_t>::
1006+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1007+ {
1008+ while (__lo < __hi && !this->do_is(__m, *__lo))
1009+ ++__lo;
1010+ return __lo;
1011+ }
1012+
1013+ const wchar_t*
1014+ ctype<wchar_t>::
1015+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1016+ {
1017+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1018+ ++__lo;
1019+ return __lo;
1020+ }
1021+
1022+ wchar_t
1023+ ctype<wchar_t>::
1024+ do_widen(char __c) const
1025+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1026+
1027+ const char*
1028+ ctype<wchar_t>::
1029+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1030+ {
1031+ while (__lo < __hi)
1032+ {
1033+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1034+ ++__lo;
1035+ ++__dest;
1036+ }
1037+ return __hi;
1038+ }
1039+
1040+ char
1041+ ctype<wchar_t>::
1042+ do_narrow(wchar_t __wc, char __dfault) const
1043+ {
1044+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1045+ return _M_narrow[__wc];
1046+#ifdef __UCLIBC_HAS_XLOCALE__
1047+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1048+#endif
1049+ const int __c = wctob(__wc);
1050+#ifdef __UCLIBC_HAS_XLOCALE__
1051+ __uselocale(__old);
1052+#endif
1053+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1054+ }
1055+
1056+ const wchar_t*
1057+ ctype<wchar_t>::
1058+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1059+ char* __dest) const
1060+ {
1061+#ifdef __UCLIBC_HAS_XLOCALE__
1062+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1063+#endif
1064+ if (_M_narrow_ok)
1065+ while (__lo < __hi)
1066+ {
1067+ if (*__lo >= 0 && *__lo < 128)
1068+ *__dest = _M_narrow[*__lo];
1069+ else
1070+ {
1071+ const int __c = wctob(*__lo);
1072+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1073+ }
1074+ ++__lo;
1075+ ++__dest;
1076+ }
1077+ else
1078+ while (__lo < __hi)
1079+ {
1080+ const int __c = wctob(*__lo);
1081+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1082+ ++__lo;
1083+ ++__dest;
1084+ }
1085+#ifdef __UCLIBC_HAS_XLOCALE__
1086+ __uselocale(__old);
1087+#endif
1088+ return __hi;
1089+ }
1090+
1091+ void
1092+ ctype<wchar_t>::_M_initialize_ctype()
1093+ {
1094+#ifdef __UCLIBC_HAS_XLOCALE__
1095+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1096+#endif
1097+ wint_t __i;
1098+ for (__i = 0; __i < 128; ++__i)
1099+ {
1100+ const int __c = wctob(__i);
1101+ if (__c == EOF)
1102+ break;
1103+ else
1104+ _M_narrow[__i] = static_cast<char>(__c);
1105+ }
1106+ if (__i == 128)
1107+ _M_narrow_ok = true;
1108+ else
1109+ _M_narrow_ok = false;
1110+ for (size_t __j = 0;
1111+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1112+ _M_widen[__j] = btowc(__j);
1113+
1114+ for (size_t __k = 0; __k <= 11; ++__k)
1115+ {
1116+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1117+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1118+ }
1119+#ifdef __UCLIBC_HAS_XLOCALE__
1120+ __uselocale(__old);
1121+#endif
1122+ }
1123+#endif // _GLIBCXX_USE_WCHAR_T
1124+}
1125Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
1126===================================================================
1127--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1128+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2010-06-25 10:42:34.913881064 -0700
1129@@ -0,0 +1,100 @@
1130+// std::messages implementation details, GNU version -*- C++ -*-
1131+
1132+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1133+//
1134+// This file is part of the GNU ISO C++ Library. This library is free
1135+// software; you can redistribute it and/or modify it under the
1136+// terms of the GNU General Public License as published by the
1137+// Free Software Foundation; either version 2, or (at your option)
1138+// any later version.
1139+
1140+// This library is distributed in the hope that it will be useful,
1141+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1142+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1143+// GNU General Public License for more details.
1144+
1145+// You should have received a copy of the GNU General Public License along
1146+// with this library; see the file COPYING. If not, write to the Free
1147+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1148+// USA.
1149+
1150+// As a special exception, you may use this file as part of a free software
1151+// library without restriction. Specifically, if other files instantiate
1152+// templates or use macros or inline functions from this file, or you compile
1153+// this file and link it with other files to produce an executable, this
1154+// file does not by itself cause the resulting executable to be covered by
1155+// the GNU General Public License. This exception does not however
1156+// invalidate any other reasons why the executable file might be covered by
1157+// the GNU General Public License.
1158+
1159+//
1160+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1161+//
1162+
1163+// Written by Benjamin Kosnik <bkoz@redhat.com>
1164+
1165+#include <locale>
1166+#include <bits/c++locale_internal.h>
1167+
1168+#ifdef __UCLIBC_MJN3_ONLY__
1169+#warning fix gettext stuff
1170+#endif
1171+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1172+extern "C" char *__dcgettext(const char *domainname,
1173+ const char *msgid, int category);
1174+#undef gettext
1175+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1176+#else
1177+#undef gettext
1178+#define gettext(msgid) (msgid)
1179+#endif
1180+
1181+namespace std
1182+{
1183+ // Specializations.
1184+ template<>
1185+ string
1186+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1187+ {
1188+#ifdef __UCLIBC_HAS_XLOCALE__
1189+ __c_locale __old = __uselocale(_M_c_locale_messages);
1190+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1191+ __uselocale(__old);
1192+ return string(__msg);
1193+#elif defined __UCLIBC_HAS_LOCALE__
1194+ char* __old = strdup(setlocale(LC_ALL, NULL));
1195+ setlocale(LC_ALL, _M_name_messages);
1196+ const char* __msg = gettext(__dfault.c_str());
1197+ setlocale(LC_ALL, __old);
1198+ free(__old);
1199+ return string(__msg);
1200+#else
1201+ const char* __msg = gettext(__dfault.c_str());
1202+ return string(__msg);
1203+#endif
1204+ }
1205+
1206+#ifdef _GLIBCXX_USE_WCHAR_T
1207+ template<>
1208+ wstring
1209+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1210+ {
1211+# ifdef __UCLIBC_HAS_XLOCALE__
1212+ __c_locale __old = __uselocale(_M_c_locale_messages);
1213+ char* __msg = gettext(_M_convert_to_char(__dfault));
1214+ __uselocale(__old);
1215+ return _M_convert_from_char(__msg);
1216+# elif defined __UCLIBC_HAS_LOCALE__
1217+ char* __old = strdup(setlocale(LC_ALL, NULL));
1218+ setlocale(LC_ALL, _M_name_messages);
1219+ char* __msg = gettext(_M_convert_to_char(__dfault));
1220+ setlocale(LC_ALL, __old);
1221+ free(__old);
1222+ return _M_convert_from_char(__msg);
1223+# else
1224+ char* __msg = gettext(_M_convert_to_char(__dfault));
1225+ return _M_convert_from_char(__msg);
1226+# endif
1227+ }
1228+#endif
1229+}
1230Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.h
1231===================================================================
1232--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1233+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2010-06-25 10:42:34.913881064 -0700
1234@@ -0,0 +1,118 @@
1235+// std::messages implementation details, GNU version -*- C++ -*-
1236+
1237+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1238+//
1239+// This file is part of the GNU ISO C++ Library. This library is free
1240+// software; you can redistribute it and/or modify it under the
1241+// terms of the GNU General Public License as published by the
1242+// Free Software Foundation; either version 2, or (at your option)
1243+// any later version.
1244+
1245+// This library is distributed in the hope that it will be useful,
1246+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1247+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1248+// GNU General Public License for more details.
1249+
1250+// You should have received a copy of the GNU General Public License along
1251+// with this library; see the file COPYING. If not, write to the Free
1252+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1253+// USA.
1254+
1255+// As a special exception, you may use this file as part of a free software
1256+// library without restriction. Specifically, if other files instantiate
1257+// templates or use macros or inline functions from this file, or you compile
1258+// this file and link it with other files to produce an executable, this
1259+// file does not by itself cause the resulting executable to be covered by
1260+// the GNU General Public License. This exception does not however
1261+// invalidate any other reasons why the executable file might be covered by
1262+// the GNU General Public License.
1263+
1264+//
1265+// ISO C++ 14882: 22.2.7.1.2 messages functions
1266+//
1267+
1268+// Written by Benjamin Kosnik <bkoz@redhat.com>
1269+
1270+#ifdef __UCLIBC_MJN3_ONLY__
1271+#warning fix prototypes for *textdomain funcs
1272+#endif
1273+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1274+extern "C" char *__textdomain(const char *domainname);
1275+extern "C" char *__bindtextdomain(const char *domainname,
1276+ const char *dirname);
1277+#else
1278+#undef __textdomain
1279+#undef __bindtextdomain
1280+#define __textdomain(D) ((void)0)
1281+#define __bindtextdomain(D,P) ((void)0)
1282+#endif
1283+
1284+ // Non-virtual member functions.
1285+ template<typename _CharT>
1286+ messages<_CharT>::messages(size_t __refs)
1287+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1288+ _M_name_messages(_S_get_c_name())
1289+ { }
1290+
1291+ template<typename _CharT>
1292+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1293+ size_t __refs)
1294+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1295+ _M_name_messages(__s)
1296+ {
1297+ char* __tmp = new char[std::strlen(__s) + 1];
1298+ std::strcpy(__tmp, __s);
1299+ _M_name_messages = __tmp;
1300+ }
1301+
1302+ template<typename _CharT>
1303+ typename messages<_CharT>::catalog
1304+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1305+ const char* __dir) const
1306+ {
1307+ __bindtextdomain(__s.c_str(), __dir);
1308+ return this->do_open(__s, __loc);
1309+ }
1310+
1311+ // Virtual member functions.
1312+ template<typename _CharT>
1313+ messages<_CharT>::~messages()
1314+ {
1315+ if (_M_name_messages != _S_get_c_name())
1316+ delete [] _M_name_messages;
1317+ _S_destroy_c_locale(_M_c_locale_messages);
1318+ }
1319+
1320+ template<typename _CharT>
1321+ typename messages<_CharT>::catalog
1322+ messages<_CharT>::do_open(const basic_string<char>& __s,
1323+ const locale&) const
1324+ {
1325+ // No error checking is done, assume the catalog exists and can
1326+ // be used.
1327+ __textdomain(__s.c_str());
1328+ return 0;
1329+ }
1330+
1331+ template<typename _CharT>
1332+ void
1333+ messages<_CharT>::do_close(catalog) const
1334+ { }
1335+
1336+ // messages_byname
1337+ template<typename _CharT>
1338+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1339+ : messages<_CharT>(__refs)
1340+ {
1341+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1342+ delete [] this->_M_name_messages;
1343+ char* __tmp = new char[std::strlen(__s) + 1];
1344+ std::strcpy(__tmp, __s);
1345+ this->_M_name_messages = __tmp;
1346+
1347+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1348+ {
1349+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1350+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1351+ }
1352+ }
1353Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1354===================================================================
1355--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1356+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2010-06-25 10:42:34.913881064 -0700
1357@@ -0,0 +1,692 @@
1358+// std::moneypunct implementation details, GNU version -*- C++ -*-
1359+
1360+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1361+//
1362+// This file is part of the GNU ISO C++ Library. This library is free
1363+// software; you can redistribute it and/or modify it under the
1364+// terms of the GNU General Public License as published by the
1365+// Free Software Foundation; either version 2, or (at your option)
1366+// any later version.
1367+
1368+// This library is distributed in the hope that it will be useful,
1369+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1370+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1371+// GNU General Public License for more details.
1372+
1373+// You should have received a copy of the GNU General Public License along
1374+// with this library; see the file COPYING. If not, write to the Free
1375+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1376+// USA.
1377+
1378+// As a special exception, you may use this file as part of a free software
1379+// library without restriction. Specifically, if other files instantiate
1380+// templates or use macros or inline functions from this file, or you compile
1381+// this file and link it with other files to produce an executable, this
1382+// file does not by itself cause the resulting executable to be covered by
1383+// the GNU General Public License. This exception does not however
1384+// invalidate any other reasons why the executable file might be covered by
1385+// the GNU General Public License.
1386+
1387+//
1388+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1389+//
1390+
1391+// Written by Benjamin Kosnik <bkoz@redhat.com>
1392+
1393+#define _LIBC
1394+#include <locale>
1395+#undef _LIBC
1396+#include <bits/c++locale_internal.h>
1397+
1398+#ifdef __UCLIBC_MJN3_ONLY__
1399+#warning optimize this for uclibc
1400+#warning tailor for stub locale support
1401+#endif
1402+
1403+#ifndef __UCLIBC_HAS_XLOCALE__
1404+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1405+#endif
1406+
1407+namespace std
1408+{
1409+ // Construct and return valid pattern consisting of some combination of:
1410+ // space none symbol sign value
1411+ money_base::pattern
1412+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1413+ {
1414+ pattern __ret;
1415+
1416+ // This insanely complicated routine attempts to construct a valid
1417+ // pattern for use with monyepunct. A couple of invariants:
1418+
1419+ // if (__precedes) symbol -> value
1420+ // else value -> symbol
1421+
1422+ // if (__space) space
1423+ // else none
1424+
1425+ // none == never first
1426+ // space never first or last
1427+
1428+ // Any elegant implementations of this are welcome.
1429+ switch (__posn)
1430+ {
1431+ case 0:
1432+ case 1:
1433+ // 1 The sign precedes the value and symbol.
1434+ __ret.field[0] = sign;
1435+ if (__space)
1436+ {
1437+ // Pattern starts with sign.
1438+ if (__precedes)
1439+ {
1440+ __ret.field[1] = symbol;
1441+ __ret.field[3] = value;
1442+ }
1443+ else
1444+ {
1445+ __ret.field[1] = value;
1446+ __ret.field[3] = symbol;
1447+ }
1448+ __ret.field[2] = space;
1449+ }
1450+ else
1451+ {
1452+ // Pattern starts with sign and ends with none.
1453+ if (__precedes)
1454+ {
1455+ __ret.field[1] = symbol;
1456+ __ret.field[2] = value;
1457+ }
1458+ else
1459+ {
1460+ __ret.field[1] = value;
1461+ __ret.field[2] = symbol;
1462+ }
1463+ __ret.field[3] = none;
1464+ }
1465+ break;
1466+ case 2:
1467+ // 2 The sign follows the value and symbol.
1468+ if (__space)
1469+ {
1470+ // Pattern either ends with sign.
1471+ if (__precedes)
1472+ {
1473+ __ret.field[0] = symbol;
1474+ __ret.field[2] = value;
1475+ }
1476+ else
1477+ {
1478+ __ret.field[0] = value;
1479+ __ret.field[2] = symbol;
1480+ }
1481+ __ret.field[1] = space;
1482+ __ret.field[3] = sign;
1483+ }
1484+ else
1485+ {
1486+ // Pattern ends with sign then none.
1487+ if (__precedes)
1488+ {
1489+ __ret.field[0] = symbol;
1490+ __ret.field[1] = value;
1491+ }
1492+ else
1493+ {
1494+ __ret.field[0] = value;
1495+ __ret.field[1] = symbol;
1496+ }
1497+ __ret.field[2] = sign;
1498+ __ret.field[3] = none;
1499+ }
1500+ break;
1501+ case 3:
1502+ // 3 The sign immediately precedes the symbol.
1503+ if (__precedes)
1504+ {
1505+ __ret.field[0] = sign;
1506+ __ret.field[1] = symbol;
1507+ if (__space)
1508+ {
1509+ __ret.field[2] = space;
1510+ __ret.field[3] = value;
1511+ }
1512+ else
1513+ {
1514+ __ret.field[2] = value;
1515+ __ret.field[3] = none;
1516+ }
1517+ }
1518+ else
1519+ {
1520+ __ret.field[0] = value;
1521+ if (__space)
1522+ {
1523+ __ret.field[1] = space;
1524+ __ret.field[2] = sign;
1525+ __ret.field[3] = symbol;
1526+ }
1527+ else
1528+ {
1529+ __ret.field[1] = sign;
1530+ __ret.field[2] = symbol;
1531+ __ret.field[3] = none;
1532+ }
1533+ }
1534+ break;
1535+ case 4:
1536+ // 4 The sign immediately follows the symbol.
1537+ if (__precedes)
1538+ {
1539+ __ret.field[0] = symbol;
1540+ __ret.field[1] = sign;
1541+ if (__space)
1542+ {
1543+ __ret.field[2] = space;
1544+ __ret.field[3] = value;
1545+ }
1546+ else
1547+ {
1548+ __ret.field[2] = value;
1549+ __ret.field[3] = none;
1550+ }
1551+ }
1552+ else
1553+ {
1554+ __ret.field[0] = value;
1555+ if (__space)
1556+ {
1557+ __ret.field[1] = space;
1558+ __ret.field[2] = symbol;
1559+ __ret.field[3] = sign;
1560+ }
1561+ else
1562+ {
1563+ __ret.field[1] = symbol;
1564+ __ret.field[2] = sign;
1565+ __ret.field[3] = none;
1566+ }
1567+ }
1568+ break;
1569+ default:
1570+ ;
1571+ }
1572+ return __ret;
1573+ }
1574+
1575+ template<>
1576+ void
1577+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1578+ const char*)
1579+ {
1580+ if (!_M_data)
1581+ _M_data = new __moneypunct_cache<char, true>;
1582+
1583+ if (!__cloc)
1584+ {
1585+ // "C" locale
1586+ _M_data->_M_decimal_point = '.';
1587+ _M_data->_M_thousands_sep = ',';
1588+ _M_data->_M_grouping = "";
1589+ _M_data->_M_grouping_size = 0;
1590+ _M_data->_M_curr_symbol = "";
1591+ _M_data->_M_curr_symbol_size = 0;
1592+ _M_data->_M_positive_sign = "";
1593+ _M_data->_M_positive_sign_size = 0;
1594+ _M_data->_M_negative_sign = "";
1595+ _M_data->_M_negative_sign_size = 0;
1596+ _M_data->_M_frac_digits = 0;
1597+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1598+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1599+
1600+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1601+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1602+ }
1603+ else
1604+ {
1605+ // Named locale.
1606+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1607+ __cloc));
1608+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1609+ __cloc));
1610+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1611+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1612+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1613+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1614+
1615+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1616+ if (!__nposn)
1617+ _M_data->_M_negative_sign = "()";
1618+ else
1619+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1620+ __cloc);
1621+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1622+
1623+ // _Intl == true
1624+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1625+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1626+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1627+ __cloc));
1628+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1629+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1630+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1631+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1632+ __pposn);
1633+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1634+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1635+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1636+ __nposn);
1637+ }
1638+ }
1639+
1640+ template<>
1641+ void
1642+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1643+ const char*)
1644+ {
1645+ if (!_M_data)
1646+ _M_data = new __moneypunct_cache<char, false>;
1647+
1648+ if (!__cloc)
1649+ {
1650+ // "C" locale
1651+ _M_data->_M_decimal_point = '.';
1652+ _M_data->_M_thousands_sep = ',';
1653+ _M_data->_M_grouping = "";
1654+ _M_data->_M_grouping_size = 0;
1655+ _M_data->_M_curr_symbol = "";
1656+ _M_data->_M_curr_symbol_size = 0;
1657+ _M_data->_M_positive_sign = "";
1658+ _M_data->_M_positive_sign_size = 0;
1659+ _M_data->_M_negative_sign = "";
1660+ _M_data->_M_negative_sign_size = 0;
1661+ _M_data->_M_frac_digits = 0;
1662+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1663+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1664+
1665+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1666+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1667+ }
1668+ else
1669+ {
1670+ // Named locale.
1671+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1672+ __cloc));
1673+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1674+ __cloc));
1675+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1676+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1677+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1678+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1679+
1680+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1681+ if (!__nposn)
1682+ _M_data->_M_negative_sign = "()";
1683+ else
1684+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1685+ __cloc);
1686+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1687+
1688+ // _Intl == false
1689+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1690+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1691+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1692+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1693+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1694+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1695+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1696+ __pposn);
1697+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1698+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1699+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1700+ __nposn);
1701+ }
1702+ }
1703+
1704+ template<>
1705+ moneypunct<char, true>::~moneypunct()
1706+ { delete _M_data; }
1707+
1708+ template<>
1709+ moneypunct<char, false>::~moneypunct()
1710+ { delete _M_data; }
1711+
1712+#ifdef _GLIBCXX_USE_WCHAR_T
1713+ template<>
1714+ void
1715+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1716+#ifdef __UCLIBC_HAS_XLOCALE__
1717+ const char*)
1718+#else
1719+ const char* __name)
1720+#endif
1721+ {
1722+ if (!_M_data)
1723+ _M_data = new __moneypunct_cache<wchar_t, true>;
1724+
1725+ if (!__cloc)
1726+ {
1727+ // "C" locale
1728+ _M_data->_M_decimal_point = L'.';
1729+ _M_data->_M_thousands_sep = L',';
1730+ _M_data->_M_grouping = "";
1731+ _M_data->_M_grouping_size = 0;
1732+ _M_data->_M_curr_symbol = L"";
1733+ _M_data->_M_curr_symbol_size = 0;
1734+ _M_data->_M_positive_sign = L"";
1735+ _M_data->_M_positive_sign_size = 0;
1736+ _M_data->_M_negative_sign = L"";
1737+ _M_data->_M_negative_sign_size = 0;
1738+ _M_data->_M_frac_digits = 0;
1739+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1740+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1741+
1742+ // Use ctype::widen code without the facet...
1743+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1744+ _M_data->_M_atoms[__i] =
1745+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1746+ }
1747+ else
1748+ {
1749+ // Named locale.
1750+#ifdef __UCLIBC_HAS_XLOCALE__
1751+ __c_locale __old = __uselocale(__cloc);
1752+#else
1753+ // Switch to named locale so that mbsrtowcs will work.
1754+ char* __old = strdup(setlocale(LC_ALL, NULL));
1755+ setlocale(LC_ALL, __name);
1756+#endif
1757+
1758+#ifdef __UCLIBC_MJN3_ONLY__
1759+#warning fix this... should be monetary
1760+#endif
1761+#ifdef __UCLIBC__
1762+# ifdef __UCLIBC_HAS_XLOCALE__
1763+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1764+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1765+# else
1766+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1767+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1768+# endif
1769+#else
1770+ union { char *__s; wchar_t __w; } __u;
1771+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1772+ _M_data->_M_decimal_point = __u.__w;
1773+
1774+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1775+ _M_data->_M_thousands_sep = __u.__w;
1776+#endif
1777+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1778+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1779+
1780+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1781+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1782+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1783+
1784+ wchar_t* __wcs_ps = 0;
1785+ wchar_t* __wcs_ns = 0;
1786+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1787+ try
1788+ {
1789+ mbstate_t __state;
1790+ size_t __len = strlen(__cpossign);
1791+ if (__len)
1792+ {
1793+ ++__len;
1794+ memset(&__state, 0, sizeof(mbstate_t));
1795+ __wcs_ps = new wchar_t[__len];
1796+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1797+ _M_data->_M_positive_sign = __wcs_ps;
1798+ }
1799+ else
1800+ _M_data->_M_positive_sign = L"";
1801+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1802+
1803+ __len = strlen(__cnegsign);
1804+ if (!__nposn)
1805+ _M_data->_M_negative_sign = L"()";
1806+ else if (__len)
1807+ {
1808+ ++__len;
1809+ memset(&__state, 0, sizeof(mbstate_t));
1810+ __wcs_ns = new wchar_t[__len];
1811+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1812+ _M_data->_M_negative_sign = __wcs_ns;
1813+ }
1814+ else
1815+ _M_data->_M_negative_sign = L"";
1816+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1817+
1818+ // _Intl == true.
1819+ __len = strlen(__ccurr);
1820+ if (__len)
1821+ {
1822+ ++__len;
1823+ memset(&__state, 0, sizeof(mbstate_t));
1824+ wchar_t* __wcs = new wchar_t[__len];
1825+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1826+ _M_data->_M_curr_symbol = __wcs;
1827+ }
1828+ else
1829+ _M_data->_M_curr_symbol = L"";
1830+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1831+ }
1832+ catch (...)
1833+ {
1834+ delete _M_data;
1835+ _M_data = 0;
1836+ delete __wcs_ps;
1837+ delete __wcs_ns;
1838+#ifdef __UCLIBC_HAS_XLOCALE__
1839+ __uselocale(__old);
1840+#else
1841+ setlocale(LC_ALL, __old);
1842+ free(__old);
1843+#endif
1844+ __throw_exception_again;
1845+ }
1846+
1847+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1848+ __cloc));
1849+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1850+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1851+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1852+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1853+ __pposn);
1854+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1855+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1856+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1857+ __nposn);
1858+
1859+#ifdef __UCLIBC_HAS_XLOCALE__
1860+ __uselocale(__old);
1861+#else
1862+ setlocale(LC_ALL, __old);
1863+ free(__old);
1864+#endif
1865+ }
1866+ }
1867+
1868+ template<>
1869+ void
1870+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1871+#ifdef __UCLIBC_HAS_XLOCALE__
1872+ const char*)
1873+#else
1874+ const char* __name)
1875+#endif
1876+ {
1877+ if (!_M_data)
1878+ _M_data = new __moneypunct_cache<wchar_t, false>;
1879+
1880+ if (!__cloc)
1881+ {
1882+ // "C" locale
1883+ _M_data->_M_decimal_point = L'.';
1884+ _M_data->_M_thousands_sep = L',';
1885+ _M_data->_M_grouping = "";
1886+ _M_data->_M_grouping_size = 0;
1887+ _M_data->_M_curr_symbol = L"";
1888+ _M_data->_M_curr_symbol_size = 0;
1889+ _M_data->_M_positive_sign = L"";
1890+ _M_data->_M_positive_sign_size = 0;
1891+ _M_data->_M_negative_sign = L"";
1892+ _M_data->_M_negative_sign_size = 0;
1893+ _M_data->_M_frac_digits = 0;
1894+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1895+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1896+
1897+ // Use ctype::widen code without the facet...
1898+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1899+ _M_data->_M_atoms[__i] =
1900+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1901+ }
1902+ else
1903+ {
1904+ // Named locale.
1905+#ifdef __UCLIBC_HAS_XLOCALE__
1906+ __c_locale __old = __uselocale(__cloc);
1907+#else
1908+ // Switch to named locale so that mbsrtowcs will work.
1909+ char* __old = strdup(setlocale(LC_ALL, NULL));
1910+ setlocale(LC_ALL, __name);
1911+#endif
1912+
1913+#ifdef __UCLIBC_MJN3_ONLY__
1914+#warning fix this... should be monetary
1915+#endif
1916+#ifdef __UCLIBC__
1917+# ifdef __UCLIBC_HAS_XLOCALE__
1918+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1919+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1920+# else
1921+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1922+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1923+# endif
1924+#else
1925+ union { char *__s; wchar_t __w; } __u;
1926+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1927+ _M_data->_M_decimal_point = __u.__w;
1928+
1929+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1930+ _M_data->_M_thousands_sep = __u.__w;
1931+#endif
1932+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1933+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1934+
1935+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1936+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1937+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1938+
1939+ wchar_t* __wcs_ps = 0;
1940+ wchar_t* __wcs_ns = 0;
1941+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1942+ try
1943+ {
1944+ mbstate_t __state;
1945+ size_t __len;
1946+ __len = strlen(__cpossign);
1947+ if (__len)
1948+ {
1949+ ++__len;
1950+ memset(&__state, 0, sizeof(mbstate_t));
1951+ __wcs_ps = new wchar_t[__len];
1952+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1953+ _M_data->_M_positive_sign = __wcs_ps;
1954+ }
1955+ else
1956+ _M_data->_M_positive_sign = L"";
1957+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1958+
1959+ __len = strlen(__cnegsign);
1960+ if (!__nposn)
1961+ _M_data->_M_negative_sign = L"()";
1962+ else if (__len)
1963+ {
1964+ ++__len;
1965+ memset(&__state, 0, sizeof(mbstate_t));
1966+ __wcs_ns = new wchar_t[__len];
1967+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1968+ _M_data->_M_negative_sign = __wcs_ns;
1969+ }
1970+ else
1971+ _M_data->_M_negative_sign = L"";
1972+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1973+
1974+ // _Intl == true.
1975+ __len = strlen(__ccurr);
1976+ if (__len)
1977+ {
1978+ ++__len;
1979+ memset(&__state, 0, sizeof(mbstate_t));
1980+ wchar_t* __wcs = new wchar_t[__len];
1981+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1982+ _M_data->_M_curr_symbol = __wcs;
1983+ }
1984+ else
1985+ _M_data->_M_curr_symbol = L"";
1986+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1987+ }
1988+ catch (...)
1989+ {
1990+ delete _M_data;
1991+ _M_data = 0;
1992+ delete __wcs_ps;
1993+ delete __wcs_ns;
1994+#ifdef __UCLIBC_HAS_XLOCALE__
1995+ __uselocale(__old);
1996+#else
1997+ setlocale(LC_ALL, __old);
1998+ free(__old);
1999+#endif
2000+ __throw_exception_again;
2001+ }
2002+
2003+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2004+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2005+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2006+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2007+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2008+ __pposn);
2009+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2010+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2011+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2012+ __nposn);
2013+
2014+#ifdef __UCLIBC_HAS_XLOCALE__
2015+ __uselocale(__old);
2016+#else
2017+ setlocale(LC_ALL, __old);
2018+ free(__old);
2019+#endif
2020+ }
2021+ }
2022+
2023+ template<>
2024+ moneypunct<wchar_t, true>::~moneypunct()
2025+ {
2026+ if (_M_data->_M_positive_sign_size)
2027+ delete [] _M_data->_M_positive_sign;
2028+ if (_M_data->_M_negative_sign_size
2029+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2030+ delete [] _M_data->_M_negative_sign;
2031+ if (_M_data->_M_curr_symbol_size)
2032+ delete [] _M_data->_M_curr_symbol;
2033+ delete _M_data;
2034+ }
2035+
2036+ template<>
2037+ moneypunct<wchar_t, false>::~moneypunct()
2038+ {
2039+ if (_M_data->_M_positive_sign_size)
2040+ delete [] _M_data->_M_positive_sign;
2041+ if (_M_data->_M_negative_sign_size
2042+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2043+ delete [] _M_data->_M_negative_sign;
2044+ if (_M_data->_M_curr_symbol_size)
2045+ delete [] _M_data->_M_curr_symbol;
2046+ delete _M_data;
2047+ }
2048+#endif
2049+}
2050Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2051===================================================================
2052--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2053+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2010-06-25 10:42:34.913881064 -0700
2054@@ -0,0 +1,160 @@
2055+// std::numpunct implementation details, GNU version -*- C++ -*-
2056+
2057+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2058+//
2059+// This file is part of the GNU ISO C++ Library. This library is free
2060+// software; you can redistribute it and/or modify it under the
2061+// terms of the GNU General Public License as published by the
2062+// Free Software Foundation; either version 2, or (at your option)
2063+// any later version.
2064+
2065+// This library is distributed in the hope that it will be useful,
2066+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2067+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2068+// GNU General Public License for more details.
2069+
2070+// You should have received a copy of the GNU General Public License along
2071+// with this library; see the file COPYING. If not, write to the Free
2072+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2073+// USA.
2074+
2075+// As a special exception, you may use this file as part of a free software
2076+// library without restriction. Specifically, if other files instantiate
2077+// templates or use macros or inline functions from this file, or you compile
2078+// this file and link it with other files to produce an executable, this
2079+// file does not by itself cause the resulting executable to be covered by
2080+// the GNU General Public License. This exception does not however
2081+// invalidate any other reasons why the executable file might be covered by
2082+// the GNU General Public License.
2083+
2084+//
2085+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2086+//
2087+
2088+// Written by Benjamin Kosnik <bkoz@redhat.com>
2089+
2090+#define _LIBC
2091+#include <locale>
2092+#undef _LIBC
2093+#include <bits/c++locale_internal.h>
2094+
2095+#ifdef __UCLIBC_MJN3_ONLY__
2096+#warning tailor for stub locale support
2097+#endif
2098+#ifndef __UCLIBC_HAS_XLOCALE__
2099+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2100+#endif
2101+
2102+namespace std
2103+{
2104+ template<>
2105+ void
2106+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2107+ {
2108+ if (!_M_data)
2109+ _M_data = new __numpunct_cache<char>;
2110+
2111+ if (!__cloc)
2112+ {
2113+ // "C" locale
2114+ _M_data->_M_grouping = "";
2115+ _M_data->_M_grouping_size = 0;
2116+ _M_data->_M_use_grouping = false;
2117+
2118+ _M_data->_M_decimal_point = '.';
2119+ _M_data->_M_thousands_sep = ',';
2120+
2121+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2122+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2123+
2124+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2125+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2126+ }
2127+ else
2128+ {
2129+ // Named locale.
2130+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2131+ __cloc));
2132+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2133+ __cloc));
2134+
2135+ // Check for NULL, which implies no grouping.
2136+ if (_M_data->_M_thousands_sep == '\0')
2137+ _M_data->_M_grouping = "";
2138+ else
2139+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2140+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2141+ }
2142+
2143+ // NB: There is no way to extact this info from posix locales.
2144+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2145+ _M_data->_M_truename = "true";
2146+ _M_data->_M_truename_size = 4;
2147+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2148+ _M_data->_M_falsename = "false";
2149+ _M_data->_M_falsename_size = 5;
2150+ }
2151+
2152+ template<>
2153+ numpunct<char>::~numpunct()
2154+ { delete _M_data; }
2155+
2156+#ifdef _GLIBCXX_USE_WCHAR_T
2157+ template<>
2158+ void
2159+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2160+ {
2161+ if (!_M_data)
2162+ _M_data = new __numpunct_cache<wchar_t>;
2163+
2164+ if (!__cloc)
2165+ {
2166+ // "C" locale
2167+ _M_data->_M_grouping = "";
2168+ _M_data->_M_grouping_size = 0;
2169+ _M_data->_M_use_grouping = false;
2170+
2171+ _M_data->_M_decimal_point = L'.';
2172+ _M_data->_M_thousands_sep = L',';
2173+
2174+ // Use ctype::widen code without the facet...
2175+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2176+ _M_data->_M_atoms_out[__i] =
2177+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2178+
2179+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2180+ _M_data->_M_atoms_in[__j] =
2181+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2182+ }
2183+ else
2184+ {
2185+ // Named locale.
2186+ // NB: In the GNU model wchar_t is always 32 bit wide.
2187+ union { char *__s; wchar_t __w; } __u;
2188+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2189+ _M_data->_M_decimal_point = __u.__w;
2190+
2191+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2192+ _M_data->_M_thousands_sep = __u.__w;
2193+
2194+ if (_M_data->_M_thousands_sep == L'\0')
2195+ _M_data->_M_grouping = "";
2196+ else
2197+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2198+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2199+ }
2200+
2201+ // NB: There is no way to extact this info from posix locales.
2202+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2203+ _M_data->_M_truename = L"true";
2204+ _M_data->_M_truename_size = 4;
2205+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2206+ _M_data->_M_falsename = L"false";
2207+ _M_data->_M_falsename_size = 5;
2208+ }
2209+
2210+ template<>
2211+ numpunct<wchar_t>::~numpunct()
2212+ { delete _M_data; }
2213+ #endif
2214+}
2215Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/time_members.cc
2216===================================================================
2217--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2218+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2010-06-25 10:42:34.913881064 -0700
2219@@ -0,0 +1,406 @@
2220+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2221+
2222+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2223+//
2224+// This file is part of the GNU ISO C++ Library. This library is free
2225+// software; you can redistribute it and/or modify it under the
2226+// terms of the GNU General Public License as published by the
2227+// Free Software Foundation; either version 2, or (at your option)
2228+// any later version.
2229+
2230+// This library is distributed in the hope that it will be useful,
2231+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2232+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2233+// GNU General Public License for more details.
2234+
2235+// You should have received a copy of the GNU General Public License along
2236+// with this library; see the file COPYING. If not, write to the Free
2237+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2238+// USA.
2239+
2240+// As a special exception, you may use this file as part of a free software
2241+// library without restriction. Specifically, if other files instantiate
2242+// templates or use macros or inline functions from this file, or you compile
2243+// this file and link it with other files to produce an executable, this
2244+// file does not by itself cause the resulting executable to be covered by
2245+// the GNU General Public License. This exception does not however
2246+// invalidate any other reasons why the executable file might be covered by
2247+// the GNU General Public License.
2248+
2249+//
2250+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2251+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2252+//
2253+
2254+// Written by Benjamin Kosnik <bkoz@redhat.com>
2255+
2256+#include <locale>
2257+#include <bits/c++locale_internal.h>
2258+
2259+#ifdef __UCLIBC_MJN3_ONLY__
2260+#warning tailor for stub locale support
2261+#endif
2262+#ifndef __UCLIBC_HAS_XLOCALE__
2263+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2264+#endif
2265+
2266+namespace std
2267+{
2268+ template<>
2269+ void
2270+ __timepunct<char>::
2271+ _M_put(char* __s, size_t __maxlen, const char* __format,
2272+ const tm* __tm) const
2273+ {
2274+#ifdef __UCLIBC_HAS_XLOCALE__
2275+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2276+ _M_c_locale_timepunct);
2277+#else
2278+ char* __old = strdup(setlocale(LC_ALL, NULL));
2279+ setlocale(LC_ALL, _M_name_timepunct);
2280+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2281+ setlocale(LC_ALL, __old);
2282+ free(__old);
2283+#endif
2284+ // Make sure __s is null terminated.
2285+ if (__len == 0)
2286+ __s[0] = '\0';
2287+ }
2288+
2289+ template<>
2290+ void
2291+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2292+ {
2293+ if (!_M_data)
2294+ _M_data = new __timepunct_cache<char>;
2295+
2296+ if (!__cloc)
2297+ {
2298+ // "C" locale
2299+ _M_c_locale_timepunct = _S_get_c_locale();
2300+
2301+ _M_data->_M_date_format = "%m/%d/%y";
2302+ _M_data->_M_date_era_format = "%m/%d/%y";
2303+ _M_data->_M_time_format = "%H:%M:%S";
2304+ _M_data->_M_time_era_format = "%H:%M:%S";
2305+ _M_data->_M_date_time_format = "";
2306+ _M_data->_M_date_time_era_format = "";
2307+ _M_data->_M_am = "AM";
2308+ _M_data->_M_pm = "PM";
2309+ _M_data->_M_am_pm_format = "";
2310+
2311+ // Day names, starting with "C"'s Sunday.
2312+ _M_data->_M_day1 = "Sunday";
2313+ _M_data->_M_day2 = "Monday";
2314+ _M_data->_M_day3 = "Tuesday";
2315+ _M_data->_M_day4 = "Wednesday";
2316+ _M_data->_M_day5 = "Thursday";
2317+ _M_data->_M_day6 = "Friday";
2318+ _M_data->_M_day7 = "Saturday";
2319+
2320+ // Abbreviated day names, starting with "C"'s Sun.
2321+ _M_data->_M_aday1 = "Sun";
2322+ _M_data->_M_aday2 = "Mon";
2323+ _M_data->_M_aday3 = "Tue";
2324+ _M_data->_M_aday4 = "Wed";
2325+ _M_data->_M_aday5 = "Thu";
2326+ _M_data->_M_aday6 = "Fri";
2327+ _M_data->_M_aday7 = "Sat";
2328+
2329+ // Month names, starting with "C"'s January.
2330+ _M_data->_M_month01 = "January";
2331+ _M_data->_M_month02 = "February";
2332+ _M_data->_M_month03 = "March";
2333+ _M_data->_M_month04 = "April";
2334+ _M_data->_M_month05 = "May";
2335+ _M_data->_M_month06 = "June";
2336+ _M_data->_M_month07 = "July";
2337+ _M_data->_M_month08 = "August";
2338+ _M_data->_M_month09 = "September";
2339+ _M_data->_M_month10 = "October";
2340+ _M_data->_M_month11 = "November";
2341+ _M_data->_M_month12 = "December";
2342+
2343+ // Abbreviated month names, starting with "C"'s Jan.
2344+ _M_data->_M_amonth01 = "Jan";
2345+ _M_data->_M_amonth02 = "Feb";
2346+ _M_data->_M_amonth03 = "Mar";
2347+ _M_data->_M_amonth04 = "Apr";
2348+ _M_data->_M_amonth05 = "May";
2349+ _M_data->_M_amonth06 = "Jun";
2350+ _M_data->_M_amonth07 = "Jul";
2351+ _M_data->_M_amonth08 = "Aug";
2352+ _M_data->_M_amonth09 = "Sep";
2353+ _M_data->_M_amonth10 = "Oct";
2354+ _M_data->_M_amonth11 = "Nov";
2355+ _M_data->_M_amonth12 = "Dec";
2356+ }
2357+ else
2358+ {
2359+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2360+
2361+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2362+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2363+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2364+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2365+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2366+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2367+ __cloc);
2368+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2369+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2370+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2371+
2372+ // Day names, starting with "C"'s Sunday.
2373+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2374+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2375+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2376+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2377+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2378+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2379+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2380+
2381+ // Abbreviated day names, starting with "C"'s Sun.
2382+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2383+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2384+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2385+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2386+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2387+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2388+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2389+
2390+ // Month names, starting with "C"'s January.
2391+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2392+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2393+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2394+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2395+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2396+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2397+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2398+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2399+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2400+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2401+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2402+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2403+
2404+ // Abbreviated month names, starting with "C"'s Jan.
2405+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2406+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2407+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2408+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2409+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2410+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2411+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2412+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2413+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2414+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2415+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2416+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2417+ }
2418+ }
2419+
2420+#ifdef _GLIBCXX_USE_WCHAR_T
2421+ template<>
2422+ void
2423+ __timepunct<wchar_t>::
2424+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2425+ const tm* __tm) const
2426+ {
2427+#ifdef __UCLIBC_HAS_XLOCALE__
2428+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2429+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2430+ _M_c_locale_timepunct);
2431+#else
2432+ char* __old = strdup(setlocale(LC_ALL, NULL));
2433+ setlocale(LC_ALL, _M_name_timepunct);
2434+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2435+ setlocale(LC_ALL, __old);
2436+ free(__old);
2437+#endif
2438+ // Make sure __s is null terminated.
2439+ if (__len == 0)
2440+ __s[0] = L'\0';
2441+ }
2442+
2443+ template<>
2444+ void
2445+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2446+ {
2447+ if (!_M_data)
2448+ _M_data = new __timepunct_cache<wchar_t>;
2449+
2450+#warning wide time stuff
2451+// if (!__cloc)
2452+ {
2453+ // "C" locale
2454+ _M_c_locale_timepunct = _S_get_c_locale();
2455+
2456+ _M_data->_M_date_format = L"%m/%d/%y";
2457+ _M_data->_M_date_era_format = L"%m/%d/%y";
2458+ _M_data->_M_time_format = L"%H:%M:%S";
2459+ _M_data->_M_time_era_format = L"%H:%M:%S";
2460+ _M_data->_M_date_time_format = L"";
2461+ _M_data->_M_date_time_era_format = L"";
2462+ _M_data->_M_am = L"AM";
2463+ _M_data->_M_pm = L"PM";
2464+ _M_data->_M_am_pm_format = L"";
2465+
2466+ // Day names, starting with "C"'s Sunday.
2467+ _M_data->_M_day1 = L"Sunday";
2468+ _M_data->_M_day2 = L"Monday";
2469+ _M_data->_M_day3 = L"Tuesday";
2470+ _M_data->_M_day4 = L"Wednesday";
2471+ _M_data->_M_day5 = L"Thursday";
2472+ _M_data->_M_day6 = L"Friday";
2473+ _M_data->_M_day7 = L"Saturday";
2474+
2475+ // Abbreviated day names, starting with "C"'s Sun.
2476+ _M_data->_M_aday1 = L"Sun";
2477+ _M_data->_M_aday2 = L"Mon";
2478+ _M_data->_M_aday3 = L"Tue";
2479+ _M_data->_M_aday4 = L"Wed";
2480+ _M_data->_M_aday5 = L"Thu";
2481+ _M_data->_M_aday6 = L"Fri";
2482+ _M_data->_M_aday7 = L"Sat";
2483+
2484+ // Month names, starting with "C"'s January.
2485+ _M_data->_M_month01 = L"January";
2486+ _M_data->_M_month02 = L"February";
2487+ _M_data->_M_month03 = L"March";
2488+ _M_data->_M_month04 = L"April";
2489+ _M_data->_M_month05 = L"May";
2490+ _M_data->_M_month06 = L"June";
2491+ _M_data->_M_month07 = L"July";
2492+ _M_data->_M_month08 = L"August";
2493+ _M_data->_M_month09 = L"September";
2494+ _M_data->_M_month10 = L"October";
2495+ _M_data->_M_month11 = L"November";
2496+ _M_data->_M_month12 = L"December";
2497+
2498+ // Abbreviated month names, starting with "C"'s Jan.
2499+ _M_data->_M_amonth01 = L"Jan";
2500+ _M_data->_M_amonth02 = L"Feb";
2501+ _M_data->_M_amonth03 = L"Mar";
2502+ _M_data->_M_amonth04 = L"Apr";
2503+ _M_data->_M_amonth05 = L"May";
2504+ _M_data->_M_amonth06 = L"Jun";
2505+ _M_data->_M_amonth07 = L"Jul";
2506+ _M_data->_M_amonth08 = L"Aug";
2507+ _M_data->_M_amonth09 = L"Sep";
2508+ _M_data->_M_amonth10 = L"Oct";
2509+ _M_data->_M_amonth11 = L"Nov";
2510+ _M_data->_M_amonth12 = L"Dec";
2511+ }
2512+#if 0
2513+ else
2514+ {
2515+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2516+
2517+ union { char *__s; wchar_t *__w; } __u;
2518+
2519+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2520+ _M_data->_M_date_format = __u.__w;
2521+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2522+ _M_data->_M_date_era_format = __u.__w;
2523+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2524+ _M_data->_M_time_format = __u.__w;
2525+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2526+ _M_data->_M_time_era_format = __u.__w;
2527+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2528+ _M_data->_M_date_time_format = __u.__w;
2529+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2530+ _M_data->_M_date_time_era_format = __u.__w;
2531+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2532+ _M_data->_M_am = __u.__w;
2533+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2534+ _M_data->_M_pm = __u.__w;
2535+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2536+ _M_data->_M_am_pm_format = __u.__w;
2537+
2538+ // Day names, starting with "C"'s Sunday.
2539+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2540+ _M_data->_M_day1 = __u.__w;
2541+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2542+ _M_data->_M_day2 = __u.__w;
2543+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2544+ _M_data->_M_day3 = __u.__w;
2545+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2546+ _M_data->_M_day4 = __u.__w;
2547+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2548+ _M_data->_M_day5 = __u.__w;
2549+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2550+ _M_data->_M_day6 = __u.__w;
2551+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2552+ _M_data->_M_day7 = __u.__w;
2553+
2554+ // Abbreviated day names, starting with "C"'s Sun.
2555+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2556+ _M_data->_M_aday1 = __u.__w;
2557+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2558+ _M_data->_M_aday2 = __u.__w;
2559+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2560+ _M_data->_M_aday3 = __u.__w;
2561+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2562+ _M_data->_M_aday4 = __u.__w;
2563+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2564+ _M_data->_M_aday5 = __u.__w;
2565+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2566+ _M_data->_M_aday6 = __u.__w;
2567+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2568+ _M_data->_M_aday7 = __u.__w;
2569+
2570+ // Month names, starting with "C"'s January.
2571+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2572+ _M_data->_M_month01 = __u.__w;
2573+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2574+ _M_data->_M_month02 = __u.__w;
2575+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2576+ _M_data->_M_month03 = __u.__w;
2577+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2578+ _M_data->_M_month04 = __u.__w;
2579+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2580+ _M_data->_M_month05 = __u.__w;
2581+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2582+ _M_data->_M_month06 = __u.__w;
2583+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2584+ _M_data->_M_month07 = __u.__w;
2585+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2586+ _M_data->_M_month08 = __u.__w;
2587+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2588+ _M_data->_M_month09 = __u.__w;
2589+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2590+ _M_data->_M_month10 = __u.__w;
2591+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2592+ _M_data->_M_month11 = __u.__w;
2593+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2594+ _M_data->_M_month12 = __u.__w;
2595+
2596+ // Abbreviated month names, starting with "C"'s Jan.
2597+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2598+ _M_data->_M_amonth01 = __u.__w;
2599+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2600+ _M_data->_M_amonth02 = __u.__w;
2601+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2602+ _M_data->_M_amonth03 = __u.__w;
2603+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2604+ _M_data->_M_amonth04 = __u.__w;
2605+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2606+ _M_data->_M_amonth05 = __u.__w;
2607+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2608+ _M_data->_M_amonth06 = __u.__w;
2609+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2610+ _M_data->_M_amonth07 = __u.__w;
2611+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2612+ _M_data->_M_amonth08 = __u.__w;
2613+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2614+ _M_data->_M_amonth09 = __u.__w;
2615+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2616+ _M_data->_M_amonth10 = __u.__w;
2617+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2618+ _M_data->_M_amonth11 = __u.__w;
2619+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2620+ _M_data->_M_amonth12 = __u.__w;
2621+ }
2622+#endif // 0
2623+ }
2624+#endif
2625+}
2626Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/time_members.h
2627===================================================================
2628--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2629+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/time_members.h 2010-06-25 10:42:34.913881064 -0700
2630@@ -0,0 +1,68 @@
2631+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2632+
2633+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2634+//
2635+// This file is part of the GNU ISO C++ Library. This library is free
2636+// software; you can redistribute it and/or modify it under the
2637+// terms of the GNU General Public License as published by the
2638+// Free Software Foundation; either version 2, or (at your option)
2639+// any later version.
2640+
2641+// This library is distributed in the hope that it will be useful,
2642+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2643+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2644+// GNU General Public License for more details.
2645+
2646+// You should have received a copy of the GNU General Public License along
2647+// with this library; see the file COPYING. If not, write to the Free
2648+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2649+// USA.
2650+
2651+// As a special exception, you may use this file as part of a free software
2652+// library without restriction. Specifically, if other files instantiate
2653+// templates or use macros or inline functions from this file, or you compile
2654+// this file and link it with other files to produce an executable, this
2655+// file does not by itself cause the resulting executable to be covered by
2656+// the GNU General Public License. This exception does not however
2657+// invalidate any other reasons why the executable file might be covered by
2658+// the GNU General Public License.
2659+
2660+//
2661+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2662+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2663+//
2664+
2665+// Written by Benjamin Kosnik <bkoz@redhat.com>
2666+
2667+ template<typename _CharT>
2668+ __timepunct<_CharT>::__timepunct(size_t __refs)
2669+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2670+ _M_name_timepunct(_S_get_c_name())
2671+ { _M_initialize_timepunct(); }
2672+
2673+ template<typename _CharT>
2674+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2675+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2676+ _M_name_timepunct(_S_get_c_name())
2677+ { _M_initialize_timepunct(); }
2678+
2679+ template<typename _CharT>
2680+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2681+ size_t __refs)
2682+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2683+ _M_name_timepunct(__s)
2684+ {
2685+ char* __tmp = new char[std::strlen(__s) + 1];
2686+ std::strcpy(__tmp, __s);
2687+ _M_name_timepunct = __tmp;
2688+ _M_initialize_timepunct(__cloc);
2689+ }
2690+
2691+ template<typename _CharT>
2692+ __timepunct<_CharT>::~__timepunct()
2693+ {
2694+ if (_M_name_timepunct != _S_get_c_name())
2695+ delete [] _M_name_timepunct;
2696+ delete _M_data;
2697+ _S_destroy_c_locale(_M_c_locale_timepunct);
2698+ }
2699Index: gcc-4.5.0/libstdc++-v3/configure
2700===================================================================
2701--- gcc-4.5.0.orig/libstdc++-v3/configure 2010-04-05 18:27:44.000000000 -0700
2702+++ gcc-4.5.0/libstdc++-v3/configure 2010-06-25 10:48:10.124633072 -0700
2703@@ -15577,7 +15577,7 @@
2704 if test "${enable_clocale+set}" = set; then :
2705 enableval=$enable_clocale;
2706 case "$enableval" in
2707- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
2708+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
2709 *) as_fn_error "Unknown argument to enable/disable clocale" "$LINENO" 5 ;;
2710 esac
2711
2712@@ -15609,6 +15609,9 @@
2713 # Default to "generic".
2714 if test $enable_clocale_flag = auto; then
2715 case ${target_os} in
2716+ *-uclibc*)
2717+ enable_clocale_flag=uclibc
2718+ ;;
2719 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2720 enable_clocale_flag=gnu
2721 ;;
2722@@ -15885,6 +15888,76 @@
2723 CTIME_CC=config/locale/generic/time_members.cc
2724 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2725 ;;
2726+ uclibc)
2727+ echo "$as_me:$LINENO: result: uclibc" >&5
2728+echo "${ECHO_T}uclibc" >&6
2729+
2730+ # Declare intention to use gettext, and add support for specific
2731+ # languages.
2732+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2733+ ALL_LINGUAS="de fr"
2734+
2735+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2736+ # Extract the first word of "msgfmt", so it can be a program name with args.
2737+set dummy msgfmt; ac_word=$2
2738+echo "$as_me:$LINENO: checking for $ac_word" >&5
2739+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2740+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
2741+ echo $ECHO_N "(cached) $ECHO_C" >&6
2742+else
2743+ if test -n "$check_msgfmt"; then
2744+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2745+else
2746+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2747+for as_dir in $PATH
2748+do
2749+ IFS=$as_save_IFS
2750+ test -z "$as_dir" && as_dir=.
2751+ for ac_exec_ext in '' $ac_executable_extensions; do
2752+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2753+ ac_cv_prog_check_msgfmt="yes"
2754+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2755+ break 2
2756+ fi
2757+done
2758+done
2759+
2760+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2761+fi
2762+fi
2763+check_msgfmt=$ac_cv_prog_check_msgfmt
2764+if test -n "$check_msgfmt"; then
2765+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
2766+echo "${ECHO_T}$check_msgfmt" >&6
2767+else
2768+ echo "$as_me:$LINENO: result: no" >&5
2769+echo "${ECHO_T}no" >&6
2770+fi
2771+
2772+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2773+ USE_NLS=yes
2774+ fi
2775+ # Export the build objects.
2776+ for ling in $ALL_LINGUAS; do \
2777+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2778+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2779+ done
2780+
2781+
2782+
2783+ CLOCALE_H=config/locale/uclibc/c_locale.h
2784+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2785+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2786+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2787+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2788+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2789+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2790+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2791+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2792+ CTIME_H=config/locale/uclibc/time_members.h
2793+ CTIME_CC=config/locale/uclibc/time_members.cc
2794+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2795+ ;;
2796 esac
2797
2798 # This is where the testsuite looks for locale catalogs, using the
2799@@ -16940,6 +17013,7 @@
2800
2801 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2802 /* end confdefs.h. */
2803+#line 17016 "configure"
2804 #include <wctype.h>
2805 int
2806 main ()
2807@@ -58165,7 +58239,6 @@
2808 fi
2809 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2810 /* end confdefs.h. */
2811-
2812 int
2813 main ()
2814 {
2815Index: gcc-4.5.0/libstdc++-v3/include/c_compatibility/wchar.h
2816===================================================================
2817--- gcc-4.5.0.orig/libstdc++-v3/include/c_compatibility/wchar.h 2009-04-09 08:00:19.000000000 -0700
2818+++ gcc-4.5.0/libstdc++-v3/include/c_compatibility/wchar.h 2010-06-25 10:42:34.949880937 -0700
2819@@ -101,7 +101,9 @@
2820 using std::wmemcpy;
2821 using std::wmemmove;
2822 using std::wmemset;
2823+#if _GLIBCXX_HAVE_WCSFTIME
2824 using std::wcsftime;
2825+#endif
2826
2827 #if _GLIBCXX_USE_C99
2828 using std::wcstold;
2829Index: gcc-4.5.0/libstdc++-v3/include/c_std/cwchar
2830===================================================================
2831--- gcc-4.5.0.orig/libstdc++-v3/include/c_std/cwchar 2010-02-04 10:20:34.000000000 -0800
2832+++ gcc-4.5.0/libstdc++-v3/include/c_std/cwchar 2010-06-25 10:42:34.949880937 -0700
2833@@ -177,7 +177,9 @@
2834 using ::wcscoll;
2835 using ::wcscpy;
2836 using ::wcscspn;
2837+#if _GLIBCXX_HAVE_WCSFTIME
2838 using ::wcsftime;
2839+#endif
2840 using ::wcslen;
2841 using ::wcsncat;
2842 using ::wcsncmp;
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/203-uclibc-locale-no__x.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/203-uclibc-locale-no__x.patch
deleted file mode 100644
index c81e782183..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/203-uclibc-locale-no__x.patch
+++ /dev/null
@@ -1,235 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
4===================================================================
5--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-08-16 01:29:20.000000000 -0700
6+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-08-16 01:33:23.000000000 -0700
7@@ -60,4 +60,49 @@
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.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
58===================================================================
59--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-08-16 01:29:20.000000000 -0700
60+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-08-16 01:33:00.000000000 -0700
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.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
83===================================================================
84--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-08-16 01:29:20.000000000 -0700
85+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-08-16 01:30:31.000000000 -0700
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.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
101===================================================================
102--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-08-16 01:29:20.000000000 -0700
103+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-08-16 01:30:31.000000000 -0700
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.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
116===================================================================
117--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-08-16 01:29:20.000000000 -0700
118+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-08-16 01:30:31.000000000 -0700
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.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc
130===================================================================
131--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-08-16 01:29:20.000000000 -0700
132+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-08-16 01:30:31.000000000 -0700
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.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
144===================================================================
145--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-08-16 01:29:20.000000000 -0700
146+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-08-16 01:30:31.000000000 -0700
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.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
162===================================================================
163--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-08-16 01:27:18.000000000 -0700
164+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-08-16 01:30:31.000000000 -0700
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.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h
182===================================================================
183--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-08-16 01:29:20.000000000 -0700
184+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-08-16 01:31:43.000000000 -0700
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 @@
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 @@
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.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h
225===================================================================
226--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-08-16 01:29:20.000000000 -0700
227+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-08-16 01:30:31.000000000 -0700
228@@ -68,6 +68,7 @@
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.5.1/204-uclibc-locale-wchar_fix.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/204-uclibc-locale-wchar_fix.patch
deleted file mode 100644
index d498f8917b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/204-uclibc-locale-wchar_fix.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1Upstream-Status: Pending
2
3--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
4+++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:37:27 +0100
5@@ -401,7 +401,7 @@
6 # ifdef __UCLIBC_HAS_XLOCALE__
7 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
8 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
9-# else
10+# elif defined __UCLIBC_HAS_LOCALE__
11 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
12 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
13 # endif
14@@ -556,7 +556,7 @@
15 # ifdef __UCLIBC_HAS_XLOCALE__
16 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
17 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
18-# else
19+# elif defined __UCLIBC_HAS_LOCALE__
20 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
21 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
22 # endif
23--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
24+++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:37:27 +0100
25@@ -127,12 +127,25 @@
26 {
27 // Named locale.
28 // NB: In the GNU model wchar_t is always 32 bit wide.
29+#ifdef __UCLIBC_MJN3_ONLY__
30+#warning fix this... should be numeric
31+#endif
32+#ifdef __UCLIBC__
33+# ifdef __UCLIBC_HAS_XLOCALE__
34+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
35+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
36+# elif defined __UCLIBC_HAS_LOCALE__
37+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
38+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
39+# endif
40+#else
41 union { char *__s; wchar_t __w; } __u;
42 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
43 _M_data->_M_decimal_point = __u.__w;
44
45 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
46 _M_data->_M_thousands_sep = __u.__w;
47+#endif
48
49 if (_M_data->_M_thousands_sep == L'\0')
50 _M_data->_M_grouping = "";
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/205-uclibc-locale-update.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/205-uclibc-locale-update.patch
deleted file mode 100644
index f8446956a3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/205-uclibc-locale-update.patch
+++ /dev/null
@@ -1,521 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc
4===================================================================
5--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-09-17 22:35:28.000000000 -0700
6+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-09-17 22:35:29.000000000 -0700
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 @@
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 @@
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 @@
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 @@
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.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc
128===================================================================
129--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-09-17 22:35:28.000000000 -0700
130+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-09-17 23:09:49.000000000 -0700
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 @@
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 @@
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 @@
209 #endif
210 }
211 #endif // _GLIBCXX_USE_WCHAR_T
212-}
213+
214+_GLIBCXX_END_NAMESPACE
215Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h
216===================================================================
217--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-09-17 22:35:28.000000000 -0700
218+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-09-17 23:13:34.000000000 -0700
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.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc
241===================================================================
242--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-09-17 22:35:28.000000000 -0700
243+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-09-17 22:35:29.000000000 -0700
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 @@
260 }
261 break;
262 default:
263- ;
264+ __ret = pattern();
265 }
266 return __ret;
267 }
268@@ -390,7 +395,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc
338===================================================================
339--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-09-17 22:35:28.000000000 -0700
340+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-09-17 22:35:29.000000000 -0700
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.3.2/libstdc++-v3/config/locale/uclibc/time_members.h
357===================================================================
358--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-09-17 22:35:27.000000000 -0700
359+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/time_members.h 2008-09-17 23:13:34.000000000 -0700
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.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h
387===================================================================
388--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-09-17 22:35:28.000000000 -0700
389+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-09-17 22:35:29.000000000 -0700
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 @@
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 @@
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.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc
469===================================================================
470--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-09-17 22:35:28.000000000 -0700
471+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-09-17 22:35:29.000000000 -0700
472@@ -53,11 +53,14 @@
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 @@
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.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
509===================================================================
510--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-09-17 22:35:28.000000000 -0700
511+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-09-17 22:35:29.000000000 -0700
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.5.1/301-missing-execinfo_h.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/301-missing-execinfo_h.patch
deleted file mode 100644
index 812d3ddbc9..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/301-missing-execinfo_h.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5.0/boehm-gc/include/gc.h
4===================================================================
5--- gcc-4.5.0.orig/boehm-gc/include/gc.h 2007-04-23 14:10:09.000000000 -0700
6+++ gcc-4.5.0/boehm-gc/include/gc.h 2010-06-25 10:49:12.768883509 -0700
7@@ -503,7 +503,7 @@
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.5.1/302-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/302-c99-snprintf.patch
deleted file mode 100644
index ec8c43e32c..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/302-c99-snprintf.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5.0/libstdc++-v3/include/c_std/cstdio
4===================================================================
5--- gcc-4.5.0.orig/libstdc++-v3/include/c_std/cstdio 2010-02-04 10:20:34.000000000 -0800
6+++ gcc-4.5.0/libstdc++-v3/include/c_std/cstdio 2010-06-25 10:51:12.712631679 -0700
7@@ -139,7 +139,7 @@
8
9 _GLIBCXX_END_NAMESPACE
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.5.1/303-c99-complex-ugly-hack.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/303-c99-complex-ugly-hack.patch
deleted file mode 100644
index abd032b74e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/303-c99-complex-ugly-hack.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: gcc-4.5.0/libstdc++-v3/configure
4===================================================================
5--- gcc-4.5.0.orig/libstdc++-v3/configure 2010-06-25 10:48:37.488384191 -0700
6+++ gcc-4.5.0/libstdc++-v3/configure 2010-06-25 10:51:23.804380413 -0700
7@@ -18262,6 +18262,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.5.1/304-index_macro.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/304-index_macro.patch
deleted file mode 100644
index 25f4e9333e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/304-index_macro.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5.0/libstdc++-v3/include/ext/rope
4===================================================================
5--- gcc-4.5.0.orig/libstdc++-v3/include/ext/rope 2009-04-09 08:00:19.000000000 -0700
6+++ gcc-4.5.0/libstdc++-v3/include/ext/rope 2010-06-25 10:51:33.613383077 -0700
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.5.0/libstdc++-v3/include/ext/ropeimpl.h
18===================================================================
19--- gcc-4.5.0.orig/libstdc++-v3/include/ext/ropeimpl.h 2009-04-09 08:00:19.000000000 -0700
20+++ gcc-4.5.0/libstdc++-v3/include/ext/ropeimpl.h 2010-06-25 10:51:33.621381669 -0700
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 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
29
30 using std::size_t;
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/305-libmudflap-susv3-legacy.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/305-libmudflap-susv3-legacy.patch
deleted file mode 100644
index d148877927..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/305-libmudflap-susv3-legacy.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: gcc-4.5.0/libmudflap/mf-hooks2.c
4===================================================================
5--- gcc-4.5.0.orig/libmudflap/mf-hooks2.c 2009-04-09 08:00:19.000000000 -0700
6+++ gcc-4.5.0/libmudflap/mf-hooks2.c 2010-06-25 10:52:13.937636901 -0700
7@@ -421,7 +421,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@@ -431,7 +431,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@@ -441,7 +441,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@@ -450,7 +450,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@@ -459,7 +459,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.5.1/306-libstdc++-namespace.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/306-libstdc++-namespace.patch
deleted file mode 100644
index 3cc61c3d17..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/306-libstdc++-namespace.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.h
4===================================================================
5--- gcc-4.5.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2010-06-25 10:49:07.024632961 -0700
6+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2010-06-25 10:52:33.980632645 -0700
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.5.0/libstdc++-v3/config/locale/uclibc/time_members.h
23===================================================================
24--- gcc-4.5.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2010-06-25 10:49:07.024632961 -0700
25+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/time_members.h 2010-06-25 10:52:33.980632645 -0700
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.5.1/64bithack.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/64bithack.patch
deleted file mode 100644
index 05eafe3551..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/64bithack.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3By default gcc places 64 bit libs in a lib64 directory. This makes it use
4"lib" instead.
5
6RP 25/7/10
7
8Index: gcc-4.5.0/gcc/config/i386/t-linux64
9===================================================================
10--- gcc-4.5.0.orig/gcc/config/i386/t-linux64 2010-08-10 15:47:42.000000000 +0100
11+++ gcc-4.5.0/gcc/config/i386/t-linux64 2010-08-10 15:47:47.000000000 +0100
12@@ -24,8 +24,8 @@
13 # MULTILIB_OSDIRNAMES according to what is found on the target.
14
15 MULTILIB_OPTIONS = m64/m32
16-MULTILIB_DIRNAMES = 64 32
17-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
18+MULTILIB_DIRNAMES = . 32
19+MULTILIB_OSDIRNAMES = . $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
20
21 LIBGCC = stmp-multilib
22 INSTALL_LIBGCC = install-multilib
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/740-sh-pr24836.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/740-sh-pr24836.patch
deleted file mode 100644
index ace3631016..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/740-sh-pr24836.patch
+++ /dev/null
@@ -1,31 +0,0 @@
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.5.0/gcc/configure.ac
7===================================================================
8--- gcc-4.5.0.orig/gcc/configure.ac 2010-03-25 22:40:32.000000000 -0700
9+++ gcc-4.5.0/gcc/configure.ac 2010-06-25 11:02:48.489057877 -0700
10@@ -2784,7 +2784,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.5.0/gcc/configure
20===================================================================
21--- gcc-4.5.0.orig/gcc/configure 2010-03-25 22:40:32.000000000 -0700
22+++ gcc-4.5.0/gcc/configure 2010-06-25 11:02:48.508381845 -0700
23@@ -22156,7 +22156,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.5.1/800-arm-bigendian.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/800-arm-bigendian.patch
deleted file mode 100644
index f2474ded67..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/800-arm-bigendian.patch
+++ /dev/null
@@ -1,36 +0,0 @@
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.5.0/gcc/config/arm/linux-elf.h
9===================================================================
10--- gcc-4.5.0.orig/gcc/config/arm/linux-elf.h 2009-11-05 06:47:45.000000000 -0800
11+++ gcc-4.5.0/gcc/config/arm/linux-elf.h 2010-06-25 11:03:06.997132728 -0700
12@@ -51,7 +51,7 @@
13
14 #undef MULTILIB_DEFAULTS
15 #define MULTILIB_DEFAULTS \
16- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
17+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
18
19 /* Now we define the strings used to build the spec file. */
20 #undef LIB_SPEC
21Index: gcc-4.5.0/gcc/config.gcc
22===================================================================
23--- gcc-4.5.0.orig/gcc/config.gcc 2010-06-25 10:40:33.321880880 -0700
24+++ gcc-4.5.0/gcc/config.gcc 2010-06-25 11:03:07.013133525 -0700
25@@ -734,6 +734,11 @@
26 esac
27 tmake_file="${tmake_file} t-linux 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 t-slibgcc-libgcc"
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/904-flatten-switch-stmt-00.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/904-flatten-switch-stmt-00.patch
deleted file mode 100644
index 62ec949320..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/904-flatten-switch-stmt-00.patch
+++ /dev/null
@@ -1,76 +0,0 @@
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.5.0/gcc/stmt.c
53===================================================================
54--- gcc-4.5.0.orig/gcc/stmt.c 2010-02-19 01:53:51.000000000 -0800
55+++ gcc-4.5.0/gcc/stmt.c 2010-06-25 11:05:31.816881094 -0700
56@@ -2440,7 +2440,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@@ -3008,6 +3012,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.5.1/COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch
deleted file mode 100644
index e8264e2845..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1Upstream-Status: Pending
2
3#This patck added --sysroot into COLLECT_GCC_OPTIONS which is used to
4#invoke collect2.
5
6diff -ruN gcc-4.5.1.orig/gcc/gcc.c gcc-4.5.1/gcc/gcc.c
7--- gcc-4.5.1.orig/gcc/gcc.c 2011-03-09 16:43:39.127752586 +0800
8+++ gcc-4.5.1/gcc/gcc.c 2011-03-09 16:47:15.894929459 +0800
9@@ -4667,6 +4667,15 @@
10 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
11
12 first_time = TRUE;
13+#ifdef HAVE_LD_SYSROOT
14+ if (target_system_root_changed && target_system_root)
15+ {
16+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
17+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
18+ obstack_grow (&collect_obstack, "'", 1);
19+ first_time = FALSE;
20+ }
21+#endif
22 for (i = 0; (int) i < n_switches; i++)
23 {
24 const char *const *args;
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch
deleted file mode 100644
index 98b84ba602..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1Upstream-Status: Pending
2
3# by default c++ include directories are not relative to "--sysroot"
4# which brings one trouble when using the toolchain in an environment
5# where the build directory generating that toolchain doesn't exist,
6# e.g. in sstate, machine specific sysroot and relocatable SDK
7# toolchain. This patch now enables c++ include paths under sysroot.
8# This way it's enough as long as "--sysroot" is correctly enabled
9# in the new environment.
10#
11# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-12-30
12
13diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
14index 5024f48..9b47d1c 100644
15--- a/gcc/cppdefault.c
16+++ b/gcc/cppdefault.c
17@@ -48,15 +48,15 @@ const struct default_include cpp_include_defaults[]
18 = {
19 #ifdef GPLUSPLUS_INCLUDE_DIR
20 /* Pick up GNU C++ generic include files. */
21- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 },
22+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 1, 0 },
23 #endif
24 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
25 /* Pick up GNU C++ target-dependent include files. */
26- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 1 },
27+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 1, 1 },
28 #endif
29 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
30 /* Pick up GNU C++ backward and deprecated include files. */
31- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 0 },
32+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 1, 0 },
33 #endif
34 #ifdef LOCAL_INCLUDE_DIR
35 /* /usr/local/include comes before the fixincluded header files. */
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/arm-bswapsi2.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/arm-bswapsi2.patch
deleted file mode 100644
index a7a6684718..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/arm-bswapsi2.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5/gcc/config/arm/arm.md
4===================================================================
5--- gcc-4.5.orig/gcc/config/arm/arm.md 2010-06-17 09:13:07.000000000 -0700
6+++ gcc-4.5/gcc/config/arm/arm.md 2010-06-22 08:08:45.397212002 -0700
7@@ -11267,7 +11267,7 @@
8 (define_expand "bswapsi2"
9 [(set (match_operand:SI 0 "s_register_operand" "=r")
10 (bswap:SI (match_operand:SI 1 "s_register_operand" "r")))]
11-"TARGET_EITHER"
12+"TARGET_EITHER && (arm_arch6 || !optimize_size)"
13 "
14 if (!arm_arch6)
15 {
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/arm-nolibfloat.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/arm-nolibfloat.patch
deleted file mode 100644
index 871f9cf717..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/arm-nolibfloat.patch
+++ /dev/null
@@ -1,26 +0,0 @@
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: gcc-4.5.0/gcc/config/arm/linux-elf.h
15===================================================================
16--- gcc-4.5.0.orig/gcc/config/arm/linux-elf.h 2010-06-25 11:04:49.572437901 -0700
17+++ gcc-4.5.0/gcc/config/arm/linux-elf.h 2010-06-25 11:06:12.273162283 -0700
18@@ -60,7 +60,7 @@
19 %{shared:-lc} \
20 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
21
22-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
23+#define LIBGCC_SPEC "-lgcc"
24
25 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
26
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/arm-softfloat.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/arm-softfloat.patch
deleted file mode 100644
index a0b1a3c9d6..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/arm-softfloat.patch
+++ /dev/null
@@ -1,18 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5.0/gcc/config/arm/t-linux
4===================================================================
5--- gcc-4.5.0.orig/gcc/config/arm/t-linux 2009-04-21 12:03:23.000000000 -0700
6+++ gcc-4.5.0/gcc/config/arm/t-linux 2010-06-25 11:11:06.836381365 -0700
7@@ -23,7 +23,10 @@
8
9 LIB1ASMSRC = arm/lib1funcs.asm
10 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
11- _arm_addsubdf3 _arm_addsubsf3
12+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
13+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
14+ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf
15+# _arm_addsubdf3 _arm_addsubsf3
16
17 # MULTILIB_OPTIONS = mhard-float/msoft-float
18 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/cache-amnesia.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/cache-amnesia.patch
deleted file mode 100644
index 4a4bc7d153..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/cache-amnesia.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3---
4 gcc/configure | 2 +-
5 gcc/configure.ac | 2 +-
6 2 files changed, 2 insertions(+), 2 deletions(-)
7
8Index: gcc-4.5+svnr155514/gcc/configure
9===================================================================
10--- gcc-4.5+svnr155514.orig/gcc/configure 2009-12-29 22:00:40.000000000 -0800
11+++ gcc-4.5+svnr155514/gcc/configure 2009-12-29 23:52:43.381592113 -0800
12@@ -10467,7 +10467,7 @@ else
13 saved_CFLAGS="${CFLAGS}"
14 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
15 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
16- ${realsrcdir}/configure \
17+ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
18 --enable-languages=${enable_languages-all} \
19 --target=$target_alias --host=$build_alias --build=$build_alias
20 CFLAGS="${saved_CFLAGS}"
21Index: gcc-4.5+svnr155514/gcc/configure.ac
22===================================================================
23--- gcc-4.5+svnr155514.orig/gcc/configure.ac 2009-12-29 22:00:40.000000000 -0800
24+++ gcc-4.5+svnr155514/gcc/configure.ac 2009-12-29 23:51:54.589091778 -0800
25@@ -1458,7 +1458,7 @@ else
26 saved_CFLAGS="${CFLAGS}"
27 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
28 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
29- ${realsrcdir}/configure \
30+ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
31 --enable-languages=${enable_languages-all} \
32 --target=$target_alias --host=$build_alias --build=$build_alias
33 CFLAGS="${saved_CFLAGS}"
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/disable_relax_pic_calls_flag.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/disable_relax_pic_calls_flag.patch
deleted file mode 100644
index 1b1a95b83c..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/disable_relax_pic_calls_flag.patch
+++ /dev/null
@@ -1,46 +0,0 @@
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
13diff -ruN gcc-4.5.0-orig/gcc/configure gcc-4.5.0/gcc/configure
14--- gcc-4.5.0-orig/gcc/configure 2010-09-17 23:30:21.000000000 +0800
15+++ gcc-4.5.0/gcc/configure 2010-09-19 18:21:28.000000000 +0800
16@@ -23945,13 +23945,6 @@
17 rm -f conftest.*
18 fi
19 fi
20- if test $gcc_cv_as_ld_jalr_reloc = yes; then
21- if test x$target_cpu_default = x; then
22- target_cpu_default=MASK_RELAX_PIC_CALLS
23- else
24- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
25- fi
26- fi
27 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
28 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
29
30diff -ruN gcc-4.5.0-orig/gcc/configure.ac gcc-4.5.0/gcc/configure.ac
31--- gcc-4.5.0-orig/gcc/configure.ac 2010-09-17 23:30:21.000000000 +0800
32+++ gcc-4.5.0/gcc/configure.ac 2010-09-19 18:21:11.000000000 +0800
33@@ -3467,13 +3467,6 @@
34 rm -f conftest.*
35 fi
36 fi
37- if test $gcc_cv_as_ld_jalr_reloc = yes; then
38- if test x$target_cpu_default = x; then
39- target_cpu_default=MASK_RELAX_PIC_CALLS
40- else
41- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
42- fi
43- fi
44 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
45
46 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch
deleted file mode 100644
index a2dcedeab3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch
+++ /dev/null
@@ -1,115 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22007-10-02 Jakub Jelinek <jakub@redhat.com>
3
4 * decl.c (duplicate_decls): When redeclaring a builtin function,
5 keep the merged decl builtin whenever types match, even if new
6 decl defines a function.
7
8 * gcc.dg/builtins-65.c: New test.
9 * g++.dg/ext/builtin10.C: New test.
10
11Index: gcc/cp/decl.c
12===================================================================
13--- gcc/cp/decl.c.orig 2010-04-01 11:48:46.000000000 -0700
14+++ gcc/cp/decl.c 2010-06-25 10:10:54.749131719 -0700
15@@ -2021,23 +2021,21 @@
16 DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
17 DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
18 }
19+ /* If redeclaring a builtin function, it stays built in. */
20+ if (types_match && DECL_BUILT_IN (olddecl))
21+ {
22+ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
23+ DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
24+ /* If we're keeping the built-in definition, keep the rtl,
25+ regardless of declaration matches. */
26+ COPY_DECL_RTL (olddecl, newdecl);
27+ }
28 if (new_defines_function)
29 /* If defining a function declared with other language
30 linkage, use the previously declared language linkage. */
31 SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
32 else if (types_match)
33 {
34- /* If redeclaring a builtin function, and not a definition,
35- it stays built in. */
36- if (DECL_BUILT_IN (olddecl))
37- {
38- DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
39- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
40- /* If we're keeping the built-in definition, keep the rtl,
41- regardless of declaration matches. */
42- COPY_DECL_RTL (olddecl, newdecl);
43- }
44-
45 DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
46 /* Don't clear out the arguments if we're just redeclaring a
47 function. */
48Index: gcc/testsuite/gcc.dg/builtins-65.c
49===================================================================
50--- gcc/testsuite/gcc.dg/builtins-65.c.orig 2009-06-26 02:02:04.000000000 -0700
51+++ gcc/testsuite/gcc.dg/builtins-65.c 2010-06-25 10:10:54.784464429 -0700
52@@ -1,3 +1,28 @@
53+/* { dg-do compile } */
54+/* { dg-options "-O2" } */
55+
56+typedef __SIZE_TYPE__ size_t;
57+extern void __chk_fail (void);
58+extern int snprintf (char *, size_t, const char *, ...);
59+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
60+{
61+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
62+ __chk_fail ();
63+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
64+}
65+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
66+
67+char buf[10];
68+
69+int
70+main (void)
71+{
72+ snprintf (buf, 10, "%d%d\n", 10, 10);
73+ return 0;
74+}
75+
76+/* { dg-final { scan-assembler "mysnprintf" } } */
77+/* { dg-final { scan-assembler-not "__chk_fail" } } */
78 /* { dg-do link } */
79 /* { dg-options "-O2 -ffast-math" } */
80 /* { dg-require-effective-target c99_runtime } */
81Index: gcc/testsuite/g++.dg/ext/builtin10.C
82===================================================================
83--- gcc/testsuite/g++.dg/ext/builtin10.C.orig 2009-02-02 03:27:50.000000000 -0800
84+++ gcc/testsuite/g++.dg/ext/builtin10.C 2010-06-25 10:10:54.816467202 -0700
85@@ -1,3 +1,30 @@
86+// { dg-do compile }
87+// { dg-options "-O2" }
88+
89+typedef __SIZE_TYPE__ size_t;
90+extern "C" {
91+extern void __chk_fail (void);
92+extern int snprintf (char *, size_t, const char *, ...);
93+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
94+{
95+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
96+ __chk_fail ();
97+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
98+}
99+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
100+}
101+
102+char buf[10];
103+
104+int
105+main (void)
106+{
107+ snprintf (buf, 10, "%d%d\n", 10, 10);
108+ return 0;
109+}
110+
111+// { dg-final { scan-assembler "mysnprintf" } }
112+// { dg-final { scan-assembler-not "__chk_fail" } }
113 // { dg-do compile { target correct_iso_cpp_string_wchar_protos } }
114 // { dg-options "-O2 -fdump-tree-optimized" }
115
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-cpp-pragma.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-cpp-pragma.patch
deleted file mode 100644
index 6dab5bf916..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-cpp-pragma.patch
+++ /dev/null
@@ -1,285 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22008-02-26 Jakub Jelinek <jakub@redhat.com>
3
4 * c-ppoutput.c (scan_translation_unit): Handle CPP_PRAGMA
5 and CPP_PRAGMA_EOL.
6 * c-pragma.c (pragma_ns_name): New typedef.
7 (registered_pp_pragmas): New variable.
8 (c_pp_lookup_pragma): New function.
9 (c_register_pragma_1): If flag_preprocess_only, do nothing
10 for non-expanded pragmas, for expanded ones push pragma's
11 namespace and name into registered_pp_pragmas vector.
12 (c_invoke_pragma_handler): Register OpenMP pragmas even when
13 flag_preprocess_only, don't register GCC pch_preprocess
14 pragma if flag_preprocess_only.
15 * c-opts.c (c_common_init): Call init_pragma even if
16 flag_preprocess_only.
17 * c-pragma.c (c_pp_lookup_pragma): New prototype.
18 * config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS): Don't call
19 cpp_register_pragma if flag_preprocess_only.
20
21 * gcc.dg/gomp/preprocess-1.c: New test.
22
23--- gcc/c-ppoutput.c.jj 2008-01-26 18:01:16.000000000 +0100
24+++ gcc/c-ppoutput.c 2008-02-26 22:54:57.000000000 +0100
25@@ -1,6 +1,6 @@
26 /* Preprocess only, using cpplib.
27- Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007
28- Free Software Foundation, Inc.
29+ Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007,
30+ 2008 Free Software Foundation, Inc.
31 Written by Per Bothner, 1994-95.
32
33 This program is free software; you can redistribute it and/or modify it
34@@ -177,7 +177,24 @@ scan_translation_unit (cpp_reader *pfile
35 avoid_paste = false;
36 print.source = NULL;
37 print.prev = token;
38- cpp_output_token (token, print.outf);
39+ if (token->type == CPP_PRAGMA)
40+ {
41+ const char *space;
42+ const char *name;
43+
44+ maybe_print_line (token->src_loc);
45+ fputs ("#pragma ", print.outf);
46+ c_pp_lookup_pragma (token->val.pragma, &space, &name);
47+ if (space)
48+ fprintf (print.outf, "%s %s", space, name);
49+ else
50+ fprintf (print.outf, "%s", name);
51+ print.printed = 1;
52+ }
53+ else if (token->type == CPP_PRAGMA_EOL)
54+ maybe_print_line (token->src_loc);
55+ else
56+ cpp_output_token (token, print.outf);
57
58 if (token->type == CPP_COMMENT)
59 account_for_newlines (token->val.str.text, token->val.str.len);
60--- gcc/c-pragma.c.jj 2008-02-15 18:43:03.000000000 +0100
61+++ gcc/c-pragma.c 2008-02-26 22:59:44.000000000 +0100
62@@ -1,6 +1,6 @@
63 /* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
64 Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
65- 2006, 2007 Free Software Foundation, Inc.
66+ 2006, 2007, 2008 Free Software Foundation, Inc.
67
68 This file is part of GCC.
69
70@@ -872,6 +872,61 @@ DEF_VEC_ALLOC_O (pragma_handler, heap);
71
72 static VEC(pragma_handler, heap) *registered_pragmas;
73
74+typedef struct
75+{
76+ const char *space;
77+ const char *name;
78+} pragma_ns_name;
79+
80+DEF_VEC_O (pragma_ns_name);
81+DEF_VEC_ALLOC_O (pragma_ns_name, heap);
82+
83+static VEC(pragma_ns_name, heap) *registered_pp_pragmas;
84+
85+struct omp_pragma_def { const char *name; unsigned int id; };
86+static const struct omp_pragma_def omp_pragmas[] = {
87+ { "atomic", PRAGMA_OMP_ATOMIC },
88+ { "barrier", PRAGMA_OMP_BARRIER },
89+ { "critical", PRAGMA_OMP_CRITICAL },
90+ { "flush", PRAGMA_OMP_FLUSH },
91+ { "for", PRAGMA_OMP_FOR },
92+ { "master", PRAGMA_OMP_MASTER },
93+ { "ordered", PRAGMA_OMP_ORDERED },
94+ { "parallel", PRAGMA_OMP_PARALLEL },
95+ { "section", PRAGMA_OMP_SECTION },
96+ { "sections", PRAGMA_OMP_SECTIONS },
97+ { "single", PRAGMA_OMP_SINGLE },
98+ { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
99+};
100+
101+void
102+c_pp_lookup_pragma (unsigned int id, const char **space, const char **name)
103+{
104+ const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas);
105+ int i;
106+
107+ for (i = 0; i < n_omp_pragmas; ++i)
108+ if (omp_pragmas[i].id == id)
109+ {
110+ *space = "omp";
111+ *name = omp_pragmas[i].name;
112+ return;
113+ }
114+
115+ if (id >= PRAGMA_FIRST_EXTERNAL
116+ && (id < PRAGMA_FIRST_EXTERNAL
117+ + VEC_length (pragma_ns_name, registered_pp_pragmas)))
118+ {
119+ *space = VEC_index (pragma_ns_name, registered_pp_pragmas,
120+ id - PRAGMA_FIRST_EXTERNAL)->space;
121+ *name = VEC_index (pragma_ns_name, registered_pp_pragmas,
122+ id - PRAGMA_FIRST_EXTERNAL)->name;
123+ return;
124+ }
125+
126+ gcc_unreachable ();
127+}
128+
129 /* Front-end wrappers for pragma registration to avoid dragging
130 cpplib.h in almost everywhere. */
131
132@@ -881,13 +936,29 @@ c_register_pragma_1 (const char *space,
133 {
134 unsigned id;
135
136- VEC_safe_push (pragma_handler, heap, registered_pragmas, &handler);
137- id = VEC_length (pragma_handler, registered_pragmas);
138- id += PRAGMA_FIRST_EXTERNAL - 1;
139-
140- /* The C++ front end allocates 6 bits in cp_token; the C front end
141- allocates 7 bits in c_token. At present this is sufficient. */
142- gcc_assert (id < 64);
143+ if (flag_preprocess_only)
144+ {
145+ pragma_ns_name ns_name;
146+
147+ if (!allow_expansion)
148+ return;
149+
150+ ns_name.space = space;
151+ ns_name.name = name;
152+ VEC_safe_push (pragma_ns_name, heap, registered_pp_pragmas, &ns_name);
153+ id = VEC_length (pragma_ns_name, registered_pp_pragmas);
154+ id += PRAGMA_FIRST_EXTERNAL - 1;
155+ }
156+ else
157+ {
158+ VEC_safe_push (pragma_handler, heap, registered_pragmas, &handler);
159+ id = VEC_length (pragma_handler, registered_pragmas);
160+ id += PRAGMA_FIRST_EXTERNAL - 1;
161+
162+ /* The C++ front end allocates 6 bits in cp_token; the C front end
163+ allocates 7 bits in c_token. At present this is sufficient. */
164+ gcc_assert (id < 64);
165+ }
166
167 cpp_register_deferred_pragma (parse_in, space, name, id,
168 allow_expansion, false);
169@@ -921,24 +992,8 @@ c_invoke_pragma_handler (unsigned int id
170 void
171 init_pragma (void)
172 {
173- if (flag_openmp && !flag_preprocess_only)
174+ if (flag_openmp)
175 {
176- struct omp_pragma_def { const char *name; unsigned int id; };
177- static const struct omp_pragma_def omp_pragmas[] = {
178- { "atomic", PRAGMA_OMP_ATOMIC },
179- { "barrier", PRAGMA_OMP_BARRIER },
180- { "critical", PRAGMA_OMP_CRITICAL },
181- { "flush", PRAGMA_OMP_FLUSH },
182- { "for", PRAGMA_OMP_FOR },
183- { "master", PRAGMA_OMP_MASTER },
184- { "ordered", PRAGMA_OMP_ORDERED },
185- { "parallel", PRAGMA_OMP_PARALLEL },
186- { "section", PRAGMA_OMP_SECTION },
187- { "sections", PRAGMA_OMP_SECTIONS },
188- { "single", PRAGMA_OMP_SINGLE },
189- { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
190- };
191-
192 const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas);
193 int i;
194
195@@ -947,8 +1002,9 @@ init_pragma (void)
196 omp_pragmas[i].id, true, true);
197 }
198
199- cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
200- PRAGMA_GCC_PCH_PREPROCESS, false, false);
201+ if (!flag_preprocess_only)
202+ cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
203+ PRAGMA_GCC_PCH_PREPROCESS, false, false);
204
205 #ifdef HANDLE_PRAGMA_PACK
206 #ifdef HANDLE_PRAGMA_PACK_WITH_EXPANSION
207--- gcc/c-opts.c.jj 2008-02-26 22:53:23.000000000 +0100
208+++ gcc/c-opts.c 2008-02-26 22:54:57.000000000 +0100
209@@ -1,5 +1,5 @@
210 /* C/ObjC/C++ command line option handling.
211- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
212+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
213 Free Software Foundation, Inc.
214 Contributed by Neil Booth.
215
216@@ -1239,6 +1239,9 @@ c_common_init (void)
217 if (version_flag)
218 c_common_print_pch_checksum (stderr);
219
220+ /* Has to wait until now so that cpplib has its hash table. */
221+ init_pragma ();
222+
223 if (flag_preprocess_only)
224 {
225 finish_options ();
226@@ -1246,9 +1249,6 @@ c_common_init (void)
227 return false;
228 }
229
230- /* Has to wait until now so that cpplib has its hash table. */
231- init_pragma ();
232-
233 return true;
234 }
235
236--- gcc/c-pragma.h.jj 2008-01-26 18:01:16.000000000 +0100
237+++ gcc/c-pragma.h 2008-02-26 22:54:57.000000000 +0100
238@@ -1,6 +1,6 @@
239 /* Pragma related interfaces.
240 Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
241- 2007 Free Software Foundation, Inc.
242+ 2007, 2008 Free Software Foundation, Inc.
243
244 This file is part of GCC.
245
246@@ -124,4 +124,6 @@ extern enum cpp_ttype pragma_lex (tree *
247 extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
248 int);
249
250+extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
251+
252 #endif /* GCC_C_PRAGMA_H */
253--- gcc/config/darwin.h.jj 2008-02-11 14:48:12.000000000 +0100
254+++ gcc/config/darwin.h 2008-02-26 22:54:57.000000000 +0100
255@@ -892,8 +892,9 @@ enum machopic_addr_class {
256
257 #define DARWIN_REGISTER_TARGET_PRAGMAS() \
258 do { \
259- cpp_register_pragma (parse_in, NULL, "mark", \
260- darwin_pragma_ignore, false); \
261+ if (!flag_preprocess_only) \
262+ cpp_register_pragma (parse_in, NULL, "mark", \
263+ darwin_pragma_ignore, false); \
264 c_register_pragma (0, "options", darwin_pragma_options); \
265 c_register_pragma (0, "segment", darwin_pragma_ignore); \
266 c_register_pragma (0, "unused", darwin_pragma_unused); \
267--- gcc/testsuite/gcc.dg/gomp/preprocess-1.c.jj 2008-02-26 22:54:57.000000000 +0100
268+++ gcc/testsuite/gcc.dg/gomp/preprocess-1.c 2008-02-26 22:54:57.000000000 +0100
269@@ -0,0 +1,16 @@
270+/* { dg-do preprocess } */
271+
272+void foo (void)
273+{
274+ int i1, j1, k1;
275+#define p parallel
276+#define P(x) private (x##1)
277+#define S(x) shared (x##1)
278+#define F(x) firstprivate (x##1)
279+#pragma omp p P(i) \
280+ S(j) \
281+ F(k)
282+ ;
283+}
284+
285+/* { dg-final { scan-file preprocess-1.i "(^|\n)#pragma omp parallel private \\(i1\\) shared \\(j1\\) firstprivate \\(k1\\)($|\n)" } } */
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-i386-libgomp.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-i386-libgomp.patch
deleted file mode 100644
index bf09f23aa0..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-i386-libgomp.patch
+++ /dev/null
@@ -1,66 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
2Build i386.rpm libgomp and libsupc++.a(guard.o) as i486+, pre-i486
3hardware isn't supported because NPTL doesn't support it anyway.
4
5Index: libgomp/configure.tgt
6===================================================================
7--- libgomp/configure.tgt.orig 2010-01-28 13:47:59.000000000 -0800
8+++ libgomp/configure.tgt 2010-06-25 10:32:26.706135558 -0700
9@@ -48,14 +48,14 @@
10 ;;
11
12 # Note that bare i386 is not included here. We need cmpxchg.
13- i[456]86-*-linux*)
14+ i[3456]86-*-linux*)
15 config_path="linux/x86 linux posix"
16 case " ${CC} ${CFLAGS} " in
17 *" -m64 "*)
18 ;;
19 *)
20 if test -z "$with_arch"; then
21- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
22+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
23 fi
24 esac
25 ;;
26@@ -67,7 +67,7 @@
27 config_path="linux/x86 linux posix"
28 case " ${CC} ${CFLAGS} " in
29 *" -m32 "*)
30- XCFLAGS="${XCFLAGS} -march=i486 -mtune=i686"
31+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
32 ;;
33 esac
34 ;;
35Index: libstdc++-v3/libsupc++/guard.cc
36===================================================================
37--- libstdc++-v3/libsupc++/guard.cc.orig 2009-11-09 14:09:30.000000000 -0800
38+++ libstdc++-v3/libsupc++/guard.cc 2010-06-25 10:32:26.710135964 -0700
39@@ -30,6 +30,27 @@
40 #include <new>
41 #include <ext/atomicity.h>
42 #include <ext/concurrence.h>
43+#if defined __i386__ && !defined _GLIBCXX_ATOMIC_BUILTINS
44+# define _GLIBCXX_ATOMIC_BUILTINS 1
45+# define __sync_val_compare_and_swap(a, b, c) \
46+ ({ \
47+ typedef char sltast[sizeof (*a) == sizeof (int) ? 1 : -1]; \
48+ int sltas; \
49+ __asm __volatile ("lock; cmpxchgl %3, (%1)" \
50+ : "=a" (sltas) \
51+ : "r" (a), "0" (b), "r" (c) : "memory"); \
52+ sltas; \
53+ })
54+# define __sync_lock_test_and_set(a, b) \
55+ ({ \
56+ typedef char sltast[sizeof (*a) == sizeof (int) ? 1 : -1]; \
57+ int sltas; \
58+ __asm __volatile ("xchgl (%1), %0" \
59+ : "=r" (sltas) \
60+ : "r" (a), "0" (b) : "memory"); \
61+ sltas; \
62+ })
63+#endif
64 #if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \
65 && defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
66 # include <climits>
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ia64-libunwind.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ia64-libunwind.patch
deleted file mode 100644
index 0d6fa61d6a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ia64-libunwind.patch
+++ /dev/null
@@ -1,551 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22004-11-27 Jakub Jelinek <jakub@redhat.com>
3
4 * config.gcc (ia64*-*-linux*): If native and libelf is installed,
5 use ia64/t-glibc-no-libunwind instead of the other t-*unwind*
6 fragments.
7 * config/ia64/t-glibc-no-libunwind: New file.
8 * config/ia64/change-symver.c: New file.
9 * config/ia64/unwind-ia64.c: If USE_SYMVER_GLOBAL and SHARED,
10 define _Unwind_* to __symverglobal_Unwind_*.
11 (alias): Undefine.
12 (symverglobal): Define. Use it on _Unwind_*.
13 * config/ia64/mkmap-symver-multi.awk: New file.
14 * config/ia64/libgcc-ia64-no-libunwind.ver: New file.
15
16Index: gcc/config.gcc
17===================================================================
18--- gcc/config.gcc.orig 2010-04-07 03:34:00.000000000 -0700
19+++ gcc/config.gcc 2010-06-25 10:15:25.133131055 -0700
20@@ -1457,9 +1457,16 @@
21 ;;
22 ia64*-*-linux*)
23 tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h"
24- tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc"
25- if test x$with_system_libunwind != xyes ; then
26- tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
27+ tmake_file="${tmake_file} ia64/t-ia64"
28+ if test x${target} = x${host} && test x${target} = x${build} \
29+ && grep gelf_getverdef /usr/include/gelf.h > /dev/null 2>&1 \
30+ && test -f /usr/lib/libelf.so; then
31+ tmake_file="${tmake_file} ia64/t-glibc-no-libunwind"
32+ else
33+ tmake_file="${tmake_file} t-libunwind ia64/t-glibc"
34+ if test x$with_system_libunwind != xyes ; then
35+ tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
36+ fi
37 fi
38 target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
39 extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
40Index: gcc/config/ia64/t-glibc-no-libunwind
41===================================================================
42--- /dev/null 1970-01-01 00:00:00.000000000 +0000
43+++ gcc/config/ia64/t-glibc-no-libunwind 2010-06-25 10:14:32.521880765 -0700
44@@ -0,0 +1,30 @@
45+# Don't use system libunwind library on IA-64 GLIBC based system,
46+# but make _Unwind_* symbols unversioned, so that created programs
47+# are usable even when libgcc_s uses libunwind.
48+LIB2ADDEH += $(srcdir)/config/ia64/fde-glibc.c
49+SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64-no-libunwind.ver
50+SHLIB_MKMAP = $(srcdir)/config/ia64/mkmap-symver-multi.awk
51+
52+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
53+ -Wl,--soname=$(SHLIB_SONAME) \
54+ -Wl,--version-script=$(SHLIB_MAP) \
55+ -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \
56+ rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
57+ if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
58+ mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
59+ $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
60+ else true; fi && \
61+ gcc -O2 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tweak \
62+ $$(gcc_srcdir)/config/ia64/change-symver.c -lelf && \
63+ $(SHLIB_DIR)/$(SHLIB_SONAME).tweak $(SHLIB_DIR)/$(SHLIB_SONAME).tmp \
64+ GCC_3.4.2 _GLOBAL_ \
65+ _Unwind_GetGR _Unwind_RaiseException _Unwind_GetRegionStart _Unwind_SetIP \
66+ _Unwind_GetIP _Unwind_GetLanguageSpecificData _Unwind_Resume \
67+ _Unwind_DeleteException _Unwind_SetGR _Unwind_ForcedUnwind \
68+ _Unwind_Backtrace _Unwind_FindEnclosingFunction _Unwind_GetCFA \
69+ _Unwind_Resume_or_Rethrow _Unwind_GetBSP && \
70+ rm -f $(SHLIB_DIR)/$(SHLIB_SONAME).tweak && \
71+ mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
72+ $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
73+
74+TARGET_LIBGCC2_CFLAGS += -DUSE_SYMVER_GLOBAL
75Index: gcc/config/ia64/change-symver.c
76===================================================================
77--- /dev/null 1970-01-01 00:00:00.000000000 +0000
78+++ gcc/config/ia64/change-symver.c 2010-06-25 10:14:32.521880765 -0700
79@@ -0,0 +1,211 @@
80+#define _GNU_SOURCE 1
81+#define _FILE_OFFSET_BITS 64
82+#include <endian.h>
83+#include <errno.h>
84+#include <error.h>
85+#include <fcntl.h>
86+#include <fnmatch.h>
87+#include <gelf.h>
88+#include <stdlib.h>
89+#include <string.h>
90+#include <unistd.h>
91+
92+int
93+compute_veridx (const char *name, Elf *elf, Elf_Data *verd, GElf_Shdr *verd_shdr)
94+{
95+ if (strcmp (name, "_GLOBAL_") == 0)
96+ return 1;
97+
98+ int cnt;
99+ size_t offset = 0;
100+ for (cnt = verd_shdr->sh_info; --cnt >= 0; )
101+ {
102+ GElf_Verdef defmem;
103+ GElf_Verdef *def;
104+ GElf_Verdaux auxmem;
105+ GElf_Verdaux *aux;
106+ unsigned int auxoffset;
107+
108+ /* Get the data at the next offset. */
109+ def = gelf_getverdef (verd, offset, &defmem);
110+ if (def == NULL)
111+ break;
112+
113+ auxoffset = offset + def->vd_aux;
114+ aux = gelf_getverdaux (verd, auxoffset, &auxmem);
115+ if (aux == NULL)
116+ break;
117+
118+ if (strcmp (name, elf_strptr (elf, verd_shdr->sh_link,
119+ aux->vda_name)) == 0)
120+ return def->vd_ndx;
121+
122+ /* Find the next offset. */
123+ offset += def->vd_next;
124+ }
125+
126+ return -1;
127+}
128+
129+int
130+main (int argc, char **argv)
131+{
132+ if (argc < 4)
133+ error (1, 0, "Usage: change_symver library from_symver to_symver symbol...\nExample: change_symver libfoo.so FOO_1.0 *global* bar baz");
134+
135+ const char *fname = argv[1];
136+
137+ /* Open the file. */
138+ int fd;
139+ fd = open (fname, O_RDWR);
140+ if (fd == -1)
141+ error (1, errno, fname);
142+
143+ elf_version (EV_CURRENT);
144+
145+ /* Now get the ELF descriptor. */
146+ Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
147+ if (elf == NULL || elf_kind (elf) != ELF_K_ELF)
148+ error (1, 0, "Couldn't open %s: %s", fname, elf_errmsg (-1));
149+
150+ size_t shstrndx;
151+ /* Get the section header string table index. */
152+ if (elf_getshstrndx (elf, &shstrndx) < 0)
153+ error (1, 0, "cannot get shstrndx from %s", fname);
154+
155+ GElf_Ehdr ehdr_mem;
156+ GElf_Ehdr *ehdr;
157+
158+ /* We need the ELF header in a few places. */
159+ ehdr = gelf_getehdr (elf, &ehdr_mem);
160+ if (ehdr == NULL)
161+ error (1, 0, "couldn't get ELF headers %s: %s", fname, elf_errmsg (-1));
162+
163+ Elf_Scn *scn = NULL;
164+ GElf_Shdr shdr_mem, verd_shdr, ver_shdr, dynsym_shdr;
165+ Elf_Data *ver = NULL, *verd = NULL, *dynsym = NULL;
166+
167+ while ((scn = elf_nextscn (elf, scn)) != NULL)
168+ {
169+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
170+
171+ if (shdr == NULL)
172+ error (1, 0, "couldn't get shdr from %s", fname);
173+
174+ if ((shdr->sh_flags & SHF_ALLOC) != 0)
175+ {
176+ const char *name = elf_strptr (elf, shstrndx, shdr->sh_name);
177+ Elf_Data **p;
178+
179+ if (strcmp (name, ".gnu.version") == 0)
180+ {
181+ p = &ver;
182+ ver_shdr = *shdr;
183+ }
184+ else if (strcmp (name, ".gnu.version_d") == 0)
185+ {
186+ p = &verd;
187+ verd_shdr = *shdr;
188+ }
189+ else if (strcmp (name, ".dynsym") == 0)
190+ {
191+ p = &dynsym;
192+ dynsym_shdr = *shdr;
193+ }
194+ else
195+ continue;
196+
197+ if (*p != NULL)
198+ error (1, 0, "Two %s sections in %s", name, fname);
199+ *p = elf_getdata (scn, NULL);
200+ if (*p == NULL || elf_getdata (scn, *p) != NULL)
201+ error (1, 0, "No data or non-contiguous data in %s section in %s",
202+ name, fname);
203+ }
204+ }
205+
206+ if (ver == NULL || verd == NULL || dynsym == NULL)
207+ error (1, 0, "Couldn't find one of the needed sections in %s", fname);
208+
209+ int from_idx = compute_veridx (argv[2], elf, verd, &verd_shdr);
210+ if (from_idx == -1)
211+ error (1, 0, "Could not find symbol version %s in %s", argv[2], fname);
212+
213+ int to_idx = compute_veridx (argv[3], elf, verd, &verd_shdr);
214+ if (to_idx == -1)
215+ error (1, 0, "Could not find symbol version %s in %s", argv[3], fname);
216+
217+ if (dynsym_shdr.sh_entsize != gelf_fsize (elf, ELF_T_SYM, 1, ehdr->e_version)
218+ || dynsym_shdr.sh_size % dynsym_shdr.sh_entsize
219+ || ver_shdr.sh_entsize != 2
220+ || (ver_shdr.sh_size & 1)
221+ || dynsym_shdr.sh_size / dynsym_shdr.sh_entsize != ver_shdr.sh_size / 2)
222+ error (1, 0, "Unexpected sh_size or sh_entsize in %s", fname);
223+
224+ size_t nentries = ver_shdr.sh_size / 2;
225+ size_t cnt;
226+ GElf_Versym array[nentries];
227+ for (cnt = 0; cnt < nentries; ++cnt)
228+ {
229+ GElf_Versym vsymmem;
230+ GElf_Versym *vsym;
231+
232+ vsym = gelf_getversym (ver, cnt, &vsymmem);
233+ if (vsym == NULL)
234+ error (1, 0, "gelt_getversym failed in %s: %s", fname, elf_errmsg (-1));
235+
236+ array[cnt] = *vsym;
237+ if (*vsym != from_idx)
238+ continue;
239+
240+ GElf_Sym sym_mem;
241+ GElf_Sym *sym;
242+ sym = gelf_getsym (dynsym, cnt, &sym_mem);
243+ if (sym == NULL)
244+ error (1, 0, "gelt_getsym failed in %s: %s", fname, elf_errmsg (-1));
245+
246+ const char *name = elf_strptr (elf, dynsym_shdr.sh_link, sym->st_name);
247+
248+ int argn;
249+ for (argn = 4; argn < argc; ++argn)
250+ if (fnmatch (argv[argn], name, 0) == 0)
251+ {
252+ array[cnt] = to_idx;
253+ break;
254+ }
255+ }
256+
257+ if (sizeof (array[0]) != 2)
258+ abort ();
259+
260+#if __BYTE_ORDER == __LITTLE_ENDIAN
261+ if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
262+ ;
263+ else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
264+#elif __BYTE_ORDER == __BIG_ENDIAN
265+ if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
266+ ;
267+ else if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
268+#else
269+# error Unsupported endianity
270+#endif
271+ {
272+ for (cnt = 0; cnt < nentries; ++cnt)
273+ array[cnt] = ((array[cnt] & 0xff) << 8) | ((array[cnt] & 0xff00) >> 8);
274+ }
275+ else
276+ error (1, 0, "Unknown EI_DATA %d in %s", ehdr->e_ident[EI_DATA], fname);
277+
278+ if (elf_end (elf) != 0)
279+ error (1, 0, "couldn't close %s: %s", fname, elf_errmsg (-1));
280+
281+ if (lseek (fd, ver_shdr.sh_offset, SEEK_SET) != (off_t) ver_shdr.sh_offset)
282+ error (1, 0, "failed to seek to %zd in %s", (size_t) ver_shdr.sh_offset,
283+ fname);
284+
285+ if (write (fd, array, 2 * nentries) != (ssize_t) (2 * nentries))
286+ error (1, 0, "failed to write .gnu.version section into %s", fname);
287+
288+ close (fd);
289+ return 0;
290+}
291Index: gcc/config/ia64/unwind-ia64.c
292===================================================================
293--- gcc/config/ia64/unwind-ia64.c.orig 2009-09-07 08:41:52.000000000 -0700
294+++ gcc/config/ia64/unwind-ia64.c 2010-06-25 10:14:32.521880765 -0700
295@@ -48,6 +48,51 @@
296 #define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) 1
297 #endif
298
299+#if defined (USE_SYMVER_GLOBAL) && defined (SHARED)
300+extern _Unwind_Reason_Code __symverglobal_Unwind_Backtrace
301+ (_Unwind_Trace_Fn, void *);
302+extern void __symverglobal_Unwind_DeleteException
303+ (struct _Unwind_Exception *);
304+extern void * __symverglobal_Unwind_FindEnclosingFunction (void *);
305+extern _Unwind_Reason_Code __symverglobal_Unwind_ForcedUnwind
306+ (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
307+extern _Unwind_Word __symverglobal_Unwind_GetCFA
308+ (struct _Unwind_Context *);
309+extern _Unwind_Word __symverglobal_Unwind_GetBSP
310+ (struct _Unwind_Context *);
311+extern _Unwind_Word __symverglobal_Unwind_GetGR
312+ (struct _Unwind_Context *, int );
313+extern _Unwind_Ptr __symverglobal_Unwind_GetIP (struct _Unwind_Context *);
314+extern void *__symverglobal_Unwind_GetLanguageSpecificData
315+ (struct _Unwind_Context *);
316+extern _Unwind_Ptr __symverglobal_Unwind_GetRegionStart
317+ (struct _Unwind_Context *);
318+extern _Unwind_Reason_Code __symverglobal_Unwind_RaiseException
319+ (struct _Unwind_Exception *);
320+extern void __symverglobal_Unwind_Resume (struct _Unwind_Exception *);
321+extern _Unwind_Reason_Code __symverglobal_Unwind_Resume_or_Rethrow
322+ (struct _Unwind_Exception *);
323+extern void __symverglobal_Unwind_SetGR
324+ (struct _Unwind_Context *, int, _Unwind_Word);
325+extern void __symverglobal_Unwind_SetIP
326+ (struct _Unwind_Context *, _Unwind_Ptr);
327+#define _Unwind_Backtrace __symverglobal_Unwind_Backtrace
328+#define _Unwind_DeleteException __symverglobal_Unwind_DeleteException
329+#define _Unwind_FindEnclosingFunction __symverglobal_Unwind_FindEnclosingFunction
330+#define _Unwind_ForcedUnwind __symverglobal_Unwind_ForcedUnwind
331+#define _Unwind_GetBSP __symverglobal_Unwind_GetBSP
332+#define _Unwind_GetCFA __symverglobal_Unwind_GetCFA
333+#define _Unwind_GetGR __symverglobal_Unwind_GetGR
334+#define _Unwind_GetIP __symverglobal_Unwind_GetIP
335+#define _Unwind_GetLanguageSpecificData __symverglobal_Unwind_GetLanguageSpecificData
336+#define _Unwind_GetRegionStart __symverglobal_Unwind_GetRegionStart
337+#define _Unwind_RaiseException __symverglobal_Unwind_RaiseException
338+#define _Unwind_Resume __symverglobal_Unwind_Resume
339+#define _Unwind_Resume_or_Rethrow __symverglobal_Unwind_Resume_or_Rethrow
340+#define _Unwind_SetGR __symverglobal_Unwind_SetGR
341+#define _Unwind_SetIP __symverglobal_Unwind_SetIP
342+#endif
343+
344 enum unw_application_register
345 {
346 UNW_AR_BSP,
347@@ -2457,4 +2502,44 @@
348 alias (_Unwind_SetIP);
349 #endif
350
351+#if defined (USE_SYMVER_GLOBAL) && defined (SHARED)
352+#undef alias
353+#define symverglobal(name, version) \
354+__typeof (__symverglobal##name) __symverlocal##name \
355+ __attribute__ ((alias ("__symverglobal" #name))); \
356+__asm__ (".symver __symverglobal" #name"," #name "@@GCC_3.4.2");\
357+__asm__ (".symver __symverlocal" #name"," #name "@" #version)
358+
359+#undef _Unwind_Backtrace
360+#undef _Unwind_DeleteException
361+#undef _Unwind_FindEnclosingFunction
362+#undef _Unwind_ForcedUnwind
363+#undef _Unwind_GetBSP
364+#undef _Unwind_GetCFA
365+#undef _Unwind_GetGR
366+#undef _Unwind_GetIP
367+#undef _Unwind_GetLanguageSpecificData
368+#undef _Unwind_GetRegionStart
369+#undef _Unwind_RaiseException
370+#undef _Unwind_Resume
371+#undef _Unwind_Resume_or_Rethrow
372+#undef _Unwind_SetGR
373+#undef _Unwind_SetIP
374+symverglobal (_Unwind_Backtrace, GCC_3.3);
375+symverglobal (_Unwind_DeleteException, GCC_3.0);
376+symverglobal (_Unwind_FindEnclosingFunction, GCC_3.3);
377+symverglobal (_Unwind_ForcedUnwind, GCC_3.0);
378+symverglobal (_Unwind_GetBSP, GCC_3.3.2);
379+symverglobal (_Unwind_GetCFA, GCC_3.3);
380+symverglobal (_Unwind_GetGR, GCC_3.0);
381+symverglobal (_Unwind_GetIP, GCC_3.0);
382+symverglobal (_Unwind_GetLanguageSpecificData, GCC_3.0);
383+symverglobal (_Unwind_GetRegionStart, GCC_3.0);
384+symverglobal (_Unwind_RaiseException, GCC_3.0);
385+symverglobal (_Unwind_Resume, GCC_3.0);
386+symverglobal (_Unwind_Resume_or_Rethrow, GCC_3.3);
387+symverglobal (_Unwind_SetGR, GCC_3.0);
388+symverglobal (_Unwind_SetIP, GCC_3.0);
389+#endif
390+
391 #endif
392Index: gcc/config/ia64/mkmap-symver-multi.awk
393===================================================================
394--- /dev/null 1970-01-01 00:00:00.000000000 +0000
395+++ gcc/config/ia64/mkmap-symver-multi.awk 2010-06-25 10:14:32.521880765 -0700
396@@ -0,0 +1,133 @@
397+# Generate an ELF symbol version map a-la Solaris and GNU ld.
398+# Contributed by Richard Henderson <rth@cygnus.com>
399+#
400+# This file is part of GCC.
401+#
402+# GCC is free software; you can redistribute it and/or modify it under
403+# the terms of the GNU General Public License as published by the Free
404+# Software Foundation; either version 2, or (at your option) any later
405+# version.
406+#
407+# GCC is distributed in the hope that it will be useful, but WITHOUT
408+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
409+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
410+# License for more details.
411+#
412+# You should have received a copy of the GNU General Public License
413+# along with GCC; see the file COPYING. If not, write to the Free
414+# Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
415+# 02110-1301, USA.
416+
417+BEGIN {
418+ state = "nm";
419+ sawsymbol = 0;
420+}
421+
422+# Remove comment and blank lines.
423+/^ *#/ || /^ *$/ {
424+ next;
425+}
426+
427+# We begin with nm input. Collect the set of symbols that are present
428+# so that we can not emit them into the final version script -- Solaris
429+# complains at us if we do.
430+
431+state == "nm" && /^%%/ {
432+ state = "ver";
433+ next;
434+}
435+
436+state == "nm" && ($1 == "U" || $2 == "U") {
437+ next;
438+}
439+
440+state == "nm" && NF == 3 {
441+ if ($3 ~ /^[^@]*@GCC_[0-9.]*$/) {
442+ def[$3] = 1
443+ tl=$3
444+ sub(/^.*@/,"",tl)
445+ ver[$3] = tl
446+ } else {
447+ sub(/@@?GCC_[0-9.]*$/,"",$3)
448+ def[$3] = 1;
449+ }
450+ sawsymbol = 1;
451+ next;
452+}
453+
454+state == "nm" {
455+ next;
456+}
457+
458+# Now we process a simplified variant of the Solaris symbol version
459+# script. We have one symbol per line, no semicolons, simple markers
460+# for beginning and ending each section, and %inherit markers for
461+# describing version inheritence. A symbol may appear in more than
462+# one symbol version, and the last seen takes effect.
463+
464+NF == 3 && $1 == "%inherit" {
465+ inherit[$2] = $3;
466+ next;
467+}
468+
469+NF == 2 && $2 == "{" {
470+ libs[$1] = 1;
471+ thislib = $1;
472+ next;
473+}
474+
475+$1 == "}" {
476+ thislib = "";
477+ next;
478+}
479+
480+{
481+ ver[$1] = thislib;
482+ next;
483+}
484+
485+END {
486+ if (!sawsymbol)
487+ {
488+ print "No symbols seen -- broken or mis-installed nm?" | "cat 1>&2";
489+ exit 1;
490+ }
491+ for (l in libs)
492+ output(l);
493+}
494+
495+function output(lib) {
496+ if (done[lib])
497+ return;
498+ done[lib] = 1;
499+ if (inherit[lib])
500+ output(inherit[lib]);
501+
502+ empty=1
503+ for (sym in ver)
504+ if ((ver[sym] == lib) && (sym in def))
505+ {
506+ if (empty)
507+ {
508+ printf("%s {\n", lib);
509+ printf(" global:\n");
510+ empty = 0;
511+ }
512+ symp = sym;
513+ sub(/@GCC_[0-9.]*$/,"",symp);
514+ printf("\t%s;\n", symp);
515+ if (dotsyms)
516+ printf("\t.%s;\n", symp);
517+ }
518+
519+ if (empty)
520+ {
521+ for (l in libs)
522+ if (inherit[l] == lib)
523+ inherit[l] = inherit[lib];
524+ }
525+ else if (inherit[lib])
526+ printf("} %s;\n", inherit[lib]);
527+ else
528+ printf ("\n local:\n\t*;\n};\n");
529+}
530Index: gcc/config/ia64/libgcc-ia64-no-libunwind.ver
531===================================================================
532--- /dev/null 1970-01-01 00:00:00.000000000 +0000
533+++ gcc/config/ia64/libgcc-ia64-no-libunwind.ver 2010-06-25 10:14:32.525880902 -0700
534@@ -0,0 +1,17 @@
535+GCC_3.4.2 {
536+ _Unwind_GetGR
537+ _Unwind_RaiseException
538+ _Unwind_GetRegionStart
539+ _Unwind_SetIP
540+ _Unwind_GetIP
541+ _Unwind_GetLanguageSpecificData
542+ _Unwind_Resume
543+ _Unwind_DeleteException
544+ _Unwind_SetGR
545+ _Unwind_ForcedUnwind
546+ _Unwind_Backtrace
547+ _Unwind_FindEnclosingFunction
548+ _Unwind_GetCFA
549+ _Unwind_Resume_or_Rethrow
550+ _Unwind_GetBSP
551+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-debug-iface-type.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-debug-iface-type.patch
deleted file mode 100644
index bd856e4032..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-debug-iface-type.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22008-01-25 Jakub Jelinek <jakub@redhat.com>
3
4 * lang.c (java_classify_record): Revert 2007-12-20 change.
5
6Index: gcc/java/lang.c
7===================================================================
8--- gcc/java/lang.c.orig 2010-01-20 00:17:00.000000000 -0800
9+++ gcc/java/lang.c 2010-06-25 10:28:46.569383189 -0700
10@@ -881,9 +881,7 @@
11 if (! CLASS_P (type))
12 return RECORD_IS_STRUCT;
13
14- /* ??? GDB does not support DW_TAG_interface_type as of December,
15- 2007. Re-enable this at a later time. */
16- if (0 && CLASS_INTERFACE (TYPE_NAME (type)))
17+ if (CLASS_INTERFACE (TYPE_NAME (type)))
18 return RECORD_IS_INTERFACE;
19
20 return RECORD_IS_CLASS;
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-nomulti.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-nomulti.patch
deleted file mode 100644
index 2502f041dd..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-java-nomulti.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
2Index: libjava/configure.ac
3===================================================================
4--- libjava/configure.ac.orig 2010-03-21 12:41:37.000000000 -0700
5+++ libjava/configure.ac 2010-06-25 10:17:47.489886278 -0700
6@@ -139,6 +139,13 @@
7 [allow rebuilding of .class and .h files]))
8 AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
9
10+AC_ARG_ENABLE(libjava-multilib,
11+ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib]))
12+if test "$enable_libjava_multilib" = no; then
13+ multilib=no
14+ ac_configure_args="$ac_configure_args --disable-multilib"
15+fi
16+
17 # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
18 GCC_NO_EXECUTABLES
19
20Index: libjava/configure
21===================================================================
22--- libjava/configure.orig 2010-04-02 11:18:06.000000000 -0700
23+++ libjava/configure 2010-06-25 10:17:47.516381209 -0700
24@@ -1609,6 +1609,8 @@
25 default=yes
26 --enable-java-maintainer-mode
27 allow rebuilding of .class and .h files
28+ --enable-libjava-multilib
29+ build libjava as multilib
30 --disable-dependency-tracking speeds up one-time build
31 --enable-dependency-tracking do not reject slow dependency extractors
32 --enable-maintainer-mode enable make rules and dependencies not useful
33@@ -3346,6 +3348,16 @@
34 fi
35
36
37+# Check whether --enable-libjava-multilib was given.
38+if test "${enable_libjava_multilib+set}" = set; then
39+ enableval=$enable_libjava_multilib;
40+fi
41+
42+if test "$enable_libjava_multilib" = no; then
43+ multilib=no
44+ ac_configure_args="$ac_configure_args --disable-multilib"
45+fi
46+
47 # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
48
49
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-libgomp-speedup.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-libgomp-speedup.patch
deleted file mode 100644
index 54c855fb34..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-libgomp-speedup.patch
+++ /dev/null
@@ -1,2798 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22008-03-28 Jakub Jelinek <jakub@redhat.com>
3
4 * config/linux/sparc/futex.h (atomic_write_barrier): Fix membar
5 argument.
6
72008-03-27 Jakub Jelinek <jakub@redhat.com>
8
9 * libgomp.h (struct gomp_team_state): Remove single_count field
10 ifndef HAVE_SYNC_BUILTINS.
11 (struct gomp_team): Likewise. Add work_share_list_free_lock
12 ifndef HAVE_SYNC_BUILTINS.
13 * team.c (gomp_new_team): If HAVE_SYNC_BUILTINS is not defined,
14 don't initialize single_count, but instead initialize
15 work_share_list_free_lock.
16 (free_team): Destroy work_share_list_free_lock ifndef
17 HAVE_SYNC_BUILTINS.
18 (gomp_team_start): Don't initialize ts.single_count ifndef
19 HAVE_SYNC_BUILTINS.
20 * work.c (alloc_work_share, free_work_share): Use
21 work_share_list_free_lock instead of atomic chaining ifndef
22 HAVE_SYNC_BUILTINS.
23
242008-03-26 Jakub Jelinek <jakub@redhat.com>
25
26 * loop.c (gomp_loop_init): Fix GFS_DYNAMIC ws->mode setting.
27 * testsuite/libgomp.c/loop-4.c: New test.
28
29 * libgomp.h (struct gomp_team_state): Add single_count field.
30 (struct gomp_team): Likewise.
31 * team.c (gomp_new_team): Clear single_count.
32 (gomp_team_start): Likewise.
33 * single.c (GOMP_single_start): Rewritten if HAVE_SYNC_BUILTINS.
34
352008-03-25 Jakub Jelinek <jakub@redhat.com>
36
37 * team.c (gomp_thread_start): Don't clear ts.static_trip here.
38 * loop.c (gomp_loop_static_start, gomp_loop_dynamic_start): Clear
39 ts.static_trip here.
40 * work.c (gomp_work_share_start): Don't clear ts.static_trip here.
41
422008-03-21 Jakub Jelinek <jakub@redhat.com>
43
44 * libgomp.h: Include ptrlock.h.
45 (struct gomp_work_share): Reshuffle fields. Add next_alloc,
46 next_ws, next_free and inline_ordered_team_ids fields, change
47 ordered_team_ids into pointer from flexible array member.
48 (struct gomp_team_state): Add last_work_share field, remove
49 work_share_generation.
50 (struct gomp_team): Remove work_share_lock, generation_mask,
51 oldest_live_gen, num_live_gen and init_work_shares fields, add
52 work work_share_list_alloc, work_share_list_free and work_share_chunk
53 fields. Change work_shares from pointer to pointers into an array.
54 (gomp_new_team): New prototype.
55 (gomp_team_start): Change type of last argument.
56 (gomp_new_work_share): Removed.
57 (gomp_init_work_share, gomp_fini_work_share): New prototypes.
58 (gomp_work_share_init_done): New static inline.
59 * team.c (gomp_thread_start): Clear ts.last_work_share, don't clear
60 ts.work_share_generation.
61 (new_team): Removed.
62 (gomp_new_team): New function.
63 (free_team): Free gomp_work_share blocks chained through next_alloc,
64 instead of freeing work_shares and destroying work_share_lock.
65 (gomp_team_start): Change last argument from ws to team, don't create
66 new team, set ts.work_share to &team->work_shares[0] and clear
67 ts.last_work_share. Don't clear ts.work_share_generation.
68 (gomp_team_end): Call gomp_fini_work_share.
69 * work.c (gomp_new_work_share): Removed.
70 (alloc_work_share, gomp_init_work_share, gomp_fini_work_share): New
71 functions.
72 (free_work_share): Add team argument. Call gomp_fini_work_share
73 and then either free ws if orphaned, or put it into
74 work_share_list_free list of the current team.
75 (gomp_work_share_start, gomp_work_share_end,
76 gomp_work_share_end_nowait): Rewritten.
77 * sections.c (GOMP_sections_start): Call gomp_work_share_init_done
78 after gomp_sections_init. If HAVE_SYNC_BUILTINS, call
79 gomp_iter_dynamic_next instead of the _locked variant and don't take
80 lock around it, otherwise acquire it before calling
81 gomp_iter_dynamic_next_locked.
82 (GOMP_sections_next): If HAVE_SYNC_BUILTINS, call
83 gomp_iter_dynamic_next instead of the _locked variant and don't take
84 lock around it.
85 (GOMP_parallel_sections_start): Call gomp_new_team instead of
86 gomp_new_work_share. Call gomp_sections_init on &team->work_shares[0].
87 Adjust gomp_team_start caller.
88 * loop.c (gomp_loop_static_start, gomp_loop_ordered_static_start): Call
89 gomp_work_share_init_done after gomp_loop_init. Don't unlock ws->lock.
90 (gomp_loop_dynamic_start, gomp_loop_guided_start): Call
91 gomp_work_share_init_done after gomp_loop_init. If HAVE_SYNC_BUILTINS,
92 don't unlock ws->lock, otherwise lock it.
93 (gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start): Call
94 gomp_work_share_init_done after gomp_loop_init. Lock ws->lock.
95 (gomp_parallel_loop_start): Call gomp_new_team instead of
96 gomp_new_work_share. Call gomp_loop_init on &team->work_shares[0].
97 Adjust gomp_team_start caller.
98 * single.c (GOMP_single_start, GOMP_single_copy_start): Call
99 gomp_work_share_init_done if gomp_work_share_start returned true.
100 Don't unlock ws->lock.
101 * parallel.c (GOMP_parallel_start): Call gomp_new_team and pass that
102 as last argument to gomp_team_start.
103 * config/linux/ptrlock.c: New file.
104 * config/linux/ptrlock.h: New file.
105 * config/posix/ptrlock.c: New file.
106 * config/posix/ptrlock.h: New file.
107 * Makefile.am (libgomp_la_SOURCES): Add ptrlock.c.
108 * Makefile.in: Regenerated.
109 * testsuite/Makefile.in: Regenerated.
110
1112008-03-19 Jakub Jelinek <jakub@redhat.com>
112
113 * libgomp.h (gomp_active_wait_policy): Remove decl.
114 (gomp_throttled_spin_count_var, gomp_available_cpus,
115 gomp_managed_threads): New extern decls.
116 * team.c (gomp_team_start, gomp_team_end): If number of threads
117 changed, adjust atomically gomp_managed_threads.
118 * env.c (gomp_active_wait_policy, gomp_block_time_var): Remove.
119 (gomp_throttled_spin_count_var, gomp_available_cpus,
120 gomp_managed_threads): New variables.
121 (parse_millis): Removed.
122 (parse_spincount): New function.
123 (parse_wait_policy): Return -1/0/1 instead of setting
124 gomp_active_wait_policy.
125 (initialize_env): Call gomp_init_num_threads unconditionally.
126 Initialize gomp_available_cpus. Call parse_spincount instead
127 of parse_millis, initialize gomp_{,throttled_}spin_count_var
128 depending on presence and value of OMP_WAIT_POLICY and
129 GOMP_SPINCOUNT env vars.
130 * config/linux/wait.h (do_wait): Use gomp_throttled_spin_count_var
131 instead of gomp_spin_count_var if gomp_managed_threads >
132 gomp_available_cpus.
133
134 * config/linux/wait.h: Include errno.h.
135 (FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Define.
136 (gomp_futex_wake, gomp_futex_wait): New extern decls.
137 * config/linux/mutex.c (gomp_futex_wake, gomp_futex_wait): New
138 variables.
139 * config/linux/powerpc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
140 (sys_futex0): Return error code.
141 (futex_wake, futex_wait): If ENOSYS was returned, clear
142 FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
143 * config/linux/alpha/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
144 (futex_wake, futex_wait): If ENOSYS was returned, clear
145 FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
146 * config/linux/x86/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
147 (sys_futex0): Return error code.
148 (futex_wake, futex_wait): If ENOSYS was returned, clear
149 FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
150 * config/linux/s390/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
151 (sys_futex0): Return error code.
152 (futex_wake, futex_wait): If ENOSYS was returned, clear
153 FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
154 * config/linux/ia64/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
155 (sys_futex0): Return error code.
156 (futex_wake, futex_wait): If ENOSYS was returned, clear
157 FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
158 * config/linux/sparc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
159 (sys_futex0): Return error code.
160 (futex_wake, futex_wait): If ENOSYS was returned, clear
161 FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
162
1632008-03-18 Jakub Jelinek <jakub@redhat.com>
164
165 * libgomp.h (struct gomp_work_share): Add mode field. Put lock and
166 next into a different cache line from most of the write-once fields.
167 * loop.c: Include limits.h.
168 (gomp_loop_init): For GFS_DYNAMIC, multiply ws->chunk_size by incr.
169 If adding ws->chunk_size nthreads + 1 times after end won't
170 overflow, set ws->mode to 1.
171 * iter.c (gomp_iter_dynamic_next_locked): Don't multiply
172 ws->chunk_size by incr.
173 (gomp_iter_dynamic_next): Likewise. If ws->mode, use more efficient
174 code.
175 * work.c: Include stddef.h.
176 (gomp_new_work_share): Use offsetof rather than sizeof.
177
1782008-03-17 Jakub Jelinek <jakub@redhat.com>
179
180 * libgomp.h (struct gomp_team): Change ordered_release field
181 into gomp_sem_t ** from flexible array member. Add implicit_task
182 and initial_work_shares fields.
183 (gomp_new_task): Removed.
184 (gomp_init_task): New prototype.
185 * team.c (new_team): Allocate implicit_task for each thread
186 and initial work_shares together with gomp_team allocation.
187 (free_team): Only free work_shares if it is not init_work_shares.
188 (gomp_team_start): Use gomp_init_task instead of gomp_new_task,
189 set thr->task to the corresponding implicit_task array entry.
190 * task.c (gomp_new_task): Removed.
191 (gomp_init_task): New function.
192 (gomp_end_task): Don't free the task.
193 (GOMP_task): Allocate struct gomp_task on the stack, call
194 gomp_init_task rather than gomp_new_task.
195 * work.c (gomp_work_share_start): If work_shares ==
196 init_work_shares, gomp_malloc + memcpy rather than gomp_realloc.
197
1982008-03-15 Jakub Jelinek <jakub@redhat.com>
199 Ulrich Drepper <drepper@redhat.com>
200
201 * config/linux/bar.h (gomp_barrier_state_t): Rewritten.
202 (gomp_barrier_state_t): Change to unsigned int.
203 (gomp_barrier_init, gomp_barrier_reinit, gomp_barrier_destroy,
204 gomp_barrier_wait_start, gomp_barrier_last_thread): Rewritten.
205 (gomp_barrier_wait_last): Prototype rather than inline.
206 * config/linux/bar.c (gomp_barrier_wait_end): Rewritten.
207 (gomp_barrier_wait_last): New function.
208
2092008-03-15 Jakub Jelinek <jakub@redhat.com>
210
211 * team.c (gomp_thread_start): Use gomp_barrier_wait_last instead
212 of gomp_barrier_wait.
213 * env.c (gomp_block_time_var, gomp_spin_count_var): New variables.
214 (parse_millis): New function.
215 (initialize_env): Handle GOMP_BLOCKTIME env var.
216 * libgomp.h (struct gomp_team): Move close to the end of the struct.
217 (gomp_spin_count_var): New extern var decl.
218 * work.c (gomp_work_share_end): Use gomp_barrier_state_t bstate
219 var instead of bool last, call gomp_barrier_last_thread to check
220 for last thread, pass bstate to gomp_barrier_wait_end.
221 * config/linux/wait.h: New file.
222 * config/linux/mutex.c: Include wait.h instead of libgomp.h and
223 futex.h.
224 (gomp_mutex_lock_slow): Call do_wait instead of futex_wait.
225 * config/linux/bar.c: Include wait.h instead of libgomp.h and
226 futex.h.
227 (gomp_barrier_wait_end): Change second argument to
228 gomp_barrier_state_t. Call do_wait instead of futex_wait.
229 * config/linux/sem.c: Include wait.h instead of libgomp.h and
230 futex.h.
231 (gomp_sem_wait_slow): Call do_wait instead of futex_wait.
232 * config/linux/lock.c: Include wait.h instead of libgomp.h and
233 futex.h.
234 (gomp_set_nest_lock_25): Call do_wait instead of futex_wait.
235 * config/linux/affinity.c: Assume HAVE_SYNC_BUILTINS.
236 * config/linux/bar.h (gomp_barrier_state_t): New typedef.
237 (gomp_barrier_wait_end): Change second argument to
238 gomp_barrier_state_t.
239 (gomp_barrier_wait_start): Return gomp_barrier_state_t.
240 (gomp_barrier_last_thread, gomp_barrier_wait_last): New static
241 inlines.
242 * config/linux/powerpc/futex.h (cpu_relax, atomic_write_barrier): New
243 static inlines.
244 * config/linux/alpha/futex.h (cpu_relax, atomic_write_barrier):
245 Likewise.
246 * config/linux/x86/futex.h (cpu_relax, atomic_write_barrier):
247 Likewise.
248 * config/linux/s390/futex.h (cpu_relax, atomic_write_barrier):
249 Likewise.
250 * config/linux/ia64/futex.h (cpu_relax, atomic_write_barrier):
251 Likewise.
252 * config/linux/sparc/futex.h (cpu_relax, atomic_write_barrier):
253 Likewise.
254 * config/posix/bar.c (gomp_barrier_wait_end): Change second argument
255 to gomp_barrier_state_t.
256 * config/posix/bar.h (gomp_barrier_state_t): New typedef.
257 (gomp_barrier_wait_end): Change second argument to
258 gomp_barrier_state_t.
259 (gomp_barrier_wait_start): Return gomp_barrier_state_t.
260 (gomp_barrier_last_thread, gomp_barrier_wait_last): New static
261 inlines.
262
263--- libgomp/parallel.c.jj 2007-12-07 14:41:01.000000000 +0100
264+++ libgomp/parallel.c 2008-03-26 15:32:06.000000000 +0100
265@@ -68,7 +68,7 @@ void
266 GOMP_parallel_start (void (*fn) (void *), void *data, unsigned num_threads)
267 {
268 num_threads = gomp_resolve_num_threads (num_threads);
269- gomp_team_start (fn, data, num_threads, NULL);
270+ gomp_team_start (fn, data, num_threads, gomp_new_team (num_threads));
271 }
272
273 void
274--- libgomp/sections.c.jj 2007-12-07 14:41:01.000000000 +0100
275+++ libgomp/sections.c 2008-03-26 15:33:06.000000000 +0100
276@@ -59,14 +59,24 @@ GOMP_sections_start (unsigned count)
277 long s, e, ret;
278
279 if (gomp_work_share_start (false))
280- gomp_sections_init (thr->ts.work_share, count);
281+ {
282+ gomp_sections_init (thr->ts.work_share, count);
283+ gomp_work_share_init_done ();
284+ }
285
286+#ifdef HAVE_SYNC_BUILTINS
287+ if (gomp_iter_dynamic_next (&s, &e))
288+ ret = s;
289+ else
290+ ret = 0;
291+#else
292+ gomp_mutex_lock (&thr->ts.work_share->lock);
293 if (gomp_iter_dynamic_next_locked (&s, &e))
294 ret = s;
295 else
296 ret = 0;
297-
298 gomp_mutex_unlock (&thr->ts.work_share->lock);
299+#endif
300
301 return ret;
302 }
303@@ -83,15 +93,23 @@ GOMP_sections_start (unsigned count)
304 unsigned
305 GOMP_sections_next (void)
306 {
307- struct gomp_thread *thr = gomp_thread ();
308 long s, e, ret;
309
310+#ifdef HAVE_SYNC_BUILTINS
311+ if (gomp_iter_dynamic_next (&s, &e))
312+ ret = s;
313+ else
314+ ret = 0;
315+#else
316+ struct gomp_thread *thr = gomp_thread ();
317+
318 gomp_mutex_lock (&thr->ts.work_share->lock);
319 if (gomp_iter_dynamic_next_locked (&s, &e))
320 ret = s;
321 else
322 ret = 0;
323 gomp_mutex_unlock (&thr->ts.work_share->lock);
324+#endif
325
326 return ret;
327 }
328@@ -103,15 +121,15 @@ void
329 GOMP_parallel_sections_start (void (*fn) (void *), void *data,
330 unsigned num_threads, unsigned count)
331 {
332- struct gomp_work_share *ws;
333+ struct gomp_team *team;
334
335 num_threads = gomp_resolve_num_threads (num_threads);
336 if (gomp_dyn_var && num_threads > count)
337 num_threads = count;
338
339- ws = gomp_new_work_share (false, num_threads);
340- gomp_sections_init (ws, count);
341- gomp_team_start (fn, data, num_threads, ws);
342+ team = gomp_new_team (num_threads);
343+ gomp_sections_init (&team->work_shares[0], count);
344+ gomp_team_start (fn, data, num_threads, team);
345 }
346
347 /* The GOMP_section_end* routines are called after the thread is told
348--- libgomp/env.c.jj 2007-12-07 14:41:01.000000000 +0100
349+++ libgomp/env.c 2008-03-26 16:40:26.000000000 +0100
350@@ -44,6 +44,11 @@ enum gomp_schedule_type gomp_run_sched_v
351 unsigned long gomp_run_sched_chunk = 1;
352 unsigned short *gomp_cpu_affinity;
353 size_t gomp_cpu_affinity_len;
354+#ifndef HAVE_SYNC_BUILTINS
355+gomp_mutex_t gomp_remaining_threads_lock;
356+#endif
357+unsigned long gomp_available_cpus = 1, gomp_managed_threads = 1;
358+unsigned long long gomp_spin_count_var, gomp_throttled_spin_count_var;
359
360 /* Parse the OMP_SCHEDULE environment variable. */
361
362@@ -147,6 +152,79 @@ parse_unsigned_long (const char *name, u
363 return false;
364 }
365
366+/* Parse the GOMP_SPINCOUNT environment varible. Return true if one was
367+ present and it was successfully parsed. */
368+
369+static bool
370+parse_spincount (const char *name, unsigned long long *pvalue)
371+{
372+ char *env, *end;
373+ unsigned long long value, mult = 1;
374+
375+ env = getenv (name);
376+ if (env == NULL)
377+ return false;
378+
379+ while (isspace ((unsigned char) *env))
380+ ++env;
381+ if (*env == '\0')
382+ goto invalid;
383+
384+ if (strncasecmp (env, "infinite", 8) == 0
385+ || strncasecmp (env, "infinity", 8) == 0)
386+ {
387+ value = ~0ULL;
388+ end = env + 8;
389+ goto check_tail;
390+ }
391+
392+ errno = 0;
393+ value = strtoull (env, &end, 10);
394+ if (errno)
395+ goto invalid;
396+
397+ while (isspace ((unsigned char) *end))
398+ ++end;
399+ if (*end != '\0')
400+ {
401+ switch (tolower (*end))
402+ {
403+ case 'k':
404+ mult = 1000LL;
405+ break;
406+ case 'm':
407+ mult = 1000LL * 1000LL;
408+ break;
409+ case 'g':
410+ mult = 1000LL * 1000LL * 1000LL;
411+ break;
412+ case 't':
413+ mult = 1000LL * 1000LL * 1000LL * 1000LL;
414+ break;
415+ default:
416+ goto invalid;
417+ }
418+ ++end;
419+ check_tail:
420+ while (isspace ((unsigned char) *end))
421+ ++end;
422+ if (*end != '\0')
423+ goto invalid;
424+ }
425+
426+ if (value > ~0ULL / mult)
427+ value = ~0ULL;
428+ else
429+ value *= mult;
430+
431+ *pvalue = value;
432+ return true;
433+
434+ invalid:
435+ gomp_error ("Invalid value for environment variable %s", name);
436+ return false;
437+}
438+
439 /* Parse a boolean value for environment variable NAME and store the
440 result in VALUE. */
441
442@@ -281,10 +359,25 @@ initialize_env (void)
443 parse_schedule ();
444 parse_boolean ("OMP_DYNAMIC", &gomp_dyn_var);
445 parse_boolean ("OMP_NESTED", &gomp_nest_var);
446+ gomp_init_num_threads ();
447+ gomp_available_cpus = gomp_nthreads_var;
448 if (!parse_unsigned_long ("OMP_NUM_THREADS", &gomp_nthreads_var))
449- gomp_init_num_threads ();
450+ gomp_nthreads_var = gomp_available_cpus;
451 if (parse_affinity ())
452 gomp_init_affinity ();
453+ if (!parse_spincount ("GOMP_SPINCOUNT", &gomp_spin_count_var))
454+ {
455+ /* Using a rough estimation of 100000 spins per msec,
456+ use 200 msec blocking.
457+ Depending on the CPU speed, this can be e.g. 5 times longer
458+ or 5 times shorter. */
459+ gomp_spin_count_var = 20000000LL;
460+ }
461+ /* gomp_throttled_spin_count_var is used when there are more libgomp
462+ managed threads than available CPUs. Use very short spinning. */
463+ gomp_throttled_spin_count_var = 100LL;
464+ if (gomp_throttled_spin_count_var > gomp_spin_count_var)
465+ gomp_throttled_spin_count_var = gomp_spin_count_var;
466
467 /* Not strictly environment related, but ordering constructors is tricky. */
468 pthread_attr_init (&gomp_thread_attr);
469--- libgomp/libgomp.h.jj 2007-12-07 14:41:01.000000000 +0100
470+++ libgomp/libgomp.h 2008-03-27 12:21:51.000000000 +0100
471@@ -50,6 +50,7 @@
472 #include "sem.h"
473 #include "mutex.h"
474 #include "bar.h"
475+#include "ptrlock.h"
476
477
478 /* This structure contains the data to control one work-sharing construct,
479@@ -70,6 +71,8 @@ struct gomp_work_share
480 If this is a SECTIONS construct, this value will always be DYNAMIC. */
481 enum gomp_schedule_type sched;
482
483+ int mode;
484+
485 /* This is the chunk_size argument to the SCHEDULE clause. */
486 long chunk_size;
487
488@@ -81,17 +84,38 @@ struct gomp_work_share
489 is always 1. */
490 long incr;
491
492- /* This lock protects the update of the following members. */
493- gomp_mutex_t lock;
494+ /* This is a circular queue that details which threads will be allowed
495+ into the ordered region and in which order. When a thread allocates
496+ iterations on which it is going to work, it also registers itself at
497+ the end of the array. When a thread reaches the ordered region, it
498+ checks to see if it is the one at the head of the queue. If not, it
499+ blocks on its RELEASE semaphore. */
500+ unsigned *ordered_team_ids;
501
502- union {
503- /* This is the next iteration value to be allocated. In the case of
504- GFS_STATIC loops, this the iteration start point and never changes. */
505- long next;
506+ /* This is the number of threads that have registered themselves in
507+ the circular queue ordered_team_ids. */
508+ unsigned ordered_num_used;
509
510- /* This is the returned data structure for SINGLE COPYPRIVATE. */
511- void *copyprivate;
512- };
513+ /* This is the team_id of the currently acknowledged owner of the ordered
514+ section, or -1u if the ordered section has not been acknowledged by
515+ any thread. This is distinguished from the thread that is *allowed*
516+ to take the section next. */
517+ unsigned ordered_owner;
518+
519+ /* This is the index into the circular queue ordered_team_ids of the
520+ current thread that's allowed into the ordered reason. */
521+ unsigned ordered_cur;
522+
523+ /* This is a chain of allocated gomp_work_share blocks, valid only
524+ in the first gomp_work_share struct in the block. */
525+ struct gomp_work_share *next_alloc;
526+
527+ /* The above fields are written once during workshare initialization,
528+ or related to ordered worksharing. Make sure the following fields
529+ are in a different cache line. */
530+
531+ /* This lock protects the update of the following members. */
532+ gomp_mutex_t lock __attribute__((aligned (64)));
533
534 /* This is the count of the number of threads that have exited the work
535 share construct. If the construct was marked nowait, they have moved on
536@@ -99,27 +123,28 @@ struct gomp_work_share
537 of the team to exit the work share construct must deallocate it. */
538 unsigned threads_completed;
539
540- /* This is the index into the circular queue ordered_team_ids of the
541- current thread that's allowed into the ordered reason. */
542- unsigned ordered_cur;
543+ union {
544+ /* This is the next iteration value to be allocated. In the case of
545+ GFS_STATIC loops, this the iteration start point and never changes. */
546+ long next;
547
548- /* This is the number of threads that have registered themselves in
549- the circular queue ordered_team_ids. */
550- unsigned ordered_num_used;
551+ /* This is the returned data structure for SINGLE COPYPRIVATE. */
552+ void *copyprivate;
553+ };
554
555- /* This is the team_id of the currently acknoledged owner of the ordered
556- section, or -1u if the ordered section has not been acknowledged by
557- any thread. This is distinguished from the thread that is *allowed*
558- to take the section next. */
559- unsigned ordered_owner;
560+ union {
561+ /* Link to gomp_work_share struct for next work sharing construct
562+ encountered after this one. */
563+ gomp_ptrlock_t next_ws;
564+
565+ /* gomp_work_share structs are chained in the free work share cache
566+ through this. */
567+ struct gomp_work_share *next_free;
568+ };
569
570- /* This is a circular queue that details which threads will be allowed
571- into the ordered region and in which order. When a thread allocates
572- iterations on which it is going to work, it also registers itself at
573- the end of the array. When a thread reaches the ordered region, it
574- checks to see if it is the one at the head of the queue. If not, it
575- blocks on its RELEASE semaphore. */
576- unsigned ordered_team_ids[];
577+ /* If only few threads are in the team, ordered_team_ids can point
578+ to this array which fills the padding at the end of this struct. */
579+ unsigned inline_ordered_team_ids[0];
580 };
581
582 /* This structure contains all of the thread-local data associated with
583@@ -133,21 +158,24 @@ struct gomp_team_state
584
585 /* This is the work share construct which this thread is currently
586 processing. Recall that with NOWAIT, not all threads may be
587- processing the same construct. This value is NULL when there
588- is no construct being processed. */
589+ processing the same construct. */
590 struct gomp_work_share *work_share;
591
592+ /* This is the previous work share construct or NULL if there wasn't any.
593+ When all threads are done with the current work sharing construct,
594+ the previous one can be freed. The current one can't, as its
595+ next_ws field is used. */
596+ struct gomp_work_share *last_work_share;
597+
598 /* This is the ID of this thread within the team. This value is
599 guaranteed to be between 0 and N-1, where N is the number of
600 threads in the team. */
601 unsigned team_id;
602
603- /* The work share "generation" is a number that increases by one for
604- each work share construct encountered in the dynamic flow of the
605- program. It is used to find the control data for the work share
606- when encountering it for the first time. This particular number
607- reflects the generation of the work_share member of this struct. */
608- unsigned work_share_generation;
609+#ifdef HAVE_SYNC_BUILTINS
610+ /* Number of single stmts encountered. */
611+ unsigned long single_count;
612+#endif
613
614 /* For GFS_RUNTIME loops that resolved to GFS_STATIC, this is the
615 trip number through the loop. So first time a particular loop
616@@ -163,41 +191,53 @@ struct gomp_team_state
617
618 struct gomp_team
619 {
620- /* This lock protects access to the following work shares data structures. */
621- gomp_mutex_t work_share_lock;
622-
623- /* This is a dynamically sized array containing pointers to the control
624- structs for all "live" work share constructs. Here "live" means that
625- the construct has been encountered by at least one thread, and not
626- completed by all threads. */
627- struct gomp_work_share **work_shares;
628-
629- /* The work_shares array is indexed by "generation & generation_mask".
630- The mask will be 2**N - 1, where 2**N is the size of the array. */
631- unsigned generation_mask;
632-
633- /* These two values define the bounds of the elements of the work_shares
634- array that are currently in use. */
635- unsigned oldest_live_gen;
636- unsigned num_live_gen;
637-
638 /* This is the number of threads in the current team. */
639 unsigned nthreads;
640
641+ /* This is number of gomp_work_share structs that have been allocated
642+ as a block last time. */
643+ unsigned work_share_chunk;
644+
645 /* This is the saved team state that applied to a master thread before
646 the current thread was created. */
647 struct gomp_team_state prev_ts;
648
649- /* This barrier is used for most synchronization of the team. */
650- gomp_barrier_t barrier;
651-
652 /* This semaphore should be used by the master thread instead of its
653 "native" semaphore in the thread structure. Required for nested
654 parallels, as the master is a member of two teams. */
655 gomp_sem_t master_release;
656
657- /* This array contains pointers to the release semaphore of the threads
658- in the team. */
659+ /* List of gomp_work_share structs chained through next_free fields.
660+ This is populated and taken off only by the first thread in the
661+ team encountering a new work sharing construct, in a critical
662+ section. */
663+ struct gomp_work_share *work_share_list_alloc;
664+
665+ /* List of gomp_work_share structs freed by free_work_share. New
666+ entries are atomically added to the start of the list, and
667+ alloc_work_share can safely only move all but the first entry
668+ to work_share_list alloc, as free_work_share can happen concurrently
669+ with alloc_work_share. */
670+ struct gomp_work_share *work_share_list_free;
671+
672+#ifdef HAVE_SYNC_BUILTINS
673+ /* Number of simple single regions encountered by threads in this
674+ team. */
675+ unsigned long single_count;
676+#else
677+ /* Mutex protecting addition of workshares to work_share_list_free. */
678+ gomp_mutex_t work_share_list_free_lock;
679+#endif
680+
681+ /* This barrier is used for most synchronization of the team. */
682+ gomp_barrier_t barrier;
683+
684+ /* Initial work shares, to avoid allocating any gomp_work_share
685+ structs in the common case. */
686+ struct gomp_work_share work_shares[8];
687+
688+ /* This is an array with pointers to the release semaphore
689+ of the threads in the team. */
690 gomp_sem_t *ordered_release[];
691 };
692
693@@ -242,6 +282,11 @@ extern bool gomp_dyn_var;
694 extern bool gomp_nest_var;
695 extern enum gomp_schedule_type gomp_run_sched_var;
696 extern unsigned long gomp_run_sched_chunk;
697+#ifndef HAVE_SYNC_BUILTINS
698+extern gomp_mutex_t gomp_remaining_threads_lock;
699+#endif
700+extern unsigned long long gomp_spin_count_var, gomp_throttled_spin_count_var;
701+extern unsigned long gomp_available_cpus, gomp_managed_threads;
702
703 /* The attributes to be used during thread creation. */
704 extern pthread_attr_t gomp_thread_attr;
705@@ -306,17 +351,27 @@ extern unsigned gomp_dynamic_max_threads
706
707 /* team.c */
708
709+extern struct gomp_team *gomp_new_team (unsigned);
710 extern void gomp_team_start (void (*) (void *), void *, unsigned,
711- struct gomp_work_share *);
712+ struct gomp_team *);
713 extern void gomp_team_end (void);
714
715 /* work.c */
716
717-extern struct gomp_work_share * gomp_new_work_share (bool, unsigned);
718+extern void gomp_init_work_share (struct gomp_work_share *, bool, unsigned);
719+extern void gomp_fini_work_share (struct gomp_work_share *);
720 extern bool gomp_work_share_start (bool);
721 extern void gomp_work_share_end (void);
722 extern void gomp_work_share_end_nowait (void);
723
724+static inline void
725+gomp_work_share_init_done (void)
726+{
727+ struct gomp_thread *thr = gomp_thread ();
728+ if (__builtin_expect (thr->ts.last_work_share != NULL, 1))
729+ gomp_ptrlock_set (&thr->ts.last_work_share->next_ws, thr->ts.work_share);
730+}
731+
732 #ifdef HAVE_ATTRIBUTE_VISIBILITY
733 # pragma GCC visibility pop
734 #endif
735--- libgomp/iter.c.jj 2008-03-26 14:48:34.000000000 +0100
736+++ libgomp/iter.c 2008-03-26 15:11:23.000000000 +0100
737@@ -1,4 +1,4 @@
738-/* Copyright (C) 2005 Free Software Foundation, Inc.
739+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
740 Contributed by Richard Henderson <rth@redhat.com>.
741
742 This file is part of the GNU OpenMP Library (libgomp).
743@@ -154,7 +154,7 @@ gomp_iter_dynamic_next_locked (long *pst
744 if (start == ws->end)
745 return false;
746
747- chunk = ws->chunk_size * ws->incr;
748+ chunk = ws->chunk_size;
749 left = ws->end - start;
750 if (ws->incr < 0)
751 {
752@@ -186,11 +186,38 @@ gomp_iter_dynamic_next (long *pstart, lo
753 struct gomp_work_share *ws = thr->ts.work_share;
754 long start, end, nend, chunk, incr;
755
756- start = ws->next;
757 end = ws->end;
758 incr = ws->incr;
759- chunk = ws->chunk_size * incr;
760+ chunk = ws->chunk_size;
761+
762+ if (__builtin_expect (ws->mode, 1))
763+ {
764+ long tmp = __sync_fetch_and_add (&ws->next, chunk);
765+ if (incr > 0)
766+ {
767+ if (tmp >= end)
768+ return false;
769+ nend = tmp + chunk;
770+ if (nend > end)
771+ nend = end;
772+ *pstart = tmp;
773+ *pend = nend;
774+ return true;
775+ }
776+ else
777+ {
778+ if (tmp <= end)
779+ return false;
780+ nend = tmp + chunk;
781+ if (nend < end)
782+ nend = end;
783+ *pstart = tmp;
784+ *pend = nend;
785+ return true;
786+ }
787+ }
788
789+ start = ws->next;
790 while (1)
791 {
792 long left = end - start;
793--- libgomp/work.c.jj 2007-12-07 14:41:01.000000000 +0100
794+++ libgomp/work.c 2008-03-27 12:21:51.000000000 +0100
795@@ -1,4 +1,4 @@
796-/* Copyright (C) 2005 Free Software Foundation, Inc.
797+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
798 Contributed by Richard Henderson <rth@redhat.com>.
799
800 This file is part of the GNU OpenMP Library (libgomp).
801@@ -29,39 +29,138 @@
802 of threads. */
803
804 #include "libgomp.h"
805+#include <stddef.h>
806 #include <stdlib.h>
807 #include <string.h>
808
809
810-/* Create a new work share structure. */
811+/* Allocate a new work share structure, preferably from current team's
812+ free gomp_work_share cache. */
813
814-struct gomp_work_share *
815-gomp_new_work_share (bool ordered, unsigned nthreads)
816+static struct gomp_work_share *
817+alloc_work_share (struct gomp_team *team)
818 {
819 struct gomp_work_share *ws;
820- size_t size;
821+ unsigned int i;
822
823- size = sizeof (*ws);
824- if (ordered)
825- size += nthreads * sizeof (ws->ordered_team_ids[0]);
826+ /* This is called in a critical section. */
827+ if (team->work_share_list_alloc != NULL)
828+ {
829+ ws = team->work_share_list_alloc;
830+ team->work_share_list_alloc = ws->next_free;
831+ return ws;
832+ }
833
834- ws = gomp_malloc_cleared (size);
835- gomp_mutex_init (&ws->lock);
836- ws->ordered_owner = -1;
837+#ifdef HAVE_SYNC_BUILTINS
838+ ws = team->work_share_list_free;
839+ /* We need atomic read from work_share_list_free,
840+ as free_work_share can be called concurrently. */
841+ __asm ("" : "+r" (ws));
842+
843+ if (ws && ws->next_free)
844+ {
845+ struct gomp_work_share *next = ws->next_free;
846+ ws->next_free = NULL;
847+ team->work_share_list_alloc = next->next_free;
848+ return next;
849+ }
850+#else
851+ gomp_mutex_lock (&team->work_share_list_free_lock);
852+ ws = team->work_share_list_free;
853+ if (ws)
854+ {
855+ team->work_share_list_alloc = ws->next_free;
856+ team->work_share_list_free = NULL;
857+ gomp_mutex_unlock (&team->work_share_list_free_lock);
858+ return ws;
859+ }
860+ gomp_mutex_unlock (&team->work_share_list_free_lock);
861+#endif
862
863+ team->work_share_chunk *= 2;
864+ ws = gomp_malloc (team->work_share_chunk * sizeof (struct gomp_work_share));
865+ ws->next_alloc = team->work_shares[0].next_alloc;
866+ team->work_shares[0].next_alloc = ws;
867+ team->work_share_list_alloc = &ws[1];
868+ for (i = 1; i < team->work_share_chunk - 1; i++)
869+ ws[i].next_free = &ws[i + 1];
870+ ws[i].next_free = NULL;
871 return ws;
872 }
873
874+/* Initialize an already allocated struct gomp_work_share.
875+ This shouldn't touch the next_alloc field. */
876+
877+void
878+gomp_init_work_share (struct gomp_work_share *ws, bool ordered,
879+ unsigned nthreads)
880+{
881+ gomp_mutex_init (&ws->lock);
882+ if (__builtin_expect (ordered, 0))
883+ {
884+#define INLINE_ORDERED_TEAM_IDS_CNT \
885+ ((sizeof (struct gomp_work_share) \
886+ - offsetof (struct gomp_work_share, inline_ordered_team_ids)) \
887+ / sizeof (((struct gomp_work_share *) 0)->inline_ordered_team_ids[0]))
888+
889+ if (nthreads > INLINE_ORDERED_TEAM_IDS_CNT)
890+ ws->ordered_team_ids
891+ = gomp_malloc (nthreads * sizeof (*ws->ordered_team_ids));
892+ else
893+ ws->ordered_team_ids = ws->inline_ordered_team_ids;
894+ memset (ws->ordered_team_ids, '\0',
895+ nthreads * sizeof (*ws->ordered_team_ids));
896+ ws->ordered_num_used = 0;
897+ ws->ordered_owner = -1;
898+ ws->ordered_cur = 0;
899+ }
900+ else
901+ ws->ordered_team_ids = NULL;
902+ gomp_ptrlock_init (&ws->next_ws, NULL);
903+ ws->threads_completed = 0;
904+}
905
906-/* Free a work share structure. */
907+/* Do any needed destruction of gomp_work_share fields before it
908+ is put back into free gomp_work_share cache or freed. */
909
910-static void
911-free_work_share (struct gomp_work_share *ws)
912+void
913+gomp_fini_work_share (struct gomp_work_share *ws)
914 {
915 gomp_mutex_destroy (&ws->lock);
916- free (ws);
917+ if (ws->ordered_team_ids != ws->inline_ordered_team_ids)
918+ free (ws->ordered_team_ids);
919+ gomp_ptrlock_destroy (&ws->next_ws);
920 }
921
922+/* Free a work share struct, if not orphaned, put it into current
923+ team's free gomp_work_share cache. */
924+
925+static inline void
926+free_work_share (struct gomp_team *team, struct gomp_work_share *ws)
927+{
928+ gomp_fini_work_share (ws);
929+ if (__builtin_expect (team == NULL, 0))
930+ free (ws);
931+ else
932+ {
933+ struct gomp_work_share *next_ws;
934+#ifdef HAVE_SYNC_BUILTINS
935+ do
936+ {
937+ next_ws = team->work_share_list_free;
938+ ws->next_free = next_ws;
939+ }
940+ while (!__sync_bool_compare_and_swap (&team->work_share_list_free,
941+ next_ws, ws));
942+#else
943+ gomp_mutex_lock (&team->work_share_list_free_lock);
944+ next_ws = team->work_share_list_free;
945+ ws->next_free = next_ws;
946+ team->work_share_list_free = ws;
947+ gomp_mutex_unlock (&team->work_share_list_free_lock);
948+#endif
949+ }
950+}
951
952 /* The current thread is ready to begin the next work sharing construct.
953 In all cases, thr->ts.work_share is updated to point to the new
954@@ -74,71 +173,34 @@ gomp_work_share_start (bool ordered)
955 struct gomp_thread *thr = gomp_thread ();
956 struct gomp_team *team = thr->ts.team;
957 struct gomp_work_share *ws;
958- unsigned ws_index, ws_gen;
959
960 /* Work sharing constructs can be orphaned. */
961 if (team == NULL)
962 {
963- ws = gomp_new_work_share (ordered, 1);
964+ ws = gomp_malloc (sizeof (*ws));
965+ gomp_init_work_share (ws, ordered, 1);
966 thr->ts.work_share = ws;
967- thr->ts.static_trip = 0;
968- gomp_mutex_lock (&ws->lock);
969- return true;
970+ return ws;
971 }
972
973- gomp_mutex_lock (&team->work_share_lock);
974-
975- /* This thread is beginning its next generation. */
976- ws_gen = ++thr->ts.work_share_generation;
977-
978- /* If this next generation is not newer than any other generation in
979- the team, then simply reference the existing construct. */
980- if (ws_gen - team->oldest_live_gen < team->num_live_gen)
981+ ws = thr->ts.work_share;
982+ thr->ts.last_work_share = ws;
983+ ws = gomp_ptrlock_get (&ws->next_ws);
984+ if (ws == NULL)
985 {
986- ws_index = ws_gen & team->generation_mask;
987- ws = team->work_shares[ws_index];
988+ /* This thread encountered a new ws first. */
989+ struct gomp_work_share *ws = alloc_work_share (team);
990+ gomp_init_work_share (ws, ordered, team->nthreads);
991 thr->ts.work_share = ws;
992- thr->ts.static_trip = 0;
993-
994- gomp_mutex_lock (&ws->lock);
995- gomp_mutex_unlock (&team->work_share_lock);
996-
997- return false;
998+ return true;
999 }
1000-
1001- /* Resize the work shares queue if we've run out of space. */
1002- if (team->num_live_gen++ == team->generation_mask)
1003+ else
1004 {
1005- team->work_shares = gomp_realloc (team->work_shares,
1006- 2 * team->num_live_gen
1007- * sizeof (*team->work_shares));
1008-
1009- /* Unless oldest_live_gen is zero, the sequence of live elements
1010- wraps around the end of the array. If we do nothing, we break
1011- lookup of the existing elements. Fix that by unwrapping the
1012- data from the front to the end. */
1013- if (team->oldest_live_gen > 0)
1014- memcpy (team->work_shares + team->num_live_gen,
1015- team->work_shares,
1016- (team->oldest_live_gen & team->generation_mask)
1017- * sizeof (*team->work_shares));
1018-
1019- team->generation_mask = team->generation_mask * 2 + 1;
1020- }
1021-
1022- ws_index = ws_gen & team->generation_mask;
1023- ws = gomp_new_work_share (ordered, team->nthreads);
1024- thr->ts.work_share = ws;
1025- thr->ts.static_trip = 0;
1026- team->work_shares[ws_index] = ws;
1027-
1028- gomp_mutex_lock (&ws->lock);
1029- gomp_mutex_unlock (&team->work_share_lock);
1030-
1031- return true;
1032+ thr->ts.work_share = ws;
1033+ return false;
1034+ }
1035 }
1036
1037-
1038 /* The current thread is done with its current work sharing construct.
1039 This version does imply a barrier at the end of the work-share. */
1040
1041@@ -147,36 +209,28 @@ gomp_work_share_end (void)
1042 {
1043 struct gomp_thread *thr = gomp_thread ();
1044 struct gomp_team *team = thr->ts.team;
1045- struct gomp_work_share *ws = thr->ts.work_share;
1046- bool last;
1047-
1048- thr->ts.work_share = NULL;
1049+ gomp_barrier_state_t bstate;
1050
1051 /* Work sharing constructs can be orphaned. */
1052 if (team == NULL)
1053 {
1054- free_work_share (ws);
1055+ free_work_share (NULL, thr->ts.work_share);
1056+ thr->ts.work_share = NULL;
1057 return;
1058 }
1059
1060- last = gomp_barrier_wait_start (&team->barrier);
1061+ bstate = gomp_barrier_wait_start (&team->barrier);
1062
1063- if (last)
1064+ if (gomp_barrier_last_thread (bstate))
1065 {
1066- unsigned ws_index;
1067-
1068- ws_index = thr->ts.work_share_generation & team->generation_mask;
1069- team->work_shares[ws_index] = NULL;
1070- team->oldest_live_gen++;
1071- team->num_live_gen = 0;
1072-
1073- free_work_share (ws);
1074+ if (__builtin_expect (thr->ts.last_work_share != NULL, 1))
1075+ free_work_share (team, thr->ts.last_work_share);
1076 }
1077
1078- gomp_barrier_wait_end (&team->barrier, last);
1079+ gomp_barrier_wait_end (&team->barrier, bstate);
1080+ thr->ts.last_work_share = NULL;
1081 }
1082
1083-
1084 /* The current thread is done with its current work sharing construct.
1085 This version does NOT imply a barrier at the end of the work-share. */
1086
1087@@ -188,15 +242,17 @@ gomp_work_share_end_nowait (void)
1088 struct gomp_work_share *ws = thr->ts.work_share;
1089 unsigned completed;
1090
1091- thr->ts.work_share = NULL;
1092-
1093 /* Work sharing constructs can be orphaned. */
1094 if (team == NULL)
1095 {
1096- free_work_share (ws);
1097+ free_work_share (NULL, ws);
1098+ thr->ts.work_share = NULL;
1099 return;
1100 }
1101
1102+ if (__builtin_expect (thr->ts.last_work_share == NULL, 0))
1103+ return;
1104+
1105 #ifdef HAVE_SYNC_BUILTINS
1106 completed = __sync_add_and_fetch (&ws->threads_completed, 1);
1107 #else
1108@@ -206,18 +262,6 @@ gomp_work_share_end_nowait (void)
1109 #endif
1110
1111 if (completed == team->nthreads)
1112- {
1113- unsigned ws_index;
1114-
1115- gomp_mutex_lock (&team->work_share_lock);
1116-
1117- ws_index = thr->ts.work_share_generation & team->generation_mask;
1118- team->work_shares[ws_index] = NULL;
1119- team->oldest_live_gen++;
1120- team->num_live_gen--;
1121-
1122- gomp_mutex_unlock (&team->work_share_lock);
1123-
1124- free_work_share (ws);
1125- }
1126+ free_work_share (team, thr->ts.last_work_share);
1127+ thr->ts.last_work_share = NULL;
1128 }
1129--- libgomp/single.c.jj 2007-12-07 14:41:01.000000000 +0100
1130+++ libgomp/single.c 2008-03-26 15:11:32.000000000 +0100
1131@@ -1,4 +1,4 @@
1132-/* Copyright (C) 2005 Free Software Foundation, Inc.
1133+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
1134 Contributed by Richard Henderson <rth@redhat.com>.
1135
1136 This file is part of the GNU OpenMP Library (libgomp).
1137@@ -37,10 +37,24 @@
1138 bool
1139 GOMP_single_start (void)
1140 {
1141+#ifdef HAVE_SYNC_BUILTINS
1142+ struct gomp_thread *thr = gomp_thread ();
1143+ struct gomp_team *team = thr->ts.team;
1144+ unsigned long single_count;
1145+
1146+ if (__builtin_expect (team == NULL, 0))
1147+ return true;
1148+
1149+ single_count = thr->ts.single_count++;
1150+ return __sync_bool_compare_and_swap (&team->single_count, single_count,
1151+ single_count + 1L);
1152+#else
1153 bool ret = gomp_work_share_start (false);
1154- gomp_mutex_unlock (&gomp_thread ()->ts.work_share->lock);
1155+ if (ret)
1156+ gomp_work_share_init_done ();
1157 gomp_work_share_end_nowait ();
1158 return ret;
1159+#endif
1160 }
1161
1162 /* This routine is called when first encountering a SINGLE construct that
1163@@ -57,10 +71,12 @@ GOMP_single_copy_start (void)
1164 void *ret;
1165
1166 first = gomp_work_share_start (false);
1167- gomp_mutex_unlock (&thr->ts.work_share->lock);
1168
1169 if (first)
1170- ret = NULL;
1171+ {
1172+ gomp_work_share_init_done ();
1173+ ret = NULL;
1174+ }
1175 else
1176 {
1177 gomp_barrier_wait (&thr->ts.team->barrier);
1178--- libgomp/loop.c.jj 2007-12-07 14:41:01.000000000 +0100
1179+++ libgomp/loop.c 2008-03-26 18:47:04.000000000 +0100
1180@@ -27,8 +27,9 @@
1181
1182 /* This file handles the LOOP (FOR/DO) construct. */
1183
1184-#include "libgomp.h"
1185+#include <limits.h>
1186 #include <stdlib.h>
1187+#include "libgomp.h"
1188
1189
1190 /* Initialize the given work share construct from the given arguments. */
1191@@ -44,6 +45,39 @@ gomp_loop_init (struct gomp_work_share *
1192 ? start : end;
1193 ws->incr = incr;
1194 ws->next = start;
1195+ if (sched == GFS_DYNAMIC)
1196+ {
1197+ ws->chunk_size *= incr;
1198+
1199+#ifdef HAVE_SYNC_BUILTINS
1200+ {
1201+ /* For dynamic scheduling prepare things to make each iteration
1202+ faster. */
1203+ struct gomp_thread *thr = gomp_thread ();
1204+ struct gomp_team *team = thr->ts.team;
1205+ long nthreads = team ? team->nthreads : 1;
1206+
1207+ if (__builtin_expect (incr > 0, 1))
1208+ {
1209+ /* Cheap overflow protection. */
1210+ if (__builtin_expect ((nthreads | ws->chunk_size)
1211+ >= 1UL << (sizeof (long)
1212+ * __CHAR_BIT__ / 2 - 1), 0))
1213+ ws->mode = 0;
1214+ else
1215+ ws->mode = ws->end < (LONG_MAX
1216+ - (nthreads + 1) * ws->chunk_size);
1217+ }
1218+ /* Cheap overflow protection. */
1219+ else if (__builtin_expect ((nthreads | -ws->chunk_size)
1220+ >= 1UL << (sizeof (long)
1221+ * __CHAR_BIT__ / 2 - 1), 0))
1222+ ws->mode = 0;
1223+ else
1224+ ws->mode = ws->end > (nthreads + 1) * -ws->chunk_size - LONG_MAX;
1225+ }
1226+#endif
1227+ }
1228 }
1229
1230 /* The *_start routines are called when first encountering a loop construct
1231@@ -68,10 +102,13 @@ gomp_loop_static_start (long start, long
1232 {
1233 struct gomp_thread *thr = gomp_thread ();
1234
1235+ thr->ts.static_trip = 0;
1236 if (gomp_work_share_start (false))
1237- gomp_loop_init (thr->ts.work_share, start, end, incr,
1238- GFS_STATIC, chunk_size);
1239- gomp_mutex_unlock (&thr->ts.work_share->lock);
1240+ {
1241+ gomp_loop_init (thr->ts.work_share, start, end, incr,
1242+ GFS_STATIC, chunk_size);
1243+ gomp_work_share_init_done ();
1244+ }
1245
1246 return !gomp_iter_static_next (istart, iend);
1247 }
1248@@ -84,13 +121,16 @@ gomp_loop_dynamic_start (long start, lon
1249 bool ret;
1250
1251 if (gomp_work_share_start (false))
1252- gomp_loop_init (thr->ts.work_share, start, end, incr,
1253- GFS_DYNAMIC, chunk_size);
1254+ {
1255+ gomp_loop_init (thr->ts.work_share, start, end, incr,
1256+ GFS_DYNAMIC, chunk_size);
1257+ gomp_work_share_init_done ();
1258+ }
1259
1260 #ifdef HAVE_SYNC_BUILTINS
1261- gomp_mutex_unlock (&thr->ts.work_share->lock);
1262 ret = gomp_iter_dynamic_next (istart, iend);
1263 #else
1264+ gomp_mutex_lock (&thr->ts.work_share->lock);
1265 ret = gomp_iter_dynamic_next_locked (istart, iend);
1266 gomp_mutex_unlock (&thr->ts.work_share->lock);
1267 #endif
1268@@ -106,13 +146,16 @@ gomp_loop_guided_start (long start, long
1269 bool ret;
1270
1271 if (gomp_work_share_start (false))
1272- gomp_loop_init (thr->ts.work_share, start, end, incr,
1273- GFS_GUIDED, chunk_size);
1274+ {
1275+ gomp_loop_init (thr->ts.work_share, start, end, incr,
1276+ GFS_GUIDED, chunk_size);
1277+ gomp_work_share_init_done ();
1278+ }
1279
1280 #ifdef HAVE_SYNC_BUILTINS
1281- gomp_mutex_unlock (&thr->ts.work_share->lock);
1282 ret = gomp_iter_guided_next (istart, iend);
1283 #else
1284+ gomp_mutex_lock (&thr->ts.work_share->lock);
1285 ret = gomp_iter_guided_next_locked (istart, iend);
1286 gomp_mutex_unlock (&thr->ts.work_share->lock);
1287 #endif
1288@@ -149,13 +192,14 @@ gomp_loop_ordered_static_start (long sta
1289 {
1290 struct gomp_thread *thr = gomp_thread ();
1291
1292+ thr->ts.static_trip = 0;
1293 if (gomp_work_share_start (true))
1294 {
1295 gomp_loop_init (thr->ts.work_share, start, end, incr,
1296 GFS_STATIC, chunk_size);
1297 gomp_ordered_static_init ();
1298+ gomp_work_share_init_done ();
1299 }
1300- gomp_mutex_unlock (&thr->ts.work_share->lock);
1301
1302 return !gomp_iter_static_next (istart, iend);
1303 }
1304@@ -168,8 +212,14 @@ gomp_loop_ordered_dynamic_start (long st
1305 bool ret;
1306
1307 if (gomp_work_share_start (true))
1308- gomp_loop_init (thr->ts.work_share, start, end, incr,
1309- GFS_DYNAMIC, chunk_size);
1310+ {
1311+ gomp_loop_init (thr->ts.work_share, start, end, incr,
1312+ GFS_DYNAMIC, chunk_size);
1313+ gomp_mutex_lock (&thr->ts.work_share->lock);
1314+ gomp_work_share_init_done ();
1315+ }
1316+ else
1317+ gomp_mutex_lock (&thr->ts.work_share->lock);
1318
1319 ret = gomp_iter_dynamic_next_locked (istart, iend);
1320 if (ret)
1321@@ -187,8 +237,14 @@ gomp_loop_ordered_guided_start (long sta
1322 bool ret;
1323
1324 if (gomp_work_share_start (true))
1325- gomp_loop_init (thr->ts.work_share, start, end, incr,
1326- GFS_GUIDED, chunk_size);
1327+ {
1328+ gomp_loop_init (thr->ts.work_share, start, end, incr,
1329+ GFS_GUIDED, chunk_size);
1330+ gomp_mutex_lock (&thr->ts.work_share->lock);
1331+ gomp_work_share_init_done ();
1332+ }
1333+ else
1334+ gomp_mutex_lock (&thr->ts.work_share->lock);
1335
1336 ret = gomp_iter_guided_next_locked (istart, iend);
1337 if (ret)
1338@@ -375,12 +431,12 @@ gomp_parallel_loop_start (void (*fn) (vo
1339 long incr, enum gomp_schedule_type sched,
1340 long chunk_size)
1341 {
1342- struct gomp_work_share *ws;
1343+ struct gomp_team *team;
1344
1345 num_threads = gomp_resolve_num_threads (num_threads);
1346- ws = gomp_new_work_share (false, num_threads);
1347- gomp_loop_init (ws, start, end, incr, sched, chunk_size);
1348- gomp_team_start (fn, data, num_threads, ws);
1349+ team = gomp_new_team (num_threads);
1350+ gomp_loop_init (&team->work_shares[0], start, end, incr, sched, chunk_size);
1351+ gomp_team_start (fn, data, num_threads, team);
1352 }
1353
1354 void
1355--- libgomp/Makefile.in.jj 2008-01-10 20:53:47.000000000 +0100
1356+++ libgomp/Makefile.in 2008-03-26 18:51:01.000000000 +0100
1357@@ -83,7 +83,7 @@ libgomp_la_LIBADD =
1358 am_libgomp_la_OBJECTS = alloc.lo barrier.lo critical.lo env.lo \
1359 error.lo iter.lo loop.lo ordered.lo parallel.lo sections.lo \
1360 single.lo team.lo work.lo lock.lo mutex.lo proc.lo sem.lo \
1361- bar.lo time.lo fortran.lo affinity.lo
1362+ bar.lo ptrlock.lo time.lo fortran.lo affinity.lo
1363 libgomp_la_OBJECTS = $(am_libgomp_la_OBJECTS)
1364 DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
1365 depcomp = $(SHELL) $(top_srcdir)/../depcomp
1366@@ -292,7 +292,7 @@ libgomp_version_info = -version-info $(l
1367 libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script)
1368 libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
1369 loop.c ordered.c parallel.c sections.c single.c team.c work.c \
1370- lock.c mutex.c proc.c sem.c bar.c time.c fortran.c affinity.c
1371+ lock.c mutex.c proc.c sem.c bar.c ptrlock.c time.c fortran.c affinity.c
1372
1373 nodist_noinst_HEADERS = libgomp_f.h
1374 nodist_libsubinclude_HEADERS = omp.h
1375@@ -434,6 +434,7 @@ distclean-compile:
1376 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordered.Plo@am__quote@
1377 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel.Plo@am__quote@
1378 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@
1379+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptrlock.Plo@am__quote@
1380 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sections.Plo@am__quote@
1381 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sem.Plo@am__quote@
1382 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single.Plo@am__quote@
1383--- libgomp/testsuite/libgomp.c/loop-4.c.jj 2008-03-26 18:47:04.000000000 +0100
1384+++ libgomp/testsuite/libgomp.c/loop-4.c 2008-03-26 18:47:04.000000000 +0100
1385@@ -0,0 +1,28 @@
1386+/* { dg-do run } */
1387+
1388+extern void abort (void);
1389+
1390+int
1391+main (void)
1392+{
1393+ int e = 0;
1394+#pragma omp parallel num_threads (4) reduction(+:e)
1395+ {
1396+ long i;
1397+ #pragma omp for schedule(dynamic,1)
1398+ for (i = __LONG_MAX__ - 30001; i <= __LONG_MAX__ - 10001; i += 10000)
1399+ if (i != __LONG_MAX__ - 30001
1400+ && i != __LONG_MAX__ - 20001
1401+ && i != __LONG_MAX__ - 10001)
1402+ e = 1;
1403+ #pragma omp for schedule(dynamic,1)
1404+ for (i = -__LONG_MAX__ + 30000; i >= -__LONG_MAX__ + 10000; i -= 10000)
1405+ if (i != -__LONG_MAX__ + 30000
1406+ && i != -__LONG_MAX__ + 20000
1407+ && i != -__LONG_MAX__ + 10000)
1408+ e = 1;
1409+ }
1410+ if (e)
1411+ abort ();
1412+ return 0;
1413+}
1414--- libgomp/Makefile.am.jj 2007-12-07 14:41:01.000000000 +0100
1415+++ libgomp/Makefile.am 2008-03-26 15:15:19.000000000 +0100
1416@@ -31,7 +31,7 @@ libgomp_la_LDFLAGS = $(libgomp_version_i
1417
1418 libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
1419 loop.c ordered.c parallel.c sections.c single.c team.c work.c \
1420- lock.c mutex.c proc.c sem.c bar.c time.c fortran.c affinity.c
1421+ lock.c mutex.c proc.c sem.c bar.c ptrlock.c time.c fortran.c affinity.c
1422
1423 nodist_noinst_HEADERS = libgomp_f.h
1424 nodist_libsubinclude_HEADERS = omp.h
1425--- libgomp/team.c.jj 2007-12-07 14:41:01.000000000 +0100
1426+++ libgomp/team.c 2008-03-27 12:22:26.000000000 +0100
1427@@ -94,7 +94,7 @@ gomp_thread_start (void *xdata)
1428 {
1429 gomp_barrier_wait (&thr->ts.team->barrier);
1430 local_fn (local_data);
1431- gomp_barrier_wait (&thr->ts.team->barrier);
1432+ gomp_barrier_wait_last (&thr->ts.team->barrier);
1433 }
1434 else
1435 {
1436@@ -114,11 +114,10 @@ gomp_thread_start (void *xdata)
1437 thr->data = NULL;
1438 thr->ts.team = NULL;
1439 thr->ts.work_share = NULL;
1440+ thr->ts.last_work_share = NULL;
1441 thr->ts.team_id = 0;
1442- thr->ts.work_share_generation = 0;
1443- thr->ts.static_trip = 0;
1444
1445- gomp_barrier_wait (&team->barrier);
1446+ gomp_barrier_wait_last (&team->barrier);
1447 gomp_barrier_wait (&gomp_threads_dock);
1448
1449 local_fn = thr->fn;
1450@@ -133,21 +132,29 @@ gomp_thread_start (void *xdata)
1451
1452 /* Create a new team data structure. */
1453
1454-static struct gomp_team *
1455-new_team (unsigned nthreads, struct gomp_work_share *work_share)
1456+struct gomp_team *
1457+gomp_new_team (unsigned nthreads)
1458 {
1459 struct gomp_team *team;
1460 size_t size;
1461+ int i;
1462
1463 size = sizeof (*team) + nthreads * sizeof (team->ordered_release[0]);
1464 team = gomp_malloc (size);
1465- gomp_mutex_init (&team->work_share_lock);
1466
1467- team->work_shares = gomp_malloc (4 * sizeof (struct gomp_work_share *));
1468- team->generation_mask = 3;
1469- team->oldest_live_gen = work_share == NULL;
1470- team->num_live_gen = work_share != NULL;
1471- team->work_shares[0] = work_share;
1472+ team->work_share_chunk = 8;
1473+#ifdef HAVE_SYNC_BUILTINS
1474+ team->single_count = 0;
1475+#else
1476+ gomp_mutex_init (&team->work_share_list_free_lock);
1477+#endif
1478+ gomp_init_work_share (&team->work_shares[0], false, nthreads);
1479+ team->work_shares[0].next_alloc = NULL;
1480+ team->work_share_list_free = NULL;
1481+ team->work_share_list_alloc = &team->work_shares[1];
1482+ for (i = 1; i < 7; i++)
1483+ team->work_shares[i].next_free = &team->work_shares[i + 1];
1484+ team->work_shares[i].next_free = NULL;
1485
1486 team->nthreads = nthreads;
1487 gomp_barrier_init (&team->barrier, nthreads);
1488@@ -164,10 +171,22 @@ new_team (unsigned nthreads, struct gomp
1489 static void
1490 free_team (struct gomp_team *team)
1491 {
1492- free (team->work_shares);
1493- gomp_mutex_destroy (&team->work_share_lock);
1494+ if (__builtin_expect (team->work_shares[0].next_alloc != NULL, 0))
1495+ {
1496+ struct gomp_work_share *ws = team->work_shares[0].next_alloc;
1497+ do
1498+ {
1499+ struct gomp_work_share *next_ws = ws->next_alloc;
1500+ free (ws);
1501+ ws = next_ws;
1502+ }
1503+ while (ws != NULL);
1504+ }
1505 gomp_barrier_destroy (&team->barrier);
1506 gomp_sem_destroy (&team->master_release);
1507+#ifndef HAVE_SYNC_BUILTINS
1508+ gomp_mutex_destroy (&team->work_share_list_free_lock);
1509+#endif
1510 free (team);
1511 }
1512
1513@@ -176,11 +195,10 @@ free_team (struct gomp_team *team)
1514
1515 void
1516 gomp_team_start (void (*fn) (void *), void *data, unsigned nthreads,
1517- struct gomp_work_share *work_share)
1518+ struct gomp_team *team)
1519 {
1520 struct gomp_thread_start_data *start_data;
1521 struct gomp_thread *thr, *nthr;
1522- struct gomp_team *team;
1523 bool nested;
1524 unsigned i, n, old_threads_used = 0;
1525 pthread_attr_t thread_attr, *attr;
1526@@ -188,17 +206,18 @@ gomp_team_start (void (*fn) (void *), vo
1527 thr = gomp_thread ();
1528 nested = thr->ts.team != NULL;
1529
1530- team = new_team (nthreads, work_share);
1531-
1532 /* Always save the previous state, even if this isn't a nested team.
1533 In particular, we should save any work share state from an outer
1534 orphaned work share construct. */
1535 team->prev_ts = thr->ts;
1536
1537 thr->ts.team = team;
1538- thr->ts.work_share = work_share;
1539 thr->ts.team_id = 0;
1540- thr->ts.work_share_generation = 0;
1541+ thr->ts.work_share = &team->work_shares[0];
1542+ thr->ts.last_work_share = NULL;
1543+#ifdef HAVE_SYNC_BUILTINS
1544+ thr->ts.single_count = 0;
1545+#endif
1546 thr->ts.static_trip = 0;
1547
1548 if (nthreads == 1)
1549@@ -241,9 +260,12 @@ gomp_team_start (void (*fn) (void *), vo
1550 {
1551 nthr = gomp_threads[i];
1552 nthr->ts.team = team;
1553- nthr->ts.work_share = work_share;
1554+ nthr->ts.work_share = &team->work_shares[0];
1555+ nthr->ts.last_work_share = NULL;
1556 nthr->ts.team_id = i;
1557- nthr->ts.work_share_generation = 0;
1558+#ifdef HAVE_SYNC_BUILTINS
1559+ nthr->ts.single_count = 0;
1560+#endif
1561 nthr->ts.static_trip = 0;
1562 nthr->fn = fn;
1563 nthr->data = data;
1564@@ -266,8 +288,24 @@ gomp_team_start (void (*fn) (void *), vo
1565 }
1566 }
1567
1568+ if (__builtin_expect (nthreads > old_threads_used, 0))
1569+ {
1570+ long diff = (long) nthreads - (long) old_threads_used;
1571+
1572+ if (old_threads_used == 0)
1573+ --diff;
1574+
1575+#ifdef HAVE_SYNC_BUILTINS
1576+ __sync_fetch_and_add (&gomp_managed_threads, diff);
1577+#else
1578+ gomp_mutex_lock (&gomp_remaining_threads_lock);
1579+ gomp_managed_threads += diff;
1580+ gomp_mutex_unlock (&gomp_remaining_threads_lock);
1581+#endif
1582+ }
1583+
1584 attr = &gomp_thread_attr;
1585- if (gomp_cpu_affinity != NULL)
1586+ if (__builtin_expect (gomp_cpu_affinity != NULL, 0))
1587 {
1588 size_t stacksize;
1589 pthread_attr_init (&thread_attr);
1590@@ -287,9 +325,12 @@ gomp_team_start (void (*fn) (void *), vo
1591 int err;
1592
1593 start_data->ts.team = team;
1594- start_data->ts.work_share = work_share;
1595+ start_data->ts.work_share = &team->work_shares[0];
1596+ start_data->ts.last_work_share = NULL;
1597 start_data->ts.team_id = i;
1598- start_data->ts.work_share_generation = 0;
1599+#ifdef HAVE_SYNC_BUILTINS
1600+ start_data->ts.single_count = 0;
1601+#endif
1602 start_data->ts.static_trip = 0;
1603 start_data->fn = fn;
1604 start_data->fn_data = data;
1605@@ -303,7 +344,7 @@ gomp_team_start (void (*fn) (void *), vo
1606 gomp_fatal ("Thread creation failed: %s", strerror (err));
1607 }
1608
1609- if (gomp_cpu_affinity != NULL)
1610+ if (__builtin_expect (gomp_cpu_affinity != NULL, 0))
1611 pthread_attr_destroy (&thread_attr);
1612
1613 do_release:
1614@@ -313,8 +354,20 @@ gomp_team_start (void (*fn) (void *), vo
1615 that should arrive back at the end of this team. The extra
1616 threads should be exiting. Note that we arrange for this test
1617 to never be true for nested teams. */
1618- if (nthreads < old_threads_used)
1619- gomp_barrier_reinit (&gomp_threads_dock, nthreads);
1620+ if (__builtin_expect (nthreads < old_threads_used, 0))
1621+ {
1622+ long diff = (long) nthreads - (long) old_threads_used;
1623+
1624+ gomp_barrier_reinit (&gomp_threads_dock, nthreads);
1625+
1626+#ifdef HAVE_SYNC_BUILTINS
1627+ __sync_fetch_and_add (&gomp_managed_threads, diff);
1628+#else
1629+ gomp_mutex_lock (&gomp_remaining_threads_lock);
1630+ gomp_managed_threads += diff;
1631+ gomp_mutex_unlock (&gomp_remaining_threads_lock);
1632+#endif
1633+ }
1634 }
1635
1636
1637@@ -329,8 +382,21 @@ gomp_team_end (void)
1638
1639 gomp_barrier_wait (&team->barrier);
1640
1641+ gomp_fini_work_share (thr->ts.work_share);
1642+
1643 thr->ts = team->prev_ts;
1644
1645+ if (__builtin_expect (thr->ts.team != NULL, 0))
1646+ {
1647+#ifdef HAVE_SYNC_BUILTINS
1648+ __sync_fetch_and_add (&gomp_managed_threads, 1L - team->nthreads);
1649+#else
1650+ gomp_mutex_lock (&gomp_remaining_threads_lock);
1651+ gomp_managed_threads -= team->nthreads - 1L;
1652+ gomp_mutex_unlock (&gomp_remaining_threads_lock);
1653+#endif
1654+ }
1655+
1656 free_team (team);
1657 }
1658
1659--- libgomp/config/posix/bar.h.jj 2007-12-07 14:41:01.000000000 +0100
1660+++ libgomp/config/posix/bar.h 2008-03-26 15:11:32.000000000 +0100
1661@@ -1,4 +1,4 @@
1662-/* Copyright (C) 2005 Free Software Foundation, Inc.
1663+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
1664 Contributed by Richard Henderson <rth@redhat.com>.
1665
1666 This file is part of the GNU OpenMP Library (libgomp).
1667@@ -46,18 +46,32 @@ typedef struct
1668 unsigned total;
1669 unsigned arrived;
1670 } gomp_barrier_t;
1671+typedef bool gomp_barrier_state_t;
1672
1673 extern void gomp_barrier_init (gomp_barrier_t *, unsigned);
1674 extern void gomp_barrier_reinit (gomp_barrier_t *, unsigned);
1675 extern void gomp_barrier_destroy (gomp_barrier_t *);
1676
1677 extern void gomp_barrier_wait (gomp_barrier_t *);
1678-extern void gomp_barrier_wait_end (gomp_barrier_t *, bool);
1679+extern void gomp_barrier_wait_end (gomp_barrier_t *, gomp_barrier_state_t);
1680
1681-static inline bool gomp_barrier_wait_start (gomp_barrier_t *bar)
1682+static inline gomp_barrier_state_t
1683+gomp_barrier_wait_start (gomp_barrier_t *bar)
1684 {
1685 gomp_mutex_lock (&bar->mutex1);
1686 return ++bar->arrived == bar->total;
1687 }
1688
1689+static inline bool
1690+gomp_barrier_last_thread (gomp_barrier_state_t state)
1691+{
1692+ return state;
1693+}
1694+
1695+static inline void
1696+gomp_barrier_wait_last (gomp_barrier_t *bar)
1697+{
1698+ gomp_barrier_wait (bar);
1699+}
1700+
1701 #endif /* GOMP_BARRIER_H */
1702--- libgomp/config/posix/ptrlock.h.jj 2008-03-26 15:11:32.000000000 +0100
1703+++ libgomp/config/posix/ptrlock.h 2008-03-26 15:11:32.000000000 +0100
1704@@ -0,0 +1,69 @@
1705+/* Copyright (C) 2008 Free Software Foundation, Inc.
1706+ Contributed by Jakub Jelinek <jakub@redhat.com>.
1707+
1708+ This file is part of the GNU OpenMP Library (libgomp).
1709+
1710+ Libgomp is free software; you can redistribute it and/or modify it
1711+ under the terms of the GNU Lesser General Public License as published by
1712+ the Free Software Foundation; either version 2.1 of the License, or
1713+ (at your option) any later version.
1714+
1715+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
1716+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1717+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
1718+ more details.
1719+
1720+ You should have received a copy of the GNU Lesser General Public License
1721+ along with libgomp; see the file COPYING.LIB. If not, write to the
1722+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1723+ MA 02110-1301, USA. */
1724+
1725+/* As a special exception, if you link this library with other files, some
1726+ of which are compiled with GCC, to produce an executable, this library
1727+ does not by itself cause the resulting executable to be covered by the
1728+ GNU General Public License. This exception does not however invalidate
1729+ any other reasons why the executable file might be covered by the GNU
1730+ General Public License. */
1731+
1732+/* This is a Linux specific implementation of a mutex synchronization
1733+ mechanism for libgomp. This type is private to the library. This
1734+ implementation uses atomic instructions and the futex syscall. */
1735+
1736+#ifndef GOMP_PTRLOCK_H
1737+#define GOMP_PTRLOCK_H 1
1738+
1739+typedef struct { void *ptr; gomp_mutex_t lock; } gomp_ptrlock_t;
1740+
1741+static inline void gomp_ptrlock_init (gomp_ptrlock_t *ptrlock, void *ptr)
1742+{
1743+ ptrlock->ptr = ptr;
1744+ gomp_mutex_init (&ptrlock->lock);
1745+}
1746+
1747+static inline void *gomp_ptrlock_get (gomp_ptrlock_t *ptrlock)
1748+{
1749+ if (ptrlock->ptr != NULL)
1750+ return ptrlock->ptr;
1751+
1752+ gomp_mutex_lock (&ptrlock->lock);
1753+ if (ptrlock->ptr != NULL)
1754+ {
1755+ gomp_mutex_unlock (&ptrlock->lock);
1756+ return ptrlock->ptr;
1757+ }
1758+
1759+ return NULL;
1760+}
1761+
1762+static inline void gomp_ptrlock_set (gomp_ptrlock_t *ptrlock, void *ptr)
1763+{
1764+ ptrlock->ptr = ptr;
1765+ gomp_mutex_unlock (&ptrlock->lock);
1766+}
1767+
1768+static inline void gomp_ptrlock_destroy (gomp_ptrlock_t *ptrlock)
1769+{
1770+ gomp_mutex_destroy (&ptrlock->lock);
1771+}
1772+
1773+#endif /* GOMP_PTRLOCK_H */
1774--- libgomp/config/posix/ptrlock.c.jj 2008-03-26 15:11:32.000000000 +0100
1775+++ libgomp/config/posix/ptrlock.c 2008-03-26 15:11:32.000000000 +0100
1776@@ -0,0 +1 @@
1777+/* Everything is in the header. */
1778--- libgomp/config/posix/bar.c.jj 2007-12-07 14:41:01.000000000 +0100
1779+++ libgomp/config/posix/bar.c 2008-03-26 15:11:32.000000000 +0100
1780@@ -1,4 +1,4 @@
1781-/* Copyright (C) 2005 Free Software Foundation, Inc.
1782+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
1783 Contributed by Richard Henderson <rth@redhat.com>.
1784
1785 This file is part of the GNU OpenMP Library (libgomp).
1786@@ -70,7 +70,7 @@ gomp_barrier_reinit (gomp_barrier_t *bar
1787 }
1788
1789 void
1790-gomp_barrier_wait_end (gomp_barrier_t *bar, bool last)
1791+gomp_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t last)
1792 {
1793 unsigned int n;
1794
1795--- libgomp/config/linux/alpha/futex.h.jj 2007-12-07 14:41:00.000000000 +0100
1796+++ libgomp/config/linux/alpha/futex.h 2008-03-26 15:11:32.000000000 +0100
1797@@ -1,4 +1,4 @@
1798-/* Copyright (C) 2005 Free Software Foundation, Inc.
1799+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
1800 Contributed by Richard Henderson <rth@redhat.com>.
1801
1802 This file is part of the GNU OpenMP Library (libgomp).
1803@@ -30,8 +30,6 @@
1804 #ifndef SYS_futex
1805 #define SYS_futex 394
1806 #endif
1807-#define FUTEX_WAIT 0
1808-#define FUTEX_WAKE 1
1809
1810
1811 static inline void
1812@@ -45,7 +43,7 @@ futex_wait (int *addr, int val)
1813
1814 sc_0 = SYS_futex;
1815 sc_16 = (long) addr;
1816- sc_17 = FUTEX_WAIT;
1817+ sc_17 = gomp_futex_wait;
1818 sc_18 = val;
1819 sc_19 = 0;
1820 __asm volatile ("callsys"
1821@@ -53,6 +51,20 @@ futex_wait (int *addr, int val)
1822 : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18), "1"(sc_19)
1823 : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
1824 "$22", "$23", "$24", "$25", "$27", "$28", "memory");
1825+ if (__builtin_expect (sc_19, 0) && sc_0 == ENOSYS)
1826+ {
1827+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
1828+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
1829+ sc_0 = SYS_futex;
1830+ sc_17 &= ~FUTEX_PRIVATE_FLAG;
1831+ sc_19 = 0;
1832+ __asm volatile ("callsys"
1833+ : "=r" (sc_0), "=r"(sc_19)
1834+ : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18),
1835+ "1"(sc_19)
1836+ : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
1837+ "$22", "$23", "$24", "$25", "$27", "$28", "memory");
1838+ }
1839 }
1840
1841 static inline void
1842@@ -66,11 +78,35 @@ futex_wake (int *addr, int count)
1843
1844 sc_0 = SYS_futex;
1845 sc_16 = (long) addr;
1846- sc_17 = FUTEX_WAKE;
1847+ sc_17 = gomp_futex_wake;
1848 sc_18 = count;
1849 __asm volatile ("callsys"
1850 : "=r" (sc_0), "=r"(sc_19)
1851 : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18)
1852 : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
1853 "$22", "$23", "$24", "$25", "$27", "$28", "memory");
1854+ if (__builtin_expect (sc_19, 0) && sc_0 == ENOSYS)
1855+ {
1856+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
1857+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
1858+ sc_0 = SYS_futex;
1859+ sc_17 &= ~FUTEX_PRIVATE_FLAG;
1860+ __asm volatile ("callsys"
1861+ : "=r" (sc_0), "=r"(sc_19)
1862+ : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18)
1863+ : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
1864+ "$22", "$23", "$24", "$25", "$27", "$28", "memory");
1865+ }
1866+}
1867+
1868+static inline void
1869+cpu_relax (void)
1870+{
1871+ __asm volatile ("" : : : "memory");
1872+}
1873+
1874+static inline void
1875+atomic_write_barrier (void)
1876+{
1877+ __asm volatile ("wmb" : : : "memory");
1878 }
1879--- libgomp/config/linux/affinity.c.jj 2007-12-07 14:41:00.000000000 +0100
1880+++ libgomp/config/linux/affinity.c 2008-03-26 15:11:32.000000000 +0100
1881@@ -1,4 +1,4 @@
1882-/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
1883+/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
1884 Contributed by Jakub Jelinek <jakub@redhat.com>.
1885
1886 This file is part of the GNU OpenMP Library (libgomp).
1887@@ -38,9 +38,6 @@
1888 #ifdef HAVE_PTHREAD_AFFINITY_NP
1889
1890 static unsigned int affinity_counter;
1891-#ifndef HAVE_SYNC_BUILTINS
1892-static gomp_mutex_t affinity_lock;
1893-#endif
1894
1895 void
1896 gomp_init_affinity (void)
1897@@ -76,9 +73,6 @@ gomp_init_affinity (void)
1898 CPU_SET (gomp_cpu_affinity[0], &cpuset);
1899 pthread_setaffinity_np (pthread_self (), sizeof (cpuset), &cpuset);
1900 affinity_counter = 1;
1901-#ifndef HAVE_SYNC_BUILTINS
1902- gomp_mutex_init (&affinity_lock);
1903-#endif
1904 }
1905
1906 void
1907@@ -87,13 +81,7 @@ gomp_init_thread_affinity (pthread_attr_
1908 unsigned int cpu;
1909 cpu_set_t cpuset;
1910
1911-#ifdef HAVE_SYNC_BUILTINS
1912 cpu = __sync_fetch_and_add (&affinity_counter, 1);
1913-#else
1914- gomp_mutex_lock (&affinity_lock);
1915- cpu = affinity_counter++;
1916- gomp_mutex_unlock (&affinity_lock);
1917-#endif
1918 cpu %= gomp_cpu_affinity_len;
1919 CPU_ZERO (&cpuset);
1920 CPU_SET (gomp_cpu_affinity[cpu], &cpuset);
1921--- libgomp/config/linux/bar.h.jj 2007-12-07 14:41:00.000000000 +0100
1922+++ libgomp/config/linux/bar.h 2008-03-26 15:11:32.000000000 +0100
1923@@ -1,4 +1,4 @@
1924-/* Copyright (C) 2005 Free Software Foundation, Inc.
1925+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
1926 Contributed by Richard Henderson <rth@redhat.com>.
1927
1928 This file is part of the GNU OpenMP Library (libgomp).
1929@@ -36,40 +36,49 @@
1930
1931 typedef struct
1932 {
1933- gomp_mutex_t mutex;
1934- unsigned total;
1935- unsigned arrived;
1936- int generation;
1937+ /* Make sure total/generation is in a mostly read cacheline, while
1938+ awaited in a separate cacheline. */
1939+ unsigned total __attribute__((aligned (64)));
1940+ unsigned generation;
1941+ unsigned awaited __attribute__((aligned (64)));
1942 } gomp_barrier_t;
1943+typedef unsigned int gomp_barrier_state_t;
1944
1945 static inline void gomp_barrier_init (gomp_barrier_t *bar, unsigned count)
1946 {
1947- gomp_mutex_init (&bar->mutex);
1948 bar->total = count;
1949- bar->arrived = 0;
1950+ bar->awaited = count;
1951 bar->generation = 0;
1952 }
1953
1954 static inline void gomp_barrier_reinit (gomp_barrier_t *bar, unsigned count)
1955 {
1956- gomp_mutex_lock (&bar->mutex);
1957+ __sync_fetch_and_add (&bar->awaited, count - bar->total);
1958 bar->total = count;
1959- gomp_mutex_unlock (&bar->mutex);
1960 }
1961
1962 static inline void gomp_barrier_destroy (gomp_barrier_t *bar)
1963 {
1964- /* Before destroying, make sure all threads have left the barrier. */
1965- gomp_mutex_lock (&bar->mutex);
1966 }
1967
1968 extern void gomp_barrier_wait (gomp_barrier_t *);
1969-extern void gomp_barrier_wait_end (gomp_barrier_t *, bool);
1970+extern void gomp_barrier_wait_last (gomp_barrier_t *);
1971+extern void gomp_barrier_wait_end (gomp_barrier_t *, gomp_barrier_state_t);
1972
1973-static inline bool gomp_barrier_wait_start (gomp_barrier_t *bar)
1974+static inline gomp_barrier_state_t
1975+gomp_barrier_wait_start (gomp_barrier_t *bar)
1976 {
1977- gomp_mutex_lock (&bar->mutex);
1978- return ++bar->arrived == bar->total;
1979+ unsigned int ret = bar->generation;
1980+ /* Do we need any barrier here or is __sync_add_and_fetch acting
1981+ as the needed LoadLoad barrier already? */
1982+ ret += __sync_add_and_fetch (&bar->awaited, -1) == 0;
1983+ return ret;
1984+}
1985+
1986+static inline bool
1987+gomp_barrier_last_thread (gomp_barrier_state_t state)
1988+{
1989+ return state & 1;
1990 }
1991
1992 #endif /* GOMP_BARRIER_H */
1993--- libgomp/config/linux/ptrlock.h.jj 2008-03-26 15:11:32.000000000 +0100
1994+++ libgomp/config/linux/ptrlock.h 2008-03-26 15:11:32.000000000 +0100
1995@@ -0,0 +1,65 @@
1996+/* Copyright (C) 2008 Free Software Foundation, Inc.
1997+ Contributed by Jakub Jelinek <jakub@redhat.com>.
1998+
1999+ This file is part of the GNU OpenMP Library (libgomp).
2000+
2001+ Libgomp is free software; you can redistribute it and/or modify it
2002+ under the terms of the GNU Lesser General Public License as published by
2003+ the Free Software Foundation; either version 2.1 of the License, or
2004+ (at your option) any later version.
2005+
2006+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
2007+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2008+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
2009+ more details.
2010+
2011+ You should have received a copy of the GNU Lesser General Public License
2012+ along with libgomp; see the file COPYING.LIB. If not, write to the
2013+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
2014+ MA 02110-1301, USA. */
2015+
2016+/* As a special exception, if you link this library with other files, some
2017+ of which are compiled with GCC, to produce an executable, this library
2018+ does not by itself cause the resulting executable to be covered by the
2019+ GNU General Public License. This exception does not however invalidate
2020+ any other reasons why the executable file might be covered by the GNU
2021+ General Public License. */
2022+
2023+/* This is a Linux specific implementation of a mutex synchronization
2024+ mechanism for libgomp. This type is private to the library. This
2025+ implementation uses atomic instructions and the futex syscall. */
2026+
2027+#ifndef GOMP_PTRLOCK_H
2028+#define GOMP_PTRLOCK_H 1
2029+
2030+typedef void *gomp_ptrlock_t;
2031+
2032+static inline void gomp_ptrlock_init (gomp_ptrlock_t *ptrlock, void *ptr)
2033+{
2034+ *ptrlock = ptr;
2035+}
2036+
2037+extern void *gomp_ptrlock_get_slow (gomp_ptrlock_t *ptrlock);
2038+static inline void *gomp_ptrlock_get (gomp_ptrlock_t *ptrlock)
2039+{
2040+ if ((uintptr_t) *ptrlock > 2)
2041+ return *ptrlock;
2042+
2043+ if (__sync_bool_compare_and_swap (ptrlock, NULL, (uintptr_t) 1))
2044+ return NULL;
2045+
2046+ return gomp_ptrlock_get_slow (ptrlock);
2047+}
2048+
2049+extern void gomp_ptrlock_set_slow (gomp_ptrlock_t *ptrlock, void *ptr);
2050+static inline void gomp_ptrlock_set (gomp_ptrlock_t *ptrlock, void *ptr)
2051+{
2052+ if (!__sync_bool_compare_and_swap (ptrlock, (uintptr_t) 1, ptr))
2053+ gomp_ptrlock_set_slow (ptrlock, ptr);
2054+}
2055+
2056+static inline void gomp_ptrlock_destroy (gomp_ptrlock_t *ptrlock)
2057+{
2058+}
2059+
2060+#endif /* GOMP_PTRLOCK_H */
2061--- libgomp/config/linux/lock.c.jj 2007-12-07 14:41:00.000000000 +0100
2062+++ libgomp/config/linux/lock.c 2008-03-26 15:11:32.000000000 +0100
2063@@ -29,11 +29,10 @@
2064 primitives. This implementation uses atomic instructions and the futex
2065 syscall. */
2066
2067-#include "libgomp.h"
2068 #include <string.h>
2069 #include <unistd.h>
2070 #include <sys/syscall.h>
2071-#include "futex.h"
2072+#include "wait.h"
2073
2074
2075 /* The internal gomp_mutex_t and the external non-recursive omp_lock_t
2076@@ -137,7 +136,7 @@ omp_set_nest_lock (omp_nest_lock_t *lock
2077 return;
2078 }
2079
2080- futex_wait (&lock->owner, otid);
2081+ do_wait (&lock->owner, otid);
2082 }
2083 }
2084
2085--- libgomp/config/linux/ptrlock.c.jj 2008-03-26 15:11:32.000000000 +0100
2086+++ libgomp/config/linux/ptrlock.c 2008-03-26 15:11:32.000000000 +0100
2087@@ -0,0 +1,70 @@
2088+/* Copyright (C) 2008 Free Software Foundation, Inc.
2089+ Contributed by Jakub Jelinek <jakub@redhat.com>.
2090+
2091+ This file is part of the GNU OpenMP Library (libgomp).
2092+
2093+ Libgomp is free software; you can redistribute it and/or modify it
2094+ under the terms of the GNU Lesser General Public License as published by
2095+ the Free Software Foundation; either version 2.1 of the License, or
2096+ (at your option) any later version.
2097+
2098+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
2099+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2100+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
2101+ more details.
2102+
2103+ You should have received a copy of the GNU Lesser General Public License
2104+ along with libgomp; see the file COPYING.LIB. If not, write to the
2105+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
2106+ MA 02110-1301, USA. */
2107+
2108+/* As a special exception, if you link this library with other files, some
2109+ of which are compiled with GCC, to produce an executable, this library
2110+ does not by itself cause the resulting executable to be covered by the
2111+ GNU General Public License. This exception does not however invalidate
2112+ any other reasons why the executable file might be covered by the GNU
2113+ General Public License. */
2114+
2115+/* This is a Linux specific implementation of a mutex synchronization
2116+ mechanism for libgomp. This type is private to the library. This
2117+ implementation uses atomic instructions and the futex syscall. */
2118+
2119+#include <endian.h>
2120+#include <limits.h>
2121+#include "wait.h"
2122+
2123+void *
2124+gomp_ptrlock_get_slow (gomp_ptrlock_t *ptrlock)
2125+{
2126+ int *intptr;
2127+ __sync_bool_compare_and_swap (ptrlock, 1, 2);
2128+
2129+ /* futex works on ints, not pointers.
2130+ But a valid work share pointer will be at least
2131+ 8 byte aligned, so it is safe to assume the low
2132+ 32-bits of the pointer won't contain values 1 or 2. */
2133+ __asm volatile ("" : "=r" (intptr) : "0" (ptrlock));
2134+#if __BYTE_ORDER == __BIG_ENDIAN
2135+ if (sizeof (*ptrlock) > sizeof (int))
2136+ intptr += (sizeof (*ptrlock) / sizeof (int)) - 1;
2137+#endif
2138+ do
2139+ do_wait (intptr, 2);
2140+ while (*intptr == 2);
2141+ __asm volatile ("" : : : "memory");
2142+ return *ptrlock;
2143+}
2144+
2145+void
2146+gomp_ptrlock_set_slow (gomp_ptrlock_t *ptrlock, void *ptr)
2147+{
2148+ int *intptr;
2149+
2150+ *ptrlock = ptr;
2151+ __asm volatile ("" : "=r" (intptr) : "0" (ptrlock));
2152+#if __BYTE_ORDER == __BIG_ENDIAN
2153+ if (sizeof (*ptrlock) > sizeof (int))
2154+ intptr += (sizeof (*ptrlock) / sizeof (int)) - 1;
2155+#endif
2156+ futex_wake (intptr, INT_MAX);
2157+}
2158--- libgomp/config/linux/x86/futex.h.jj 2007-12-07 14:41:00.000000000 +0100
2159+++ libgomp/config/linux/x86/futex.h 2008-03-26 15:11:32.000000000 +0100
2160@@ -1,4 +1,4 @@
2161-/* Copyright (C) 2005 Free Software Foundation, Inc.
2162+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2163 Contributed by Richard Henderson <rth@redhat.com>.
2164
2165 This file is part of the GNU OpenMP Library (libgomp).
2166@@ -27,9 +27,6 @@
2167
2168 /* Provide target-specific access to the futex system call. */
2169
2170-#define FUTEX_WAIT 0
2171-#define FUTEX_WAKE 1
2172-
2173 #ifdef __LP64__
2174 # ifndef SYS_futex
2175 # define SYS_futex 202
2176@@ -38,14 +35,26 @@
2177 static inline void
2178 futex_wait (int *addr, int val)
2179 {
2180- register long r10 __asm__("%r10") = 0;
2181+ register long r10 __asm__("%r10");
2182 long res;
2183
2184+ r10 = 0;
2185 __asm volatile ("syscall"
2186 : "=a" (res)
2187- : "0"(SYS_futex), "D" (addr), "S"(FUTEX_WAIT),
2188- "d"(val), "r"(r10)
2189+ : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wait),
2190+ "d" (val), "r" (r10)
2191 : "r11", "rcx", "memory");
2192+ if (__builtin_expect (res == -ENOSYS, 0))
2193+ {
2194+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2195+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2196+ r10 = 0;
2197+ __asm volatile ("syscall"
2198+ : "=a" (res)
2199+ : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wait),
2200+ "d" (val), "r" (r10)
2201+ : "r11", "rcx", "memory");
2202+ }
2203 }
2204
2205 static inline void
2206@@ -55,8 +64,19 @@ futex_wake (int *addr, int count)
2207
2208 __asm volatile ("syscall"
2209 : "=a" (res)
2210- : "0"(SYS_futex), "D" (addr), "S"(FUTEX_WAKE), "d"(count)
2211+ : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wake),
2212+ "d" (count)
2213 : "r11", "rcx", "memory");
2214+ if (__builtin_expect (res == -ENOSYS, 0))
2215+ {
2216+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2217+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2218+ __asm volatile ("syscall"
2219+ : "=a" (res)
2220+ : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wake),
2221+ "d" (count)
2222+ : "r11", "rcx", "memory");
2223+ }
2224 }
2225 #else
2226 # ifndef SYS_futex
2227@@ -65,7 +85,7 @@ futex_wake (int *addr, int count)
2228
2229 # ifdef __PIC__
2230
2231-static inline void
2232+static inline long
2233 sys_futex0 (int *addr, int op, int val)
2234 {
2235 long res;
2236@@ -77,11 +97,12 @@ sys_futex0 (int *addr, int op, int val)
2237 : "0"(SYS_futex), "r" (addr), "c"(op),
2238 "d"(val), "S"(0)
2239 : "memory");
2240+ return res;
2241 }
2242
2243 # else
2244
2245-static inline void
2246+static inline long
2247 sys_futex0 (int *addr, int op, int val)
2248 {
2249 long res;
2250@@ -91,6 +112,7 @@ sys_futex0 (int *addr, int op, int val)
2251 : "0"(SYS_futex), "b" (addr), "c"(op),
2252 "d"(val), "S"(0)
2253 : "memory");
2254+ return res;
2255 }
2256
2257 # endif /* __PIC__ */
2258@@ -98,13 +120,37 @@ sys_futex0 (int *addr, int op, int val)
2259 static inline void
2260 futex_wait (int *addr, int val)
2261 {
2262- sys_futex0 (addr, FUTEX_WAIT, val);
2263+ long res = sys_futex0 (addr, gomp_futex_wait, val);
2264+ if (__builtin_expect (res == -ENOSYS, 0))
2265+ {
2266+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2267+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2268+ sys_futex0 (addr, gomp_futex_wait, val);
2269+ }
2270 }
2271
2272 static inline void
2273 futex_wake (int *addr, int count)
2274 {
2275- sys_futex0 (addr, FUTEX_WAKE, count);
2276+ long res = sys_futex0 (addr, gomp_futex_wake, count);
2277+ if (__builtin_expect (res == -ENOSYS, 0))
2278+ {
2279+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2280+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2281+ sys_futex0 (addr, gomp_futex_wake, count);
2282+ }
2283 }
2284
2285 #endif /* __LP64__ */
2286+
2287+static inline void
2288+cpu_relax (void)
2289+{
2290+ __asm volatile ("rep; nop" : : : "memory");
2291+}
2292+
2293+static inline void
2294+atomic_write_barrier (void)
2295+{
2296+ __sync_synchronize ();
2297+}
2298--- libgomp/config/linux/wait.h.jj 2008-03-26 15:11:32.000000000 +0100
2299+++ libgomp/config/linux/wait.h 2008-03-26 15:11:32.000000000 +0100
2300@@ -0,0 +1,68 @@
2301+/* Copyright (C) 2008 Free Software Foundation, Inc.
2302+ Contributed by Jakub Jelinek <jakub@redhat.com>.
2303+
2304+ This file is part of the GNU OpenMP Library (libgomp).
2305+
2306+ Libgomp is free software; you can redistribute it and/or modify it
2307+ under the terms of the GNU Lesser General Public License as published by
2308+ the Free Software Foundation; either version 2.1 of the License, or
2309+ (at your option) any later version.
2310+
2311+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
2312+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2313+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
2314+ more details.
2315+
2316+ You should have received a copy of the GNU Lesser General Public License
2317+ along with libgomp; see the file COPYING.LIB. If not, write to the
2318+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
2319+ MA 02110-1301, USA. */
2320+
2321+/* As a special exception, if you link this library with other files, some
2322+ of which are compiled with GCC, to produce an executable, this library
2323+ does not by itself cause the resulting executable to be covered by the
2324+ GNU General Public License. This exception does not however invalidate
2325+ any other reasons why the executable file might be covered by the GNU
2326+ General Public License. */
2327+
2328+/* This is a Linux specific implementation of a mutex synchronization
2329+ mechanism for libgomp. This type is private to the library. This
2330+ implementation uses atomic instructions and the futex syscall. */
2331+
2332+#ifndef GOMP_WAIT_H
2333+#define GOMP_WAIT_H 1
2334+
2335+#include "libgomp.h"
2336+#include <errno.h>
2337+
2338+#define FUTEX_WAIT 0
2339+#define FUTEX_WAKE 1
2340+#define FUTEX_PRIVATE_FLAG 128L
2341+
2342+#ifdef HAVE_ATTRIBUTE_VISIBILITY
2343+# pragma GCC visibility push(hidden)
2344+#endif
2345+
2346+extern long int gomp_futex_wait, gomp_futex_wake;
2347+
2348+#include "futex.h"
2349+
2350+static inline void do_wait (int *addr, int val)
2351+{
2352+ unsigned long long i, count = gomp_spin_count_var;
2353+
2354+ if (__builtin_expect (gomp_managed_threads > gomp_available_cpus, 0))
2355+ count = gomp_throttled_spin_count_var;
2356+ for (i = 0; i < count; i++)
2357+ if (__builtin_expect (*addr != val, 0))
2358+ return;
2359+ else
2360+ cpu_relax ();
2361+ futex_wait (addr, val);
2362+}
2363+
2364+#ifdef HAVE_ATTRIBUTE_VISIBILITY
2365+# pragma GCC visibility pop
2366+#endif
2367+
2368+#endif /* GOMP_WAIT_H */
2369--- libgomp/config/linux/sparc/futex.h.jj 2007-12-07 14:41:00.000000000 +0100
2370+++ libgomp/config/linux/sparc/futex.h 2008-03-26 15:11:32.000000000 +0100
2371@@ -1,4 +1,4 @@
2372-/* Copyright (C) 2005 Free Software Foundation, Inc.
2373+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2374 Contributed by Jakub Jelinek <jakub@redhat.com>.
2375
2376 This file is part of the GNU OpenMP Library (libgomp).
2377@@ -28,10 +28,8 @@
2378 /* Provide target-specific access to the futex system call. */
2379
2380 #include <sys/syscall.h>
2381-#define FUTEX_WAIT 0
2382-#define FUTEX_WAKE 1
2383
2384-static inline void
2385+static inline long
2386 sys_futex0 (int *addr, int op, int val)
2387 {
2388 register long int g1 __asm__ ("g1");
2389@@ -47,9 +45,9 @@ sys_futex0 (int *addr, int op, int val)
2390 o3 = 0;
2391
2392 #ifdef __arch64__
2393-# define SYSCALL_STRING "ta\t0x6d"
2394+# define SYSCALL_STRING "ta\t0x6d; bcs,a,pt %%xcc, 1f; sub %%g0, %%o0, %%o0; 1:"
2395 #else
2396-# define SYSCALL_STRING "ta\t0x10"
2397+# define SYSCALL_STRING "ta\t0x10; bcs,a 1f; sub %%g0, %%o0, %%o0; 1:"
2398 #endif
2399
2400 __asm volatile (SYSCALL_STRING
2401@@ -65,16 +63,49 @@ sys_futex0 (int *addr, int op, int val)
2402 "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62",
2403 #endif
2404 "cc", "memory");
2405+ return o0;
2406 }
2407
2408 static inline void
2409 futex_wait (int *addr, int val)
2410 {
2411- sys_futex0 (addr, FUTEX_WAIT, val);
2412+ long err = sys_futex0 (addr, gomp_futex_wait, val);
2413+ if (__builtin_expect (err == ENOSYS, 0))
2414+ {
2415+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2416+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2417+ sys_futex0 (addr, gomp_futex_wait, val);
2418+ }
2419 }
2420
2421 static inline void
2422 futex_wake (int *addr, int count)
2423 {
2424- sys_futex0 (addr, FUTEX_WAKE, count);
2425+ long err = sys_futex0 (addr, gomp_futex_wake, count);
2426+ if (__builtin_expect (err == ENOSYS, 0))
2427+ {
2428+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2429+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2430+ sys_futex0 (addr, gomp_futex_wake, count);
2431+ }
2432+}
2433+
2434+static inline void
2435+cpu_relax (void)
2436+{
2437+#if defined __arch64__ || defined __sparc_v9__
2438+ __asm volatile ("membar #LoadLoad" : : : "memory");
2439+#else
2440+ __asm volatile ("" : : : "memory");
2441+#endif
2442+}
2443+
2444+static inline void
2445+atomic_write_barrier (void)
2446+{
2447+#if defined __arch64__ || defined __sparc_v9__
2448+ __asm volatile ("membar #StoreStore" : : : "memory");
2449+#else
2450+ __sync_synchronize ();
2451+#endif
2452 }
2453--- libgomp/config/linux/ia64/futex.h.jj 2007-12-07 14:41:00.000000000 +0100
2454+++ libgomp/config/linux/ia64/futex.h 2008-03-26 15:11:32.000000000 +0100
2455@@ -1,4 +1,4 @@
2456-/* Copyright (C) 2005 Free Software Foundation, Inc.
2457+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2458 Contributed by Richard Henderson <rth@redhat.com>.
2459
2460 This file is part of the GNU OpenMP Library (libgomp).
2461@@ -29,23 +29,24 @@
2462
2463 #include <sys/syscall.h>
2464
2465-#define FUTEX_WAIT 0
2466-#define FUTEX_WAKE 1
2467
2468
2469-static inline void
2470-sys_futex0(int *addr, int op, int val)
2471+static inline long
2472+sys_futex0(int *addr, long op, int val)
2473 {
2474 register long out0 asm ("out0") = (long) addr;
2475 register long out1 asm ("out1") = op;
2476 register long out2 asm ("out2") = val;
2477 register long out3 asm ("out3") = 0;
2478+ register long r8 asm ("r8");
2479+ register long r10 asm ("r10");
2480 register long r15 asm ("r15") = SYS_futex;
2481
2482 __asm __volatile ("break 0x100000"
2483- : "=r"(r15), "=r"(out0), "=r"(out1), "=r"(out2), "=r"(out3)
2484+ : "=r"(r15), "=r"(out0), "=r"(out1), "=r"(out2), "=r"(out3),
2485+ "=r"(r8), "=r"(r10)
2486 : "r"(r15), "r"(out0), "r"(out1), "r"(out2), "r"(out3)
2487- : "memory", "r8", "r10", "out4", "out5", "out6", "out7",
2488+ : "memory", "out4", "out5", "out6", "out7",
2489 /* Non-stacked integer registers, minus r8, r10, r15. */
2490 "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18",
2491 "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",
2492@@ -56,16 +57,41 @@ sys_futex0(int *addr, int op, int val)
2493 "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
2494 /* Branch registers. */
2495 "b6");
2496+ return r8 & r10;
2497 }
2498
2499 static inline void
2500 futex_wait (int *addr, int val)
2501 {
2502- sys_futex0 (addr, FUTEX_WAIT, val);
2503+ long err = sys_futex0 (addr, gomp_futex_wait, val);
2504+ if (__builtin_expect (err == ENOSYS, 0))
2505+ {
2506+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2507+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2508+ sys_futex0 (addr, gomp_futex_wait, val);
2509+ }
2510 }
2511
2512 static inline void
2513 futex_wake (int *addr, int count)
2514 {
2515- sys_futex0 (addr, FUTEX_WAKE, count);
2516+ long err = sys_futex0 (addr, gomp_futex_wake, count);
2517+ if (__builtin_expect (err == ENOSYS, 0))
2518+ {
2519+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2520+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2521+ sys_futex0 (addr, gomp_futex_wake, count);
2522+ }
2523+}
2524+
2525+static inline void
2526+cpu_relax (void)
2527+{
2528+ __asm volatile ("hint @pause" : : : "memory");
2529+}
2530+
2531+static inline void
2532+atomic_write_barrier (void)
2533+{
2534+ __sync_synchronize ();
2535 }
2536--- libgomp/config/linux/s390/futex.h.jj 2007-12-07 14:41:00.000000000 +0100
2537+++ libgomp/config/linux/s390/futex.h 2008-03-26 15:11:32.000000000 +0100
2538@@ -1,4 +1,4 @@
2539-/* Copyright (C) 2005 Free Software Foundation, Inc.
2540+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2541 Contributed by Jakub Jelinek <jakub@redhat.com>.
2542
2543 This file is part of the GNU OpenMP Library (libgomp).
2544@@ -28,10 +28,8 @@
2545 /* Provide target-specific access to the futex system call. */
2546
2547 #include <sys/syscall.h>
2548-#define FUTEX_WAIT 0
2549-#define FUTEX_WAKE 1
2550
2551-static inline void
2552+static inline long
2553 sys_futex0 (int *addr, int op, int val)
2554 {
2555 register long int gpr2 __asm__ ("2");
2556@@ -49,16 +47,41 @@ sys_futex0 (int *addr, int op, int val)
2557 : "i" (SYS_futex),
2558 "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
2559 : "memory");
2560+ return gpr2;
2561 }
2562
2563 static inline void
2564 futex_wait (int *addr, int val)
2565 {
2566- sys_futex0 (addr, FUTEX_WAIT, val);
2567+ long err = sys_futex0 (addr, gomp_futex_wait, val);
2568+ if (__builtin_expect (err == -ENOSYS, 0))
2569+ {
2570+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2571+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2572+ sys_futex0 (addr, gomp_futex_wait, val);
2573+ }
2574 }
2575
2576 static inline void
2577 futex_wake (int *addr, int count)
2578 {
2579- sys_futex0 (addr, FUTEX_WAKE, count);
2580+ long err = sys_futex0 (addr, gomp_futex_wake, count);
2581+ if (__builtin_expect (err == -ENOSYS, 0))
2582+ {
2583+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2584+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2585+ sys_futex0 (addr, gomp_futex_wake, count);
2586+ }
2587+}
2588+
2589+static inline void
2590+cpu_relax (void)
2591+{
2592+ __asm volatile ("" : : : "memory");
2593+}
2594+
2595+static inline void
2596+atomic_write_barrier (void)
2597+{
2598+ __sync_synchronize ();
2599 }
2600--- libgomp/config/linux/mutex.c.jj 2007-12-07 14:41:00.000000000 +0100
2601+++ libgomp/config/linux/mutex.c 2008-03-26 15:11:32.000000000 +0100
2602@@ -1,4 +1,4 @@
2603-/* Copyright (C) 2005 Free Software Foundation, Inc.
2604+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2605 Contributed by Richard Henderson <rth@redhat.com>.
2606
2607 This file is part of the GNU OpenMP Library (libgomp).
2608@@ -29,9 +29,10 @@
2609 mechanism for libgomp. This type is private to the library. This
2610 implementation uses atomic instructions and the futex syscall. */
2611
2612-#include "libgomp.h"
2613-#include "futex.h"
2614+#include "wait.h"
2615
2616+long int gomp_futex_wake = FUTEX_WAKE | FUTEX_PRIVATE_FLAG;
2617+long int gomp_futex_wait = FUTEX_WAIT | FUTEX_PRIVATE_FLAG;
2618
2619 void
2620 gomp_mutex_lock_slow (gomp_mutex_t *mutex)
2621@@ -40,7 +41,7 @@ gomp_mutex_lock_slow (gomp_mutex_t *mute
2622 {
2623 int oldval = __sync_val_compare_and_swap (mutex, 1, 2);
2624 if (oldval != 0)
2625- futex_wait (mutex, 2);
2626+ do_wait (mutex, 2);
2627 }
2628 while (!__sync_bool_compare_and_swap (mutex, 0, 2));
2629 }
2630--- libgomp/config/linux/sem.c.jj 2007-12-07 14:41:00.000000000 +0100
2631+++ libgomp/config/linux/sem.c 2008-03-26 15:11:32.000000000 +0100
2632@@ -1,4 +1,4 @@
2633-/* Copyright (C) 2005 Free Software Foundation, Inc.
2634+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2635 Contributed by Richard Henderson <rth@redhat.com>.
2636
2637 This file is part of the GNU OpenMP Library (libgomp).
2638@@ -29,8 +29,7 @@
2639 mechanism for libgomp. This type is private to the library. This
2640 implementation uses atomic instructions and the futex syscall. */
2641
2642-#include "libgomp.h"
2643-#include "futex.h"
2644+#include "wait.h"
2645
2646
2647 void
2648@@ -44,7 +43,7 @@ gomp_sem_wait_slow (gomp_sem_t *sem)
2649 if (__sync_bool_compare_and_swap (sem, val, val - 1))
2650 return;
2651 }
2652- futex_wait (sem, -1);
2653+ do_wait (sem, -1);
2654 }
2655 }
2656
2657--- libgomp/config/linux/powerpc/futex.h.jj 2007-12-07 14:41:00.000000000 +0100
2658+++ libgomp/config/linux/powerpc/futex.h 2008-03-26 15:11:32.000000000 +0100
2659@@ -1,4 +1,4 @@
2660-/* Copyright (C) 2005 Free Software Foundation, Inc.
2661+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2662 Contributed by Richard Henderson <rth@redhat.com>.
2663
2664 This file is part of the GNU OpenMP Library (libgomp).
2665@@ -28,10 +28,8 @@
2666 /* Provide target-specific access to the futex system call. */
2667
2668 #include <sys/syscall.h>
2669-#define FUTEX_WAIT 0
2670-#define FUTEX_WAKE 1
2671
2672-static inline void
2673+static inline long
2674 sys_futex0 (int *addr, int op, int val)
2675 {
2676 register long int r0 __asm__ ("r0");
2677@@ -50,21 +48,48 @@ sys_futex0 (int *addr, int op, int val)
2678 doesn't. It doesn't much matter for us. In the interest of unity,
2679 go ahead and clobber it always. */
2680
2681- __asm volatile ("sc"
2682+ __asm volatile ("sc; mfcr %0"
2683 : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6)
2684 : "r"(r0), "r"(r3), "r"(r4), "r"(r5), "r"(r6)
2685 : "r7", "r8", "r9", "r10", "r11", "r12",
2686 "cr0", "ctr", "memory");
2687+ if (__builtin_expect (r0 & (1 << 28), 0))
2688+ return r3;
2689+ return 0;
2690 }
2691
2692 static inline void
2693 futex_wait (int *addr, int val)
2694 {
2695- sys_futex0 (addr, FUTEX_WAIT, val);
2696+ long err = sys_futex0 (addr, gomp_futex_wait, val);
2697+ if (__builtin_expect (err == ENOSYS, 0))
2698+ {
2699+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2700+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2701+ sys_futex0 (addr, gomp_futex_wait, val);
2702+ }
2703 }
2704
2705 static inline void
2706 futex_wake (int *addr, int count)
2707 {
2708- sys_futex0 (addr, FUTEX_WAKE, count);
2709+ long err = sys_futex0 (addr, gomp_futex_wake, count);
2710+ if (__builtin_expect (err == ENOSYS, 0))
2711+ {
2712+ gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
2713+ gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
2714+ sys_futex0 (addr, gomp_futex_wake, count);
2715+ }
2716+}
2717+
2718+static inline void
2719+cpu_relax (void)
2720+{
2721+ __asm volatile ("" : : : "memory");
2722+}
2723+
2724+static inline void
2725+atomic_write_barrier (void)
2726+{
2727+ __asm volatile ("eieio" : : : "memory");
2728 }
2729--- libgomp/config/linux/bar.c.jj 2007-12-07 14:41:00.000000000 +0100
2730+++ libgomp/config/linux/bar.c 2008-03-26 15:11:32.000000000 +0100
2731@@ -1,4 +1,4 @@
2732-/* Copyright (C) 2005 Free Software Foundation, Inc.
2733+/* Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2734 Contributed by Richard Henderson <rth@redhat.com>.
2735
2736 This file is part of the GNU OpenMP Library (libgomp).
2737@@ -29,32 +29,29 @@
2738 mechanism for libgomp. This type is private to the library. This
2739 implementation uses atomic instructions and the futex syscall. */
2740
2741-#include "libgomp.h"
2742-#include "futex.h"
2743 #include <limits.h>
2744+#include "wait.h"
2745
2746
2747 void
2748-gomp_barrier_wait_end (gomp_barrier_t *bar, bool last)
2749+gomp_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state)
2750 {
2751- if (last)
2752+ if (__builtin_expect ((state & 1) != 0, 0))
2753 {
2754- bar->generation++;
2755- futex_wake (&bar->generation, INT_MAX);
2756+ /* Next time we'll be awaiting TOTAL threads again. */
2757+ bar->awaited = bar->total;
2758+ atomic_write_barrier ();
2759+ bar->generation += 2;
2760+ futex_wake ((int *) &bar->generation, INT_MAX);
2761 }
2762 else
2763 {
2764- unsigned int generation = bar->generation;
2765-
2766- gomp_mutex_unlock (&bar->mutex);
2767+ unsigned int generation = state;
2768
2769 do
2770- futex_wait (&bar->generation, generation);
2771+ do_wait ((int *) &bar->generation, generation);
2772 while (bar->generation == generation);
2773 }
2774-
2775- if (__sync_add_and_fetch (&bar->arrived, -1) == 0)
2776- gomp_mutex_unlock (&bar->mutex);
2777 }
2778
2779 void
2780@@ -62,3 +59,18 @@ gomp_barrier_wait (gomp_barrier_t *barri
2781 {
2782 gomp_barrier_wait_end (barrier, gomp_barrier_wait_start (barrier));
2783 }
2784+
2785+/* Like gomp_barrier_wait, except that if the encountering thread
2786+ is not the last one to hit the barrier, it returns immediately.
2787+ The intended usage is that a thread which intends to gomp_barrier_destroy
2788+ this barrier calls gomp_barrier_wait, while all other threads
2789+ call gomp_barrier_wait_last. When gomp_barrier_wait returns,
2790+ the barrier can be safely destroyed. */
2791+
2792+void
2793+gomp_barrier_wait_last (gomp_barrier_t *barrier)
2794+{
2795+ gomp_barrier_state_t state = gomp_barrier_wait_start (barrier);
2796+ if (state & 1)
2797+ gomp_barrier_wait_end (barrier, state);
2798+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ppc32-retaddr.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ppc32-retaddr.patch
deleted file mode 100644
index cf9f856de5..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-ppc32-retaddr.patch
+++ /dev/null
@@ -1,91 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22005-11-28 Jakub Jelinek <jakub@redhat.com>
3
4 * config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0,
5 read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx
6 instead of doing an extran indirection from frame_pointer_rtx.
7
8 * gcc.dg/20051128-1.c: New test.
9
10Index: gcc/config/rs6000/rs6000.c
11===================================================================
12--- gcc/config/rs6000/rs6000.c.orig 2010-03-27 03:27:39.000000000 -0700
13+++ gcc/config/rs6000/rs6000.c 2010-06-25 10:18:04.053381930 -0700
14@@ -17646,17 +17646,22 @@
15 don't try to be too clever here. */
16 if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic))
17 {
18+ rtx x;
19 cfun->machine->ra_needs_full_frame = 1;
20
21- return
22- gen_rtx_MEM
23- (Pmode,
24- memory_address
25- (Pmode,
26- plus_constant (copy_to_reg
27- (gen_rtx_MEM (Pmode,
28- memory_address (Pmode, frame))),
29- RETURN_ADDRESS_OFFSET)));
30+ if (count == 0)
31+ {
32+ gcc_assert (frame == frame_pointer_rtx);
33+ x = arg_pointer_rtx;
34+ }
35+ else
36+ {
37+ x = memory_address (Pmode, frame);
38+ x = copy_to_reg (gen_rtx_MEM (Pmode, x));
39+ }
40+
41+ x = plus_constant (x, RETURN_ADDRESS_OFFSET);
42+ return gen_rtx_MEM (Pmode, memory_address (Pmode, x));
43 }
44
45 cfun->machine->ra_need_lr = 1;
46Index: gcc/testsuite/gcc.dg/20051128-1.c
47===================================================================
48--- /dev/null 1970-01-01 00:00:00.000000000 +0000
49+++ gcc/testsuite/gcc.dg/20051128-1.c 2010-06-25 10:18:04.061382856 -0700
50@@ -0,0 +1,41 @@
51+/* { dg-do run } */
52+/* { dg-options "-O2 -fpic" } */
53+
54+extern void exit (int);
55+extern void abort (void);
56+
57+int b;
58+
59+struct A
60+{
61+ void *pad[147];
62+ void *ra, *h;
63+ long o;
64+};
65+
66+void
67+__attribute__((noinline))
68+foo (struct A *a, void *x)
69+{
70+ __builtin_memset (a, 0, sizeof (a));
71+ if (!b)
72+ exit (0);
73+}
74+
75+void
76+__attribute__((noinline))
77+bar (void)
78+{
79+ struct A a;
80+
81+ __builtin_unwind_init ();
82+ foo (&a, __builtin_return_address (0));
83+}
84+
85+int
86+main (void)
87+{
88+ bar ();
89+ abort ();
90+ return 0;
91+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr27898.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr27898.patch
deleted file mode 100644
index 7ea650f54f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr27898.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22006-08-18 Jakub Jelinek <jakub@redhat.com>
3
4 PR c/27898
5 * gcc.dg/pr27898.c: New test.
6
7--- gcc/testsuite/gcc.dg/pr27898.c.jj 2006-08-18 09:19:33.000000000 +0200
8+++ gcc/testsuite/gcc.dg/pr27898.c 2006-08-18 09:19:27.000000000 +0200
9@@ -0,0 +1,8 @@
10+/* PR c/27898 */
11+/* { dg-do compile } */
12+/* { dg-options "--combine" } */
13+/* { dg-additional-sources "pr27898.c" } */
14+
15+union u { struct { int i; }; };
16+
17+extern int foo (union u *);
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr32139.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr32139.patch
deleted file mode 100644
index b8a2aff987..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr32139.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22007-06-01 Jakub Jelinek <jakub@redhat.com>
3
4 PR tree-optimization/32139
5 * gcc.c-torture/compile/20070531-1.c: New test.
6
7--- gcc/testsuite/gcc.c-torture/compile/20070531-1.c.jj 2007-05-31 13:47:22.000000000 +0200
8+++ gcc/testsuite/gcc.c-torture/compile/20070531-1.c 2007-06-01 10:57:15.000000000 +0200
9@@ -0,0 +1,11 @@
10+/* PR tree-optimization/32139 */
11+int foo (void);
12+int bar (void) __attribute__ ((const));
13+
14+int
15+test (int x)
16+{
17+ int a = (x == 10000 ? foo : bar) ();
18+ int b = (x == 10000 ? foo : bar) ();
19+ return a + b;
20+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr33763.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr33763.patch
deleted file mode 100644
index 6fc0a1f7c1..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-pr33763.patch
+++ /dev/null
@@ -1,160 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22007-11-06 Jakub Jelinek <jakub@redhat.com>
3
4 PR tree-optimization/33763
5 * gcc.dg/pr33763.c: New test.
6 * g++.dg/opt/inline13.C: New test.
7
82007-11-06 Jan Hubicka <jh@suse.cz>
9
10 PR tree-optimization/33763
11 * tree-inline.c (expand_call_inline): Silently ignore always_inline
12 attribute for redefined extern inline functions.
13
14Index: gcc/tree-inline.c
15===================================================================
16--- gcc/tree-inline.c.orig 2010-03-18 13:07:13.000000000 -0700
17+++ gcc/tree-inline.c 2010-06-25 10:18:51.230139825 -0700
18@@ -3545,6 +3545,12 @@
19 goto egress;
20
21 if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
22+ /* For extern inline functions that get redefined we always
23+ silently ignored alway_inline flag. Better behaviour would
24+ be to be able to keep both bodies and use extern inline body
25+ for inlining, but we can't do that because frontends overwrite
26+ the body. */
27+ && !cg_edge->callee->local.redefined_extern_inline
28 /* Avoid warnings during early inline pass. */
29 && cgraph_global_info_ready)
30 {
31Index: gcc/testsuite/gcc.dg/pr33763.c
32===================================================================
33--- /dev/null 1970-01-01 00:00:00.000000000 +0000
34+++ gcc/testsuite/gcc.dg/pr33763.c 2010-06-25 10:18:51.234141302 -0700
35@@ -0,0 +1,60 @@
36+/* PR tree-optimization/33763 */
37+/* { dg-do compile } */
38+/* { dg-options "-O2" } */
39+
40+typedef struct
41+{
42+ void *a;
43+ void *b;
44+} T;
45+extern void *foo (const char *, const char *);
46+extern void *bar (void *, const char *, T);
47+extern int baz (const char *, int);
48+
49+extern inline __attribute__ ((always_inline, gnu_inline)) int
50+baz (const char *x, int y)
51+{
52+ return 2;
53+}
54+
55+int
56+baz (const char *x, int y)
57+{
58+ return 1;
59+}
60+
61+int xa, xb;
62+
63+static void *
64+inl (const char *x, const char *y)
65+{
66+ T t = { &xa, &xb };
67+ int *f = (int *) __builtin_malloc (sizeof (int));
68+ const char *z;
69+ int o = 0;
70+ void *r = 0;
71+
72+ for (z = y; *z; z++)
73+ {
74+ if (*z == 'r')
75+ o |= 1;
76+ if (*z == 'w')
77+ o |= 2;
78+ }
79+ if (o == 1)
80+ *f = baz (x, 0);
81+ if (o == 2)
82+ *f = baz (x, 1);
83+ if (o == 3)
84+ *f = baz (x, 2);
85+
86+ if (o && *f > 0)
87+ r = bar (f, "w", t);
88+ return r;
89+}
90+
91+void *
92+foo (const char *x, const char *y)
93+{
94+ return inl (x, y);
95+}
96Index: gcc/testsuite/g++.dg/opt/inline13.C
97===================================================================
98--- /dev/null 1970-01-01 00:00:00.000000000 +0000
99+++ gcc/testsuite/g++.dg/opt/inline13.C 2010-06-25 10:18:51.261052137 -0700
100@@ -0,0 +1,60 @@
101+// PR tree-optimization/33763
102+// { dg-do compile }
103+// { dg-options "-O2" }
104+
105+typedef struct
106+{
107+ void *a;
108+ void *b;
109+} T;
110+extern void *foo (const char *, const char *);
111+extern void *bar (void *, const char *, T);
112+extern int baz (const char *, int);
113+
114+extern inline __attribute__ ((always_inline, gnu_inline)) int
115+baz (const char *x, int y)
116+{
117+ return 2;
118+}
119+
120+int
121+baz (const char *x, int y)
122+{
123+ return 1;
124+}
125+
126+int xa, xb;
127+
128+static void *
129+inl (const char *x, const char *y)
130+{
131+ T t = { &xa, &xb };
132+ int *f = (int *) __builtin_malloc (sizeof (int));
133+ const char *z;
134+ int o = 0;
135+ void *r = 0;
136+
137+ for (z = y; *z; z++)
138+ {
139+ if (*z == 'r')
140+ o |= 1;
141+ if (*z == 'w')
142+ o |= 2;
143+ }
144+ if (o == 1)
145+ *f = baz (x, 0);
146+ if (o == 2)
147+ *f = baz (x, 1);
148+ if (o == 3)
149+ *f = baz (x, 2);
150+
151+ if (o && *f > 0)
152+ r = bar (f, "w", t);
153+ return r;
154+}
155+
156+void *
157+foo (const char *x, const char *y)
158+{
159+ return inl (x, y);
160+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh251682.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh251682.patch
deleted file mode 100644
index 8415073e17..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh251682.patch
+++ /dev/null
@@ -1,90 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22008-04-01 Jakub Jelinek <jakub@redhat.com>
3
4 PR pch/13675
5 * files.c (struct _cpp_file): Remove pch field.
6 (pch_open_file): Don't set file->pch, just file->pchname.
7 (should_stack_file): After pfile->cb.read_pch call
8 free pchname and clear pchname, don't close file->fd.
9 Test file->pchname instead of file->pch. Don't close fd after cb.
10 (_cpp_stack_include): Test file->pchname instead of file->pch.
11
12 * c-pch.c (c_common_read_pch): On error close (fd) resp. fclose (f).
13
14--- libcpp/files.c.jj 2008-02-18 23:50:17.000000000 +0100
15+++ libcpp/files.c 2008-03-31 15:59:01.000000000 +0200
16@@ -106,9 +106,6 @@ struct _cpp_file
17
18 /* If BUFFER above contains the true contents of the file. */
19 bool buffer_valid;
20-
21- /* File is a PCH (on return from find_include_file). */
22- bool pch;
23 };
24
25 /* A singly-linked list for all searches for a given file name, with
26@@ -322,9 +319,7 @@ pch_open_file (cpp_reader *pfile, _cpp_f
27 }
28 closedir (pchdir);
29 }
30- if (valid)
31- file->pch = true;
32- else
33+ if (!valid)
34 *invalid_pch = true;
35 }
36
37@@ -703,11 +698,12 @@ should_stack_file (cpp_reader *pfile, _c
38 return false;
39
40 /* Handle PCH files immediately; don't stack them. */
41- if (file->pch)
42+ if (file->pchname)
43 {
44 pfile->cb.read_pch (pfile, file->pchname, file->fd, file->path);
45- close (file->fd);
46 file->fd = -1;
47+ free ((void *) file->pchname);
48+ file->pchname = NULL;
49 return false;
50 }
51
52@@ -916,7 +912,7 @@ _cpp_stack_include (cpp_reader *pfile, c
53 complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we
54 found a PCH file (in which case linemap_add is not called) or we
55 were included from the command-line. */
56- if (! file->pch && file->err_no == 0 && type != IT_CMDLINE)
57+ if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
58 pfile->line_table->highest_location--;
59
60 return _cpp_stack_file (pfile, file, type == IT_IMPORT);
61--- gcc/c-pch.c.jj 2008-02-18 23:46:08.000000000 +0100
62+++ gcc/c-pch.c 2008-03-31 15:56:00.000000000 +0200
63@@ -372,6 +372,7 @@ c_common_read_pch (cpp_reader *pfile, co
64 if (f == NULL)
65 {
66 cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
67+ close (fd);
68 return;
69 }
70
71@@ -380,6 +381,7 @@ c_common_read_pch (cpp_reader *pfile, co
72 if (fread (&h, sizeof (h), 1, f) != 1)
73 {
74 cpp_errno (pfile, CPP_DL_ERROR, "reading");
75+ fclose (f);
76 return;
77 }
78
79@@ -425,7 +427,10 @@ c_common_read_pch (cpp_reader *pfile, co
80 gt_pch_restore (f);
81
82 if (cpp_read_state (pfile, name, f, smd) != 0)
83- return;
84+ {
85+ fclose (f);
86+ return;
87+ }
88
89 fclose (f);
90
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh330771.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh330771.patch
deleted file mode 100644
index 22ea108a1a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh330771.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22007-10-16 Jakub Jelinek <jakub@redhat.com>
3
4 * Makefile.am (libgcj_tools_la_LIBADD): Add.
5 * Makefile.in: Regenerated.
6
7Index: libjava/Makefile.am
8===================================================================
9--- libjava/Makefile.am.orig 2010-03-21 12:41:37.000000000 -0700
10+++ libjava/Makefile.am 2010-06-25 10:22:11.394130458 -0700
11@@ -507,6 +507,8 @@
12 libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch \
13 -fno-bootstrap-classes -fno-indirect-classes \
14 -fsource-filename=$(here)/classpath/tools/all-classes.lst
15+## See jv_convert_LDADD.
16+libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la
17 libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \
18 -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
19 $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBJAVA_LDFLAGS_NOUNDEF)
20Index: libjava/Makefile.in
21===================================================================
22--- libjava/Makefile.in.orig 2010-04-02 11:18:06.000000000 -0700
23+++ libjava/Makefile.in 2010-06-25 10:27:41.841708512 -0700
24@@ -1190,7 +1190,7 @@
25 -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
26 $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBJAVA_LDFLAGS_NOUNDEF)
27
28-libgcj_tools_la_LIBADD = libgcj.la -lm
29+libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la -lm
30 libgcj_tools_la_DEPENDENCIES = libgcj.la libgcj.spec $(am__append_22)
31 libgcj_tools_la_LINK = $(LIBLINK) $(libgcj_tools_la_LDFLAGS)
32 libjvm_la_SOURCES = jni-libjvm.cc
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh341221.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh341221.patch
deleted file mode 100644
index 67edaf1e74..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-rh341221.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22007-10-21 Jakub Jelinek <jakub@redhat.com>
3
4 * doc/Makefile.am (POD2MAN): Set date from cp-tools.texinfo
5 timestamp rather than from current date.
6 * doc/Makefile.in: Regenerated.
7
8Index: libjava/classpath/doc/Makefile.am
9===================================================================
10--- libjava/classpath/doc/Makefile.am.orig 2008-10-21 10:55:01.000000000 -0700
11+++ libjava/classpath/doc/Makefile.am 2010-06-25 10:28:30.237631599 -0700
12@@ -31,7 +31,7 @@
13 gtnameserv.1 \
14 gjdoc.1
15
16-POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
17+POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date="$(shell ls --time-style=+%F -l $(srcdir)/cp-tools.texinfo | awk '{print $$6}')"
18 TEXI2POD = perl $(srcdir)/texi2pod.pl
19 STAMP = echo timestamp >
20
21Index: libjava/classpath/doc/Makefile.in
22===================================================================
23--- libjava/classpath/doc/Makefile.in.orig 2010-04-02 11:18:06.000000000 -0700
24+++ libjava/classpath/doc/Makefile.in 2010-06-25 10:28:30.245635728 -0700
25@@ -376,7 +376,7 @@
26 gtnameserv.1 \
27 gjdoc.1
28
29-POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
30+POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date="$(shell ls --time-style=+%F -l $(srcdir)/cp-tools.texinfo | awk '{print $$6}')"
31 TEXI2POD = perl $(srcdir)/texi2pod.pl
32 STAMP = echo timestamp >
33 @GENINSRC_FALSE@STAMP_GENINSRC =
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc45-no-add-needed.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc45-no-add-needed.patch
deleted file mode 100644
index 6da24315f3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc45-no-add-needed.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22010-02-08 Roland McGrath <roland@redhat.com>
3
4 * config/rs6000/sysv4.h (LINK_EH_SPEC): Pass --no-add-needed to the
5 linker.
6 * config/linux.h (LINK_EH_SPEC): Likewise.
7 * config/alpha/elf.h (LINK_EH_SPEC): Likewise.
8 * config/ia64/linux.h (LINK_EH_SPEC): Likewise.
9
10--- gcc/config/alpha/elf.h.~1~
11+++ gcc/config/alpha/elf.h
12@@ -421,7 +421,7 @@ extern int alpha_this_gpdisp_sequence_nu
13 I imagine that other systems will catch up. In the meantime, it
14 doesn't harm to make sure that the data exists to be used later. */
15 #if defined(HAVE_LD_EH_FRAME_HDR)
16-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
17+#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
18 #endif
19
20 /* A C statement (sans semicolon) to output to the stdio stream STREAM
21--- gcc/config/ia64/linux.h.~1~
22+++ gcc/config/ia64/linux.h
23@@ -58,7 +58,7 @@ do { \
24 Signalize that because we have fde-glibc, we don't need all C shared libs
25 linked against -lgcc_s. */
26 #undef LINK_EH_SPEC
27-#define LINK_EH_SPEC ""
28+#define LINK_EH_SPEC "--no-add-needed "
29
30 #define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h"
31
32--- gcc/config/linux.h.~1~
33+++ gcc/config/linux.h
34@@ -89,7 +89,7 @@ see the files COPYING3 and COPYING.RUNTI
35 } while (0)
36
37 #if defined(HAVE_LD_EH_FRAME_HDR)
38-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
39+#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
40 #endif
41
42 /* Define this so we can compile MS code for use with WINE. */
43--- gcc/config/rs6000/sysv4.h.~1~
44+++ gcc/config/rs6000/sysv4.h
45@@ -917,7 +917,7 @@ SVR4_ASM_SPEC \
46 %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}"
47
48 #if defined(HAVE_LD_EH_FRAME_HDR)
49-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
50+# define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
51 #endif
52
53 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fortran-cross-compile-hack.patch
deleted file mode 100644
index 5a895596f4..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fortran-cross-compile-hack.patch
+++ /dev/null
@@ -1,32 +0,0 @@
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.5+svnr155514/libgfortran/configure
8===================================================================
9--- gcc-4.5+svnr155514.orig/libgfortran/configure 2009-12-29 22:02:01.000000000 -0800
10+++ gcc-4.5+svnr155514/libgfortran/configure 2009-12-30 08:12:40.889091657 -0800
11@@ -11655,7 +11655,7 @@ CC="$lt_save_CC"
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.5+svnr155514/libgfortran/configure.ac
21===================================================================
22--- gcc-4.5+svnr155514.orig/libgfortran/configure.ac 2009-12-29 22:02:01.000000000 -0800
23+++ gcc-4.5+svnr155514/libgfortran/configure.ac 2009-12-30 08:12:13.453094218 -0800
24@@ -187,7 +187,7 @@ AC_SUBST(enable_static)
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.5.1/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
deleted file mode 100644
index 3c5dea357d..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,33 +0,0 @@
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.3.1/configure.ac
9===================================================================
10--- gcc-4.3.1.orig/configure.ac 2008-07-21 12:29:18.000000000 -0700
11+++ gcc-4.3.1/configure.ac 2008-07-21 12:29:35.000000000 -0700
12@@ -2352,7 +2352,7 @@ fi
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.3.1/configure
22===================================================================
23--- gcc-4.3.1.orig/configure 2008-07-21 12:29:48.000000000 -0700
24+++ gcc-4.3.1/configure 2008-07-21 12:29:59.000000000 -0700
25@@ -5841,7 +5841,7 @@ fi
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.5.1/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
deleted file mode 100644
index eac302a421..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,116 +0,0 @@
1Upstream-Status: Inappropriate [Backport]
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.5.0/configure
75===================================================================
76--- gcc-4.5.0.orig/configure 2010-06-25 14:51:59.409382073 -0700
77+++ gcc-4.5.0/configure 2010-06-25 14:52:35.157132702 -0700
78@@ -7130,6 +7130,38 @@
79 fi
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.5.1/gcc-flags-for-build.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-flags-for-build.patch
deleted file mode 100644
index 2cf54aec73..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-flags-for-build.patch
+++ /dev/null
@@ -1,180 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5/Makefile.def
4===================================================================
5--- gcc-4.5.orig/Makefile.def
6+++ gcc-4.5/Makefile.def
7@@ -240,6 +240,7 @@ flags_to_pass = { flag= AWK ; };
8 flags_to_pass = { flag= BISON ; };
9 flags_to_pass = { flag= CC_FOR_BUILD ; };
10 flags_to_pass = { flag= CFLAGS_FOR_BUILD ; };
11+flags_to_pass = { flag= CPPFLAGS_FOR_BUILD ; };
12 flags_to_pass = { flag= CXX_FOR_BUILD ; };
13 flags_to_pass = { flag= EXPECT ; };
14 flags_to_pass = { flag= FLEX ; };
15Index: gcc-4.5/gcc/Makefile.in
16===================================================================
17--- gcc-4.5.orig/gcc/Makefile.in
18+++ gcc-4.5/gcc/Makefile.in
19@@ -766,7 +766,7 @@ BUILD_LINKERFLAGS = $(BUILD_CFLAGS)
20
21 # Native linker and preprocessor flags. For x-fragment overrides.
22 BUILD_LDFLAGS=@BUILD_LDFLAGS@
23-BUILD_CPPFLAGS=$(ALL_CPPFLAGS)
24+BUILD_CPPFLAGS=$(INCLUDES) @BUILD_CPPFLAGS@ $(X_CPPFLAGS)
25
26 # Actual name to use when installing a native compiler.
27 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
28Index: gcc-4.5/gcc/configure.ac
29===================================================================
30--- gcc-4.5.orig/gcc/configure.ac
31+++ gcc-4.5/gcc/configure.ac
32@@ -1798,16 +1798,18 @@ AC_SUBST(inhibit_libc)
33 # Also, we cannot run fixincludes.
34
35 # These are the normal (build=host) settings:
36-CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
37-BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
38-BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
39-STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
40+CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
41+BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
42+BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
43+BUILD_CPPFLAGS='$(ALL_CPPFLAGS)' AC_SUBST(BUILD_CPPFLAGS)
44+STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
45
46 # And these apply if build != host, or we are generating coverage data
47 if test x$build != x$host || test "x$coverage_flags" != x
48 then
49 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
50 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
51+ BUILD_CPPFLAGS='$(CPPFLAGS_FOR_BUILD)'
52 fi
53
54 # Expand extra_headers to include complete path.
55Index: gcc-4.5/Makefile.in
56===================================================================
57--- gcc-4.5.orig/Makefile.in
58+++ gcc-4.5/Makefile.in
59@@ -333,6 +333,7 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
60 AS_FOR_BUILD = @AS_FOR_BUILD@
61 CC_FOR_BUILD = @CC_FOR_BUILD@
62 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
63+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
64 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
65 CXX_FOR_BUILD = @CXX_FOR_BUILD@
66 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
67@@ -662,6 +663,7 @@ BASE_FLAGS_TO_PASS = \
68 "BISON=$(BISON)" \
69 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
70 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
71+ "CPPFLAGS_FOR_BUILD=$(CPPFLAGS_FOR_BUILD)" \
72 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
73 "EXPECT=$(EXPECT)" \
74 "FLEX=$(FLEX)" \
75Index: gcc-4.5/gcc/configure
76===================================================================
77--- gcc-4.5.orig/gcc/configure
78+++ gcc-4.5/gcc/configure
79@@ -707,6 +707,7 @@ SED
80 LIBTOOL
81 collect2
82 STMP_FIXINC
83+BUILD_CPPFLAGS
84 BUILD_LDFLAGS
85 BUILD_CFLAGS
86 CC_FOR_BUILD
87@@ -10982,6 +10983,7 @@ fi
88 CC_FOR_BUILD='$(CC)'
89 BUILD_CFLAGS='$(ALL_CFLAGS)'
90 BUILD_LDFLAGS='$(LDFLAGS)'
91+BUILD_CPPFLAGS='$(ALL_CPPFLAGS)'
92 STMP_FIXINC=stmp-fixinc
93
94 # And these apply if build != host, or we are generating coverage data
95@@ -10989,6 +10991,7 @@ if test x$build != x$host || test "x$cov
96 then
97 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
98 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
99+ BUILD_CPPFLAGS='$(CPPFLAGS_FOR_BUILD)'
100 fi
101
102 # Expand extra_headers to include complete path.
103@@ -17108,7 +17111,7 @@ else
104 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
105 lt_status=$lt_dlunknown
106 cat > conftest.$ac_ext <<_LT_EOF
107-#line 17111 "configure"
108+#line 17114 "configure"
109 #include "confdefs.h"
110
111 #if HAVE_DLFCN_H
112@@ -17214,7 +17217,7 @@ else
113 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
114 lt_status=$lt_dlunknown
115 cat > conftest.$ac_ext <<_LT_EOF
116-#line 17217 "configure"
117+#line 17220 "configure"
118 #include "confdefs.h"
119
120 #if HAVE_DLFCN_H
121Index: gcc-4.5/Makefile.tpl
122===================================================================
123--- gcc-4.5.orig/Makefile.tpl
124+++ gcc-4.5/Makefile.tpl
125@@ -336,6 +336,7 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
126 AS_FOR_BUILD = @AS_FOR_BUILD@
127 CC_FOR_BUILD = @CC_FOR_BUILD@
128 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
129+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
130 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
131 CXX_FOR_BUILD = @CXX_FOR_BUILD@
132 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
133Index: gcc-4.5/configure
134===================================================================
135--- gcc-4.5.orig/configure
136+++ gcc-4.5/configure
137@@ -651,6 +651,7 @@ GCJ_FOR_BUILD
138 DLLTOOL_FOR_BUILD
139 CXX_FOR_BUILD
140 CXXFLAGS_FOR_BUILD
141+CPPFLAGS_FOR_BUILD
142 CFLAGS_FOR_BUILD
143 CC_FOR_BUILD
144 AS_FOR_BUILD
145@@ -8036,6 +8037,7 @@ esac
146 # our build compiler if desired.
147 if test x"${build}" = x"${host}" ; then
148 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
149+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
150 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
151 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
152 fi
153@@ -8101,6 +8103,7 @@ done
154
155
156
157+
158
159
160
161Index: gcc-4.5/configure.ac
162===================================================================
163--- gcc-4.5.orig/configure.ac
164+++ gcc-4.5/configure.ac
165@@ -3089,6 +3089,7 @@ esac
166 # our build compiler if desired.
167 if test x"${build}" = x"${host}" ; then
168 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
169+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
170 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
171 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
172 fi
173@@ -3155,6 +3156,7 @@ AC_SUBST(AR_FOR_BUILD)
174 AC_SUBST(AS_FOR_BUILD)
175 AC_SUBST(CC_FOR_BUILD)
176 AC_SUBST(CFLAGS_FOR_BUILD)
177+AC_SUBST(CPPFLAGS_FOR_BUILD)
178 AC_SUBST(CXXFLAGS_FOR_BUILD)
179 AC_SUBST(CXX_FOR_BUILD)
180 AC_SUBST(DLLTOOL_FOR_BUILD)
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-dir-extend.patch
deleted file mode 100644
index 94e5c68843..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-dir-extend.patch
+++ /dev/null
@@ -1,26 +0,0 @@
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
13diff -ur gcc-4.5.0.orig/gcc/incpath.c gcc-4.5.0/gcc/incpath.c
14--- gcc-4.5.0.orig/gcc/incpath.c 2010-09-29 14:58:31.358975524 -0500
15+++ gcc-4.5.0/gcc/incpath.c 2010-09-29 15:08:02.065975516 -0500
16@@ -363,7 +363,9 @@
17 {
18 if ((!strncmp (p->name, "/usr/include", 12))
19 || (!strncmp (p->name, "/usr/local/include", 18))
20- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
21+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
22+ || (!strncmp (p->name, "/sw/include", 11))
23+ || (!strncmp (p->name, "/opt/include", 12)))
24 warning (OPT_Wpoison_system_directories,
25 "include location \"%s\" is unsafe for "
26 "cross-compilation",
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-system-directories.patch
deleted file mode 100644
index 59047126a3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-poison-system-directories.patch
+++ /dev/null
@@ -1,203 +0,0 @@
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.5.0/gcc/common.opt
31===================================================================
32--- gcc-4.5.0.orig/gcc/common.opt 2010-03-17 20:01:09.000000000 -0700
33+++ gcc-4.5.0/gcc/common.opt 2010-06-25 11:35:39.965383734 -0700
34@@ -152,6 +152,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.5.0/gcc/config.in
46===================================================================
47--- gcc-4.5.0.orig/gcc/config.in 2010-04-14 02:30:07.000000000 -0700
48+++ gcc-4.5.0/gcc/config.in 2010-06-25 11:35:39.969383588 -0700
49@@ -132,6 +132,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.5.0/gcc/configure.ac
63===================================================================
64--- gcc-4.5.0.orig/gcc/configure.ac 2010-06-25 11:34:01.433382161 -0700
65+++ gcc-4.5.0/gcc/configure.ac 2010-06-25 11:35:39.969383588 -0700
66@@ -4276,6 +4276,16 @@
67 fi)
68 AC_SUBST(slibdir)
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.5.0/gcc/doc/invoke.texi
84===================================================================
85--- gcc-4.5.0.orig/gcc/doc/invoke.texi 2010-04-06 07:02:22.000000000 -0700
86+++ gcc-4.5.0/gcc/doc/invoke.texi 2010-06-25 11:35:39.992666345 -0700
87@@ -252,6 +252,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@@ -3603,6 +3604,14 @@
96 option will @emph{not} warn about unknown pragmas in system
97 headers---for that, @option{-Wunknown-pragmas} must also be used.
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.5.0/gcc/gcc.c
111===================================================================
112--- gcc-4.5.0.orig/gcc/gcc.c 2010-02-11 04:23:08.000000000 -0800
113+++ gcc-4.5.0/gcc/gcc.c 2010-06-25 11:35:40.009381858 -0700
114@@ -792,6 +792,8 @@
115 %{flto} %{fwhopr} %l " LINK_PIE_SPEC \
116 "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
117 %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!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)} %(mflib)\
122 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
123Index: gcc-4.5.0/gcc/incpath.c
124===================================================================
125--- gcc-4.5.0.orig/gcc/incpath.c 2009-11-25 02:55:54.000000000 -0800
126+++ gcc-4.5.0/gcc/incpath.c 2010-06-25 11:35:40.017209818 -0700
127@@ -353,6 +353,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
152diff -ur gcc-4.5.0.orig/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in
153--- gcc-4.5.0.orig/gcc/Makefile.in 2010-09-29 17:13:49.164088845 -0500
154+++ gcc-4.5.0/gcc/Makefile.in 2010-09-29 18:48:19.300178501 -0500
155@@ -1965,7 +1965,7 @@
156
157 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
158 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
159- $(MACHMODE_H)
160+ $(MACHMODE_H) $(FLAGS_H) toplev.h
161
162 c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
163 $(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
164diff -ur gcc-4.5.0.orig/gcc/configure gcc-4.5.0/gcc/configure
165--- gcc-4.5.0.orig/gcc/configure 2010-09-29 14:58:31.702054881 -0500
166+++ gcc-4.5.0/gcc/configure 2010-09-29 18:46:31.486068500 -0500
167@@ -913,6 +913,7 @@
168 enable_maintainer_mode
169 enable_version_specific_runtime_libs
170 with_slibdir
171+enable_poison_system_directories
172 enable_plugin
173 enable_target_optspace
174 '
175@@ -1621,6 +1622,8 @@
176 --enable-version-specific-runtime-libs
177 specify that runtime libraries should be
178 installed in a compiler-specific directory
179+ --enable-poison-system-directories
180+ warn for use of native system header directories
181 --enable-plugin enable plugin support
182
183 Optional Packages:
184@@ -25339,6 +25377,19 @@
185
186
187
188+# Check whether --enable-poison-system-directories was given.
189+if test "${enable_poison_system_directories+set}" = set; then :
190+ enableval=$enable_poison_system_directories;
191+else
192+ enable_poison_system_directories=no
193+fi
194+
195+if test "x${enable_poison_system_directories}" = "xyes"; then
196+
197+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
198+
199+fi
200+
201 # Substitute configuration variables
202
203
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-uclibc-locale-ctype_touplow_t.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-uclibc-locale-ctype_touplow_t.patch
deleted file mode 100644
index e3e229295a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/gcc-uclibc-locale-ctype_touplow_t.patch
+++ /dev/null
@@ -1,69 +0,0 @@
1Upstream-Status: Pending
2
3Index: gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.h
4===================================================================
5--- gcc-4.5.orig/libstdc++-v3/config/locale/generic/c_locale.h 2010-06-30 22:30:53.993316002 -0700
6+++ gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.h 2010-06-30 22:31:26.043316001 -0700
7@@ -41,12 +41,17 @@
8
9 #include <clocale>
10 #include <cstddef>
11+#include <features.h>
12+#include <ctype.h>
13
14 #define _GLIBCXX_NUM_CATEGORIES 0
15
16 _GLIBCXX_BEGIN_NAMESPACE(std)
17-
18- typedef int* __c_locale;
19+#ifdef __UCLIBC__
20+ typedef __ctype_touplow_t* __c_locale;
21+#else
22+ typedef int* __c_locale;
23+#endif
24
25 // Convert numeric value of type double and long double to string and
26 // return length of string. If vsnprintf is available use it, otherwise
27Index: gcc-4.5/libstdc++-v3/config/os/gnu-linux/ctype_base.h
28===================================================================
29--- gcc-4.5.orig/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2010-06-30 22:30:54.013316002 -0700
30+++ gcc-4.5/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2010-06-30 22:31:26.053316001 -0700
31@@ -33,14 +33,21 @@
32 */
33
34 // Information as gleaned from /usr/include/ctype.h
35-
36+
37+#include <features.h>
38+#include <ctype.h>
39+
40 _GLIBCXX_BEGIN_NAMESPACE(std)
41
42 /// @brief Base class for ctype.
43 struct ctype_base
44 {
45 // Non-standard typedefs.
46- typedef const int* __to_type;
47+#ifdef __UCLIBC__
48+ typedef const __ctype_touplow_t* __to_type;
49+#else
50+ typedef const int* __to_type;
51+#endif
52
53 // NB: Offsets into ctype<char>::_M_table force a particular size
54 // on the mask type. Because of this, we don't use an enum.
55Index: gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.cc
56===================================================================
57--- gcc-4.5.orig/libstdc++-v3/config/locale/generic/c_locale.cc 2010-06-28 12:12:42.000000000 -0700
58+++ gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.cc 2010-06-30 22:31:26.063316001 -0700
59@@ -256,5 +256,10 @@ _GLIBCXX_END_NAMESPACE
60 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
61 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
62 extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
63+#ifdef __UCLIBC__
64+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
65+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
66+#else
67 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
68+#endif
69 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/libstdc++-emit-__cxa_end_cleanup-in-text.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/libstdc++-emit-__cxa_end_cleanup-in-text.patch
deleted file mode 100644
index 6f958fbf77..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/libstdc++-emit-__cxa_end_cleanup-in-text.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1Upstream-Status: Pending
2
32010-06-07 Khem Raj <raj.khem@gmail.com>
4
5 * libsupc++/eh_arm.cc (__cxa_end_cleanup): Use .pushsection/.popsection
6 to emit inline assembly into .text section.
7
8Index: gcc-4.5/libstdc++-v3/libsupc++/eh_arm.cc
9===================================================================
10--- gcc-4.5.orig/libstdc++-v3/libsupc++/eh_arm.cc 2010-06-04 23:20:18.000000000 -0700
11+++ gcc-4.5/libstdc++-v3/libsupc++/eh_arm.cc 2010-06-08 11:27:34.247541722 -0700
12@@ -157,22 +157,26 @@ __gnu_end_cleanup(void)
13 // Assembly wrapper to call __gnu_end_cleanup without clobbering r1-r3.
14 // Also push r4 to preserve stack alignment.
15 #ifdef __thumb__
16-asm (".global __cxa_end_cleanup\n"
17+asm (" .pushsection .text.__cxa_end_cleanup\n"
18+" .global __cxa_end_cleanup\n"
19 " .type __cxa_end_cleanup, \"function\"\n"
20 " .thumb_func\n"
21 "__cxa_end_cleanup:\n"
22 " push\t{r1, r2, r3, r4}\n"
23 " bl\t__gnu_end_cleanup\n"
24 " pop\t{r1, r2, r3, r4}\n"
25-" bl\t_Unwind_Resume @ Never returns\n");
26+" bl\t_Unwind_Resume @ Never returns\n"
27+" .popsection\n");
28 #else
29-asm (".global __cxa_end_cleanup\n"
30+asm (" .pushsection .text.__cxa_end_cleanup\n"
31+" .global __cxa_end_cleanup\n"
32 " .type __cxa_end_cleanup, \"function\"\n"
33 "__cxa_end_cleanup:\n"
34 " stmfd\tsp!, {r1, r2, r3, r4}\n"
35 " bl\t__gnu_end_cleanup\n"
36 " ldmfd\tsp!, {r1, r2, r3, r4}\n"
37-" bl\t_Unwind_Resume @ Never returns\n");
38+" bl\t_Unwind_Resume @ Never returns\n"
39+" .popsection\n");
40 #endif
41
42 #endif
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/optional_libstdc.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/optional_libstdc.patch
deleted file mode 100644
index 1da869933c..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/optional_libstdc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
4will not run correctly since my default the linker will try and link against libstdc++
5which shouldn't exist yet. We need an option to disable the automatically added -lstdc++
6option whilst leaving -lc, -lgcc and other automatic library dependencies. This patch
7adds such an option which only disables the -lstdc++ linkage.
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.3.3/gcc/cp/g++spec.c
15===================================================================
16--- gcc-4.3.3.orig/gcc/cp/g++spec.c 2010-06-29 00:06:03.901695025 +0100
17+++ gcc-4.3.3/gcc/cp/g++spec.c 2010-06-29 00:06:58.800325439 +0100
18@@ -131,6 +131,7 @@
19 if (argv[i][0] == '-')
20 {
21 if (strcmp (argv[i], "-nostdlib") == 0
22+ || strcmp (argv[i], "-nostdlib++") == 0
23 || strcmp (argv[i], "-nodefaultlibs") == 0)
24 {
25 library = -1;
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr43810.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr43810.patch
deleted file mode 100644
index e9db4c07f6..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/pr43810.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 33ba46dc9395d7a6b1496e9f273cf953d59a8d71 Mon Sep 17 00:00:00 2001
2From: froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 23 Feb 2011 18:06:29 +0000
4Subject: [PATCH 1/6] PR target/43810
5
6 Backport from mainline:
7 2010-07-23 Nathan Froyd <froydnj@codesourcery.com>
8
9 * config.host (powerpc*-eabispe*): Set tmake_file.
10 (powerpc*-eabi*): Likewise.
11 * config/rs6000/t-ppccomm (EXTRA_PARTS): Add crtbegin, crtend,
12 crtbeginS, crtendS, crtbeginT.
13
14git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch@170443 138bc75d-0d04-0410-961f-82ee72b054a4
15---
16 libgcc/config.host | 2 ++
17 libgcc/config/rs6000/t-ppccomm | 4 +++-
18 2 files changed, 5 insertions(+), 1 deletions(-)
19
20diff --git a/libgcc/config.host b/libgcc/config.host
21index fe3465e..f85c723 100644
22--- a/libgcc/config.host
23+++ b/libgcc/config.host
24@@ -454,6 +454,7 @@ powerpc*-*-freebsd*)
25 powerpc-*-netbsd*)
26 ;;
27 powerpc-*-eabispe*)
28+ tmake_file="${tmake_file} rs6000/t-ppccomm"
29 ;;
30 powerpc-*-eabisimaltivec*)
31 ;;
32@@ -464,6 +465,7 @@ powerpc-*-elf*)
33 powerpc-*-eabialtivec*)
34 ;;
35 powerpc-*-eabi*)
36+ tmake_file="${tmake_file} rs6000/t-ppccomm"
37 ;;
38 powerpc-*-rtems*)
39 ;;
40diff --git a/libgcc/config/rs6000/t-ppccomm b/libgcc/config/rs6000/t-ppccomm
41index 1a711eb..4548cd7 100644
42--- a/libgcc/config/rs6000/t-ppccomm
43+++ b/libgcc/config/rs6000/t-ppccomm
44@@ -15,7 +15,9 @@ LIB2ADD_ST += crtsavfpr.S crtresfpr.S \
45 e500crtsavg64gpr.S \
46 e500crtsavg64gprctr.S
47
48-EXTRA_PARTS += ecrti$(objext) ecrtn$(objext) ncrti$(objext) ncrtn$(objext)
49+EXTRA_PARTS += crtbegin$(objext) crtend$(objext) \
50+ crtbeginS$(objext) crtendS$(objext) crtbeginT$(objext) \
51+ ecrti$(objext) ecrtn$(objext) ncrti$(objext) ncrtn$(objext)
52
53 # We build {e,n}crti.o and {e,n}crtn.o, which serve to add begin and
54 # end labels to all of the special sections used when we link using gcc.
55--
561.7.4
57
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch
deleted file mode 100644
index 9cf187a423..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch
+++ /dev/null
@@ -1,119 +0,0 @@
1From cb13264f07c419149b86e19c2187729bda8dd47d Mon Sep 17 00:00:00 2001
2From: jiez <jiez@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Fri, 23 Jul 2010 14:47:46 +0000
4Subject: [PATCH 2/6] PR target/44290 * attribs.c (decl_attributes): Insert "noinline" and "noclone" if "naked". * tree-sra.c (ipa_sra_preliminary_function_checks): Return false if ! tree_versionable_function_p.
5
6 testsuite/
7 PR target/44290
8 * gcc.dg/pr44290-1.c: New test.
9 * gcc.dg/pr44290-2.c: New test.
10
11git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162466 138bc75d-0d04-0410-961f-82ee72b054a4
12---
13 gcc/attribs.c | 13 +++++++++++++
14 gcc/testsuite/gcc.dg/pr44290-1.c | 18 ++++++++++++++++++
15 gcc/testsuite/gcc.dg/pr44290-2.c | 24 ++++++++++++++++++++++++
16 gcc/tree-sra.c | 7 +++++++
17 4 files changed, 62 insertions(+), 0 deletions(-)
18 create mode 100644 gcc/testsuite/gcc.dg/pr44290-1.c
19 create mode 100644 gcc/testsuite/gcc.dg/pr44290-2.c
20
21diff --git a/gcc/attribs.c b/gcc/attribs.c
22index 4d91a0d..2e06608 100644
23--- a/gcc/attribs.c
24+++ b/gcc/attribs.c
25@@ -278,6 +278,19 @@ decl_attributes (tree *node, tree attributes, int flags)
26 TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
27 }
28
29+ /* A "naked" function attribute implies "noinline" and "noclone" for
30+ those targets that support it. */
31+ if (TREE_CODE (*node) == FUNCTION_DECL
32+ && lookup_attribute_spec (get_identifier ("naked"))
33+ && lookup_attribute ("naked", attributes) != NULL)
34+ {
35+ if (lookup_attribute ("noinline", attributes) == NULL)
36+ attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
37+
38+ if (lookup_attribute ("noclone", attributes) == NULL)
39+ attributes = tree_cons (get_identifier ("noclone"), NULL, attributes);
40+ }
41+
42 targetm.insert_attributes (*node, &attributes);
43
44 for (a = attributes; a; a = TREE_CHAIN (a))
45diff --git a/gcc/testsuite/gcc.dg/pr44290-1.c b/gcc/testsuite/gcc.dg/pr44290-1.c
46new file mode 100644
47index 0000000..071a271
48--- /dev/null
49+++ b/gcc/testsuite/gcc.dg/pr44290-1.c
50@@ -0,0 +1,18 @@
51+/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
52+/* { dg-options "-O2 -fdump-tree-optimized" } */
53+
54+static void __attribute__((naked))
55+foo(void *from, void *to)
56+{
57+ asm volatile("dummy"::"r"(from), "r"(to));
58+}
59+
60+unsigned int fie[2];
61+
62+void fum(void *to)
63+{
64+ foo(fie, to);
65+}
66+
67+/* { dg-final { scan-tree-dump "foo \\\(void \\\* from, void \\\* to\\\)" "optimized" } } */
68+/* { dg-final { cleanup-tree-dump "optimized" } } */
69diff --git a/gcc/testsuite/gcc.dg/pr44290-2.c b/gcc/testsuite/gcc.dg/pr44290-2.c
70new file mode 100644
71index 0000000..1951a51
72--- /dev/null
73+++ b/gcc/testsuite/gcc.dg/pr44290-2.c
74@@ -0,0 +1,24 @@
75+/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
76+/* { dg-options "-O2 -fdump-tree-optimized" } */
77+
78+static unsigned long __attribute__((naked))
79+foo (unsigned long base)
80+{
81+ asm volatile ("dummy");
82+}
83+unsigned long
84+bar (void)
85+{
86+ static int start, set;
87+
88+ if (!set)
89+ {
90+ set = 1;
91+ start = foo (0);
92+ }
93+
94+ return foo (start);
95+}
96+
97+/* { dg-final { scan-tree-dump "foo \\\(long unsigned int base\\\)" "optimized" } } */
98+/* { dg-final { cleanup-tree-dump "optimized" } } */
99diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
100index 6a5b577..ea37d97 100644
101--- a/gcc/tree-sra.c
102+++ b/gcc/tree-sra.c
103@@ -4126,6 +4126,13 @@ modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
104 static bool
105 ipa_sra_preliminary_function_checks (struct cgraph_node *node)
106 {
107+ if (!tree_versionable_function_p (current_function_decl))
108+ {
109+ if (dump_file)
110+ fprintf (dump_file, "Function isn't allowed to be versioned.\n");
111+ return false;
112+ }
113+
114 if (!cgraph_node_can_be_local_p (node))
115 {
116 if (dump_file)
117--
1181.7.4
119
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr44606.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr44606.patch
deleted file mode 100644
index dd590bbe80..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/pr44606.patch
+++ /dev/null
@@ -1,106 +0,0 @@
1From aff0ca6587a2f0849db55eef62a85bc8721869f2 Mon Sep 17 00:00:00 2001
2From: froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Tue, 1 Feb 2011 02:11:54 +0000
4Subject: [PATCH 3/6] gcc/ Backport from mainline: 2010-12-30 Nathan Froyd <froydnj@codesourcery.com>
5
6 PR target/44606
7 * reload1.c (choose_reload_regs): Don't look for equivalences for
8 output reloads of constant loads.
9
10gcc/testsuite/
11 Backport from mainline:
12 2010-12-30 Nathan Froyd <froydnj@codesourcery.com>
13
14 PR target/44606
15 * gcc.dg/pr44606.c: New test.
16
17git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch@169465 138bc75d-0d04-0410-961f-82ee72b054a4
18---
19 gcc/reload1.c | 11 --------
20 gcc/testsuite/gcc.dg/pr44606.c | 52 ++++++++++++++++++++++++++++++++++++++++
21 2 files changed, 52 insertions(+), 11 deletions(-)
22 create mode 100644 gcc/testsuite/gcc.dg/pr44606.c
23
24diff --git a/gcc/reload1.c b/gcc/reload1.c
25index 02fef2d..5732677 100644
26--- a/gcc/reload1.c
27+++ b/gcc/reload1.c
28@@ -6273,17 +6273,6 @@ choose_reload_regs (struct insn_chain *chain)
29 && (rld[r].nregs == max_group_size
30 || ! reg_classes_intersect_p (rld[r].rclass, group_class)))
31 search_equiv = rld[r].in;
32- /* If this is an output reload from a simple move insn, look
33- if an equivalence for the input is available. */
34- else if (inheritance && rld[r].in == 0 && rld[r].out != 0)
35- {
36- rtx set = single_set (insn);
37-
38- if (set
39- && rtx_equal_p (rld[r].out, SET_DEST (set))
40- && CONSTANT_P (SET_SRC (set)))
41- search_equiv = SET_SRC (set);
42- }
43
44 if (search_equiv)
45 {
46diff --git a/gcc/testsuite/gcc.dg/pr44606.c b/gcc/testsuite/gcc.dg/pr44606.c
47new file mode 100644
48index 0000000..3929775
49--- /dev/null
50+++ b/gcc/testsuite/gcc.dg/pr44606.c
51@@ -0,0 +1,52 @@
52+/* PR target/44606 */
53+/* { dg-do run } */
54+/* { dg-options "-O2" } */
55+
56+#include <stdio.h>
57+
58+extern void abort (void);
59+
60+ typedef struct _PixelPacket { unsigned char r, g, b; }
61+ PixelPacket;
62+#define ARRAYLEN(X) (sizeof(X)/sizeof(X[0]))
63+PixelPacket q[6];
64+#define COLS (ARRAYLEN(q) - 1)
65+PixelPacket p[2*COLS + 22];
66+#define Minify(POS, WEIGHT) do { \
67+ total_r += (WEIGHT)*(p[POS].r); \
68+ total_g += (WEIGHT)*(p[POS].g); \
69+ total_b += (WEIGHT)*(p[POS].b); \
70+} while (0)
71+unsigned long columns = COLS;
72+int main(void)
73+{
74+ static const unsigned char answers[COLS] = { 31, 32, 34, 35, 36 };
75+ unsigned long x;
76+ for (x = 0; x < sizeof(p)/sizeof(p[0]); x++) {
77+ p[x].b = (x + 34) | 1;
78+ }
79+ for (x = 0; x < columns; x++) {
80+ double total_r = 0, total_g = 0, total_b = 0;
81+ double saved_r = 0, saved_g = 0, saved_b = 0;
82+ Minify(2*x + 0, 3.0);
83+ Minify(2*x + 1, 7.0);
84+ Minify(2*x + 2, 7.0);
85+ saved_r = total_r;
86+ saved_g = total_g;
87+ Minify(2*x + 11, 15.0);
88+ Minify(2*x + 12, 7.0);
89+ Minify(2*x + 18, 7.0);
90+ Minify(2*x + 19, 15.0);
91+ Minify(2*x + 20, 15.0);
92+ Minify(2*x + 21, 7.0);
93+ q[x].r = (unsigned char)(total_r/128.0 + 0.5);
94+ q[x].g = (unsigned char)(total_g/128.0 + 0.5);
95+ q[x].b = (unsigned char)(total_b/128.0 + 0.5);
96+ fprintf(stderr, "r:%f g:%f b:%f\n", saved_r, saved_g, saved_b);
97+ }
98+ for (x = 0; x < COLS; x++) {
99+ if (answers[x] != q[x].b)
100+ abort();
101+ }
102+ return 0;
103+}
104--
1051.7.4
106
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr44618.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr44618.patch
deleted file mode 100644
index 23f41ccd90..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/pr44618.patch
+++ /dev/null
@@ -1,314 +0,0 @@
1Upstream-Status: Pending
2
3Backport of bugfix in gcc-4.6.x and mainline that address bug 44618 in
4which we get wrong code generation with -Os -frename-registers.
5
6 2011-06-13 Edmar Wienskoski <edmar@freescale.com>
7
8 PR target/44618
9 * config/rs6000/rs6000.md (save_gpregs_<mode>): Replaced pattern
10 with a set of similar patterns, where the MATCH_OPERAND for the
11 function argument is replaced with individual references to hardware
12 registers.
13 (save_fpregs_<mode>): Ditto
14 (restore_gpregs_<mode>): Ditto
15 (return_and_restore_gpregs_<mode>): Ditto
16 (return_and_restore_fpregs_<mode>): Ditto
17 (return_and_restore_fpregs_aix_<mode>): Ditto
18
19 * gcc.target/powerpc/outofline_rnreg.c: New testcase.
20
21Index: gcc-4.5.1/gcc/config/rs6000/rs6000.md
22===================================================================
23--- gcc-4.5.1.orig/gcc/config/rs6000/rs6000.md
24+++ gcc-4.5.1/gcc/config/rs6000/rs6000.md
25@@ -15256,25 +15256,88 @@
26 "{stm|stmw} %2,%1"
27 [(set_attr "type" "store_ux")])
28
29-(define_insn "*save_gpregs_<mode>"
30+; The following comment applies to:
31+; save_gpregs_*
32+; save_fpregs_*
33+; restore_gpregs*
34+; return_and_restore_gpregs*
35+; return_and_restore_fpregs*
36+; return_and_restore_fpregs_aix*
37+;
38+; The out-of-line save / restore functions expects one input argument.
39+; Since those are not standard call_insn's, we must avoid using
40+; MATCH_OPERAND for that argument. That way the register rename
41+; optimization will not try to rename this register.
42+; Each pattern is repeated for each possible register number used in
43+; various ABIs (r11, r1, and for some functions r12)
44+
45+(define_insn "*save_gpregs_<mode>_r11"
46+ [(match_parallel 0 "any_parallel_operand"
47+ [(clobber (reg:P 65))
48+ (use (match_operand:P 1 "symbol_ref_operand" "s"))
49+ (use (reg:P 11))
50+ (set (match_operand:P 2 "memory_operand" "=m")
51+ (match_operand:P 3 "gpc_reg_operand" "r"))])]
52+ ""
53+ "bl %1"
54+ [(set_attr "type" "branch")
55+ (set_attr "length" "4")])
56+
57+(define_insn "*save_gpregs_<mode>_r12"
58+ [(match_parallel 0 "any_parallel_operand"
59+ [(clobber (reg:P 65))
60+ (use (match_operand:P 1 "symbol_ref_operand" "s"))
61+ (use (reg:P 12))
62+ (set (match_operand:P 2 "memory_operand" "=m")
63+ (match_operand:P 3 "gpc_reg_operand" "r"))])]
64+ ""
65+ "bl %1"
66+ [(set_attr "type" "branch")
67+ (set_attr "length" "4")])
68+
69+(define_insn "*save_gpregs_<mode>_r1"
70+ [(match_parallel 0 "any_parallel_operand"
71+ [(clobber (reg:P 65))
72+ (use (match_operand:P 1 "symbol_ref_operand" "s"))
73+ (use (reg:P 1))
74+ (set (match_operand:P 2 "memory_operand" "=m")
75+ (match_operand:P 3 "gpc_reg_operand" "r"))])]
76+ ""
77+ "bl %1"
78+ [(set_attr "type" "branch")
79+ (set_attr "length" "4")])
80+
81+(define_insn "*save_fpregs_<mode>_r11"
82+ [(match_parallel 0 "any_parallel_operand"
83+ [(clobber (reg:P 65))
84+ (use (match_operand:P 1 "symbol_ref_operand" "s"))
85+ (use (reg:P 11))
86+ (set (match_operand:DF 2 "memory_operand" "=m")
87+ (match_operand:DF 3 "gpc_reg_operand" "d"))])]
88+ ""
89+ "bl %1"
90+ [(set_attr "type" "branch")
91+ (set_attr "length" "4")])
92+
93+(define_insn "*save_fpregs_<mode>_r12"
94 [(match_parallel 0 "any_parallel_operand"
95 [(clobber (reg:P 65))
96 (use (match_operand:P 1 "symbol_ref_operand" "s"))
97- (use (match_operand:P 2 "gpc_reg_operand" "r"))
98- (set (match_operand:P 3 "memory_operand" "=m")
99- (match_operand:P 4 "gpc_reg_operand" "r"))])]
100+ (use (reg:P 12))
101+ (set (match_operand:DF 2 "memory_operand" "=m")
102+ (match_operand:DF 3 "gpc_reg_operand" "d"))])]
103 ""
104 "bl %1"
105 [(set_attr "type" "branch")
106 (set_attr "length" "4")])
107
108-(define_insn "*save_fpregs_<mode>"
109+(define_insn "*save_fpregs_<mode>_r1"
110 [(match_parallel 0 "any_parallel_operand"
111 [(clobber (reg:P 65))
112 (use (match_operand:P 1 "symbol_ref_operand" "s"))
113- (use (match_operand:P 2 "gpc_reg_operand" "r"))
114- (set (match_operand:DF 3 "memory_operand" "=m")
115- (match_operand:DF 4 "gpc_reg_operand" "d"))])]
116+ (use (reg:P 1))
117+ (set (match_operand:DF 2 "memory_operand" "=m")
118+ (match_operand:DF 3 "gpc_reg_operand" "d"))])]
119 ""
120 "bl %1"
121 [(set_attr "type" "branch")
122@@ -15372,52 +15435,156 @@
123 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
124 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
125
126-(define_insn "*restore_gpregs_<mode>"
127+; The following comment applies to:
128+; save_gpregs_*
129+; save_fpregs_*
130+; restore_gpregs*
131+; return_and_restore_gpregs*
132+; return_and_restore_fpregs*
133+; return_and_restore_fpregs_aix*
134+;
135+; The out-of-line save / restore functions expects one input argument.
136+; Since those are not standard call_insn's, we must avoid using
137+; MATCH_OPERAND for that argument. That way the register rename
138+; optimization will not try to rename this register.
139+; Each pattern is repeated for each possible register number used in
140+; various ABIs (r11, r1, and for some functions r12)
141+
142+(define_insn "*restore_gpregs_<mode>_r11"
143+ [(match_parallel 0 "any_parallel_operand"
144+ [(clobber (match_operand:P 1 "register_operand" "=l"))
145+ (use (match_operand:P 2 "symbol_ref_operand" "s"))
146+ (use (reg:P 11))
147+ (set (match_operand:P 3 "gpc_reg_operand" "=r")
148+ (match_operand:P 4 "memory_operand" "m"))])]
149+ ""
150+ "bl %2"
151+ [(set_attr "type" "branch")
152+ (set_attr "length" "4")])
153+
154+(define_insn "*restore_gpregs_<mode>_r12"
155 [(match_parallel 0 "any_parallel_operand"
156 [(clobber (match_operand:P 1 "register_operand" "=l"))
157 (use (match_operand:P 2 "symbol_ref_operand" "s"))
158- (use (match_operand:P 3 "gpc_reg_operand" "r"))
159- (set (match_operand:P 4 "gpc_reg_operand" "=r")
160- (match_operand:P 5 "memory_operand" "m"))])]
161+ (use (reg:P 12))
162+ (set (match_operand:P 3 "gpc_reg_operand" "=r")
163+ (match_operand:P 4 "memory_operand" "m"))])]
164 ""
165 "bl %2"
166 [(set_attr "type" "branch")
167 (set_attr "length" "4")])
168
169-(define_insn "*return_and_restore_gpregs_<mode>"
170+(define_insn "*restore_gpregs_<mode>_r1"
171+ [(match_parallel 0 "any_parallel_operand"
172+ [(clobber (match_operand:P 1 "register_operand" "=l"))
173+ (use (match_operand:P 2 "symbol_ref_operand" "s"))
174+ (use (reg:P 1))
175+ (set (match_operand:P 3 "gpc_reg_operand" "=r")
176+ (match_operand:P 4 "memory_operand" "m"))])]
177+ ""
178+ "bl %2"
179+ [(set_attr "type" "branch")
180+ (set_attr "length" "4")])
181+
182+(define_insn "*return_and_restore_gpregs_<mode>_r11"
183+ [(match_parallel 0 "any_parallel_operand"
184+ [(return)
185+ (clobber (match_operand:P 1 "register_operand" "=l"))
186+ (use (match_operand:P 2 "symbol_ref_operand" "s"))
187+ (use (reg:P 11))
188+ (set (match_operand:P 3 "gpc_reg_operand" "=r")
189+ (match_operand:P 4 "memory_operand" "m"))])]
190+ ""
191+ "b %2"
192+ [(set_attr "type" "branch")
193+ (set_attr "length" "4")])
194+
195+(define_insn "*return_and_restore_gpregs_<mode>_r12"
196+ [(match_parallel 0 "any_parallel_operand"
197+ [(return)
198+ (clobber (match_operand:P 1 "register_operand" "=l"))
199+ (use (match_operand:P 2 "symbol_ref_operand" "s"))
200+ (use (reg:P 12))
201+ (set (match_operand:P 3 "gpc_reg_operand" "=r")
202+ (match_operand:P 4 "memory_operand" "m"))])]
203+ ""
204+ "b %2"
205+ [(set_attr "type" "branch")
206+ (set_attr "length" "4")])
207+
208+(define_insn "*return_and_restore_gpregs_<mode>_r1"
209 [(match_parallel 0 "any_parallel_operand"
210 [(return)
211 (clobber (match_operand:P 1 "register_operand" "=l"))
212 (use (match_operand:P 2 "symbol_ref_operand" "s"))
213- (use (match_operand:P 3 "gpc_reg_operand" "r"))
214- (set (match_operand:P 4 "gpc_reg_operand" "=r")
215- (match_operand:P 5 "memory_operand" "m"))])]
216+ (use (reg:P 1))
217+ (set (match_operand:P 3 "gpc_reg_operand" "=r")
218+ (match_operand:P 4 "memory_operand" "m"))])]
219 ""
220 "b %2"
221 [(set_attr "type" "branch")
222 (set_attr "length" "4")])
223
224-(define_insn "*return_and_restore_fpregs_<mode>"
225+(define_insn "*return_and_restore_fpregs_<mode>_r11"
226 [(match_parallel 0 "any_parallel_operand"
227 [(return)
228 (clobber (match_operand:P 1 "register_operand" "=l"))
229 (use (match_operand:P 2 "symbol_ref_operand" "s"))
230- (use (match_operand:P 3 "gpc_reg_operand" "r"))
231- (set (match_operand:DF 4 "gpc_reg_operand" "=d")
232- (match_operand:DF 5 "memory_operand" "m"))])]
233+ (use (reg:P 11))
234+ (set (match_operand:DF 3 "gpc_reg_operand" "=d")
235+ (match_operand:DF 4 "memory_operand" "m"))])]
236+ ""
237+ "b %2"
238+ [(set_attr "type" "branch")
239+ (set_attr "length" "4")])
240+
241+(define_insn "*return_and_restore_fpregs_<mode>_r12"
242+ [(match_parallel 0 "any_parallel_operand"
243+ [(return)
244+ (clobber (match_operand:P 1 "register_operand" "=l"))
245+ (use (match_operand:P 2 "symbol_ref_operand" "s"))
246+ (use (reg:P 12))
247+ (set (match_operand:DF 3 "gpc_reg_operand" "=d")
248+ (match_operand:DF 4 "memory_operand" "m"))])]
249+ ""
250+ "b %2"
251+ [(set_attr "type" "branch")
252+ (set_attr "length" "4")])
253+
254+(define_insn "*return_and_restore_fpregs_<mode>_r1"
255+ [(match_parallel 0 "any_parallel_operand"
256+ [(return)
257+ (clobber (match_operand:P 1 "register_operand" "=l"))
258+ (use (match_operand:P 2 "symbol_ref_operand" "s"))
259+ (use (reg:P 1))
260+ (set (match_operand:DF 3 "gpc_reg_operand" "=d")
261+ (match_operand:DF 4 "memory_operand" "m"))])]
262+ ""
263+ "b %2"
264+ [(set_attr "type" "branch")
265+ (set_attr "length" "4")])
266+
267+(define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
268+ [(match_parallel 0 "any_parallel_operand"
269+ [(return)
270+ (use (match_operand:P 1 "register_operand" "l"))
271+ (use (match_operand:P 2 "symbol_ref_operand" "s"))
272+ (use (reg:P 11))
273+ (set (match_operand:DF 3 "gpc_reg_operand" "=d")
274+ (match_operand:DF 4 "memory_operand" "m"))])]
275 ""
276 "b %2"
277 [(set_attr "type" "branch")
278 (set_attr "length" "4")])
279
280-(define_insn "*return_and_restore_fpregs_aix_<mode>"
281+(define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
282 [(match_parallel 0 "any_parallel_operand"
283 [(return)
284 (use (match_operand:P 1 "register_operand" "l"))
285 (use (match_operand:P 2 "symbol_ref_operand" "s"))
286- (use (match_operand:P 3 "gpc_reg_operand" "r"))
287- (set (match_operand:DF 4 "gpc_reg_operand" "=d")
288- (match_operand:DF 5 "memory_operand" "m"))])]
289+ (use (reg:P 1))
290+ (set (match_operand:DF 3 "gpc_reg_operand" "=d")
291+ (match_operand:DF 4 "memory_operand" "m"))])]
292 ""
293 "b %2"
294 [(set_attr "type" "branch")
295Index: gcc-4.5.1/gcc/testsuite/gcc.target/powerpc/outofline_rnreg.c
296===================================================================
297--- /dev/null
298+++ gcc-4.5.1/gcc/testsuite/gcc.target/powerpc/outofline_rnreg.c
299@@ -0,0 +1,15 @@
300+/* Test that registers used by out of line restore functions does not get renamed.
301+ AIX, and 64 bit targets uses r1, which rnreg stays away from.
302+ Linux 32 bits targets uses r11, which is susceptible to be renamed */
303+/* { dg-do compile } */
304+/* { dg-require-effective-target ilp32 } */
305+/* { dg-options "-Os -frename-registers -fdump-rtl-rnreg" } */
306+/* "* renamed" or "* no available better choice" results are not acceptable */
307+/* { dg-final { scan-rtl-dump-not "Register 11 in insn *" "rnreg" { target powerpc*-*-linux* } } } */
308+/* { dg-final { cleanup-rtl-dump "rnreg" } } */
309+int
310+calc (int j)
311+{
312+ if (j<=1) return 1;
313+ return calc(j-1)*(j+1);
314+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr45052.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr45052.patch
deleted file mode 100644
index 855a8230ee..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/pr45052.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 138f1af2d77d56762a2c2af4759efd53c275b67e Mon Sep 17 00:00:00 2001
2From: Ilya Yanok <yanok@emcraft.com>
3Date: Mon, 21 Mar 2011 00:49:43 +0100
4Subject: [PATCH 5/6] PR45052
5
6---
7 gcc/ipa-pure-const.c | 7 +++++++
8 1 files changed, 7 insertions(+), 0 deletions(-)
9
10diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
11index 166dabb..da9d5d6 100644
12--- a/gcc/ipa-pure-const.c
13+++ b/gcc/ipa-pure-const.c
14@@ -416,6 +416,13 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
15 print_gimple_stmt (dump_file, stmt, 0, 0);
16 }
17
18+ if (gimple_has_volatile_ops (stmt))
19+ {
20+ local->pure_const_state = IPA_NEITHER;
21+ if (dump_file)
22+ fprintf (dump_file, " Volatile stmt is not const/pure\n");
23+ }
24+
25 /* Look for loads and stores. */
26 walk_stmt_load_store_ops (stmt, local, check_load, check_store);
27
28--
291.7.4
30
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr45094.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr45094.patch
deleted file mode 100644
index 182e0055db..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/pr45094.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1From 34bd4baaa0f6583f9ff99544c732350c199ec0e2 Mon Sep 17 00:00:00 2001
2From: qiyao <qiyao@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 18 Aug 2010 12:33:43 +0000
4Subject: [PATCH 4/6] gcc/ PR target/45094 * config/arm/arm.c (output_move_double): Fix typo generating instructions ('ldr'->'str').
5
6gcc/testsuite/
7
8 PR target/45094
9 * gcc.target/arm/pr45094.c: New test.
10
11git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163338 138bc75d-0d04-0410-961f-82ee72b054a4
12---
13 gcc/config/arm/arm.c | 8 ++++----
14 gcc/testsuite/gcc.target/arm/pr45094.c | 27 +++++++++++++++++++++++++++
15 2 files changed, 31 insertions(+), 4 deletions(-)
16 create mode 100644 gcc/testsuite/gcc.target/arm/pr45094.c
17
18diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
19index a06a38b..0382b24 100644
20--- a/gcc/config/arm/arm.c
21+++ b/gcc/config/arm/arm.c
22@@ -12182,13 +12182,13 @@ output_move_double (rtx *operands)
23 {
24 if (GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)
25 {
26- output_asm_insn ("ldr%?\t%0, [%1, %2]!", otherops);
27- output_asm_insn ("ldr%?\t%H0, [%1, #4]", otherops);
28+ output_asm_insn ("str%?\t%0, [%1, %2]!", otherops);
29+ output_asm_insn ("str%?\t%H0, [%1, #4]", otherops);
30 }
31 else
32 {
33- output_asm_insn ("ldr%?\t%H0, [%1, #4]", otherops);
34- output_asm_insn ("ldr%?\t%0, [%1], %2", otherops);
35+ output_asm_insn ("str%?\t%H0, [%1, #4]", otherops);
36+ output_asm_insn ("str%?\t%0, [%1], %2", otherops);
37 }
38 }
39 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)
40diff --git a/gcc/testsuite/gcc.target/arm/pr45094.c b/gcc/testsuite/gcc.target/arm/pr45094.c
41new file mode 100644
42index 0000000..05f16d8
43--- /dev/null
44+++ b/gcc/testsuite/gcc.target/arm/pr45094.c
45@@ -0,0 +1,27 @@
46+/* { dg-do run } */
47+/* { dg-require-effective-target arm_neon_hw } */
48+/* { dg-options "-O2 -mcpu=cortex-a8" } */
49+/* { dg-add-options arm_neon } */
50+
51+#include <stdlib.h>
52+
53+long long buffer[32];
54+
55+void __attribute__((noinline)) f(long long *p, int n)
56+{
57+ while (--n >= 0)
58+ {
59+ *p = 1;
60+ p += 32;
61+ }
62+}
63+
64+int main(void)
65+{
66+ f(buffer, 1);
67+
68+ if (!buffer[0])
69+ abort();
70+
71+ return 0;
72+}
73--
741.7.4
75
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr45886.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr45886.patch
deleted file mode 100644
index 36aa37e4ac..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/pr45886.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1From d066d0682da4e60b811d9282b00128244caa5c29 Mon Sep 17 00:00:00 2001
2From: Ilya Yanok <yanok@emcraft.com>
3Date: Mon, 21 Mar 2011 00:55:25 +0100
4Subject: [PATCH 6/6] PR45886
5
6---
7 gcc/config/arm/arm.c | 2 +-
8 gcc/config/arm/arm.h | 11 ++++++++++-
9 2 files changed, 11 insertions(+), 2 deletions(-)
10
11diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
12index 0382b24..5634829 100644
13--- a/gcc/config/arm/arm.c
14+++ b/gcc/config/arm/arm.c
15@@ -700,7 +700,7 @@ static int after_arm_reorg = 0;
16 /* The maximum number of insns to be used when loading a constant. */
17 static int arm_constant_limit = 3;
18
19-static enum arm_pcs arm_pcs_default;
20+enum arm_pcs arm_pcs_default;
21
22 /* For an explanation of these variables, see final_prescan_insn below. */
23 int arm_ccfsm_state;
24diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
25index 26ffaf8..ac7bbb3 100644
26--- a/gcc/config/arm/arm.h
27+++ b/gcc/config/arm/arm.h
28@@ -94,7 +94,13 @@ extern char arm_arch_name[];
29 if (arm_arch_iwmmxt) \
30 builtin_define ("__IWMMXT__"); \
31 if (TARGET_AAPCS_BASED) \
32- builtin_define ("__ARM_EABI__"); \
33+ { \
34+ if (arm_pcs_default == ARM_PCS_AAPCS_VFP) \
35+ builtin_define ("__ARM_PCS_VFP"); \
36+ else if (arm_pcs_default == ARM_PCS_AAPCS) \
37+ builtin_define ("__ARM_PCS"); \
38+ builtin_define ("__ARM_EABI__"); \
39+ } \
40 } while (0)
41
42 /* The various ARM cores. */
43@@ -1648,6 +1654,9 @@ enum arm_pcs
44 ARM_PCS_UNKNOWN
45 };
46
47+/* Default procedure calling standard of current compilation unit. */
48+extern enum arm_pcs arm_pcs_default;
49+
50 /* A C type for declaring a variable that is used as the first argument of
51 `FUNCTION_ARG' and other related values. */
52 typedef struct
53--
541.7.4
55
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/use-defaults.h-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/use-defaults.h-and-t-oe-in-B.patch
deleted file mode 100644
index c93e6caa06..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/use-defaults.h-and-t-oe-in-B.patch
+++ /dev/null
@@ -1,57 +0,0 @@
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 3 files changed, 5 insertions(+), 5 deletions(-)
11
12diff --git a/gcc/Makefile.in b/gcc/Makefile.in
13index d91f93a..03ee2bd 100644
14--- a/gcc/Makefile.in
15+++ b/gcc/Makefile.in
16@@ -461,7 +461,7 @@ LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
17 TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
18
19 xmake_file=@xmake_file@
20-tmake_file=@tmake_file@
21+tmake_file=@tmake_file@ ./t-oe
22 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
23 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
24 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
25diff --git a/gcc/configure b/gcc/configure
26index f440fa2..dafb0c1 100755
27--- a/gcc/configure
28+++ b/gcc/configure
29@@ -10838,8 +10838,8 @@ for f in $tm_file; do
30 tm_include_list="${tm_include_list} $f"
31 ;;
32 defaults.h )
33- tm_file_list="${tm_file_list} \$(srcdir)/$f"
34- tm_include_list="${tm_include_list} $f"
35+ tm_file_list="${tm_file_list} ./$f"
36+ tm_include_list="${tm_include_list} ./$f"
37 ;;
38 * )
39 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
40diff --git a/gcc/configure.ac b/gcc/configure.ac
41index d003091..ba422e6 100644
42--- a/gcc/configure.ac
43+++ b/gcc/configure.ac
44@@ -1652,8 +1652,8 @@ for f in $tm_file; do
45 tm_include_list="${tm_include_list} $f"
46 ;;
47 defaults.h )
48- tm_file_list="${tm_file_list} \$(srcdir)/$f"
49- tm_include_list="${tm_include_list} $f"
50+ tm_file_list="${tm_file_list} ./$f"
51+ tm_include_list="${tm_include_list} ./$f"
52 ;;
53 * )
54 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
55--
561.7.1
57
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/zecke-xgcc-cpp.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/zecke-xgcc-cpp.patch
deleted file mode 100644
index d0337df650..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/zecke-xgcc-cpp.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2upstream: n/a
3comment: Use the preprocessor we have just compiled instead the one of
4the system. There might be incompabilities between us and them.
5
6Index: gcc-4.5.0/Makefile.in
7===================================================================
8--- gcc-4.5.0.orig/Makefile.in 2010-02-17 03:01:44.000000000 -0800
9+++ gcc-4.5.0/Makefile.in 2010-06-25 11:22:08.421381364 -0700
10@@ -266,6 +266,7 @@
11 AR="$(AR_FOR_TARGET)"; export AR; \
12 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
13 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
14+ CPP="$(CC_FOR_TARGET) -E"; export CPP; \
15 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
16 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
17 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
18Index: gcc-4.5.0/Makefile.tpl
19===================================================================
20--- gcc-4.5.0.orig/Makefile.tpl 2010-02-17 03:01:44.000000000 -0800
21+++ gcc-4.5.0/Makefile.tpl 2010-06-25 11:22:16.945631990 -0700
22@@ -269,6 +269,7 @@
23 AR="$(AR_FOR_TARGET)"; export AR; \
24 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
25 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
26+ CPP="$(CC_FOR_TARGET) -E"; export CPP; \
27 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
28 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
29 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
deleted file mode 100644
index da3210fc35..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
+++ /dev/null
@@ -1,23 +0,0 @@
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.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
deleted file mode 100644
index 16d8181774..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
deleted file mode 100644
index 42fd0f0f59..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require gcc-cross_${PV}.bb
2require gcc-cross-intermediate.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
deleted file mode 100644
index 97a0c81920..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
+++ /dev/null
@@ -1,8 +0,0 @@
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.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
deleted file mode 100644
index 0c9fdd3449..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require gcc-cross-initial_${PV}.bb
2require gcc-crosssdk-initial.inc
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
deleted file mode 100644
index 1aa588ac9f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require gcc-cross-intermediate_${PV}.bb
2require gcc-crosssdk-intermediate.inc
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
deleted file mode 100644
index 7430888ed7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
deleted file mode 100644
index bd3bacfe3a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
+++ /dev/null
@@ -1,10 +0,0 @@
1require gcc-${PV}.inc
2require gcc-configure-runtime.inc
3require gcc-package-runtime.inc
4
5SRC_URI_append = "file://fortran-cross-compile-hack.patch"
6
7ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
8
9EXTRA_OECONF += "--disable-libunwind-exceptions"
10EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
diff --git a/meta/recipes-devtools/gcc/gcc_4.5.1.bb b/meta/recipes-devtools/gcc/gcc_4.5.1.bb
deleted file mode 100644
index 4dfb12e82e..0000000000
--- a/meta/recipes-devtools/gcc/gcc_4.5.1.bb
+++ /dev/null
@@ -1,11 +0,0 @@
1require gcc-${PV}.inc
2require gcc-configure-target.inc
3require gcc-package-target.inc
4
5SRC_URI_append = "file://fortran-cross-compile-hack.patch"
6
7ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
8
9
10SRC_URI[md5sum] = "48231a8e33ed6e058a341c53b819de1a"
11SRC_URI[sha256sum] = "45fa81face89203ccbf3ec73f7a372769d855f3ba7446f50125b613d9c163e2c"
diff --git a/meta/recipes-devtools/gcc/libgcc_4.5.1.bb b/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
deleted file mode 100644
index 500dda9054..0000000000
--- a/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
+++ /dev/null
@@ -1,44 +0,0 @@
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 "
10
11FILES_${PN} = "${base_libdir}/libgcc*.so.*"
12FILES_${PN}-dev = " \
13 ${base_libdir}/libgcc*.so \
14 ${libdir}/${TARGET_SYS}/${BINV}/crt* \
15 ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \
16 ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
17
18do_configure[noexec] = "1"
19do_compile[noexec] = "1"
20
21do_install () {
22 target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-nativesdk##`
23
24 # Install libgcc from our gcc-cross saved data
25 install -d ${D}${base_libdir} ${D}${libdir}
26 cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$target/* ${D}
27
28 # Move libgcc_s into /lib
29 mkdir -p ${D}${base_libdir}
30 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
31 mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
32 else
33 mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
34 fi
35
36 chown -R root:root ${D}
37}
38
39do_package_write_ipk[depends] += "virtual/libc:do_package"
40do_package_write_deb[depends] += "virtual/libc:do_package"
41do_package_write_rpm[depends] += "virtual/libc:do_package"
42
43BBCLASSEXTEND = "nativesdk"
44