summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7.inc147
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch93
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch49
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch2810
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch235
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch521
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch16
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch30
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch63
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch36
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch25
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch165
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/add-install-ptest-to-Makefile.patch162
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/arm-hard-float-loader.patch48
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/avoid-oob-array-access.patch45
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/define_insn_reservation.patch118
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/disable-texinfo-5.patch107
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch48
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/disablesdt.patch32
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/fix-g++-sysroot.patch428
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch32
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch116
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-argument-list-too-long.patch33
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-armv4-pass-fix-v4bx-to-ld.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch27
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch223
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch72
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch61
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/libtool.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/mips64-default-n64.patch19
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch86
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/ppc_no_crtsavres.patch72
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/ppc_with_cpu.patch752
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/ppce5500-e6500-support.patch713
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch72
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/rs6000-tables.patch135
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/run-ptest3
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch77
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch87
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/wcast-qual-PR55383.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8.inc148
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0002-uclibc-conf.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch87
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0004-uclibc-locale.patch2862
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0005-uclibc-locale-no__x.patch257
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0006-uclibc-locale-wchar_fix.patch68
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0007-uclibc-locale-update.patch542
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0008-missing-execinfo_h.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0009-c99-snprintf.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0010-c99-complex-ugly-hack.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0011-index_macro.patch44
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0012-libmudflap-susv3-legacy.patch64
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0013-libstdc-namespace.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0014-sh-pr24836.patch45
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0016-gcc-poison-system-directories.patch224
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0017-gcc-poison-dir-extend.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0019-64-bit-multilib-hack.patch82
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0020-optional-libstdc.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch59
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0022-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch88
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0024-PR-target-32219.patch67
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0025-fortran-cross-compile-hack.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0026-libgcc-sjlj-check.patch74
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0027-cpp-honor-sysroot.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0028-MIPS64-Default-to-N64-ABI.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch190
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0030-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0031-Disable-sdt.patch45
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0032-libtool.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0035-wcast-qual-PR-55383.patch55
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0036-PR-target-56102.patch83
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0037-gcc-4.8-PR56797.patch66
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0038-gcc-4.8-build-args.patch41
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0039-gcc-4.8-PR57717.patch23
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0040-fix-g++-sysroot.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0041-libtool-avoid-libdir.patch19
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch78
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0043-cpp.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0044-gengtypes.patch97
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch21
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0046-libatomic-deptracking.patch41
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0047-repomembug.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/add-install-ptest-to-Makefile.patch162
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/run-ptest3
-rw-r--r--meta/recipes-devtools/gcc/gcc-common.inc123
-rw-r--r--meta/recipes-devtools/gcc/gcc-configure-common.inc133
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian.inc156
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_4.8.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial.inc81
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_4.8.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross.inc185
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_4.7.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_4.8.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial.inc8
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.7.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.8.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk.inc10
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_4.8.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-multilib-config.inc191
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime.inc185
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_4.8.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-target.inc154
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.7.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.8.bb7
-rw-r--r--meta/recipes-devtools/gcc/libgcc.inc143
-rw-r--r--meta/recipes-devtools/gcc/libgcc_4.7.bb3
-rw-r--r--meta/recipes-devtools/gcc/libgcc_4.8.bb2
126 files changed, 16232 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc
new file mode 100644
index 0000000000..2812095b52
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7.inc
@@ -0,0 +1,147 @@
1require gcc-common.inc
2
3PR = "r20"
4
5# Third digit in PV should be incremented after a minor release
6# happens from this branch on gcc e.g. currently its 4.7.1
7# when 4.7.2 is releases and we bump SRCREV beyond the release
8# on branch then PV should be incremented to 4.7.2+svnr${SRCPV}
9# to reflect that change
10
11PV = "4.7.2"
12
13# BINV should be incremented after updating to a revision
14# after a minor gcc release (e.g. 4.7.1 or 4.7.2) has been made
15# the value will be minor-release+1 e.g. if current minor release was
16# 4.7.1 then the value below will have 2 which will mean 4.7.2
17# which will be next minor release and so on.
18
19BINV = "4.7.2"
20
21FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-4.7' ], d)}"
22
23DEPENDS =+ "mpfr gmp libmpc zlib"
24NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
25
26LICENSE="GPL-3.0-with-GCC-exception & GPLv3"
27
28LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
29 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
30 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
31 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
32 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
33
34SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
35 file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
36 file://100-uclibc-conf.patch \
37 file://gcc-uclibc-locale-ctype_touplow_t.patch \
38 file://200-uclibc-locale.patch \
39 file://203-uclibc-locale-no__x.patch; \
40 file://204-uclibc-locale-wchar_fix.patch; \
41 file://205-uclibc-locale-update.patch; \
42 file://301-missing-execinfo_h.patch \
43 file://302-c99-snprintf.patch \
44 file://303-c99-complex-ugly-hack.patch \
45 file://304-index_macro.patch \
46 file://305-libmudflap-susv3-legacy.patch \
47 file://306-libstdc++-namespace.patch \
48 file://740-sh-pr24836.patch \
49 file://800-arm-bigendian.patch \
50 file://gcc-poison-system-directories.patch \
51 file://gcc-poison-dir-extend.patch \
52 file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
53 file://64bithack.patch \
54 file://optional_libstdc.patch \
55 file://disable_relax_pic_calls_flag.patch \
56 file://COLLECT_GCC_OPTIONS.patch \
57 file://use-defaults.h-and-t-oe-in-B.patch \
58 file://ppc_with_cpu.patch \
59 file://ppce5500-e6500-support.patch \
60 file://rs6000-tables.patch \
61 file://define_insn_reservation.patch \
62 file://pr32219.patch \
63 file://fortran-cross-compile-hack.patch \
64 file://libgcc-sjlj-check.patch \
65 file://cpp-honor-sysroot.patch \
66 file://mips64-default-n64.patch \
67 file://GLIBC_DYNAMIC_LINKER.patch \
68 file://arm-hard-float-loader.patch \
69 file://gcc-argument-list-too-long.patch \
70 file://fix-g++-sysroot.patch \
71 file://disablesdt.patch \
72 file://libtool.patch \
73 file://gcc-armv4-pass-fix-v4bx-to-ld.patch \
74 file://ppc_no_crtsavres.patch \
75 file://0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch \
76 file://0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch \
77 file://use-ml-conf-files-from-B.patch \
78 file://wcast-qual-PR55383.patch \
79 file://disable-texinfo-5.patch \
80 file://avoid-oob-array-access.patch \
81 file://add-install-ptest-to-Makefile.patch \
82 file://run-ptest \
83 "
84SRC_URI[md5sum] = "cc308a0891e778cfda7a151ab8a6e762"
85SRC_URI[sha256sum] = "8a9283d7010fb9fe5ece3ca507e0af5c19412626384f8a5e9434251ae100b084"
86
87S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
88B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
89
90# Language Overrides
91FORTRAN = ""
92JAVA = ""
93
94EXTRA_OECONF_BASE = " --enable-lto \
95 --enable-libssp \
96 --disable-bootstrap \
97 --disable-libmudflap \
98 --with-system-zlib \
99 --with-linker-hash-style=${LINKER_HASH_STYLE} \
100 --enable-linker-build-id \
101 --with-ppl=no \
102 --with-cloog=no \
103 --enable-checking=release \
104 --enable-cheaders=c_global "
105
106EXTRA_OECONF_INITIAL = "--disable-libmudflap \
107 --disable-libgomp \
108 --disable-libssp \
109 --disable-libquadmath \
110 --with-system-zlib \
111 --disable-lto \
112 --disable-plugin \
113 --enable-decimal-float=no"
114
115EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
116 --disable-libgomp \
117 --disable-libquadmath \
118 --with-system-zlib \
119 --disable-lto \
120 --disable-plugin \
121 --disable-libssp"
122
123EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
124
125EXTRA_OECONF_PATHS = " \
126 --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
127 --with-sysroot=${STAGING_DIR_TARGET} \
128 --with-build-sysroot=${STAGING_DIR_TARGET}"
129
130do_configure_prepend () {
131 # teach gcc to find correct target includedir when checking libc ssp support
132 mkdir -p ${B}/gcc
133 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
134 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
135 cat >>${B}/gcc/defaults.h.new <<_EOF
136#ifndef STANDARD_STARTFILE_PREFIX_1
137#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
138#endif
139#ifndef STANDARD_STARTFILE_PREFIX_2
140#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
141#endif
142#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
143#endif /* ! GCC_DEFAULTS_H */
144_EOF
145 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
146}
147
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch b/meta/recipes-devtools/gcc/gcc-4.7/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch
new file mode 100644
index 0000000000..b6f8f94378
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch
@@ -0,0 +1,93 @@
1From b78f422ee83d279a83c62491b252cfec5b94e92a Mon Sep 17 00:00:00 2001
2From: jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 22 Aug 2012 08:36:23 +0000
4Subject: [PATCH] * Makefile.in (vis_hide, gen-hide-list): Do not make
5 definitions depend on --enable-shared.
6 ($(lib1asmfuncs-o)): Use %.vis files independent of
7 --enable-shared. * static-object.mk
8 ($(base)$(objext), $(base).vis)
9 ($(base)_s$(objext)): Use same rules for visibility
10 handling as in shared-object.mk.
11
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190588 138bc75d-0d04-0410-961f-82ee72b054a4
13---
14 libgcc/ChangeLog | 10 ++++++++++
15 libgcc/Makefile.in | 16 ++++------------
16 libgcc/static-object.mk | 10 ++++++++--
17 3 files changed, 22 insertions(+), 14 deletions(-)
18
19Upstream-Status: Backport
20
21-Khem
2205-Sep-2012
23
24Index: gcc-4_7-branch/libgcc/Makefile.in
25===================================================================
26--- gcc-4_7-branch.orig/libgcc/Makefile.in 2012-08-21 22:33:20.000000000 -0700
27+++ gcc-4_7-branch/libgcc/Makefile.in 2012-09-05 17:30:28.572998745 -0700
28@@ -362,6 +362,7 @@
29 ifneq ($(LIBUNWIND),)
30 install-libunwind = install-libunwind
31 endif
32+endif
33
34 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
35 # the command line, and a #define to prevent libgcc2.h etc from
36@@ -385,11 +386,8 @@
37 gen-hide-list = echo > $@
38 endif
39
40-else
41-# Not enable_shared.
42+ifneq ($(enable_shared),yes)
43 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
44-vis_hide =
45-gen-hide-list = echo > \$@
46 endif
47
48 LIB2ADD += enable-execute-stack.c
49@@ -438,7 +436,6 @@
50 $(LIB2_DIVMOD_FUNCS))
51
52 # Build "libgcc1" (assembly) components.
53-ifeq ($(enable_shared),yes)
54
55 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
56 $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis
57@@ -450,14 +447,9 @@
58 lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
59 $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
60 $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
61-libgcc-s-objects += $(lib1asmfuncs-s-o)
62-
63-else
64+ifeq ($(enable_shared),yes)
65
66-lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
67-$(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC)
68- $(gcc_compile) -DL$* -xassembler-with-cpp -c $<
69-libgcc-objects += $(lib1asmfuncs-o)
70+libgcc-s-objects += $(lib1asmfuncs-s-o)
71
72 endif
73
74Index: gcc-4_7-branch/libgcc/static-object.mk
75===================================================================
76--- gcc-4_7-branch.orig/libgcc/static-object.mk 2012-08-21 22:33:20.000000000 -0700
77+++ gcc-4_7-branch/libgcc/static-object.mk 2012-09-05 17:30:28.572998745 -0700
78@@ -24,7 +24,13 @@
79 endif
80 endif
81
82-$(base)$(objext): $o
83- $(gcc_compile) -c -xassembler-with-cpp $<
84+$(base)$(objext): $o $(base).vis
85+ $(gcc_compile) -c -xassembler-with-cpp -include $*.vis $<
86+
87+$(base).vis: $(base)_s$(objext)
88+ $(gen-hide-list)
89+
90+$(base)_s$(objext): $o
91+ $(gcc_s_compile) -c -xassembler-with-cpp $<
92
93 endif
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch b/meta/recipes-devtools/gcc/gcc-4.7/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch
new file mode 100644
index 0000000000..15034f7da2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch
@@ -0,0 +1,49 @@
1From 935475158f45b9c55a54647543c0402b4b3043ae Mon Sep 17 00:00:00 2001
2From: jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Sun, 19 Aug 2012 15:11:40 +0000
4Subject: [PATCH] * crtstuff.c (USE_PT_GNU_EH_FRAME): Define for
5 systems using glibc even if inhibit_libc.
6
7git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190517 138bc75d-0d04-0410-961f-82ee72b054a4
8---
9 libgcc/ChangeLog | 5 +++++
10 libgcc/crtstuff.c | 16 +++++++++++++++-
11 2 files changed, 20 insertions(+), 1 deletion(-)
12
13Upstream-Status: Backport
14
15-Khem 05-Sep-2012
16Index: gcc-4_7-branch/libgcc/crtstuff.c
17===================================================================
18--- gcc-4_7-branch.orig/libgcc/crtstuff.c 2012-08-21 22:33:20.000000000 -0700
19+++ gcc-4_7-branch/libgcc/crtstuff.c 2012-09-05 17:28:49.248994968 -0700
20@@ -1,7 +1,7 @@
21 /* Specialized bits of code needed to support construction and
22 destruction of file-scope objects in C++ code.
23 Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
24- 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
25+ 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012
26 Free Software Foundation, Inc.
27 Contributed by Ron Guilmette (rfg@monkeys.com).
28
29@@ -113,6 +113,20 @@
30 # define USE_PT_GNU_EH_FRAME
31 # endif
32 #endif
33+
34+#if defined(OBJECT_FORMAT_ELF) \
35+ && !defined(OBJECT_FORMAT_FLAT) \
36+ && defined(HAVE_LD_EH_FRAME_HDR) \
37+ && !defined(CRTSTUFFT_O) \
38+ && defined(inhibit_libc) \
39+ && (defined(__GLIBC__) || defined(__gnu_linux__) || defined(__GNU__))
40+/* On systems using glibc, an inhibit_libc build of libgcc is only
41+ part of a bootstrap process. Build the same crt*.o as would be
42+ built with headers present, so that it is not necessary to build
43+ glibc more than once for the bootstrap to converge. */
44+# define USE_PT_GNU_EH_FRAME
45+#endif
46+
47 #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
48 # define USE_EH_FRAME_REGISTRY
49 #endif
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch b/meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch
new file mode 100644
index 0000000000..b2981e0791
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/100-uclibc-conf.patch
@@ -0,0 +1,39 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/contrib/regression/objs-gcc.sh
4===================================================================
5--- gcc-4.6.0.orig/contrib/regression/objs-gcc.sh
6+++ gcc-4.6.0/contrib/regression/objs-gcc.sh
7@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
8 then
9 make all-gdb all-dejagnu all-ld || exit 1
10 make install-gdb install-dejagnu install-ld || exit 1
11+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
12+ then
13+ make all-gdb all-dejagnu all-ld || exit 1
14+ make install-gdb install-dejagnu install-ld || exit 1
15 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
16 make bootstrap || exit 1
17 make install || exit 1
18Index: gcc-4.6.0/libjava/classpath/ltconfig
19===================================================================
20--- gcc-4.6.0.orig/libjava/classpath/ltconfig
21+++ gcc-4.6.0/libjava/classpath/ltconfig
22@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
23
24 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
25 case $host_os in
26-linux-gnu*) ;;
27+linux-gnu*|linux-uclibc*) ;;
28 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
29 esac
30
31@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
32 ;;
33
34 # This must be Linux ELF.
35-linux-gnu*)
36+linux*)
37 version_type=linux
38 need_lib_prefix=no
39 need_version=no
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch b/meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch
new file mode 100644
index 0000000000..df22c54406
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/200-uclibc-locale.patch
@@ -0,0 +1,2810 @@
1Upstream-Status: Pending
2
3Index: gcc-4_7-branch/libstdc++-v3/acinclude.m4
4===================================================================
5--- gcc-4_7-branch.orig/libstdc++-v3/acinclude.m4 2012-04-10 10:19:50.395337128 -0700
6+++ gcc-4_7-branch/libstdc++-v3/acinclude.m4 2012-04-10 10:30:37.327368356 -0700
7@@ -1924,6 +1924,9 @@
8 # Default to "generic".
9 if test $enable_clocale_flag = auto; then
10 case ${target_os} in
11+ *-uclibc*)
12+ enable_clocale_flag=uclibc
13+ ;;
14 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
15 enable_clocale_flag=gnu
16 ;;
17@@ -2085,6 +2088,40 @@
18 CTIME_CC=config/locale/generic/time_members.cc
19 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
20 ;;
21+ uclibc)
22+ AC_MSG_RESULT(uclibc)
23+
24+ # Declare intention to use gettext, and add support for specific
25+ # languages.
26+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
27+ ALL_LINGUAS="de fr"
28+
29+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
30+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
31+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
32+ USE_NLS=yes
33+ fi
34+ # Export the build objects.
35+ for ling in $ALL_LINGUAS; do \
36+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
37+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
38+ done
39+ AC_SUBST(glibcxx_MOFILES)
40+ AC_SUBST(glibcxx_POFILES)
41+
42+ CLOCALE_H=config/locale/uclibc/c_locale.h
43+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
44+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
45+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
46+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
47+ CMESSAGES_H=config/locale/uclibc/messages_members.h
48+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
49+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
50+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
51+ CTIME_H=config/locale/uclibc/time_members.h
52+ CTIME_CC=config/locale/uclibc/time_members.cc
53+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
54+ ;;
55 esac
56
57 # This is where the testsuite looks for locale catalogs, using the
58Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
59===================================================================
60--- /dev/null 1970-01-01 00:00:00.000000000 +0000
61+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2012-04-10 10:30:37.327368356 -0700
62@@ -0,0 +1,63 @@
63+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
64+
65+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
66+//
67+// This file is part of the GNU ISO C++ Library. This library is free
68+// software; you can redistribute it and/or modify it under the
69+// terms of the GNU General Public License as published by the
70+// Free Software Foundation; either version 2, or (at your option)
71+// any later version.
72+
73+// This library is distributed in the hope that it will be useful,
74+// but WITHOUT ANY WARRANTY; without even the implied warranty of
75+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76+// GNU General Public License for more details.
77+
78+// You should have received a copy of the GNU General Public License along
79+// with this library; see the file COPYING. If not, write to the Free
80+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
81+// USA.
82+
83+// As a special exception, you may use this file as part of a free software
84+// library without restriction. Specifically, if other files instantiate
85+// templates or use macros or inline functions from this file, or you compile
86+// this file and link it with other files to produce an executable, this
87+// file does not by itself cause the resulting executable to be covered by
88+// the GNU General Public License. This exception does not however
89+// invalidate any other reasons why the executable file might be covered by
90+// the GNU General Public License.
91+
92+// Written by Jakub Jelinek <jakub@redhat.com>
93+
94+#include <bits/c++config.h>
95+#include <clocale>
96+
97+#ifdef __UCLIBC_MJN3_ONLY__
98+#warning clean this up
99+#endif
100+
101+#ifdef __UCLIBC_HAS_XLOCALE__
102+
103+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
104+extern "C" __typeof(strcoll_l) __strcoll_l;
105+extern "C" __typeof(strftime_l) __strftime_l;
106+extern "C" __typeof(strtod_l) __strtod_l;
107+extern "C" __typeof(strtof_l) __strtof_l;
108+extern "C" __typeof(strtold_l) __strtold_l;
109+extern "C" __typeof(strxfrm_l) __strxfrm_l;
110+extern "C" __typeof(newlocale) __newlocale;
111+extern "C" __typeof(freelocale) __freelocale;
112+extern "C" __typeof(duplocale) __duplocale;
113+extern "C" __typeof(uselocale) __uselocale;
114+
115+#ifdef _GLIBCXX_USE_WCHAR_T
116+extern "C" __typeof(iswctype_l) __iswctype_l;
117+extern "C" __typeof(towlower_l) __towlower_l;
118+extern "C" __typeof(towupper_l) __towupper_l;
119+extern "C" __typeof(wcscoll_l) __wcscoll_l;
120+extern "C" __typeof(wcsftime_l) __wcsftime_l;
121+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
122+extern "C" __typeof(wctype_l) __wctype_l;
123+#endif
124+
125+#endif // GLIBC 2.3 and later
126Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.cc
127===================================================================
128--- /dev/null 1970-01-01 00:00:00.000000000 +0000
129+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.cc 2012-04-10 10:30:37.327368356 -0700
130@@ -0,0 +1,160 @@
131+// Wrapper for underlying C-language localization -*- C++ -*-
132+
133+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
134+//
135+// This file is part of the GNU ISO C++ Library. This library is free
136+// software; you can redistribute it and/or modify it under the
137+// terms of the GNU General Public License as published by the
138+// Free Software Foundation; either version 2, or (at your option)
139+// any later version.
140+
141+// This library is distributed in the hope that it will be useful,
142+// but WITHOUT ANY WARRANTY; without even the implied warranty of
143+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
144+// GNU General Public License for more details.
145+
146+// You should have received a copy of the GNU General Public License along
147+// with this library; see the file COPYING. If not, write to the Free
148+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
149+// USA.
150+
151+// As a special exception, you may use this file as part of a free software
152+// library without restriction. Specifically, if other files instantiate
153+// templates or use macros or inline functions from this file, or you compile
154+// this file and link it with other files to produce an executable, this
155+// file does not by itself cause the resulting executable to be covered by
156+// the GNU General Public License. This exception does not however
157+// invalidate any other reasons why the executable file might be covered by
158+// the GNU General Public License.
159+
160+//
161+// ISO C++ 14882: 22.8 Standard locale categories.
162+//
163+
164+// Written by Benjamin Kosnik <bkoz@redhat.com>
165+
166+#include <cerrno> // For errno
167+#include <locale>
168+#include <stdexcept>
169+#include <langinfo.h>
170+#include <bits/c++locale_internal.h>
171+
172+#ifndef __UCLIBC_HAS_XLOCALE__
173+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
174+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
175+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
176+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
177+#define __strtof_l(S, E, L) strtof((S), (E))
178+#define __strtod_l(S, E, L) strtod((S), (E))
179+#define __strtold_l(S, E, L) strtold((S), (E))
180+#warning should dummy __newlocale check for C|POSIX ?
181+#define __newlocale(a, b, c) NULL
182+#define __freelocale(a) ((void)0)
183+#define __duplocale(a) __c_locale()
184+#endif
185+
186+namespace std
187+{
188+ template<>
189+ void
190+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
191+ const __c_locale& __cloc)
192+ {
193+ if (!(__err & ios_base::failbit))
194+ {
195+ char* __sanity;
196+ errno = 0;
197+ float __f = __strtof_l(__s, &__sanity, __cloc);
198+ if (__sanity != __s && errno != ERANGE)
199+ __v = __f;
200+ else
201+ __err |= ios_base::failbit;
202+ }
203+ }
204+
205+ template<>
206+ void
207+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
208+ const __c_locale& __cloc)
209+ {
210+ if (!(__err & ios_base::failbit))
211+ {
212+ char* __sanity;
213+ errno = 0;
214+ double __d = __strtod_l(__s, &__sanity, __cloc);
215+ if (__sanity != __s && errno != ERANGE)
216+ __v = __d;
217+ else
218+ __err |= ios_base::failbit;
219+ }
220+ }
221+
222+ template<>
223+ void
224+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
225+ const __c_locale& __cloc)
226+ {
227+ if (!(__err & ios_base::failbit))
228+ {
229+ char* __sanity;
230+ errno = 0;
231+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
232+ if (__sanity != __s && errno != ERANGE)
233+ __v = __ld;
234+ else
235+ __err |= ios_base::failbit;
236+ }
237+ }
238+
239+ void
240+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
241+ __c_locale __old)
242+ {
243+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
244+#ifdef __UCLIBC_HAS_XLOCALE__
245+ if (!__cloc)
246+ {
247+ // This named locale is not supported by the underlying OS.
248+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
249+ "name not valid"));
250+ }
251+#endif
252+ }
253+
254+ void
255+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
256+ {
257+ if (_S_get_c_locale() != __cloc)
258+ __freelocale(__cloc);
259+ }
260+
261+ __c_locale
262+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
263+ { return __duplocale(__cloc); }
264+} // namespace std
265+
266+namespace __gnu_cxx
267+{
268+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
269+ {
270+ "LC_CTYPE",
271+ "LC_NUMERIC",
272+ "LC_TIME",
273+ "LC_COLLATE",
274+ "LC_MONETARY",
275+ "LC_MESSAGES",
276+#if _GLIBCXX_NUM_CATEGORIES != 0
277+ "LC_PAPER",
278+ "LC_NAME",
279+ "LC_ADDRESS",
280+ "LC_TELEPHONE",
281+ "LC_MEASUREMENT",
282+ "LC_IDENTIFICATION"
283+#endif
284+ };
285+}
286+
287+namespace std
288+{
289+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
290+} // namespace std
291Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.h
292===================================================================
293--- /dev/null 1970-01-01 00:00:00.000000000 +0000
294+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.h 2012-04-10 10:30:37.327368356 -0700
295@@ -0,0 +1,117 @@
296+// Wrapper for underlying C-language localization -*- C++ -*-
297+
298+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
299+//
300+// This file is part of the GNU ISO C++ Library. This library is free
301+// software; you can redistribute it and/or modify it under the
302+// terms of the GNU General Public License as published by the
303+// Free Software Foundation; either version 2, or (at your option)
304+// any later version.
305+
306+// This library is distributed in the hope that it will be useful,
307+// but WITHOUT ANY WARRANTY; without even the implied warranty of
308+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
309+// GNU General Public License for more details.
310+
311+// You should have received a copy of the GNU General Public License along
312+// with this library; see the file COPYING. If not, write to the Free
313+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
314+// USA.
315+
316+// As a special exception, you may use this file as part of a free software
317+// library without restriction. Specifically, if other files instantiate
318+// templates or use macros or inline functions from this file, or you compile
319+// this file and link it with other files to produce an executable, this
320+// file does not by itself cause the resulting executable to be covered by
321+// the GNU General Public License. This exception does not however
322+// invalidate any other reasons why the executable file might be covered by
323+// the GNU General Public License.
324+
325+//
326+// ISO C++ 14882: 22.8 Standard locale categories.
327+//
328+
329+// Written by Benjamin Kosnik <bkoz@redhat.com>
330+
331+#ifndef _C_LOCALE_H
332+#define _C_LOCALE_H 1
333+
334+#pragma GCC system_header
335+
336+#include <cstring> // get std::strlen
337+#include <cstdio> // get std::snprintf or std::sprintf
338+#include <clocale>
339+#include <langinfo.h> // For codecvt
340+#ifdef __UCLIBC_MJN3_ONLY__
341+#warning fix this
342+#endif
343+#ifdef __UCLIBC_HAS_LOCALE__
344+#include <iconv.h> // For codecvt using iconv, iconv_t
345+#endif
346+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
347+#include <libintl.h> // For messages
348+#endif
349+
350+#ifdef __UCLIBC_MJN3_ONLY__
351+#warning what is _GLIBCXX_C_LOCALE_GNU for
352+#endif
353+#define _GLIBCXX_C_LOCALE_GNU 1
354+
355+#ifdef __UCLIBC_MJN3_ONLY__
356+#warning fix categories
357+#endif
358+// #define _GLIBCXX_NUM_CATEGORIES 6
359+#define _GLIBCXX_NUM_CATEGORIES 0
360+
361+#ifdef __UCLIBC_HAS_XLOCALE__
362+namespace __gnu_cxx
363+{
364+ extern "C" __typeof(uselocale) __uselocale;
365+}
366+#endif
367+
368+namespace std
369+{
370+#ifdef __UCLIBC_HAS_XLOCALE__
371+ typedef __locale_t __c_locale;
372+#else
373+ typedef int* __c_locale;
374+#endif
375+
376+ // Convert numeric value of type _Tv to string and return length of
377+ // string. If snprintf is available use it, otherwise fall back to
378+ // the unsafe sprintf which, in general, can be dangerous and should
379+ // be avoided.
380+ template<typename _Tv>
381+ int
382+ __convert_from_v(char* __out,
383+ const int __size __attribute__ ((__unused__)),
384+ const char* __fmt,
385+#ifdef __UCLIBC_HAS_XCLOCALE__
386+ _Tv __v, const __c_locale& __cloc, int __prec)
387+ {
388+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
389+#else
390+ _Tv __v, const __c_locale&, int __prec)
391+ {
392+# ifdef __UCLIBC_HAS_LOCALE__
393+ char* __old = std::setlocale(LC_ALL, NULL);
394+ char* __sav = new char[std::strlen(__old) + 1];
395+ std::strcpy(__sav, __old);
396+ std::setlocale(LC_ALL, "C");
397+# endif
398+#endif
399+
400+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
401+
402+#ifdef __UCLIBC_HAS_XCLOCALE__
403+ __gnu_cxx::__uselocale(__old);
404+#elif defined __UCLIBC_HAS_LOCALE__
405+ std::setlocale(LC_ALL, __sav);
406+ delete [] __sav;
407+#endif
408+ return __ret;
409+ }
410+}
411+
412+#endif
413Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
414===================================================================
415--- /dev/null 1970-01-01 00:00:00.000000000 +0000
416+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2012-04-10 10:30:37.327368356 -0700
417@@ -0,0 +1,308 @@
418+// std::codecvt implementation details, GNU version -*- C++ -*-
419+
420+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
421+//
422+// This file is part of the GNU ISO C++ Library. This library is free
423+// software; you can redistribute it and/or modify it under the
424+// terms of the GNU General Public License as published by the
425+// Free Software Foundation; either version 2, or (at your option)
426+// any later version.
427+
428+// This library is distributed in the hope that it will be useful,
429+// but WITHOUT ANY WARRANTY; without even the implied warranty of
430+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
431+// GNU General Public License for more details.
432+
433+// You should have received a copy of the GNU General Public License along
434+// with this library; see the file COPYING. If not, write to the Free
435+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
436+// USA.
437+
438+// As a special exception, you may use this file as part of a free software
439+// library without restriction. Specifically, if other files instantiate
440+// templates or use macros or inline functions from this file, or you compile
441+// this file and link it with other files to produce an executable, this
442+// file does not by itself cause the resulting executable to be covered by
443+// the GNU General Public License. This exception does not however
444+// invalidate any other reasons why the executable file might be covered by
445+// the GNU General Public License.
446+
447+//
448+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
449+//
450+
451+// Written by Benjamin Kosnik <bkoz@redhat.com>
452+
453+#include <locale>
454+#include <cstdlib> // For MB_CUR_MAX
455+#include <climits> // For MB_LEN_MAX
456+#include <bits/c++locale_internal.h>
457+
458+namespace std
459+{
460+ // Specializations.
461+#ifdef _GLIBCXX_USE_WCHAR_T
462+ codecvt_base::result
463+ codecvt<wchar_t, char, mbstate_t>::
464+ do_out(state_type& __state, const intern_type* __from,
465+ const intern_type* __from_end, const intern_type*& __from_next,
466+ extern_type* __to, extern_type* __to_end,
467+ extern_type*& __to_next) const
468+ {
469+ result __ret = ok;
470+ state_type __tmp_state(__state);
471+
472+#ifdef __UCLIBC_HAS_XLOCALE__
473+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
474+#endif
475+
476+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
477+ // in case we fall back to wcrtomb and then continue, in a loop.
478+ // NB: wcsnrtombs is a GNU extension
479+ for (__from_next = __from, __to_next = __to;
480+ __from_next < __from_end && __to_next < __to_end
481+ && __ret == ok;)
482+ {
483+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
484+ __from_end - __from_next);
485+ if (!__from_chunk_end)
486+ __from_chunk_end = __from_end;
487+
488+ __from = __from_next;
489+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
490+ __from_chunk_end - __from_next,
491+ __to_end - __to_next, &__state);
492+ if (__conv == static_cast<size_t>(-1))
493+ {
494+ // In case of error, in order to stop at the exact place we
495+ // have to start again from the beginning with a series of
496+ // wcrtomb.
497+ for (; __from < __from_next; ++__from)
498+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
499+ __state = __tmp_state;
500+ __ret = error;
501+ }
502+ else if (__from_next && __from_next < __from_chunk_end)
503+ {
504+ __to_next += __conv;
505+ __ret = partial;
506+ }
507+ else
508+ {
509+ __from_next = __from_chunk_end;
510+ __to_next += __conv;
511+ }
512+
513+ if (__from_next < __from_end && __ret == ok)
514+ {
515+ extern_type __buf[MB_LEN_MAX];
516+ __tmp_state = __state;
517+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
518+ if (__conv > static_cast<size_t>(__to_end - __to_next))
519+ __ret = partial;
520+ else
521+ {
522+ memcpy(__to_next, __buf, __conv);
523+ __state = __tmp_state;
524+ __to_next += __conv;
525+ ++__from_next;
526+ }
527+ }
528+ }
529+
530+#ifdef __UCLIBC_HAS_XLOCALE__
531+ __uselocale(__old);
532+#endif
533+
534+ return __ret;
535+ }
536+
537+ codecvt_base::result
538+ codecvt<wchar_t, char, mbstate_t>::
539+ do_in(state_type& __state, const extern_type* __from,
540+ const extern_type* __from_end, const extern_type*& __from_next,
541+ intern_type* __to, intern_type* __to_end,
542+ intern_type*& __to_next) const
543+ {
544+ result __ret = ok;
545+ state_type __tmp_state(__state);
546+
547+#ifdef __UCLIBC_HAS_XLOCALE__
548+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
549+#endif
550+
551+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
552+ // in case we store a L'\0' and then continue, in a loop.
553+ // NB: mbsnrtowcs is a GNU extension
554+ for (__from_next = __from, __to_next = __to;
555+ __from_next < __from_end && __to_next < __to_end
556+ && __ret == ok;)
557+ {
558+ const extern_type* __from_chunk_end;
559+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
560+ __from_end
561+ - __from_next));
562+ if (!__from_chunk_end)
563+ __from_chunk_end = __from_end;
564+
565+ __from = __from_next;
566+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
567+ __from_chunk_end - __from_next,
568+ __to_end - __to_next, &__state);
569+ if (__conv == static_cast<size_t>(-1))
570+ {
571+ // In case of error, in order to stop at the exact place we
572+ // have to start again from the beginning with a series of
573+ // mbrtowc.
574+ for (;; ++__to_next, __from += __conv)
575+ {
576+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
577+ &__tmp_state);
578+ if (__conv == static_cast<size_t>(-1)
579+ || __conv == static_cast<size_t>(-2))
580+ break;
581+ }
582+ __from_next = __from;
583+ __state = __tmp_state;
584+ __ret = error;
585+ }
586+ else if (__from_next && __from_next < __from_chunk_end)
587+ {
588+ // It is unclear what to return in this case (see DR 382).
589+ __to_next += __conv;
590+ __ret = partial;
591+ }
592+ else
593+ {
594+ __from_next = __from_chunk_end;
595+ __to_next += __conv;
596+ }
597+
598+ if (__from_next < __from_end && __ret == ok)
599+ {
600+ if (__to_next < __to_end)
601+ {
602+ // XXX Probably wrong for stateful encodings
603+ __tmp_state = __state;
604+ ++__from_next;
605+ *__to_next++ = L'\0';
606+ }
607+ else
608+ __ret = partial;
609+ }
610+ }
611+
612+#ifdef __UCLIBC_HAS_XLOCALE__
613+ __uselocale(__old);
614+#endif
615+
616+ return __ret;
617+ }
618+
619+ int
620+ codecvt<wchar_t, char, mbstate_t>::
621+ do_encoding() const throw()
622+ {
623+ // XXX This implementation assumes that the encoding is
624+ // stateless and is either single-byte or variable-width.
625+ int __ret = 0;
626+#ifdef __UCLIBC_HAS_XLOCALE__
627+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
628+#endif
629+ if (MB_CUR_MAX == 1)
630+ __ret = 1;
631+#ifdef __UCLIBC_HAS_XLOCALE__
632+ __uselocale(__old);
633+#endif
634+ return __ret;
635+ }
636+
637+ int
638+ codecvt<wchar_t, char, mbstate_t>::
639+ do_max_length() const throw()
640+ {
641+#ifdef __UCLIBC_HAS_XLOCALE__
642+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
643+#endif
644+ // XXX Probably wrong for stateful encodings.
645+ int __ret = MB_CUR_MAX;
646+#ifdef __UCLIBC_HAS_XLOCALE__
647+ __uselocale(__old);
648+#endif
649+ return __ret;
650+ }
651+
652+ int
653+ codecvt<wchar_t, char, mbstate_t>::
654+ do_length(state_type& __state, const extern_type* __from,
655+ const extern_type* __end, size_t __max) const
656+ {
657+ int __ret = 0;
658+ state_type __tmp_state(__state);
659+
660+#ifdef __UCLIBC_HAS_XLOCALE__
661+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
662+#endif
663+
664+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
665+ // in case we advance past it and then continue, in a loop.
666+ // NB: mbsnrtowcs is a GNU extension
667+
668+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
669+ // its fourth parameter (it wouldn't with NULL as first parameter).
670+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
671+ * __max));
672+ while (__from < __end && __max)
673+ {
674+ const extern_type* __from_chunk_end;
675+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
676+ __end
677+ - __from));
678+ if (!__from_chunk_end)
679+ __from_chunk_end = __end;
680+
681+ const extern_type* __tmp_from = __from;
682+ size_t __conv = mbsnrtowcs(__to, &__from,
683+ __from_chunk_end - __from,
684+ __max, &__state);
685+ if (__conv == static_cast<size_t>(-1))
686+ {
687+ // In case of error, in order to stop at the exact place we
688+ // have to start again from the beginning with a series of
689+ // mbrtowc.
690+ for (__from = __tmp_from;; __from += __conv)
691+ {
692+ __conv = mbrtowc(NULL, __from, __end - __from,
693+ &__tmp_state);
694+ if (__conv == static_cast<size_t>(-1)
695+ || __conv == static_cast<size_t>(-2))
696+ break;
697+ }
698+ __state = __tmp_state;
699+ __ret += __from - __tmp_from;
700+ break;
701+ }
702+ if (!__from)
703+ __from = __from_chunk_end;
704+
705+ __ret += __from - __tmp_from;
706+ __max -= __conv;
707+
708+ if (__from < __end && __max)
709+ {
710+ // XXX Probably wrong for stateful encodings
711+ __tmp_state = __state;
712+ ++__from;
713+ ++__ret;
714+ --__max;
715+ }
716+ }
717+
718+#ifdef __UCLIBC_HAS_XLOCALE__
719+ __uselocale(__old);
720+#endif
721+
722+ return __ret;
723+ }
724+#endif
725+}
726Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/collate_members.cc
727===================================================================
728--- /dev/null 1970-01-01 00:00:00.000000000 +0000
729+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/collate_members.cc 2012-04-10 10:30:37.327368356 -0700
730@@ -0,0 +1,80 @@
731+// std::collate implementation details, GNU version -*- C++ -*-
732+
733+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
734+//
735+// This file is part of the GNU ISO C++ Library. This library is free
736+// software; you can redistribute it and/or modify it under the
737+// terms of the GNU General Public License as published by the
738+// Free Software Foundation; either version 2, or (at your option)
739+// any later version.
740+
741+// This library is distributed in the hope that it will be useful,
742+// but WITHOUT ANY WARRANTY; without even the implied warranty of
743+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
744+// GNU General Public License for more details.
745+
746+// You should have received a copy of the GNU General Public License along
747+// with this library; see the file COPYING. If not, write to the Free
748+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
749+// USA.
750+
751+// As a special exception, you may use this file as part of a free software
752+// library without restriction. Specifically, if other files instantiate
753+// templates or use macros or inline functions from this file, or you compile
754+// this file and link it with other files to produce an executable, this
755+// file does not by itself cause the resulting executable to be covered by
756+// the GNU General Public License. This exception does not however
757+// invalidate any other reasons why the executable file might be covered by
758+// the GNU General Public License.
759+
760+//
761+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
762+//
763+
764+// Written by Benjamin Kosnik <bkoz@redhat.com>
765+
766+#include <locale>
767+#include <bits/c++locale_internal.h>
768+
769+#ifndef __UCLIBC_HAS_XLOCALE__
770+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
771+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
772+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
773+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
774+#endif
775+
776+namespace std
777+{
778+ // These are basically extensions to char_traits, and perhaps should
779+ // be put there instead of here.
780+ template<>
781+ int
782+ collate<char>::_M_compare(const char* __one, const char* __two) const
783+ {
784+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
785+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
786+ }
787+
788+ template<>
789+ size_t
790+ collate<char>::_M_transform(char* __to, const char* __from,
791+ size_t __n) const
792+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
793+
794+#ifdef _GLIBCXX_USE_WCHAR_T
795+ template<>
796+ int
797+ collate<wchar_t>::_M_compare(const wchar_t* __one,
798+ const wchar_t* __two) const
799+ {
800+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
801+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
802+ }
803+
804+ template<>
805+ size_t
806+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
807+ size_t __n) const
808+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
809+#endif
810+}
811Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/ctype_members.cc
812===================================================================
813--- /dev/null 1970-01-01 00:00:00.000000000 +0000
814+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2012-04-10 10:30:37.331368420 -0700
815@@ -0,0 +1,300 @@
816+// std::ctype implementation details, GNU version -*- C++ -*-
817+
818+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
819+//
820+// This file is part of the GNU ISO C++ Library. This library is free
821+// software; you can redistribute it and/or modify it under the
822+// terms of the GNU General Public License as published by the
823+// Free Software Foundation; either version 2, or (at your option)
824+// any later version.
825+
826+// This library is distributed in the hope that it will be useful,
827+// but WITHOUT ANY WARRANTY; without even the implied warranty of
828+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
829+// GNU General Public License for more details.
830+
831+// You should have received a copy of the GNU General Public License along
832+// with this library; see the file COPYING. If not, write to the Free
833+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
834+// USA.
835+
836+// As a special exception, you may use this file as part of a free software
837+// library without restriction. Specifically, if other files instantiate
838+// templates or use macros or inline functions from this file, or you compile
839+// this file and link it with other files to produce an executable, this
840+// file does not by itself cause the resulting executable to be covered by
841+// the GNU General Public License. This exception does not however
842+// invalidate any other reasons why the executable file might be covered by
843+// the GNU General Public License.
844+
845+//
846+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
847+//
848+
849+// Written by Benjamin Kosnik <bkoz@redhat.com>
850+
851+#define _LIBC
852+#include <locale>
853+#undef _LIBC
854+#include <bits/c++locale_internal.h>
855+
856+#ifndef __UCLIBC_HAS_XLOCALE__
857+#define __wctype_l(S, L) wctype((S))
858+#define __towupper_l(C, L) towupper((C))
859+#define __towlower_l(C, L) towlower((C))
860+#define __iswctype_l(C, M, L) iswctype((C), (M))
861+#endif
862+
863+namespace std
864+{
865+ // NB: The other ctype<char> specializations are in src/locale.cc and
866+ // various /config/os/* files.
867+ template<>
868+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
869+ : ctype<char>(0, false, __refs)
870+ {
871+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
872+ {
873+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
874+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
875+#ifdef __UCLIBC_HAS_XLOCALE__
876+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
877+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
878+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
879+#endif
880+ }
881+ }
882+
883+#ifdef _GLIBCXX_USE_WCHAR_T
884+ ctype<wchar_t>::__wmask_type
885+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
886+ {
887+ __wmask_type __ret;
888+ switch (__m)
889+ {
890+ case space:
891+ __ret = __wctype_l("space", _M_c_locale_ctype);
892+ break;
893+ case print:
894+ __ret = __wctype_l("print", _M_c_locale_ctype);
895+ break;
896+ case cntrl:
897+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
898+ break;
899+ case upper:
900+ __ret = __wctype_l("upper", _M_c_locale_ctype);
901+ break;
902+ case lower:
903+ __ret = __wctype_l("lower", _M_c_locale_ctype);
904+ break;
905+ case alpha:
906+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
907+ break;
908+ case digit:
909+ __ret = __wctype_l("digit", _M_c_locale_ctype);
910+ break;
911+ case punct:
912+ __ret = __wctype_l("punct", _M_c_locale_ctype);
913+ break;
914+ case xdigit:
915+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
916+ break;
917+ case alnum:
918+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
919+ break;
920+ case graph:
921+ __ret = __wctype_l("graph", _M_c_locale_ctype);
922+ break;
923+ default:
924+ __ret = __wmask_type();
925+ }
926+ return __ret;
927+ }
928+
929+ wchar_t
930+ ctype<wchar_t>::do_toupper(wchar_t __c) const
931+ { return __towupper_l(__c, _M_c_locale_ctype); }
932+
933+ const wchar_t*
934+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
935+ {
936+ while (__lo < __hi)
937+ {
938+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
939+ ++__lo;
940+ }
941+ return __hi;
942+ }
943+
944+ wchar_t
945+ ctype<wchar_t>::do_tolower(wchar_t __c) const
946+ { return __towlower_l(__c, _M_c_locale_ctype); }
947+
948+ const wchar_t*
949+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
950+ {
951+ while (__lo < __hi)
952+ {
953+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
954+ ++__lo;
955+ }
956+ return __hi;
957+ }
958+
959+ bool
960+ ctype<wchar_t>::
961+ do_is(mask __m, wchar_t __c) const
962+ {
963+ // Highest bitmask in ctype_base == 10, but extra in "C"
964+ // library for blank.
965+ bool __ret = false;
966+ const size_t __bitmasksize = 11;
967+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
968+ if (__m & _M_bit[__bitcur]
969+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
970+ {
971+ __ret = true;
972+ break;
973+ }
974+ return __ret;
975+ }
976+
977+ const wchar_t*
978+ ctype<wchar_t>::
979+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
980+ {
981+ for (; __lo < __hi; ++__vec, ++__lo)
982+ {
983+ // Highest bitmask in ctype_base == 10, but extra in "C"
984+ // library for blank.
985+ const size_t __bitmasksize = 11;
986+ mask __m = 0;
987+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
988+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
989+ __m |= _M_bit[__bitcur];
990+ *__vec = __m;
991+ }
992+ return __hi;
993+ }
994+
995+ const wchar_t*
996+ ctype<wchar_t>::
997+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
998+ {
999+ while (__lo < __hi && !this->do_is(__m, *__lo))
1000+ ++__lo;
1001+ return __lo;
1002+ }
1003+
1004+ const wchar_t*
1005+ ctype<wchar_t>::
1006+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1007+ {
1008+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1009+ ++__lo;
1010+ return __lo;
1011+ }
1012+
1013+ wchar_t
1014+ ctype<wchar_t>::
1015+ do_widen(char __c) const
1016+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1017+
1018+ const char*
1019+ ctype<wchar_t>::
1020+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1021+ {
1022+ while (__lo < __hi)
1023+ {
1024+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1025+ ++__lo;
1026+ ++__dest;
1027+ }
1028+ return __hi;
1029+ }
1030+
1031+ char
1032+ ctype<wchar_t>::
1033+ do_narrow(wchar_t __wc, char __dfault) const
1034+ {
1035+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1036+ return _M_narrow[__wc];
1037+#ifdef __UCLIBC_HAS_XLOCALE__
1038+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1039+#endif
1040+ const int __c = wctob(__wc);
1041+#ifdef __UCLIBC_HAS_XLOCALE__
1042+ __uselocale(__old);
1043+#endif
1044+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1045+ }
1046+
1047+ const wchar_t*
1048+ ctype<wchar_t>::
1049+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1050+ char* __dest) const
1051+ {
1052+#ifdef __UCLIBC_HAS_XLOCALE__
1053+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1054+#endif
1055+ if (_M_narrow_ok)
1056+ while (__lo < __hi)
1057+ {
1058+ if (*__lo >= 0 && *__lo < 128)
1059+ *__dest = _M_narrow[*__lo];
1060+ else
1061+ {
1062+ const int __c = wctob(*__lo);
1063+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1064+ }
1065+ ++__lo;
1066+ ++__dest;
1067+ }
1068+ else
1069+ while (__lo < __hi)
1070+ {
1071+ const int __c = wctob(*__lo);
1072+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1073+ ++__lo;
1074+ ++__dest;
1075+ }
1076+#ifdef __UCLIBC_HAS_XLOCALE__
1077+ __uselocale(__old);
1078+#endif
1079+ return __hi;
1080+ }
1081+
1082+ void
1083+ ctype<wchar_t>::_M_initialize_ctype()
1084+ {
1085+#ifdef __UCLIBC_HAS_XLOCALE__
1086+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1087+#endif
1088+ wint_t __i;
1089+ for (__i = 0; __i < 128; ++__i)
1090+ {
1091+ const int __c = wctob(__i);
1092+ if (__c == EOF)
1093+ break;
1094+ else
1095+ _M_narrow[__i] = static_cast<char>(__c);
1096+ }
1097+ if (__i == 128)
1098+ _M_narrow_ok = true;
1099+ else
1100+ _M_narrow_ok = false;
1101+ for (size_t __j = 0;
1102+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1103+ _M_widen[__j] = btowc(__j);
1104+
1105+ for (size_t __k = 0; __k <= 11; ++__k)
1106+ {
1107+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1108+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1109+ }
1110+#ifdef __UCLIBC_HAS_XLOCALE__
1111+ __uselocale(__old);
1112+#endif
1113+ }
1114+#endif // _GLIBCXX_USE_WCHAR_T
1115+}
1116Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.cc
1117===================================================================
1118--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1119+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.cc 2012-04-10 10:30:37.331368420 -0700
1120@@ -0,0 +1,100 @@
1121+// std::messages implementation details, GNU version -*- C++ -*-
1122+
1123+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1124+//
1125+// This file is part of the GNU ISO C++ Library. This library is free
1126+// software; you can redistribute it and/or modify it under the
1127+// terms of the GNU General Public License as published by the
1128+// Free Software Foundation; either version 2, or (at your option)
1129+// any later version.
1130+
1131+// This library is distributed in the hope that it will be useful,
1132+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1133+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1134+// GNU General Public License for more details.
1135+
1136+// You should have received a copy of the GNU General Public License along
1137+// with this library; see the file COPYING. If not, write to the Free
1138+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1139+// USA.
1140+
1141+// As a special exception, you may use this file as part of a free software
1142+// library without restriction. Specifically, if other files instantiate
1143+// templates or use macros or inline functions from this file, or you compile
1144+// this file and link it with other files to produce an executable, this
1145+// file does not by itself cause the resulting executable to be covered by
1146+// the GNU General Public License. This exception does not however
1147+// invalidate any other reasons why the executable file might be covered by
1148+// the GNU General Public License.
1149+
1150+//
1151+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1152+//
1153+
1154+// Written by Benjamin Kosnik <bkoz@redhat.com>
1155+
1156+#include <locale>
1157+#include <bits/c++locale_internal.h>
1158+
1159+#ifdef __UCLIBC_MJN3_ONLY__
1160+#warning fix gettext stuff
1161+#endif
1162+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1163+extern "C" char *__dcgettext(const char *domainname,
1164+ const char *msgid, int category);
1165+#undef gettext
1166+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1167+#else
1168+#undef gettext
1169+#define gettext(msgid) (msgid)
1170+#endif
1171+
1172+namespace std
1173+{
1174+ // Specializations.
1175+ template<>
1176+ string
1177+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1178+ {
1179+#ifdef __UCLIBC_HAS_XLOCALE__
1180+ __c_locale __old = __uselocale(_M_c_locale_messages);
1181+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1182+ __uselocale(__old);
1183+ return string(__msg);
1184+#elif defined __UCLIBC_HAS_LOCALE__
1185+ char* __old = strdup(setlocale(LC_ALL, NULL));
1186+ setlocale(LC_ALL, _M_name_messages);
1187+ const char* __msg = gettext(__dfault.c_str());
1188+ setlocale(LC_ALL, __old);
1189+ free(__old);
1190+ return string(__msg);
1191+#else
1192+ const char* __msg = gettext(__dfault.c_str());
1193+ return string(__msg);
1194+#endif
1195+ }
1196+
1197+#ifdef _GLIBCXX_USE_WCHAR_T
1198+ template<>
1199+ wstring
1200+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1201+ {
1202+# ifdef __UCLIBC_HAS_XLOCALE__
1203+ __c_locale __old = __uselocale(_M_c_locale_messages);
1204+ char* __msg = gettext(_M_convert_to_char(__dfault));
1205+ __uselocale(__old);
1206+ return _M_convert_from_char(__msg);
1207+# elif defined __UCLIBC_HAS_LOCALE__
1208+ char* __old = strdup(setlocale(LC_ALL, NULL));
1209+ setlocale(LC_ALL, _M_name_messages);
1210+ char* __msg = gettext(_M_convert_to_char(__dfault));
1211+ setlocale(LC_ALL, __old);
1212+ free(__old);
1213+ return _M_convert_from_char(__msg);
1214+# else
1215+ char* __msg = gettext(_M_convert_to_char(__dfault));
1216+ return _M_convert_from_char(__msg);
1217+# endif
1218+ }
1219+#endif
1220+}
1221Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.h
1222===================================================================
1223--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1224+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.h 2012-04-10 10:30:37.331368420 -0700
1225@@ -0,0 +1,118 @@
1226+// std::messages implementation details, GNU version -*- C++ -*-
1227+
1228+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1229+//
1230+// This file is part of the GNU ISO C++ Library. This library is free
1231+// software; you can redistribute it and/or modify it under the
1232+// terms of the GNU General Public License as published by the
1233+// Free Software Foundation; either version 2, or (at your option)
1234+// any later version.
1235+
1236+// This library is distributed in the hope that it will be useful,
1237+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1238+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1239+// GNU General Public License for more details.
1240+
1241+// You should have received a copy of the GNU General Public License along
1242+// with this library; see the file COPYING. If not, write to the Free
1243+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1244+// USA.
1245+
1246+// As a special exception, you may use this file as part of a free software
1247+// library without restriction. Specifically, if other files instantiate
1248+// templates or use macros or inline functions from this file, or you compile
1249+// this file and link it with other files to produce an executable, this
1250+// file does not by itself cause the resulting executable to be covered by
1251+// the GNU General Public License. This exception does not however
1252+// invalidate any other reasons why the executable file might be covered by
1253+// the GNU General Public License.
1254+
1255+//
1256+// ISO C++ 14882: 22.2.7.1.2 messages functions
1257+//
1258+
1259+// Written by Benjamin Kosnik <bkoz@redhat.com>
1260+
1261+#ifdef __UCLIBC_MJN3_ONLY__
1262+#warning fix prototypes for *textdomain funcs
1263+#endif
1264+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1265+extern "C" char *__textdomain(const char *domainname);
1266+extern "C" char *__bindtextdomain(const char *domainname,
1267+ const char *dirname);
1268+#else
1269+#undef __textdomain
1270+#undef __bindtextdomain
1271+#define __textdomain(D) ((void)0)
1272+#define __bindtextdomain(D,P) ((void)0)
1273+#endif
1274+
1275+ // Non-virtual member functions.
1276+ template<typename _CharT>
1277+ messages<_CharT>::messages(size_t __refs)
1278+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1279+ _M_name_messages(_S_get_c_name())
1280+ { }
1281+
1282+ template<typename _CharT>
1283+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1284+ size_t __refs)
1285+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1286+ _M_name_messages(__s)
1287+ {
1288+ char* __tmp = new char[std::strlen(__s) + 1];
1289+ std::strcpy(__tmp, __s);
1290+ _M_name_messages = __tmp;
1291+ }
1292+
1293+ template<typename _CharT>
1294+ typename messages<_CharT>::catalog
1295+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1296+ const char* __dir) const
1297+ {
1298+ __bindtextdomain(__s.c_str(), __dir);
1299+ return this->do_open(__s, __loc);
1300+ }
1301+
1302+ // Virtual member functions.
1303+ template<typename _CharT>
1304+ messages<_CharT>::~messages()
1305+ {
1306+ if (_M_name_messages != _S_get_c_name())
1307+ delete [] _M_name_messages;
1308+ _S_destroy_c_locale(_M_c_locale_messages);
1309+ }
1310+
1311+ template<typename _CharT>
1312+ typename messages<_CharT>::catalog
1313+ messages<_CharT>::do_open(const basic_string<char>& __s,
1314+ const locale&) const
1315+ {
1316+ // No error checking is done, assume the catalog exists and can
1317+ // be used.
1318+ __textdomain(__s.c_str());
1319+ return 0;
1320+ }
1321+
1322+ template<typename _CharT>
1323+ void
1324+ messages<_CharT>::do_close(catalog) const
1325+ { }
1326+
1327+ // messages_byname
1328+ template<typename _CharT>
1329+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1330+ : messages<_CharT>(__refs)
1331+ {
1332+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1333+ delete [] this->_M_name_messages;
1334+ char* __tmp = new char[std::strlen(__s) + 1];
1335+ std::strcpy(__tmp, __s);
1336+ this->_M_name_messages = __tmp;
1337+
1338+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1339+ {
1340+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1341+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1342+ }
1343+ }
1344Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1345===================================================================
1346--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1347+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2012-04-10 10:30:37.331368420 -0700
1348@@ -0,0 +1,692 @@
1349+// std::moneypunct implementation details, GNU version -*- C++ -*-
1350+
1351+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1352+//
1353+// This file is part of the GNU ISO C++ Library. This library is free
1354+// software; you can redistribute it and/or modify it under the
1355+// terms of the GNU General Public License as published by the
1356+// Free Software Foundation; either version 2, or (at your option)
1357+// any later version.
1358+
1359+// This library is distributed in the hope that it will be useful,
1360+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1361+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1362+// GNU General Public License for more details.
1363+
1364+// You should have received a copy of the GNU General Public License along
1365+// with this library; see the file COPYING. If not, write to the Free
1366+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1367+// USA.
1368+
1369+// As a special exception, you may use this file as part of a free software
1370+// library without restriction. Specifically, if other files instantiate
1371+// templates or use macros or inline functions from this file, or you compile
1372+// this file and link it with other files to produce an executable, this
1373+// file does not by itself cause the resulting executable to be covered by
1374+// the GNU General Public License. This exception does not however
1375+// invalidate any other reasons why the executable file might be covered by
1376+// the GNU General Public License.
1377+
1378+//
1379+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1380+//
1381+
1382+// Written by Benjamin Kosnik <bkoz@redhat.com>
1383+
1384+#define _LIBC
1385+#include <locale>
1386+#undef _LIBC
1387+#include <bits/c++locale_internal.h>
1388+
1389+#ifdef __UCLIBC_MJN3_ONLY__
1390+#warning optimize this for uclibc
1391+#warning tailor for stub locale support
1392+#endif
1393+
1394+#ifndef __UCLIBC_HAS_XLOCALE__
1395+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1396+#endif
1397+
1398+namespace std
1399+{
1400+ // Construct and return valid pattern consisting of some combination of:
1401+ // space none symbol sign value
1402+ money_base::pattern
1403+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1404+ {
1405+ pattern __ret;
1406+
1407+ // This insanely complicated routine attempts to construct a valid
1408+ // pattern for use with monyepunct. A couple of invariants:
1409+
1410+ // if (__precedes) symbol -> value
1411+ // else value -> symbol
1412+
1413+ // if (__space) space
1414+ // else none
1415+
1416+ // none == never first
1417+ // space never first or last
1418+
1419+ // Any elegant implementations of this are welcome.
1420+ switch (__posn)
1421+ {
1422+ case 0:
1423+ case 1:
1424+ // 1 The sign precedes the value and symbol.
1425+ __ret.field[0] = sign;
1426+ if (__space)
1427+ {
1428+ // Pattern starts with sign.
1429+ if (__precedes)
1430+ {
1431+ __ret.field[1] = symbol;
1432+ __ret.field[3] = value;
1433+ }
1434+ else
1435+ {
1436+ __ret.field[1] = value;
1437+ __ret.field[3] = symbol;
1438+ }
1439+ __ret.field[2] = space;
1440+ }
1441+ else
1442+ {
1443+ // Pattern starts with sign and ends with none.
1444+ if (__precedes)
1445+ {
1446+ __ret.field[1] = symbol;
1447+ __ret.field[2] = value;
1448+ }
1449+ else
1450+ {
1451+ __ret.field[1] = value;
1452+ __ret.field[2] = symbol;
1453+ }
1454+ __ret.field[3] = none;
1455+ }
1456+ break;
1457+ case 2:
1458+ // 2 The sign follows the value and symbol.
1459+ if (__space)
1460+ {
1461+ // Pattern either ends with sign.
1462+ if (__precedes)
1463+ {
1464+ __ret.field[0] = symbol;
1465+ __ret.field[2] = value;
1466+ }
1467+ else
1468+ {
1469+ __ret.field[0] = value;
1470+ __ret.field[2] = symbol;
1471+ }
1472+ __ret.field[1] = space;
1473+ __ret.field[3] = sign;
1474+ }
1475+ else
1476+ {
1477+ // Pattern ends with sign then none.
1478+ if (__precedes)
1479+ {
1480+ __ret.field[0] = symbol;
1481+ __ret.field[1] = value;
1482+ }
1483+ else
1484+ {
1485+ __ret.field[0] = value;
1486+ __ret.field[1] = symbol;
1487+ }
1488+ __ret.field[2] = sign;
1489+ __ret.field[3] = none;
1490+ }
1491+ break;
1492+ case 3:
1493+ // 3 The sign immediately precedes the symbol.
1494+ if (__precedes)
1495+ {
1496+ __ret.field[0] = sign;
1497+ __ret.field[1] = symbol;
1498+ if (__space)
1499+ {
1500+ __ret.field[2] = space;
1501+ __ret.field[3] = value;
1502+ }
1503+ else
1504+ {
1505+ __ret.field[2] = value;
1506+ __ret.field[3] = none;
1507+ }
1508+ }
1509+ else
1510+ {
1511+ __ret.field[0] = value;
1512+ if (__space)
1513+ {
1514+ __ret.field[1] = space;
1515+ __ret.field[2] = sign;
1516+ __ret.field[3] = symbol;
1517+ }
1518+ else
1519+ {
1520+ __ret.field[1] = sign;
1521+ __ret.field[2] = symbol;
1522+ __ret.field[3] = none;
1523+ }
1524+ }
1525+ break;
1526+ case 4:
1527+ // 4 The sign immediately follows the symbol.
1528+ if (__precedes)
1529+ {
1530+ __ret.field[0] = symbol;
1531+ __ret.field[1] = sign;
1532+ if (__space)
1533+ {
1534+ __ret.field[2] = space;
1535+ __ret.field[3] = value;
1536+ }
1537+ else
1538+ {
1539+ __ret.field[2] = value;
1540+ __ret.field[3] = none;
1541+ }
1542+ }
1543+ else
1544+ {
1545+ __ret.field[0] = value;
1546+ if (__space)
1547+ {
1548+ __ret.field[1] = space;
1549+ __ret.field[2] = symbol;
1550+ __ret.field[3] = sign;
1551+ }
1552+ else
1553+ {
1554+ __ret.field[1] = symbol;
1555+ __ret.field[2] = sign;
1556+ __ret.field[3] = none;
1557+ }
1558+ }
1559+ break;
1560+ default:
1561+ ;
1562+ }
1563+ return __ret;
1564+ }
1565+
1566+ template<>
1567+ void
1568+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1569+ const char*)
1570+ {
1571+ if (!_M_data)
1572+ _M_data = new __moneypunct_cache<char, true>;
1573+
1574+ if (!__cloc)
1575+ {
1576+ // "C" locale
1577+ _M_data->_M_decimal_point = '.';
1578+ _M_data->_M_thousands_sep = ',';
1579+ _M_data->_M_grouping = "";
1580+ _M_data->_M_grouping_size = 0;
1581+ _M_data->_M_curr_symbol = "";
1582+ _M_data->_M_curr_symbol_size = 0;
1583+ _M_data->_M_positive_sign = "";
1584+ _M_data->_M_positive_sign_size = 0;
1585+ _M_data->_M_negative_sign = "";
1586+ _M_data->_M_negative_sign_size = 0;
1587+ _M_data->_M_frac_digits = 0;
1588+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1589+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1590+
1591+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1592+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1593+ }
1594+ else
1595+ {
1596+ // Named locale.
1597+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1598+ __cloc));
1599+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1600+ __cloc));
1601+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1602+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1603+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1604+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1605+
1606+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1607+ if (!__nposn)
1608+ _M_data->_M_negative_sign = "()";
1609+ else
1610+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1611+ __cloc);
1612+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1613+
1614+ // _Intl == true
1615+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1616+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1617+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1618+ __cloc));
1619+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1620+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1621+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1622+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1623+ __pposn);
1624+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1625+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1626+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1627+ __nposn);
1628+ }
1629+ }
1630+
1631+ template<>
1632+ void
1633+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1634+ const char*)
1635+ {
1636+ if (!_M_data)
1637+ _M_data = new __moneypunct_cache<char, false>;
1638+
1639+ if (!__cloc)
1640+ {
1641+ // "C" locale
1642+ _M_data->_M_decimal_point = '.';
1643+ _M_data->_M_thousands_sep = ',';
1644+ _M_data->_M_grouping = "";
1645+ _M_data->_M_grouping_size = 0;
1646+ _M_data->_M_curr_symbol = "";
1647+ _M_data->_M_curr_symbol_size = 0;
1648+ _M_data->_M_positive_sign = "";
1649+ _M_data->_M_positive_sign_size = 0;
1650+ _M_data->_M_negative_sign = "";
1651+ _M_data->_M_negative_sign_size = 0;
1652+ _M_data->_M_frac_digits = 0;
1653+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1654+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1655+
1656+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1657+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1658+ }
1659+ else
1660+ {
1661+ // Named locale.
1662+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1663+ __cloc));
1664+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1665+ __cloc));
1666+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1667+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1668+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1669+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1670+
1671+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1672+ if (!__nposn)
1673+ _M_data->_M_negative_sign = "()";
1674+ else
1675+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1676+ __cloc);
1677+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1678+
1679+ // _Intl == false
1680+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1681+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1682+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1683+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1684+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1685+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1686+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1687+ __pposn);
1688+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1689+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1690+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1691+ __nposn);
1692+ }
1693+ }
1694+
1695+ template<>
1696+ moneypunct<char, true>::~moneypunct()
1697+ { delete _M_data; }
1698+
1699+ template<>
1700+ moneypunct<char, false>::~moneypunct()
1701+ { delete _M_data; }
1702+
1703+#ifdef _GLIBCXX_USE_WCHAR_T
1704+ template<>
1705+ void
1706+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1707+#ifdef __UCLIBC_HAS_XLOCALE__
1708+ const char*)
1709+#else
1710+ const char* __name)
1711+#endif
1712+ {
1713+ if (!_M_data)
1714+ _M_data = new __moneypunct_cache<wchar_t, true>;
1715+
1716+ if (!__cloc)
1717+ {
1718+ // "C" locale
1719+ _M_data->_M_decimal_point = L'.';
1720+ _M_data->_M_thousands_sep = L',';
1721+ _M_data->_M_grouping = "";
1722+ _M_data->_M_grouping_size = 0;
1723+ _M_data->_M_curr_symbol = L"";
1724+ _M_data->_M_curr_symbol_size = 0;
1725+ _M_data->_M_positive_sign = L"";
1726+ _M_data->_M_positive_sign_size = 0;
1727+ _M_data->_M_negative_sign = L"";
1728+ _M_data->_M_negative_sign_size = 0;
1729+ _M_data->_M_frac_digits = 0;
1730+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1731+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1732+
1733+ // Use ctype::widen code without the facet...
1734+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1735+ _M_data->_M_atoms[__i] =
1736+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1737+ }
1738+ else
1739+ {
1740+ // Named locale.
1741+#ifdef __UCLIBC_HAS_XLOCALE__
1742+ __c_locale __old = __uselocale(__cloc);
1743+#else
1744+ // Switch to named locale so that mbsrtowcs will work.
1745+ char* __old = strdup(setlocale(LC_ALL, NULL));
1746+ setlocale(LC_ALL, __name);
1747+#endif
1748+
1749+#ifdef __UCLIBC_MJN3_ONLY__
1750+#warning fix this... should be monetary
1751+#endif
1752+#ifdef __UCLIBC__
1753+# ifdef __UCLIBC_HAS_XLOCALE__
1754+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1755+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1756+# else
1757+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1758+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1759+# endif
1760+#else
1761+ union { char *__s; wchar_t __w; } __u;
1762+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1763+ _M_data->_M_decimal_point = __u.__w;
1764+
1765+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1766+ _M_data->_M_thousands_sep = __u.__w;
1767+#endif
1768+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1769+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1770+
1771+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1772+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1773+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1774+
1775+ wchar_t* __wcs_ps = 0;
1776+ wchar_t* __wcs_ns = 0;
1777+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1778+ try
1779+ {
1780+ mbstate_t __state;
1781+ size_t __len = strlen(__cpossign);
1782+ if (__len)
1783+ {
1784+ ++__len;
1785+ memset(&__state, 0, sizeof(mbstate_t));
1786+ __wcs_ps = new wchar_t[__len];
1787+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1788+ _M_data->_M_positive_sign = __wcs_ps;
1789+ }
1790+ else
1791+ _M_data->_M_positive_sign = L"";
1792+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1793+
1794+ __len = strlen(__cnegsign);
1795+ if (!__nposn)
1796+ _M_data->_M_negative_sign = L"()";
1797+ else if (__len)
1798+ {
1799+ ++__len;
1800+ memset(&__state, 0, sizeof(mbstate_t));
1801+ __wcs_ns = new wchar_t[__len];
1802+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1803+ _M_data->_M_negative_sign = __wcs_ns;
1804+ }
1805+ else
1806+ _M_data->_M_negative_sign = L"";
1807+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1808+
1809+ // _Intl == true.
1810+ __len = strlen(__ccurr);
1811+ if (__len)
1812+ {
1813+ ++__len;
1814+ memset(&__state, 0, sizeof(mbstate_t));
1815+ wchar_t* __wcs = new wchar_t[__len];
1816+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1817+ _M_data->_M_curr_symbol = __wcs;
1818+ }
1819+ else
1820+ _M_data->_M_curr_symbol = L"";
1821+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1822+ }
1823+ catch (...)
1824+ {
1825+ delete _M_data;
1826+ _M_data = 0;
1827+ delete __wcs_ps;
1828+ delete __wcs_ns;
1829+#ifdef __UCLIBC_HAS_XLOCALE__
1830+ __uselocale(__old);
1831+#else
1832+ setlocale(LC_ALL, __old);
1833+ free(__old);
1834+#endif
1835+ __throw_exception_again;
1836+ }
1837+
1838+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1839+ __cloc));
1840+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1841+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1842+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1843+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1844+ __pposn);
1845+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1846+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1847+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1848+ __nposn);
1849+
1850+#ifdef __UCLIBC_HAS_XLOCALE__
1851+ __uselocale(__old);
1852+#else
1853+ setlocale(LC_ALL, __old);
1854+ free(__old);
1855+#endif
1856+ }
1857+ }
1858+
1859+ template<>
1860+ void
1861+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1862+#ifdef __UCLIBC_HAS_XLOCALE__
1863+ const char*)
1864+#else
1865+ const char* __name)
1866+#endif
1867+ {
1868+ if (!_M_data)
1869+ _M_data = new __moneypunct_cache<wchar_t, false>;
1870+
1871+ if (!__cloc)
1872+ {
1873+ // "C" locale
1874+ _M_data->_M_decimal_point = L'.';
1875+ _M_data->_M_thousands_sep = L',';
1876+ _M_data->_M_grouping = "";
1877+ _M_data->_M_grouping_size = 0;
1878+ _M_data->_M_curr_symbol = L"";
1879+ _M_data->_M_curr_symbol_size = 0;
1880+ _M_data->_M_positive_sign = L"";
1881+ _M_data->_M_positive_sign_size = 0;
1882+ _M_data->_M_negative_sign = L"";
1883+ _M_data->_M_negative_sign_size = 0;
1884+ _M_data->_M_frac_digits = 0;
1885+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1886+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1887+
1888+ // Use ctype::widen code without the facet...
1889+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1890+ _M_data->_M_atoms[__i] =
1891+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1892+ }
1893+ else
1894+ {
1895+ // Named locale.
1896+#ifdef __UCLIBC_HAS_XLOCALE__
1897+ __c_locale __old = __uselocale(__cloc);
1898+#else
1899+ // Switch to named locale so that mbsrtowcs will work.
1900+ char* __old = strdup(setlocale(LC_ALL, NULL));
1901+ setlocale(LC_ALL, __name);
1902+#endif
1903+
1904+#ifdef __UCLIBC_MJN3_ONLY__
1905+#warning fix this... should be monetary
1906+#endif
1907+#ifdef __UCLIBC__
1908+# ifdef __UCLIBC_HAS_XLOCALE__
1909+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1910+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1911+# else
1912+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1913+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1914+# endif
1915+#else
1916+ union { char *__s; wchar_t __w; } __u;
1917+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1918+ _M_data->_M_decimal_point = __u.__w;
1919+
1920+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1921+ _M_data->_M_thousands_sep = __u.__w;
1922+#endif
1923+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1924+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1925+
1926+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1927+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1928+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1929+
1930+ wchar_t* __wcs_ps = 0;
1931+ wchar_t* __wcs_ns = 0;
1932+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1933+ try
1934+ {
1935+ mbstate_t __state;
1936+ size_t __len;
1937+ __len = strlen(__cpossign);
1938+ if (__len)
1939+ {
1940+ ++__len;
1941+ memset(&__state, 0, sizeof(mbstate_t));
1942+ __wcs_ps = new wchar_t[__len];
1943+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1944+ _M_data->_M_positive_sign = __wcs_ps;
1945+ }
1946+ else
1947+ _M_data->_M_positive_sign = L"";
1948+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1949+
1950+ __len = strlen(__cnegsign);
1951+ if (!__nposn)
1952+ _M_data->_M_negative_sign = L"()";
1953+ else if (__len)
1954+ {
1955+ ++__len;
1956+ memset(&__state, 0, sizeof(mbstate_t));
1957+ __wcs_ns = new wchar_t[__len];
1958+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1959+ _M_data->_M_negative_sign = __wcs_ns;
1960+ }
1961+ else
1962+ _M_data->_M_negative_sign = L"";
1963+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1964+
1965+ // _Intl == true.
1966+ __len = strlen(__ccurr);
1967+ if (__len)
1968+ {
1969+ ++__len;
1970+ memset(&__state, 0, sizeof(mbstate_t));
1971+ wchar_t* __wcs = new wchar_t[__len];
1972+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1973+ _M_data->_M_curr_symbol = __wcs;
1974+ }
1975+ else
1976+ _M_data->_M_curr_symbol = L"";
1977+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1978+ }
1979+ catch (...)
1980+ {
1981+ delete _M_data;
1982+ _M_data = 0;
1983+ delete __wcs_ps;
1984+ delete __wcs_ns;
1985+#ifdef __UCLIBC_HAS_XLOCALE__
1986+ __uselocale(__old);
1987+#else
1988+ setlocale(LC_ALL, __old);
1989+ free(__old);
1990+#endif
1991+ __throw_exception_again;
1992+ }
1993+
1994+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1995+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1996+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1997+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1998+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1999+ __pposn);
2000+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2001+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2002+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2003+ __nposn);
2004+
2005+#ifdef __UCLIBC_HAS_XLOCALE__
2006+ __uselocale(__old);
2007+#else
2008+ setlocale(LC_ALL, __old);
2009+ free(__old);
2010+#endif
2011+ }
2012+ }
2013+
2014+ template<>
2015+ moneypunct<wchar_t, true>::~moneypunct()
2016+ {
2017+ if (_M_data->_M_positive_sign_size)
2018+ delete [] _M_data->_M_positive_sign;
2019+ if (_M_data->_M_negative_sign_size
2020+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2021+ delete [] _M_data->_M_negative_sign;
2022+ if (_M_data->_M_curr_symbol_size)
2023+ delete [] _M_data->_M_curr_symbol;
2024+ delete _M_data;
2025+ }
2026+
2027+ template<>
2028+ moneypunct<wchar_t, false>::~moneypunct()
2029+ {
2030+ if (_M_data->_M_positive_sign_size)
2031+ delete [] _M_data->_M_positive_sign;
2032+ if (_M_data->_M_negative_sign_size
2033+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2034+ delete [] _M_data->_M_negative_sign;
2035+ if (_M_data->_M_curr_symbol_size)
2036+ delete [] _M_data->_M_curr_symbol;
2037+ delete _M_data;
2038+ }
2039+#endif
2040+}
2041Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2042===================================================================
2043--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2044+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2012-04-10 10:30:37.331368420 -0700
2045@@ -0,0 +1,160 @@
2046+// std::numpunct implementation details, GNU version -*- C++ -*-
2047+
2048+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2049+//
2050+// This file is part of the GNU ISO C++ Library. This library is free
2051+// software; you can redistribute it and/or modify it under the
2052+// terms of the GNU General Public License as published by the
2053+// Free Software Foundation; either version 2, or (at your option)
2054+// any later version.
2055+
2056+// This library is distributed in the hope that it will be useful,
2057+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2058+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2059+// GNU General Public License for more details.
2060+
2061+// You should have received a copy of the GNU General Public License along
2062+// with this library; see the file COPYING. If not, write to the Free
2063+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2064+// USA.
2065+
2066+// As a special exception, you may use this file as part of a free software
2067+// library without restriction. Specifically, if other files instantiate
2068+// templates or use macros or inline functions from this file, or you compile
2069+// this file and link it with other files to produce an executable, this
2070+// file does not by itself cause the resulting executable to be covered by
2071+// the GNU General Public License. This exception does not however
2072+// invalidate any other reasons why the executable file might be covered by
2073+// the GNU General Public License.
2074+
2075+//
2076+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2077+//
2078+
2079+// Written by Benjamin Kosnik <bkoz@redhat.com>
2080+
2081+#define _LIBC
2082+#include <locale>
2083+#undef _LIBC
2084+#include <bits/c++locale_internal.h>
2085+
2086+#ifdef __UCLIBC_MJN3_ONLY__
2087+#warning tailor for stub locale support
2088+#endif
2089+#ifndef __UCLIBC_HAS_XLOCALE__
2090+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2091+#endif
2092+
2093+namespace std
2094+{
2095+ template<>
2096+ void
2097+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2098+ {
2099+ if (!_M_data)
2100+ _M_data = new __numpunct_cache<char>;
2101+
2102+ if (!__cloc)
2103+ {
2104+ // "C" locale
2105+ _M_data->_M_grouping = "";
2106+ _M_data->_M_grouping_size = 0;
2107+ _M_data->_M_use_grouping = false;
2108+
2109+ _M_data->_M_decimal_point = '.';
2110+ _M_data->_M_thousands_sep = ',';
2111+
2112+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2113+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2114+
2115+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2116+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2117+ }
2118+ else
2119+ {
2120+ // Named locale.
2121+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2122+ __cloc));
2123+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2124+ __cloc));
2125+
2126+ // Check for NULL, which implies no grouping.
2127+ if (_M_data->_M_thousands_sep == '\0')
2128+ _M_data->_M_grouping = "";
2129+ else
2130+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2131+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2132+ }
2133+
2134+ // NB: There is no way to extact this info from posix locales.
2135+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2136+ _M_data->_M_truename = "true";
2137+ _M_data->_M_truename_size = 4;
2138+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2139+ _M_data->_M_falsename = "false";
2140+ _M_data->_M_falsename_size = 5;
2141+ }
2142+
2143+ template<>
2144+ numpunct<char>::~numpunct()
2145+ { delete _M_data; }
2146+
2147+#ifdef _GLIBCXX_USE_WCHAR_T
2148+ template<>
2149+ void
2150+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2151+ {
2152+ if (!_M_data)
2153+ _M_data = new __numpunct_cache<wchar_t>;
2154+
2155+ if (!__cloc)
2156+ {
2157+ // "C" locale
2158+ _M_data->_M_grouping = "";
2159+ _M_data->_M_grouping_size = 0;
2160+ _M_data->_M_use_grouping = false;
2161+
2162+ _M_data->_M_decimal_point = L'.';
2163+ _M_data->_M_thousands_sep = L',';
2164+
2165+ // Use ctype::widen code without the facet...
2166+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2167+ _M_data->_M_atoms_out[__i] =
2168+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2169+
2170+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2171+ _M_data->_M_atoms_in[__j] =
2172+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2173+ }
2174+ else
2175+ {
2176+ // Named locale.
2177+ // NB: In the GNU model wchar_t is always 32 bit wide.
2178+ union { char *__s; wchar_t __w; } __u;
2179+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2180+ _M_data->_M_decimal_point = __u.__w;
2181+
2182+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2183+ _M_data->_M_thousands_sep = __u.__w;
2184+
2185+ if (_M_data->_M_thousands_sep == L'\0')
2186+ _M_data->_M_grouping = "";
2187+ else
2188+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2189+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2190+ }
2191+
2192+ // NB: There is no way to extact this info from posix locales.
2193+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2194+ _M_data->_M_truename = L"true";
2195+ _M_data->_M_truename_size = 4;
2196+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2197+ _M_data->_M_falsename = L"false";
2198+ _M_data->_M_falsename_size = 5;
2199+ }
2200+
2201+ template<>
2202+ numpunct<wchar_t>::~numpunct()
2203+ { delete _M_data; }
2204+ #endif
2205+}
2206Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.cc
2207===================================================================
2208--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2209+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.cc 2012-04-10 10:30:37.331368420 -0700
2210@@ -0,0 +1,406 @@
2211+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2212+
2213+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2214+//
2215+// This file is part of the GNU ISO C++ Library. This library is free
2216+// software; you can redistribute it and/or modify it under the
2217+// terms of the GNU General Public License as published by the
2218+// Free Software Foundation; either version 2, or (at your option)
2219+// any later version.
2220+
2221+// This library is distributed in the hope that it will be useful,
2222+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2223+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2224+// GNU General Public License for more details.
2225+
2226+// You should have received a copy of the GNU General Public License along
2227+// with this library; see the file COPYING. If not, write to the Free
2228+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2229+// USA.
2230+
2231+// As a special exception, you may use this file as part of a free software
2232+// library without restriction. Specifically, if other files instantiate
2233+// templates or use macros or inline functions from this file, or you compile
2234+// this file and link it with other files to produce an executable, this
2235+// file does not by itself cause the resulting executable to be covered by
2236+// the GNU General Public License. This exception does not however
2237+// invalidate any other reasons why the executable file might be covered by
2238+// the GNU General Public License.
2239+
2240+//
2241+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2242+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2243+//
2244+
2245+// Written by Benjamin Kosnik <bkoz@redhat.com>
2246+
2247+#include <locale>
2248+#include <bits/c++locale_internal.h>
2249+
2250+#ifdef __UCLIBC_MJN3_ONLY__
2251+#warning tailor for stub locale support
2252+#endif
2253+#ifndef __UCLIBC_HAS_XLOCALE__
2254+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2255+#endif
2256+
2257+namespace std
2258+{
2259+ template<>
2260+ void
2261+ __timepunct<char>::
2262+ _M_put(char* __s, size_t __maxlen, const char* __format,
2263+ const tm* __tm) const
2264+ {
2265+#ifdef __UCLIBC_HAS_XLOCALE__
2266+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2267+ _M_c_locale_timepunct);
2268+#else
2269+ char* __old = strdup(setlocale(LC_ALL, NULL));
2270+ setlocale(LC_ALL, _M_name_timepunct);
2271+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2272+ setlocale(LC_ALL, __old);
2273+ free(__old);
2274+#endif
2275+ // Make sure __s is null terminated.
2276+ if (__len == 0)
2277+ __s[0] = '\0';
2278+ }
2279+
2280+ template<>
2281+ void
2282+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2283+ {
2284+ if (!_M_data)
2285+ _M_data = new __timepunct_cache<char>;
2286+
2287+ if (!__cloc)
2288+ {
2289+ // "C" locale
2290+ _M_c_locale_timepunct = _S_get_c_locale();
2291+
2292+ _M_data->_M_date_format = "%m/%d/%y";
2293+ _M_data->_M_date_era_format = "%m/%d/%y";
2294+ _M_data->_M_time_format = "%H:%M:%S";
2295+ _M_data->_M_time_era_format = "%H:%M:%S";
2296+ _M_data->_M_date_time_format = "";
2297+ _M_data->_M_date_time_era_format = "";
2298+ _M_data->_M_am = "AM";
2299+ _M_data->_M_pm = "PM";
2300+ _M_data->_M_am_pm_format = "";
2301+
2302+ // Day names, starting with "C"'s Sunday.
2303+ _M_data->_M_day1 = "Sunday";
2304+ _M_data->_M_day2 = "Monday";
2305+ _M_data->_M_day3 = "Tuesday";
2306+ _M_data->_M_day4 = "Wednesday";
2307+ _M_data->_M_day5 = "Thursday";
2308+ _M_data->_M_day6 = "Friday";
2309+ _M_data->_M_day7 = "Saturday";
2310+
2311+ // Abbreviated day names, starting with "C"'s Sun.
2312+ _M_data->_M_aday1 = "Sun";
2313+ _M_data->_M_aday2 = "Mon";
2314+ _M_data->_M_aday3 = "Tue";
2315+ _M_data->_M_aday4 = "Wed";
2316+ _M_data->_M_aday5 = "Thu";
2317+ _M_data->_M_aday6 = "Fri";
2318+ _M_data->_M_aday7 = "Sat";
2319+
2320+ // Month names, starting with "C"'s January.
2321+ _M_data->_M_month01 = "January";
2322+ _M_data->_M_month02 = "February";
2323+ _M_data->_M_month03 = "March";
2324+ _M_data->_M_month04 = "April";
2325+ _M_data->_M_month05 = "May";
2326+ _M_data->_M_month06 = "June";
2327+ _M_data->_M_month07 = "July";
2328+ _M_data->_M_month08 = "August";
2329+ _M_data->_M_month09 = "September";
2330+ _M_data->_M_month10 = "October";
2331+ _M_data->_M_month11 = "November";
2332+ _M_data->_M_month12 = "December";
2333+
2334+ // Abbreviated month names, starting with "C"'s Jan.
2335+ _M_data->_M_amonth01 = "Jan";
2336+ _M_data->_M_amonth02 = "Feb";
2337+ _M_data->_M_amonth03 = "Mar";
2338+ _M_data->_M_amonth04 = "Apr";
2339+ _M_data->_M_amonth05 = "May";
2340+ _M_data->_M_amonth06 = "Jun";
2341+ _M_data->_M_amonth07 = "Jul";
2342+ _M_data->_M_amonth08 = "Aug";
2343+ _M_data->_M_amonth09 = "Sep";
2344+ _M_data->_M_amonth10 = "Oct";
2345+ _M_data->_M_amonth11 = "Nov";
2346+ _M_data->_M_amonth12 = "Dec";
2347+ }
2348+ else
2349+ {
2350+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2351+
2352+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2353+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2354+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2355+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2356+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2357+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2358+ __cloc);
2359+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2360+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2361+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2362+
2363+ // Day names, starting with "C"'s Sunday.
2364+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2365+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2366+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2367+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2368+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2369+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2370+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2371+
2372+ // Abbreviated day names, starting with "C"'s Sun.
2373+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2374+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2375+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2376+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2377+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2378+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2379+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2380+
2381+ // Month names, starting with "C"'s January.
2382+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2383+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2384+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2385+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2386+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2387+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2388+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2389+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2390+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2391+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2392+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2393+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2394+
2395+ // Abbreviated month names, starting with "C"'s Jan.
2396+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2397+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2398+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2399+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2400+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2401+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2402+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2403+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2404+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2405+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2406+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2407+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2408+ }
2409+ }
2410+
2411+#ifdef _GLIBCXX_USE_WCHAR_T
2412+ template<>
2413+ void
2414+ __timepunct<wchar_t>::
2415+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2416+ const tm* __tm) const
2417+ {
2418+#ifdef __UCLIBC_HAS_XLOCALE__
2419+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2420+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2421+ _M_c_locale_timepunct);
2422+#else
2423+ char* __old = strdup(setlocale(LC_ALL, NULL));
2424+ setlocale(LC_ALL, _M_name_timepunct);
2425+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2426+ setlocale(LC_ALL, __old);
2427+ free(__old);
2428+#endif
2429+ // Make sure __s is null terminated.
2430+ if (__len == 0)
2431+ __s[0] = L'\0';
2432+ }
2433+
2434+ template<>
2435+ void
2436+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2437+ {
2438+ if (!_M_data)
2439+ _M_data = new __timepunct_cache<wchar_t>;
2440+
2441+#warning wide time stuff
2442+// if (!__cloc)
2443+ {
2444+ // "C" locale
2445+ _M_c_locale_timepunct = _S_get_c_locale();
2446+
2447+ _M_data->_M_date_format = L"%m/%d/%y";
2448+ _M_data->_M_date_era_format = L"%m/%d/%y";
2449+ _M_data->_M_time_format = L"%H:%M:%S";
2450+ _M_data->_M_time_era_format = L"%H:%M:%S";
2451+ _M_data->_M_date_time_format = L"";
2452+ _M_data->_M_date_time_era_format = L"";
2453+ _M_data->_M_am = L"AM";
2454+ _M_data->_M_pm = L"PM";
2455+ _M_data->_M_am_pm_format = L"";
2456+
2457+ // Day names, starting with "C"'s Sunday.
2458+ _M_data->_M_day1 = L"Sunday";
2459+ _M_data->_M_day2 = L"Monday";
2460+ _M_data->_M_day3 = L"Tuesday";
2461+ _M_data->_M_day4 = L"Wednesday";
2462+ _M_data->_M_day5 = L"Thursday";
2463+ _M_data->_M_day6 = L"Friday";
2464+ _M_data->_M_day7 = L"Saturday";
2465+
2466+ // Abbreviated day names, starting with "C"'s Sun.
2467+ _M_data->_M_aday1 = L"Sun";
2468+ _M_data->_M_aday2 = L"Mon";
2469+ _M_data->_M_aday3 = L"Tue";
2470+ _M_data->_M_aday4 = L"Wed";
2471+ _M_data->_M_aday5 = L"Thu";
2472+ _M_data->_M_aday6 = L"Fri";
2473+ _M_data->_M_aday7 = L"Sat";
2474+
2475+ // Month names, starting with "C"'s January.
2476+ _M_data->_M_month01 = L"January";
2477+ _M_data->_M_month02 = L"February";
2478+ _M_data->_M_month03 = L"March";
2479+ _M_data->_M_month04 = L"April";
2480+ _M_data->_M_month05 = L"May";
2481+ _M_data->_M_month06 = L"June";
2482+ _M_data->_M_month07 = L"July";
2483+ _M_data->_M_month08 = L"August";
2484+ _M_data->_M_month09 = L"September";
2485+ _M_data->_M_month10 = L"October";
2486+ _M_data->_M_month11 = L"November";
2487+ _M_data->_M_month12 = L"December";
2488+
2489+ // Abbreviated month names, starting with "C"'s Jan.
2490+ _M_data->_M_amonth01 = L"Jan";
2491+ _M_data->_M_amonth02 = L"Feb";
2492+ _M_data->_M_amonth03 = L"Mar";
2493+ _M_data->_M_amonth04 = L"Apr";
2494+ _M_data->_M_amonth05 = L"May";
2495+ _M_data->_M_amonth06 = L"Jun";
2496+ _M_data->_M_amonth07 = L"Jul";
2497+ _M_data->_M_amonth08 = L"Aug";
2498+ _M_data->_M_amonth09 = L"Sep";
2499+ _M_data->_M_amonth10 = L"Oct";
2500+ _M_data->_M_amonth11 = L"Nov";
2501+ _M_data->_M_amonth12 = L"Dec";
2502+ }
2503+#if 0
2504+ else
2505+ {
2506+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2507+
2508+ union { char *__s; wchar_t *__w; } __u;
2509+
2510+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2511+ _M_data->_M_date_format = __u.__w;
2512+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2513+ _M_data->_M_date_era_format = __u.__w;
2514+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2515+ _M_data->_M_time_format = __u.__w;
2516+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2517+ _M_data->_M_time_era_format = __u.__w;
2518+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2519+ _M_data->_M_date_time_format = __u.__w;
2520+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2521+ _M_data->_M_date_time_era_format = __u.__w;
2522+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2523+ _M_data->_M_am = __u.__w;
2524+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2525+ _M_data->_M_pm = __u.__w;
2526+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2527+ _M_data->_M_am_pm_format = __u.__w;
2528+
2529+ // Day names, starting with "C"'s Sunday.
2530+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2531+ _M_data->_M_day1 = __u.__w;
2532+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2533+ _M_data->_M_day2 = __u.__w;
2534+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2535+ _M_data->_M_day3 = __u.__w;
2536+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2537+ _M_data->_M_day4 = __u.__w;
2538+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2539+ _M_data->_M_day5 = __u.__w;
2540+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2541+ _M_data->_M_day6 = __u.__w;
2542+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2543+ _M_data->_M_day7 = __u.__w;
2544+
2545+ // Abbreviated day names, starting with "C"'s Sun.
2546+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2547+ _M_data->_M_aday1 = __u.__w;
2548+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2549+ _M_data->_M_aday2 = __u.__w;
2550+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2551+ _M_data->_M_aday3 = __u.__w;
2552+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2553+ _M_data->_M_aday4 = __u.__w;
2554+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2555+ _M_data->_M_aday5 = __u.__w;
2556+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2557+ _M_data->_M_aday6 = __u.__w;
2558+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2559+ _M_data->_M_aday7 = __u.__w;
2560+
2561+ // Month names, starting with "C"'s January.
2562+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2563+ _M_data->_M_month01 = __u.__w;
2564+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2565+ _M_data->_M_month02 = __u.__w;
2566+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2567+ _M_data->_M_month03 = __u.__w;
2568+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2569+ _M_data->_M_month04 = __u.__w;
2570+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2571+ _M_data->_M_month05 = __u.__w;
2572+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2573+ _M_data->_M_month06 = __u.__w;
2574+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2575+ _M_data->_M_month07 = __u.__w;
2576+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2577+ _M_data->_M_month08 = __u.__w;
2578+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2579+ _M_data->_M_month09 = __u.__w;
2580+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2581+ _M_data->_M_month10 = __u.__w;
2582+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2583+ _M_data->_M_month11 = __u.__w;
2584+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2585+ _M_data->_M_month12 = __u.__w;
2586+
2587+ // Abbreviated month names, starting with "C"'s Jan.
2588+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2589+ _M_data->_M_amonth01 = __u.__w;
2590+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2591+ _M_data->_M_amonth02 = __u.__w;
2592+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2593+ _M_data->_M_amonth03 = __u.__w;
2594+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2595+ _M_data->_M_amonth04 = __u.__w;
2596+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2597+ _M_data->_M_amonth05 = __u.__w;
2598+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2599+ _M_data->_M_amonth06 = __u.__w;
2600+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2601+ _M_data->_M_amonth07 = __u.__w;
2602+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2603+ _M_data->_M_amonth08 = __u.__w;
2604+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2605+ _M_data->_M_amonth09 = __u.__w;
2606+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2607+ _M_data->_M_amonth10 = __u.__w;
2608+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2609+ _M_data->_M_amonth11 = __u.__w;
2610+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2611+ _M_data->_M_amonth12 = __u.__w;
2612+ }
2613+#endif // 0
2614+ }
2615+#endif
2616+}
2617Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.h
2618===================================================================
2619--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2620+++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.h 2012-04-10 10:30:37.331368420 -0700
2621@@ -0,0 +1,68 @@
2622+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2623+
2624+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2625+//
2626+// This file is part of the GNU ISO C++ Library. This library is free
2627+// software; you can redistribute it and/or modify it under the
2628+// terms of the GNU General Public License as published by the
2629+// Free Software Foundation; either version 2, or (at your option)
2630+// any later version.
2631+
2632+// This library is distributed in the hope that it will be useful,
2633+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2634+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2635+// GNU General Public License for more details.
2636+
2637+// You should have received a copy of the GNU General Public License along
2638+// with this library; see the file COPYING. If not, write to the Free
2639+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2640+// USA.
2641+
2642+// As a special exception, you may use this file as part of a free software
2643+// library without restriction. Specifically, if other files instantiate
2644+// templates or use macros or inline functions from this file, or you compile
2645+// this file and link it with other files to produce an executable, this
2646+// file does not by itself cause the resulting executable to be covered by
2647+// the GNU General Public License. This exception does not however
2648+// invalidate any other reasons why the executable file might be covered by
2649+// the GNU General Public License.
2650+
2651+//
2652+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2653+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2654+//
2655+
2656+// Written by Benjamin Kosnik <bkoz@redhat.com>
2657+
2658+ template<typename _CharT>
2659+ __timepunct<_CharT>::__timepunct(size_t __refs)
2660+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2661+ _M_name_timepunct(_S_get_c_name())
2662+ { _M_initialize_timepunct(); }
2663+
2664+ template<typename _CharT>
2665+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2666+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2667+ _M_name_timepunct(_S_get_c_name())
2668+ { _M_initialize_timepunct(); }
2669+
2670+ template<typename _CharT>
2671+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2672+ size_t __refs)
2673+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2674+ _M_name_timepunct(__s)
2675+ {
2676+ char* __tmp = new char[std::strlen(__s) + 1];
2677+ std::strcpy(__tmp, __s);
2678+ _M_name_timepunct = __tmp;
2679+ _M_initialize_timepunct(__cloc);
2680+ }
2681+
2682+ template<typename _CharT>
2683+ __timepunct<_CharT>::~__timepunct()
2684+ {
2685+ if (_M_name_timepunct != _S_get_c_name())
2686+ delete [] _M_name_timepunct;
2687+ delete _M_data;
2688+ _S_destroy_c_locale(_M_c_locale_timepunct);
2689+ }
2690Index: gcc-4_7-branch/libstdc++-v3/configure
2691===================================================================
2692--- gcc-4_7-branch.orig/libstdc++-v3/configure 2012-04-10 10:19:50.383337127 -0700
2693+++ gcc-4_7-branch/libstdc++-v3/configure 2012-04-10 10:30:37.347368481 -0700
2694@@ -15736,6 +15736,9 @@
2695 # Default to "generic".
2696 if test $enable_clocale_flag = auto; then
2697 case ${target_os} in
2698+ *-uclibc*)
2699+ enable_clocale_flag=uclibc
2700+ ;;
2701 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2702 enable_clocale_flag=gnu
2703 ;;
2704@@ -15990,6 +15993,78 @@
2705 CTIME_CC=config/locale/generic/time_members.cc
2706 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2707 ;;
2708+ uclibc)
2709+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: uclibc" >&5
2710+$as_echo "uclibc" >&6; }
2711+
2712+ # Declare intention to use gettext, and add support for specific
2713+ # languages.
2714+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2715+ ALL_LINGUAS="de fr"
2716+
2717+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2718+ # Extract the first word of "msgfmt", so it can be a program name with args.
2719+set dummy msgfmt; ac_word=$2
2720+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2721+$as_echo_n "checking for $ac_word... " >&6; }
2722+if test "${ac_cv_prog_check_msgfmt+set}" = set; then :
2723+ $as_echo_n "(cached) " >&6
2724+else
2725+ if test -n "$check_msgfmt"; then
2726+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2727+else
2728+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2729+for as_dir in $PATH
2730+do
2731+ IFS=$as_save_IFS
2732+ test -z "$as_dir" && as_dir=.
2733+ for ac_exec_ext in '' $ac_executable_extensions; do
2734+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2735+ ac_cv_prog_check_msgfmt="yes"
2736+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2737+ break 2
2738+ fi
2739+done
2740+ done
2741+IFS=$as_save_IFS
2742+
2743+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2744+fi
2745+fi
2746+check_msgfmt=$ac_cv_prog_check_msgfmt
2747+if test -n "$check_msgfmt"; then
2748+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $check_msgfmt" >&5
2749+$as_echo "$check_msgfmt" >&6; }
2750+else
2751+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2752+$as_echo "no" >&6; }
2753+fi
2754+
2755+
2756+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2757+ USE_NLS=yes
2758+ fi
2759+ # Export the build objects.
2760+ for ling in $ALL_LINGUAS; do \
2761+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2762+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2763+ done
2764+
2765+
2766+
2767+ CLOCALE_H=config/locale/uclibc/c_locale.h
2768+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2769+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2770+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2771+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2772+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2773+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2774+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2775+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2776+ CTIME_H=config/locale/uclibc/time_members.h
2777+ CTIME_CC=config/locale/uclibc/time_members.cc
2778+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2779+ ;;
2780 esac
2781
2782 # This is where the testsuite looks for locale catalogs, using the
2783Index: gcc-4_7-branch/libstdc++-v3/include/c_compatibility/wchar.h
2784===================================================================
2785--- gcc-4_7-branch.orig/libstdc++-v3/include/c_compatibility/wchar.h 2012-04-10 10:19:50.303337124 -0700
2786+++ gcc-4_7-branch/libstdc++-v3/include/c_compatibility/wchar.h 2012-04-10 10:30:37.347368481 -0700
2787@@ -101,7 +101,9 @@
2788 using std::wmemcpy;
2789 using std::wmemmove;
2790 using std::wmemset;
2791+#if _GLIBCXX_HAVE_WCSFTIME
2792 using std::wcsftime;
2793+#endif
2794
2795 #if _GLIBCXX_USE_C99
2796 using std::wcstold;
2797Index: gcc-4_7-branch/libstdc++-v3/include/c_std/cwchar
2798===================================================================
2799--- gcc-4_7-branch.orig/libstdc++-v3/include/c_std/cwchar 2012-04-10 10:19:50.295337124 -0700
2800+++ gcc-4_7-branch/libstdc++-v3/include/c_std/cwchar 2012-04-10 10:30:37.347368481 -0700
2801@@ -177,7 +177,9 @@
2802 using ::wcscoll;
2803 using ::wcscpy;
2804 using ::wcscspn;
2805+#if _GLIBCXX_HAVE_WCSFTIME
2806 using ::wcsftime;
2807+#endif
2808 using ::wcslen;
2809 using ::wcsncat;
2810 using ::wcsncmp;
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch b/meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch
new file mode 100644
index 0000000000..c602e913e9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/203-uclibc-locale-no__x.patch
@@ -0,0 +1,235 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
7@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm
8 extern "C" __typeof(wctype_l) __wctype_l;
9 #endif
10
11+# define __nl_langinfo_l nl_langinfo_l
12+# define __strcoll_l strcoll_l
13+# define __strftime_l strftime_l
14+# define __strtod_l strtod_l
15+# define __strtof_l strtof_l
16+# define __strtold_l strtold_l
17+# define __strxfrm_l strxfrm_l
18+# define __newlocale newlocale
19+# define __freelocale freelocale
20+# define __duplocale duplocale
21+# define __uselocale uselocale
22+
23+# ifdef _GLIBCXX_USE_WCHAR_T
24+# define __iswctype_l iswctype_l
25+# define __towlower_l towlower_l
26+# define __towupper_l towupper_l
27+# define __wcscoll_l wcscoll_l
28+# define __wcsftime_l wcsftime_l
29+# define __wcsxfrm_l wcsxfrm_l
30+# define __wctype_l wctype_l
31+# endif
32+
33+#else
34+# define __nl_langinfo_l(N, L) nl_langinfo((N))
35+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
36+# define __strtod_l(S, E, L) strtod((S), (E))
37+# define __strtof_l(S, E, L) strtof((S), (E))
38+# define __strtold_l(S, E, L) strtold((S), (E))
39+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
40+# warning should dummy __newlocale check for C|POSIX ?
41+# define __newlocale(a, b, c) NULL
42+# define __freelocale(a) ((void)0)
43+# define __duplocale(a) __c_locale()
44+//# define __uselocale ?
45+//
46+# ifdef _GLIBCXX_USE_WCHAR_T
47+# define __iswctype_l(C, M, L) iswctype((C), (M))
48+# define __towlower_l(C, L) towlower((C))
49+# define __towupper_l(C, L) towupper((C))
50+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
51+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
52+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
53+# define __wctype_l(S, L) wctype((S))
54+# endif
55+
56 #endif // GLIBC 2.3 and later
57Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
58===================================================================
59--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
60+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
61@@ -39,20 +39,6 @@
62 #include <langinfo.h>
63 #include <bits/c++locale_internal.h>
64
65-#ifndef __UCLIBC_HAS_XLOCALE__
66-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
67-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
68-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
69-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
70-#define __strtof_l(S, E, L) strtof((S), (E))
71-#define __strtod_l(S, E, L) strtod((S), (E))
72-#define __strtold_l(S, E, L) strtold((S), (E))
73-#warning should dummy __newlocale check for C|POSIX ?
74-#define __newlocale(a, b, c) NULL
75-#define __freelocale(a) ((void)0)
76-#define __duplocale(a) __c_locale()
77-#endif
78-
79 namespace std
80 {
81 template<>
82Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
83===================================================================
84--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc
85+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
86@@ -36,13 +36,6 @@
87 #include <locale>
88 #include <bits/c++locale_internal.h>
89
90-#ifndef __UCLIBC_HAS_XLOCALE__
91-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
92-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
93-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
94-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
95-#endif
96-
97 namespace std
98 {
99 // These are basically extensions to char_traits, and perhaps should
100Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
101===================================================================
102--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
103+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
104@@ -43,10 +43,6 @@
105 #warning tailor for stub locale support
106 #endif
107
108-#ifndef __UCLIBC_HAS_XLOCALE__
109-#define __nl_langinfo_l(N, L) nl_langinfo((N))
110-#endif
111-
112 namespace std
113 {
114 // Construct and return valid pattern consisting of some combination of:
115Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
116===================================================================
117--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
118+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
119@@ -41,9 +41,6 @@
120 #ifdef __UCLIBC_MJN3_ONLY__
121 #warning tailor for stub locale support
122 #endif
123-#ifndef __UCLIBC_HAS_XLOCALE__
124-#define __nl_langinfo_l(N, L) nl_langinfo((N))
125-#endif
126
127 namespace std
128 {
129Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
130===================================================================
131--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
132+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
133@@ -40,9 +40,6 @@
134 #ifdef __UCLIBC_MJN3_ONLY__
135 #warning tailor for stub locale support
136 #endif
137-#ifndef __UCLIBC_HAS_XLOCALE__
138-#define __nl_langinfo_l(N, L) nl_langinfo((N))
139-#endif
140
141 namespace std
142 {
143Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
144===================================================================
145--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
146+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
147@@ -38,13 +38,6 @@
148 #undef _LIBC
149 #include <bits/c++locale_internal.h>
150
151-#ifndef __UCLIBC_HAS_XLOCALE__
152-#define __wctype_l(S, L) wctype((S))
153-#define __towupper_l(C, L) towupper((C))
154-#define __towlower_l(C, L) towlower((C))
155-#define __iswctype_l(C, M, L) iswctype((C), (M))
156-#endif
157-
158 namespace std
159 {
160 // NB: The other ctype<char> specializations are in src/locale.cc and
161Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
162===================================================================
163--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc
164+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
165@@ -39,13 +39,10 @@
166 #ifdef __UCLIBC_MJN3_ONLY__
167 #warning fix gettext stuff
168 #endif
169-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
170-extern "C" char *__dcgettext(const char *domainname,
171- const char *msgid, int category);
172 #undef gettext
173-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
174+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
175+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
176 #else
177-#undef gettext
178 #define gettext(msgid) (msgid)
179 #endif
180
181Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
182===================================================================
183--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
184+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
185@@ -36,15 +36,11 @@
186 #ifdef __UCLIBC_MJN3_ONLY__
187 #warning fix prototypes for *textdomain funcs
188 #endif
189-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
190-extern "C" char *__textdomain(const char *domainname);
191-extern "C" char *__bindtextdomain(const char *domainname,
192- const char *dirname);
193-#else
194-#undef __textdomain
195-#undef __bindtextdomain
196-#define __textdomain(D) ((void)0)
197-#define __bindtextdomain(D,P) ((void)0)
198+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
199+#undef textdomain
200+#undef bindtextdomain
201+#define textdomain(D) ((void)0)
202+#define bindtextdomain(D,P) ((void)0)
203 #endif
204
205 // Non-virtual member functions.
206@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const
207 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
208 const char* __dir) const
209 {
210- __bindtextdomain(__s.c_str(), __dir);
211+ bindtextdomain(__s.c_str(), __dir);
212 return this->do_open(__s, __loc);
213 }
214
215@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const
216 {
217 // No error checking is done, assume the catalog exists and can
218 // be used.
219- __textdomain(__s.c_str());
220+ textdomain(__s.c_str());
221 return 0;
222 }
223
224Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
225===================================================================
226--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
227+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
228@@ -68,6 +68,7 @@ namespace __gnu_cxx
229 {
230 extern "C" __typeof(uselocale) __uselocale;
231 }
232+#define __uselocale uselocale
233 #endif
234
235 namespace std
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch b/meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000000..896d2a57c7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/204-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,54 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
7@@ -401,7 +401,7 @@ namespace std
8 # ifdef __UCLIBC_HAS_XLOCALE__
9 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
10 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
11-# else
12+# elif defined __UCLIBC_HAS_LOCALE__
13 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
14 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
15 # endif
16@@ -556,7 +556,7 @@ namespace std
17 # ifdef __UCLIBC_HAS_XLOCALE__
18 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
19 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
20-# else
21+# elif defined __UCLIBC_HAS_LOCALE__
22 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
23 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
24 # endif
25Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
26===================================================================
27--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
28+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
29@@ -127,12 +127,25 @@ namespace std
30 {
31 // Named locale.
32 // NB: In the GNU model wchar_t is always 32 bit wide.
33+#ifdef __UCLIBC_MJN3_ONLY__
34+#warning fix this... should be numeric
35+#endif
36+#ifdef __UCLIBC__
37+# ifdef __UCLIBC_HAS_XLOCALE__
38+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
39+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
40+# elif defined __UCLIBC_HAS_LOCALE__
41+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
42+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
43+# endif
44+#else
45 union { char *__s; wchar_t __w; } __u;
46 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
47 _M_data->_M_decimal_point = __u.__w;
48
49 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
50 _M_data->_M_thousands_sep = __u.__w;
51+#endif
52
53 if (_M_data->_M_thousands_sep == L'\0')
54 _M_data->_M_grouping = "";
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch b/meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch
new file mode 100644
index 0000000000..743017b4d3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/205-uclibc-locale-update.patch
@@ -0,0 +1,521 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
7@@ -39,23 +39,20 @@
8 #include <langinfo.h>
9 #include <bits/c++locale_internal.h>
10
11-namespace std
12-{
13+_GLIBCXX_BEGIN_NAMESPACE(std)
14+
15 template<>
16 void
17 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
18 const __c_locale& __cloc)
19 {
20- if (!(__err & ios_base::failbit))
21- {
22- char* __sanity;
23- errno = 0;
24- float __f = __strtof_l(__s, &__sanity, __cloc);
25- if (__sanity != __s && errno != ERANGE)
26- __v = __f;
27- else
28- __err |= ios_base::failbit;
29- }
30+ char* __sanity;
31+ errno = 0;
32+ float __f = __strtof_l(__s, &__sanity, __cloc);
33+ if (__sanity != __s && errno != ERANGE)
34+ __v = __f;
35+ else
36+ __err |= ios_base::failbit;
37 }
38
39 template<>
40@@ -63,16 +60,13 @@ namespace std
41 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
42 const __c_locale& __cloc)
43 {
44- if (!(__err & ios_base::failbit))
45- {
46- char* __sanity;
47- errno = 0;
48- double __d = __strtod_l(__s, &__sanity, __cloc);
49- if (__sanity != __s && errno != ERANGE)
50- __v = __d;
51- else
52- __err |= ios_base::failbit;
53- }
54+ char* __sanity;
55+ errno = 0;
56+ double __d = __strtod_l(__s, &__sanity, __cloc);
57+ if (__sanity != __s && errno != ERANGE)
58+ __v = __d;
59+ else
60+ __err |= ios_base::failbit;
61 }
62
63 template<>
64@@ -80,16 +74,13 @@ namespace std
65 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
66 const __c_locale& __cloc)
67 {
68- if (!(__err & ios_base::failbit))
69- {
70- char* __sanity;
71- errno = 0;
72- long double __ld = __strtold_l(__s, &__sanity, __cloc);
73- if (__sanity != __s && errno != ERANGE)
74- __v = __ld;
75- else
76- __err |= ios_base::failbit;
77- }
78+ char* __sanity;
79+ errno = 0;
80+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
81+ if (__sanity != __s && errno != ERANGE)
82+ __v = __ld;
83+ else
84+ __err |= ios_base::failbit;
85 }
86
87 void
88@@ -110,17 +101,18 @@ namespace std
89 void
90 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
91 {
92- if (_S_get_c_locale() != __cloc)
93+ if (__cloc && _S_get_c_locale() != __cloc)
94 __freelocale(__cloc);
95 }
96
97 __c_locale
98 locale::facet::_S_clone_c_locale(__c_locale& __cloc)
99 { return __duplocale(__cloc); }
100-} // namespace std
101
102-namespace __gnu_cxx
103-{
104+_GLIBCXX_END_NAMESPACE
105+
106+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
107+
108 const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
109 {
110 "LC_CTYPE",
111@@ -138,9 +130,11 @@ namespace __gnu_cxx
112 "LC_IDENTIFICATION"
113 #endif
114 };
115-}
116
117-namespace std
118-{
119+_GLIBCXX_END_NAMESPACE
120+
121+_GLIBCXX_BEGIN_NAMESPACE(std)
122+
123 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
124-} // namespace std
125+
126+_GLIBCXX_END_NAMESPACE
127Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
128===================================================================
129--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
130+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
131@@ -33,16 +33,20 @@
132
133 // Written by Benjamin Kosnik <bkoz@redhat.com>
134
135+#include <features.h>
136+#ifdef __UCLIBC_HAS_LOCALE__
137 #define _LIBC
138 #include <locale>
139 #undef _LIBC
140+#else
141+#include <locale>
142+#endif
143 #include <bits/c++locale_internal.h>
144
145-namespace std
146-{
147+_GLIBCXX_BEGIN_NAMESPACE(std)
148+
149 // NB: The other ctype<char> specializations are in src/locale.cc and
150 // various /config/os/* files.
151- template<>
152 ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
153 : ctype<char>(0, false, __refs)
154 {
155@@ -57,6 +61,8 @@ namespace std
156 #endif
157 }
158 }
159+ ctype_byname<char>::~ctype_byname()
160+ { }
161
162 #ifdef _GLIBCXX_USE_WCHAR_T
163 ctype<wchar_t>::__wmask_type
164@@ -138,17 +144,33 @@ namespace std
165 ctype<wchar_t>::
166 do_is(mask __m, wchar_t __c) const
167 {
168- // Highest bitmask in ctype_base == 10, but extra in "C"
169- // library for blank.
170+ // The case of __m == ctype_base::space is particularly important,
171+ // due to its use in many istream functions. Therefore we deal with
172+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
173+ // is the mask corresponding to ctype_base::space. NB: an encoding
174+ // change would not affect correctness!
175+
176 bool __ret = false;
177- const size_t __bitmasksize = 11;
178- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
179- if (__m & _M_bit[__bitcur]
180- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
181- {
182- __ret = true;
183- break;
184- }
185+ if (__m == _M_bit[5])
186+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
187+ else
188+ {
189+ // Highest bitmask in ctype_base == 10, but extra in "C"
190+ // library for blank.
191+ const size_t __bitmasksize = 11;
192+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
193+ if (__m & _M_bit[__bitcur])
194+ {
195+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
196+ {
197+ __ret = true;
198+ break;
199+ }
200+ else if (__m == _M_bit[__bitcur])
201+ break;
202+ }
203+ }
204+
205 return __ret;
206 }
207
208@@ -290,4 +312,5 @@ namespace std
209 #endif
210 }
211 #endif // _GLIBCXX_USE_WCHAR_T
212-}
213+
214+_GLIBCXX_END_NAMESPACE
215Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
216===================================================================
217--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
218+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
219@@ -53,12 +53,16 @@
220 template<typename _CharT>
221 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
222 size_t __refs)
223- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
224- _M_name_messages(__s)
225+ : facet(__refs), _M_c_locale_messages(NULL),
226+ _M_name_messages(NULL)
227 {
228- char* __tmp = new char[std::strlen(__s) + 1];
229- std::strcpy(__tmp, __s);
230+ const size_t __len = std::strlen(__s) + 1;
231+ char* __tmp = new char[__len];
232+ std::memcpy(__tmp, __s, __len);
233 _M_name_messages = __tmp;
234+
235+ // Last to avoid leaking memory if new throws.
236+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
237 }
238
239 template<typename _CharT>
240Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
241===================================================================
242--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
243+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
244@@ -33,9 +33,14 @@
245
246 // Written by Benjamin Kosnik <bkoz@redhat.com>
247
248+#include <features.h>
249+#ifdef __UCLIBC_HAS_LOCALE__
250 #define _LIBC
251 #include <locale>
252 #undef _LIBC
253+#else
254+#include <locale>
255+#endif
256 #include <bits/c++locale_internal.h>
257
258 #ifdef __UCLIBC_MJN3_ONLY__
259@@ -206,7 +211,7 @@ namespace std
260 }
261 break;
262 default:
263- ;
264+ __ret = pattern();
265 }
266 return __ret;
267 }
268@@ -390,7 +395,9 @@ namespace std
269 __c_locale __old = __uselocale(__cloc);
270 #else
271 // Switch to named locale so that mbsrtowcs will work.
272- char* __old = strdup(setlocale(LC_ALL, NULL));
273+ char* __old = setlocale(LC_ALL, NULL);
274+ const size_t __llen = strlen(__old) + 1;
275+ char* __sav = new char[__llen];
276 setlocale(LC_ALL, __name);
277 #endif
278
279@@ -477,8 +484,8 @@ namespace std
280 #ifdef __UCLIBC_HAS_XLOCALE__
281 __uselocale(__old);
282 #else
283- setlocale(LC_ALL, __old);
284- free(__old);
285+ setlocale(LC_ALL, __sav);
286+ delete [] __sav;
287 #endif
288 __throw_exception_again;
289 }
290@@ -498,8 +505,8 @@ namespace std
291 #ifdef __UCLIBC_HAS_XLOCALE__
292 __uselocale(__old);
293 #else
294- setlocale(LC_ALL, __old);
295- free(__old);
296+ setlocale(LC_ALL, __sav);
297+ delete [] __sav;
298 #endif
299 }
300 }
301@@ -545,8 +552,11 @@ namespace std
302 __c_locale __old = __uselocale(__cloc);
303 #else
304 // Switch to named locale so that mbsrtowcs will work.
305- char* __old = strdup(setlocale(LC_ALL, NULL));
306- setlocale(LC_ALL, __name);
307+ char* __old = setlocale(LC_ALL, NULL);
308+ const size_t __llen = strlen(__old) + 1;
309+ char* __sav = new char[__llen];
310+ memcpy(__sav, __old, __llen);
311+ setlocale(LC_ALL, __name);
312 #endif
313
314 #ifdef __UCLIBC_MJN3_ONLY__
315@@ -633,8 +643,8 @@ namespace std
316 #ifdef __UCLIBC_HAS_XLOCALE__
317 __uselocale(__old);
318 #else
319- setlocale(LC_ALL, __old);
320- free(__old);
321+ setlocale(LC_ALL, __sav);
322+ delete [] __sav;
323 #endif
324 __throw_exception_again;
325 }
326@@ -653,8 +663,8 @@ namespace std
327 #ifdef __UCLIBC_HAS_XLOCALE__
328 __uselocale(__old);
329 #else
330- setlocale(LC_ALL, __old);
331- free(__old);
332+ setlocale(LC_ALL, __sav);
333+ delete [] __sav;
334 #endif
335 }
336 }
337Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
338===================================================================
339--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
340+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
341@@ -33,9 +33,14 @@
342
343 // Written by Benjamin Kosnik <bkoz@redhat.com>
344
345+#include <features.h>
346+#ifdef __UCLIBC_HAS_LOCALE__
347 #define _LIBC
348 #include <locale>
349 #undef _LIBC
350+#else
351+#include <locale>
352+#endif
353 #include <bits/c++locale_internal.h>
354
355 #ifdef __UCLIBC_MJN3_ONLY__
356Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
357===================================================================
358--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
359+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
360@@ -50,12 +50,21 @@
361 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
362 size_t __refs)
363 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
364- _M_name_timepunct(__s)
365+ _M_name_timepunct(NULL)
366 {
367- char* __tmp = new char[std::strlen(__s) + 1];
368- std::strcpy(__tmp, __s);
369+ const size_t __len = std::strlen(__s) + 1;
370+ char* __tmp = new char[__len];
371+ std::memcpy(__tmp, __s, __len);
372 _M_name_timepunct = __tmp;
373- _M_initialize_timepunct(__cloc);
374+
375+ try
376+ { _M_initialize_timepunct(__cloc); }
377+ catch(...)
378+ {
379+ delete [] _M_name_timepunct;
380+ __throw_exception_again;
381+ }
382+
383 }
384
385 template<typename _CharT>
386Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
387===================================================================
388--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
389+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
390@@ -39,21 +39,23 @@
391 #pragma GCC system_header
392
393 #include <cstring> // get std::strlen
394-#include <cstdio> // get std::snprintf or std::sprintf
395+#include <cstdio> // get std::vsnprintf or std::vsprintf
396 #include <clocale>
397 #include <langinfo.h> // For codecvt
398 #ifdef __UCLIBC_MJN3_ONLY__
399 #warning fix this
400 #endif
401-#ifdef __UCLIBC_HAS_LOCALE__
402+#ifdef _GLIBCXX_USE_ICONV
403 #include <iconv.h> // For codecvt using iconv, iconv_t
404 #endif
405-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
406-#include <libintl.h> // For messages
407+#ifdef HAVE_LIBINTL_H
408+#include <libintl.h> // For messages
409 #endif
410+#include <cstdarg>
411
412 #ifdef __UCLIBC_MJN3_ONLY__
413 #warning what is _GLIBCXX_C_LOCALE_GNU for
414+// psm: used in os/gnu-linux/ctype_noninline.h
415 #endif
416 #define _GLIBCXX_C_LOCALE_GNU 1
417
418@@ -78,23 +80,25 @@ namespace std
419 #else
420 typedef int* __c_locale;
421 #endif
422-
423- // Convert numeric value of type _Tv to string and return length of
424- // string. If snprintf is available use it, otherwise fall back to
425- // the unsafe sprintf which, in general, can be dangerous and should
426+ // Convert numeric value of type double to string and return length of
427+ // string. If vsnprintf is available use it, otherwise fall back to
428+ // the unsafe vsprintf which, in general, can be dangerous and should
429 // be avoided.
430- template<typename _Tv>
431- int
432- __convert_from_v(char* __out,
433- const int __size __attribute__ ((__unused__)),
434- const char* __fmt,
435-#ifdef __UCLIBC_HAS_XCLOCALE__
436- _Tv __v, const __c_locale& __cloc, int __prec)
437+ inline int
438+ __convert_from_v(const __c_locale&
439+#ifndef __UCLIBC_HAS_XCLOCALE__
440+ __cloc __attribute__ ((__unused__))
441+#endif
442+ ,
443+ char* __out,
444+ const int __size,
445+ const char* __fmt, ...)
446 {
447+ va_list __args;
448+#ifdef __UCLIBC_HAS_XCLOCALE__
449+
450 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
451 #else
452- _Tv __v, const __c_locale&, int __prec)
453- {
454 # ifdef __UCLIBC_HAS_LOCALE__
455 char* __old = std::setlocale(LC_ALL, NULL);
456 char* __sav = new char[std::strlen(__old) + 1];
457@@ -103,7 +107,9 @@ namespace std
458 # endif
459 #endif
460
461- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
462+ va_start(__args, __fmt);
463+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
464+ va_end(__args);
465
466 #ifdef __UCLIBC_HAS_XCLOCALE__
467 __gnu_cxx::__uselocale(__old);
468Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
469===================================================================
470--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
471+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
472@@ -53,11 +53,14 @@ namespace std
473 const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
474 _M_c_locale_timepunct);
475 #else
476- char* __old = strdup(setlocale(LC_ALL, NULL));
477+ char* __old = setlocale(LC_ALL, NULL);
478+ const size_t __llen = strlen(__old) + 1;
479+ char* __sav = new char[__llen];
480+ memcpy(__sav, __old, __llen);
481 setlocale(LC_ALL, _M_name_timepunct);
482 const size_t __len = strftime(__s, __maxlen, __format, __tm);
483- setlocale(LC_ALL, __old);
484- free(__old);
485+ setlocale(LC_ALL, __sav);
486+ delete [] __sav;
487 #endif
488 // Make sure __s is null terminated.
489 if (__len == 0)
490@@ -207,11 +210,14 @@ namespace std
491 const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
492 _M_c_locale_timepunct);
493 #else
494- char* __old = strdup(setlocale(LC_ALL, NULL));
495+ char* __old = setlocale(LC_ALL, NULL);
496+ const size_t __llen = strlen(__old) + 1;
497+ char* __sav = new char[__llen];
498+ memcpy(__sav, __old, __llen);
499 setlocale(LC_ALL, _M_name_timepunct);
500 const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
501- setlocale(LC_ALL, __old);
502- free(__old);
503+ setlocale(LC_ALL, __sav);
504+ delete [] __sav;
505 #endif
506 // Make sure __s is null terminated.
507 if (__len == 0)
508Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
509===================================================================
510--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
511+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
512@@ -31,6 +31,9 @@
513
514 #include <bits/c++config.h>
515 #include <clocale>
516+#include <cstdlib>
517+#include <cstring>
518+#include <cstddef>
519
520 #ifdef __UCLIBC_MJN3_ONLY__
521 #warning clean this up
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch b/meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch
new file mode 100644
index 0000000000..9589822b8d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/301-missing-execinfo_h.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/boehm-gc/include/gc.h
4===================================================================
5--- gcc-4.6.0.orig/boehm-gc/include/gc.h
6+++ gcc-4.6.0/boehm-gc/include/gc.h
7@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
8 #if defined(__linux__) || defined(__GLIBC__)
9 # include <features.h>
10 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
11- && !defined(__ia64__)
12+ && !defined(__ia64__) && !defined(__UCLIBC__)
13 # ifndef GC_HAVE_BUILTIN_BACKTRACE
14 # define GC_HAVE_BUILTIN_BACKTRACE
15 # endif
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch
new file mode 100644
index 0000000000..9becc15e11
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/302-c99-snprintf.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Pending
2
3Index: gcc-4_7-branch/libstdc++-v3/include/c_std/cstdio
4===================================================================
5--- gcc-4_7-branch.orig/libstdc++-v3/include/c_std/cstdio 2012-04-10 10:19:49.603337089 -0700
6+++ gcc-4_7-branch/libstdc++-v3/include/c_std/cstdio 2012-04-10 10:30:59.863369565 -0700
7@@ -140,7 +140,7 @@
8 using ::vsprintf;
9 } // namespace std
10
11-#if _GLIBCXX_USE_C99
12+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
13
14 #undef snprintf
15 #undef vfscanf
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch b/meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000000..d69c54696a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/303-c99-complex-ugly-hack.patch
@@ -0,0 +1,16 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: gcc-4_7-branch/libstdc++-v3/configure
4===================================================================
5--- gcc-4_7-branch.orig/libstdc++-v3/configure 2012-04-10 10:30:37.347368481 -0700
6+++ gcc-4_7-branch/libstdc++-v3/configure 2012-04-10 10:31:22.787370652 -0700
7@@ -18767,6 +18767,9 @@
8 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9 /* end confdefs.h. */
10 #include <complex.h>
11+#ifdef __UCLIBC__
12+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
13+#endif
14 int
15 main ()
16 {
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch b/meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch
new file mode 100644
index 0000000000..f103765233
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/304-index_macro.patch
@@ -0,0 +1,30 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/include/ext/rope
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/include/ext/rope
6+++ gcc-4.6.0/libstdc++-v3/include/ext/rope
7@@ -54,6 +54,9 @@
8 #include <bits/gthr.h>
9 #include <tr1/functional>
10
11+/* cope w/ index defined as macro, SuSv3 proposal */
12+#undef index
13+
14 # ifdef __GC
15 # define __GC_CONST const
16 # else
17Index: gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
18===================================================================
19--- gcc-4.6.0.orig/libstdc++-v3/include/ext/ropeimpl.h
20+++ gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
21@@ -49,6 +49,9 @@
22 #include <ext/memory> // For uninitialized_copy_n
23 #include <ext/numeric> // For power
24
25+/* cope w/ index defined as macro, SuSv3 proposal */
26+#undef index
27+
28 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
29 {
30 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch b/meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000000..10d09a7fb9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/305-libmudflap-susv3-legacy.patch
@@ -0,0 +1,51 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: gcc-4_7-branch/libmudflap/mf-hooks2.c
4===================================================================
5--- gcc-4_7-branch.orig/libmudflap/mf-hooks2.c 2012-04-10 10:19:49.391337079 -0700
6+++ gcc-4_7-branch/libmudflap/mf-hooks2.c 2012-04-10 10:31:53.191372119 -0700
7@@ -424,7 +424,7 @@
8 {
9 TRACE ("%s\n", __PRETTY_FUNCTION__);
10 MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
11- bzero (s, n);
12+ memset (s, 0, n);
13 }
14
15
16@@ -434,7 +434,7 @@
17 TRACE ("%s\n", __PRETTY_FUNCTION__);
18 MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
19 MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
20- bcopy (src, dest, n);
21+ memmove (dest, src, n);
22 }
23
24
25@@ -444,7 +444,7 @@
26 TRACE ("%s\n", __PRETTY_FUNCTION__);
27 MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
28 MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
29- return bcmp (s1, s2, n);
30+ return n == 0 ? 0 : memcmp (s1, s2, n);
31 }
32
33
34@@ -453,7 +453,7 @@
35 size_t n = strlen (s);
36 TRACE ("%s\n", __PRETTY_FUNCTION__);
37 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
38- return index (s, c);
39+ return strchr (s, c);
40 }
41
42
43@@ -462,7 +462,7 @@
44 size_t n = strlen (s);
45 TRACE ("%s\n", __PRETTY_FUNCTION__);
46 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
47- return rindex (s, c);
48+ return strrchr (s, c);
49 }
50
51 /* XXX: stpcpy, memccpy */
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch b/meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch
new file mode 100644
index 0000000000..e99bf9602d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/306-libstdc++-namespace.patch
@@ -0,0 +1,40 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
6+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
7@@ -32,7 +32,8 @@
8 //
9
10 // Written by Benjamin Kosnik <bkoz@redhat.com>
11-
12+namespace std
13+{
14 #ifdef __UCLIBC_MJN3_ONLY__
15 #warning fix prototypes for *textdomain funcs
16 #endif
17@@ -116,3 +117,4 @@
18 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
19 }
20 }
21+}
22Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
23===================================================================
24--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
25+++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
26@@ -33,7 +33,8 @@
27 //
28
29 // Written by Benjamin Kosnik <bkoz@redhat.com>
30-
31+namespace std
32+{
33 template<typename _CharT>
34 __timepunct<_CharT>::__timepunct(size_t __refs)
35 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
36@@ -75,3 +76,4 @@
37 delete _M_data;
38 _S_destroy_c_locale(_M_c_locale_timepunct);
39 }
40+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch b/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
new file mode 100644
index 0000000000..f47566951b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
@@ -0,0 +1,63 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3GCC has internal multilib handling code but it assumes a very specific rigid directory
4layout. The build system implementation of multilib layout is very generic and allows
5complete customisation of the library directories.
6
7This patch is a partial solution to allow any custom directories to be passed into gcc
8and handled correctly. It forces gcc to use the base_libdir (which is the current
9directory, "."). We need to do this for each multilib that is configured as we don't
10know which compiler options may be being passed into the compiler. Since we have a compiler
11per mulitlib at this point that isn't an issue.
12
13The one problem is the target compiler is only going to work for the default multlilib at
14this point. Ideally we'd figure out which multilibs were being enabled with which paths
15and be able to patch these entries with a complete set of correct paths but this we
16don't have such code at this point. This is something the target gcc recipe should do
17and override these platform defaults in its build config.
18
19RP 15/8/11
20
21Index: trunk/gcc/config/i386/t-linux64
22===================================================================
23--- trunk.orig/gcc/config/i386/t-linux64 2012-02-22 09:44:48.000000000 -0800
24+++ trunk/gcc/config/i386/t-linux64 2012-02-22 12:31:01.836462957 -0800
25@@ -33,7 +33,6 @@
26 #
27 comma=,
28 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
29-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
30-MULTILIB_OSDIRNAMES = m64=../lib64
31-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
32-MULTILIB_OSDIRNAMES+= mx32=../libx32
33+MULTILIB_DIRNAMES = . .
34+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
35+
36Index: trunk/gcc/config/mips/t-linux64
37===================================================================
38--- trunk.orig/gcc/config/mips/t-linux64 2012-02-22 09:44:58.000000000 -0800
39+++ trunk/gcc/config/mips/t-linux64 2012-02-22 12:32:01.132465823 -0800
40@@ -17,5 +17,5 @@
41 # <http://www.gnu.org/licenses/>.
42
43 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
44-MULTILIB_DIRNAMES = n32 32 64
45-MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
46+MULTILIB_DIRNAMES = . . .
47+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
48Index: trunk/gcc/config/rs6000/t-linux64
49===================================================================
50--- trunk.orig/gcc/config/rs6000/t-linux64 2012-02-22 09:44:54.000000000 -0800
51+++ trunk/gcc/config/rs6000/t-linux64 2012-02-22 12:28:17.960454968 -0800
52@@ -27,9 +27,9 @@
53 # MULTILIB_OSDIRNAMES according to what is found on the target.
54
55 MULTILIB_OPTIONS = m64/m32 msoft-float
56-MULTILIB_DIRNAMES = 64 32 nof
57+MULTILIB_DIRNAMES = . . .
58 MULTILIB_EXTRA_OPTS = fPIC mstrict-align
59 MULTILIB_EXCEPTIONS = m64/msoft-float
60 MULTILIB_EXCLUSIONS = m64/!m32/msoft-float
61-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
62+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
63 MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT)
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch b/meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch
new file mode 100644
index 0000000000..1406f87f1c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/740-sh-pr24836.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Pending
2
3http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
4http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
5
6Index: gcc-4_7-branch/gcc/configure.ac
7===================================================================
8--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:22:05.787343661 -0700
9+++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:32:18.415373343 -0700
10@@ -3065,7 +3065,7 @@
11 tls_first_minor=14
12 tls_as_opt="-m64 -Aesame --fatal-warnings"
13 ;;
14- sh-*-* | sh[34]-*-*)
15+ sh-*-* | sh[34]*-*-*)
16 conftest_s='
17 .section ".tdata","awT",@progbits
18 foo: .long 25
19Index: gcc-4_7-branch/gcc/configure
20===================================================================
21--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:22:05.803343691 -0700
22+++ gcc-4_7-branch/gcc/configure 2012-04-10 10:32:18.419373328 -0700
23@@ -23481,7 +23481,7 @@
24 tls_first_minor=14
25 tls_as_opt="-m64 -Aesame --fatal-warnings"
26 ;;
27- sh-*-* | sh[34]-*-*)
28+ sh-*-* | sh[34]*-*-*)
29 conftest_s='
30 .section ".tdata","awT",@progbits
31 foo: .long 25
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch b/meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch
new file mode 100644
index 0000000000..ac301bd844
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/800-arm-bigendian.patch
@@ -0,0 +1,36 @@
1Upstream-Status: Pending
2
3By Lennert Buytenhek <buytenh@wantstofly.org>
4Adds support for arm*b-linux* big-endian ARM targets
5
6See http://gcc.gnu.org/PR16350
7
8Index: gcc-4_7-branch/gcc/config/arm/linux-elf.h
9===================================================================
10--- gcc-4_7-branch.orig/gcc/config/arm/linux-elf.h 2012-04-10 10:19:49.171337068 -0700
11+++ gcc-4_7-branch/gcc/config/arm/linux-elf.h 2012-04-10 10:32:36.819374226 -0700
12@@ -48,7 +48,7 @@
13
14 #undef MULTILIB_DEFAULTS
15 #define MULTILIB_DEFAULTS \
16- { "marm", "mlittle-endian", "mfloat-abi=hard", "mno-thumb-interwork" }
17+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=hard", "mno-thumb-interwork" }
18
19 /* Now we define the strings used to build the spec file. */
20 #undef LIB_SPEC
21Index: gcc-4_7-branch/gcc/config.gcc
22===================================================================
23--- gcc-4_7-branch.orig/gcc/config.gcc 2012-04-10 10:19:49.159337069 -0700
24+++ gcc-4_7-branch/gcc/config.gcc 2012-04-10 10:32:36.823374222 -0700
25@@ -842,6 +842,11 @@
26 esac
27 tmake_file="${tmake_file} arm/t-arm"
28 case ${target} in
29+ arm*b-*)
30+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
31+ ;;
32+ esac
33+ case ${target} in
34 arm*-*-linux-*eabi)
35 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
36 tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000000..f5982983f2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,25 @@
1Upstream-Status: Pending
2
3#This patck added --sysroot into COLLECT_GCC_OPTIONS which is used to
4#invoke collect2.
5
6Index: gcc-4_7-branch/gcc/gcc.c
7===================================================================
8--- gcc-4_7-branch.orig/gcc/gcc.c 2012-04-10 10:37:49.487389409 -0700
9+++ gcc-4_7-branch/gcc/gcc.c 2012-04-10 10:38:50.831392259 -0700
10@@ -3995,6 +3995,15 @@
11 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
12
13 first_time = TRUE;
14+#ifdef HAVE_LD_SYSROOT
15+ if (target_system_root_changed && target_system_root)
16+ {
17+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
18+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
19+ obstack_grow (&collect_obstack, "'", 1);
20+ first_time = FALSE;
21+ }
22+#endif
23 for (i = 0; (int) i < n_switches; i++)
24 {
25 const char *const *args;
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch
new file mode 100644
index 0000000000..38c361e085
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch
@@ -0,0 +1,165 @@
1This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
2relative to SYSTEMLIBS_DIR which can be set in generated headers
3This breaks the assumption of hardcoded multilib in gcc
4Change is only for the supported architectures in OE including
5SH, spart, alpha for possible future support (if any)
6
7Removes the do_headerfix task in metadata
8
9Signed-off-by: Khem Raj
10Upstream-Status: Inappropriate [OE configuration]
11
12Index: git/gcc/config/alpha/linux-elf.h
13===================================================================
14--- git.orig/gcc/config/alpha/linux-elf.h 2012-07-08 11:16:26.199320624 -0700
15+++ git/gcc/config/alpha/linux-elf.h 2012-07-08 11:19:51.059330624 -0700
16@@ -24,8 +24,8 @@
17 #define EXTRA_SPECS \
18 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
19
20-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
21-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
22+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
23+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
24 #if DEFAULT_LIBC == LIBC_UCLIBC
25 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
26 #elif DEFAULT_LIBC == LIBC_GLIBC
27Index: git/gcc/config/arm/linux-eabi.h
28===================================================================
29--- git.orig/gcc/config/arm/linux-eabi.h 2012-07-08 11:16:26.000000000 -0700
30+++ git/gcc/config/arm/linux-eabi.h 2012-07-08 11:20:40.947333288 -0700
31@@ -62,7 +62,7 @@
32 /* Use ld-linux.so.3 so that it will be possible to run "classic"
33 GNU/Linux binaries on an EABI system. */
34 #undef GLIBC_DYNAMIC_LINKER
35-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
36+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.3"
37
38 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
39 use the GNU/Linux version, not the generic BPABI version. */
40Index: git/gcc/config/arm/linux-elf.h
41===================================================================
42--- git.orig/gcc/config/arm/linux-elf.h 2012-07-08 11:16:31.903320900 -0700
43+++ git/gcc/config/arm/linux-elf.h 2012-07-08 11:21:37.619335646 -0700
44@@ -59,7 +59,7 @@
45
46 #define LIBGCC_SPEC "-lgcc"
47
48-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
49+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
50
51 #define LINUX_TARGET_LINK_SPEC "%{h*} \
52 %{static:-Bstatic} \
53Index: git/gcc/config/i386/linux.h
54===================================================================
55--- git.orig/gcc/config/i386/linux.h 2012-07-08 11:16:26.267320627 -0700
56+++ git/gcc/config/i386/linux.h 2012-07-08 11:23:26.727340361 -0700
57@@ -21,4 +21,4 @@
58 <http://www.gnu.org/licenses/>. */
59
60 #define GNU_USER_LINK_EMULATION "elf_i386"
61-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
62+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
63Index: git/gcc/config/i386/linux64.h
64===================================================================
65--- git.orig/gcc/config/i386/linux64.h 2012-07-08 11:16:26.267320627 -0700
66+++ git/gcc/config/i386/linux64.h 2012-07-08 11:23:13.255340316 -0700
67@@ -28,6 +28,6 @@
68 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
69 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
70
71-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
72-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
73-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
74+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
75+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
76+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
77Index: git/gcc/config/mips/linux.h
78===================================================================
79--- git.orig/gcc/config/mips/linux.h 2012-07-08 11:16:26.307320629 -0700
80+++ git/gcc/config/mips/linux.h 2012-07-08 11:23:56.063342214 -0700
81@@ -18,4 +18,4 @@
82 along with GCC; see the file COPYING3. If not see
83 <http://www.gnu.org/licenses/>. */
84
85-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
86+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
87Index: git/gcc/config/mips/linux64.h
88===================================================================
89--- git.orig/gcc/config/mips/linux64.h 2012-07-08 11:16:26.307320629 -0700
90+++ git/gcc/config/mips/linux64.h 2012-07-08 11:24:52.207345073 -0700
91@@ -23,10 +23,10 @@
92 #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
93 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
94
95-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
96-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
97-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
98-#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
99+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
100+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld.so.1"
101+#define GLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld.so.1"
102+#define UCLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
103 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
104 #define GNU_USER_DYNAMIC_LINKERN32 \
105 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
106Index: git/gcc/config/rs6000/linux64.h
107===================================================================
108--- git.orig/gcc/config/rs6000/linux64.h 2012-07-08 11:16:26.335320630 -0700
109+++ git/gcc/config/rs6000/linux64.h 2012-07-08 11:26:05.867348369 -0700
110@@ -358,10 +358,10 @@
111 #undef LINK_OS_DEFAULT_SPEC
112 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
113
114-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
115-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
116-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
117-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
118+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
119+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
120+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
121+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
122 #if DEFAULT_LIBC == LIBC_UCLIBC
123 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
124 #elif DEFAULT_LIBC == LIBC_GLIBC
125Index: git/gcc/config/sh/linux.h
126===================================================================
127--- git.orig/gcc/config/sh/linux.h 2012-07-08 11:16:26.363320632 -0700
128+++ git/gcc/config/sh/linux.h 2012-07-08 11:26:29.375350165 -0700
129@@ -45,7 +45,7 @@
130
131 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
132
133-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
134+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
135
136 #undef SUBTARGET_LINK_EMUL_SUFFIX
137 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
138Index: git/gcc/config/sparc/linux.h
139===================================================================
140--- git.orig/gcc/config/sparc/linux.h 2012-07-08 11:16:26.371320632 -0700
141+++ git/gcc/config/sparc/linux.h 2012-07-08 11:27:00.439351163 -0700
142@@ -84,7 +84,7 @@
143 When the -shared link option is used a final link is not being
144 done. */
145
146-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
147+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
148
149 #undef LINK_SPEC
150 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
151Index: git/gcc/config/sparc/linux64.h
152===================================================================
153--- git.orig/gcc/config/sparc/linux64.h 2012-07-08 11:16:26.371320632 -0700
154+++ git/gcc/config/sparc/linux64.h 2012-07-08 11:27:23.571352396 -0700
155@@ -93,8 +93,8 @@
156 When the -shared link option is used a final link is not being
157 done. */
158
159-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
160-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
161+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
162+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
163
164 #ifdef SPARC_BI_ARCH
165
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/add-install-ptest-to-Makefile.patch b/meta/recipes-devtools/gcc/gcc-4.7/add-install-ptest-to-Makefile.patch
new file mode 100644
index 0000000000..3dedde50db
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/add-install-ptest-to-Makefile.patch
@@ -0,0 +1,162 @@
1Add 'install-ptest' rule.
2
3Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
4Upstream-status: Pending
5---
6diff -uNr a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
7--- a/libstdc++-v3/Makefile.in 2013-07-01 13:01:43.659958328 +0200
8+++ b/libstdc++-v3/Makefile.in 2013-08-23 13:22:41.962029555 +0200
9@@ -710,6 +710,26 @@
10 dvi:
11 install-dvi:
12
13+spath=$(subst /,\/,$(SOURCE_DIR))
14+bpath=$(subst /,\/,$(BUILD_DIR))
15+rpath=$(subst /,\/,$(REPLACE_DIR))
16+install-ptest:
17+ mkdir -p $(DEST_DIR)/gcc/testsuite
18+ mkdir -p $(DEST_DIR)/libstdc++-v3
19+ mkdir -p $(DEST_DIR)/contrib
20+ cp -r $(SOURCE_DIR)/libstdc++-v3/testsuite $(DEST_DIR)/libstdc++-v3
21+ cp $(SOURCE_DIR)/contrib/dg-extract-results.sh $(DEST_DIR)/contrib
22+ cp $(SOURCE_DIR)/gcc/BASE-VER $(DEST_DIR)/gcc
23+ cp -r $(SOURCE_DIR)/gcc/testsuite/lib $(DEST_DIR)/gcc/testsuite
24+ cp -r $(SOURCE_DIR)/libstdc++-v3/scripts $(DEST_DIR)/libstdc++-v3
25+ cp $(BUILD_DIR)/libstdc++-v3/scripts/* $(DEST_DIR)/libstdc++-v3/scripts
26+ cp $(BUILD_DIR)/libstdc++-v3/testsuite/Makefile $(DEST_DIR)/libstdc++-v3/testsuite
27+ cp $(BUILD_DIR)/libstdc++-v3/Makefile $(DEST_DIR)/libstdc++-v3
28+ sed -i -e 's|^Makefile:|_Makefile:|' $(DEST_DIR)/libstdc++-v3/testsuite/Makefile
29+ sed -i -e "s/$(spath)/$(rpath)/g" -e "s/$(bpath)/$(rpath)/g" $(DEST_DIR)/libstdc++-v3/testsuite/Makefile
30+ sed -i -e "s/$(spath)/$(rpath)/g" -e "s/$(bpath)/$(rpath)/g" $(DEST_DIR)/libstdc++-v3/Makefile
31+ sed -i -e 's/RUNTESTDEFAULTFLAGS.=/RUNTESTDEFAULTFLAGS =-a/g' ${DEST_DIR}/libstdc++-v3/testsuite/Makefile
32+
33 # All the machinations with string instantiations messes up the
34 # automake-generated TAGS rule. Make a simple one here.
35 TAGS: tags-recursive $(LISP)
36diff -uNr a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
37--- a/libstdc++-v3/testsuite/Makefile.in 2013-07-05 16:06:08.995480821 +0200
38+++ b/libstdc++-v3/testsuite/Makefile.in 2013-08-26 08:50:04.698546942 +0200
39@@ -478,6 +478,8 @@
40 maintainer-clean-generic mostlyclean mostlyclean-generic \
41 mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
42
43+buildtest-TESTS:
44+ -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) buildtest.exp
45
46 # This rule generates all of the testsuite_files* lists at once.
47 ${lists_of_files}:
48@@ -545,7 +547,7 @@
49
50 # Run the testsuite in normal mode.
51 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
52- AR="$(AR)"; export AR; \
53+ -@(AR="$(AR)"; export AR; \
54 RANLIB="$(RANLIB)"; export RANLIB; \
55 if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
56 && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
57@@ -563,6 +565,7 @@
58 exit 0; \
59 fi; \
60 srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
61+ $(SHELL) command -v g++ >/dev/null 2>&1 || echo "g++ is not installed on your system! Please note that most of the tests need g++."; \
62 EXPECT=$(EXPECT); export EXPECT; \
63 runtest=$(RUNTEST); \
64 if [ -z "$$runtest" ]; then runtest=runtest; fi; \
65@@ -606,7 +609,7 @@
66 $(RUNTESTFLAGS); \
67 fi; \
68 else echo "WARNING: could not find \`runtest'" 1>&2; :;\
69- fi
70+ fi)
71
72 check-am:
73 $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
74diff -uNr a/libstdc++-v3/testsuite/buildtest.exp b/libstdc++-v3/testsuite/buildtest.exp
75--- a/libstdc++-v3/testsuite/buildtest.exp 1970-01-01 01:00:00.000000000 +0100
76+++ b/libstdc++-v3/testsuite/buildtest.exp 2013-08-14 09:25:57.773587133 +0200
77@@ -0,0 +1,33 @@
78+# Copyright (C) 2013 Free Software Foundation, Inc.
79+#
80+# This program is free software; you can redistribute it and/or modify
81+# it under the terms of the GNU General Public License as published by
82+# the Free Software Foundation; either version 3 of the License, or
83+# (at your option) any later version.
84+#
85+# This program is distributed in the hope that it will be useful,
86+# but WITHOUT ANY WARRANTY; without even the implied warranty of
87+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88+# GNU General Public License for more details.
89+#
90+# You should have received a copy of the GNU General Public License
91+# along with this program; see the file COPYING3. If not see
92+# <http://www.gnu.org/licenses/>.
93+
94+# If there is no baseline file, or we can't find the library, skip
95+# this test. Or, hey, if we don't support this kind of symbol
96+# versioning test: don't run it.
97+
98+
99+set baseline_subdir "[eval exec $cxx $baseline_subdir_switch]"
100+
101+# Build the support objects.
102+v3-build_support
103+
104+# Build the abi_check program.
105+if { [v3_target_compile "$srcdir/util/testsuite_abi_check.cc" "abi_check" \
106+ "executable" [list "additional_flags=-w"]] != "" } {
107+ error "could not compile testsuite_abi_check.cc"
108+}
109+
110+
111diff -uNr a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp
112--- a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp 2013-08-09 10:02:56.769743266 +0200
113+++ b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp 2013-08-14 09:27:15.722299887 +0200
114@@ -24,11 +24,6 @@
115 set lib $blddir/src/.libs/libstdc++.so
116 }
117
118-set baseline_subdir "[eval exec $cxx $baseline_subdir_switch]"
119-
120-# Build the support objects.
121-v3-build_support
122-
123 if { (${v3-symver} == 0) || ![info exists baseline_dir] \
124 || ![file exists $baseline_dir] \
125 || ![file exists $lib] } {
126@@ -50,12 +45,6 @@
127 remote_exec "build" "$objdir/../scripts/extract_symvers" \
128 [list $lib "current_symbols.txt"]
129
130-# Build the abi_check program.
131-if { [v3_target_compile "$srcdir/util/testsuite_abi_check.cc" "abi_check" \
132- "executable" [list "additional_flags=-w"]] != "" } {
133- error "could not compile testsuite_abi_check.cc"
134-}
135-
136 remote_download "target" $baseline_file "baseline_symbols.txt"
137 remote_download "target" "current_symbols.txt" "current_symbols.txt"
138 set result [${tool}_load "./abi_check" \
139diff -uNr a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp
140--- a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp 2013-08-09 13:06:20.795174486 +0200
141+++ b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp 2013-08-23 13:25:31.290856664 +0200
142@@ -21,9 +21,6 @@
143 # Initialization.
144 dg-init
145
146-# Build the support objects.
147-v3-build_support
148-
149 set tests [list]
150
151 # If there is a "testsuite_files" file, use it.
152diff -uNr a/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp b/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp
153--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp 2013-08-09 13:08:17.946244225 +0200
154+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp 2013-08-09 13:31:19.812003255 +0200
155@@ -17,7 +17,6 @@
156 load_lib gdb-test.exp
157
158 dg-init
159-v3-build_support
160
161 global GDB
162 if ![info exists ::env(GUALITY_GDB_NAME)] {
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/arm-hard-float-loader.patch b/meta/recipes-devtools/gcc/gcc-4.7/arm-hard-float-loader.patch
new file mode 100644
index 0000000000..dfa0d191f3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/arm-hard-float-loader.patch
@@ -0,0 +1,48 @@
1This patch is still being discussed by probably is almost
2final version. We add the OE notion of multilib on top
3
4Upstream-Status: Backport [ adapted ]
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Index: gcc-4_7-branch/gcc/config/arm/linux-eabi.h
9===================================================================
10--- gcc-4_7-branch.orig/gcc/config/arm/linux-eabi.h 2012-04-30 15:28:31.891863845 -0700
11+++ gcc-4_7-branch/gcc/config/arm/linux-eabi.h 2012-04-30 15:37:11.531888994 -0700
12@@ -32,7 +32,8 @@
13 while (false)
14
15 /* We default to a soft-float ABI so that binaries can run on all
16- target hardware. */
17+ target hardware. If you override this to use the hard-float ABI then
18+ change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */
19 #undef TARGET_DEFAULT_FLOAT_ABI
20 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
21
22@@ -59,10 +60,23 @@
23 #undef SUBTARGET_EXTRA_LINK_SPEC
24 #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
25
26-/* Use ld-linux.so.3 so that it will be possible to run "classic"
27- GNU/Linux binaries on an EABI system. */
28+/* GNU/Linux on ARM currently supports three dynamic linkers:
29+ - ld-linux.so.2 - for the legacy ABI
30+ - ld-linux.so.3 - for the EABI-derived soft-float ABI
31+ - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI.
32+ All the dynamic linkers live in /lib.
33+ We default to soft-float, but this can be overridden by changing both
34+ GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
35+
36 #undef GLIBC_DYNAMIC_LINKER
37-#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.3"
38+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
39+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
40+#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
41+
42+ #define GLIBC_DYNAMIC_LINKER \
43+ "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
44+ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
45+ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
46
47 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
48 use the GNU/Linux version, not the generic BPABI version. */
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/avoid-oob-array-access.patch b/meta/recipes-devtools/gcc/gcc-4.7/avoid-oob-array-access.patch
new file mode 100644
index 0000000000..4ba707d0b2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/avoid-oob-array-access.patch
@@ -0,0 +1,45 @@
1Upstream-Status: Backport
2
3See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56308
4
5From 1e37e371d2cca3549b71a247bf79778aa1a9e1c4 Mon Sep 17 00:00:00 2001
6From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
7Date: Fri, 21 Sep 2012 10:08:35 +0000
8Subject: [PATCH] 2012-09-21 Richard Guenther <rguenther@suse.de>
9
10 PR middle-end/54638
11 Backport from mainline
12 2012-04-19 Richard Guenther <rguenther@suse.de>
13
14 * ira-int.h (ira_allocno_object_iter_cond): Avoid out-of-bound
15 array access.
16
17git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@191605 138bc75d-0d04-0410-961f-82ee72b054a4
18---
19 gcc/ChangeLog | 9 +++++++++
20 gcc/ira-int.h | 9 +++++++--
21 2 files changed, 16 insertions(+), 2 deletions(-)
22
23diff --git a/gcc/ira-int.h b/gcc/ira-int.h
24index 9faabb5..771a368 100644
25--- a/gcc/ira-int.h
26+++ b/gcc/ira-int.h
27@@ -1138,8 +1138,13 @@ static inline bool
28 ira_allocno_object_iter_cond (ira_allocno_object_iterator *i, ira_allocno_t a,
29 ira_object_t *o)
30 {
31- *o = ALLOCNO_OBJECT (a, i->n);
32- return i->n++ < ALLOCNO_NUM_OBJECTS (a);
33+ int n = i->n++;
34+ if (n < ALLOCNO_NUM_OBJECTS (a))
35+ {
36+ *o = ALLOCNO_OBJECT (a, n);
37+ return true;
38+ }
39+ return false;
40 }
41
42 /* Loop over all objects associated with allocno A. In each
43--
441.8.2.2
45
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch
new file mode 100644
index 0000000000..731067741d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch
@@ -0,0 +1,40 @@
1Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
2preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
3rather than the --sysroot option specified on the commandline. If access to that directory is
4permission denied (unreadable), gcc will error.
5
6This happens when ccache is in use due to the fact it uses preprocessed source files.
7
8The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
9-isystem, -isysroot happen and the correct sysroot is used.
10
11[YOCTO #2074]
12
13Upstream-Status: Pending
14
15RP 2012/04/13
16
17Index: gcc-4_6-branch/gcc/gcc.c
18===================================================================
19--- gcc-4_6-branch.orig/gcc/gcc.c 2012-04-13 12:24:37.939671140 +0000
20+++ gcc-4_6-branch/gcc/gcc.c 2012-04-13 12:24:54.439670688 +0000
21@@ -953,7 +953,7 @@
22 %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
23 {".i", "@cpp-output", 0, 0, 0},
24 {"@cpp-output",
25- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
26+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
27 {".s", "@assembler", 0, 0, 0},
28 {"@assembler",
29 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
30Index: gcc-4_6-branch/gcc/cp/lang-specs.h
31===================================================================
32--- gcc-4_6-branch.orig/gcc/cp/lang-specs.h 2012-04-13 12:25:01.019670594 +0000
33+++ gcc-4_6-branch/gcc/cp/lang-specs.h 2012-04-13 12:25:07.567670180 +0000
34@@ -64,5 +64,5 @@
35 {".ii", "@c++-cpp-output", 0, 0, 0},
36 {"@c++-cpp-output",
37 "%{!M:%{!MM:%{!E:\
38- cc1plus -fpreprocessed %i %(cc1_options) %2\
39+ cc1plus -fpreprocessed %i %I %(cc1_options) %2\
40 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/define_insn_reservation.patch b/meta/recipes-devtools/gcc/gcc-4.7/define_insn_reservation.patch
new file mode 100644
index 0000000000..2b0ff677fe
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/define_insn_reservation.patch
@@ -0,0 +1,118 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From aab806a131efe9706396692ecc67d324371e39bc Mon Sep 17 00:00:00 2001
5From: edmarwjr <edmarwjr@138bc75d-0d04-0410-961f-82ee72b054a4>
6Date: Fri, 22 Jun 2012 20:13:23 +0000
7Subject: [PATCH] 2012-06-22 Edmar Wienskoski <edmar@freescale.com>
8
9 * config/rs6000/rs6000.md (define_attr "type"): New type popcnt.
10 (popcntb<mode>2): Add attribute type popcnt.
11 (popcntd<mode>2): Ditto.
12 * config/rs6000/power4.md (define_insn_reservation): Add type popcnt.
13 * config/rs6000/power5.md (define_insn_reservation): Ditto.
14 * config/rs6000/power7.md (define_insn_reservation): Ditto.
15 * config/rs6000/476.md (define_insn_reservation): Ditto.
16 * config/rs6000/power6.md (define_insn_reservation): New
17 reservation for popcnt instructions.
18
19
20
21git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188901 138bc75d-0d04-0410-961f-82ee72b054a4
22---
23 gcc/ChangeLog | 12 ++++++++++++
24 gcc/config/rs6000/476.md | 2 +-
25 gcc/config/rs6000/power5.md | 2 +-
26 gcc/config/rs6000/power6.md | 5 +++++
27 gcc/config/rs6000/power7.md | 2 +-
28 gcc/config/rs6000/rs6000.md | 10 +++++++---
29 6 files changed, 27 insertions(+), 6 deletions(-)
30
31Index: gcc-4_7-branch/gcc/config/rs6000/476.md
32===================================================================
33--- gcc-4_7-branch.orig/gcc/config/rs6000/476.md 2012-07-05 23:49:07.000000000 -0700
34+++ gcc-4_7-branch/gcc/config/rs6000/476.md 2012-07-06 19:50:30.078779999 -0700
35@@ -71,7 +71,7 @@
36 ppc476_i_pipe|ppc476_lj_pipe")
37
38 (define_insn_reservation "ppc476-complex-integer" 1
39- (and (eq_attr "type" "cmp,cr_logical,delayed_cr,cntlz,isel,isync,sync,trap")
40+ (and (eq_attr "type" "cmp,cr_logical,delayed_cr,cntlz,isel,isync,sync,trap,popcnt")
41 (eq_attr "cpu" "ppc476"))
42 "ppc476_issue,\
43 ppc476_i_pipe")
44Index: gcc-4_7-branch/gcc/config/rs6000/power5.md
45===================================================================
46--- gcc-4_7-branch.orig/gcc/config/rs6000/power5.md 2012-07-05 23:49:07.000000000 -0700
47+++ gcc-4_7-branch/gcc/config/rs6000/power5.md 2012-07-06 19:50:30.078779999 -0700
48@@ -142,7 +142,7 @@
49 ; Integer latency is 2 cycles
50 (define_insn_reservation "power5-integer" 2
51 (and (eq_attr "type" "integer,insert_dword,shift,trap,\
52- var_shift_rotate,cntlz,exts,isel")
53+ var_shift_rotate,cntlz,exts,isel,popcnt")
54 (eq_attr "cpu" "power5"))
55 "iq_power5")
56
57Index: gcc-4_7-branch/gcc/config/rs6000/power6.md
58===================================================================
59--- gcc-4_7-branch.orig/gcc/config/rs6000/power6.md 2012-07-05 23:49:07.000000000 -0700
60+++ gcc-4_7-branch/gcc/config/rs6000/power6.md 2012-07-06 19:50:30.078779999 -0700
61@@ -216,6 +216,11 @@
62 (eq_attr "cpu" "power6"))
63 "FXU_power6")
64
65+(define_insn_reservation "power6-popcnt" 1
66+ (and (eq_attr "type" "popcnt")
67+ (eq_attr "cpu" "power6"))
68+ "FXU_power6")
69+
70 (define_insn_reservation "power6-insert" 1
71 (and (eq_attr "type" "insert_word")
72 (eq_attr "cpu" "power6"))
73Index: gcc-4_7-branch/gcc/config/rs6000/power7.md
74===================================================================
75--- gcc-4_7-branch.orig/gcc/config/rs6000/power7.md 2012-07-05 23:49:07.000000000 -0700
76+++ gcc-4_7-branch/gcc/config/rs6000/power7.md 2012-07-06 19:50:30.078779999 -0700
77@@ -150,7 +150,7 @@
78 ; FX Unit
79 (define_insn_reservation "power7-integer" 1
80 (and (eq_attr "type" "integer,insert_word,insert_dword,shift,trap,\
81- var_shift_rotate,exts,isel")
82+ var_shift_rotate,exts,isel,popcnt")
83 (eq_attr "cpu" "power7"))
84 "DU_power7,FXU_power7")
85
86Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.md
87===================================================================
88--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.md 2012-07-06 19:44:38.000000000 -0700
89+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.md 2012-07-06 19:50:30.078779999 -0700
90@@ -144,7 +144,7 @@
91
92 ;; Define an insn type attribute. This is used in function unit delay
93 ;; computations.
94-(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel"
95+(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt"
96 (const_string "integer"))
97
98 ;; Define floating point instruction sub-types for use with Xfpu.md
99@@ -2329,13 +2329,17 @@
100 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
101 UNSPEC_POPCNTB))]
102 "TARGET_POPCNTB"
103- "popcntb %0,%1")
104+ "popcntb %0,%1"
105+ [(set_attr "length" "4")
106+ (set_attr "type" "popcnt")])
107
108 (define_insn "popcntd<mode>2"
109 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
110 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
111 "TARGET_POPCNTD"
112- "popcnt<wd> %0,%1")
113+ "popcnt<wd> %0,%1"
114+ [(set_attr "length" "4")
115+ (set_attr "type" "popcnt")])
116
117 (define_expand "popcount<mode>2"
118 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/disable-texinfo-5.patch b/meta/recipes-devtools/gcc/gcc-4.7/disable-texinfo-5.patch
new file mode 100644
index 0000000000..d5c9165a06
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/disable-texinfo-5.patch
@@ -0,0 +1,107 @@
1Upstream-Status: Pending
2
3gcc-4.8 is compatible with texinfo-5, so this is only temporary fix
4(we don't need info files on target)
5
6Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
7
8diff -uNr gcc-4.7.2.orig/configure.ac gcc-4.7.2/configure.ac
9--- gcc-4.7.2.orig/configure.ac 2013-04-04 09:10:24.600848496 +0200
10+++ gcc-4.7.2/configure.ac 2013-04-04 09:51:51.808031042 +0200
11@@ -3031,7 +3031,7 @@
12 # For an installed makeinfo, we require it to be from texinfo 4.7 or
13 # higher, else we use the "missing" dummy.
14 if ${MAKEINFO} --version \
15- | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
16+ | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9]))' >/dev/null 2>&1; then
17 :
18 else
19 MAKEINFO="$MISSING makeinfo"
20diff -uNr gcc-4.7.2.orig/gcc/configure.ac gcc-4.7.2/gcc/configure.ac
21--- gcc-4.7.2.orig/gcc/configure.ac 2013-04-04 09:10:30.523848931 +0200
22+++ gcc-4.7.2/gcc/configure.ac 2013-04-04 09:52:16.111032826 +0200
23@@ -871,7 +871,7 @@
24 # that we can use it.
25 ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
26 [GNU texinfo.* \([0-9][0-9.]*\)],
27- [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
28+ [4.[7-9]*|4.[1-9][0-9]*])
29 if test $gcc_cv_prog_makeinfo_modern = no; then
30 AC_MSG_WARN([
31 *** Makeinfo is missing or too old.
32diff -uNr gcc-4.7.2.orig/libgomp/configure.ac gcc-4.7.2/libgomp/configure.ac
33--- gcc-4.7.2.orig/libgomp/configure.ac 2010-12-06 01:50:04.000000000 +0100
34+++ gcc-4.7.2/libgomp/configure.ac 2013-04-04 09:51:29.571029410 +0200
35@@ -129,7 +129,7 @@
36 # that we can use it.
37 ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
38 [GNU texinfo.* \([0-9][0-9.]*\)],
39- [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
40+ [4.[4-9]*|4.[1-9][0-9]*])
41 AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
42
43
44diff -uNr gcc-4.7.2.orig/libiberty/configure.ac gcc-4.7.2/libiberty/configure.ac
45--- gcc-4.7.2.orig/libiberty/configure.ac 2011-08-22 18:54:02.000000000 +0200
46+++ gcc-4.7.2/libiberty/configure.ac 2013-04-04 09:51:20.685028758 +0200
47@@ -84,6 +84,12 @@
48 AC_MSG_WARN([
49 *** Makeinfo is too old. Info documentation will not be built.])
50 ;;
51+ x*\ [[5-9]].* )
52+ MAKEINFO="@echo $MAKEINFO is too new, 5.0 or newer does not work; true"
53+ BUILD_INFO=
54+ AC_MSG_WARN([
55+*** Makeinfo is too new. Info documentation will not be built.])
56+ ;;
57 esac
58 ;;
59 esac
60diff -uNr gcc-4.7.2.orig/libitm/configure.ac gcc-4.7.2/libitm/configure.ac
61--- gcc-4.7.2.orig/libitm/configure.ac 2012-02-13 22:46:38.000000000 +0100
62+++ gcc-4.7.2/libitm/configure.ac 2013-04-04 09:51:59.676031620 +0200
63@@ -140,7 +140,7 @@
64 # that we can use it.
65 ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
66 [GNU texinfo.* \([0-9][0-9.]*\)],
67- [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
68+ [4.[4-9]*|4.[1-9][0-9]*])
69 AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
70
71
72diff -uNr gcc-4.7.2.orig/libquadmath/configure.ac gcc-4.7.2/libquadmath/configure.ac
73--- gcc-4.7.2.orig/libquadmath/configure.ac 2012-05-31 20:57:56.000000000 +0200
74+++ gcc-4.7.2/libquadmath/configure.ac 2013-04-04 09:49:52.432022281 +0200
75@@ -48,7 +48,7 @@
76 # that we can use it.
77 ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
78 [GNU texinfo.* \([0-9][0-9.]*\)],
79- [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
80+ [4.[4-9]*|4.[1-9][0-9]*])
81 AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
82
83 ACX_BUGURL([http://gcc.gnu.org/bugs.html])
84diff -uNr gcc-4.7.2.orig/libstdc++-v3/configure.ac gcc-4.7.2/libstdc++-v3/configure.ac
85--- gcc-4.7.2.orig/libstdc++-v3/configure.ac 2012-08-06 16:34:27.000000000 +0200
86+++ gcc-4.7.2/libstdc++-v3/configure.ac 2013-04-04 09:49:57.483022652 +0200
87@@ -344,7 +344,7 @@
88 # that we can use it.
89 ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
90 [GNU texinfo.* \([0-9][0-9.]*\)],
91- [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
92+ [4.[4-9]*|4.[1-9][0-9]*])
93 AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
94
95 # Check for doxygen
96diff -uNr gcc-4.7.2.orig/configure gcc-4.7.2/configure
97--- gcc-4.7.2.orig/configure 2013-04-04 10:23:58.009172414 +0200
98+++ gcc-4.7.2/configure 2013-04-04 10:26:42.696184501 +0200
99@@ -7858,7 +7858,7 @@
100 # For an installed makeinfo, we require it to be from texinfo 4.7 or
101 # higher, else we use the "missing" dummy.
102 if ${MAKEINFO} --version \
103- | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
104+ | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9]))' >/dev/null 2>&1; then
105 :
106 else
107 MAKEINFO="$MISSING makeinfo"
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch b/meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch
new file mode 100644
index 0000000000..bc01cd9103
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/disable_relax_pic_calls_flag.patch
@@ -0,0 +1,48 @@
1Upstream-Status: Inappropriate [configuration]
2
3GCC: disable MASK_RELAX_PIC_CALLS bit
4
5The new feature added after 4.3.3
6"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
7will cause cc1plus eat up all the system memory when build webkit-gtk.
8The function mips_get_pic_call_symbol keeps on recursively calling itself.
9Disable this feature to walk aside the bug.
10
11Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
12
13Index: gcc-4_7-branch/gcc/configure
14===================================================================
15--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:37:09.351387437 -0700
16+++ gcc-4_7-branch/gcc/configure 2012-04-10 10:37:57.211389779 -0700
17@@ -25837,13 +25837,6 @@
18 rm -f conftest.*
19 fi
20 fi
21- if test $gcc_cv_as_ld_jalr_reloc = yes; then
22- if test x$target_cpu_default = x; then
23- target_cpu_default=MASK_RELAX_PIC_CALLS
24- else
25- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
26- fi
27- fi
28 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
29 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
30
31Index: gcc-4_7-branch/gcc/configure.ac
32===================================================================
33--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:37:09.339387366 -0700
34+++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:37:57.215389769 -0700
35@@ -4027,13 +4027,6 @@
36 rm -f conftest.*
37 fi
38 fi
39- if test $gcc_cv_as_ld_jalr_reloc = yes; then
40- if test x$target_cpu_default = x; then
41- target_cpu_default=MASK_RELAX_PIC_CALLS
42- else
43- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
44- fi
45- fi
46 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
47
48 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/disablesdt.patch b/meta/recipes-devtools/gcc/gcc-4.7/disablesdt.patch
new file mode 100644
index 0000000000..8946afc11a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/disablesdt.patch
@@ -0,0 +1,32 @@
1We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
2It may or may not exist from preivous builds though. To be determinstic, disable
3sdt.h usage always. This avoids build failures if the header is removed after configure
4but before libgcc is compiled for example.
5
6RP 2012/8/7
7
8Upstream-Status: Inappropriate [hack]
9
10Index: git/gcc/configure
11===================================================================
12--- git.orig/gcc/configure 2012-08-07 21:18:42.319247701 +0000
13+++ git/gcc/configure 2012-08-07 21:19:08.939247082 +0000
14@@ -26758,12 +26758,12 @@
15 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
16 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
17 have_sys_sdt_h=no
18-if test -f $target_header_dir/sys/sdt.h; then
19- have_sys_sdt_h=yes
20-
21-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
22-
23-fi
24+#if test -f $target_header_dir/sys/sdt.h; then
25+# have_sys_sdt_h=yes
26+#
27+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
28+#
29+#fi
30 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
31 $as_echo "$have_sys_sdt_h" >&6; }
32
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/fix-g++-sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.7/fix-g++-sysroot.patch
new file mode 100644
index 0000000000..aad234c69e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/fix-g++-sysroot.patch
@@ -0,0 +1,428 @@
1backport
2
3http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
4
5Upstream-Status: Pending
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9Index: gcc-4.7.2/gcc/configure.ac
10===================================================================
11--- gcc-4.7.2.orig/gcc/configure.ac 2012-09-20 07:42:30.284941174 -0700
12+++ gcc-4.7.2/gcc/configure.ac 2012-09-20 07:55:23.148970564 -0700
13@@ -118,6 +118,72 @@
14 local_prefix=/usr/local
15 fi
16
17+AC_ARG_WITH([native-system-header-dir],
18+ [ --with-native-system-header-dir=dir
19+ use dir as the directory to look for standard
20+ system header files in. Defaults to /usr/include.],
21+[
22+ case ${with_native_system_header_dir} in
23+ yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
24+ /* | [[A-Za-z]]:[[\\/]]*) ;;
25+ *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
26+ esac
27+ configured_native_system_header_dir="${withval}"
28+], [configured_native_system_header_dir=])
29+
30+AC_ARG_WITH(build-sysroot,
31+ [AS_HELP_STRING([--with-build-sysroot=sysroot],
32+ [use sysroot as the system root during the build])],
33+ [if test x"$withval" != x ; then
34+ SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
35+ fi],
36+ [SYSROOT_CFLAGS_FOR_TARGET=])
37+AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
38+
39+AC_ARG_WITH(sysroot,
40+[AS_HELP_STRING([[--with-sysroot[=DIR]]],
41+ [search for usr/lib, usr/include, et al, within DIR])],
42+[
43+ case ${with_sysroot} in
44+ /) ;;
45+ */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
46+ esac
47+ case ${with_sysroot} in
48+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
49+ *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
50+ esac
51+
52+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
53+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
54+
55+ if test "x$prefix" = xNONE; then
56+ test_prefix=/usr/local
57+ else
58+ test_prefix=$prefix
59+ fi
60+ if test "x$exec_prefix" = xNONE; then
61+ test_exec_prefix=$test_prefix
62+ else
63+ test_exec_prefix=$exec_prefix
64+ fi
65+ case ${TARGET_SYSTEM_ROOT} in
66+ "${test_prefix}"|"${test_prefix}/"*|\
67+ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
68+ '${prefix}'|'${prefix}/'*|\
69+ '${exec_prefix}'|'${exec_prefix}/'*)
70+ t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
71+ TARGET_SYSTEM_ROOT_DEFINE="$t"
72+ ;;
73+ esac
74+], [
75+ TARGET_SYSTEM_ROOT=
76+ TARGET_SYSTEM_ROOT_DEFINE=
77+ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
78+])
79+AC_SUBST(TARGET_SYSTEM_ROOT)
80+AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
81+AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
82+
83 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
84 # passed in by the toplevel make and thus we'd get different behavior
85 # depending on where we built the sources.
86@@ -149,7 +215,9 @@
87 if test "${with_sysroot+set}" = set; then
88 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
89 if test "${gcc_gxx_without_sysroot}"; then
90- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
91+ if test x${with_sysroot} != x/; then
92+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
93+ fi
94 gcc_gxx_include_dir_add_sysroot=1
95 fi
96 fi
97@@ -733,68 +801,6 @@
98 ], [enable_shared=yes])
99 AC_SUBST(enable_shared)
100
101-AC_ARG_WITH([native-system-header-dir],
102- [ --with-native-system-header-dir=dir
103- use dir as the directory to look for standard
104- system header files in. Defaults to /usr/include.],
105-[
106- case ${with_native_system_header_dir} in
107- yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
108- /* | [[A-Za-z]]:[[\\/]]*) ;;
109- *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
110- esac
111- configured_native_system_header_dir="${withval}"
112-], [configured_native_system_header_dir=])
113-
114-AC_ARG_WITH(build-sysroot,
115- [AS_HELP_STRING([--with-build-sysroot=sysroot],
116- [use sysroot as the system root during the build])],
117- [if test x"$withval" != x ; then
118- SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
119- fi],
120- [SYSROOT_CFLAGS_FOR_TARGET=])
121-AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
122-
123-AC_ARG_WITH(sysroot,
124-[AS_HELP_STRING([[--with-sysroot[=DIR]]],
125- [search for usr/lib, usr/include, et al, within DIR])],
126-[
127- case ${with_sysroot} in
128- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
129- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
130- esac
131-
132- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
133- CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
134-
135- if test "x$prefix" = xNONE; then
136- test_prefix=/usr/local
137- else
138- test_prefix=$prefix
139- fi
140- if test "x$exec_prefix" = xNONE; then
141- test_exec_prefix=$test_prefix
142- else
143- test_exec_prefix=$exec_prefix
144- fi
145- case ${TARGET_SYSTEM_ROOT} in
146- "${test_prefix}"|"${test_prefix}/"*|\
147- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
148- '${prefix}'|'${prefix}/'*|\
149- '${exec_prefix}'|'${exec_prefix}/'*)
150- t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
151- TARGET_SYSTEM_ROOT_DEFINE="$t"
152- ;;
153- esac
154-], [
155- TARGET_SYSTEM_ROOT=
156- TARGET_SYSTEM_ROOT_DEFINE=
157- CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
158-])
159-AC_SUBST(TARGET_SYSTEM_ROOT)
160-AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
161-AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
162-
163 AC_ARG_WITH(specs,
164 [AS_HELP_STRING([--with-specs=SPECS],
165 [add SPECS to driver command-line processing])],
166Index: gcc-4.7.2/gcc/configure
167===================================================================
168--- gcc-4.7.2.orig/gcc/configure 2012-09-20 07:42:30.284941174 -0700
169+++ gcc-4.7.2/gcc/configure 2012-09-20 07:55:31.788970893 -0700
170@@ -757,10 +757,6 @@
171 REPORT_BUGS_TO
172 PKGVERSION
173 CONFIGURE_SPECS
174-CROSS_SYSTEM_HEADER_DIR
175-TARGET_SYSTEM_ROOT_DEFINE
176-TARGET_SYSTEM_ROOT
177-SYSROOT_CFLAGS_FOR_TARGET
178 enable_shared
179 enable_fixed_point
180 enable_decimal_float
181@@ -798,6 +794,10 @@
182 CFLAGS
183 CC
184 GENINSRC
185+CROSS_SYSTEM_HEADER_DIR
186+TARGET_SYSTEM_ROOT_DEFINE
187+TARGET_SYSTEM_ROOT
188+SYSROOT_CFLAGS_FOR_TARGET
189 target_subdir
190 host_subdir
191 build_subdir
192@@ -859,6 +859,9 @@
193 enable_option_checking
194 with_build_libsubdir
195 with_local_prefix
196+with_native_system_header_dir
197+with_build_sysroot
198+with_sysroot
199 with_gxx_include_dir
200 with_cpp_install_dir
201 enable_generated_files_in_srcdir
202@@ -883,9 +886,6 @@
203 enable_objc_gc
204 with_dwarf2
205 enable_shared
206-with_native_system_header_dir
207-with_build_sysroot
208-with_sysroot
209 with_specs
210 with_pkgversion
211 with_bugurl
212@@ -1639,6 +1639,12 @@
213 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
214 --with-build-libsubdir=DIR Directory where to find libraries for build system
215 --with-local-prefix=DIR specifies directory to put local include
216+ --with-native-system-header-dir=dir
217+ use dir as the directory to look for standard
218+ system header files in. Defaults to /usr/include.
219+ --with-build-sysroot=sysroot
220+ use sysroot as the system root during the build
221+ --with-sysroot[=DIR] search for usr/lib, usr/include, et al, within DIR
222 --with-gxx-include-dir=DIR
223 specifies directory to put g++ header files
224 --with-cpp-install-dir=DIR
225@@ -1651,12 +1657,6 @@
226 --with-as arrange to use the specified as (full pathname)
227 --with-stabs arrange to use stabs instead of host debug format
228 --with-dwarf2 force the default debug format to be DWARF 2
229- --with-native-system-header-dir=dir
230- use dir as the directory to look for standard
231- system header files in. Defaults to /usr/include.
232- --with-build-sysroot=sysroot
233- use sysroot as the system root during the build
234- --with-sysroot[=DIR] search for usr/lib, usr/include, et al, within DIR
235 --with-specs=SPECS add SPECS to driver command-line processing
236 --with-pkgversion=PKG Use PKG in the version string in place of "GCC"
237 --with-bugurl=URL Direct users to URL to report a bug
238@@ -3288,6 +3288,82 @@
239 local_prefix=/usr/local
240 fi
241
242+
243+# Check whether --with-native-system-header-dir was given.
244+if test "${with_native_system_header_dir+set}" = set; then :
245+ withval=$with_native_system_header_dir;
246+ case ${with_native_system_header_dir} in
247+ yes|no) as_fn_error "bad value ${withval} given for --with-native-system-header-dir" "$LINENO" 5 ;;
248+ /* | [A-Za-z]:[\\/]*) ;;
249+ *) as_fn_error "--with-native-system-header-dir argument ${withval} must be an absolute directory" "$LINENO" 5 ;;
250+ esac
251+ configured_native_system_header_dir="${withval}"
252+
253+else
254+ configured_native_system_header_dir=
255+fi
256+
257+
258+
259+# Check whether --with-build-sysroot was given.
260+if test "${with_build_sysroot+set}" = set; then :
261+ withval=$with_build_sysroot; if test x"$withval" != x ; then
262+ SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
263+ fi
264+else
265+ SYSROOT_CFLAGS_FOR_TARGET=
266+fi
267+
268+
269+
270+
271+# Check whether --with-sysroot was given.
272+if test "${with_sysroot+set}" = set; then :
273+ withval=$with_sysroot;
274+ case ${with_sysroot} in
275+ /) ;;
276+ */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
277+ esac
278+ case ${with_sysroot} in
279+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
280+ *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
281+ esac
282+
283+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
284+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
285+
286+ if test "x$prefix" = xNONE; then
287+ test_prefix=/usr/local
288+ else
289+ test_prefix=$prefix
290+ fi
291+ if test "x$exec_prefix" = xNONE; then
292+ test_exec_prefix=$test_prefix
293+ else
294+ test_exec_prefix=$exec_prefix
295+ fi
296+ case ${TARGET_SYSTEM_ROOT} in
297+ "${test_prefix}"|"${test_prefix}/"*|\
298+ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
299+ '${prefix}'|'${prefix}/'*|\
300+ '${exec_prefix}'|'${exec_prefix}/'*)
301+ t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
302+ TARGET_SYSTEM_ROOT_DEFINE="$t"
303+ ;;
304+ esac
305+
306+else
307+
308+ TARGET_SYSTEM_ROOT=
309+ TARGET_SYSTEM_ROOT_DEFINE=
310+ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
311+
312+fi
313+
314+
315+
316+
317+
318 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
319 # passed in by the toplevel make and thus we'd get different behavior
320 # depending on where we built the sources.
321@@ -3321,7 +3397,9 @@
322 if test "${with_sysroot+set}" = set; then
323 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
324 if test "${gcc_gxx_without_sysroot}"; then
325- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
326+ if test x${with_sysroot} != x/; then
327+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
328+ fi
329 gcc_gxx_include_dir_add_sysroot=1
330 fi
331 fi
332@@ -7220,78 +7298,6 @@
333
334
335
336-# Check whether --with-native-system-header-dir was given.
337-if test "${with_native_system_header_dir+set}" = set; then :
338- withval=$with_native_system_header_dir;
339- case ${with_native_system_header_dir} in
340- yes|no) as_fn_error "bad value ${withval} given for --with-native-system-header-dir" "$LINENO" 5 ;;
341- /* | [A-Za-z]:[\\/]*) ;;
342- *) as_fn_error "--with-native-system-header-dir argument ${withval} must be an absolute directory" "$LINENO" 5 ;;
343- esac
344- configured_native_system_header_dir="${withval}"
345-
346-else
347- configured_native_system_header_dir=
348-fi
349-
350-
351-
352-# Check whether --with-build-sysroot was given.
353-if test "${with_build_sysroot+set}" = set; then :
354- withval=$with_build_sysroot; if test x"$withval" != x ; then
355- SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
356- fi
357-else
358- SYSROOT_CFLAGS_FOR_TARGET=
359-fi
360-
361-
362-
363-
364-# Check whether --with-sysroot was given.
365-if test "${with_sysroot+set}" = set; then :
366- withval=$with_sysroot;
367- case ${with_sysroot} in
368- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
369- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
370- esac
371-
372- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
373- CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
374-
375- if test "x$prefix" = xNONE; then
376- test_prefix=/usr/local
377- else
378- test_prefix=$prefix
379- fi
380- if test "x$exec_prefix" = xNONE; then
381- test_exec_prefix=$test_prefix
382- else
383- test_exec_prefix=$exec_prefix
384- fi
385- case ${TARGET_SYSTEM_ROOT} in
386- "${test_prefix}"|"${test_prefix}/"*|\
387- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
388- '${prefix}'|'${prefix}/'*|\
389- '${exec_prefix}'|'${exec_prefix}/'*)
390- t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
391- TARGET_SYSTEM_ROOT_DEFINE="$t"
392- ;;
393- esac
394-
395-else
396-
397- TARGET_SYSTEM_ROOT=
398- TARGET_SYSTEM_ROOT_DEFINE=
399- CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
400-
401-fi
402-
403-
404-
405-
406-
407-
408 # Check whether --with-specs was given.
409 if test "${with_specs+set}" = set; then :
410 withval=$with_specs; CONFIGURE_SPECS=$withval
411@@ -18013,7 +18019,7 @@
412 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
413 lt_status=$lt_dlunknown
414 cat > conftest.$ac_ext <<_LT_EOF
415-#line 18016 "configure"
416+#line 18022 "configure"
417 #include "confdefs.h"
418
419 #if HAVE_DLFCN_H
420@@ -18119,7 +18125,7 @@
421 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
422 lt_status=$lt_dlunknown
423 cat > conftest.$ac_ext <<_LT_EOF
424-#line 18122 "configure"
425+#line 18128 "configure"
426 #include "confdefs.h"
427
428 #if HAVE_DLFCN_H
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..2773b42cca
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/fortran-cross-compile-hack.patch
@@ -0,0 +1,32 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
4 used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
5 directory.
6
7Index: gcc-4_7-branch/libgfortran/configure
8===================================================================
9--- gcc-4_7-branch.orig/libgfortran/configure 2012-04-10 10:17:24.055330044 -0700
10+++ gcc-4_7-branch/libgfortran/configure 2012-04-10 10:42:26.159402591 -0700
11@@ -12689,7 +12689,7 @@
12
13 # We need gfortran to compile parts of the library
14 #AC_PROG_FC(gfortran)
15-FC="$GFORTRAN"
16+#FC="$GFORTRAN"
17 ac_ext=${ac_fc_srcext-f}
18 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
19 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
20Index: gcc-4_7-branch/libgfortran/configure.ac
21===================================================================
22--- gcc-4_7-branch.orig/libgfortran/configure.ac 2012-04-10 10:17:24.063330046 -0700
23+++ gcc-4_7-branch/libgfortran/configure.ac 2012-04-10 10:42:26.159402591 -0700
24@@ -227,7 +227,7 @@
25
26 # We need gfortran to compile parts of the library
27 #AC_PROG_FC(gfortran)
28-FC="$GFORTRAN"
29+#FC="$GFORTRAN"
30 AC_PROG_FC(gfortran)
31
32 # extra LD Flags which are required for targets
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..964c4bbbf2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,33 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3---
4 configure | 2 +-
5 configure.ac | 2 +-
6 2 files changed, 2 insertions(+), 2 deletions(-)
7
8Index: gcc-4_7-branch/configure.ac
9===================================================================
10--- gcc-4_7-branch.orig/configure.ac 2012-04-10 10:19:50.923337154 -0700
11+++ gcc-4_7-branch/configure.ac 2012-04-10 10:19:54.911337344 -0700
12@@ -2825,7 +2825,7 @@
13 # for target_alias and gcc doesn't manage it consistently.
14 target_configargs="--cache-file=./config.cache ${target_configargs}"
15
16-FLAGS_FOR_TARGET=
17+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
18 case " $target_configdirs " in
19 *" newlib "*)
20 case " $target_configargs " in
21Index: gcc-4_7-branch/configure
22===================================================================
23--- gcc-4_7-branch.orig/configure 2012-04-10 10:19:50.911337153 -0700
24+++ gcc-4_7-branch/configure 2012-04-10 10:19:54.915337349 -0700
25@@ -7368,7 +7368,7 @@
26 # for target_alias and gcc doesn't manage it consistently.
27 target_configargs="--cache-file=./config.cache ${target_configargs}"
28
29-FLAGS_FOR_TARGET=
30+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
31 case " $target_configdirs " in
32 *" newlib "*)
33 case " $target_configargs " in
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..ff136e19aa
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,116 @@
1Upstream-Status: Pending
2
3Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
4
5This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
6
7Other changes I had to do include:
8
9- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
10
11- passing the right CFLAGS to configure scripts as exported environment variables
12
13I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
14
15Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
16
17Paolo
18
192008-02-19 Paolo Bonzini <bonzini@gnu.org>
20
21 PR bootstrap/32009
22 PR bootstrap/32161
23
24 * configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Compute here.
25 * configure: Regenerate.
26
27 * Makefile.def: Define stage_libcflags for all bootstrap stages.
28 * Makefile.tpl (BOOT_LIBCFLAGS, STAGE2_LIBCFLAGS, STAGE3_LIBCFLAGS,
29 STAGE4_LIBCFLAGS): New.
30 (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Subst from autoconf, without
31 $(SYSROOT_CFLAGS_FOR_TARGET) and $(DEBUG_PREFIX_CFLAGS_FOR_TARGET).
32 (BASE_TARGET_EXPORTS): Append them here to C{,XX}FLAGS.
33 (EXTRA_TARGET_FLAGS): Append them here to {LIB,}C{,XX}FLAGS.
34 (configure-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags
35 for target modules. Don't export LIBCFLAGS.
36 (all-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags; pass
37 $(BASE_FLAGS_TO_PASS) where [+args+] was passed, and [+args+] after
38 the overridden CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
39 (invocations of `all'): Replace $(TARGET_FLAGS_TO_PASS) with
40 $(EXTRA_TARGET_FLAGS), $(FLAGS_TO_PASS) with $(EXTRA_HOST_FLAGS).
41 * Makefile.in: Regenerate.
42
43config:
442008-02-19 Paolo Bonzini <bonzini@gnu.org>
45
46 PR bootstrap/32009
47 * mh-ppc-darwin (BOOT_CFLAGS): Reenable.
48
49gcc:
502008-02-19 Paolo Bonzini <bonzini@gnu.org>
51
52 PR bootstrap/32009
53 * doc/install.texi: Correct references to CFLAGS, replacing them
54 with BOOT_CFLAGS. Document flags used during bootstrap for
55 target libraries.
56
57
58---
59 Makefile.def | 25
60 Makefile.in | 1845 ++++++++++++++++++++++++++++++-------------------
61 Makefile.tpl | 91 +-
62 config/mh-ppc-darwin | 3
63 configure | 36
64 configure.ac | 32
65 gcc/Makefile.in | 2
66 gcc/configure | 6
67 gcc/configure.ac | 3
68 gcc/doc/install.texi | 56 -
69 libiberty/Makefile.in | 162 ++--
70 libiberty/configure | 46 -
71 libiberty/configure.ac | 43 -
72 13 files changed, 1454 insertions(+), 896 deletions(-)
73
74Index: gcc-4_7-branch/configure
75===================================================================
76--- gcc-4_7-branch.orig/configure 2012-04-10 10:22:05.807343683 -0700
77+++ gcc-4_7-branch/configure 2012-04-10 10:37:24.243388086 -0700
78@@ -6695,6 +6695,38 @@
79
80
81
82+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
83+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
84+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
85+# We want to ensure that TARGET libraries (which we know are built with
86+# gcc) are built with "-O2 -g", so include those options when setting
87+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
88+if test "x$CFLAGS_FOR_TARGET" = x; then
89+ CFLAGS_FOR_TARGET=$CFLAGS
90+ case " $CFLAGS " in
91+ *" -O2 "*) ;;
92+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
93+ esac
94+ case " $CFLAGS " in
95+ *" -g "* | *" -g3 "*) ;;
96+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
97+ esac
98+fi
99+
100+
101+if test "x$CXXFLAGS_FOR_TARGET" = x; then
102+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
103+ case " $CXXFLAGS " in
104+ *" -O2 "*) ;;
105+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
106+ esac
107+ case " $CXXFLAGS " in
108+ *" -g "* | *" -g3 "*) ;;
109+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
110+ esac
111+fi
112+
113+
114 # Handle --with-headers=XXX. If the value is not "yes", the contents of
115 # the named directory are copied to $(tooldir)/sys-include.
116 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-argument-list-too-long.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-argument-list-too-long.patch
new file mode 100644
index 0000000000..70d3c53a84
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-argument-list-too-long.patch
@@ -0,0 +1,33 @@
1There would be an "Argument list too long" error when the
2build directory is longer than 200, this is caused by:
3
4headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
5
6The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
7it, use the $(sort list) of GNU make which can handle the too long list
8would fix the problem, the header would be short enough after sorted.
9The "tr ' ' '\012'" was used for translating the space to "\n", the
10$(sort list) doesn't need this.
11
12Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
13
14Upstream-Status: Pending
15---
16 gcc/Makefile.in | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19diff --git a/gcc/Makefile.in b/gcc/Makefile.in
20--- a/gcc/Makefile.in
21+++ b/gcc/Makefile.in
22@@ -4553,7 +4553,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
23 # We keep the directory structure for files in config or c-family and .def
24 # files. All other files are flattened to a single directory.
25 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
26- headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
27+ headers="$(sort $(PLUGIN_HEADERS))"; \
28 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
29 for file in $$headers; do \
30 if [ -f $$file ] ; then \
31--
321.7.10.2
33
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-armv4-pass-fix-v4bx-to-ld.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-armv4-pass-fix-v4bx-to-ld.patch
new file mode 100644
index 0000000000..7e03a3a8a8
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-armv4-pass-fix-v4bx-to-ld.patch
@@ -0,0 +1,31 @@
1The LINK_SPEC for linux gets overwritten by linux-eabi.h which
2means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
3the option is not passed to linker when chosing march=armv4
4This patch redefines this in linux-eabi.h and reinserts it
5for eabi defaulting toolchains.
6
7We might want to send it upstream
8
9Upstream-Status: Pending
10
11-Khem
12Index: gcc-4_7-branch/gcc/config/arm/linux-eabi.h
13===================================================================
14--- gcc-4_7-branch.orig/gcc/config/arm/linux-eabi.h 2012-08-21 22:54:12.448453417 -0700
15+++ gcc-4_7-branch/gcc/config/arm/linux-eabi.h 2012-08-21 23:05:18.008478722 -0700
16@@ -78,10 +78,14 @@
17 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
18 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
19
20+/* For armv4 we pass --fix-v4bx to linker to support EABI */
21+#undef TARGET_FIX_V4BX_SPEC
22+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
23+
24 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
25 use the GNU/Linux version, not the generic BPABI version. */
26 #undef LINK_SPEC
27-#define LINK_SPEC BE8_LINK_SPEC \
28+#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC \
29 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
30 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
31
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch
new file mode 100644
index 0000000000..607129a6fe
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-dir-extend.patch
@@ -0,0 +1,27 @@
1Upstream-Status: Pending
2
3Add /sw/include and /opt/include based on the original
4zecke-no-host-includes.patch patch. The original patch checked for
5/usr/include, /sw/include and /opt/include and then triggered a failure and
6aborted.
7
8Instead, we add the two missing items to the current scan. If the user
9wants this to be a failure, they can add "-Werror=poison-system-directories".
10
11Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
12
13Index: gcc-4_7-branch/gcc/incpath.c
14===================================================================
15--- gcc-4_7-branch.orig/gcc/incpath.c 2012-04-10 10:37:09.343387385 -0700
16+++ gcc-4_7-branch/gcc/incpath.c 2012-04-10 10:37:18.975387919 -0700
17@@ -371,7 +371,9 @@
18 {
19 if ((!strncmp (p->name, "/usr/include", 12))
20 || (!strncmp (p->name, "/usr/local/include", 18))
21- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
22+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
23+ || (!strncmp (p->name, "/sw/include", 11))
24+ || (!strncmp (p->name, "/opt/include", 12)))
25 warning (OPT_Wpoison_system_directories,
26 "include location \"%s\" is unsafe for "
27 "cross-compilation",
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..82a55c9b8b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-poison-system-directories.patch
@@ -0,0 +1,223 @@
1Upstream-Status: Inappropriate [distribution: codesourcery]
2
3 gcc/
4 2008-07-02 Joseph Myers <joseph@codesourcery.com>
5 * c-incpath.c: Include toplev.h.
6 (merge_include_chains): Use warning instead of cpp_error for
7 system directory poisoning diagnostic.
8 * Makefile.in (c-incpath.o): Depend on toplev.h.
9 * gcc.c (LINK_COMMAND_SPEC): Pass
10 --error-poison-system-directories if
11 -Werror=poison-system-directories.
12
13 2007-06-13 Joseph Myers <joseph@codesourcery.com>
14 * common.opt (--Wno-poison-system-directories): New.
15 * doc/invoke.texi (-Wno-poison-system-directories): Document.
16 * c-incpath.c: Include flags.h.
17 (merge_include_chains): Check flag_poison_system_directories.
18 * gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
19 to linker if -Wno-poison-system-directories.
20 * Makefile.in (c-incpath.o): Depend on $(FLAGS_H).
21
22 2007-03-20 Daniel Jacobowitz <dan@codesourcery.com>
23 Joseph Myers <joseph@codesourcery.com>
24 * configure.ac (--enable-poison-system-directories): New option.
25 * configure, config.in: Regenerate.
26 * c-incpath.c (merge_include_chains): If
27 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of
28 /usr/include, /usr/local/include or /usr/X11R6/include.
29
30Index: gcc-4.7.2/gcc/common.opt
31===================================================================
32--- gcc-4.7.2.orig/gcc/common.opt 2012-08-06 07:34:27.000000000 -0700
33+++ gcc-4.7.2/gcc/common.opt 2012-09-20 07:40:54.708937540 -0700
34@@ -582,6 +582,10 @@
35 Common Var(warn_padded) Warning
36 Warn when padding is required to align structure members
37
38+Wpoison-system-directories
39+Common Var(flag_poison_system_directories) Init(1) Warning
40+Warn for -I and -L options using system directories if cross compiling
41+
42 Wshadow
43 Common Var(warn_shadow) Warning
44 Warn when one local variable shadows another
45Index: gcc-4.7.2/gcc/config.in
46===================================================================
47--- gcc-4.7.2.orig/gcc/config.in 2012-09-20 00:23:55.000000000 -0700
48+++ gcc-4.7.2/gcc/config.in 2012-09-20 07:40:54.708937540 -0700
49@@ -144,6 +144,12 @@
50 #endif
51
52
53+/* Define to warn for use of native system header directories */
54+#ifndef USED_FOR_TARGET
55+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
56+#endif
57+
58+
59 /* Define if you want all operations on RTL (the basic data structure of the
60 optimizer and back end) to be checked for dynamic type safety at runtime.
61 This is quite expensive. */
62Index: gcc-4.7.2/gcc/configure.ac
63===================================================================
64--- gcc-4.7.2.orig/gcc/configure.ac 2012-09-20 07:30:27.000000000 -0700
65+++ gcc-4.7.2/gcc/configure.ac 2012-09-20 07:40:54.708937540 -0700
66@@ -4989,6 +4989,16 @@
67 [specify that runtime libraries should be
68 installed in a compiler-specific directory])])
69
70+AC_ARG_ENABLE([poison-system-directories],
71+ AS_HELP_STRING([--enable-poison-system-directories],
72+ [warn for use of native system header directories]),,
73+ [enable_poison_system_directories=no])
74+if test "x${enable_poison_system_directories}" = "xyes"; then
75+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
76+ [1],
77+ [Define to warn for use of native system header directories])
78+fi
79+
80 # Substitute configuration variables
81 AC_SUBST(subdirs)
82 AC_SUBST(srcdir)
83Index: gcc-4.7.2/gcc/doc/invoke.texi
84===================================================================
85--- gcc-4.7.2.orig/gcc/doc/invoke.texi 2012-09-14 13:45:27.000000000 -0700
86+++ gcc-4.7.2/gcc/doc/invoke.texi 2012-09-20 07:40:54.712937541 -0700
87@@ -260,6 +260,7 @@
88 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
89 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
90 -Wpointer-arith -Wno-pointer-to-int-cast @gol
91+-Wno-poison-system-directories @gol
92 -Wredundant-decls @gol
93 -Wreturn-type -Wsequence-point -Wshadow @gol
94 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
95@@ -3879,6 +3880,14 @@
96 for most targets, it is made up of code and thus requires the stack
97 to be made executable in order for the program to work properly.
98
99+@item -Wno-poison-system-directories
100+@opindex Wno-poison-system-directories
101+Do not warn for @option{-I} or @option{-L} options using system
102+directories such as @file{/usr/include} when cross compiling. This
103+option is intended for use in chroot environments when such
104+directories contain the correct headers and libraries for the target
105+system rather than the host.
106+
107 @item -Wfloat-equal
108 @opindex Wfloat-equal
109 @opindex Wno-float-equal
110Index: gcc-4.7.2/gcc/gcc.c
111===================================================================
112--- gcc-4.7.2.orig/gcc/gcc.c 2012-08-06 07:34:27.000000000 -0700
113+++ gcc-4.7.2/gcc/gcc.c 2012-09-20 07:40:54.716937541 -0700
114@@ -673,6 +673,8 @@
115 %{flto} %{flto=*} %l " LINK_PIE_SPEC \
116 "%X %{o*} %{e*} %{N} %{n} %{r}\
117 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
118+ %{Wno-poison-system-directories:--no-poison-system-directories}\
119+ %{Werror=poison-system-directories:--error-poison-system-directories}\
120 %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
121 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
122 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
123Index: gcc-4.7.2/gcc/incpath.c
124===================================================================
125--- gcc-4.7.2.orig/gcc/incpath.c 2012-01-26 15:34:58.000000000 -0800
126+++ gcc-4.7.2/gcc/incpath.c 2012-09-20 07:40:54.716937541 -0700
127@@ -361,6 +361,24 @@
128 }
129 fprintf (stderr, _("End of search list.\n"));
130 }
131+
132+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
133+ if (flag_poison_system_directories)
134+ {
135+ struct cpp_dir *p;
136+
137+ for (p = heads[QUOTE]; p; p = p->next)
138+ {
139+ if ((!strncmp (p->name, "/usr/include", 12))
140+ || (!strncmp (p->name, "/usr/local/include", 18))
141+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
142+ warning (OPT_Wpoison_system_directories,
143+ "include location \"%s\" is unsafe for "
144+ "cross-compilation",
145+ p->name);
146+ }
147+ }
148+#endif
149 }
150
151 /* Use given -I paths for #include "..." but not #include <...>, and
152Index: gcc-4.7.2/gcc/Makefile.in
153===================================================================
154--- gcc-4.7.2.orig/gcc/Makefile.in 2012-08-06 07:34:27.000000000 -0700
155+++ gcc-4.7.2/gcc/Makefile.in 2012-09-20 07:40:54.716937541 -0700
156@@ -2065,7 +2065,7 @@
157
158 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
159 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
160- $(MACHMODE_H)
161+ $(MACHMODE_H) $(FLAGS_H) toplev.h
162
163 CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
164 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
165Index: gcc-4.7.2/gcc/configure
166===================================================================
167--- gcc-4.7.2.orig/gcc/configure 2012-09-20 07:30:27.000000000 -0700
168+++ gcc-4.7.2/gcc/configure 2012-09-20 07:41:08.548938066 -0700
169@@ -914,6 +914,7 @@
170 with_system_zlib
171 enable_maintainer_mode
172 enable_version_specific_runtime_libs
173+enable_poison_system_directories
174 enable_plugin
175 enable_libquadmath_support
176 with_linker_hash_style
177@@ -1627,6 +1628,8 @@
178 --enable-version-specific-runtime-libs
179 specify that runtime libraries should be installed
180 in a compiler-specific directory
181+ --enable-poison-system-directories
182+ warn for use of native system header directories
183 --enable-plugin enable plugin support
184 --disable-libquadmath-support
185 disable libquadmath support for Fortran
186@@ -18010,7 +18013,7 @@
187 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
188 lt_status=$lt_dlunknown
189 cat > conftest.$ac_ext <<_LT_EOF
190-#line 18013 "configure"
191+#line 18016 "configure"
192 #include "confdefs.h"
193
194 #if HAVE_DLFCN_H
195@@ -18116,7 +18119,7 @@
196 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
197 lt_status=$lt_dlunknown
198 cat > conftest.$ac_ext <<_LT_EOF
199-#line 18119 "configure"
200+#line 18122 "configure"
201 #include "confdefs.h"
202
203 #if HAVE_DLFCN_H
204@@ -27129,6 +27132,19 @@
205 fi
206
207
208+# Check whether --enable-poison-system-directories was given.
209+if test "${enable_poison_system_directories+set}" = set; then :
210+ enableval=$enable_poison_system_directories;
211+else
212+ enable_poison_system_directories=no
213+fi
214+
215+if test "x${enable_poison_system_directories}" = "xyes"; then
216+
217+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
218+
219+fi
220+
221 # Substitute configuration variables
222
223
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch b/meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 0000000000..1648b3b98c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,72 @@
1Upstream-Status: Pending
2
3Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
4===================================================================
5--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.h
6+++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
7@@ -41,13 +41,22 @@
8
9 #include <clocale>
10
11+#ifdef __UCLIBC__
12+#include <features.h>
13+#include <ctype.h>
14+#endif
15+
16 #define _GLIBCXX_NUM_CATEGORIES 0
17
18 namespace std _GLIBCXX_VISIBILITY(default)
19 {
20 _GLIBCXX_BEGIN_NAMESPACE_VERSION
21
22+#ifdef __UCLIBC__
23+ typedef __ctype_touplow_t* __c_locale;
24+#else
25 typedef int* __c_locale;
26+#endif
27
28 // Convert numeric value of type double and long double to string and
29 // return length of string. If vsnprintf is available use it, otherwise
30Index: gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
31===================================================================
32--- gcc-4.6.0.orig/libstdc++-v3/config/os/gnu-linux/ctype_base.h
33+++ gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
34@@ -34,6 +34,11 @@
35
36 // Information as gleaned from /usr/include/ctype.h
37
38+#ifdef __UCLIBC__
39+#include <features.h>
40+#include <ctype.h>
41+#endif
42+
43 namespace std _GLIBCXX_VISIBILITY(default)
44 {
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
46@@ -42,7 +47,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 struct ctype_base
48 {
49 // Non-standard typedefs.
50+#ifdef __UCLIBC__
51+ typedef const __ctype_touplow_t* __to_type;
52+#else
53 typedef const int* __to_type;
54+#endif
55
56 // NB: Offsets into ctype<char>::_M_table force a particular size
57 // on the mask type. Because of this, we don't use an enum.
58Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
59===================================================================
60--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.cc
61+++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
62@@ -264,5 +264,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
63 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
64 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
65 extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
66+#ifdef __UCLIBC__
67+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
68+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
69+#else
70 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
71+#endif
72 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch b/meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch
new file mode 100644
index 0000000000..c2fe79217c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/libgcc-sjlj-check.patch
@@ -0,0 +1,61 @@
1ac_fn_c_try_compile doesnt seem to keep the intermediate files
2which are needed for sjlj test to pass since it greps into the
3generated file. So we run the compiler command using AC_TRY_COMMAND
4which then generates the needed .s file
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9Index: trunk/libgcc/configure
10===================================================================
11--- trunk.orig/libgcc/configure 2012-03-01 22:59:10.112444433 -0800
12+++ trunk/libgcc/configure 2012-03-01 22:59:50.424446325 -0800
13@@ -4525,17 +4525,19 @@
14 }
15
16 _ACEOF
17-CFLAGS_hold=$CFLAGS
18-CFLAGS="--save-temps -fexceptions"
19 libgcc_cv_lib_sjlj_exceptions=unknown
20-if ac_fn_c_try_compile; then :
21+if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
22+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
23+ (eval $ac_try) 2>&5
24+ ac_status=$?
25+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
26+ test $ac_status = 0; }; }; then
27 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
28 libgcc_cv_lib_sjlj_exceptions=yes
29 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
30 libgcc_cv_lib_sjlj_exceptions=no
31 fi
32 fi
33-CFLAGS=$CFLAGS_hold
34 rm -f conftest*
35
36 fi
37Index: trunk/libgcc/configure.ac
38===================================================================
39--- trunk.orig/libgcc/configure.ac 2012-03-01 22:59:10.128444406 -0800
40+++ trunk/libgcc/configure.ac 2012-03-01 22:59:50.428446373 -0800
41@@ -209,16 +209,14 @@
42 bar();
43 }
44 ])])
45-CFLAGS_hold=$CFLAGS
46-CFLAGS="--save-temps -fexceptions"
47 libgcc_cv_lib_sjlj_exceptions=unknown
48-AS_IF([ac_fn_c_try_compile],
49- [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
50+if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
51+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
52 libgcc_cv_lib_sjlj_exceptions=yes
53 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
54 libgcc_cv_lib_sjlj_exceptions=no
55- fi])
56-CFLAGS=$CFLAGS_hold
57+ fi
58+fi
59 rm -f conftest*
60 ])
61
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/libtool.patch b/meta/recipes-devtools/gcc/gcc-4.7/libtool.patch
new file mode 100644
index 0000000000..9580b23d8e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/libtool.patch
@@ -0,0 +1,29 @@
1libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
2when running on am x86_64 build host.
3
4This patch stops this speading to libdir in the libstdc++.la file within libtool.
5Aguably, it shouldn't be passing this into libtool in the first place but
6for now this resolves the nastiest problems this causes.
7
8func_normal_abspath would resolve an empty path to `pwd` so we need
9to filter the zero case.
10
11RP 2012/8/24
12
13Upstream-Status: Pending
14
15Index: git/ltmain.sh
16===================================================================
17--- git.orig/ltmain.sh 2012-08-24 11:45:58.597087961 +0000
18+++ git/ltmain.sh 2012-08-24 12:18:37.961042581 +0000
19@@ -6359,6 +6359,10 @@
20 func_warning "ignoring multiple \`-rpath's for a libtool library"
21
22 install_libdir="$1"
23+ if test -n "$install_libdir"; then
24+ func_normal_abspath "$install_libdir"
25+ install_libdir=$func_normal_abspath_result
26+ fi
27
28 oldlibs=
29 if test -z "$rpath"; then
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/mips64-default-n64.patch b/meta/recipes-devtools/gcc/gcc-4.7/mips64-default-n64.patch
new file mode 100644
index 0000000000..a42569e058
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/mips64-default-n64.patch
@@ -0,0 +1,19 @@
1MIPS64 defaults to n32 ABI, this patch makes it
2so that it defaults to N64 ABI
3
4Upstream-Status: Inappropriate [OE config specific]
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Index: gcc-4_7-branch/gcc/config.gcc
8===================================================================
9--- gcc-4_7-branch.orig/gcc/config.gcc 2012-04-22 19:30:21.000000000 -0700
10+++ gcc-4_7-branch/gcc/config.gcc 2012-04-22 21:09:57.783403173 -0700
11@@ -1750,7 +1750,7 @@
12 mips64*-*-linux* | mipsisa64*-*-linux*)
13 tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h"
14 tmake_file="${tmake_file} mips/t-linux64"
15- tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
16+ tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
17 case ${target} in
18 mips64el-st-linux-gnu)
19 tm_file="${tm_file} mips/st.h"
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch b/meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch
new file mode 100644
index 0000000000..6e7536b693
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/optional_libstdc.patch
@@ -0,0 +1,86 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
4will not run correctly since by default the linker will try to link against libstdc++
5which shouldn't exist yet. We need an option to disable -lstdc++
6option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
7driver. This patch adds such an option which only disables the -lstdc++.
8
9A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
10do this officially, the likely answer is don't build libstdc++ separately.
11
12RP 29/6/10
13
14Index: gcc-4_7-branch/gcc/cp/g++spec.c
15===================================================================
16--- gcc-4_7-branch.orig/gcc/cp/g++spec.c 2012-04-10 10:17:24.647330074 -0700
17+++ gcc-4_7-branch/gcc/cp/g++spec.c 2012-04-10 10:37:49.479389235 -0700
18@@ -127,6 +127,7 @@
19 switch (decoded_options[i].opt_index)
20 {
21 case OPT_nostdlib:
22+ case OPT_nostdlib__:
23 case OPT_nodefaultlibs:
24 library = -1;
25 break;
26Index: gcc-4_7-branch/gcc/doc/invoke.texi
27===================================================================
28--- gcc-4_7-branch.orig/gcc/doc/invoke.texi 2012-04-10 10:37:09.343387385 -0700
29+++ gcc-4_7-branch/gcc/doc/invoke.texi 2012-04-10 10:37:49.483389340 -0700
30@@ -194,7 +194,7 @@
31 -fno-pretty-templates @gol
32 -frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
33 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
34--fno-default-inline -fvisibility-inlines-hidden @gol
35+-nostdlib++ -fno-default-inline -fvisibility-inlines-hidden @gol
36 -fvisibility-ms-compat @gol
37 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
38 -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
39@@ -445,7 +445,7 @@
40 @gccoptlist{@var{object-file-name} -l@var{library} @gol
41 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
42 -s -static -static-libgcc -static-libstdc++ -shared @gol
43--shared-libgcc -symbolic @gol
44+-shared-libgcc -symbolic -nostdlib++ @gol
45 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
46 -u @var{symbol}}
47
48@@ -9438,6 +9438,11 @@
49 libc. These entry points should be supplied through some other
50 mechanism when this option is specified.
51
52+@item -nostdlib++
53+@opindex nostdlib++
54+Do not use the standard system C++ runtime libraries when linking.
55+Only the libraries you specify will be passed to the linker.
56+
57 @cindex @option{-lgcc}, use with @option{-nostdlib}
58 @cindex @option{-nostdlib} and unresolved references
59 @cindex unresolved references and @option{-nostdlib}
60Index: gcc-4_7-branch/gcc/c-family/c.opt
61===================================================================
62--- gcc-4_7-branch.orig/gcc/c-family/c.opt 2012-04-10 10:17:24.667330076 -0700
63+++ gcc-4_7-branch/gcc/c-family/c.opt 2012-04-10 10:37:49.483389340 -0700
64@@ -1171,6 +1171,10 @@
65 C++ ObjC++
66 Do not search standard system include directories for C++
67
68+nostdlib++
69+Driver
70+Do not link standard C++ runtime library
71+
72 o
73 C ObjC C++ ObjC++ Joined Separate
74 ; Documented in common.opt
75Index: gcc-4_7-branch/gcc/gcc.c
76===================================================================
77--- gcc-4_7-branch.orig/gcc/gcc.c 2012-04-10 10:37:09.343387385 -0700
78+++ gcc-4_7-branch/gcc/gcc.c 2012-04-10 10:37:49.487389409 -0700
79@@ -681,6 +681,7 @@
80 %(mflib) " STACK_SPLIT_SPEC "\
81 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
82 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
83+ %{!nostdlib++:}\
84 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
85 #endif
86
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/ppc_no_crtsavres.patch b/meta/recipes-devtools/gcc/gcc-4.7/ppc_no_crtsavres.patch
new file mode 100644
index 0000000000..92a5d9e176
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/ppc_no_crtsavres.patch
@@ -0,0 +1,72 @@
1Upstream-Status: Backport
2
3Signed-off-by: Khem Raj
4
5Source-url: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01362.html
6
7Currently, powerpc-linux gcc -Os -mno-multiple uses out-of-linux gpr
8save and restore functions when saving/restoring just one gpr. That's
9quite silly since the function call requires more instructions and is
10slower than an inline save/restore. The only case where it might win
11is when no fprs are restored and the restore function can tear down
12the frame and exit (also loading up lr on ppc64). I guess that's how
13GP_SAVE_INLINE came to be like it is, ie. it's optimised for the
14common case using ldm in the prologue and no fprs. Still, it isn't
15difficult to choose the best combination in all cases, but it does
16mean different logic is needed for restores. I could have implemented
17GP_RESTORE_INLINE and FP_RESORE_INLINE macros but it seemed simpler to
18just move everything into the one place the macros are invoked. AIX
19and Darwin register cutoff doesn't change with this patch.
20
21This patch also enables out-of-line restores in cases that were
22previously disabled due to using inline saves.
23
24Bootstrapped and regression tested powerpc-linux. OK to apply?
25
26 * aix.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
27 * darwin.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
28 * sysv4.h (FP_SAVE_INLINE, GP_SAVE_INLINE, V_SAVE_INLINE): Delete.
29 * config/rs6000/rs6000.c (V_SAVE_INLINE): Delete.
30 (rs6000_savres_strategy): Reimplement GP/FP/V_SAVE_INLINE logic.
31 For ELF targets, use out-of-line restores for -Os and any number
32 of regs if the restore exits, and out-of-line gp save for two or
33 more regs. Use save_reg_p to test for holes in reg restore set.
34 Replace "#if" with "if".
35
36Index: gcc-4_7-branch/gcc/config/rs6000/aix.h
37===================================================================
38--- gcc-4_7-branch.orig/gcc/config/rs6000/aix.h 2012-09-07 12:35:35.000000000 -0700
39+++ gcc-4_7-branch/gcc/config/rs6000/aix.h 2012-09-07 15:27:55.215290315 -0700
40@@ -207,11 +207,6 @@
41 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
42 { "link_libg", LINK_LIBG_SPEC }
43
44-/* Define cutoff for using external functions to save floating point. */
45-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
46-/* And similarly for general purpose registers. */
47-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
48-
49 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
50
51 /* No version of AIX fully supports AltiVec or 64-bit instructions in
52Index: gcc-4_7-branch/gcc/config/rs6000/darwin.h
53===================================================================
54--- gcc-4_7-branch.orig/gcc/config/rs6000/darwin.h 2012-09-07 12:35:35.000000000 -0700
55+++ gcc-4_7-branch/gcc/config/rs6000/darwin.h 2012-09-07 15:27:55.223290316 -0700
56@@ -173,16 +173,6 @@
57 (RS6000_ALIGN (crtl->outgoing_args_size, 16) \
58 + (STACK_POINTER_OFFSET))
59
60-/* Define cutoff for using out-of-line functions to save registers.
61- Currently on Darwin, we implement FP and GPR out-of-line-saves plus the
62- special routine for 'save everything'. */
63-
64-#undef FP_SAVE_INLINE
65-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 60 && (FIRST_REG) < 64)
66-
67-#undef GP_SAVE_INLINE
68-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 29 && (FIRST_REG) < 32)
69-
70 /* Darwin uses a function call if everything needs to be saved/restored. */
71
72 #undef WORLD_SAVE_P
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/ppc_with_cpu.patch b/meta/recipes-devtools/gcc/gcc-4.7/ppc_with_cpu.patch
new file mode 100644
index 0000000000..5ca12a6848
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/ppc_with_cpu.patch
@@ -0,0 +1,752 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From 7630308303ea21c318bd57c35590fc4f249a30d8 Mon Sep 17 00:00:00 2001
5From: hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
6Date: Wed, 16 May 2012 08:43:41 +0000
7Subject: [PATCH] * config/rs6000/rs6000-opts.h (enum processor_type):
8 Add PROCESSOR_PPC8548. *
9 config/rs6000/rs6000-cpus.def: Reference it for cpu="8548".
10 * config/rs6000/rs6000.md (cpu attribute
11 definition): Add ppc8548. * config/rs6000/8540.md:
12 indicate that the units/patterns apply to ppc8548
13 as well.
14
15 * config/rs6000/rs6000.c (rs6000_option_override_internal): Rename
16 default_cpu into implicit_cpu, conveying what --with-cpu was passed at
17 configure time. Treat implicit_cpu as have_CPU. Pick defaults for SPE
18 related flags, check that what is queried is supported by the selected
19 configuration. Rework the single/double_float and MASK_STRING resets to
20 hit for all the E500 cores (854x + E500MC variants). Select the ppc8540
21 costs for PROCESSOR_PPC8548 as well.
22 (rs6000_issue_rate): case CPU_PPC8548 together with CPU_PPC8540.
23 (rs6000_use_sched_lookahead): Likewise, rewriting function as a case
24 statement instead of a sequence of ifs.
25
26 * config/rs6000/rs6000.h (TARGET_E500): Remove.
27 (TARGET_NO_LWSYNC): Adjust accordingly.
28 * config/rs6000/e500.h (TARGET_E500): Remove.
29 (CHECK_E500_OPTIONS): Adjust accordingly.
30 * config/rs6000/eabispe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Remove.
31 (TARGET_DEFAULT): Reformat definition to match the one in linuxspe.h.
32 * config/rs6000/linuxspe.h: Likewise.
33 * config/rs6000/vxworks.h: Remove bogus TARGET_E500 overrides and
34 superfluous comments.
35 * config/rs6000/e500-double.h: Remove.
36
37 * config.gcc (pick a default with_cpu): For powerpc*-*-*spe*,
38 default to with_cpu=8548 if --enable-e500-double, and to 8540
39 otherwise.
40 (set misc flags section): For powerpc*|rs6000*, remove inclusion
41 of e500-double.h for --enable-e500-double.
42
43
44
45git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187581 138bc75d-0d04-0410-961f-82ee72b054a4
46---
47 gcc/ChangeLog | 37 +++++++++
48 gcc/config.gcc | 12 +--
49 gcc/config/rs6000/8540.md | 50 ++++++------
50 gcc/config/rs6000/e500-double.h | 24 ------
51 gcc/config/rs6000/e500.h | 10 +--
52 gcc/config/rs6000/eabispe.h | 17 +---
53 gcc/config/rs6000/linuxspe.h | 16 +---
54 gcc/config/rs6000/rs6000-cpus.def | 3 +-
55 gcc/config/rs6000/rs6000-opts.h | 1 +
56 gcc/config/rs6000/rs6000.c | 155 +++++++++++++++++++++++--------------
57 gcc/config/rs6000/rs6000.h | 7 +-
58 gcc/config/rs6000/rs6000.md | 2 +-
59 gcc/config/rs6000/rtems.h | 14 ----
60 gcc/config/rs6000/vxworks.h | 11 ---
61 14 files changed, 178 insertions(+), 181 deletions(-)
62
63Index: gcc-4_7-branch/gcc/config.gcc
64===================================================================
65--- gcc-4_7-branch.orig/gcc/config.gcc 2012-07-06 19:43:53.000000000 -0700
66+++ gcc-4_7-branch/gcc/config.gcc 2012-07-06 19:44:38.000000000 -0700
67@@ -2876,6 +2876,13 @@
68 mips*-*-vxworks)
69 with_arch=mips2
70 ;;
71+ powerpc*-*-*spe*)
72+ if test x$enable_e500_double = xyes; then
73+ with_cpu=8548
74+ else
75+ with_cpu=8540
76+ fi
77+ ;;
78 sparc-leon*-*)
79 with_cpu=v8;
80 ;;
81@@ -3564,11 +3571,6 @@
82 c_target_objs="${c_target_objs} rs6000-c.o"
83 cxx_target_objs="${cxx_target_objs} rs6000-c.o"
84 tmake_file="rs6000/t-rs6000 ${tmake_file}"
85-
86- if test x$enable_e500_double = xyes
87- then
88- tm_file="$tm_file rs6000/e500-double.h"
89- fi
90 ;;
91
92 sh[123456ble]*-*-* | sh-*-*)
93Index: gcc-4_7-branch/gcc/config/rs6000/8540.md
94===================================================================
95--- gcc-4_7-branch.orig/gcc/config/rs6000/8540.md 2012-07-05 23:49:07.000000000 -0700
96+++ gcc-4_7-branch/gcc/config/rs6000/8540.md 2012-07-06 19:44:38.466780001 -0700
97@@ -87,18 +87,18 @@
98 (and (eq_attr "type" "integer,insert_word,insert_dword,cmp,compare,\
99 delayed_compare,var_delayed_compare,fast_compare,\
100 shift,trap,var_shift_rotate,cntlz,exts,isel")
101- (eq_attr "cpu" "ppc8540"))
102+ (eq_attr "cpu" "ppc8540,ppc8548"))
103 "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
104
105 (define_insn_reservation "ppc8540_two" 1
106 (and (eq_attr "type" "two")
107- (eq_attr "cpu" "ppc8540"))
108+ (eq_attr "cpu" "ppc8540,ppc8548"))
109 "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire,\
110 ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
111
112 (define_insn_reservation "ppc8540_three" 1
113 (and (eq_attr "type" "three")
114- (eq_attr "cpu" "ppc8540"))
115+ (eq_attr "cpu" "ppc8540,ppc8548"))
116 "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire,\
117 ppc8540_issue+ppc8540_su_stage0+ppc8540_retire,\
118 ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
119@@ -106,13 +106,13 @@
120 ;; Branch. Actually this latency time is not used by the scheduler.
121 (define_insn_reservation "ppc8540_branch" 1
122 (and (eq_attr "type" "jmpreg,branch,isync")
123- (eq_attr "cpu" "ppc8540"))
124+ (eq_attr "cpu" "ppc8540,ppc8548"))
125 "ppc8540_decode,ppc8540_bu,ppc8540_retire")
126
127 ;; Multiply
128 (define_insn_reservation "ppc8540_multiply" 4
129 (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
130- (eq_attr "cpu" "ppc8540"))
131+ (eq_attr "cpu" "ppc8540,ppc8548"))
132 "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
133 ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
134
135@@ -122,57 +122,57 @@
136 ;; time.
137 (define_insn_reservation "ppc8540_divide" 14
138 (and (eq_attr "type" "idiv")
139- (eq_attr "cpu" "ppc8540"))
140+ (eq_attr "cpu" "ppc8540,ppc8548"))
141 "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0+ppc8540_mu_div,\
142 ppc8540_mu_div*13")
143
144 ;; CR logical
145 (define_insn_reservation "ppc8540_cr_logical" 1
146 (and (eq_attr "type" "cr_logical,delayed_cr")
147- (eq_attr "cpu" "ppc8540"))
148+ (eq_attr "cpu" "ppc8540,ppc8548"))
149 "ppc8540_decode,ppc8540_bu,ppc8540_retire")
150
151 ;; Mfcr
152 (define_insn_reservation "ppc8540_mfcr" 1
153 (and (eq_attr "type" "mfcr")
154- (eq_attr "cpu" "ppc8540"))
155+ (eq_attr "cpu" "ppc8540,ppc8548"))
156 "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
157
158 ;; Mtcrf
159 (define_insn_reservation "ppc8540_mtcrf" 1
160 (and (eq_attr "type" "mtcr")
161- (eq_attr "cpu" "ppc8540"))
162+ (eq_attr "cpu" "ppc8540,ppc8548"))
163 "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
164
165 ;; Mtjmpr
166 (define_insn_reservation "ppc8540_mtjmpr" 1
167 (and (eq_attr "type" "mtjmpr,mfjmpr")
168- (eq_attr "cpu" "ppc8540"))
169+ (eq_attr "cpu" "ppc8540,ppc8548"))
170 "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
171
172 ;; Loads
173 (define_insn_reservation "ppc8540_load" 3
174 (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
175 load_l,sync")
176- (eq_attr "cpu" "ppc8540"))
177+ (eq_attr "cpu" "ppc8540,ppc8548"))
178 "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
179
180 ;; Stores.
181 (define_insn_reservation "ppc8540_store" 3
182 (and (eq_attr "type" "store,store_ux,store_u,store_c")
183- (eq_attr "cpu" "ppc8540"))
184+ (eq_attr "cpu" "ppc8540,ppc8548"))
185 "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
186
187 ;; Simple FP
188 (define_insn_reservation "ppc8540_simple_float" 1
189 (and (eq_attr "type" "fpsimple")
190- (eq_attr "cpu" "ppc8540"))
191+ (eq_attr "cpu" "ppc8540,ppc8548"))
192 "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
193
194 ;; FP
195 (define_insn_reservation "ppc8540_float" 4
196 (and (eq_attr "type" "fp")
197- (eq_attr "cpu" "ppc8540"))
198+ (eq_attr "cpu" "ppc8540,ppc8548"))
199 "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
200 ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
201
202@@ -180,44 +180,44 @@
203 ;; because of the result automata will be huge.
204 (define_insn_reservation "ppc8540_float_vector_divide" 29
205 (and (eq_attr "type" "vecfdiv")
206- (eq_attr "cpu" "ppc8540"))
207+ (eq_attr "cpu" "ppc8540,ppc8548"))
208 "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0+ppc8540_mu_div,\
209 ppc8540_mu_div*28")
210
211 ;; Brinc
212 (define_insn_reservation "ppc8540_brinc" 1
213 (and (eq_attr "type" "brinc")
214- (eq_attr "cpu" "ppc8540"))
215+ (eq_attr "cpu" "ppc8540,ppc8548"))
216 "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
217
218 ;; Simple vector
219 (define_insn_reservation "ppc8540_simple_vector" 1
220 (and (eq_attr "type" "vecsimple")
221- (eq_attr "cpu" "ppc8540"))
222+ (eq_attr "cpu" "ppc8540,ppc8548"))
223 "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
224
225 ;; Simple vector compare
226 (define_insn_reservation "ppc8540_simple_vector_compare" 1
227 (and (eq_attr "type" "veccmpsimple")
228- (eq_attr "cpu" "ppc8540"))
229+ (eq_attr "cpu" "ppc8540,ppc8548"))
230 "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
231
232 ;; Vector compare
233 (define_insn_reservation "ppc8540_vector_compare" 1
234 (and (eq_attr "type" "veccmp")
235- (eq_attr "cpu" "ppc8540"))
236+ (eq_attr "cpu" "ppc8540,ppc8548"))
237 "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
238
239 ;; evsplatfi evsplati
240 (define_insn_reservation "ppc8540_vector_perm" 1
241 (and (eq_attr "type" "vecperm")
242- (eq_attr "cpu" "ppc8540"))
243+ (eq_attr "cpu" "ppc8540,ppc8548"))
244 "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
245
246 ;; Vector float
247 (define_insn_reservation "ppc8540_float_vector" 4
248 (and (eq_attr "type" "vecfloat")
249- (eq_attr "cpu" "ppc8540"))
250+ (eq_attr "cpu" "ppc8540,ppc8548"))
251 "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
252 ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
253
254@@ -226,25 +226,25 @@
255 ;; of miu_stage3 here because we use the average latency time.
256 (define_insn_reservation "ppc8540_vector_divide" 14
257 (and (eq_attr "type" "vecdiv")
258- (eq_attr "cpu" "ppc8540"))
259+ (eq_attr "cpu" "ppc8540,ppc8548"))
260 "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0+ppc8540_mu_div,\
261 ppc8540_mu_div*13")
262
263 ;; Complex vector.
264 (define_insn_reservation "ppc8540_complex_vector" 4
265 (and (eq_attr "type" "veccomplex")
266- (eq_attr "cpu" "ppc8540"))
267+ (eq_attr "cpu" "ppc8540,ppc8548"))
268 "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
269 ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
270
271 ;; Vector load
272 (define_insn_reservation "ppc8540_vector_load" 3
273 (and (eq_attr "type" "vecload")
274- (eq_attr "cpu" "ppc8540"))
275+ (eq_attr "cpu" "ppc8540,ppc8548"))
276 "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
277
278 ;; Vector store
279 (define_insn_reservation "ppc8540_vector_store" 3
280 (and (eq_attr "type" "vecstore")
281- (eq_attr "cpu" "ppc8540"))
282+ (eq_attr "cpu" "ppc8540,ppc8548"))
283 "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
284Index: gcc-4_7-branch/gcc/config/rs6000/e500-double.h
285===================================================================
286--- gcc-4_7-branch.orig/gcc/config/rs6000/e500-double.h 2012-07-05 23:49:07.000000000 -0700
287+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
288@@ -1,24 +0,0 @@
289-/* Target definitions for E500 with double precision FP.
290- Copyright (C) 2004, 2006, 2007, 2011 Free Software Foundation, Inc.
291- Contributed by Aldy Hernandez (aldyh@redhat.com).
292-
293- This file is part of GCC.
294-
295- GCC is free software; you can redistribute it and/or modify it
296- under the terms of the GNU General Public License as published
297- by the Free Software Foundation; either version 3, or (at your
298- option) any later version.
299-
300- GCC is distributed in the hope that it will be useful, but WITHOUT
301- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
302- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
303- License for more details.
304-
305- You should have received a copy of the GNU General Public License
306- along with GCC; see the file COPYING3. If not see
307- <http://www.gnu.org/licenses/>. */
308-
309-#undef SUB3TARGET_OVERRIDE_OPTIONS
310-#define SUB3TARGET_OVERRIDE_OPTIONS \
311- if (!global_options_set.x_rs6000_float_gprs) \
312- rs6000_float_gprs = 2;
313Index: gcc-4_7-branch/gcc/config/rs6000/e500.h
314===================================================================
315--- gcc-4_7-branch.orig/gcc/config/rs6000/e500.h 2012-07-05 23:49:07.000000000 -0700
316+++ gcc-4_7-branch/gcc/config/rs6000/e500.h 2012-07-06 19:44:38.466780001 -0700
317@@ -19,7 +19,6 @@
318
319 #undef TARGET_SPE_ABI
320 #undef TARGET_SPE
321-#undef TARGET_E500
322 #undef TARGET_FPRS
323 #undef TARGET_E500_SINGLE
324 #undef TARGET_E500_DOUBLE
325@@ -27,21 +26,20 @@
326
327 #define TARGET_SPE_ABI rs6000_spe_abi
328 #define TARGET_SPE rs6000_spe
329-#define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540)
330 #define TARGET_FPRS (rs6000_float_gprs == 0)
331 #define TARGET_E500_SINGLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 1)
332 #define TARGET_E500_DOUBLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 2)
333 #define CHECK_E500_OPTIONS \
334 do { \
335- if (TARGET_E500 || TARGET_SPE || TARGET_SPE_ABI \
336+ if (TARGET_SPE || TARGET_SPE_ABI \
337 || TARGET_E500_SINGLE || TARGET_E500_DOUBLE) \
338 { \
339 if (TARGET_ALTIVEC) \
340- error ("AltiVec and E500 instructions cannot coexist"); \
341+ error ("AltiVec and SPE instructions cannot coexist"); \
342 if (TARGET_VSX) \
343- error ("VSX and E500 instructions cannot coexist"); \
344+ error ("VSX and SPE instructions cannot coexist"); \
345 if (TARGET_64BIT) \
346- error ("64-bit E500 not supported"); \
347+ error ("64-bit SPE not supported"); \
348 if (TARGET_HARD_FLOAT && TARGET_FPRS) \
349 error ("E500 and FPRs not supported"); \
350 } \
351Index: gcc-4_7-branch/gcc/config/rs6000/eabispe.h
352===================================================================
353--- gcc-4_7-branch.orig/gcc/config/rs6000/eabispe.h 2012-07-05 23:49:07.000000000 -0700
354+++ gcc-4_7-branch/gcc/config/rs6000/eabispe.h 2012-07-06 19:44:38.466780001 -0700
355@@ -21,21 +21,8 @@
356 <http://www.gnu.org/licenses/>. */
357
358 #undef TARGET_DEFAULT
359-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI \
360- | MASK_STRICT_ALIGN)
361-
362-#undef SUBSUBTARGET_OVERRIDE_OPTIONS
363-#define SUBSUBTARGET_OVERRIDE_OPTIONS \
364- if (!global_options_set.x_rs6000_cpu_index) \
365- rs6000_cpu = PROCESSOR_PPC8540; \
366- if (!global_options_set.x_rs6000_spe_abi) \
367- rs6000_spe_abi = 1; \
368- if (!global_options_set.x_rs6000_float_gprs) \
369- rs6000_float_gprs = 1; \
370- if (!global_options_set.x_rs6000_spe) \
371- rs6000_spe = 1; \
372- if (target_flags & MASK_64BIT) \
373- error ("-m64 not supported in this configuration")
374+#define TARGET_DEFAULT \
375+ (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN | MASK_EABI)
376
377 #undef ASM_DEFAULT_SPEC
378 #define ASM_DEFAULT_SPEC "-mppc -mspe -me500"
379Index: gcc-4_7-branch/gcc/config/rs6000/linuxspe.h
380===================================================================
381--- gcc-4_7-branch.orig/gcc/config/rs6000/linuxspe.h 2012-07-05 23:52:14.000000000 -0700
382+++ gcc-4_7-branch/gcc/config/rs6000/linuxspe.h 2012-07-06 19:44:38.466780001 -0700
383@@ -22,20 +22,8 @@
384
385 /* Override rs6000.h and sysv4.h definition. */
386 #undef TARGET_DEFAULT
387-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN)
388-
389-#undef SUBSUBTARGET_OVERRIDE_OPTIONS
390-#define SUBSUBTARGET_OVERRIDE_OPTIONS \
391- if (!global_options_set.x_rs6000_cpu_index) \
392- rs6000_cpu = PROCESSOR_PPC8540; \
393- if (!global_options_set.x_rs6000_spe_abi) \
394- rs6000_spe_abi = 1; \
395- if (!global_options_set.x_rs6000_float_gprs) \
396- rs6000_float_gprs = 1; \
397- if (!global_options_set.x_rs6000_spe) \
398- rs6000_spe = 1; \
399- if (target_flags & MASK_64BIT) \
400- error ("-m64 not supported in this configuration")
401+#define TARGET_DEFAULT \
402+ (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN)
403
404 #undef ASM_DEFAULT_SPEC
405 #define ASM_DEFAULT_SPEC "-mppc -mspe -me500"
406Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def
407===================================================================
408--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:43:53.000000000 -0700
409+++ gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:44:38.000000000 -0700
410@@ -76,8 +76,7 @@
411 RS6000_CPU ("823", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT)
412 RS6000_CPU ("8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN
413 | MASK_ISEL)
414-/* 8548 has a dummy entry for now. */
415-RS6000_CPU ("8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN
416+RS6000_CPU ("8548", PROCESSOR_PPC8548, POWERPC_BASE_MASK | MASK_STRICT_ALIGN
417 | MASK_ISEL)
418 RS6000_CPU ("a2", PROCESSOR_PPCA2,
419 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_POPCNTB
420Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h
421===================================================================
422--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:43:53.000000000 -0700
423+++ gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:44:38.000000000 -0700
424@@ -49,6 +49,7 @@
425 PROCESSOR_PPC7400,
426 PROCESSOR_PPC7450,
427 PROCESSOR_PPC8540,
428+ PROCESSOR_PPC8548,
429 PROCESSOR_PPCE300C2,
430 PROCESSOR_PPCE300C3,
431 PROCESSOR_PPCE500MC,
432Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.c
433===================================================================
434--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.c 2012-07-06 19:43:53.194780001 -0700
435+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.c 2012-07-06 19:44:38.000000000 -0700
436@@ -2597,7 +2597,10 @@
437 {
438 bool ret = true;
439 bool have_cpu = false;
440- const char *default_cpu = OPTION_TARGET_CPU_DEFAULT;
441+
442+ /* The default cpu requested at configure time, if any. */
443+ const char *implicit_cpu = OPTION_TARGET_CPU_DEFAULT;
444+
445 int set_masks;
446 int cpu_index;
447 int tune_index;
448@@ -2616,11 +2619,6 @@
449 warning (0, "-malign-power is not supported for 64-bit Darwin;"
450 " it is incompatible with the installed C and C++ libraries");
451
452- if (global_options_set.x_rs6000_spe_abi
453- && rs6000_spe_abi
454- && !TARGET_SPE_ABI)
455- error ("not configured for SPE ABI");
456-
457 /* Numerous experiment shows that IRA based loop pressure
458 calculation works better for RTL loop invariant motion on targets
459 with enough (>= 32) registers. It is an expensive optimization.
460@@ -2656,7 +2654,8 @@
461 /* Process the -mcpu=<xxx> and -mtune=<xxx> argument. If the user changed
462 the cpu in a target attribute or pragma, but did not specify a tuning
463 option, use the cpu for the tuning option rather than the option specified
464- with -mtune on the command line. */
465+ with -mtune on the command line. Process a '--with-cpu' configuration
466+ request as an implicit --cpu. */
467 if (rs6000_cpu_index >= 0)
468 {
469 cpu_index = rs6000_cpu_index;
470@@ -2669,10 +2668,12 @@
471 }
472 else
473 {
474- if (!default_cpu)
475- default_cpu = (TARGET_POWERPC64 ? "powerpc64" : "powerpc");
476+ const char *default_cpu =
477+ (implicit_cpu ? implicit_cpu
478+ : (TARGET_POWERPC64 ? "powerpc64" : "powerpc"));
479
480 rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (default_cpu);
481+ have_cpu = implicit_cpu != 0;
482 }
483
484 gcc_assert (cpu_index >= 0);
485@@ -2703,6 +2704,42 @@
486 gcc_assert (tune_index >= 0);
487 rs6000_cpu = processor_target_table[tune_index].processor;
488
489+ /* Pick defaults for SPE related control flags. Do this early to make sure
490+ that the TARGET_ macros are representative ASAP. */
491+ {
492+ int spe_capable_cpu =
493+ (rs6000_cpu == PROCESSOR_PPC8540
494+ || rs6000_cpu == PROCESSOR_PPC8548);
495+
496+ if (!global_options_set.x_rs6000_spe_abi)
497+ rs6000_spe_abi = spe_capable_cpu;
498+
499+ if (!global_options_set.x_rs6000_spe)
500+ rs6000_spe = spe_capable_cpu;
501+
502+ if (!global_options_set.x_rs6000_float_gprs)
503+ rs6000_float_gprs =
504+ (rs6000_cpu == PROCESSOR_PPC8540 ? 1
505+ : rs6000_cpu == PROCESSOR_PPC8548 ? 2
506+ : 0);
507+ }
508+
509+ if (global_options_set.x_rs6000_spe_abi
510+ && rs6000_spe_abi
511+ && !TARGET_SPE_ABI)
512+ error ("not configured for SPE ABI");
513+
514+ if (global_options_set.x_rs6000_spe
515+ && rs6000_spe
516+ && !TARGET_SPE)
517+ error ("not configured for SPE instruction set");
518+
519+ if (main_target_opt != NULL
520+ && ((main_target_opt->x_rs6000_spe_abi != rs6000_spe_abi)
521+ || (main_target_opt->x_rs6000_spe != rs6000_spe)
522+ || (main_target_opt->x_rs6000_float_gprs != rs6000_float_gprs)))
523+ error ("target attribute or pragma changes SPE ABI");
524+
525 if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3
526 || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64)
527 {
528@@ -2938,35 +2975,44 @@
529 SUB3TARGET_OVERRIDE_OPTIONS;
530 #endif
531
532- if (TARGET_E500 || rs6000_cpu == PROCESSOR_PPCE500MC
533- || rs6000_cpu == PROCESSOR_PPCE500MC64)
534+ /* For the E500 family of cores, reset the single/double FP flags to let us
535+ check that they remain constant across attributes or pragmas. Also,
536+ clear a possible request for string instructions, not supported and which
537+ we might have silently queried above for -Os.
538+
539+ For other families, clear ISEL in case it was set implicitly.
540+ */
541+
542+ switch (rs6000_cpu)
543 {
544- /* The e500 and e500mc do not have string instructions, and we set
545- MASK_STRING above when optimizing for size. */
546- if ((target_flags & MASK_STRING) != 0)
547- target_flags = target_flags & ~MASK_STRING;
548- }
549- else if (global_options_set.x_rs6000_cpu_index)
550- {
551- /* For the powerpc-eabispe configuration, we set all these by
552- default, so let's unset them if we manually set another
553- CPU that is not the E500. */
554- if (main_target_opt != NULL
555- && ((main_target_opt->x_rs6000_spe_abi != rs6000_spe_abi)
556- || (main_target_opt->x_rs6000_spe != rs6000_spe)
557- || (main_target_opt->x_rs6000_float_gprs != rs6000_float_gprs)))
558- error ("target attribute or pragma changes SPE ABI");
559- else
560- {
561- if (!global_options_set.x_rs6000_spe_abi)
562- rs6000_spe_abi = 0;
563- if (!global_options_set.x_rs6000_spe)
564- rs6000_spe = 0;
565- if (!global_options_set.x_rs6000_float_gprs)
566- rs6000_float_gprs = 0;
567- }
568- if (!(target_flags_explicit & MASK_ISEL))
569+ case PROCESSOR_PPC8540:
570+ case PROCESSOR_PPC8548:
571+ case PROCESSOR_PPCE500MC:
572+ case PROCESSOR_PPCE500MC64:
573+
574+ rs6000_single_float = TARGET_E500_SINGLE || TARGET_E500_DOUBLE;
575+ rs6000_double_float = TARGET_E500_DOUBLE;
576+
577+ target_flags &= ~MASK_STRING;
578+
579+ break;
580+
581+ default:
582+
583+ if (have_cpu && !(target_flags_explicit & MASK_ISEL))
584 target_flags &= ~MASK_ISEL;
585+
586+ break;
587+ }
588+
589+ if (main_target_opt)
590+ {
591+ if (main_target_opt->x_rs6000_single_float != rs6000_single_float)
592+ error ("target attribute or pragma changes single precision floating "
593+ "point");
594+ if (main_target_opt->x_rs6000_double_float != rs6000_double_float)
595+ error ("target attribute or pragma changes double precision floating "
596+ "point");
597 }
598
599 /* Detect invalid option combinations with E500. */
600@@ -3193,6 +3239,7 @@
601 break;
602
603 case PROCESSOR_PPC8540:
604+ case PROCESSOR_PPC8548:
605 rs6000_cost = &ppc8540_cost;
606 break;
607
608@@ -3265,26 +3312,6 @@
609 && rs6000_single_float == 0 && rs6000_double_float == 0)
610 rs6000_single_float = rs6000_double_float = 1;
611
612- /* Reset single and double FP flags if target is E500. */
613- if (TARGET_E500)
614- {
615- rs6000_single_float = rs6000_double_float = 0;
616- if (TARGET_E500_SINGLE)
617- rs6000_single_float = 1;
618- if (TARGET_E500_DOUBLE)
619- rs6000_single_float = rs6000_double_float = 1;
620- }
621-
622- if (main_target_opt)
623- {
624- if (main_target_opt->x_rs6000_single_float != rs6000_single_float)
625- error ("target attribute or pragma changes single precision floating "
626- "point");
627- if (main_target_opt->x_rs6000_double_float != rs6000_double_float)
628- error ("target attribute or pragma changes double precision floating "
629- "point");
630- }
631-
632 /* If not explicitly specified via option, decide whether to generate indexed
633 load/store instructions. */
634 if (TARGET_AVOID_XFORM == -1)
635@@ -22816,6 +22843,7 @@
636 case CPU_PPC750:
637 case CPU_PPC7400:
638 case CPU_PPC8540:
639+ case CPU_PPC8548:
640 case CPU_CELL:
641 case CPU_PPCE300C2:
642 case CPU_PPCE300C3:
643@@ -22846,11 +22874,18 @@
644 static int
645 rs6000_use_sched_lookahead (void)
646 {
647- if (rs6000_cpu_attr == CPU_PPC8540)
648- return 4;
649- if (rs6000_cpu_attr == CPU_CELL)
650- return (reload_completed ? 8 : 0);
651- return 0;
652+ switch (rs6000_cpu_attr)
653+ {
654+ case CPU_PPC8540:
655+ case CPU_PPC8548:
656+ return 4;
657+
658+ case CPU_CELL:
659+ return (reload_completed ? 8 : 0);
660+
661+ default:
662+ return 0;
663+ }
664 }
665
666 /* We are choosing insn from the ready queue. Return nonzero if INSN can be chosen. */
667Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.h
668===================================================================
669--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.h 2012-07-06 19:43:53.000000000 -0700
670+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.h 2012-07-06 19:44:38.000000000 -0700
671@@ -457,7 +457,6 @@
672
673 #define TARGET_SPE_ABI 0
674 #define TARGET_SPE 0
675-#define TARGET_E500 0
676 #define TARGET_ISEL64 (TARGET_ISEL && TARGET_POWERPC64)
677 #define TARGET_FPRS 1
678 #define TARGET_E500_SINGLE 0
679@@ -500,11 +499,11 @@
680 || TARGET_ALTIVEC \
681 || TARGET_VSX)))
682
683+/* E500 cores only support plain "sync", not lwsync. */
684+#define TARGET_NO_LWSYNC (rs6000_cpu == PROCESSOR_PPC8540 \
685+ || rs6000_cpu == PROCESSOR_PPC8548)
686
687
688-/* E500 processors only support plain "sync", not lwsync. */
689-#define TARGET_NO_LWSYNC TARGET_E500
690-
691 /* Which machine supports the various reciprocal estimate instructions. */
692 #define TARGET_FRES (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \
693 && TARGET_FPRS && TARGET_SINGLE_FLOAT)
694Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.md
695===================================================================
696--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.md 2012-07-06 19:43:53.000000000 -0700
697+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.md 2012-07-06 19:44:38.000000000 -0700
698@@ -166,7 +166,7 @@
699 ;; Processor type -- this attribute must exactly match the processor_type
700 ;; enumeration in rs6000.h.
701
702-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
703+(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
704 (const (symbol_ref "rs6000_cpu_attr")))
705
706
707Index: gcc-4_7-branch/gcc/config/rs6000/rtems.h
708===================================================================
709--- gcc-4_7-branch.orig/gcc/config/rs6000/rtems.h 2012-07-05 23:49:07.000000000 -0700
710+++ gcc-4_7-branch/gcc/config/rs6000/rtems.h 2012-07-06 19:44:38.470780001 -0700
711@@ -55,17 +55,3 @@
712 #undef SUBSUBTARGET_EXTRA_SPECS
713 #define SUBSUBTARGET_EXTRA_SPECS \
714 { "cpp_os_rtems", CPP_OS_RTEMS_SPEC }
715-
716-#undef SUBSUBTARGET_OVERRIDE_OPTIONS
717-#define SUBSUBTARGET_OVERRIDE_OPTIONS \
718- do { \
719- if (TARGET_E500) \
720- { \
721- if (TARGET_HARD_FLOAT && !global_options_set.x_rs6000_float_gprs) \
722- rs6000_float_gprs = 1; \
723- if (rs6000_float_gprs != 0 && !global_options_set.x_rs6000_spe) \
724- rs6000_spe = 1; \
725- if (rs6000_spe && !global_options_set.x_rs6000_spe_abi) \
726- rs6000_spe_abi = 1; \
727- } \
728- } while(0)
729Index: gcc-4_7-branch/gcc/config/rs6000/vxworks.h
730===================================================================
731--- gcc-4_7-branch.orig/gcc/config/rs6000/vxworks.h 2012-07-05 23:49:07.000000000 -0700
732+++ gcc-4_7-branch/gcc/config/rs6000/vxworks.h 2012-07-06 19:44:38.470780001 -0700
733@@ -122,19 +122,8 @@
734
735 #undef ABI_STACK_BOUNDARY
736
737-/* Make -mcpu=8540 imply SPE. ISEL is automatically enabled, the
738- others must be done by hand. Handle -mrtp. Disable -fPIC
739- for -mrtp - the VxWorks PIC model is not compatible with it. */
740 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
741 #define SUBSUBTARGET_OVERRIDE_OPTIONS \
742- do { \
743- if (TARGET_E500) \
744- { \
745- rs6000_spe = 1; \
746- rs6000_spe_abi = 1; \
747- rs6000_float_gprs = 1; \
748- } \
749- \
750 if (!global_options_set.x_g_switch_value) \
751 g_switch_value = SDATA_DEFAULT_SIZE; \
752 VXWORKS_OVERRIDE_OPTIONS; \
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/ppce5500-e6500-support.patch b/meta/recipes-devtools/gcc/gcc-4.7/ppce5500-e6500-support.patch
new file mode 100644
index 0000000000..e3341fc0a6
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/ppce5500-e6500-support.patch
@@ -0,0 +1,713 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From b770074cee13445eba1bf4e99649c5ceac9a4b5a Mon Sep 17 00:00:00 2001
5From: edmarwjr <edmarwjr@138bc75d-0d04-0410-961f-82ee72b054a4>
6Date: Tue, 5 Jun 2012 16:05:16 +0000
7Subject: [PATCH] 2012-06-01 Edmar Wienskoski <edmar@freescale.com>
8
9 * config/rs6000/e5500.md: New file.
10 * config/rs6000/e6500.md: New file.
11 * config/rs6000/rs6000.c (processor_costs): Add new costs for
12 e5500 and e6500.
13 (rs6000_option_override_internal): Altivec and Spe options not
14 allowed with e5500. Spe options not allowed with e6500. Increase
15 move inline limit for e5500 and e6500. Disable string instructions
16 for e5500 and e6500. Enable branch targets alignment for e5500 and
17 e6500. Initialize rs6000_cost for e5500 and e6500.
18 (rs6000_adjust_cost): Add extra scheduling cycles between compare
19 and brnach for e5500 and e6500.
20 (rs6000_issue_rate): Set issue rate for e5500 and e6500.
21 * config/rs6000/rs6000-cpus.def: Add cpu definitions for e5500 and
22 e6500.
23 * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add e5500 and e6500.
24 * config/rs6000/rs6000.md (define_attr "cpu"): Add ppce5500 and
25 ppce6500.
26 Include e5500.md and e6500.md.
27 * config/rs6000/rs6000-opt.h (processor_type): Add
28 PROCESSOR_PPCE5500 and PROCESSOR_PPCE6500.
29 * config.gcc (cpu_is_64bit): Add new cores e5500, e6500.
30 (powerpc*-*-*): Add new cores e5500, e6500.
31 * doc/invoke.texi: (item -mcpu): Add e5500 and e6500 to list of cpus.
32
33gcc/testsuite
342012-06-01 Edmar Wienskoski <edmar@freescale.com>
35
36 * gcc.dg/tree-ssa/vector-3.c: Adjust regular expression.
37
38
39
40git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188244 138bc75d-0d04-0410-961f-82ee72b054a4
41---
42 gcc/ChangeLog | 26 ++++
43 gcc/config.gcc | 6 +-
44 gcc/config/rs6000/e5500.md | 176 ++++++++++++++++++++++++
45 gcc/config/rs6000/e6500.md | 213 ++++++++++++++++++++++++++++++
46 gcc/config/rs6000/rs6000-cpus.def | 4 +
47 gcc/config/rs6000/rs6000-opts.h | 2 +
48 gcc/config/rs6000/rs6000.c | 68 +++++++++-
49 gcc/config/rs6000/rs6000.h | 2 +
50 gcc/config/rs6000/rs6000.md | 4 +-
51 gcc/doc/invoke.texi | 12 +-
52 gcc/testsuite/ChangeLog | 4 +
53 gcc/testsuite/gcc.dg/tree-ssa/vector-3.c | 2 +-
54 12 files changed, 506 insertions(+), 13 deletions(-)
55 create mode 100644 gcc/config/rs6000/e5500.md
56 create mode 100644 gcc/config/rs6000/e6500.md
57
58Index: gcc-4_7-branch/gcc/config.gcc
59===================================================================
60--- gcc-4_7-branch.orig/gcc/config.gcc 2012-07-06 19:52:30.000000000 -0700
61+++ gcc-4_7-branch/gcc/config.gcc 2012-07-06 19:53:26.350779999 -0700
62@@ -413,7 +413,7 @@
63 extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
64 need_64bit_hwint=yes
65 case x$with_cpu in
66- xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell|xa2|xe500mc64)
67+ xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
68 cpu_is_64bit=yes
69 ;;
70 esac
71@@ -3361,8 +3361,8 @@
72 | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
73 | 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \
74 | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
75- | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | titan\
76- | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
77+ | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | e5500 | e6500 \
78+ | titan | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
79 # OK
80 ;;
81 *)
82Index: gcc-4_7-branch/gcc/config/rs6000/e5500.md
83===================================================================
84--- /dev/null 1970-01-01 00:00:00.000000000 +0000
85+++ gcc-4_7-branch/gcc/config/rs6000/e5500.md 2012-07-06 19:53:26.350779999 -0700
86@@ -0,0 +1,176 @@
87+;; Pipeline description for Freescale PowerPC e5500 core.
88+;; Copyright (C) 2012 Free Software Foundation, Inc.
89+;; Contributed by Edmar Wienskoski (edmar@freescale.com)
90+;;
91+;; This file is part of GCC.
92+;;
93+;; GCC is free software; you can redistribute it and/or modify it
94+;; under the terms of the GNU General Public License as published
95+;; by the Free Software Foundation; either version 3, or (at your
96+;; option) any later version.
97+;;
98+;; GCC is distributed in the hope that it will be useful, but WITHOUT
99+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
100+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
101+;; License for more details.
102+;;
103+;; You should have received a copy of the GNU General Public License
104+;; along with GCC; see the file COPYING3. If not see
105+;; <http://www.gnu.org/licenses/>.
106+;;
107+;; e5500 64-bit SFX(2), CFX, LSU, FPU, BU
108+;; Max issue 3 insns/clock cycle (includes 1 branch)
109+
110+(define_automaton "e5500_most,e5500_long")
111+(define_cpu_unit "e5500_decode_0,e5500_decode_1" "e5500_most")
112+
113+;; SFX.
114+(define_cpu_unit "e5500_sfx_0,e5500_sfx_1" "e5500_most")
115+
116+;; CFX.
117+(define_cpu_unit "e5500_cfx_stage0,e5500_cfx_stage1" "e5500_most")
118+
119+;; Non-pipelined division.
120+(define_cpu_unit "e5500_cfx_div" "e5500_long")
121+
122+;; LSU.
123+(define_cpu_unit "e5500_lsu" "e5500_most")
124+
125+;; FPU.
126+(define_cpu_unit "e5500_fpu" "e5500_long")
127+
128+;; BU.
129+(define_cpu_unit "e5500_bu" "e5500_most")
130+
131+;; The following units are used to make the automata deterministic.
132+(define_cpu_unit "present_e5500_decode_0" "e5500_most")
133+(define_cpu_unit "present_e5500_sfx_0" "e5500_most")
134+(presence_set "present_e5500_decode_0" "e5500_decode_0")
135+(presence_set "present_e5500_sfx_0" "e5500_sfx_0")
136+
137+;; Some useful abbreviations.
138+(define_reservation "e5500_decode"
139+ "e5500_decode_0|e5500_decode_1+present_e5500_decode_0")
140+(define_reservation "e5500_sfx"
141+ "e5500_sfx_0|e5500_sfx_1+present_e5500_sfx_0")
142+
143+;; SFX.
144+(define_insn_reservation "e5500_sfx" 1
145+ (and (eq_attr "type" "integer,insert_word,insert_dword,delayed_compare,\
146+ shift,cntlz,exts")
147+ (eq_attr "cpu" "ppce5500"))
148+ "e5500_decode,e5500_sfx")
149+
150+(define_insn_reservation "e5500_sfx2" 2
151+ (and (eq_attr "type" "cmp,compare,fast_compare,trap")
152+ (eq_attr "cpu" "ppce5500"))
153+ "e5500_decode,e5500_sfx")
154+
155+(define_insn_reservation "e5500_delayed" 2
156+ (and (eq_attr "type" "var_shift_rotate,var_delayed_compare")
157+ (eq_attr "cpu" "ppce5500"))
158+ "e5500_decode,e5500_sfx*2")
159+
160+(define_insn_reservation "e5500_two" 2
161+ (and (eq_attr "type" "two")
162+ (eq_attr "cpu" "ppce5500"))
163+ "e5500_decode,e5500_decode+e5500_sfx,e5500_sfx")
164+
165+(define_insn_reservation "e5500_three" 3
166+ (and (eq_attr "type" "three")
167+ (eq_attr "cpu" "ppce5500"))
168+ "e5500_decode,(e5500_decode+e5500_sfx)*2,e5500_sfx")
169+
170+;; SFX - Mfcr.
171+(define_insn_reservation "e5500_mfcr" 4
172+ (and (eq_attr "type" "mfcr")
173+ (eq_attr "cpu" "ppce5500"))
174+ "e5500_decode,e5500_sfx_0*4")
175+
176+;; SFX - Mtcrf.
177+(define_insn_reservation "e5500_mtcrf" 1
178+ (and (eq_attr "type" "mtcr")
179+ (eq_attr "cpu" "ppce5500"))
180+ "e5500_decode,e5500_sfx_0")
181+
182+;; SFX - Mtjmpr.
183+(define_insn_reservation "e5500_mtjmpr" 1
184+ (and (eq_attr "type" "mtjmpr,mfjmpr")
185+ (eq_attr "cpu" "ppce5500"))
186+ "e5500_decode,e5500_sfx")
187+
188+;; CFX - Multiply.
189+(define_insn_reservation "e5500_multiply" 4
190+ (and (eq_attr "type" "imul")
191+ (eq_attr "cpu" "ppce5500"))
192+ "e5500_decode,e5500_cfx_stage0,e5500_cfx_stage1")
193+
194+(define_insn_reservation "e5500_multiply_i" 5
195+ (and (eq_attr "type" "imul2,imul3,imul_compare")
196+ (eq_attr "cpu" "ppce5500"))
197+ "e5500_decode,e5500_cfx_stage0,\
198+ e5500_cfx_stage0+e5500_cfx_stage1,e5500_cfx_stage1")
199+
200+;; CFX - Divide.
201+(define_insn_reservation "e5500_divide" 16
202+ (and (eq_attr "type" "idiv")
203+ (eq_attr "cpu" "ppce5500"))
204+ "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
205+ e5500_cfx_div*15")
206+
207+(define_insn_reservation "e5500_divide_d" 26
208+ (and (eq_attr "type" "ldiv")
209+ (eq_attr "cpu" "ppce5500"))
210+ "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
211+ e5500_cfx_div*25")
212+
213+;; LSU - Loads.
214+(define_insn_reservation "e5500_load" 3
215+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
216+ load_l,sync")
217+ (eq_attr "cpu" "ppce5500"))
218+ "e5500_decode,e5500_lsu")
219+
220+(define_insn_reservation "e5500_fpload" 4
221+ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
222+ (eq_attr "cpu" "ppce5500"))
223+ "e5500_decode,e5500_lsu")
224+
225+;; LSU - Stores.
226+(define_insn_reservation "e5500_store" 3
227+ (and (eq_attr "type" "store,store_ux,store_u,store_c")
228+ (eq_attr "cpu" "ppce5500"))
229+ "e5500_decode,e5500_lsu")
230+
231+(define_insn_reservation "e5500_fpstore" 3
232+ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
233+ (eq_attr "cpu" "ppce5500"))
234+ "e5500_decode,e5500_lsu")
235+
236+;; FP.
237+(define_insn_reservation "e5500_float" 7
238+ (and (eq_attr "type" "fpsimple,fp,fpcompare,dmul")
239+ (eq_attr "cpu" "ppce5500"))
240+ "e5500_decode,e5500_fpu")
241+
242+(define_insn_reservation "e5500_sdiv" 20
243+ (and (eq_attr "type" "sdiv")
244+ (eq_attr "cpu" "ppce5500"))
245+ "e5500_decode,e5500_fpu*20")
246+
247+(define_insn_reservation "e5500_ddiv" 35
248+ (and (eq_attr "type" "ddiv")
249+ (eq_attr "cpu" "ppce5500"))
250+ "e5500_decode,e5500_fpu*35")
251+
252+;; BU.
253+(define_insn_reservation "e5500_branch" 1
254+ (and (eq_attr "type" "jmpreg,branch,isync")
255+ (eq_attr "cpu" "ppce5500"))
256+ "e5500_decode,e5500_bu")
257+
258+;; BU - CR logical.
259+(define_insn_reservation "e5500_cr_logical" 1
260+ (and (eq_attr "type" "cr_logical,delayed_cr")
261+ (eq_attr "cpu" "ppce5500"))
262+ "e5500_decode,e5500_bu")
263Index: gcc-4_7-branch/gcc/config/rs6000/e6500.md
264===================================================================
265--- /dev/null 1970-01-01 00:00:00.000000000 +0000
266+++ gcc-4_7-branch/gcc/config/rs6000/e6500.md 2012-07-06 19:53:26.354779999 -0700
267@@ -0,0 +1,213 @@
268+;; Pipeline description for Freescale PowerPC e6500 core.
269+;; Copyright (C) 2012 Free Software Foundation, Inc.
270+;; Contributed by Edmar Wienskoski (edmar@freescale.com)
271+;;
272+;; This file is part of GCC.
273+;;
274+;; GCC is free software; you can redistribute it and/or modify it
275+;; under the terms of the GNU General Public License as published
276+;; by the Free Software Foundation; either version 3, or (at your
277+;; option) any later version.
278+;;
279+;; GCC is distributed in the hope that it will be useful, but WITHOUT
280+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
281+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
282+;; License for more details.
283+;;
284+;; You should have received a copy of the GNU General Public License
285+;; along with GCC; see the file COPYING3. If not see
286+;; <http://www.gnu.org/licenses/>.
287+;;
288+;; e6500 64-bit SFX(2), CFX, LSU, FPU, BU, VSFX, VCFX, VFPU, VPERM
289+;; Max issue 3 insns/clock cycle (includes 1 branch)
290+
291+(define_automaton "e6500_most,e6500_long,e6500_vec")
292+(define_cpu_unit "e6500_decode_0,e6500_decode_1" "e6500_most")
293+
294+;; SFX.
295+(define_cpu_unit "e6500_sfx_0,e6500_sfx_1" "e6500_most")
296+
297+;; CFX.
298+(define_cpu_unit "e6500_cfx_stage0,e6500_cfx_stage1" "e6500_most")
299+
300+;; Non-pipelined division.
301+(define_cpu_unit "e6500_cfx_div" "e6500_long")
302+
303+;; LSU.
304+(define_cpu_unit "e6500_lsu" "e6500_most")
305+
306+;; FPU.
307+(define_cpu_unit "e6500_fpu" "e6500_long")
308+
309+;; BU.
310+(define_cpu_unit "e6500_bu" "e6500_most")
311+
312+;; Altivec unit
313+(define_cpu_unit "e6500_vec,e6500_vecperm" "e6500_vec")
314+
315+;; The following units are used to make the automata deterministic.
316+(define_cpu_unit "present_e6500_decode_0" "e6500_most")
317+(define_cpu_unit "present_e6500_sfx_0" "e6500_most")
318+(presence_set "present_e6500_decode_0" "e6500_decode_0")
319+(presence_set "present_e6500_sfx_0" "e6500_sfx_0")
320+
321+;; Some useful abbreviations.
322+(define_reservation "e6500_decode"
323+ "e6500_decode_0|e6500_decode_1+present_e6500_decode_0")
324+(define_reservation "e6500_sfx"
325+ "e6500_sfx_0|e6500_sfx_1+present_e6500_sfx_0")
326+
327+;; SFX.
328+(define_insn_reservation "e6500_sfx" 1
329+ (and (eq_attr "type" "integer,insert_word,insert_dword,delayed_compare,\
330+ shift,cntlz,exts")
331+ (eq_attr "cpu" "ppce6500"))
332+ "e6500_decode,e6500_sfx")
333+
334+(define_insn_reservation "e6500_sfx2" 2
335+ (and (eq_attr "type" "cmp,compare,fast_compare,trap")
336+ (eq_attr "cpu" "ppce6500"))
337+ "e6500_decode,e6500_sfx")
338+
339+(define_insn_reservation "e6500_delayed" 2
340+ (and (eq_attr "type" "var_shift_rotate,var_delayed_compare")
341+ (eq_attr "cpu" "ppce6500"))
342+ "e6500_decode,e6500_sfx*2")
343+
344+(define_insn_reservation "e6500_two" 2
345+ (and (eq_attr "type" "two")
346+ (eq_attr "cpu" "ppce6500"))
347+ "e6500_decode,e6500_decode+e6500_sfx,e6500_sfx")
348+
349+(define_insn_reservation "e6500_three" 3
350+ (and (eq_attr "type" "three")
351+ (eq_attr "cpu" "ppce6500"))
352+ "e6500_decode,(e6500_decode+e6500_sfx)*2,e6500_sfx")
353+
354+;; SFX - Mfcr.
355+(define_insn_reservation "e6500_mfcr" 4
356+ (and (eq_attr "type" "mfcr")
357+ (eq_attr "cpu" "ppce6500"))
358+ "e6500_decode,e6500_sfx_0*4")
359+
360+;; SFX - Mtcrf.
361+(define_insn_reservation "e6500_mtcrf" 1
362+ (and (eq_attr "type" "mtcr")
363+ (eq_attr "cpu" "ppce6500"))
364+ "e6500_decode,e6500_sfx_0")
365+
366+;; SFX - Mtjmpr.
367+(define_insn_reservation "e6500_mtjmpr" 1
368+ (and (eq_attr "type" "mtjmpr,mfjmpr")
369+ (eq_attr "cpu" "ppce6500"))
370+ "e6500_decode,e6500_sfx")
371+
372+;; CFX - Multiply.
373+(define_insn_reservation "e6500_multiply" 4
374+ (and (eq_attr "type" "imul")
375+ (eq_attr "cpu" "ppce6500"))
376+ "e6500_decode,e6500_cfx_stage0,e6500_cfx_stage1")
377+
378+(define_insn_reservation "e6500_multiply_i" 5
379+ (and (eq_attr "type" "imul2,imul3,imul_compare")
380+ (eq_attr "cpu" "ppce6500"))
381+ "e6500_decode,e6500_cfx_stage0,\
382+ e6500_cfx_stage0+e6500_cfx_stage1,e6500_cfx_stage1")
383+
384+;; CFX - Divide.
385+(define_insn_reservation "e6500_divide" 16
386+ (and (eq_attr "type" "idiv")
387+ (eq_attr "cpu" "ppce6500"))
388+ "e6500_decode,e6500_cfx_stage0+e6500_cfx_div,\
389+ e6500_cfx_div*15")
390+
391+(define_insn_reservation "e6500_divide_d" 26
392+ (and (eq_attr "type" "ldiv")
393+ (eq_attr "cpu" "ppce6500"))
394+ "e6500_decode,e6500_cfx_stage0+e6500_cfx_div,\
395+ e6500_cfx_div*25")
396+
397+;; LSU - Loads.
398+(define_insn_reservation "e6500_load" 3
399+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
400+ load_l,sync")
401+ (eq_attr "cpu" "ppce6500"))
402+ "e6500_decode,e6500_lsu")
403+
404+(define_insn_reservation "e6500_fpload" 4
405+ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
406+ (eq_attr "cpu" "ppce6500"))
407+ "e6500_decode,e6500_lsu")
408+
409+(define_insn_reservation "e6500_vecload" 4
410+ (and (eq_attr "type" "vecload")
411+ (eq_attr "cpu" "ppce6500"))
412+ "e6500_decode,e6500_lsu")
413+
414+;; LSU - Stores.
415+(define_insn_reservation "e6500_store" 3
416+ (and (eq_attr "type" "store,store_ux,store_u,store_c")
417+ (eq_attr "cpu" "ppce6500"))
418+ "e6500_decode,e6500_lsu")
419+
420+(define_insn_reservation "e6500_fpstore" 3
421+ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
422+ (eq_attr "cpu" "ppce6500"))
423+ "e6500_decode,e6500_lsu")
424+
425+(define_insn_reservation "e6500_vecstore" 4
426+ (and (eq_attr "type" "vecstore")
427+ (eq_attr "cpu" "ppce6500"))
428+ "e6500_decode,e6500_lsu")
429+
430+;; FP.
431+(define_insn_reservation "e6500_float" 7
432+ (and (eq_attr "type" "fpsimple,fp,fpcompare,dmul")
433+ (eq_attr "cpu" "ppce6500"))
434+ "e6500_decode,e6500_fpu")
435+
436+(define_insn_reservation "e6500_sdiv" 20
437+ (and (eq_attr "type" "sdiv")
438+ (eq_attr "cpu" "ppce6500"))
439+ "e6500_decode,e6500_fpu*20")
440+
441+(define_insn_reservation "e6500_ddiv" 35
442+ (and (eq_attr "type" "ddiv")
443+ (eq_attr "cpu" "ppce6500"))
444+ "e6500_decode,e6500_fpu*35")
445+
446+;; BU.
447+(define_insn_reservation "e6500_branch" 1
448+ (and (eq_attr "type" "jmpreg,branch,isync")
449+ (eq_attr "cpu" "ppce6500"))
450+ "e6500_decode,e6500_bu")
451+
452+;; BU - CR logical.
453+(define_insn_reservation "e6500_cr_logical" 1
454+ (and (eq_attr "type" "cr_logical,delayed_cr")
455+ (eq_attr "cpu" "ppce6500"))
456+ "e6500_decode,e6500_bu")
457+
458+;; VSFX.
459+(define_insn_reservation "e6500_vecsimple" 1
460+ (and (eq_attr "type" "vecsimple,veccmp")
461+ (eq_attr "cpu" "ppce6500"))
462+ "e6500_decode,e6500_vec")
463+
464+;; VCFX.
465+(define_insn_reservation "e6500_veccomplex" 4
466+ (and (eq_attr "type" "veccomplex")
467+ (eq_attr "cpu" "ppce6500"))
468+ "e6500_decode,e6500_vec")
469+
470+;; VFPU.
471+(define_insn_reservation "e6500_vecfloat" 6
472+ (and (eq_attr "type" "vecfloat")
473+ (eq_attr "cpu" "ppce6500"))
474+ "e6500_decode,e6500_vec")
475+
476+;; VPERM.
477+(define_insn_reservation "e6500_vecperm" 2
478+ (and (eq_attr "type" "vecperm")
479+ (eq_attr "cpu" "ppce6500"))
480+ "e6500_decode,e6500_vecperm")
481Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def
482===================================================================
483--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:52:30.000000000 -0700
484+++ gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:53:26.354779999 -0700
485@@ -87,6 +87,10 @@
486 | MASK_ISEL)
487 RS6000_CPU ("e500mc64", PROCESSOR_PPCE500MC64,
488 POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT | MASK_ISEL)
489+RS6000_CPU ("e5500", PROCESSOR_PPCE5500, POWERPC_BASE_MASK | MASK_POWERPC64
490+ | MASK_PPC_GFXOPT | MASK_ISEL)
491+RS6000_CPU ("e6500", PROCESSOR_PPCE6500, POWERPC_7400_MASK | MASK_POWERPC64
492+ | MASK_MFCRF | MASK_ISEL)
493 RS6000_CPU ("860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT)
494 RS6000_CPU ("970", PROCESSOR_POWER4,
495 POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64)
496Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h
497===================================================================
498--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:52:30.000000000 -0700
499+++ gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:53:26.354779999 -0700
500@@ -54,6 +54,8 @@
501 PROCESSOR_PPCE300C3,
502 PROCESSOR_PPCE500MC,
503 PROCESSOR_PPCE500MC64,
504+ PROCESSOR_PPCE5500,
505+ PROCESSOR_PPCE6500,
506 PROCESSOR_POWER4,
507 PROCESSOR_POWER5,
508 PROCESSOR_POWER6,
509Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.c
510===================================================================
511--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.c 2012-07-06 19:52:30.000000000 -0700
512+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.c 2012-07-06 19:53:26.354779999 -0700
513@@ -755,6 +755,44 @@
514 1, /* prefetch streams /*/
515 };
516
517+/* Instruction costs on PPCE5500 processors. */
518+static const
519+struct processor_costs ppce5500_cost = {
520+ COSTS_N_INSNS (5), /* mulsi */
521+ COSTS_N_INSNS (5), /* mulsi_const */
522+ COSTS_N_INSNS (4), /* mulsi_const9 */
523+ COSTS_N_INSNS (5), /* muldi */
524+ COSTS_N_INSNS (14), /* divsi */
525+ COSTS_N_INSNS (14), /* divdi */
526+ COSTS_N_INSNS (7), /* fp */
527+ COSTS_N_INSNS (10), /* dmul */
528+ COSTS_N_INSNS (36), /* sdiv */
529+ COSTS_N_INSNS (66), /* ddiv */
530+ 64, /* cache line size */
531+ 32, /* l1 cache */
532+ 128, /* l2 cache */
533+ 1, /* prefetch streams /*/
534+};
535+
536+/* Instruction costs on PPCE6500 processors. */
537+static const
538+struct processor_costs ppce6500_cost = {
539+ COSTS_N_INSNS (5), /* mulsi */
540+ COSTS_N_INSNS (5), /* mulsi_const */
541+ COSTS_N_INSNS (4), /* mulsi_const9 */
542+ COSTS_N_INSNS (5), /* muldi */
543+ COSTS_N_INSNS (14), /* divsi */
544+ COSTS_N_INSNS (14), /* divdi */
545+ COSTS_N_INSNS (7), /* fp */
546+ COSTS_N_INSNS (10), /* dmul */
547+ COSTS_N_INSNS (36), /* sdiv */
548+ COSTS_N_INSNS (66), /* ddiv */
549+ 64, /* cache line size */
550+ 32, /* l1 cache */
551+ 128, /* l2 cache */
552+ 1, /* prefetch streams /*/
553+};
554+
555 /* Instruction costs on AppliedMicro Titan processors. */
556 static const
557 struct processor_costs titan_cost = {
558@@ -2741,13 +2779,19 @@
559 error ("target attribute or pragma changes SPE ABI");
560
561 if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3
562- || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64)
563+ || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64
564+ || rs6000_cpu == PROCESSOR_PPCE5500)
565 {
566 if (TARGET_ALTIVEC)
567 error ("AltiVec not supported in this target");
568 if (TARGET_SPE)
569 error ("SPE not supported in this target");
570 }
571+ if (rs6000_cpu == PROCESSOR_PPCE6500)
572+ {
573+ if (TARGET_SPE)
574+ error ("SPE not supported in this target");
575+ }
576
577 /* Disable Cell microcode if we are optimizing for the Cell
578 and not optimizing for size. */
579@@ -2842,7 +2886,9 @@
580 user's opinion, though. */
581 if (rs6000_block_move_inline_limit == 0
582 && (rs6000_cpu == PROCESSOR_PPCE500MC
583- || rs6000_cpu == PROCESSOR_PPCE500MC64))
584+ || rs6000_cpu == PROCESSOR_PPCE500MC64
585+ || rs6000_cpu == PROCESSOR_PPCE5500
586+ || rs6000_cpu == PROCESSOR_PPCE6500))
587 rs6000_block_move_inline_limit = 128;
588
589 /* store_one_arg depends on expand_block_move to handle at least the
590@@ -2989,6 +3035,8 @@
591 case PROCESSOR_PPC8548:
592 case PROCESSOR_PPCE500MC:
593 case PROCESSOR_PPCE500MC64:
594+ case PROCESSOR_PPCE5500:
595+ case PROCESSOR_PPCE6500:
596
597 rs6000_single_float = TARGET_E500_SINGLE || TARGET_E500_DOUBLE;
598 rs6000_double_float = TARGET_E500_DOUBLE;
599@@ -3033,7 +3081,9 @@
600 || rs6000_cpu == PROCESSOR_POWER6
601 || rs6000_cpu == PROCESSOR_POWER7
602 || rs6000_cpu == PROCESSOR_PPCE500MC
603- || rs6000_cpu == PROCESSOR_PPCE500MC64);
604+ || rs6000_cpu == PROCESSOR_PPCE500MC64
605+ || rs6000_cpu == PROCESSOR_PPCE5500
606+ || rs6000_cpu == PROCESSOR_PPCE6500);
607
608 /* Allow debug switches to override the above settings. These are set to -1
609 in rs6000.opt to indicate the user hasn't directly set the switch. */
610@@ -3256,6 +3306,14 @@
611 rs6000_cost = &ppce500mc64_cost;
612 break;
613
614+ case PROCESSOR_PPCE5500:
615+ rs6000_cost = &ppce5500_cost;
616+ break;
617+
618+ case PROCESSOR_PPCE6500:
619+ rs6000_cost = &ppce6500_cost;
620+ break;
621+
622 case PROCESSOR_TITAN:
623 rs6000_cost = &titan_cost;
624 break;
625@@ -22304,6 +22362,8 @@
626 || rs6000_cpu_attr == CPU_PPC750
627 || rs6000_cpu_attr == CPU_PPC7400
628 || rs6000_cpu_attr == CPU_PPC7450
629+ || rs6000_cpu_attr == CPU_PPCE5500
630+ || rs6000_cpu_attr == CPU_PPCE6500
631 || rs6000_cpu_attr == CPU_POWER4
632 || rs6000_cpu_attr == CPU_POWER5
633 || rs6000_cpu_attr == CPU_POWER7
634@@ -22849,6 +22909,8 @@
635 case CPU_PPCE300C3:
636 case CPU_PPCE500MC:
637 case CPU_PPCE500MC64:
638+ case CPU_PPCE5500:
639+ case CPU_PPCE6500:
640 case CPU_TITAN:
641 return 2;
642 case CPU_RIOS2:
643Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.h
644===================================================================
645--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.h 2012-07-06 19:52:30.000000000 -0700
646+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.h 2012-07-06 19:53:26.358779999 -0700
647@@ -168,6 +168,8 @@
648 %{mcpu=e300c3: -me300} \
649 %{mcpu=e500mc: -me500mc} \
650 %{mcpu=e500mc64: -me500mc64} \
651+%{mcpu=e5500: -me5500} \
652+%{mcpu=e6500: -me6500} \
653 %{maltivec: -maltivec} \
654 %{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \
655 -many"
656Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.md
657===================================================================
658--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.md 2012-07-06 19:52:32.000000000 -0700
659+++ gcc-4_7-branch/gcc/config/rs6000/rs6000.md 2012-07-06 19:53:26.358779999 -0700
660@@ -166,7 +166,7 @@
661 ;; Processor type -- this attribute must exactly match the processor_type
662 ;; enumeration in rs6000.h.
663
664-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
665+(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan"
666 (const (symbol_ref "rs6000_cpu_attr")))
667
668
669@@ -194,6 +194,8 @@
670 (include "e300c2c3.md")
671 (include "e500mc.md")
672 (include "e500mc64.md")
673+(include "e5500.md")
674+(include "e6500.md")
675 (include "power4.md")
676 (include "power5.md")
677 (include "power6.md")
678Index: gcc-4_7-branch/gcc/doc/invoke.texi
679===================================================================
680--- gcc-4_7-branch.orig/gcc/doc/invoke.texi 2012-07-06 19:43:53.000000000 -0700
681+++ gcc-4_7-branch/gcc/doc/invoke.texi 2012-07-06 19:53:26.362779999 -0700
682@@ -16565,11 +16565,13 @@
683 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
684 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
685 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
686-@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
687-@samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
688-@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
689-@samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
690-@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
691+@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
692+@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
693+@samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
694+@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
695+@samp{power6x}, @samp{power7}, @samp{common}, @samp{powerpc},
696+@samp{powerpc64}, @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc},
697+and @samp{rs64}.
698
699 @option{-mcpu=common} selects a completely generic processor. Code
700 generated under this option will run on any POWER or PowerPC processor.
701Index: gcc-4_7-branch/gcc/testsuite/gcc.dg/tree-ssa/vector-3.c
702===================================================================
703--- gcc-4_7-branch.orig/gcc/testsuite/gcc.dg/tree-ssa/vector-3.c 2012-07-06 19:43:53.000000000 -0700
704+++ gcc-4_7-branch/gcc/testsuite/gcc.dg/tree-ssa/vector-3.c 2012-07-06 19:53:26.362779999 -0700
705@@ -14,7 +14,7 @@
706
707 /* We should be able to optimize this to just "return 0.0;" */
708 /* { dg-final { scan-tree-dump-times "BIT_FIELD_REF" 0 "optimized"} } */
709-/* { dg-final { scan-tree-dump-times "0.0" 1 "optimized"} } */
710+/* { dg-final { scan-tree-dump-times "0\\\.0" 1 "optimized"} } */
711
712 /* { dg-final { cleanup-tree-dump "optimized" } } */
713
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch b/meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch
new file mode 100644
index 0000000000..bea2063049
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/pr32219.patch
@@ -0,0 +1,72 @@
1Upstream-Status:Backport
2Hi,
3
4As suggested by richi.
5regtested on i686-linux-gnu with all default languages and no regressions.
6Ok for trunk?
7
8gcc/ChangeLog
92010-03-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10
11 PR target/32219
12 * varasm.c (default_binds_local_p_1): Weak data is not local.
13
14gcc/testsuite/ChangeLog
152010-03-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
16
17 PR target/32219
18 * gcc.dg/visibility-21.c: New test.
19
20Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
21---
22 gcc/testsuite/gcc.dg/visibility-21.c | 14 ++++++++++++++
23 gcc/varasm.c | 8 ++++----
24 2 files changed, 18 insertions(+), 4 deletions(-)
25 create mode 100644 gcc/testsuite/gcc.dg/visibility-21.c
26
27Index: gcc-4_7-branch/gcc/testsuite/gcc.dg/visibility-21.c
28===================================================================
29--- /dev/null 1970-01-01 00:00:00.000000000 +0000
30+++ gcc-4_7-branch/gcc/testsuite/gcc.dg/visibility-21.c 2012-04-10 10:39:38.083396738 -0700
31@@ -0,0 +1,14 @@
32+/* PR target/32219 */
33+/* { dg-do run } */
34+/* { dg-require-visibility "" } */
35+/* { dg-options "-fPIC" { target fpic } } */
36+
37+extern void f() __attribute__((weak,visibility("hidden")));
38+extern int puts( char const* );
39+int main()
40+{
41+ if (f)
42+ f();
43+ return 0;
44+}
45+
46Index: gcc-4_7-branch/gcc/varasm.c
47===================================================================
48--- gcc-4_7-branch.orig/gcc/varasm.c 2012-04-10 10:17:24.127330049 -0700
49+++ gcc-4_7-branch/gcc/varasm.c 2012-04-10 10:39:38.087396414 -0700
50@@ -6937,6 +6937,10 @@
51 /* Static variables are always local. */
52 else if (! TREE_PUBLIC (exp))
53 local_p = true;
54+ /* hidden weak can't be overridden by something non-local, all
55+ that is possible is that it is not defined at all. */
56+ else if (DECL_WEAK (exp))
57+ local_p = false;
58 /* A variable is local if the user has said explicitly that it will
59 be. */
60 else if ((DECL_VISIBILITY_SPECIFIED (exp)
61@@ -6950,11 +6954,6 @@
62 local. */
63 else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
64 local_p = true;
65- /* Default visibility weak data can be overridden by a strong symbol
66- in another module and so are not local. */
67- else if (DECL_WEAK (exp)
68- && !resolved_locally)
69- local_p = false;
70 /* If PIC, then assume that any global name can be overridden by
71 symbols resolved from other modules. */
72 else if (shlib)
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/rs6000-tables.patch b/meta/recipes-devtools/gcc/gcc-4.7/rs6000-tables.patch
new file mode 100644
index 0000000000..5b8064b02d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/rs6000-tables.patch
@@ -0,0 +1,135 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From 98da658b6944d0bf54beb10001e567d8b8922666 Mon Sep 17 00:00:00 2001
5From: edmarwjr <edmarwjr@138bc75d-0d04-0410-961f-82ee72b054a4>
6Date: Wed, 6 Jun 2012 18:09:18 +0000
7Subject: [PATCH] 2012-06-06 Edmar Wienskoski <edmar@freescale.com>
8
9 * config/rs6000/rs6000-tables.opt: Regenerated.
10
11
12
13git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188274 138bc75d-0d04-0410-961f-82ee72b054a4
14---
15 gcc/ChangeLog | 4 +++
16 gcc/config/rs6000/rs6000-tables.opt | 58 +++++++++++++++++++----------------
17 2 files changed, 36 insertions(+), 26 deletions(-)
18
19Index: git/gcc/config/rs6000/rs6000-tables.opt
20===================================================================
21--- git.orig/gcc/config/rs6000/rs6000-tables.opt 2012-07-06 20:54:29.000000000 -0700
22+++ git/gcc/config/rs6000/rs6000-tables.opt 2012-07-06 20:58:12.436646819 -0700
23@@ -126,80 +126,86 @@
24 Enum(rs6000_cpu_opt_value) String(e500mc64) Value(32)
25
26 EnumValue
27-Enum(rs6000_cpu_opt_value) String(860) Value(33)
28+Enum(rs6000_cpu_opt_value) String(e5500) Value(33)
29
30 EnumValue
31-Enum(rs6000_cpu_opt_value) String(970) Value(34)
32+Enum(rs6000_cpu_opt_value) String(e6500) Value(34)
33
34 EnumValue
35-Enum(rs6000_cpu_opt_value) String(cell) Value(35)
36+Enum(rs6000_cpu_opt_value) String(860) Value(35)
37
38 EnumValue
39-Enum(rs6000_cpu_opt_value) String(common) Value(36)
40+Enum(rs6000_cpu_opt_value) String(970) Value(36)
41
42 EnumValue
43-Enum(rs6000_cpu_opt_value) String(ec603e) Value(37)
44+Enum(rs6000_cpu_opt_value) String(cell) Value(37)
45
46 EnumValue
47-Enum(rs6000_cpu_opt_value) String(G3) Value(38)
48+Enum(rs6000_cpu_opt_value) String(common) Value(38)
49
50 EnumValue
51-Enum(rs6000_cpu_opt_value) String(G4) Value(39)
52+Enum(rs6000_cpu_opt_value) String(ec603e) Value(39)
53
54 EnumValue
55-Enum(rs6000_cpu_opt_value) String(G5) Value(40)
56+Enum(rs6000_cpu_opt_value) String(G3) Value(40)
57
58 EnumValue
59-Enum(rs6000_cpu_opt_value) String(titan) Value(41)
60+Enum(rs6000_cpu_opt_value) String(G4) Value(41)
61
62 EnumValue
63-Enum(rs6000_cpu_opt_value) String(power) Value(42)
64+Enum(rs6000_cpu_opt_value) String(G5) Value(42)
65
66 EnumValue
67-Enum(rs6000_cpu_opt_value) String(power2) Value(43)
68+Enum(rs6000_cpu_opt_value) String(titan) Value(43)
69
70 EnumValue
71-Enum(rs6000_cpu_opt_value) String(power3) Value(44)
72+Enum(rs6000_cpu_opt_value) String(power) Value(44)
73
74 EnumValue
75-Enum(rs6000_cpu_opt_value) String(power4) Value(45)
76+Enum(rs6000_cpu_opt_value) String(power2) Value(45)
77
78 EnumValue
79-Enum(rs6000_cpu_opt_value) String(power5) Value(46)
80+Enum(rs6000_cpu_opt_value) String(power3) Value(46)
81
82 EnumValue
83-Enum(rs6000_cpu_opt_value) String(power5+) Value(47)
84+Enum(rs6000_cpu_opt_value) String(power4) Value(47)
85
86 EnumValue
87-Enum(rs6000_cpu_opt_value) String(power6) Value(48)
88+Enum(rs6000_cpu_opt_value) String(power5) Value(48)
89
90 EnumValue
91-Enum(rs6000_cpu_opt_value) String(power6x) Value(49)
92+Enum(rs6000_cpu_opt_value) String(power5+) Value(49)
93
94 EnumValue
95-Enum(rs6000_cpu_opt_value) String(power7) Value(50)
96+Enum(rs6000_cpu_opt_value) String(power6) Value(50)
97
98 EnumValue
99-Enum(rs6000_cpu_opt_value) String(powerpc) Value(51)
100+Enum(rs6000_cpu_opt_value) String(power6x) Value(51)
101
102 EnumValue
103-Enum(rs6000_cpu_opt_value) String(powerpc64) Value(52)
104+Enum(rs6000_cpu_opt_value) String(power7) Value(52)
105
106 EnumValue
107-Enum(rs6000_cpu_opt_value) String(rios) Value(53)
108+Enum(rs6000_cpu_opt_value) String(powerpc) Value(53)
109
110 EnumValue
111-Enum(rs6000_cpu_opt_value) String(rios1) Value(54)
112+Enum(rs6000_cpu_opt_value) String(powerpc64) Value(54)
113
114 EnumValue
115-Enum(rs6000_cpu_opt_value) String(rios2) Value(55)
116+Enum(rs6000_cpu_opt_value) String(rios) Value(55)
117
118 EnumValue
119-Enum(rs6000_cpu_opt_value) String(rsc) Value(56)
120+Enum(rs6000_cpu_opt_value) String(rios1) Value(56)
121
122 EnumValue
123-Enum(rs6000_cpu_opt_value) String(rsc1) Value(57)
124+Enum(rs6000_cpu_opt_value) String(rios2) Value(57)
125
126 EnumValue
127-Enum(rs6000_cpu_opt_value) String(rs64) Value(58)
128+Enum(rs6000_cpu_opt_value) String(rsc) Value(58)
129+
130+EnumValue
131+Enum(rs6000_cpu_opt_value) String(rsc1) Value(59)
132+
133+EnumValue
134+Enum(rs6000_cpu_opt_value) String(rs64) Value(60)
135
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/run-ptest b/meta/recipes-devtools/gcc/gcc-4.7/run-ptest
new file mode 100644
index 0000000000..36eccc30c7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/run-ptest
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3make -C libstdc++-v3/testsuite -i check | sed -e 's/ERROR/FAIL/' -e 's/XFAIL/PASS/' -e 's/XPASS/FAIL/' -e 's/UNRESOLVED/SKIP/' -e 's/UNTESTED/SKIP/' -e 's/UNSUPPORTED/SKIP/'
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch
new file mode 100644
index 0000000000..212c26324c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/use-defaults.h-and-t-oe-in-B.patch
@@ -0,0 +1,77 @@
1Upstream-Status: Pending
2
3Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
4the source can be shared between gcc-cross-initial,
5gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
6---
7 gcc/Makefile.in | 2 +-
8 gcc/configure | 4 ++--
9 gcc/configure.ac | 4 ++--
10 gcc/mkconfig.sh | 4 ++--
11 4 files changed, 7 insertions(+), 7 deletions(-)
12
13Index: gcc-4_7-branch/gcc/Makefile.in
14===================================================================
15--- gcc-4_7-branch.orig/gcc/Makefile.in 2012-04-10 10:37:09.347387424 -0700
16+++ gcc-4_7-branch/gcc/Makefile.in 2012-04-10 10:39:24.019393881 -0700
17@@ -481,7 +481,7 @@
18 TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
19
20 xmake_file=@xmake_file@
21-tmake_file=@tmake_file@
22+tmake_file=@tmake_file@ ./t-oe
23 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
24 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
25 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
26Index: gcc-4_7-branch/gcc/configure
27===================================================================
28--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:37:57.211389779 -0700
29+++ gcc-4_7-branch/gcc/configure 2012-04-10 10:39:24.027393938 -0700
30@@ -11692,8 +11692,8 @@
31 tm_include_list="${tm_include_list} $f"
32 ;;
33 defaults.h )
34- tm_file_list="${tm_file_list} \$(srcdir)/$f"
35- tm_include_list="${tm_include_list} $f"
36+ tm_file_list="${tm_file_list} ./$f"
37+ tm_include_list="${tm_include_list} ./$f"
38 ;;
39 * )
40 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
41Index: gcc-4_7-branch/gcc/configure.ac
42===================================================================
43--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:37:57.215389769 -0700
44+++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:39:24.027393938 -0700
45@@ -1699,8 +1699,8 @@
46 tm_include_list="${tm_include_list} $f"
47 ;;
48 defaults.h )
49- tm_file_list="${tm_file_list} \$(srcdir)/$f"
50- tm_include_list="${tm_include_list} $f"
51+ tm_file_list="${tm_file_list} ./$f"
52+ tm_include_list="${tm_include_list} ./$f"
53 ;;
54 * )
55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
56Index: gcc-4_7-branch/gcc/mkconfig.sh
57===================================================================
58--- gcc-4_7-branch.orig/gcc/mkconfig.sh 2012-04-10 10:17:24.383330061 -0700
59+++ gcc-4_7-branch/gcc/mkconfig.sh 2012-04-10 10:39:24.027393938 -0700
60@@ -78,7 +78,7 @@
61 if [ $# -ge 1 ]; then
62 echo '#ifdef IN_GCC' >> ${output}T
63 for file in "$@"; do
64- if test x"$file" = x"defaults.h"; then
65+ if test x"$file" = x"./defaults.h"; then
66 postpone_defaults_h="yes"
67 else
68 echo "# include \"$file\"" >> ${output}T
69@@ -104,7 +104,7 @@
70
71 # If we postponed including defaults.h, add the #include now.
72 if test x"$postpone_defaults_h" = x"yes"; then
73- echo "# include \"defaults.h\"" >> ${output}T
74+ echo "# include \"./defaults.h\"" >> ${output}T
75 fi
76
77 # Add multiple inclusion protection guard, part two.
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch b/meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch
new file mode 100644
index 0000000000..4d229247a4
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch
@@ -0,0 +1,87 @@
1Use the multilib config files from ${B} instead of using the ones from ${S}
2so that the source can be shared between gcc-cross-initial,
3gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
4
5Upstream-Status: Inappropriate [configuration]
6Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
7
8Index: gcc-4.7.2/gcc/configure
9===================================================================
10--- gcc-4.7.2.orig/gcc/configure
11+++ gcc-4.7.2/gcc/configure
12@@ -11717,10 +11717,20 @@ done
13 tmake_file_=
14 for f in ${tmake_file}
15 do
16- if test -f ${srcdir}/config/$f
17- then
18- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
19- fi
20+ case $f in
21+ */t-linux64 )
22+ if test -f ./config/$f
23+ then
24+ tmake_file_="${tmake_file_} ./config/$f"
25+ fi
26+ ;;
27+ * )
28+ if test -f ${srcdir}/config/$f
29+ then
30+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31+ fi
32+ ;;
33+ esac
34 done
35 tmake_file="${tmake_file_}"
36
37@@ -11731,6 +11741,10 @@ tm_file_list="options.h"
38 tm_include_list="options.h insn-constants.h"
39 for f in $tm_file; do
40 case $f in
41+ */linux64.h )
42+ tm_file_list="${tm_file_list} ./config/$f"
43+ tm_include_list="${tm_include_list} ./config/$f"
44+ ;;
45 ./* )
46 f=`echo $f | sed 's/^..//'`
47 tm_file_list="${tm_file_list} $f"
48Index: gcc-4.7.2/gcc/configure.ac
49===================================================================
50--- gcc-4.7.2.orig/gcc/configure.ac
51+++ gcc-4.7.2/gcc/configure.ac
52@@ -1701,10 +1701,20 @@ done
53 tmake_file_=
54 for f in ${tmake_file}
55 do
56- if test -f ${srcdir}/config/$f
57- then
58- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
59- fi
60+ case $f in
61+ */t-linux64 )
62+ if test -f ./config/$f
63+ then
64+ tmake_file_="${tmake_file_} ./config/$f"
65+ fi
66+ ;;
67+ * )
68+ if test -f ${srcdir}/config/$f
69+ then
70+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71+ fi
72+ ;;
73+ esac
74 done
75 tmake_file="${tmake_file_}"
76
77@@ -1715,6 +1725,10 @@ tm_file_list="options.h"
78 tm_include_list="options.h insn-constants.h"
79 for f in $tm_file; do
80 case $f in
81+ */linux64.h )
82+ tm_file_list="${tm_file_list} ./config/$f"
83+ tm_include_list="${tm_include_list} ./config/$f"
84+ ;;
85 ./* )
86 f=`echo $f | sed 's/^..//'`
87 tm_file_list="${tm_file_list} $f"
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/wcast-qual-PR55383.patch b/meta/recipes-devtools/gcc/gcc-4.7/wcast-qual-PR55383.patch
new file mode 100644
index 0000000000..7c5bbe7620
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.7/wcast-qual-PR55383.patch
@@ -0,0 +1,43 @@
1This is a backport from gcc bugzilla
2
3http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55383
4
5fixes wrong warning behavior which has no workaround
6other than disabling the warning
7
8Upstream-Status: Backport
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Index: gcc-4.7.2/gcc/c-typeck.c
13===================================================================
14--- gcc-4.7.2.orig/gcc/c-typeck.c 2012-09-13 10:04:44.000000000 -0700
15+++ gcc-4.7.2/gcc/c-typeck.c 2013-03-10 23:09:17.610899536 -0700
16@@ -4557,7 +4557,7 @@
17 /* There are qualifiers present in IN_OTYPE that are not present
18 in IN_TYPE. */
19 warning_at (loc, OPT_Wcast_qual,
20- "cast discards %q#v qualifier from pointer target type",
21+ "cast discards %qv qualifier from pointer target type",
22 discarded);
23
24 if (added || discarded)
25Index: gcc-4.7.2/gcc/testsuite/c-c++-common/Wcast-qual-1.c
26===================================================================
27--- gcc-4.7.2.orig/gcc/testsuite/c-c++-common/Wcast-qual-1.c 2011-04-07 14:47:38.000000000 -0700
28+++ gcc-4.7.2/gcc/testsuite/c-c++-common/Wcast-qual-1.c 2013-03-10 23:15:45.610894589 -0700
29@@ -85,11 +85,11 @@
30 void
31 f4 (void * const **bar)
32 {
33- const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
34+ const void ***p9 = (const void ***) bar; /* { dg-warning "cast discards .const. qualifier" } */
35 void * const **p11 = (void * const **) bar;
36- void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast" } */
37+ void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */
38 const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
39- const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
40+ const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */
41 void * const * const * p19 = (void * const * const *) bar;
42 const void * const * const *p21 = (const void * const * const *) bar;
43 }
diff --git a/meta/recipes-devtools/gcc/gcc-4.8.inc b/meta/recipes-devtools/gcc/gcc-4.8.inc
new file mode 100644
index 0000000000..d99e268819
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8.inc
@@ -0,0 +1,148 @@
1require gcc-common.inc
2
3# Third digit in PV should be incremented after a minor release
4# happens from this branch on gcc e.g. currently its 4.7.1
5# when 4.7.2 is releases and we bump SRCREV beyond the release
6# on branch then PV should be incremented to 4.7.2+svnr${SRCPV}
7# to reflect that change
8
9PV = "4.8.1"
10
11# BINV should be incremented after updating to a revision
12# after a minor gcc release (e.g. 4.7.1 or 4.7.2) has been made
13# the value will be minor-release+1 e.g. if current minor release was
14# 4.7.1 then the value below will have 2 which will mean 4.7.2
15# which will be next minor release and so on.
16
17BINV = "4.8.1"
18
19FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-4.8' ], d)}"
20
21DEPENDS =+ "mpfr gmp libmpc zlib"
22NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
23
24LICENSE="GPL-3.0-with-GCC-exception & GPLv3"
25
26LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
27 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
28 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
29 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
30 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
31
32SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
33 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
34 file://0002-uclibc-conf.patch \
35 file://0003-gcc-uclibc-locale-ctype_touplow_t.patch \
36 file://0004-uclibc-locale.patch \
37 file://0005-uclibc-locale-no__x.patch \
38 file://0006-uclibc-locale-wchar_fix.patch \
39 file://0007-uclibc-locale-update.patch \
40 file://0008-missing-execinfo_h.patch \
41 file://0009-c99-snprintf.patch \
42 file://0010-c99-complex-ugly-hack.patch \
43 file://0011-index_macro.patch \
44 file://0012-libmudflap-susv3-legacy.patch \
45 file://0013-libstdc-namespace.patch \
46 file://0014-sh-pr24836.patch \
47 file://0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch \
48 file://0016-gcc-poison-system-directories.patch \
49 file://0017-gcc-poison-dir-extend.patch \
50 file://0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
51 file://0019-64-bit-multilib-hack.patch \
52 file://0020-optional-libstdc.patch \
53 file://0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
54 file://0022-COLLECT_GCC_OPTIONS.patch \
55 file://0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
56 file://0024-PR-target-32219.patch \
57 file://0025-fortran-cross-compile-hack.patch \
58 file://0026-libgcc-sjlj-check.patch \
59 file://0027-cpp-honor-sysroot.patch \
60 file://0028-MIPS64-Default-to-N64-ABI.patch \
61 file://0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
62 file://0030-gcc-Fix-argument-list-too-long-error.patch \
63 file://0031-Disable-sdt.patch \
64 file://0032-libtool.patch \
65 file://0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
66 file://0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
67 file://0035-wcast-qual-PR-55383.patch \
68 file://0036-PR-target-56102.patch \
69 file://0037-gcc-4.8-PR56797.patch \
70 file://0038-gcc-4.8-build-args.patch \
71 file://0039-gcc-4.8-PR57717.patch \
72 file://0040-fix-g++-sysroot.patch \
73 file://0041-libtool-avoid-libdir.patch \
74 file://0042-pr57748.patch \
75 file://0043-cpp.patch \
76 file://0044-gengtypes.patch \
77 file://0045-gcc-4.8-PR57717-PowerPC-E500v2.patch \
78 file://add-install-ptest-to-Makefile.patch \
79 file://run-ptest \
80 file://0046-libatomic-deptracking.patch \
81 file://0047-repomembug.patch \
82 "
83SRC_URI[md5sum] = "3b2386c114cd74185aa3754b58a79304"
84SRC_URI[sha256sum] = "545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813"
85
86S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
87B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
88
89# Language Overrides
90FORTRAN = ""
91JAVA = ""
92
93LTO = "--enable-lto"
94
95EXTRA_OECONF_BASE = " ${LTO} \
96 --enable-libssp \
97 --disable-bootstrap \
98 --disable-libmudflap \
99 --with-system-zlib \
100 --with-linker-hash-style=${LINKER_HASH_STYLE} \
101 --enable-linker-build-id \
102 --with-ppl=no \
103 --with-cloog=no \
104 --enable-checking=release \
105 --enable-cheaders=c_global "
106
107EXTRA_OECONF_INITIAL = "--disable-libmudflap \
108 --disable-libgomp \
109 --disable-libssp \
110 --disable-libquadmath \
111 --with-system-zlib \
112 --disable-lto \
113 --disable-plugin \
114 --enable-decimal-float=no"
115
116EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
117 --disable-libgomp \
118 --disable-libquadmath \
119 --with-system-zlib \
120 --disable-lto \
121 --disable-plugin \
122 --disable-libssp"
123
124EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
125
126EXTRA_OECONF_PATHS = " \
127 --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
128 --with-sysroot=${STAGING_DIR_TARGET} \
129 --with-build-sysroot=${STAGING_DIR_TARGET}"
130
131do_configure_prepend () {
132 # teach gcc to find correct target includedir when checking libc ssp support
133 mkdir -p ${B}/gcc
134 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
135 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
136 cat >>${B}/gcc/defaults.h.new <<_EOF
137#ifndef STANDARD_STARTFILE_PREFIX_1
138#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
139#endif
140#ifndef STANDARD_STARTFILE_PREFIX_2
141#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
142#endif
143#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
144#endif /* ! GCC_DEFAULTS_H */
145_EOF
146 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
147}
148
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..e588011678
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,42 @@
1From bf3d96ae58fa180b8b468d25dc2e0209daca2751 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH 01/35] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 configure | 2 +-
11 configure.ac | 2 +-
12 2 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/configure b/configure
15index d809535..1b76c90 100755
16--- a/configure
17+++ b/configure
18@@ -7439,7 +7439,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21
22-FLAGS_FOR_TARGET=
23+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
24 case " $target_configdirs " in
25 *" newlib "*)
26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac
28index 48ec1aa..89d1d3f 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -2873,7 +2873,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34
35-FLAGS_FOR_TARGET=
36+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
37 case " $target_configdirs " in
38 *" newlib "*)
39 case " $target_configargs " in
40--
411.7.10.4
42
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0002-uclibc-conf.patch b/meta/recipes-devtools/gcc/gcc-4.8/0002-uclibc-conf.patch
new file mode 100644
index 0000000000..dda3b1041b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0002-uclibc-conf.patch
@@ -0,0 +1,53 @@
1From d030973c872c00d916921d84deee0af2c0d38081 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:38:25 +0400
4Subject: [PATCH 02/35] uclibc-conf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 contrib/regression/objs-gcc.sh | 4 ++++
11 libjava/classpath/ltconfig | 4 ++--
12 2 files changed, 6 insertions(+), 2 deletions(-)
13
14diff --git a/contrib/regression/objs-gcc.sh b/contrib/regression/objs-gcc.sh
15index 60b0497..6dc7ead 100755
16--- a/contrib/regression/objs-gcc.sh
17+++ b/contrib/regression/objs-gcc.sh
18@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-gnu ]
19 then
20 make all-gdb all-dejagnu all-ld || exit 1
21 make install-gdb install-dejagnu install-ld || exit 1
22+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
23+ then
24+ make all-gdb all-dejagnu all-ld || exit 1
25+ make install-gdb install-dejagnu install-ld || exit 1
26 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
27 make bootstrap || exit 1
28 make install || exit 1
29diff --git a/libjava/classpath/ltconfig b/libjava/classpath/ltconfig
30index 743d951..ae4ea60 100755
31--- a/libjava/classpath/ltconfig
32+++ b/libjava/classpath/ltconfig
33@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
34
35 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
36 case $host_os in
37-linux-gnu*) ;;
38+linux-gnu*|linux-uclibc*) ;;
39 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
40 esac
41
42@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
43 ;;
44
45 # This must be Linux ELF.
46-linux-gnu*)
47+linux*)
48 version_type=linux
49 need_lib_prefix=no
50 need_version=no
51--
521.7.10.4
53
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch b/meta/recipes-devtools/gcc/gcc-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 0000000000..7098e99502
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,87 @@
1From d2d9dd756c4356d14dd7ae003856344cb4f37985 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:40:12 +0400
4Subject: [PATCH 03/35] gcc-uclibc-locale-ctype_touplow_t
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/generic/c_locale.cc | 5 +++++
11 libstdc++-v3/config/locale/generic/c_locale.h | 9 +++++++++
12 libstdc++-v3/config/os/gnu-linux/ctype_base.h | 9 +++++++++
13 3 files changed, 23 insertions(+)
14
15diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
16index 0d309a5..f2f1e1f 100644
17--- a/libstdc++-v3/config/locale/generic/c_locale.cc
18+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
19@@ -263,5 +263,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
20 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
21 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
22 extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
23+#ifdef __UCLIBC__
24+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
25+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
26+#else
27 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
28+#endif
29 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
30diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h
31index b5fd989..3da9a5d 100644
32--- a/libstdc++-v3/config/locale/generic/c_locale.h
33+++ b/libstdc++-v3/config/locale/generic/c_locale.h
34@@ -40,13 +40,22 @@
35
36 #include <clocale>
37
38+#ifdef __UCLIBC__
39+#include <features.h>
40+#include <ctype.h>
41+#endif
42+
43 #define _GLIBCXX_NUM_CATEGORIES 0
44
45 namespace std _GLIBCXX_VISIBILITY(default)
46 {
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48
49+#ifdef __UCLIBC__
50+ typedef __ctype_touplow_t* __c_locale;
51+#else
52 typedef int* __c_locale;
53+#endif
54
55 // Convert numeric value of type double and long double to string and
56 // return length of string. If vsnprintf is available use it, otherwise
57diff --git a/libstdc++-v3/config/os/gnu-linux/ctype_base.h b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
58index 2d8e978..14eb08f 100644
59--- a/libstdc++-v3/config/os/gnu-linux/ctype_base.h
60+++ b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
61@@ -33,6 +33,11 @@
62
63 // Information as gleaned from /usr/include/ctype.h
64
65+#ifdef __UCLIBC__
66+#include <features.h>
67+#include <ctype.h>
68+#endif
69+
70 namespace std _GLIBCXX_VISIBILITY(default)
71 {
72 _GLIBCXX_BEGIN_NAMESPACE_VERSION
73@@ -41,7 +46,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
74 struct ctype_base
75 {
76 // Non-standard typedefs.
77+#ifdef __UCLIBC__
78+ typedef const __ctype_touplow_t* __to_type;
79+#else
80 typedef const int* __to_type;
81+#endif
82
83 // NB: Offsets into ctype<char>::_M_table force a particular size
84 // on the mask type. Because of this, we don't use an enum.
85--
861.7.10.4
87
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0004-uclibc-locale.patch b/meta/recipes-devtools/gcc/gcc-4.8/0004-uclibc-locale.patch
new file mode 100644
index 0000000000..49f5f338e3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0004-uclibc-locale.patch
@@ -0,0 +1,2862 @@
1From a55c751a449c2cbf0b3fcc07aab1b86bf9661510 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:41:39 +0400
4Subject: [PATCH 04/35] uclibc-locale
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/acinclude.m4 | 37 ++
11 .../config/locale/uclibc/c++locale_internal.h | 63 ++
12 libstdc++-v3/config/locale/uclibc/c_locale.cc | 160 +++++
13 libstdc++-v3/config/locale/uclibc/c_locale.h | 117 ++++
14 .../config/locale/uclibc/codecvt_members.cc | 308 +++++++++
15 .../config/locale/uclibc/collate_members.cc | 80 +++
16 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 300 +++++++++
17 .../config/locale/uclibc/messages_members.cc | 100 +++
18 .../config/locale/uclibc/messages_members.h | 118 ++++
19 .../config/locale/uclibc/monetary_members.cc | 692 ++++++++++++++++++++
20 .../config/locale/uclibc/numeric_members.cc | 160 +++++
21 libstdc++-v3/config/locale/uclibc/time_members.cc | 406 ++++++++++++
22 libstdc++-v3/config/locale/uclibc/time_members.h | 68 ++
23 libstdc++-v3/configure | 75 +++
24 libstdc++-v3/include/c_compatibility/wchar.h | 2 +
25 libstdc++-v3/include/c_std/cwchar | 2 +
26 16 files changed, 2688 insertions(+)
27 create mode 100644 libstdc++-v3/config/locale/uclibc/c++locale_internal.h
28 create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.cc
29 create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.h
30 create mode 100644 libstdc++-v3/config/locale/uclibc/codecvt_members.cc
31 create mode 100644 libstdc++-v3/config/locale/uclibc/collate_members.cc
32 create mode 100644 libstdc++-v3/config/locale/uclibc/ctype_members.cc
33 create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.cc
34 create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.h
35 create mode 100644 libstdc++-v3/config/locale/uclibc/monetary_members.cc
36 create mode 100644 libstdc++-v3/config/locale/uclibc/numeric_members.cc
37 create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.cc
38 create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.h
39
40diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
41index 0871a6a..326d7ef 100644
42--- a/libstdc++-v3/acinclude.m4
43+++ b/libstdc++-v3/acinclude.m4
44@@ -1905,6 +1905,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
45 # Default to "generic".
46 if test $enable_clocale_flag = auto; then
47 case ${target_os} in
48+ *-uclibc*)
49+ enable_clocale_flag=uclibc
50+ ;;
51 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
52 enable_clocale_flag=gnu
53 ;;
54@@ -2069,6 +2072,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
55 CTIME_CC=config/locale/generic/time_members.cc
56 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
57 ;;
58+ uclibc)
59+ AC_MSG_RESULT(uclibc)
60+
61+ # Declare intention to use gettext, and add support for specific
62+ # languages.
63+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
64+ ALL_LINGUAS="de fr"
65+
66+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
67+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
68+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
69+ USE_NLS=yes
70+ fi
71+ # Export the build objects.
72+ for ling in $ALL_LINGUAS; do \
73+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
74+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
75+ done
76+ AC_SUBST(glibcxx_MOFILES)
77+ AC_SUBST(glibcxx_POFILES)
78+
79+ CLOCALE_H=config/locale/uclibc/c_locale.h
80+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
81+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
82+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
83+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
84+ CMESSAGES_H=config/locale/uclibc/messages_members.h
85+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
86+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
87+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
88+ CTIME_H=config/locale/uclibc/time_members.h
89+ CTIME_CC=config/locale/uclibc/time_members.cc
90+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
91+ ;;
92 esac
93
94 # This is where the testsuite looks for locale catalogs, using the
95diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
96new file mode 100644
97index 0000000..2ae3e4a
98--- /dev/null
99+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
100@@ -0,0 +1,63 @@
101+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
102+
103+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
104+//
105+// This file is part of the GNU ISO C++ Library. This library is free
106+// software; you can redistribute it and/or modify it under the
107+// terms of the GNU General Public License as published by the
108+// Free Software Foundation; either version 2, or (at your option)
109+// any later version.
110+
111+// This library is distributed in the hope that it will be useful,
112+// but WITHOUT ANY WARRANTY; without even the implied warranty of
113+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114+// GNU General Public License for more details.
115+
116+// You should have received a copy of the GNU General Public License along
117+// with this library; see the file COPYING. If not, write to the Free
118+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
119+// USA.
120+
121+// As a special exception, you may use this file as part of a free software
122+// library without restriction. Specifically, if other files instantiate
123+// templates or use macros or inline functions from this file, or you compile
124+// this file and link it with other files to produce an executable, this
125+// file does not by itself cause the resulting executable to be covered by
126+// the GNU General Public License. This exception does not however
127+// invalidate any other reasons why the executable file might be covered by
128+// the GNU General Public License.
129+
130+// Written by Jakub Jelinek <jakub@redhat.com>
131+
132+#include <bits/c++config.h>
133+#include <clocale>
134+
135+#ifdef __UCLIBC_MJN3_ONLY__
136+#warning clean this up
137+#endif
138+
139+#ifdef __UCLIBC_HAS_XLOCALE__
140+
141+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
142+extern "C" __typeof(strcoll_l) __strcoll_l;
143+extern "C" __typeof(strftime_l) __strftime_l;
144+extern "C" __typeof(strtod_l) __strtod_l;
145+extern "C" __typeof(strtof_l) __strtof_l;
146+extern "C" __typeof(strtold_l) __strtold_l;
147+extern "C" __typeof(strxfrm_l) __strxfrm_l;
148+extern "C" __typeof(newlocale) __newlocale;
149+extern "C" __typeof(freelocale) __freelocale;
150+extern "C" __typeof(duplocale) __duplocale;
151+extern "C" __typeof(uselocale) __uselocale;
152+
153+#ifdef _GLIBCXX_USE_WCHAR_T
154+extern "C" __typeof(iswctype_l) __iswctype_l;
155+extern "C" __typeof(towlower_l) __towlower_l;
156+extern "C" __typeof(towupper_l) __towupper_l;
157+extern "C" __typeof(wcscoll_l) __wcscoll_l;
158+extern "C" __typeof(wcsftime_l) __wcsftime_l;
159+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
160+extern "C" __typeof(wctype_l) __wctype_l;
161+#endif
162+
163+#endif // GLIBC 2.3 and later
164diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
165new file mode 100644
166index 0000000..5081dc1
167--- /dev/null
168+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
169@@ -0,0 +1,160 @@
170+// Wrapper for underlying C-language localization -*- C++ -*-
171+
172+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
173+//
174+// This file is part of the GNU ISO C++ Library. This library is free
175+// software; you can redistribute it and/or modify it under the
176+// terms of the GNU General Public License as published by the
177+// Free Software Foundation; either version 2, or (at your option)
178+// any later version.
179+
180+// This library is distributed in the hope that it will be useful,
181+// but WITHOUT ANY WARRANTY; without even the implied warranty of
182+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+// GNU General Public License for more details.
184+
185+// You should have received a copy of the GNU General Public License along
186+// with this library; see the file COPYING. If not, write to the Free
187+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
188+// USA.
189+
190+// As a special exception, you may use this file as part of a free software
191+// library without restriction. Specifically, if other files instantiate
192+// templates or use macros or inline functions from this file, or you compile
193+// this file and link it with other files to produce an executable, this
194+// file does not by itself cause the resulting executable to be covered by
195+// the GNU General Public License. This exception does not however
196+// invalidate any other reasons why the executable file might be covered by
197+// the GNU General Public License.
198+
199+//
200+// ISO C++ 14882: 22.8 Standard locale categories.
201+//
202+
203+// Written by Benjamin Kosnik <bkoz@redhat.com>
204+
205+#include <cerrno> // For errno
206+#include <locale>
207+#include <stdexcept>
208+#include <langinfo.h>
209+#include <bits/c++locale_internal.h>
210+
211+#ifndef __UCLIBC_HAS_XLOCALE__
212+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
213+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
214+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
215+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
216+#define __strtof_l(S, E, L) strtof((S), (E))
217+#define __strtod_l(S, E, L) strtod((S), (E))
218+#define __strtold_l(S, E, L) strtold((S), (E))
219+#warning should dummy __newlocale check for C|POSIX ?
220+#define __newlocale(a, b, c) NULL
221+#define __freelocale(a) ((void)0)
222+#define __duplocale(a) __c_locale()
223+#endif
224+
225+namespace std
226+{
227+ template<>
228+ void
229+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
230+ const __c_locale& __cloc)
231+ {
232+ if (!(__err & ios_base::failbit))
233+ {
234+ char* __sanity;
235+ errno = 0;
236+ float __f = __strtof_l(__s, &__sanity, __cloc);
237+ if (__sanity != __s && errno != ERANGE)
238+ __v = __f;
239+ else
240+ __err |= ios_base::failbit;
241+ }
242+ }
243+
244+ template<>
245+ void
246+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
247+ const __c_locale& __cloc)
248+ {
249+ if (!(__err & ios_base::failbit))
250+ {
251+ char* __sanity;
252+ errno = 0;
253+ double __d = __strtod_l(__s, &__sanity, __cloc);
254+ if (__sanity != __s && errno != ERANGE)
255+ __v = __d;
256+ else
257+ __err |= ios_base::failbit;
258+ }
259+ }
260+
261+ template<>
262+ void
263+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
264+ const __c_locale& __cloc)
265+ {
266+ if (!(__err & ios_base::failbit))
267+ {
268+ char* __sanity;
269+ errno = 0;
270+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
271+ if (__sanity != __s && errno != ERANGE)
272+ __v = __ld;
273+ else
274+ __err |= ios_base::failbit;
275+ }
276+ }
277+
278+ void
279+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
280+ __c_locale __old)
281+ {
282+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
283+#ifdef __UCLIBC_HAS_XLOCALE__
284+ if (!__cloc)
285+ {
286+ // This named locale is not supported by the underlying OS.
287+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
288+ "name not valid"));
289+ }
290+#endif
291+ }
292+
293+ void
294+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
295+ {
296+ if (_S_get_c_locale() != __cloc)
297+ __freelocale(__cloc);
298+ }
299+
300+ __c_locale
301+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
302+ { return __duplocale(__cloc); }
303+} // namespace std
304+
305+namespace __gnu_cxx
306+{
307+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
308+ {
309+ "LC_CTYPE",
310+ "LC_NUMERIC",
311+ "LC_TIME",
312+ "LC_COLLATE",
313+ "LC_MONETARY",
314+ "LC_MESSAGES",
315+#if _GLIBCXX_NUM_CATEGORIES != 0
316+ "LC_PAPER",
317+ "LC_NAME",
318+ "LC_ADDRESS",
319+ "LC_TELEPHONE",
320+ "LC_MEASUREMENT",
321+ "LC_IDENTIFICATION"
322+#endif
323+ };
324+}
325+
326+namespace std
327+{
328+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
329+} // namespace std
330diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
331new file mode 100644
332index 0000000..da07c1f
333--- /dev/null
334+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
335@@ -0,0 +1,117 @@
336+// Wrapper for underlying C-language localization -*- C++ -*-
337+
338+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
339+//
340+// This file is part of the GNU ISO C++ Library. This library is free
341+// software; you can redistribute it and/or modify it under the
342+// terms of the GNU General Public License as published by the
343+// Free Software Foundation; either version 2, or (at your option)
344+// any later version.
345+
346+// This library is distributed in the hope that it will be useful,
347+// but WITHOUT ANY WARRANTY; without even the implied warranty of
348+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
349+// GNU General Public License for more details.
350+
351+// You should have received a copy of the GNU General Public License along
352+// with this library; see the file COPYING. If not, write to the Free
353+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
354+// USA.
355+
356+// As a special exception, you may use this file as part of a free software
357+// library without restriction. Specifically, if other files instantiate
358+// templates or use macros or inline functions from this file, or you compile
359+// this file and link it with other files to produce an executable, this
360+// file does not by itself cause the resulting executable to be covered by
361+// the GNU General Public License. This exception does not however
362+// invalidate any other reasons why the executable file might be covered by
363+// the GNU General Public License.
364+
365+//
366+// ISO C++ 14882: 22.8 Standard locale categories.
367+//
368+
369+// Written by Benjamin Kosnik <bkoz@redhat.com>
370+
371+#ifndef _C_LOCALE_H
372+#define _C_LOCALE_H 1
373+
374+#pragma GCC system_header
375+
376+#include <cstring> // get std::strlen
377+#include <cstdio> // get std::snprintf or std::sprintf
378+#include <clocale>
379+#include <langinfo.h> // For codecvt
380+#ifdef __UCLIBC_MJN3_ONLY__
381+#warning fix this
382+#endif
383+#ifdef __UCLIBC_HAS_LOCALE__
384+#include <iconv.h> // For codecvt using iconv, iconv_t
385+#endif
386+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
387+#include <libintl.h> // For messages
388+#endif
389+
390+#ifdef __UCLIBC_MJN3_ONLY__
391+#warning what is _GLIBCXX_C_LOCALE_GNU for
392+#endif
393+#define _GLIBCXX_C_LOCALE_GNU 1
394+
395+#ifdef __UCLIBC_MJN3_ONLY__
396+#warning fix categories
397+#endif
398+// #define _GLIBCXX_NUM_CATEGORIES 6
399+#define _GLIBCXX_NUM_CATEGORIES 0
400+
401+#ifdef __UCLIBC_HAS_XLOCALE__
402+namespace __gnu_cxx
403+{
404+ extern "C" __typeof(uselocale) __uselocale;
405+}
406+#endif
407+
408+namespace std
409+{
410+#ifdef __UCLIBC_HAS_XLOCALE__
411+ typedef __locale_t __c_locale;
412+#else
413+ typedef int* __c_locale;
414+#endif
415+
416+ // Convert numeric value of type _Tv to string and return length of
417+ // string. If snprintf is available use it, otherwise fall back to
418+ // the unsafe sprintf which, in general, can be dangerous and should
419+ // be avoided.
420+ template<typename _Tv>
421+ int
422+ __convert_from_v(char* __out,
423+ const int __size __attribute__ ((__unused__)),
424+ const char* __fmt,
425+#ifdef __UCLIBC_HAS_XCLOCALE__
426+ _Tv __v, const __c_locale& __cloc, int __prec)
427+ {
428+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
429+#else
430+ _Tv __v, const __c_locale&, int __prec)
431+ {
432+# ifdef __UCLIBC_HAS_LOCALE__
433+ char* __old = std::setlocale(LC_ALL, NULL);
434+ char* __sav = new char[std::strlen(__old) + 1];
435+ std::strcpy(__sav, __old);
436+ std::setlocale(LC_ALL, "C");
437+# endif
438+#endif
439+
440+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
441+
442+#ifdef __UCLIBC_HAS_XCLOCALE__
443+ __gnu_cxx::__uselocale(__old);
444+#elif defined __UCLIBC_HAS_LOCALE__
445+ std::setlocale(LC_ALL, __sav);
446+ delete [] __sav;
447+#endif
448+ return __ret;
449+ }
450+}
451+
452+#endif
453diff --git a/libstdc++-v3/config/locale/uclibc/codecvt_members.cc b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
454new file mode 100644
455index 0000000..64aa962
456--- /dev/null
457+++ b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
458@@ -0,0 +1,308 @@
459+// std::codecvt implementation details, GNU version -*- C++ -*-
460+
461+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
462+//
463+// This file is part of the GNU ISO C++ Library. This library is free
464+// software; you can redistribute it and/or modify it under the
465+// terms of the GNU General Public License as published by the
466+// Free Software Foundation; either version 2, or (at your option)
467+// any later version.
468+
469+// This library is distributed in the hope that it will be useful,
470+// but WITHOUT ANY WARRANTY; without even the implied warranty of
471+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
472+// GNU General Public License for more details.
473+
474+// You should have received a copy of the GNU General Public License along
475+// with this library; see the file COPYING. If not, write to the Free
476+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
477+// USA.
478+
479+// As a special exception, you may use this file as part of a free software
480+// library without restriction. Specifically, if other files instantiate
481+// templates or use macros or inline functions from this file, or you compile
482+// this file and link it with other files to produce an executable, this
483+// file does not by itself cause the resulting executable to be covered by
484+// the GNU General Public License. This exception does not however
485+// invalidate any other reasons why the executable file might be covered by
486+// the GNU General Public License.
487+
488+//
489+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
490+//
491+
492+// Written by Benjamin Kosnik <bkoz@redhat.com>
493+
494+#include <locale>
495+#include <cstdlib> // For MB_CUR_MAX
496+#include <climits> // For MB_LEN_MAX
497+#include <bits/c++locale_internal.h>
498+
499+namespace std
500+{
501+ // Specializations.
502+#ifdef _GLIBCXX_USE_WCHAR_T
503+ codecvt_base::result
504+ codecvt<wchar_t, char, mbstate_t>::
505+ do_out(state_type& __state, const intern_type* __from,
506+ const intern_type* __from_end, const intern_type*& __from_next,
507+ extern_type* __to, extern_type* __to_end,
508+ extern_type*& __to_next) const
509+ {
510+ result __ret = ok;
511+ state_type __tmp_state(__state);
512+
513+#ifdef __UCLIBC_HAS_XLOCALE__
514+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
515+#endif
516+
517+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
518+ // in case we fall back to wcrtomb and then continue, in a loop.
519+ // NB: wcsnrtombs is a GNU extension
520+ for (__from_next = __from, __to_next = __to;
521+ __from_next < __from_end && __to_next < __to_end
522+ && __ret == ok;)
523+ {
524+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
525+ __from_end - __from_next);
526+ if (!__from_chunk_end)
527+ __from_chunk_end = __from_end;
528+
529+ __from = __from_next;
530+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
531+ __from_chunk_end - __from_next,
532+ __to_end - __to_next, &__state);
533+ if (__conv == static_cast<size_t>(-1))
534+ {
535+ // In case of error, in order to stop at the exact place we
536+ // have to start again from the beginning with a series of
537+ // wcrtomb.
538+ for (; __from < __from_next; ++__from)
539+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
540+ __state = __tmp_state;
541+ __ret = error;
542+ }
543+ else if (__from_next && __from_next < __from_chunk_end)
544+ {
545+ __to_next += __conv;
546+ __ret = partial;
547+ }
548+ else
549+ {
550+ __from_next = __from_chunk_end;
551+ __to_next += __conv;
552+ }
553+
554+ if (__from_next < __from_end && __ret == ok)
555+ {
556+ extern_type __buf[MB_LEN_MAX];
557+ __tmp_state = __state;
558+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
559+ if (__conv > static_cast<size_t>(__to_end - __to_next))
560+ __ret = partial;
561+ else
562+ {
563+ memcpy(__to_next, __buf, __conv);
564+ __state = __tmp_state;
565+ __to_next += __conv;
566+ ++__from_next;
567+ }
568+ }
569+ }
570+
571+#ifdef __UCLIBC_HAS_XLOCALE__
572+ __uselocale(__old);
573+#endif
574+
575+ return __ret;
576+ }
577+
578+ codecvt_base::result
579+ codecvt<wchar_t, char, mbstate_t>::
580+ do_in(state_type& __state, const extern_type* __from,
581+ const extern_type* __from_end, const extern_type*& __from_next,
582+ intern_type* __to, intern_type* __to_end,
583+ intern_type*& __to_next) const
584+ {
585+ result __ret = ok;
586+ state_type __tmp_state(__state);
587+
588+#ifdef __UCLIBC_HAS_XLOCALE__
589+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
590+#endif
591+
592+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
593+ // in case we store a L'\0' and then continue, in a loop.
594+ // NB: mbsnrtowcs is a GNU extension
595+ for (__from_next = __from, __to_next = __to;
596+ __from_next < __from_end && __to_next < __to_end
597+ && __ret == ok;)
598+ {
599+ const extern_type* __from_chunk_end;
600+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
601+ __from_end
602+ - __from_next));
603+ if (!__from_chunk_end)
604+ __from_chunk_end = __from_end;
605+
606+ __from = __from_next;
607+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
608+ __from_chunk_end - __from_next,
609+ __to_end - __to_next, &__state);
610+ if (__conv == static_cast<size_t>(-1))
611+ {
612+ // In case of error, in order to stop at the exact place we
613+ // have to start again from the beginning with a series of
614+ // mbrtowc.
615+ for (;; ++__to_next, __from += __conv)
616+ {
617+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
618+ &__tmp_state);
619+ if (__conv == static_cast<size_t>(-1)
620+ || __conv == static_cast<size_t>(-2))
621+ break;
622+ }
623+ __from_next = __from;
624+ __state = __tmp_state;
625+ __ret = error;
626+ }
627+ else if (__from_next && __from_next < __from_chunk_end)
628+ {
629+ // It is unclear what to return in this case (see DR 382).
630+ __to_next += __conv;
631+ __ret = partial;
632+ }
633+ else
634+ {
635+ __from_next = __from_chunk_end;
636+ __to_next += __conv;
637+ }
638+
639+ if (__from_next < __from_end && __ret == ok)
640+ {
641+ if (__to_next < __to_end)
642+ {
643+ // XXX Probably wrong for stateful encodings
644+ __tmp_state = __state;
645+ ++__from_next;
646+ *__to_next++ = L'\0';
647+ }
648+ else
649+ __ret = partial;
650+ }
651+ }
652+
653+#ifdef __UCLIBC_HAS_XLOCALE__
654+ __uselocale(__old);
655+#endif
656+
657+ return __ret;
658+ }
659+
660+ int
661+ codecvt<wchar_t, char, mbstate_t>::
662+ do_encoding() const throw()
663+ {
664+ // XXX This implementation assumes that the encoding is
665+ // stateless and is either single-byte or variable-width.
666+ int __ret = 0;
667+#ifdef __UCLIBC_HAS_XLOCALE__
668+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
669+#endif
670+ if (MB_CUR_MAX == 1)
671+ __ret = 1;
672+#ifdef __UCLIBC_HAS_XLOCALE__
673+ __uselocale(__old);
674+#endif
675+ return __ret;
676+ }
677+
678+ int
679+ codecvt<wchar_t, char, mbstate_t>::
680+ do_max_length() const throw()
681+ {
682+#ifdef __UCLIBC_HAS_XLOCALE__
683+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
684+#endif
685+ // XXX Probably wrong for stateful encodings.
686+ int __ret = MB_CUR_MAX;
687+#ifdef __UCLIBC_HAS_XLOCALE__
688+ __uselocale(__old);
689+#endif
690+ return __ret;
691+ }
692+
693+ int
694+ codecvt<wchar_t, char, mbstate_t>::
695+ do_length(state_type& __state, const extern_type* __from,
696+ const extern_type* __end, size_t __max) const
697+ {
698+ int __ret = 0;
699+ state_type __tmp_state(__state);
700+
701+#ifdef __UCLIBC_HAS_XLOCALE__
702+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
703+#endif
704+
705+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
706+ // in case we advance past it and then continue, in a loop.
707+ // NB: mbsnrtowcs is a GNU extension
708+
709+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
710+ // its fourth parameter (it wouldn't with NULL as first parameter).
711+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
712+ * __max));
713+ while (__from < __end && __max)
714+ {
715+ const extern_type* __from_chunk_end;
716+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
717+ __end
718+ - __from));
719+ if (!__from_chunk_end)
720+ __from_chunk_end = __end;
721+
722+ const extern_type* __tmp_from = __from;
723+ size_t __conv = mbsnrtowcs(__to, &__from,
724+ __from_chunk_end - __from,
725+ __max, &__state);
726+ if (__conv == static_cast<size_t>(-1))
727+ {
728+ // In case of error, in order to stop at the exact place we
729+ // have to start again from the beginning with a series of
730+ // mbrtowc.
731+ for (__from = __tmp_from;; __from += __conv)
732+ {
733+ __conv = mbrtowc(NULL, __from, __end - __from,
734+ &__tmp_state);
735+ if (__conv == static_cast<size_t>(-1)
736+ || __conv == static_cast<size_t>(-2))
737+ break;
738+ }
739+ __state = __tmp_state;
740+ __ret += __from - __tmp_from;
741+ break;
742+ }
743+ if (!__from)
744+ __from = __from_chunk_end;
745+
746+ __ret += __from - __tmp_from;
747+ __max -= __conv;
748+
749+ if (__from < __end && __max)
750+ {
751+ // XXX Probably wrong for stateful encodings
752+ __tmp_state = __state;
753+ ++__from;
754+ ++__ret;
755+ --__max;
756+ }
757+ }
758+
759+#ifdef __UCLIBC_HAS_XLOCALE__
760+ __uselocale(__old);
761+#endif
762+
763+ return __ret;
764+ }
765+#endif
766+}
767diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
768new file mode 100644
769index 0000000..c2664a7
770--- /dev/null
771+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
772@@ -0,0 +1,80 @@
773+// std::collate implementation details, GNU version -*- C++ -*-
774+
775+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
776+//
777+// This file is part of the GNU ISO C++ Library. This library is free
778+// software; you can redistribute it and/or modify it under the
779+// terms of the GNU General Public License as published by the
780+// Free Software Foundation; either version 2, or (at your option)
781+// any later version.
782+
783+// This library is distributed in the hope that it will be useful,
784+// but WITHOUT ANY WARRANTY; without even the implied warranty of
785+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
786+// GNU General Public License for more details.
787+
788+// You should have received a copy of the GNU General Public License along
789+// with this library; see the file COPYING. If not, write to the Free
790+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
791+// USA.
792+
793+// As a special exception, you may use this file as part of a free software
794+// library without restriction. Specifically, if other files instantiate
795+// templates or use macros or inline functions from this file, or you compile
796+// this file and link it with other files to produce an executable, this
797+// file does not by itself cause the resulting executable to be covered by
798+// the GNU General Public License. This exception does not however
799+// invalidate any other reasons why the executable file might be covered by
800+// the GNU General Public License.
801+
802+//
803+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
804+//
805+
806+// Written by Benjamin Kosnik <bkoz@redhat.com>
807+
808+#include <locale>
809+#include <bits/c++locale_internal.h>
810+
811+#ifndef __UCLIBC_HAS_XLOCALE__
812+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
813+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
814+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
815+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
816+#endif
817+
818+namespace std
819+{
820+ // These are basically extensions to char_traits, and perhaps should
821+ // be put there instead of here.
822+ template<>
823+ int
824+ collate<char>::_M_compare(const char* __one, const char* __two) const
825+ {
826+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
827+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
828+ }
829+
830+ template<>
831+ size_t
832+ collate<char>::_M_transform(char* __to, const char* __from,
833+ size_t __n) const
834+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
835+
836+#ifdef _GLIBCXX_USE_WCHAR_T
837+ template<>
838+ int
839+ collate<wchar_t>::_M_compare(const wchar_t* __one,
840+ const wchar_t* __two) const
841+ {
842+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
843+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
844+ }
845+
846+ template<>
847+ size_t
848+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
849+ size_t __n) const
850+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
851+#endif
852+}
853diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
854new file mode 100644
855index 0000000..7294e3a
856--- /dev/null
857+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
858@@ -0,0 +1,300 @@
859+// std::ctype implementation details, GNU version -*- C++ -*-
860+
861+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
862+//
863+// This file is part of the GNU ISO C++ Library. This library is free
864+// software; you can redistribute it and/or modify it under the
865+// terms of the GNU General Public License as published by the
866+// Free Software Foundation; either version 2, or (at your option)
867+// any later version.
868+
869+// This library is distributed in the hope that it will be useful,
870+// but WITHOUT ANY WARRANTY; without even the implied warranty of
871+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
872+// GNU General Public License for more details.
873+
874+// You should have received a copy of the GNU General Public License along
875+// with this library; see the file COPYING. If not, write to the Free
876+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
877+// USA.
878+
879+// As a special exception, you may use this file as part of a free software
880+// library without restriction. Specifically, if other files instantiate
881+// templates or use macros or inline functions from this file, or you compile
882+// this file and link it with other files to produce an executable, this
883+// file does not by itself cause the resulting executable to be covered by
884+// the GNU General Public License. This exception does not however
885+// invalidate any other reasons why the executable file might be covered by
886+// the GNU General Public License.
887+
888+//
889+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
890+//
891+
892+// Written by Benjamin Kosnik <bkoz@redhat.com>
893+
894+#define _LIBC
895+#include <locale>
896+#undef _LIBC
897+#include <bits/c++locale_internal.h>
898+
899+#ifndef __UCLIBC_HAS_XLOCALE__
900+#define __wctype_l(S, L) wctype((S))
901+#define __towupper_l(C, L) towupper((C))
902+#define __towlower_l(C, L) towlower((C))
903+#define __iswctype_l(C, M, L) iswctype((C), (M))
904+#endif
905+
906+namespace std
907+{
908+ // NB: The other ctype<char> specializations are in src/locale.cc and
909+ // various /config/os/* files.
910+ template<>
911+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
912+ : ctype<char>(0, false, __refs)
913+ {
914+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
915+ {
916+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
917+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
918+#ifdef __UCLIBC_HAS_XLOCALE__
919+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
920+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
921+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
922+#endif
923+ }
924+ }
925+
926+#ifdef _GLIBCXX_USE_WCHAR_T
927+ ctype<wchar_t>::__wmask_type
928+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
929+ {
930+ __wmask_type __ret;
931+ switch (__m)
932+ {
933+ case space:
934+ __ret = __wctype_l("space", _M_c_locale_ctype);
935+ break;
936+ case print:
937+ __ret = __wctype_l("print", _M_c_locale_ctype);
938+ break;
939+ case cntrl:
940+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
941+ break;
942+ case upper:
943+ __ret = __wctype_l("upper", _M_c_locale_ctype);
944+ break;
945+ case lower:
946+ __ret = __wctype_l("lower", _M_c_locale_ctype);
947+ break;
948+ case alpha:
949+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
950+ break;
951+ case digit:
952+ __ret = __wctype_l("digit", _M_c_locale_ctype);
953+ break;
954+ case punct:
955+ __ret = __wctype_l("punct", _M_c_locale_ctype);
956+ break;
957+ case xdigit:
958+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
959+ break;
960+ case alnum:
961+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
962+ break;
963+ case graph:
964+ __ret = __wctype_l("graph", _M_c_locale_ctype);
965+ break;
966+ default:
967+ __ret = __wmask_type();
968+ }
969+ return __ret;
970+ }
971+
972+ wchar_t
973+ ctype<wchar_t>::do_toupper(wchar_t __c) const
974+ { return __towupper_l(__c, _M_c_locale_ctype); }
975+
976+ const wchar_t*
977+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
978+ {
979+ while (__lo < __hi)
980+ {
981+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
982+ ++__lo;
983+ }
984+ return __hi;
985+ }
986+
987+ wchar_t
988+ ctype<wchar_t>::do_tolower(wchar_t __c) const
989+ { return __towlower_l(__c, _M_c_locale_ctype); }
990+
991+ const wchar_t*
992+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
993+ {
994+ while (__lo < __hi)
995+ {
996+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
997+ ++__lo;
998+ }
999+ return __hi;
1000+ }
1001+
1002+ bool
1003+ ctype<wchar_t>::
1004+ do_is(mask __m, wchar_t __c) const
1005+ {
1006+ // Highest bitmask in ctype_base == 10, but extra in "C"
1007+ // library for blank.
1008+ bool __ret = false;
1009+ const size_t __bitmasksize = 11;
1010+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1011+ if (__m & _M_bit[__bitcur]
1012+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
1013+ {
1014+ __ret = true;
1015+ break;
1016+ }
1017+ return __ret;
1018+ }
1019+
1020+ const wchar_t*
1021+ ctype<wchar_t>::
1022+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1023+ {
1024+ for (; __lo < __hi; ++__vec, ++__lo)
1025+ {
1026+ // Highest bitmask in ctype_base == 10, but extra in "C"
1027+ // library for blank.
1028+ const size_t __bitmasksize = 11;
1029+ mask __m = 0;
1030+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1031+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
1032+ __m |= _M_bit[__bitcur];
1033+ *__vec = __m;
1034+ }
1035+ return __hi;
1036+ }
1037+
1038+ const wchar_t*
1039+ ctype<wchar_t>::
1040+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1041+ {
1042+ while (__lo < __hi && !this->do_is(__m, *__lo))
1043+ ++__lo;
1044+ return __lo;
1045+ }
1046+
1047+ const wchar_t*
1048+ ctype<wchar_t>::
1049+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1050+ {
1051+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1052+ ++__lo;
1053+ return __lo;
1054+ }
1055+
1056+ wchar_t
1057+ ctype<wchar_t>::
1058+ do_widen(char __c) const
1059+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1060+
1061+ const char*
1062+ ctype<wchar_t>::
1063+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1064+ {
1065+ while (__lo < __hi)
1066+ {
1067+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1068+ ++__lo;
1069+ ++__dest;
1070+ }
1071+ return __hi;
1072+ }
1073+
1074+ char
1075+ ctype<wchar_t>::
1076+ do_narrow(wchar_t __wc, char __dfault) const
1077+ {
1078+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1079+ return _M_narrow[__wc];
1080+#ifdef __UCLIBC_HAS_XLOCALE__
1081+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1082+#endif
1083+ const int __c = wctob(__wc);
1084+#ifdef __UCLIBC_HAS_XLOCALE__
1085+ __uselocale(__old);
1086+#endif
1087+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1088+ }
1089+
1090+ const wchar_t*
1091+ ctype<wchar_t>::
1092+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1093+ char* __dest) const
1094+ {
1095+#ifdef __UCLIBC_HAS_XLOCALE__
1096+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1097+#endif
1098+ if (_M_narrow_ok)
1099+ while (__lo < __hi)
1100+ {
1101+ if (*__lo >= 0 && *__lo < 128)
1102+ *__dest = _M_narrow[*__lo];
1103+ else
1104+ {
1105+ const int __c = wctob(*__lo);
1106+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1107+ }
1108+ ++__lo;
1109+ ++__dest;
1110+ }
1111+ else
1112+ while (__lo < __hi)
1113+ {
1114+ const int __c = wctob(*__lo);
1115+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1116+ ++__lo;
1117+ ++__dest;
1118+ }
1119+#ifdef __UCLIBC_HAS_XLOCALE__
1120+ __uselocale(__old);
1121+#endif
1122+ return __hi;
1123+ }
1124+
1125+ void
1126+ ctype<wchar_t>::_M_initialize_ctype()
1127+ {
1128+#ifdef __UCLIBC_HAS_XLOCALE__
1129+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1130+#endif
1131+ wint_t __i;
1132+ for (__i = 0; __i < 128; ++__i)
1133+ {
1134+ const int __c = wctob(__i);
1135+ if (__c == EOF)
1136+ break;
1137+ else
1138+ _M_narrow[__i] = static_cast<char>(__c);
1139+ }
1140+ if (__i == 128)
1141+ _M_narrow_ok = true;
1142+ else
1143+ _M_narrow_ok = false;
1144+ for (size_t __j = 0;
1145+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1146+ _M_widen[__j] = btowc(__j);
1147+
1148+ for (size_t __k = 0; __k <= 11; ++__k)
1149+ {
1150+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1151+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1152+ }
1153+#ifdef __UCLIBC_HAS_XLOCALE__
1154+ __uselocale(__old);
1155+#endif
1156+ }
1157+#endif // _GLIBCXX_USE_WCHAR_T
1158+}
1159diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
1160new file mode 100644
1161index 0000000..13594d9
1162--- /dev/null
1163+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
1164@@ -0,0 +1,100 @@
1165+// std::messages implementation details, GNU version -*- C++ -*-
1166+
1167+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1168+//
1169+// This file is part of the GNU ISO C++ Library. This library is free
1170+// software; you can redistribute it and/or modify it under the
1171+// terms of the GNU General Public License as published by the
1172+// Free Software Foundation; either version 2, or (at your option)
1173+// any later version.
1174+
1175+// This library is distributed in the hope that it will be useful,
1176+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1177+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1178+// GNU General Public License for more details.
1179+
1180+// You should have received a copy of the GNU General Public License along
1181+// with this library; see the file COPYING. If not, write to the Free
1182+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1183+// USA.
1184+
1185+// As a special exception, you may use this file as part of a free software
1186+// library without restriction. Specifically, if other files instantiate
1187+// templates or use macros or inline functions from this file, or you compile
1188+// this file and link it with other files to produce an executable, this
1189+// file does not by itself cause the resulting executable to be covered by
1190+// the GNU General Public License. This exception does not however
1191+// invalidate any other reasons why the executable file might be covered by
1192+// the GNU General Public License.
1193+
1194+//
1195+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1196+//
1197+
1198+// Written by Benjamin Kosnik <bkoz@redhat.com>
1199+
1200+#include <locale>
1201+#include <bits/c++locale_internal.h>
1202+
1203+#ifdef __UCLIBC_MJN3_ONLY__
1204+#warning fix gettext stuff
1205+#endif
1206+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1207+extern "C" char *__dcgettext(const char *domainname,
1208+ const char *msgid, int category);
1209+#undef gettext
1210+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1211+#else
1212+#undef gettext
1213+#define gettext(msgid) (msgid)
1214+#endif
1215+
1216+namespace std
1217+{
1218+ // Specializations.
1219+ template<>
1220+ string
1221+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1222+ {
1223+#ifdef __UCLIBC_HAS_XLOCALE__
1224+ __c_locale __old = __uselocale(_M_c_locale_messages);
1225+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1226+ __uselocale(__old);
1227+ return string(__msg);
1228+#elif defined __UCLIBC_HAS_LOCALE__
1229+ char* __old = strdup(setlocale(LC_ALL, NULL));
1230+ setlocale(LC_ALL, _M_name_messages);
1231+ const char* __msg = gettext(__dfault.c_str());
1232+ setlocale(LC_ALL, __old);
1233+ free(__old);
1234+ return string(__msg);
1235+#else
1236+ const char* __msg = gettext(__dfault.c_str());
1237+ return string(__msg);
1238+#endif
1239+ }
1240+
1241+#ifdef _GLIBCXX_USE_WCHAR_T
1242+ template<>
1243+ wstring
1244+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1245+ {
1246+# ifdef __UCLIBC_HAS_XLOCALE__
1247+ __c_locale __old = __uselocale(_M_c_locale_messages);
1248+ char* __msg = gettext(_M_convert_to_char(__dfault));
1249+ __uselocale(__old);
1250+ return _M_convert_from_char(__msg);
1251+# elif defined __UCLIBC_HAS_LOCALE__
1252+ char* __old = strdup(setlocale(LC_ALL, NULL));
1253+ setlocale(LC_ALL, _M_name_messages);
1254+ char* __msg = gettext(_M_convert_to_char(__dfault));
1255+ setlocale(LC_ALL, __old);
1256+ free(__old);
1257+ return _M_convert_from_char(__msg);
1258+# else
1259+ char* __msg = gettext(_M_convert_to_char(__dfault));
1260+ return _M_convert_from_char(__msg);
1261+# endif
1262+ }
1263+#endif
1264+}
1265diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
1266new file mode 100644
1267index 0000000..1424078
1268--- /dev/null
1269+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
1270@@ -0,0 +1,118 @@
1271+// std::messages implementation details, GNU version -*- C++ -*-
1272+
1273+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1274+//
1275+// This file is part of the GNU ISO C++ Library. This library is free
1276+// software; you can redistribute it and/or modify it under the
1277+// terms of the GNU General Public License as published by the
1278+// Free Software Foundation; either version 2, or (at your option)
1279+// any later version.
1280+
1281+// This library is distributed in the hope that it will be useful,
1282+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1283+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1284+// GNU General Public License for more details.
1285+
1286+// You should have received a copy of the GNU General Public License along
1287+// with this library; see the file COPYING. If not, write to the Free
1288+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1289+// USA.
1290+
1291+// As a special exception, you may use this file as part of a free software
1292+// library without restriction. Specifically, if other files instantiate
1293+// templates or use macros or inline functions from this file, or you compile
1294+// this file and link it with other files to produce an executable, this
1295+// file does not by itself cause the resulting executable to be covered by
1296+// the GNU General Public License. This exception does not however
1297+// invalidate any other reasons why the executable file might be covered by
1298+// the GNU General Public License.
1299+
1300+//
1301+// ISO C++ 14882: 22.2.7.1.2 messages functions
1302+//
1303+
1304+// Written by Benjamin Kosnik <bkoz@redhat.com>
1305+
1306+#ifdef __UCLIBC_MJN3_ONLY__
1307+#warning fix prototypes for *textdomain funcs
1308+#endif
1309+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1310+extern "C" char *__textdomain(const char *domainname);
1311+extern "C" char *__bindtextdomain(const char *domainname,
1312+ const char *dirname);
1313+#else
1314+#undef __textdomain
1315+#undef __bindtextdomain
1316+#define __textdomain(D) ((void)0)
1317+#define __bindtextdomain(D,P) ((void)0)
1318+#endif
1319+
1320+ // Non-virtual member functions.
1321+ template<typename _CharT>
1322+ messages<_CharT>::messages(size_t __refs)
1323+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1324+ _M_name_messages(_S_get_c_name())
1325+ { }
1326+
1327+ template<typename _CharT>
1328+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1329+ size_t __refs)
1330+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1331+ _M_name_messages(__s)
1332+ {
1333+ char* __tmp = new char[std::strlen(__s) + 1];
1334+ std::strcpy(__tmp, __s);
1335+ _M_name_messages = __tmp;
1336+ }
1337+
1338+ template<typename _CharT>
1339+ typename messages<_CharT>::catalog
1340+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1341+ const char* __dir) const
1342+ {
1343+ __bindtextdomain(__s.c_str(), __dir);
1344+ return this->do_open(__s, __loc);
1345+ }
1346+
1347+ // Virtual member functions.
1348+ template<typename _CharT>
1349+ messages<_CharT>::~messages()
1350+ {
1351+ if (_M_name_messages != _S_get_c_name())
1352+ delete [] _M_name_messages;
1353+ _S_destroy_c_locale(_M_c_locale_messages);
1354+ }
1355+
1356+ template<typename _CharT>
1357+ typename messages<_CharT>::catalog
1358+ messages<_CharT>::do_open(const basic_string<char>& __s,
1359+ const locale&) const
1360+ {
1361+ // No error checking is done, assume the catalog exists and can
1362+ // be used.
1363+ __textdomain(__s.c_str());
1364+ return 0;
1365+ }
1366+
1367+ template<typename _CharT>
1368+ void
1369+ messages<_CharT>::do_close(catalog) const
1370+ { }
1371+
1372+ // messages_byname
1373+ template<typename _CharT>
1374+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1375+ : messages<_CharT>(__refs)
1376+ {
1377+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1378+ delete [] this->_M_name_messages;
1379+ char* __tmp = new char[std::strlen(__s) + 1];
1380+ std::strcpy(__tmp, __s);
1381+ this->_M_name_messages = __tmp;
1382+
1383+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1384+ {
1385+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1386+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1387+ }
1388+ }
1389diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1390new file mode 100644
1391index 0000000..aa52731
1392--- /dev/null
1393+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1394@@ -0,0 +1,692 @@
1395+// std::moneypunct implementation details, GNU version -*- C++ -*-
1396+
1397+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1398+//
1399+// This file is part of the GNU ISO C++ Library. This library is free
1400+// software; you can redistribute it and/or modify it under the
1401+// terms of the GNU General Public License as published by the
1402+// Free Software Foundation; either version 2, or (at your option)
1403+// any later version.
1404+
1405+// This library is distributed in the hope that it will be useful,
1406+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1407+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1408+// GNU General Public License for more details.
1409+
1410+// You should have received a copy of the GNU General Public License along
1411+// with this library; see the file COPYING. If not, write to the Free
1412+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1413+// USA.
1414+
1415+// As a special exception, you may use this file as part of a free software
1416+// library without restriction. Specifically, if other files instantiate
1417+// templates or use macros or inline functions from this file, or you compile
1418+// this file and link it with other files to produce an executable, this
1419+// file does not by itself cause the resulting executable to be covered by
1420+// the GNU General Public License. This exception does not however
1421+// invalidate any other reasons why the executable file might be covered by
1422+// the GNU General Public License.
1423+
1424+//
1425+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1426+//
1427+
1428+// Written by Benjamin Kosnik <bkoz@redhat.com>
1429+
1430+#define _LIBC
1431+#include <locale>
1432+#undef _LIBC
1433+#include <bits/c++locale_internal.h>
1434+
1435+#ifdef __UCLIBC_MJN3_ONLY__
1436+#warning optimize this for uclibc
1437+#warning tailor for stub locale support
1438+#endif
1439+
1440+#ifndef __UCLIBC_HAS_XLOCALE__
1441+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1442+#endif
1443+
1444+namespace std
1445+{
1446+ // Construct and return valid pattern consisting of some combination of:
1447+ // space none symbol sign value
1448+ money_base::pattern
1449+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1450+ {
1451+ pattern __ret;
1452+
1453+ // This insanely complicated routine attempts to construct a valid
1454+ // pattern for use with monyepunct. A couple of invariants:
1455+
1456+ // if (__precedes) symbol -> value
1457+ // else value -> symbol
1458+
1459+ // if (__space) space
1460+ // else none
1461+
1462+ // none == never first
1463+ // space never first or last
1464+
1465+ // Any elegant implementations of this are welcome.
1466+ switch (__posn)
1467+ {
1468+ case 0:
1469+ case 1:
1470+ // 1 The sign precedes the value and symbol.
1471+ __ret.field[0] = sign;
1472+ if (__space)
1473+ {
1474+ // Pattern starts with sign.
1475+ if (__precedes)
1476+ {
1477+ __ret.field[1] = symbol;
1478+ __ret.field[3] = value;
1479+ }
1480+ else
1481+ {
1482+ __ret.field[1] = value;
1483+ __ret.field[3] = symbol;
1484+ }
1485+ __ret.field[2] = space;
1486+ }
1487+ else
1488+ {
1489+ // Pattern starts with sign and ends with none.
1490+ if (__precedes)
1491+ {
1492+ __ret.field[1] = symbol;
1493+ __ret.field[2] = value;
1494+ }
1495+ else
1496+ {
1497+ __ret.field[1] = value;
1498+ __ret.field[2] = symbol;
1499+ }
1500+ __ret.field[3] = none;
1501+ }
1502+ break;
1503+ case 2:
1504+ // 2 The sign follows the value and symbol.
1505+ if (__space)
1506+ {
1507+ // Pattern either ends with sign.
1508+ if (__precedes)
1509+ {
1510+ __ret.field[0] = symbol;
1511+ __ret.field[2] = value;
1512+ }
1513+ else
1514+ {
1515+ __ret.field[0] = value;
1516+ __ret.field[2] = symbol;
1517+ }
1518+ __ret.field[1] = space;
1519+ __ret.field[3] = sign;
1520+ }
1521+ else
1522+ {
1523+ // Pattern ends with sign then none.
1524+ if (__precedes)
1525+ {
1526+ __ret.field[0] = symbol;
1527+ __ret.field[1] = value;
1528+ }
1529+ else
1530+ {
1531+ __ret.field[0] = value;
1532+ __ret.field[1] = symbol;
1533+ }
1534+ __ret.field[2] = sign;
1535+ __ret.field[3] = none;
1536+ }
1537+ break;
1538+ case 3:
1539+ // 3 The sign immediately precedes the symbol.
1540+ if (__precedes)
1541+ {
1542+ __ret.field[0] = sign;
1543+ __ret.field[1] = symbol;
1544+ if (__space)
1545+ {
1546+ __ret.field[2] = space;
1547+ __ret.field[3] = value;
1548+ }
1549+ else
1550+ {
1551+ __ret.field[2] = value;
1552+ __ret.field[3] = none;
1553+ }
1554+ }
1555+ else
1556+ {
1557+ __ret.field[0] = value;
1558+ if (__space)
1559+ {
1560+ __ret.field[1] = space;
1561+ __ret.field[2] = sign;
1562+ __ret.field[3] = symbol;
1563+ }
1564+ else
1565+ {
1566+ __ret.field[1] = sign;
1567+ __ret.field[2] = symbol;
1568+ __ret.field[3] = none;
1569+ }
1570+ }
1571+ break;
1572+ case 4:
1573+ // 4 The sign immediately follows the symbol.
1574+ if (__precedes)
1575+ {
1576+ __ret.field[0] = symbol;
1577+ __ret.field[1] = sign;
1578+ if (__space)
1579+ {
1580+ __ret.field[2] = space;
1581+ __ret.field[3] = value;
1582+ }
1583+ else
1584+ {
1585+ __ret.field[2] = value;
1586+ __ret.field[3] = none;
1587+ }
1588+ }
1589+ else
1590+ {
1591+ __ret.field[0] = value;
1592+ if (__space)
1593+ {
1594+ __ret.field[1] = space;
1595+ __ret.field[2] = symbol;
1596+ __ret.field[3] = sign;
1597+ }
1598+ else
1599+ {
1600+ __ret.field[1] = symbol;
1601+ __ret.field[2] = sign;
1602+ __ret.field[3] = none;
1603+ }
1604+ }
1605+ break;
1606+ default:
1607+ ;
1608+ }
1609+ return __ret;
1610+ }
1611+
1612+ template<>
1613+ void
1614+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1615+ const char*)
1616+ {
1617+ if (!_M_data)
1618+ _M_data = new __moneypunct_cache<char, true>;
1619+
1620+ if (!__cloc)
1621+ {
1622+ // "C" locale
1623+ _M_data->_M_decimal_point = '.';
1624+ _M_data->_M_thousands_sep = ',';
1625+ _M_data->_M_grouping = "";
1626+ _M_data->_M_grouping_size = 0;
1627+ _M_data->_M_curr_symbol = "";
1628+ _M_data->_M_curr_symbol_size = 0;
1629+ _M_data->_M_positive_sign = "";
1630+ _M_data->_M_positive_sign_size = 0;
1631+ _M_data->_M_negative_sign = "";
1632+ _M_data->_M_negative_sign_size = 0;
1633+ _M_data->_M_frac_digits = 0;
1634+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1635+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1636+
1637+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1638+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1639+ }
1640+ else
1641+ {
1642+ // Named locale.
1643+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1644+ __cloc));
1645+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1646+ __cloc));
1647+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1648+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1649+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1650+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1651+
1652+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1653+ if (!__nposn)
1654+ _M_data->_M_negative_sign = "()";
1655+ else
1656+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1657+ __cloc);
1658+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1659+
1660+ // _Intl == true
1661+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1662+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1663+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1664+ __cloc));
1665+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1666+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1667+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1668+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1669+ __pposn);
1670+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1671+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1672+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1673+ __nposn);
1674+ }
1675+ }
1676+
1677+ template<>
1678+ void
1679+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1680+ const char*)
1681+ {
1682+ if (!_M_data)
1683+ _M_data = new __moneypunct_cache<char, false>;
1684+
1685+ if (!__cloc)
1686+ {
1687+ // "C" locale
1688+ _M_data->_M_decimal_point = '.';
1689+ _M_data->_M_thousands_sep = ',';
1690+ _M_data->_M_grouping = "";
1691+ _M_data->_M_grouping_size = 0;
1692+ _M_data->_M_curr_symbol = "";
1693+ _M_data->_M_curr_symbol_size = 0;
1694+ _M_data->_M_positive_sign = "";
1695+ _M_data->_M_positive_sign_size = 0;
1696+ _M_data->_M_negative_sign = "";
1697+ _M_data->_M_negative_sign_size = 0;
1698+ _M_data->_M_frac_digits = 0;
1699+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1700+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1701+
1702+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1703+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1704+ }
1705+ else
1706+ {
1707+ // Named locale.
1708+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1709+ __cloc));
1710+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1711+ __cloc));
1712+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1713+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1714+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1715+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1716+
1717+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1718+ if (!__nposn)
1719+ _M_data->_M_negative_sign = "()";
1720+ else
1721+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1722+ __cloc);
1723+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1724+
1725+ // _Intl == false
1726+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1727+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1728+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1729+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1730+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1731+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1732+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1733+ __pposn);
1734+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1735+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1736+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1737+ __nposn);
1738+ }
1739+ }
1740+
1741+ template<>
1742+ moneypunct<char, true>::~moneypunct()
1743+ { delete _M_data; }
1744+
1745+ template<>
1746+ moneypunct<char, false>::~moneypunct()
1747+ { delete _M_data; }
1748+
1749+#ifdef _GLIBCXX_USE_WCHAR_T
1750+ template<>
1751+ void
1752+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1753+#ifdef __UCLIBC_HAS_XLOCALE__
1754+ const char*)
1755+#else
1756+ const char* __name)
1757+#endif
1758+ {
1759+ if (!_M_data)
1760+ _M_data = new __moneypunct_cache<wchar_t, true>;
1761+
1762+ if (!__cloc)
1763+ {
1764+ // "C" locale
1765+ _M_data->_M_decimal_point = L'.';
1766+ _M_data->_M_thousands_sep = L',';
1767+ _M_data->_M_grouping = "";
1768+ _M_data->_M_grouping_size = 0;
1769+ _M_data->_M_curr_symbol = L"";
1770+ _M_data->_M_curr_symbol_size = 0;
1771+ _M_data->_M_positive_sign = L"";
1772+ _M_data->_M_positive_sign_size = 0;
1773+ _M_data->_M_negative_sign = L"";
1774+ _M_data->_M_negative_sign_size = 0;
1775+ _M_data->_M_frac_digits = 0;
1776+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1777+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1778+
1779+ // Use ctype::widen code without the facet...
1780+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1781+ _M_data->_M_atoms[__i] =
1782+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1783+ }
1784+ else
1785+ {
1786+ // Named locale.
1787+#ifdef __UCLIBC_HAS_XLOCALE__
1788+ __c_locale __old = __uselocale(__cloc);
1789+#else
1790+ // Switch to named locale so that mbsrtowcs will work.
1791+ char* __old = strdup(setlocale(LC_ALL, NULL));
1792+ setlocale(LC_ALL, __name);
1793+#endif
1794+
1795+#ifdef __UCLIBC_MJN3_ONLY__
1796+#warning fix this... should be monetary
1797+#endif
1798+#ifdef __UCLIBC__
1799+# ifdef __UCLIBC_HAS_XLOCALE__
1800+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1801+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1802+# else
1803+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1804+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1805+# endif
1806+#else
1807+ union { char *__s; wchar_t __w; } __u;
1808+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1809+ _M_data->_M_decimal_point = __u.__w;
1810+
1811+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1812+ _M_data->_M_thousands_sep = __u.__w;
1813+#endif
1814+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1815+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1816+
1817+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1818+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1819+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1820+
1821+ wchar_t* __wcs_ps = 0;
1822+ wchar_t* __wcs_ns = 0;
1823+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1824+ try
1825+ {
1826+ mbstate_t __state;
1827+ size_t __len = strlen(__cpossign);
1828+ if (__len)
1829+ {
1830+ ++__len;
1831+ memset(&__state, 0, sizeof(mbstate_t));
1832+ __wcs_ps = new wchar_t[__len];
1833+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1834+ _M_data->_M_positive_sign = __wcs_ps;
1835+ }
1836+ else
1837+ _M_data->_M_positive_sign = L"";
1838+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1839+
1840+ __len = strlen(__cnegsign);
1841+ if (!__nposn)
1842+ _M_data->_M_negative_sign = L"()";
1843+ else if (__len)
1844+ {
1845+ ++__len;
1846+ memset(&__state, 0, sizeof(mbstate_t));
1847+ __wcs_ns = new wchar_t[__len];
1848+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1849+ _M_data->_M_negative_sign = __wcs_ns;
1850+ }
1851+ else
1852+ _M_data->_M_negative_sign = L"";
1853+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1854+
1855+ // _Intl == true.
1856+ __len = strlen(__ccurr);
1857+ if (__len)
1858+ {
1859+ ++__len;
1860+ memset(&__state, 0, sizeof(mbstate_t));
1861+ wchar_t* __wcs = new wchar_t[__len];
1862+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1863+ _M_data->_M_curr_symbol = __wcs;
1864+ }
1865+ else
1866+ _M_data->_M_curr_symbol = L"";
1867+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1868+ }
1869+ catch (...)
1870+ {
1871+ delete _M_data;
1872+ _M_data = 0;
1873+ delete __wcs_ps;
1874+ delete __wcs_ns;
1875+#ifdef __UCLIBC_HAS_XLOCALE__
1876+ __uselocale(__old);
1877+#else
1878+ setlocale(LC_ALL, __old);
1879+ free(__old);
1880+#endif
1881+ __throw_exception_again;
1882+ }
1883+
1884+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1885+ __cloc));
1886+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1887+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1888+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1889+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1890+ __pposn);
1891+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1892+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1893+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1894+ __nposn);
1895+
1896+#ifdef __UCLIBC_HAS_XLOCALE__
1897+ __uselocale(__old);
1898+#else
1899+ setlocale(LC_ALL, __old);
1900+ free(__old);
1901+#endif
1902+ }
1903+ }
1904+
1905+ template<>
1906+ void
1907+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1908+#ifdef __UCLIBC_HAS_XLOCALE__
1909+ const char*)
1910+#else
1911+ const char* __name)
1912+#endif
1913+ {
1914+ if (!_M_data)
1915+ _M_data = new __moneypunct_cache<wchar_t, false>;
1916+
1917+ if (!__cloc)
1918+ {
1919+ // "C" locale
1920+ _M_data->_M_decimal_point = L'.';
1921+ _M_data->_M_thousands_sep = L',';
1922+ _M_data->_M_grouping = "";
1923+ _M_data->_M_grouping_size = 0;
1924+ _M_data->_M_curr_symbol = L"";
1925+ _M_data->_M_curr_symbol_size = 0;
1926+ _M_data->_M_positive_sign = L"";
1927+ _M_data->_M_positive_sign_size = 0;
1928+ _M_data->_M_negative_sign = L"";
1929+ _M_data->_M_negative_sign_size = 0;
1930+ _M_data->_M_frac_digits = 0;
1931+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1932+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1933+
1934+ // Use ctype::widen code without the facet...
1935+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1936+ _M_data->_M_atoms[__i] =
1937+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1938+ }
1939+ else
1940+ {
1941+ // Named locale.
1942+#ifdef __UCLIBC_HAS_XLOCALE__
1943+ __c_locale __old = __uselocale(__cloc);
1944+#else
1945+ // Switch to named locale so that mbsrtowcs will work.
1946+ char* __old = strdup(setlocale(LC_ALL, NULL));
1947+ setlocale(LC_ALL, __name);
1948+#endif
1949+
1950+#ifdef __UCLIBC_MJN3_ONLY__
1951+#warning fix this... should be monetary
1952+#endif
1953+#ifdef __UCLIBC__
1954+# ifdef __UCLIBC_HAS_XLOCALE__
1955+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1956+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1957+# else
1958+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1959+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1960+# endif
1961+#else
1962+ union { char *__s; wchar_t __w; } __u;
1963+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1964+ _M_data->_M_decimal_point = __u.__w;
1965+
1966+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1967+ _M_data->_M_thousands_sep = __u.__w;
1968+#endif
1969+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1970+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1971+
1972+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1973+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1974+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1975+
1976+ wchar_t* __wcs_ps = 0;
1977+ wchar_t* __wcs_ns = 0;
1978+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1979+ try
1980+ {
1981+ mbstate_t __state;
1982+ size_t __len;
1983+ __len = strlen(__cpossign);
1984+ if (__len)
1985+ {
1986+ ++__len;
1987+ memset(&__state, 0, sizeof(mbstate_t));
1988+ __wcs_ps = new wchar_t[__len];
1989+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1990+ _M_data->_M_positive_sign = __wcs_ps;
1991+ }
1992+ else
1993+ _M_data->_M_positive_sign = L"";
1994+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1995+
1996+ __len = strlen(__cnegsign);
1997+ if (!__nposn)
1998+ _M_data->_M_negative_sign = L"()";
1999+ else if (__len)
2000+ {
2001+ ++__len;
2002+ memset(&__state, 0, sizeof(mbstate_t));
2003+ __wcs_ns = new wchar_t[__len];
2004+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2005+ _M_data->_M_negative_sign = __wcs_ns;
2006+ }
2007+ else
2008+ _M_data->_M_negative_sign = L"";
2009+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2010+
2011+ // _Intl == true.
2012+ __len = strlen(__ccurr);
2013+ if (__len)
2014+ {
2015+ ++__len;
2016+ memset(&__state, 0, sizeof(mbstate_t));
2017+ wchar_t* __wcs = new wchar_t[__len];
2018+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2019+ _M_data->_M_curr_symbol = __wcs;
2020+ }
2021+ else
2022+ _M_data->_M_curr_symbol = L"";
2023+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2024+ }
2025+ catch (...)
2026+ {
2027+ delete _M_data;
2028+ _M_data = 0;
2029+ delete __wcs_ps;
2030+ delete __wcs_ns;
2031+#ifdef __UCLIBC_HAS_XLOCALE__
2032+ __uselocale(__old);
2033+#else
2034+ setlocale(LC_ALL, __old);
2035+ free(__old);
2036+#endif
2037+ __throw_exception_again;
2038+ }
2039+
2040+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2041+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2042+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2043+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2044+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2045+ __pposn);
2046+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2047+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2048+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2049+ __nposn);
2050+
2051+#ifdef __UCLIBC_HAS_XLOCALE__
2052+ __uselocale(__old);
2053+#else
2054+ setlocale(LC_ALL, __old);
2055+ free(__old);
2056+#endif
2057+ }
2058+ }
2059+
2060+ template<>
2061+ moneypunct<wchar_t, true>::~moneypunct()
2062+ {
2063+ if (_M_data->_M_positive_sign_size)
2064+ delete [] _M_data->_M_positive_sign;
2065+ if (_M_data->_M_negative_sign_size
2066+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2067+ delete [] _M_data->_M_negative_sign;
2068+ if (_M_data->_M_curr_symbol_size)
2069+ delete [] _M_data->_M_curr_symbol;
2070+ delete _M_data;
2071+ }
2072+
2073+ template<>
2074+ moneypunct<wchar_t, false>::~moneypunct()
2075+ {
2076+ if (_M_data->_M_positive_sign_size)
2077+ delete [] _M_data->_M_positive_sign;
2078+ if (_M_data->_M_negative_sign_size
2079+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2080+ delete [] _M_data->_M_negative_sign;
2081+ if (_M_data->_M_curr_symbol_size)
2082+ delete [] _M_data->_M_curr_symbol;
2083+ delete _M_data;
2084+ }
2085+#endif
2086+}
2087diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2088new file mode 100644
2089index 0000000..883ec1a
2090--- /dev/null
2091+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2092@@ -0,0 +1,160 @@
2093+// std::numpunct implementation details, GNU version -*- C++ -*-
2094+
2095+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2096+//
2097+// This file is part of the GNU ISO C++ Library. This library is free
2098+// software; you can redistribute it and/or modify it under the
2099+// terms of the GNU General Public License as published by the
2100+// Free Software Foundation; either version 2, or (at your option)
2101+// any later version.
2102+
2103+// This library is distributed in the hope that it will be useful,
2104+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2105+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2106+// GNU General Public License for more details.
2107+
2108+// You should have received a copy of the GNU General Public License along
2109+// with this library; see the file COPYING. If not, write to the Free
2110+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2111+// USA.
2112+
2113+// As a special exception, you may use this file as part of a free software
2114+// library without restriction. Specifically, if other files instantiate
2115+// templates or use macros or inline functions from this file, or you compile
2116+// this file and link it with other files to produce an executable, this
2117+// file does not by itself cause the resulting executable to be covered by
2118+// the GNU General Public License. This exception does not however
2119+// invalidate any other reasons why the executable file might be covered by
2120+// the GNU General Public License.
2121+
2122+//
2123+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2124+//
2125+
2126+// Written by Benjamin Kosnik <bkoz@redhat.com>
2127+
2128+#define _LIBC
2129+#include <locale>
2130+#undef _LIBC
2131+#include <bits/c++locale_internal.h>
2132+
2133+#ifdef __UCLIBC_MJN3_ONLY__
2134+#warning tailor for stub locale support
2135+#endif
2136+#ifndef __UCLIBC_HAS_XLOCALE__
2137+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2138+#endif
2139+
2140+namespace std
2141+{
2142+ template<>
2143+ void
2144+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2145+ {
2146+ if (!_M_data)
2147+ _M_data = new __numpunct_cache<char>;
2148+
2149+ if (!__cloc)
2150+ {
2151+ // "C" locale
2152+ _M_data->_M_grouping = "";
2153+ _M_data->_M_grouping_size = 0;
2154+ _M_data->_M_use_grouping = false;
2155+
2156+ _M_data->_M_decimal_point = '.';
2157+ _M_data->_M_thousands_sep = ',';
2158+
2159+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2160+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2161+
2162+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2163+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2164+ }
2165+ else
2166+ {
2167+ // Named locale.
2168+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2169+ __cloc));
2170+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2171+ __cloc));
2172+
2173+ // Check for NULL, which implies no grouping.
2174+ if (_M_data->_M_thousands_sep == '\0')
2175+ _M_data->_M_grouping = "";
2176+ else
2177+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2178+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2179+ }
2180+
2181+ // NB: There is no way to extact this info from posix locales.
2182+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2183+ _M_data->_M_truename = "true";
2184+ _M_data->_M_truename_size = 4;
2185+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2186+ _M_data->_M_falsename = "false";
2187+ _M_data->_M_falsename_size = 5;
2188+ }
2189+
2190+ template<>
2191+ numpunct<char>::~numpunct()
2192+ { delete _M_data; }
2193+
2194+#ifdef _GLIBCXX_USE_WCHAR_T
2195+ template<>
2196+ void
2197+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2198+ {
2199+ if (!_M_data)
2200+ _M_data = new __numpunct_cache<wchar_t>;
2201+
2202+ if (!__cloc)
2203+ {
2204+ // "C" locale
2205+ _M_data->_M_grouping = "";
2206+ _M_data->_M_grouping_size = 0;
2207+ _M_data->_M_use_grouping = false;
2208+
2209+ _M_data->_M_decimal_point = L'.';
2210+ _M_data->_M_thousands_sep = L',';
2211+
2212+ // Use ctype::widen code without the facet...
2213+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2214+ _M_data->_M_atoms_out[__i] =
2215+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2216+
2217+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2218+ _M_data->_M_atoms_in[__j] =
2219+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2220+ }
2221+ else
2222+ {
2223+ // Named locale.
2224+ // NB: In the GNU model wchar_t is always 32 bit wide.
2225+ union { char *__s; wchar_t __w; } __u;
2226+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2227+ _M_data->_M_decimal_point = __u.__w;
2228+
2229+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2230+ _M_data->_M_thousands_sep = __u.__w;
2231+
2232+ if (_M_data->_M_thousands_sep == L'\0')
2233+ _M_data->_M_grouping = "";
2234+ else
2235+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2236+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2237+ }
2238+
2239+ // NB: There is no way to extact this info from posix locales.
2240+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2241+ _M_data->_M_truename = L"true";
2242+ _M_data->_M_truename_size = 4;
2243+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2244+ _M_data->_M_falsename = L"false";
2245+ _M_data->_M_falsename_size = 5;
2246+ }
2247+
2248+ template<>
2249+ numpunct<wchar_t>::~numpunct()
2250+ { delete _M_data; }
2251+ #endif
2252+}
2253diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
2254new file mode 100644
2255index 0000000..e0707d7
2256--- /dev/null
2257+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
2258@@ -0,0 +1,406 @@
2259+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2260+
2261+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2262+//
2263+// This file is part of the GNU ISO C++ Library. This library is free
2264+// software; you can redistribute it and/or modify it under the
2265+// terms of the GNU General Public License as published by the
2266+// Free Software Foundation; either version 2, or (at your option)
2267+// any later version.
2268+
2269+// This library is distributed in the hope that it will be useful,
2270+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2271+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2272+// GNU General Public License for more details.
2273+
2274+// You should have received a copy of the GNU General Public License along
2275+// with this library; see the file COPYING. If not, write to the Free
2276+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2277+// USA.
2278+
2279+// As a special exception, you may use this file as part of a free software
2280+// library without restriction. Specifically, if other files instantiate
2281+// templates or use macros or inline functions from this file, or you compile
2282+// this file and link it with other files to produce an executable, this
2283+// file does not by itself cause the resulting executable to be covered by
2284+// the GNU General Public License. This exception does not however
2285+// invalidate any other reasons why the executable file might be covered by
2286+// the GNU General Public License.
2287+
2288+//
2289+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2290+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2291+//
2292+
2293+// Written by Benjamin Kosnik <bkoz@redhat.com>
2294+
2295+#include <locale>
2296+#include <bits/c++locale_internal.h>
2297+
2298+#ifdef __UCLIBC_MJN3_ONLY__
2299+#warning tailor for stub locale support
2300+#endif
2301+#ifndef __UCLIBC_HAS_XLOCALE__
2302+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2303+#endif
2304+
2305+namespace std
2306+{
2307+ template<>
2308+ void
2309+ __timepunct<char>::
2310+ _M_put(char* __s, size_t __maxlen, const char* __format,
2311+ const tm* __tm) const
2312+ {
2313+#ifdef __UCLIBC_HAS_XLOCALE__
2314+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2315+ _M_c_locale_timepunct);
2316+#else
2317+ char* __old = strdup(setlocale(LC_ALL, NULL));
2318+ setlocale(LC_ALL, _M_name_timepunct);
2319+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2320+ setlocale(LC_ALL, __old);
2321+ free(__old);
2322+#endif
2323+ // Make sure __s is null terminated.
2324+ if (__len == 0)
2325+ __s[0] = '\0';
2326+ }
2327+
2328+ template<>
2329+ void
2330+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2331+ {
2332+ if (!_M_data)
2333+ _M_data = new __timepunct_cache<char>;
2334+
2335+ if (!__cloc)
2336+ {
2337+ // "C" locale
2338+ _M_c_locale_timepunct = _S_get_c_locale();
2339+
2340+ _M_data->_M_date_format = "%m/%d/%y";
2341+ _M_data->_M_date_era_format = "%m/%d/%y";
2342+ _M_data->_M_time_format = "%H:%M:%S";
2343+ _M_data->_M_time_era_format = "%H:%M:%S";
2344+ _M_data->_M_date_time_format = "";
2345+ _M_data->_M_date_time_era_format = "";
2346+ _M_data->_M_am = "AM";
2347+ _M_data->_M_pm = "PM";
2348+ _M_data->_M_am_pm_format = "";
2349+
2350+ // Day names, starting with "C"'s Sunday.
2351+ _M_data->_M_day1 = "Sunday";
2352+ _M_data->_M_day2 = "Monday";
2353+ _M_data->_M_day3 = "Tuesday";
2354+ _M_data->_M_day4 = "Wednesday";
2355+ _M_data->_M_day5 = "Thursday";
2356+ _M_data->_M_day6 = "Friday";
2357+ _M_data->_M_day7 = "Saturday";
2358+
2359+ // Abbreviated day names, starting with "C"'s Sun.
2360+ _M_data->_M_aday1 = "Sun";
2361+ _M_data->_M_aday2 = "Mon";
2362+ _M_data->_M_aday3 = "Tue";
2363+ _M_data->_M_aday4 = "Wed";
2364+ _M_data->_M_aday5 = "Thu";
2365+ _M_data->_M_aday6 = "Fri";
2366+ _M_data->_M_aday7 = "Sat";
2367+
2368+ // Month names, starting with "C"'s January.
2369+ _M_data->_M_month01 = "January";
2370+ _M_data->_M_month02 = "February";
2371+ _M_data->_M_month03 = "March";
2372+ _M_data->_M_month04 = "April";
2373+ _M_data->_M_month05 = "May";
2374+ _M_data->_M_month06 = "June";
2375+ _M_data->_M_month07 = "July";
2376+ _M_data->_M_month08 = "August";
2377+ _M_data->_M_month09 = "September";
2378+ _M_data->_M_month10 = "October";
2379+ _M_data->_M_month11 = "November";
2380+ _M_data->_M_month12 = "December";
2381+
2382+ // Abbreviated month names, starting with "C"'s Jan.
2383+ _M_data->_M_amonth01 = "Jan";
2384+ _M_data->_M_amonth02 = "Feb";
2385+ _M_data->_M_amonth03 = "Mar";
2386+ _M_data->_M_amonth04 = "Apr";
2387+ _M_data->_M_amonth05 = "May";
2388+ _M_data->_M_amonth06 = "Jun";
2389+ _M_data->_M_amonth07 = "Jul";
2390+ _M_data->_M_amonth08 = "Aug";
2391+ _M_data->_M_amonth09 = "Sep";
2392+ _M_data->_M_amonth10 = "Oct";
2393+ _M_data->_M_amonth11 = "Nov";
2394+ _M_data->_M_amonth12 = "Dec";
2395+ }
2396+ else
2397+ {
2398+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2399+
2400+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2401+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2402+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2403+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2404+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2405+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2406+ __cloc);
2407+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2408+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2409+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2410+
2411+ // Day names, starting with "C"'s Sunday.
2412+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2413+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2414+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2415+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2416+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2417+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2418+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2419+
2420+ // Abbreviated day names, starting with "C"'s Sun.
2421+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2422+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2423+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2424+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2425+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2426+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2427+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2428+
2429+ // Month names, starting with "C"'s January.
2430+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2431+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2432+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2433+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2434+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2435+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2436+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2437+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2438+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2439+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2440+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2441+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2442+
2443+ // Abbreviated month names, starting with "C"'s Jan.
2444+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2445+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2446+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2447+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2448+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2449+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2450+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2451+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2452+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2453+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2454+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2455+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2456+ }
2457+ }
2458+
2459+#ifdef _GLIBCXX_USE_WCHAR_T
2460+ template<>
2461+ void
2462+ __timepunct<wchar_t>::
2463+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2464+ const tm* __tm) const
2465+ {
2466+#ifdef __UCLIBC_HAS_XLOCALE__
2467+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2468+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2469+ _M_c_locale_timepunct);
2470+#else
2471+ char* __old = strdup(setlocale(LC_ALL, NULL));
2472+ setlocale(LC_ALL, _M_name_timepunct);
2473+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2474+ setlocale(LC_ALL, __old);
2475+ free(__old);
2476+#endif
2477+ // Make sure __s is null terminated.
2478+ if (__len == 0)
2479+ __s[0] = L'\0';
2480+ }
2481+
2482+ template<>
2483+ void
2484+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2485+ {
2486+ if (!_M_data)
2487+ _M_data = new __timepunct_cache<wchar_t>;
2488+
2489+#warning wide time stuff
2490+// if (!__cloc)
2491+ {
2492+ // "C" locale
2493+ _M_c_locale_timepunct = _S_get_c_locale();
2494+
2495+ _M_data->_M_date_format = L"%m/%d/%y";
2496+ _M_data->_M_date_era_format = L"%m/%d/%y";
2497+ _M_data->_M_time_format = L"%H:%M:%S";
2498+ _M_data->_M_time_era_format = L"%H:%M:%S";
2499+ _M_data->_M_date_time_format = L"";
2500+ _M_data->_M_date_time_era_format = L"";
2501+ _M_data->_M_am = L"AM";
2502+ _M_data->_M_pm = L"PM";
2503+ _M_data->_M_am_pm_format = L"";
2504+
2505+ // Day names, starting with "C"'s Sunday.
2506+ _M_data->_M_day1 = L"Sunday";
2507+ _M_data->_M_day2 = L"Monday";
2508+ _M_data->_M_day3 = L"Tuesday";
2509+ _M_data->_M_day4 = L"Wednesday";
2510+ _M_data->_M_day5 = L"Thursday";
2511+ _M_data->_M_day6 = L"Friday";
2512+ _M_data->_M_day7 = L"Saturday";
2513+
2514+ // Abbreviated day names, starting with "C"'s Sun.
2515+ _M_data->_M_aday1 = L"Sun";
2516+ _M_data->_M_aday2 = L"Mon";
2517+ _M_data->_M_aday3 = L"Tue";
2518+ _M_data->_M_aday4 = L"Wed";
2519+ _M_data->_M_aday5 = L"Thu";
2520+ _M_data->_M_aday6 = L"Fri";
2521+ _M_data->_M_aday7 = L"Sat";
2522+
2523+ // Month names, starting with "C"'s January.
2524+ _M_data->_M_month01 = L"January";
2525+ _M_data->_M_month02 = L"February";
2526+ _M_data->_M_month03 = L"March";
2527+ _M_data->_M_month04 = L"April";
2528+ _M_data->_M_month05 = L"May";
2529+ _M_data->_M_month06 = L"June";
2530+ _M_data->_M_month07 = L"July";
2531+ _M_data->_M_month08 = L"August";
2532+ _M_data->_M_month09 = L"September";
2533+ _M_data->_M_month10 = L"October";
2534+ _M_data->_M_month11 = L"November";
2535+ _M_data->_M_month12 = L"December";
2536+
2537+ // Abbreviated month names, starting with "C"'s Jan.
2538+ _M_data->_M_amonth01 = L"Jan";
2539+ _M_data->_M_amonth02 = L"Feb";
2540+ _M_data->_M_amonth03 = L"Mar";
2541+ _M_data->_M_amonth04 = L"Apr";
2542+ _M_data->_M_amonth05 = L"May";
2543+ _M_data->_M_amonth06 = L"Jun";
2544+ _M_data->_M_amonth07 = L"Jul";
2545+ _M_data->_M_amonth08 = L"Aug";
2546+ _M_data->_M_amonth09 = L"Sep";
2547+ _M_data->_M_amonth10 = L"Oct";
2548+ _M_data->_M_amonth11 = L"Nov";
2549+ _M_data->_M_amonth12 = L"Dec";
2550+ }
2551+#if 0
2552+ else
2553+ {
2554+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2555+
2556+ union { char *__s; wchar_t *__w; } __u;
2557+
2558+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2559+ _M_data->_M_date_format = __u.__w;
2560+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2561+ _M_data->_M_date_era_format = __u.__w;
2562+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2563+ _M_data->_M_time_format = __u.__w;
2564+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2565+ _M_data->_M_time_era_format = __u.__w;
2566+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2567+ _M_data->_M_date_time_format = __u.__w;
2568+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2569+ _M_data->_M_date_time_era_format = __u.__w;
2570+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2571+ _M_data->_M_am = __u.__w;
2572+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2573+ _M_data->_M_pm = __u.__w;
2574+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2575+ _M_data->_M_am_pm_format = __u.__w;
2576+
2577+ // Day names, starting with "C"'s Sunday.
2578+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2579+ _M_data->_M_day1 = __u.__w;
2580+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2581+ _M_data->_M_day2 = __u.__w;
2582+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2583+ _M_data->_M_day3 = __u.__w;
2584+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2585+ _M_data->_M_day4 = __u.__w;
2586+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2587+ _M_data->_M_day5 = __u.__w;
2588+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2589+ _M_data->_M_day6 = __u.__w;
2590+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2591+ _M_data->_M_day7 = __u.__w;
2592+
2593+ // Abbreviated day names, starting with "C"'s Sun.
2594+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2595+ _M_data->_M_aday1 = __u.__w;
2596+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2597+ _M_data->_M_aday2 = __u.__w;
2598+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2599+ _M_data->_M_aday3 = __u.__w;
2600+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2601+ _M_data->_M_aday4 = __u.__w;
2602+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2603+ _M_data->_M_aday5 = __u.__w;
2604+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2605+ _M_data->_M_aday6 = __u.__w;
2606+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2607+ _M_data->_M_aday7 = __u.__w;
2608+
2609+ // Month names, starting with "C"'s January.
2610+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2611+ _M_data->_M_month01 = __u.__w;
2612+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2613+ _M_data->_M_month02 = __u.__w;
2614+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2615+ _M_data->_M_month03 = __u.__w;
2616+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2617+ _M_data->_M_month04 = __u.__w;
2618+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2619+ _M_data->_M_month05 = __u.__w;
2620+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2621+ _M_data->_M_month06 = __u.__w;
2622+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2623+ _M_data->_M_month07 = __u.__w;
2624+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2625+ _M_data->_M_month08 = __u.__w;
2626+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2627+ _M_data->_M_month09 = __u.__w;
2628+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2629+ _M_data->_M_month10 = __u.__w;
2630+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2631+ _M_data->_M_month11 = __u.__w;
2632+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2633+ _M_data->_M_month12 = __u.__w;
2634+
2635+ // Abbreviated month names, starting with "C"'s Jan.
2636+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2637+ _M_data->_M_amonth01 = __u.__w;
2638+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2639+ _M_data->_M_amonth02 = __u.__w;
2640+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2641+ _M_data->_M_amonth03 = __u.__w;
2642+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2643+ _M_data->_M_amonth04 = __u.__w;
2644+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2645+ _M_data->_M_amonth05 = __u.__w;
2646+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2647+ _M_data->_M_amonth06 = __u.__w;
2648+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2649+ _M_data->_M_amonth07 = __u.__w;
2650+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2651+ _M_data->_M_amonth08 = __u.__w;
2652+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2653+ _M_data->_M_amonth09 = __u.__w;
2654+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2655+ _M_data->_M_amonth10 = __u.__w;
2656+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2657+ _M_data->_M_amonth11 = __u.__w;
2658+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2659+ _M_data->_M_amonth12 = __u.__w;
2660+ }
2661+#endif // 0
2662+ }
2663+#endif
2664+}
2665diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
2666new file mode 100644
2667index 0000000..ba8e858
2668--- /dev/null
2669+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
2670@@ -0,0 +1,68 @@
2671+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2672+
2673+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2674+//
2675+// This file is part of the GNU ISO C++ Library. This library is free
2676+// software; you can redistribute it and/or modify it under the
2677+// terms of the GNU General Public License as published by the
2678+// Free Software Foundation; either version 2, or (at your option)
2679+// any later version.
2680+
2681+// This library is distributed in the hope that it will be useful,
2682+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2683+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2684+// GNU General Public License for more details.
2685+
2686+// You should have received a copy of the GNU General Public License along
2687+// with this library; see the file COPYING. If not, write to the Free
2688+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2689+// USA.
2690+
2691+// As a special exception, you may use this file as part of a free software
2692+// library without restriction. Specifically, if other files instantiate
2693+// templates or use macros or inline functions from this file, or you compile
2694+// this file and link it with other files to produce an executable, this
2695+// file does not by itself cause the resulting executable to be covered by
2696+// the GNU General Public License. This exception does not however
2697+// invalidate any other reasons why the executable file might be covered by
2698+// the GNU General Public License.
2699+
2700+//
2701+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2702+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2703+//
2704+
2705+// Written by Benjamin Kosnik <bkoz@redhat.com>
2706+
2707+ template<typename _CharT>
2708+ __timepunct<_CharT>::__timepunct(size_t __refs)
2709+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2710+ _M_name_timepunct(_S_get_c_name())
2711+ { _M_initialize_timepunct(); }
2712+
2713+ template<typename _CharT>
2714+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2715+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2716+ _M_name_timepunct(_S_get_c_name())
2717+ { _M_initialize_timepunct(); }
2718+
2719+ template<typename _CharT>
2720+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2721+ size_t __refs)
2722+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2723+ _M_name_timepunct(__s)
2724+ {
2725+ char* __tmp = new char[std::strlen(__s) + 1];
2726+ std::strcpy(__tmp, __s);
2727+ _M_name_timepunct = __tmp;
2728+ _M_initialize_timepunct(__cloc);
2729+ }
2730+
2731+ template<typename _CharT>
2732+ __timepunct<_CharT>::~__timepunct()
2733+ {
2734+ if (_M_name_timepunct != _S_get_c_name())
2735+ delete [] _M_name_timepunct;
2736+ delete _M_data;
2737+ _S_destroy_c_locale(_M_c_locale_timepunct);
2738+ }
2739diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
2740index f40ddcf..c57a751 100755
2741--- a/libstdc++-v3/configure
2742+++ b/libstdc++-v3/configure
2743@@ -15822,6 +15822,9 @@ fi
2744 # Default to "generic".
2745 if test $enable_clocale_flag = auto; then
2746 case ${target_os} in
2747+ *-uclibc*)
2748+ enable_clocale_flag=uclibc
2749+ ;;
2750 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2751 enable_clocale_flag=gnu
2752 ;;
2753@@ -16079,6 +16082,78 @@ $as_echo "newlib" >&6; }
2754 CTIME_CC=config/locale/generic/time_members.cc
2755 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2756 ;;
2757+ uclibc)
2758+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: uclibc" >&5
2759+$as_echo "uclibc" >&6; }
2760+
2761+ # Declare intention to use gettext, and add support for specific
2762+ # languages.
2763+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2764+ ALL_LINGUAS="de fr"
2765+
2766+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2767+ # Extract the first word of "msgfmt", so it can be a program name with args.
2768+set dummy msgfmt; ac_word=$2
2769+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2770+$as_echo_n "checking for $ac_word... " >&6; }
2771+if test "${ac_cv_prog_check_msgfmt+set}" = set; then :
2772+ $as_echo_n "(cached) " >&6
2773+else
2774+ if test -n "$check_msgfmt"; then
2775+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2776+else
2777+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2778+for as_dir in $PATH
2779+do
2780+ IFS=$as_save_IFS
2781+ test -z "$as_dir" && as_dir=.
2782+ for ac_exec_ext in '' $ac_executable_extensions; do
2783+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2784+ ac_cv_prog_check_msgfmt="yes"
2785+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2786+ break 2
2787+ fi
2788+done
2789+ done
2790+IFS=$as_save_IFS
2791+
2792+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2793+fi
2794+fi
2795+check_msgfmt=$ac_cv_prog_check_msgfmt
2796+if test -n "$check_msgfmt"; then
2797+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $check_msgfmt" >&5
2798+$as_echo "$check_msgfmt" >&6; }
2799+else
2800+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2801+$as_echo "no" >&6; }
2802+fi
2803+
2804+
2805+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2806+ USE_NLS=yes
2807+ fi
2808+ # Export the build objects.
2809+ for ling in $ALL_LINGUAS; do \
2810+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2811+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2812+ done
2813+
2814+
2815+
2816+ CLOCALE_H=config/locale/uclibc/c_locale.h
2817+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2818+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2819+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2820+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2821+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2822+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2823+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2824+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2825+ CTIME_H=config/locale/uclibc/time_members.h
2826+ CTIME_CC=config/locale/uclibc/time_members.cc
2827+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2828+ ;;
2829 esac
2830
2831 # This is where the testsuite looks for locale catalogs, using the
2832diff --git a/libstdc++-v3/include/c_compatibility/wchar.h b/libstdc++-v3/include/c_compatibility/wchar.h
2833index 580d725..3fe61b8 100644
2834--- a/libstdc++-v3/include/c_compatibility/wchar.h
2835+++ b/libstdc++-v3/include/c_compatibility/wchar.h
2836@@ -101,7 +101,9 @@ using std::wmemcmp;
2837 using std::wmemcpy;
2838 using std::wmemmove;
2839 using std::wmemset;
2840+#if _GLIBCXX_HAVE_WCSFTIME
2841 using std::wcsftime;
2842+#endif
2843
2844 #if _GLIBCXX_USE_C99
2845 using std::wcstold;
2846diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar
2847index 0e6b1fc..405aee2 100644
2848--- a/libstdc++-v3/include/c_std/cwchar
2849+++ b/libstdc++-v3/include/c_std/cwchar
2850@@ -175,7 +175,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
2851 using ::wcscoll;
2852 using ::wcscpy;
2853 using ::wcscspn;
2854+#if _GLIBCXX_HAVE_WCSFTIME
2855 using ::wcsftime;
2856+#endif
2857 using ::wcslen;
2858 using ::wcsncat;
2859 using ::wcsncmp;
2860--
28611.7.10.4
2862
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0005-uclibc-locale-no__x.patch b/meta/recipes-devtools/gcc/gcc-4.8/0005-uclibc-locale-no__x.patch
new file mode 100644
index 0000000000..dcbbfe4545
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0005-uclibc-locale-no__x.patch
@@ -0,0 +1,257 @@
1From 6a3e8506a12c12728d8b29901defd738be43757f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:42:36 +0400
4Subject: [PATCH 05/35] uclibc-locale-no__x
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 .../config/locale/uclibc/c++locale_internal.h | 45 ++++++++++++++++++++
11 libstdc++-v3/config/locale/uclibc/c_locale.cc | 14 ------
12 libstdc++-v3/config/locale/uclibc/c_locale.h | 1 +
13 .../config/locale/uclibc/collate_members.cc | 7 ---
14 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 7 ---
15 .../config/locale/uclibc/messages_members.cc | 7 +--
16 .../config/locale/uclibc/messages_members.h | 18 +++-----
17 .../config/locale/uclibc/monetary_members.cc | 4 --
18 .../config/locale/uclibc/numeric_members.cc | 3 --
19 libstdc++-v3/config/locale/uclibc/time_members.cc | 3 --
20 10 files changed, 55 insertions(+), 54 deletions(-)
21
22diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
23index 2ae3e4a..e74fddf 100644
24--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
25+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
26@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
27 extern "C" __typeof(wctype_l) __wctype_l;
28 #endif
29
30+# define __nl_langinfo_l nl_langinfo_l
31+# define __strcoll_l strcoll_l
32+# define __strftime_l strftime_l
33+# define __strtod_l strtod_l
34+# define __strtof_l strtof_l
35+# define __strtold_l strtold_l
36+# define __strxfrm_l strxfrm_l
37+# define __newlocale newlocale
38+# define __freelocale freelocale
39+# define __duplocale duplocale
40+# define __uselocale uselocale
41+
42+# ifdef _GLIBCXX_USE_WCHAR_T
43+# define __iswctype_l iswctype_l
44+# define __towlower_l towlower_l
45+# define __towupper_l towupper_l
46+# define __wcscoll_l wcscoll_l
47+# define __wcsftime_l wcsftime_l
48+# define __wcsxfrm_l wcsxfrm_l
49+# define __wctype_l wctype_l
50+# endif
51+
52+#else
53+# define __nl_langinfo_l(N, L) nl_langinfo((N))
54+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
55+# define __strtod_l(S, E, L) strtod((S), (E))
56+# define __strtof_l(S, E, L) strtof((S), (E))
57+# define __strtold_l(S, E, L) strtold((S), (E))
58+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
59+# warning should dummy __newlocale check for C|POSIX ?
60+# define __newlocale(a, b, c) NULL
61+# define __freelocale(a) ((void)0)
62+# define __duplocale(a) __c_locale()
63+//# define __uselocale ?
64+//
65+# ifdef _GLIBCXX_USE_WCHAR_T
66+# define __iswctype_l(C, M, L) iswctype((C), (M))
67+# define __towlower_l(C, L) towlower((C))
68+# define __towupper_l(C, L) towupper((C))
69+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
70+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
71+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
72+# define __wctype_l(S, L) wctype((S))
73+# endif
74+
75 #endif // GLIBC 2.3 and later
76diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
77index 5081dc1..21430d0 100644
78--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
79+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
80@@ -39,20 +39,6 @@
81 #include <langinfo.h>
82 #include <bits/c++locale_internal.h>
83
84-#ifndef __UCLIBC_HAS_XLOCALE__
85-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
86-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
87-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
88-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
89-#define __strtof_l(S, E, L) strtof((S), (E))
90-#define __strtod_l(S, E, L) strtod((S), (E))
91-#define __strtold_l(S, E, L) strtold((S), (E))
92-#warning should dummy __newlocale check for C|POSIX ?
93-#define __newlocale(a, b, c) NULL
94-#define __freelocale(a) ((void)0)
95-#define __duplocale(a) __c_locale()
96-#endif
97-
98 namespace std
99 {
100 template<>
101diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
102index da07c1f..4bca5f1 100644
103--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
104+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
105@@ -68,6 +68,7 @@ namespace __gnu_cxx
106 {
107 extern "C" __typeof(uselocale) __uselocale;
108 }
109+#define __uselocale uselocale
110 #endif
111
112 namespace std
113diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
114index c2664a7..ec5c329 100644
115--- a/libstdc++-v3/config/locale/uclibc/collate_members.cc
116+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
117@@ -36,13 +36,6 @@
118 #include <locale>
119 #include <bits/c++locale_internal.h>
120
121-#ifndef __UCLIBC_HAS_XLOCALE__
122-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
123-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
124-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
125-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
126-#endif
127-
128 namespace std
129 {
130 // These are basically extensions to char_traits, and perhaps should
131diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
132index 7294e3a..7b12861 100644
133--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
134+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
135@@ -38,13 +38,6 @@
136 #undef _LIBC
137 #include <bits/c++locale_internal.h>
138
139-#ifndef __UCLIBC_HAS_XLOCALE__
140-#define __wctype_l(S, L) wctype((S))
141-#define __towupper_l(C, L) towupper((C))
142-#define __towlower_l(C, L) towlower((C))
143-#define __iswctype_l(C, M, L) iswctype((C), (M))
144-#endif
145-
146 namespace std
147 {
148 // NB: The other ctype<char> specializations are in src/locale.cc and
149diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
150index 13594d9..d7693b4 100644
151--- a/libstdc++-v3/config/locale/uclibc/messages_members.cc
152+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
153@@ -39,13 +39,10 @@
154 #ifdef __UCLIBC_MJN3_ONLY__
155 #warning fix gettext stuff
156 #endif
157-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
158-extern "C" char *__dcgettext(const char *domainname,
159- const char *msgid, int category);
160 #undef gettext
161-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
162+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
163+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
164 #else
165-#undef gettext
166 #define gettext(msgid) (msgid)
167 #endif
168
169diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
170index 1424078..d89da33 100644
171--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
172+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
173@@ -36,15 +36,11 @@
174 #ifdef __UCLIBC_MJN3_ONLY__
175 #warning fix prototypes for *textdomain funcs
176 #endif
177-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
178-extern "C" char *__textdomain(const char *domainname);
179-extern "C" char *__bindtextdomain(const char *domainname,
180- const char *dirname);
181-#else
182-#undef __textdomain
183-#undef __bindtextdomain
184-#define __textdomain(D) ((void)0)
185-#define __bindtextdomain(D,P) ((void)0)
186+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
187+#undef textdomain
188+#undef bindtextdomain
189+#define textdomain(D) ((void)0)
190+#define bindtextdomain(D,P) ((void)0)
191 #endif
192
193 // Non-virtual member functions.
194@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
195 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
196 const char* __dir) const
197 {
198- __bindtextdomain(__s.c_str(), __dir);
199+ bindtextdomain(__s.c_str(), __dir);
200 return this->do_open(__s, __loc);
201 }
202
203@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
204 {
205 // No error checking is done, assume the catalog exists and can
206 // be used.
207- __textdomain(__s.c_str());
208+ textdomain(__s.c_str());
209 return 0;
210 }
211
212diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
213index aa52731..2e6f80a 100644
214--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
215+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
216@@ -43,10 +43,6 @@
217 #warning tailor for stub locale support
218 #endif
219
220-#ifndef __UCLIBC_HAS_XLOCALE__
221-#define __nl_langinfo_l(N, L) nl_langinfo((N))
222-#endif
223-
224 namespace std
225 {
226 // Construct and return valid pattern consisting of some combination of:
227diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
228index 883ec1a..2c70642 100644
229--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
230+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
231@@ -41,9 +41,6 @@
232 #ifdef __UCLIBC_MJN3_ONLY__
233 #warning tailor for stub locale support
234 #endif
235-#ifndef __UCLIBC_HAS_XLOCALE__
236-#define __nl_langinfo_l(N, L) nl_langinfo((N))
237-#endif
238
239 namespace std
240 {
241diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
242index e0707d7..d848ed5 100644
243--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
244+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
245@@ -40,9 +40,6 @@
246 #ifdef __UCLIBC_MJN3_ONLY__
247 #warning tailor for stub locale support
248 #endif
249-#ifndef __UCLIBC_HAS_XLOCALE__
250-#define __nl_langinfo_l(N, L) nl_langinfo((N))
251-#endif
252
253 namespace std
254 {
255--
2561.7.10.4
257
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0006-uclibc-locale-wchar_fix.patch b/meta/recipes-devtools/gcc/gcc-4.8/0006-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000000..3406859e11
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0006-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,68 @@
1From 225511a3aeb193a916b3999f0b640a392caa67cd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:45:57 +0400
4Subject: [PATCH 06/35] uclibc-locale-wchar_fix
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/uclibc/monetary_members.cc | 4 ++--
11 libstdc++-v3/config/locale/uclibc/numeric_members.cc | 13 +++++++++++++
12 2 files changed, 15 insertions(+), 2 deletions(-)
13
14diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
15index 2e6f80a..31ebb9f 100644
16--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
17+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
18@@ -401,7 +401,7 @@ namespace std
19 # ifdef __UCLIBC_HAS_XLOCALE__
20 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
21 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
22-# else
23+# elif defined __UCLIBC_HAS_LOCALE__
24 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
25 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
26 # endif
27@@ -556,7 +556,7 @@ namespace std
28 # ifdef __UCLIBC_HAS_XLOCALE__
29 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
30 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
31-# else
32+# elif defined __UCLIBC_HAS_LOCALE__
33 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
34 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
35 # endif
36diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
37index 2c70642..d5c8961 100644
38--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
39+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
40@@ -127,12 +127,25 @@ namespace std
41 {
42 // Named locale.
43 // NB: In the GNU model wchar_t is always 32 bit wide.
44+#ifdef __UCLIBC_MJN3_ONLY__
45+#warning fix this... should be numeric
46+#endif
47+#ifdef __UCLIBC__
48+# ifdef __UCLIBC_HAS_XLOCALE__
49+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
50+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
51+# elif defined __UCLIBC_HAS_LOCALE__
52+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
53+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
54+# endif
55+#else
56 union { char *__s; wchar_t __w; } __u;
57 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
58 _M_data->_M_decimal_point = __u.__w;
59
60 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
61 _M_data->_M_thousands_sep = __u.__w;
62+#endif
63
64 if (_M_data->_M_thousands_sep == L'\0')
65 _M_data->_M_grouping = "";
66--
671.7.10.4
68
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0007-uclibc-locale-update.patch b/meta/recipes-devtools/gcc/gcc-4.8/0007-uclibc-locale-update.patch
new file mode 100644
index 0000000000..58511233d7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0007-uclibc-locale-update.patch
@@ -0,0 +1,542 @@
1From 6ffe7c46f52d27864c3df3663e16ec9ddee71e8f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:46:58 +0400
4Subject: [PATCH 07/35] uclibc-locale-update
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 .../config/locale/uclibc/c++locale_internal.h | 3 +
11 libstdc++-v3/config/locale/uclibc/c_locale.cc | 74 +++++++++-----------
12 libstdc++-v3/config/locale/uclibc/c_locale.h | 42 ++++++-----
13 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 51 ++++++++++----
14 .../config/locale/uclibc/messages_members.h | 12 ++--
15 .../config/locale/uclibc/monetary_members.cc | 34 +++++----
16 .../config/locale/uclibc/numeric_members.cc | 5 ++
17 libstdc++-v3/config/locale/uclibc/time_members.cc | 18 +++--
18 libstdc++-v3/config/locale/uclibc/time_members.h | 17 +++--
19 9 files changed, 158 insertions(+), 98 deletions(-)
20
21diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
22index e74fddf..971a6b4 100644
23--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
24+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
25@@ -31,6 +31,9 @@
26
27 #include <bits/c++config.h>
28 #include <clocale>
29+#include <cstdlib>
30+#include <cstring>
31+#include <cstddef>
32
33 #ifdef __UCLIBC_MJN3_ONLY__
34 #warning clean this up
35diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
36index 21430d0..1b9d8e1 100644
37--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
38+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
39@@ -39,23 +39,20 @@
40 #include <langinfo.h>
41 #include <bits/c++locale_internal.h>
42
43-namespace std
44-{
45+_GLIBCXX_BEGIN_NAMESPACE(std)
46+
47 template<>
48 void
49 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
50 const __c_locale& __cloc)
51 {
52- if (!(__err & ios_base::failbit))
53- {
54- char* __sanity;
55- errno = 0;
56- float __f = __strtof_l(__s, &__sanity, __cloc);
57- if (__sanity != __s && errno != ERANGE)
58- __v = __f;
59- else
60- __err |= ios_base::failbit;
61- }
62+ char* __sanity;
63+ errno = 0;
64+ float __f = __strtof_l(__s, &__sanity, __cloc);
65+ if (__sanity != __s && errno != ERANGE)
66+ __v = __f;
67+ else
68+ __err |= ios_base::failbit;
69 }
70
71 template<>
72@@ -63,16 +60,13 @@ namespace std
73 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
74 const __c_locale& __cloc)
75 {
76- if (!(__err & ios_base::failbit))
77- {
78- char* __sanity;
79- errno = 0;
80- double __d = __strtod_l(__s, &__sanity, __cloc);
81- if (__sanity != __s && errno != ERANGE)
82- __v = __d;
83- else
84- __err |= ios_base::failbit;
85- }
86+ char* __sanity;
87+ errno = 0;
88+ double __d = __strtod_l(__s, &__sanity, __cloc);
89+ if (__sanity != __s && errno != ERANGE)
90+ __v = __d;
91+ else
92+ __err |= ios_base::failbit;
93 }
94
95 template<>
96@@ -80,16 +74,13 @@ namespace std
97 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
98 const __c_locale& __cloc)
99 {
100- if (!(__err & ios_base::failbit))
101- {
102- char* __sanity;
103- errno = 0;
104- long double __ld = __strtold_l(__s, &__sanity, __cloc);
105- if (__sanity != __s && errno != ERANGE)
106- __v = __ld;
107- else
108- __err |= ios_base::failbit;
109- }
110+ char* __sanity;
111+ errno = 0;
112+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
113+ if (__sanity != __s && errno != ERANGE)
114+ __v = __ld;
115+ else
116+ __err |= ios_base::failbit;
117 }
118
119 void
120@@ -110,17 +101,18 @@ namespace std
121 void
122 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
123 {
124- if (_S_get_c_locale() != __cloc)
125+ if (__cloc && _S_get_c_locale() != __cloc)
126 __freelocale(__cloc);
127 }
128
129 __c_locale
130 locale::facet::_S_clone_c_locale(__c_locale& __cloc)
131 { return __duplocale(__cloc); }
132-} // namespace std
133
134-namespace __gnu_cxx
135-{
136+_GLIBCXX_END_NAMESPACE
137+
138+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
139+
140 const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
141 {
142 "LC_CTYPE",
143@@ -138,9 +130,11 @@ namespace __gnu_cxx
144 "LC_IDENTIFICATION"
145 #endif
146 };
147-}
148
149-namespace std
150-{
151+_GLIBCXX_END_NAMESPACE
152+
153+_GLIBCXX_BEGIN_NAMESPACE(std)
154+
155 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
156-} // namespace std
157+
158+_GLIBCXX_END_NAMESPACE
159diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
160index 4bca5f1..64a6d46 100644
161--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
162+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
163@@ -39,21 +39,23 @@
164 #pragma GCC system_header
165
166 #include <cstring> // get std::strlen
167-#include <cstdio> // get std::snprintf or std::sprintf
168+#include <cstdio> // get std::vsnprintf or std::vsprintf
169 #include <clocale>
170 #include <langinfo.h> // For codecvt
171 #ifdef __UCLIBC_MJN3_ONLY__
172 #warning fix this
173 #endif
174-#ifdef __UCLIBC_HAS_LOCALE__
175+#ifdef _GLIBCXX_USE_ICONV
176 #include <iconv.h> // For codecvt using iconv, iconv_t
177 #endif
178-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
179-#include <libintl.h> // For messages
180+#ifdef HAVE_LIBINTL_H
181+#include <libintl.h> // For messages
182 #endif
183+#include <cstdarg>
184
185 #ifdef __UCLIBC_MJN3_ONLY__
186 #warning what is _GLIBCXX_C_LOCALE_GNU for
187+// psm: used in os/gnu-linux/ctype_noninline.h
188 #endif
189 #define _GLIBCXX_C_LOCALE_GNU 1
190
191@@ -78,23 +80,25 @@ namespace std
192 #else
193 typedef int* __c_locale;
194 #endif
195-
196- // Convert numeric value of type _Tv to string and return length of
197- // string. If snprintf is available use it, otherwise fall back to
198- // the unsafe sprintf which, in general, can be dangerous and should
199+ // Convert numeric value of type double to string and return length of
200+ // string. If vsnprintf is available use it, otherwise fall back to
201+ // the unsafe vsprintf which, in general, can be dangerous and should
202 // be avoided.
203- template<typename _Tv>
204- int
205- __convert_from_v(char* __out,
206- const int __size __attribute__ ((__unused__)),
207- const char* __fmt,
208-#ifdef __UCLIBC_HAS_XCLOCALE__
209- _Tv __v, const __c_locale& __cloc, int __prec)
210+ inline int
211+ __convert_from_v(const __c_locale&
212+#ifndef __UCLIBC_HAS_XCLOCALE__
213+ __cloc __attribute__ ((__unused__))
214+#endif
215+ ,
216+ char* __out,
217+ const int __size,
218+ const char* __fmt, ...)
219 {
220+ va_list __args;
221+#ifdef __UCLIBC_HAS_XCLOCALE__
222+
223 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
224 #else
225- _Tv __v, const __c_locale&, int __prec)
226- {
227 # ifdef __UCLIBC_HAS_LOCALE__
228 char* __old = std::setlocale(LC_ALL, NULL);
229 char* __sav = new char[std::strlen(__old) + 1];
230@@ -103,7 +107,9 @@ namespace std
231 # endif
232 #endif
233
234- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
235+ va_start(__args, __fmt);
236+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
237+ va_end(__args);
238
239 #ifdef __UCLIBC_HAS_XCLOCALE__
240 __gnu_cxx::__uselocale(__old);
241diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
242index 7b12861..13e011d 100644
243--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
244+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
245@@ -33,16 +33,20 @@
246
247 // Written by Benjamin Kosnik <bkoz@redhat.com>
248
249+#include <features.h>
250+#ifdef __UCLIBC_HAS_LOCALE__
251 #define _LIBC
252 #include <locale>
253 #undef _LIBC
254+#else
255+#include <locale>
256+#endif
257 #include <bits/c++locale_internal.h>
258
259-namespace std
260-{
261+_GLIBCXX_BEGIN_NAMESPACE(std)
262+
263 // NB: The other ctype<char> specializations are in src/locale.cc and
264 // various /config/os/* files.
265- template<>
266 ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
267 : ctype<char>(0, false, __refs)
268 {
269@@ -57,6 +61,8 @@ namespace std
270 #endif
271 }
272 }
273+ ctype_byname<char>::~ctype_byname()
274+ { }
275
276 #ifdef _GLIBCXX_USE_WCHAR_T
277 ctype<wchar_t>::__wmask_type
278@@ -138,17 +144,33 @@ namespace std
279 ctype<wchar_t>::
280 do_is(mask __m, wchar_t __c) const
281 {
282- // Highest bitmask in ctype_base == 10, but extra in "C"
283- // library for blank.
284+ // The case of __m == ctype_base::space is particularly important,
285+ // due to its use in many istream functions. Therefore we deal with
286+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
287+ // is the mask corresponding to ctype_base::space. NB: an encoding
288+ // change would not affect correctness!
289+
290 bool __ret = false;
291- const size_t __bitmasksize = 11;
292- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
293- if (__m & _M_bit[__bitcur]
294- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
295- {
296- __ret = true;
297- break;
298- }
299+ if (__m == _M_bit[5])
300+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
301+ else
302+ {
303+ // Highest bitmask in ctype_base == 10, but extra in "C"
304+ // library for blank.
305+ const size_t __bitmasksize = 11;
306+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
307+ if (__m & _M_bit[__bitcur])
308+ {
309+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
310+ {
311+ __ret = true;
312+ break;
313+ }
314+ else if (__m == _M_bit[__bitcur])
315+ break;
316+ }
317+ }
318+
319 return __ret;
320 }
321
322@@ -290,4 +312,5 @@ namespace std
323 #endif
324 }
325 #endif // _GLIBCXX_USE_WCHAR_T
326-}
327+
328+_GLIBCXX_END_NAMESPACE
329diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
330index d89da33..067657a 100644
331--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
332+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
333@@ -53,12 +53,16 @@
334 template<typename _CharT>
335 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
336 size_t __refs)
337- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
338- _M_name_messages(__s)
339+ : facet(__refs), _M_c_locale_messages(NULL),
340+ _M_name_messages(NULL)
341 {
342- char* __tmp = new char[std::strlen(__s) + 1];
343- std::strcpy(__tmp, __s);
344+ const size_t __len = std::strlen(__s) + 1;
345+ char* __tmp = new char[__len];
346+ std::memcpy(__tmp, __s, __len);
347 _M_name_messages = __tmp;
348+
349+ // Last to avoid leaking memory if new throws.
350+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
351 }
352
353 template<typename _CharT>
354diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
355index 31ebb9f..7679b9c 100644
356--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
357+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
358@@ -33,9 +33,14 @@
359
360 // Written by Benjamin Kosnik <bkoz@redhat.com>
361
362+#include <features.h>
363+#ifdef __UCLIBC_HAS_LOCALE__
364 #define _LIBC
365 #include <locale>
366 #undef _LIBC
367+#else
368+#include <locale>
369+#endif
370 #include <bits/c++locale_internal.h>
371
372 #ifdef __UCLIBC_MJN3_ONLY__
373@@ -206,7 +211,7 @@ namespace std
374 }
375 break;
376 default:
377- ;
378+ __ret = pattern();
379 }
380 return __ret;
381 }
382@@ -390,7 +395,9 @@ namespace std
383 __c_locale __old = __uselocale(__cloc);
384 #else
385 // Switch to named locale so that mbsrtowcs will work.
386- char* __old = strdup(setlocale(LC_ALL, NULL));
387+ char* __old = setlocale(LC_ALL, NULL);
388+ const size_t __llen = strlen(__old) + 1;
389+ char* __sav = new char[__llen];
390 setlocale(LC_ALL, __name);
391 #endif
392
393@@ -477,8 +484,8 @@ namespace std
394 #ifdef __UCLIBC_HAS_XLOCALE__
395 __uselocale(__old);
396 #else
397- setlocale(LC_ALL, __old);
398- free(__old);
399+ setlocale(LC_ALL, __sav);
400+ delete [] __sav;
401 #endif
402 __throw_exception_again;
403 }
404@@ -498,8 +505,8 @@ namespace std
405 #ifdef __UCLIBC_HAS_XLOCALE__
406 __uselocale(__old);
407 #else
408- setlocale(LC_ALL, __old);
409- free(__old);
410+ setlocale(LC_ALL, __sav);
411+ delete [] __sav;
412 #endif
413 }
414 }
415@@ -545,8 +552,11 @@ namespace std
416 __c_locale __old = __uselocale(__cloc);
417 #else
418 // Switch to named locale so that mbsrtowcs will work.
419- char* __old = strdup(setlocale(LC_ALL, NULL));
420- setlocale(LC_ALL, __name);
421+ char* __old = setlocale(LC_ALL, NULL);
422+ const size_t __llen = strlen(__old) + 1;
423+ char* __sav = new char[__llen];
424+ memcpy(__sav, __old, __llen);
425+ setlocale(LC_ALL, __name);
426 #endif
427
428 #ifdef __UCLIBC_MJN3_ONLY__
429@@ -633,8 +643,8 @@ namespace std
430 #ifdef __UCLIBC_HAS_XLOCALE__
431 __uselocale(__old);
432 #else
433- setlocale(LC_ALL, __old);
434- free(__old);
435+ setlocale(LC_ALL, __sav);
436+ delete [] __sav;
437 #endif
438 __throw_exception_again;
439 }
440@@ -653,8 +663,8 @@ namespace std
441 #ifdef __UCLIBC_HAS_XLOCALE__
442 __uselocale(__old);
443 #else
444- setlocale(LC_ALL, __old);
445- free(__old);
446+ setlocale(LC_ALL, __sav);
447+ delete [] __sav;
448 #endif
449 }
450 }
451diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
452index d5c8961..8ae8969 100644
453--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
454+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
455@@ -33,9 +33,14 @@
456
457 // Written by Benjamin Kosnik <bkoz@redhat.com>
458
459+#include <features.h>
460+#ifdef __UCLIBC_HAS_LOCALE__
461 #define _LIBC
462 #include <locale>
463 #undef _LIBC
464+#else
465+#include <locale>
466+#endif
467 #include <bits/c++locale_internal.h>
468
469 #ifdef __UCLIBC_MJN3_ONLY__
470diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
471index d848ed5..f24d53e 100644
472--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
473+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
474@@ -53,11 +53,14 @@ namespace std
475 const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
476 _M_c_locale_timepunct);
477 #else
478- char* __old = strdup(setlocale(LC_ALL, NULL));
479+ char* __old = setlocale(LC_ALL, NULL);
480+ const size_t __llen = strlen(__old) + 1;
481+ char* __sav = new char[__llen];
482+ memcpy(__sav, __old, __llen);
483 setlocale(LC_ALL, _M_name_timepunct);
484 const size_t __len = strftime(__s, __maxlen, __format, __tm);
485- setlocale(LC_ALL, __old);
486- free(__old);
487+ setlocale(LC_ALL, __sav);
488+ delete [] __sav;
489 #endif
490 // Make sure __s is null terminated.
491 if (__len == 0)
492@@ -207,11 +210,14 @@ namespace std
493 const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
494 _M_c_locale_timepunct);
495 #else
496- char* __old = strdup(setlocale(LC_ALL, NULL));
497+ char* __old = setlocale(LC_ALL, NULL);
498+ const size_t __llen = strlen(__old) + 1;
499+ char* __sav = new char[__llen];
500+ memcpy(__sav, __old, __llen);
501 setlocale(LC_ALL, _M_name_timepunct);
502 const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
503- setlocale(LC_ALL, __old);
504- free(__old);
505+ setlocale(LC_ALL, __sav);
506+ delete [] __sav;
507 #endif
508 // Make sure __s is null terminated.
509 if (__len == 0)
510diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
511index ba8e858..1665dde 100644
512--- a/libstdc++-v3/config/locale/uclibc/time_members.h
513+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
514@@ -50,12 +50,21 @@
515 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
516 size_t __refs)
517 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
518- _M_name_timepunct(__s)
519+ _M_name_timepunct(NULL)
520 {
521- char* __tmp = new char[std::strlen(__s) + 1];
522- std::strcpy(__tmp, __s);
523+ const size_t __len = std::strlen(__s) + 1;
524+ char* __tmp = new char[__len];
525+ std::memcpy(__tmp, __s, __len);
526 _M_name_timepunct = __tmp;
527- _M_initialize_timepunct(__cloc);
528+
529+ try
530+ { _M_initialize_timepunct(__cloc); }
531+ catch(...)
532+ {
533+ delete [] _M_name_timepunct;
534+ __throw_exception_again;
535+ }
536+
537 }
538
539 template<typename _CharT>
540--
5411.7.10.4
542
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0008-missing-execinfo_h.patch b/meta/recipes-devtools/gcc/gcc-4.8/0008-missing-execinfo_h.patch
new file mode 100644
index 0000000000..282380934a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0008-missing-execinfo_h.patch
@@ -0,0 +1,28 @@
1From 9f2158451981cf0a80cfabdc79ae31bb6976a801 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:48:10 +0400
4Subject: [PATCH 08/35] missing-execinfo_h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 boehm-gc/include/gc.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
14index c51e017..a7ba8dc 100644
15--- a/boehm-gc/include/gc.h
16+++ b/boehm-gc/include/gc.h
17@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
18 #if defined(__linux__) || defined(__GLIBC__)
19 # include <features.h>
20 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
21- && !defined(__ia64__)
22+ && !defined(__ia64__) && !defined(__UCLIBC__)
23 # ifndef GC_HAVE_BUILTIN_BACKTRACE
24 # define GC_HAVE_BUILTIN_BACKTRACE
25 # endif
26--
271.7.10.4
28
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0009-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-4.8/0009-c99-snprintf.patch
new file mode 100644
index 0000000000..7168778df4
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0009-c99-snprintf.patch
@@ -0,0 +1,28 @@
1From e393e076f1ab82d25e1aa04d6edea27b41d3eb06 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:03 +0400
4Subject: [PATCH 09/35] c99-snprintf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/c_std/cstdio | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
14index e85bd83..6af839a 100644
15--- a/libstdc++-v3/include/c_std/cstdio
16+++ b/libstdc++-v3/include/c_std/cstdio
17@@ -139,7 +139,7 @@ namespace std
18 using ::vsprintf;
19 } // namespace std
20
21-#if _GLIBCXX_USE_C99
22+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
23
24 #undef snprintf
25 #undef vfscanf
26--
271.7.10.4
28
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0010-c99-complex-ugly-hack.patch b/meta/recipes-devtools/gcc/gcc-4.8/0010-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000000..b628571e5d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0010-c99-complex-ugly-hack.patch
@@ -0,0 +1,29 @@
1From 73f69d806e2c9561a54995223431a1076cfd6164 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:57 +0400
4Subject: [PATCH 10/35] c99-complex-ugly-hack
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 libstdc++-v3/configure | 3 +++
11 1 file changed, 3 insertions(+)
12
13diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
14index c57a751..a1333e2 100755
15--- a/libstdc++-v3/configure
16+++ b/libstdc++-v3/configure
17@@ -18734,6 +18734,9 @@ $as_echo_n "checking for ISO C99 support to TR1 in <complex.h>... " >&6; }
18 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
19 /* end confdefs.h. */
20 #include <complex.h>
21+#ifdef __UCLIBC__
22+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
23+#endif
24 int
25 main ()
26 {
27--
281.7.10.4
29
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0011-index_macro.patch b/meta/recipes-devtools/gcc/gcc-4.8/0011-index_macro.patch
new file mode 100644
index 0000000000..8ee79b09b4
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0011-index_macro.patch
@@ -0,0 +1,44 @@
1From b037953e40312b45ab84ed0a3ad882bb5e413101 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:51:02 +0400
4Subject: [PATCH 11/35] index_macro
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/ext/rope | 3 +++
11 libstdc++-v3/include/ext/ropeimpl.h | 3 +++
12 2 files changed, 6 insertions(+)
13
14diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
15index 38eb1e8..158d21a 100644
16--- a/libstdc++-v3/include/ext/rope
17+++ b/libstdc++-v3/include/ext/rope
18@@ -55,6 +55,9 @@
19 #include <bits/gthr.h>
20 #include <tr1/functional>
21
22+/* cope w/ index defined as macro, SuSv3 proposal */
23+#undef index
24+
25 # ifdef __GC
26 # define __GC_CONST const
27 # else
28diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
29index d7b5cbd..b9b3acb 100644
30--- a/libstdc++-v3/include/ext/ropeimpl.h
31+++ b/libstdc++-v3/include/ext/ropeimpl.h
32@@ -48,6 +48,9 @@
33 #include <ext/memory> // For uninitialized_copy_n
34 #include <ext/numeric> // For power
35
36+/* cope w/ index defined as macro, SuSv3 proposal */
37+#undef index
38+
39 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
40 {
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
42--
431.7.10.4
44
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0012-libmudflap-susv3-legacy.patch b/meta/recipes-devtools/gcc/gcc-4.8/0012-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000000..968d45e84d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0012-libmudflap-susv3-legacy.patch
@@ -0,0 +1,64 @@
1From a0cb13bdd98a941b81fdafe4cd96e4c569feb651 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:52:36 +0400
4Subject: [PATCH 12/35] libmudflap-susv3-legacy
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 libmudflap/mf-hooks2.c | 10 +++++-----
11 1 file changed, 5 insertions(+), 5 deletions(-)
12
13diff --git a/libmudflap/mf-hooks2.c b/libmudflap/mf-hooks2.c
14index 4af17df..a3c6b2f 100644
15--- a/libmudflap/mf-hooks2.c
16+++ b/libmudflap/mf-hooks2.c
17@@ -424,7 +424,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
18 {
19 TRACE ("%s\n", __PRETTY_FUNCTION__);
20 MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
21- bzero (s, n);
22+ memset (s, 0, n);
23 }
24
25
26@@ -434,7 +434,7 @@ WRAPPER2(void, bcopy, const void *src, void *dest, size_t n)
27 TRACE ("%s\n", __PRETTY_FUNCTION__);
28 MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
29 MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
30- bcopy (src, dest, n);
31+ memmove (dest, src, n);
32 }
33
34
35@@ -444,7 +444,7 @@ WRAPPER2(int, bcmp, const void *s1, const void *s2, size_t n)
36 TRACE ("%s\n", __PRETTY_FUNCTION__);
37 MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
38 MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
39- return bcmp (s1, s2, n);
40+ return n == 0 ? 0 : memcmp (s1, s2, n);
41 }
42
43
44@@ -453,7 +453,7 @@ WRAPPER2(char *, index, const char *s, int c)
45 size_t n = strlen (s);
46 TRACE ("%s\n", __PRETTY_FUNCTION__);
47 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
48- return index (s, c);
49+ return strchr (s, c);
50 }
51
52
53@@ -462,7 +462,7 @@ WRAPPER2(char *, rindex, const char *s, int c)
54 size_t n = strlen (s);
55 TRACE ("%s\n", __PRETTY_FUNCTION__);
56 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
57- return rindex (s, c);
58+ return strrchr (s, c);
59 }
60
61 /* XXX: stpcpy, memccpy */
62--
631.7.10.4
64
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0013-libstdc-namespace.patch b/meta/recipes-devtools/gcc/gcc-4.8/0013-libstdc-namespace.patch
new file mode 100644
index 0000000000..4a3efdebd8
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0013-libstdc-namespace.patch
@@ -0,0 +1,54 @@
1From 104e4d66208f2726b14d2f5eebce90700cbc83c8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:54:02 +0400
4Subject: [PATCH 13/35] libstdc++-namespace
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/uclibc/messages_members.h | 4 +++-
11 libstdc++-v3/config/locale/uclibc/time_members.h | 4 +++-
12 2 files changed, 6 insertions(+), 2 deletions(-)
13
14diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
15index 067657a..dd76a6c 100644
16--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
17+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
18@@ -32,7 +32,8 @@
19 //
20
21 // Written by Benjamin Kosnik <bkoz@redhat.com>
22-
23+namespace std
24+{
25 #ifdef __UCLIBC_MJN3_ONLY__
26 #warning fix prototypes for *textdomain funcs
27 #endif
28@@ -116,3 +117,4 @@
29 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
30 }
31 }
32+}
33diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
34index 1665dde..905c433 100644
35--- a/libstdc++-v3/config/locale/uclibc/time_members.h
36+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
37@@ -33,7 +33,8 @@
38 //
39
40 // Written by Benjamin Kosnik <bkoz@redhat.com>
41-
42+namespace std
43+{
44 template<typename _CharT>
45 __timepunct<_CharT>::__timepunct(size_t __refs)
46 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
47@@ -75,3 +76,4 @@
48 delete _M_data;
49 _S_destroy_c_locale(_M_c_locale_timepunct);
50 }
51+}
52--
531.7.10.4
54
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0014-sh-pr24836.patch b/meta/recipes-devtools/gcc/gcc-4.8/0014-sh-pr24836.patch
new file mode 100644
index 0000000000..cb8fd525b2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0014-sh-pr24836.patch
@@ -0,0 +1,45 @@
1From edc9acb181810f234b6b9f7d2820b0e4f6a1eeaf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:54:48 +0400
4Subject: [PATCH 14/35] sh-pr24836
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9
10http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
11http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
12---
13 gcc/configure | 2 +-
14 gcc/configure.ac | 2 +-
15 2 files changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/gcc/configure b/gcc/configure
18index e12a180..135bbf5 100755
19--- a/gcc/configure
20+++ b/gcc/configure
21@@ -23378,7 +23378,7 @@ foo: .long 25
22 tls_first_minor=14
23 tls_as_opt="-m64 -Aesame --fatal-warnings"
24 ;;
25- sh-*-* | sh[34]-*-*)
26+ sh-*-* | sh[34]*-*-*)
27 conftest_s='
28 .section ".tdata","awT",@progbits
29 foo: .long 25
30diff --git a/gcc/configure.ac b/gcc/configure.ac
31index eba3577..6363a21 100644
32--- a/gcc/configure.ac
33+++ b/gcc/configure.ac
34@@ -3141,7 +3141,7 @@ foo: .long 25
35 tls_first_minor=14
36 tls_as_opt="-m64 -Aesame --fatal-warnings"
37 ;;
38- sh-*-* | sh[34]-*-*)
39+ sh-*-* | sh[34]*-*-*)
40 conftest_s='
41 .section ".tdata","awT",@progbits
42 foo: .long 25
43--
441.7.10.4
45
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch b/meta/recipes-devtools/gcc/gcc-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
new file mode 100644
index 0000000000..1081222f61
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
@@ -0,0 +1,29 @@
1From 50e5366005b0f6af27378e2a5c3cb9f9936a7e62 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:58:36 +0400
4Subject: [PATCH 15/35] arm: Use TARGET_ENDIAN_OPTION for determining
5 MULTILIB_DEFAULTS
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9Upstream-Status: Pending
10---
11 gcc/config/arm/linux-elf.h | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
15index 488efa4..753dc3a 100644
16--- a/gcc/config/arm/linux-elf.h
17+++ b/gcc/config/arm/linux-elf.h
18@@ -46,7 +46,7 @@
19
20 #undef MULTILIB_DEFAULTS
21 #define MULTILIB_DEFAULTS \
22- { "marm", "mlittle-endian", "mfloat-abi=hard", "mno-thumb-interwork" }
23+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=hard", "mno-thumb-interwork" }
24
25 /* Now we define the strings used to build the spec file. */
26 #undef LIB_SPEC
27--
281.7.10.4
29
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0016-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.8/0016-gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..1e2a9e1009
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0016-gcc-poison-system-directories.patch
@@ -0,0 +1,224 @@
1From 160397ef3c3331099af028f1b8d3e085b07d88ad Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:59:00 +0400
4Subject: [PATCH 16/35] gcc: poison-system-directories
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [distribution: codesourcery]
9---
10 gcc/Makefile.in | 2 +-
11 gcc/common.opt | 4 ++++
12 gcc/config.in | 6 ++++++
13 gcc/configure | 20 ++++++++++++++++++--
14 gcc/configure.ac | 10 ++++++++++
15 gcc/doc/invoke.texi | 9 +++++++++
16 gcc/gcc.c | 2 ++
17 gcc/incpath.c | 19 +++++++++++++++++++
18 8 files changed, 69 insertions(+), 3 deletions(-)
19
20diff --git a/gcc/Makefile.in b/gcc/Makefile.in
21index 54ea04f..90a2bba 100644
22--- a/gcc/Makefile.in
23+++ b/gcc/Makefile.in
24@@ -2018,7 +2018,7 @@ attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
25
26 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
27 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
28- $(MACHMODE_H)
29+ $(MACHMODE_H) $(FLAGS_H) toplev.h
30
31 CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
32 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
33diff --git a/gcc/common.opt b/gcc/common.opt
34index bdbd3b6..ab86b00 100644
35--- a/gcc/common.opt
36+++ b/gcc/common.opt
37@@ -595,6 +595,10 @@ Wpedantic
38 Common Var(pedantic) Warning
39 Issue warnings needed for strict compliance to the standard
40
41+Wpoison-system-directories
42+Common Var(flag_poison_system_directories) Init(1) Warning
43+Warn for -I and -L options using system directories if cross compiling
44+
45 Wshadow
46 Common Var(warn_shadow) Warning
47 Warn when one local variable shadows another
48diff --git a/gcc/config.in b/gcc/config.in
49index d80fb9f..0524af7 100644
50--- a/gcc/config.in
51+++ b/gcc/config.in
52@@ -138,6 +138,12 @@
53 #endif
54
55
56+/* Define to warn for use of native system header directories */
57+#ifndef USED_FOR_TARGET
58+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
59+#endif
60+
61+
62 /* Define if you want all operations on RTL (the basic data structure of the
63 optimizer and back end) to be checked for dynamic type safety at runtime.
64 This is quite expensive. */
65diff --git a/gcc/configure b/gcc/configure
66index 135bbf5..b65d21d 100755
67--- a/gcc/configure
68+++ b/gcc/configure
69@@ -917,6 +917,7 @@ with_gc
70 with_system_zlib
71 enable_maintainer_mode
72 enable_version_specific_runtime_libs
73+enable_poison_system_directories
74 enable_plugin
75 enable_libquadmath_support
76 with_linker_hash_style
77@@ -1630,6 +1631,8 @@ Optional Features:
78 --enable-version-specific-runtime-libs
79 specify that runtime libraries should be installed
80 in a compiler-specific directory
81+ --enable-poison-system-directories
82+ warn for use of native system header directories
83 --enable-plugin enable plugin support
84 --disable-libquadmath-support
85 disable libquadmath support for Fortran
86@@ -17828,7 +17831,7 @@ else
87 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
88 lt_status=$lt_dlunknown
89 cat > conftest.$ac_ext <<_LT_EOF
90-#line 17831 "configure"
91+#line 17834 "configure"
92 #include "confdefs.h"
93
94 #if HAVE_DLFCN_H
95@@ -17934,7 +17937,7 @@ else
96 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
97 lt_status=$lt_dlunknown
98 cat > conftest.$ac_ext <<_LT_EOF
99-#line 17937 "configure"
100+#line 17940 "configure"
101 #include "confdefs.h"
102
103 #if HAVE_DLFCN_H
104@@ -27103,6 +27106,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
105 fi
106
107
108+# Check whether --enable-poison-system-directories was given.
109+if test "${enable_poison_system_directories+set}" = set; then :
110+ enableval=$enable_poison_system_directories;
111+else
112+ enable_poison_system_directories=no
113+fi
114+
115+if test "x${enable_poison_system_directories}" = "xyes"; then
116+
117+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
118+
119+fi
120+
121 # Substitute configuration variables
122
123
124diff --git a/gcc/configure.ac b/gcc/configure.ac
125index 6363a21..e226b85 100644
126--- a/gcc/configure.ac
127+++ b/gcc/configure.ac
128@@ -5063,6 +5063,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
129 [specify that runtime libraries should be
130 installed in a compiler-specific directory])])
131
132+AC_ARG_ENABLE([poison-system-directories],
133+ AS_HELP_STRING([--enable-poison-system-directories],
134+ [warn for use of native system header directories]),,
135+ [enable_poison_system_directories=no])
136+if test "x${enable_poison_system_directories}" = "xyes"; then
137+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
138+ [1],
139+ [Define to warn for use of native system header directories])
140+fi
141+
142 # Substitute configuration variables
143 AC_SUBST(subdirs)
144 AC_SUBST(srcdir)
145diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
146index 9273d7d..a022622 100644
147--- a/gcc/doc/invoke.texi
148+++ b/gcc/doc/invoke.texi
149@@ -258,6 +258,7 @@ Objective-C and Objective-C++ Dialects}.
150 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
151 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
152 -Wpointer-arith -Wno-pointer-to-int-cast @gol
153+-Wno-poison-system-directories @gol
154 -Wredundant-decls -Wno-return-local-addr @gol
155 -Wreturn-type -Wsequence-point -Wshadow @gol
156 -Wsign-compare -Wsign-conversion -Wsizeof-pointer-memaccess @gol
157@@ -4007,6 +4008,14 @@ headers---for that, @option{-Wunknown-pragmas} must also be used.
158 for most targets, it is made up of code and thus requires the stack
159 to be made executable in order for the program to work properly.
160
161+@item -Wno-poison-system-directories
162+@opindex Wno-poison-system-directories
163+Do not warn for @option{-I} or @option{-L} options using system
164+directories such as @file{/usr/include} when cross compiling. This
165+option is intended for use in chroot environments when such
166+directories contain the correct headers and libraries for the target
167+system rather than the host.
168+
169 @item -Wfloat-equal
170 @opindex Wfloat-equal
171 @opindex Wno-float-equal
172diff --git a/gcc/gcc.c b/gcc/gcc.c
173index 86077f8..efdb625 100644
174--- a/gcc/gcc.c
175+++ b/gcc/gcc.c
176@@ -740,6 +740,8 @@ proper position among the other output files. */
177 "%{fuse-ld=*:-fuse-ld=%*}\
178 %X %{o*} %{e*} %{N} %{n} %{r}\
179 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
180+ %{Wno-poison-system-directories:--no-poison-system-directories}\
181+ %{Werror=poison-system-directories:--error-poison-system-directories}\
182 %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
183 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
184 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
185diff --git a/gcc/incpath.c b/gcc/incpath.c
186index 018da98..cd41c78 100644
187--- a/gcc/incpath.c
188+++ b/gcc/incpath.c
189@@ -28,6 +28,7 @@
190 #include "intl.h"
191 #include "incpath.h"
192 #include "cppdefault.h"
193+#include "diagnostic-core.h"
194
195 /* Microsoft Windows does not natively support inodes.
196 VMS has non-numeric inodes. */
197@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
198 }
199 fprintf (stderr, _("End of search list.\n"));
200 }
201+
202+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
203+ if (flag_poison_system_directories)
204+ {
205+ struct cpp_dir *p;
206+
207+ for (p = heads[QUOTE]; p; p = p->next)
208+ {
209+ if ((!strncmp (p->name, "/usr/include", 12))
210+ || (!strncmp (p->name, "/usr/local/include", 18))
211+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
212+ warning (OPT_Wpoison_system_directories,
213+ "include location \"%s\" is unsafe for "
214+ "cross-compilation",
215+ p->name);
216+ }
217+ }
218+#endif
219 }
220
221 /* Use given -I paths for #include "..." but not #include <...>, and
222--
2231.7.10.4
224
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0017-gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-4.8/0017-gcc-poison-dir-extend.patch
new file mode 100644
index 0000000000..9e81efd4d5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0017-gcc-poison-dir-extend.patch
@@ -0,0 +1,39 @@
1From e99c9c97266d6d3e8cac798aa91408250c4d60cf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:00:34 +0400
4Subject: [PATCH 17/35] gcc-poison-dir-extend
5
6Add /sw/include and /opt/include based on the original
7zecke-no-host-includes.patch patch. The original patch checked for
8/usr/include, /sw/include and /opt/include and then triggered a failure and
9aborted.
10
11Instead, we add the two missing items to the current scan. If the user
12wants this to be a failure, they can add "-Werror=poison-system-directories".
13
14Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Pending
18---
19 gcc/incpath.c | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/incpath.c b/gcc/incpath.c
23index cd41c78..eac4a92 100644
24--- a/gcc/incpath.c
25+++ b/gcc/incpath.c
26@@ -393,7 +393,9 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
27 {
28 if ((!strncmp (p->name, "/usr/include", 12))
29 || (!strncmp (p->name, "/usr/local/include", 18))
30- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
31+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
32+ || (!strncmp (p->name, "/sw/include", 11))
33+ || (!strncmp (p->name, "/opt/include", 12)))
34 warning (OPT_Wpoison_system_directories,
35 "include location \"%s\" is unsafe for "
36 "cross-compilation",
37--
381.7.10.4
39
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..a28cafdf95
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,73 @@
1From 56207fa2923e8edf774e98ffac82666091076be3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:08:31 +0400
4Subject: [PATCH 18/35] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
5
6Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
7
8This 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.
9
10Other changes I had to do include:
11
12- 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.
13
14- passing the right CFLAGS to configure scripts as exported environment variables
15
16I 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.
17
18Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
19
20Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22
23Upstream-Status: Pending
24---
25 configure | 32 ++++++++++++++++++++++++++++++++
26 1 file changed, 32 insertions(+)
27
28diff --git a/configure b/configure
29index 1b76c90..e4dce7c 100755
30--- a/configure
31+++ b/configure
32@@ -6772,6 +6772,38 @@ fi
33
34
35
36+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
37+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
38+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
39+# We want to ensure that TARGET libraries (which we know are built with
40+# gcc) are built with "-O2 -g", so include those options when setting
41+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
42+if test "x$CFLAGS_FOR_TARGET" = x; then
43+ CFLAGS_FOR_TARGET=$CFLAGS
44+ case " $CFLAGS " in
45+ *" -O2 "*) ;;
46+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
47+ esac
48+ case " $CFLAGS " in
49+ *" -g "* | *" -g3 "*) ;;
50+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
51+ esac
52+fi
53+
54+
55+if test "x$CXXFLAGS_FOR_TARGET" = x; then
56+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
57+ case " $CXXFLAGS " in
58+ *" -O2 "*) ;;
59+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
60+ esac
61+ case " $CXXFLAGS " in
62+ *" -g "* | *" -g3 "*) ;;
63+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
64+ esac
65+fi
66+
67+
68 # Handle --with-headers=XXX. If the value is not "yes", the contents of
69 # the named directory are copied to $(tooldir)/sys-include.
70 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
71--
721.7.10.4
73
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0019-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc-4.8/0019-64-bit-multilib-hack.patch
new file mode 100644
index 0000000000..51f4dba396
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0019-64-bit-multilib-hack.patch
@@ -0,0 +1,82 @@
1From 18fde5740b09324dfb9cf41e9849672573ff5fa0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH 19/35] 64-bit multilib hack.
5
6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22RP 15/8/11
23
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
26
27Upstream-Status: Pending
28---
29 gcc/config/i386/t-linux64 | 6 ++----
30 gcc/config/mips/t-linux64 | 10 +++-------
31 gcc/config/rs6000/t-linux64 | 5 ++---
32 3 files changed, 7 insertions(+), 14 deletions(-)
33
34diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
35index bcea0c6..eb004d7 100644
36--- a/gcc/config/i386/t-linux64
37+++ b/gcc/config/i386/t-linux64
38@@ -32,7 +32,5 @@
39 #
40 comma=,
41 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
42-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
43-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
44-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
45-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
46+MULTILIB_DIRNAMES = . .
47+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
48diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
49index bdbbd4f..16a6366 100644
50--- a/gcc/config/mips/t-linux64
51+++ b/gcc/config/mips/t-linux64
52@@ -17,10 +17,6 @@
53 # <http://www.gnu.org/licenses/>.
54
55 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
56-MULTILIB_DIRNAMES = n32 32 64
57-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
58-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
59-MULTILIB_OSDIRNAMES = \
60- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
61- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
62- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
63+MULTILIB_DIRNAMES = . . .
64+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
65+
66diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
67index 9175de2..3971019 100644
68--- a/gcc/config/rs6000/t-linux64
69+++ b/gcc/config/rs6000/t-linux64
70@@ -26,7 +26,6 @@
71 # MULTILIB_OSDIRNAMES according to what is found on the target.
72
73 MULTILIB_OPTIONS = m64/m32
74-MULTILIB_DIRNAMES = 64 32
75+MULTILIB_DIRNAMES = . .
76 MULTILIB_EXTRA_OPTS = fPIC
77-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:powerpc64-linux-gnu)
78-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
79+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
80--
811.7.10.4
82
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0020-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc-4.8/0020-optional-libstdc.patch
new file mode 100644
index 0000000000..eff021eb99
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0020-optional-libstdc.patch
@@ -0,0 +1,102 @@
1From 307c8ff3ef666b7bd5ac733863f2fbb27a9d521e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:12:56 +0400
4Subject: [PATCH 20/35] optional libstdc
5
6gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
7will not run correctly since by default the linker will try to link against libstdc++
8which shouldn't exist yet. We need an option to disable -lstdc++
9option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
10driver. This patch adds such an option which only disables the -lstdc++.
11
12A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
13do this officially, the likely answer is don't build libstdc++ separately.
14
15RP 29/6/10
16
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18
19Upstream-Status: Inappropriate [embedded specific]
20---
21 gcc/c-family/c.opt | 4 ++++
22 gcc/cp/g++spec.c | 1 +
23 gcc/doc/invoke.texi | 9 +++++++--
24 gcc/gcc.c | 1 +
25 4 files changed, 13 insertions(+), 2 deletions(-)
26
27diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
28index 10ae84d..dc3ffdf 100644
29--- a/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt
31@@ -1299,6 +1299,10 @@ nostdinc++
32 C++ ObjC++
33 Do not search standard system include directories for C++
34
35+nostdlib++
36+Driver
37+Do not link standard C++ runtime library
38+
39 o
40 C ObjC C++ ObjC++ Joined Separate
41 ; Documented in common.opt
42diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
43index b896eea..f55216b 100644
44--- a/gcc/cp/g++spec.c
45+++ b/gcc/cp/g++spec.c
46@@ -126,6 +126,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
47 switch (decoded_options[i].opt_index)
48 {
49 case OPT_nostdlib:
50+ case OPT_nostdlib__:
51 case OPT_nodefaultlibs:
52 library = -1;
53 break;
54diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
55index a022622..f15c991 100644
56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi
58@@ -190,7 +190,7 @@ in the following sections.
59 -frepo -fno-rtti -fstats -ftemplate-backtrace-limit=@var{n} @gol
60 -ftemplate-depth=@var{n} @gol
61 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
62--fno-default-inline -fvisibility-inlines-hidden @gol
63+-nostdlib++ -fno-default-inline -fvisibility-inlines-hidden @gol
64 -fvisibility-ms-compat @gol
65 -fext-numeric-literals @gol
66 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
67@@ -453,7 +453,7 @@ Objective-C and Objective-C++ Dialects}.
68 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
69 -s -static -static-libgcc -static-libstdc++ @gol
70 -static-libasan -static-libtsan @gol
71--shared -shared-libgcc -symbolic @gol
72+-shared -shared-libgcc -symbolic -nostdlib++ @gol
73 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
74 -u @var{symbol}}
75
76@@ -9886,6 +9886,11 @@ These entries are usually resolved by entries in
77 libc. These entry points should be supplied through some other
78 mechanism when this option is specified.
79
80+@item -nostdlib++
81+@opindex nostdlib++
82+Do not use the standard system C++ runtime libraries when linking.
83+Only the libraries you specify will be passed to the linker.
84+
85 @cindex @option{-lgcc}, use with @option{-nostdlib}
86 @cindex @option{-nostdlib} and unresolved references
87 @cindex unresolved references and @option{-nostdlib}
88diff --git a/gcc/gcc.c b/gcc/gcc.c
89index efdb625..477752f 100644
90--- a/gcc/gcc.c
91+++ b/gcc/gcc.c
92@@ -748,6 +748,7 @@ proper position among the other output files. */
93 %(mflib) " STACK_SPLIT_SPEC "\
94 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
95 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
96+ %{!nostdlib++:}\
97 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
98 #endif
99
100--
1011.7.10.4
102
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/meta/recipes-devtools/gcc/gcc-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
new file mode 100644
index 0000000000..eb3c61f127
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
@@ -0,0 +1,59 @@
1From 004696e054ae9dc71d512cc755ccc4074fc62b2d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:14:20 +0400
4Subject: [PATCH 21/35] gcc: disable MASK_RELAX_PIC_CALLS bit
5
6The new feature added after 4.3.3
7"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
8will cause cc1plus eat up all the system memory when build webkit-gtk.
9The function mips_get_pic_call_symbol keeps on recursively calling itself.
10Disable this feature to walk aside the bug.
11
12Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Inappropriate [configuration]
16---
17 gcc/configure | 7 -------
18 gcc/configure.ac | 7 -------
19 2 files changed, 14 deletions(-)
20
21diff --git a/gcc/configure b/gcc/configure
22index b65d21d..bdab45a 100755
23--- a/gcc/configure
24+++ b/gcc/configure
25@@ -25829,13 +25829,6 @@ $as_echo_n "checking assembler and linker for explicit JALR relocation... " >&6;
26 rm -f conftest.*
27 fi
28 fi
29- if test $gcc_cv_as_ld_jalr_reloc = yes; then
30- if test x$target_cpu_default = x; then
31- target_cpu_default=MASK_RELAX_PIC_CALLS
32- else
33- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
34- fi
35- fi
36 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
37 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
38
39diff --git a/gcc/configure.ac b/gcc/configure.ac
40index e226b85..5f5c909 100644
41--- a/gcc/configure.ac
42+++ b/gcc/configure.ac
43@@ -4099,13 +4099,6 @@ x:
44 rm -f conftest.*
45 fi
46 fi
47- if test $gcc_cv_as_ld_jalr_reloc = yes; then
48- if test x$target_cpu_default = x; then
49- target_cpu_default=MASK_RELAX_PIC_CALLS
50- else
51- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
52- fi
53- fi
54 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
55
56 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
57--
581.7.10.4
59
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0022-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-4.8/0022-COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000000..40c8abffae
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0022-COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,38 @@
1From 7f5c9dcc71c8b83a0b5596266cc4bdf0936e8e00 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:16:28 +0400
4Subject: [PATCH 22/35] COLLECT_GCC_OPTIONS
5
6This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
7invoke collect2.
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Pending
12---
13 gcc/gcc.c | 9 +++++++++
14 1 file changed, 9 insertions(+)
15
16diff --git a/gcc/gcc.c b/gcc/gcc.c
17index 477752f..51062aa 100644
18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c
20@@ -4098,6 +4098,15 @@ set_collect_gcc_options (void)
21 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
22
23 first_time = TRUE;
24+#ifdef HAVE_LD_SYSROOT
25+ if (target_system_root_changed && target_system_root)
26+ {
27+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
28+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
29+ obstack_grow (&collect_obstack, "'", 1);
30+ first_time = FALSE;
31+ }
32+#endif
33 for (i = 0; (int) i < n_switches; i++)
34 {
35 const char *const *args;
36--
371.7.10.4
38
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
new file mode 100644
index 0000000000..9e4435cf59
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,88 @@
1From 46d52439052f0876a92dcf8a0ab9c60d75c8030b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:17:25 +0400
4Subject: [PATCH 23/35] Use the defaults.h in ${B} instead of ${S}, and t-oe
5 in ${B}
6
7Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
8the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14---
15 gcc/Makefile.in | 2 +-
16 gcc/configure | 4 ++--
17 gcc/configure.ac | 4 ++--
18 gcc/mkconfig.sh | 4 ++--
19 4 files changed, 7 insertions(+), 7 deletions(-)
20
21diff --git a/gcc/Makefile.in b/gcc/Makefile.in
22index 90a2bba..2320497 100644
23--- a/gcc/Makefile.in
24+++ b/gcc/Makefile.in
25@@ -469,7 +469,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
26 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
27
28 xmake_file=@xmake_file@
29-tmake_file=@tmake_file@
30+tmake_file=@tmake_file@ ./t-oe
31 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
32 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
33 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
34diff --git a/gcc/configure b/gcc/configure
35index bdab45a..d587993 100755
36--- a/gcc/configure
37+++ b/gcc/configure
38@@ -11539,8 +11539,8 @@ for f in $tm_file; do
39 tm_include_list="${tm_include_list} $f"
40 ;;
41 defaults.h )
42- tm_file_list="${tm_file_list} \$(srcdir)/$f"
43- tm_include_list="${tm_include_list} $f"
44+ tm_file_list="${tm_file_list} ./$f"
45+ tm_include_list="${tm_include_list} ./$f"
46 ;;
47 * )
48 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
49diff --git a/gcc/configure.ac b/gcc/configure.ac
50index 5f5c909..5e5e84f 100644
51--- a/gcc/configure.ac
52+++ b/gcc/configure.ac
53@@ -1720,8 +1720,8 @@ for f in $tm_file; do
54 tm_include_list="${tm_include_list} $f"
55 ;;
56 defaults.h )
57- tm_file_list="${tm_file_list} \$(srcdir)/$f"
58- tm_include_list="${tm_include_list} $f"
59+ tm_file_list="${tm_file_list} ./$f"
60+ tm_include_list="${tm_include_list} ./$f"
61 ;;
62 * )
63 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
64diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
65index 29fdfc7..e048dce 100644
66--- a/gcc/mkconfig.sh
67+++ b/gcc/mkconfig.sh
68@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
69 if [ $# -ge 1 ]; then
70 echo '#ifdef IN_GCC' >> ${output}T
71 for file in "$@"; do
72- if test x"$file" = x"defaults.h"; then
73+ if test x"$file" = x"./defaults.h"; then
74 postpone_defaults_h="yes"
75 else
76 echo "# include \"$file\"" >> ${output}T
77@@ -103,7 +103,7 @@ esac
78
79 # If we postponed including defaults.h, add the #include now.
80 if test x"$postpone_defaults_h" = x"yes"; then
81- echo "# include \"defaults.h\"" >> ${output}T
82+ echo "# include \"./defaults.h\"" >> ${output}T
83 fi
84
85 # Add multiple inclusion protection guard, part two.
86--
871.7.10.4
88
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0024-PR-target-32219.patch b/meta/recipes-devtools/gcc/gcc-4.8/0024-PR-target-32219.patch
new file mode 100644
index 0000000000..b47d841a7f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0024-PR-target-32219.patch
@@ -0,0 +1,67 @@
1From e0d15f4f8bf28c351b9215ca37f1caa24df0e1fd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:18:54 +0400
4Subject: [PATCH 24/35] PR target/32219
5
6* varasm.c (default_binds_local_p_1): Weak data is not local.
7
8Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Backport
12---
13 gcc/testsuite/gcc.dg/visibility-21.c | 14 ++++++++++++++
14 gcc/varasm.c | 9 ++++-----
15 2 files changed, 18 insertions(+), 5 deletions(-)
16 create mode 100644 gcc/testsuite/gcc.dg/visibility-21.c
17
18diff --git a/gcc/testsuite/gcc.dg/visibility-21.c b/gcc/testsuite/gcc.dg/visibility-21.c
19new file mode 100644
20index 0000000..be7deda
21--- /dev/null
22+++ b/gcc/testsuite/gcc.dg/visibility-21.c
23@@ -0,0 +1,14 @@
24+/* PR target/32219 */
25+/* { dg-do run } */
26+/* { dg-require-visibility "" } */
27+/* { dg-options "-fPIC" { target fpic } } */
28+
29+extern void f() __attribute__((weak,visibility("hidden")));
30+extern int puts( char const* );
31+int main()
32+{
33+ if (f)
34+ f();
35+ return 0;
36+}
37+
38diff --git a/gcc/varasm.c b/gcc/varasm.c
39index 6648103..fadba78 100644
40--- a/gcc/varasm.c
41+++ b/gcc/varasm.c
42@@ -6675,6 +6675,10 @@ default_binds_local_p_1 (const_tree exp, int shlib)
43 /* Static variables are always local. */
44 else if (! TREE_PUBLIC (exp))
45 local_p = true;
46+ /* hidden weak can't be overridden by something non-local, all
47+ that is possible is that it is not defined at all. */
48+ else if (DECL_WEAK (exp))
49+ local_p = false;
50 /* A variable is local if the user has said explicitly that it will
51 be. */
52 else if ((DECL_VISIBILITY_SPECIFIED (exp)
53@@ -6688,11 +6692,6 @@ default_binds_local_p_1 (const_tree exp, int shlib)
54 local. */
55 else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
56 local_p = true;
57- /* Default visibility weak data can be overridden by a strong symbol
58- in another module and so are not local. */
59- else if (DECL_WEAK (exp)
60- && !resolved_locally)
61- local_p = false;
62 /* If PIC, then assume that any global name can be overridden by
63 symbols resolved from other modules. */
64 else if (shlib)
65--
661.7.10.4
67
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0025-fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-4.8/0025-fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..0e7914d5c7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0025-fortran-cross-compile-hack.patch
@@ -0,0 +1,46 @@
1From af8a56ea4e17b2909eff2c57704ab43ef24f28d3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:01 +0400
4Subject: [PATCH 25/35] fortran cross-compile hack.
5
6* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
7used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
8directory.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Upstream-Status: Inappropriate [embedded specific]
13---
14 libgfortran/configure | 2 +-
15 libgfortran/configure.ac | 2 +-
16 2 files changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/libgfortran/configure b/libgfortran/configure
19index 8385e96..b8f7a92 100755
20--- a/libgfortran/configure
21+++ b/libgfortran/configure
22@@ -12704,7 +12704,7 @@ esac
23
24 # We need gfortran to compile parts of the library
25 #AC_PROG_FC(gfortran)
26-FC="$GFORTRAN"
27+#FC="$GFORTRAN"
28 ac_ext=${ac_fc_srcext-f}
29 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
30 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
31diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
32index 7d97fed..3f9f484 100644
33--- a/libgfortran/configure.ac
34+++ b/libgfortran/configure.ac
35@@ -227,7 +227,7 @@ AC_SUBST(enable_static)
36
37 # We need gfortran to compile parts of the library
38 #AC_PROG_FC(gfortran)
39-FC="$GFORTRAN"
40+#FC="$GFORTRAN"
41 AC_PROG_FC(gfortran)
42
43 # extra LD Flags which are required for targets
44--
451.7.10.4
46
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0026-libgcc-sjlj-check.patch b/meta/recipes-devtools/gcc/gcc-4.8/0026-libgcc-sjlj-check.patch
new file mode 100644
index 0000000000..d4efab956a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0026-libgcc-sjlj-check.patch
@@ -0,0 +1,74 @@
1From 08c2398445e6cac282488f64ae6bf29cbcd8db23 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:50 +0400
4Subject: [PATCH 26/35] libgcc-sjlj-check
5
6ac_fn_c_try_compile doesnt seem to keep the intermediate files
7which are needed for sjlj test to pass since it greps into the
8generated file. So we run the compiler command using AC_TRY_COMMAND
9which then generates the needed .s file
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14---
15 libgcc/configure | 10 ++++++----
16 libgcc/configure.ac | 10 ++++------
17 2 files changed, 10 insertions(+), 10 deletions(-)
18
19diff --git a/libgcc/configure b/libgcc/configure
20index 1425df6..d18e3cb 100644
21--- a/libgcc/configure
22+++ b/libgcc/configure
23@@ -4208,17 +4208,19 @@ void foo ()
24 }
25
26 _ACEOF
27-CFLAGS_hold=$CFLAGS
28-CFLAGS="--save-temps -fexceptions"
29 libgcc_cv_lib_sjlj_exceptions=unknown
30-if ac_fn_c_try_compile; then :
31+if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
32+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
33+ (eval $ac_try) 2>&5
34+ ac_status=$?
35+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
36+ test $ac_status = 0; }; }; then
37 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
38 libgcc_cv_lib_sjlj_exceptions=yes
39 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
40 libgcc_cv_lib_sjlj_exceptions=no
41 fi
42 fi
43-CFLAGS=$CFLAGS_hold
44 rm -f conftest*
45
46 fi
47diff --git a/libgcc/configure.ac b/libgcc/configure.ac
48index 8b7aba5..c7c9644 100644
49--- a/libgcc/configure.ac
50+++ b/libgcc/configure.ac
51@@ -216,16 +216,14 @@ void foo ()
52 bar();
53 }
54 ])])
55-CFLAGS_hold=$CFLAGS
56-CFLAGS="--save-temps -fexceptions"
57 libgcc_cv_lib_sjlj_exceptions=unknown
58-AS_IF([ac_fn_c_try_compile],
59- [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
60+if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
61+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
62 libgcc_cv_lib_sjlj_exceptions=yes
63 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
64 libgcc_cv_lib_sjlj_exceptions=no
65- fi])
66-CFLAGS=$CFLAGS_hold
67+ fi
68+fi
69 rm -f conftest*
70 ])
71
72--
731.7.10.4
74
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0027-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.8/0027-cpp-honor-sysroot.patch
new file mode 100644
index 0000000000..05e95219f8
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0027-cpp-honor-sysroot.patch
@@ -0,0 +1,54 @@
1From a0f9bd09c816ad29ecf7c29d6c27f7df97710364 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH 27/35] cpp: honor sysroot.
5
6Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
7preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
8rather than the --sysroot option specified on the commandline. If access to that directory is
9permission denied (unreadable), gcc will error.
10
11This happens when ccache is in use due to the fact it uses preprocessed source files.
12
13The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
14-isystem, -isysroot happen and the correct sysroot is used.
15
16[YOCTO #2074]
17
18RP 2012/04/13
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21
22Upstream-Status: Pending
23---
24 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.c | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
29index a001c3e..1aae1e4 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -63,5 +63,5 @@ along with GCC; see the file COPYING3. If not see
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!M:%{!MM:%{!E:\
36- cc1plus -fpreprocessed %i %(cc1_options) %2\
37+ cc1plus -fpreprocessed %i %I %(cc1_options) %2\
38 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
39diff --git a/gcc/gcc.c b/gcc/gcc.c
40index 51062aa..cf6b99e 100644
41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c
43@@ -1042,7 +1042,7 @@ static const struct compiler default_compilers[] =
44 %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
45 {".i", "@cpp-output", 0, 0, 0},
46 {"@cpp-output",
47- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
48+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
49 {".s", "@assembler", 0, 0, 0},
50 {"@assembler",
51 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
52--
531.7.10.4
54
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0028-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc-4.8/0028-MIPS64-Default-to-N64-ABI.patch
new file mode 100644
index 0000000000..263872069c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0028-MIPS64-Default-to-N64-ABI.patch
@@ -0,0 +1,31 @@
1From 301e18d4711db5925e767fad08dffa9cfe0a2f1f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:23:08 +0400
4Subject: [PATCH 28/35] MIPS64: Default to N64 ABI
5
6MIPS64 defaults to n32 ABI, this patch makes it
7so that it defaults to N64 ABI
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Inappropriate [OE config specific]
12---
13 gcc/config.gcc | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/gcc/config.gcc b/gcc/config.gcc
17index 1a0be50..989c2fb 100644
18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc
20@@ -1797,7 +1797,7 @@ mips*-mti-linux*)
21 mips64*-*-linux* | mipsisa64*-*-linux*)
22 tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h"
23 tmake_file="${tmake_file} mips/t-linux64"
24- tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
25+ tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
26 case ${target} in
27 mips64el-st-linux-gnu)
28 tm_file="${tm_file} mips/st.h"
29--
301.7.10.4
31
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
new file mode 100644
index 0000000000..0e8fffcd8b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,190 @@
1From 29d12344fb682a053de53eb08b95704cf3b67af2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH 29/35] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
5 relative to SYSTEMLIBS_DIR
6
7This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
8relative to SYSTEMLIBS_DIR which can be set in generated headers
9This breaks the assumption of hardcoded multilib in gcc
10Change is only for the supported architectures in OE including
11SH, sparc, alpha for possible future support (if any)
12
13Removes the do_headerfix task in metadata
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration]
18---
19 gcc/config/alpha/linux-elf.h | 4 ++--
20 gcc/config/arm/linux-eabi.h | 4 ++--
21 gcc/config/arm/linux-elf.h | 2 +-
22 gcc/config/i386/linux.h | 2 +-
23 gcc/config/i386/linux64.h | 6 +++---
24 gcc/config/mips/linux.h | 2 +-
25 gcc/config/mips/linux64.h | 8 ++++----
26 gcc/config/rs6000/linux64.h | 8 ++++----
27 gcc/config/sh/linux.h | 2 +-
28 gcc/config/sparc/linux.h | 2 +-
29 gcc/config/sparc/linux64.h | 4 ++--
30 11 files changed, 22 insertions(+), 22 deletions(-)
31
32diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
33index 84e0596..3a59d71 100644
34--- a/gcc/config/alpha/linux-elf.h
35+++ b/gcc/config/alpha/linux-elf.h
36@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
37 #define EXTRA_SPECS \
38 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
39
40-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
41-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
42+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
43+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
44 #if DEFAULT_LIBC == LIBC_UCLIBC
45 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
46 #elif DEFAULT_LIBC == LIBC_GLIBC
47diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
48index 4a425c8..80f454d 100644
49--- a/gcc/config/arm/linux-eabi.h
50+++ b/gcc/config/arm/linux-eabi.h
51@@ -68,8 +68,8 @@
52 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
53
54 #undef GLIBC_DYNAMIC_LINKER
55-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
56-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
57+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
58+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
59 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
60
61 #define GLIBC_DYNAMIC_LINKER \
62diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
63index 753dc3a..d593967 100644
64--- a/gcc/config/arm/linux-elf.h
65+++ b/gcc/config/arm/linux-elf.h
66@@ -57,7 +57,7 @@
67
68 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
69
70-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
71+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
72
73 #define LINUX_TARGET_LINK_SPEC "%{h*} \
74 %{static:-Bstatic} \
75diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
76index 3c95ee0..33b8acd 100644
77--- a/gcc/config/i386/linux.h
78+++ b/gcc/config/i386/linux.h
79@@ -20,4 +20,4 @@ along with GCC; see the file COPYING3. If not see
80 <http://www.gnu.org/licenses/>. */
81
82 #define GNU_USER_LINK_EMULATION "elf_i386"
83-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
84+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
85diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
86index b793e08..da788b8 100644
87--- a/gcc/config/i386/linux64.h
88+++ b/gcc/config/i386/linux64.h
89@@ -27,6 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
90 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
91 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
92
93-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
94-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
95-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
96+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
97+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
98+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
99diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
100index 9b4c68d..7ee5ba8 100644
101--- a/gcc/config/mips/linux.h
102+++ b/gcc/config/mips/linux.h
103@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
104 along with GCC; see the file COPYING3. If not see
105 <http://www.gnu.org/licenses/>. */
106
107-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
108+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
109diff --git a/gcc/config/mips/linux64.h b/gcc/config/mips/linux64.h
110index dbba47a..c7ed573 100644
111--- a/gcc/config/mips/linux64.h
112+++ b/gcc/config/mips/linux64.h
113@@ -22,10 +22,10 @@ along with GCC; see the file COPYING3. If not see
114 #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
115 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
116
117-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
118-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
119-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
120-#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
121+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
122+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld.so.1"
123+#define GLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld.so.1"
124+#define UCLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
125 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
126 #define GNU_USER_DYNAMIC_LINKERN32 \
127 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
128diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
129index dc6f67f..bc60769 100644
130--- a/gcc/config/rs6000/linux64.h
131+++ b/gcc/config/rs6000/linux64.h
132@@ -360,10 +360,10 @@ extern int dot_symbols;
133 #undef LINK_OS_DEFAULT_SPEC
134 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
135
136-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
137-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
138-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
139-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
140+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
141+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
142+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
143+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
144 #if DEFAULT_LIBC == LIBC_UCLIBC
145 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
146 #elif DEFAULT_LIBC == LIBC_GLIBC
147diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
148index 9e8f32d..86bf81e 100644
149--- a/gcc/config/sh/linux.h
150+++ b/gcc/config/sh/linux.h
151@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see
152
153 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
154
155-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
156+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
157
158 #undef SUBTARGET_LINK_EMUL_SUFFIX
159 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
160diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
161index 49283d3..6f0b03a 100644
162--- a/gcc/config/sparc/linux.h
163+++ b/gcc/config/sparc/linux.h
164@@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
165 When the -shared link option is used a final link is not being
166 done. */
167
168-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
169+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
170
171 #undef LINK_SPEC
172 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
173diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
174index 7d48e96..b01993f 100644
175--- a/gcc/config/sparc/linux64.h
176+++ b/gcc/config/sparc/linux64.h
177@@ -92,8 +92,8 @@ along with GCC; see the file COPYING3. If not see
178 When the -shared link option is used a final link is not being
179 done. */
180
181-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
182-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
183+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
184+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
185
186 #ifdef SPARC_BI_ARCH
187
188--
1891.7.10.4
190
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0030-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc-4.8/0030-gcc-Fix-argument-list-too-long-error.patch
new file mode 100644
index 0000000000..2ceaff64f7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0030-gcc-Fix-argument-list-too-long-error.patch
@@ -0,0 +1,40 @@
1From c1816c160156f99c34e6a0a0311bb0219326804e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:26:37 +0400
4Subject: [PATCH 30/35] gcc: Fix argument list too long error.
5
6There would be an "Argument list too long" error when the
7build directory is longer than 200, this is caused by:
8
9headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
10
11The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
12it, use the $(sort list) of GNU make which can handle the too long list
13would fix the problem, the header would be short enough after sorted.
14The "tr ' ' '\012'" was used for translating the space to "\n", the
15$(sort list) doesn't need this.
16
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 gcc/Makefile.in | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/gcc/Makefile.in b/gcc/Makefile.in
26index 2320497..8562a62 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -4627,7 +4627,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
30 # We keep the directory structure for files in config or c-family and .def
31 # files. All other files are flattened to a single directory.
32 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
33- headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
34+ headers="$(sort $(PLUGIN_HEADERS))"; \
35 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
36 for file in $$headers; do \
37 if [ -f $$file ] ; then \
38--
391.7.10.4
40
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0031-Disable-sdt.patch b/meta/recipes-devtools/gcc/gcc-4.8/0031-Disable-sdt.patch
new file mode 100644
index 0000000000..c714239bea
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0031-Disable-sdt.patch
@@ -0,0 +1,45 @@
1From eb70cb2785af7171897f363298bbfcd83de5ec57 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:28:10 +0400
4Subject: [PATCH 31/35] Disable sdt.
5
6We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
7It may or may not exist from preivous builds though. To be determinstic, disable
8sdt.h usage always. This avoids build failures if the header is removed after configure
9but before libgcc is compiled for example.
10
11RP 2012/8/7
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Inappropriate [hack]
16---
17 gcc/configure | 12 ++++++------
18 1 file changed, 6 insertions(+), 6 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index d587993..8bc0c98 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -26792,12 +26792,12 @@ fi
25 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
26 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
27 have_sys_sdt_h=no
28-if test -f $target_header_dir/sys/sdt.h; then
29- have_sys_sdt_h=yes
30-
31-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
32-
33-fi
34+#if test -f $target_header_dir/sys/sdt.h; then
35+# have_sys_sdt_h=yes
36+#
37+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
38+#
39+#fi
40 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
41 $as_echo "$have_sys_sdt_h" >&6; }
42
43--
441.7.10.4
45
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0032-libtool.patch b/meta/recipes-devtools/gcc/gcc-4.8/0032-libtool.patch
new file mode 100644
index 0000000000..3b3d1b621b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0032-libtool.patch
@@ -0,0 +1,42 @@
1From 6c715fcfa262adadca81c68a1f3f69aa3187a501 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH 32/35] libtool
5
6libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
7when running on am x86_64 build host.
8
9This patch stops this speading to libdir in the libstdc++.la file within libtool.
10Arguably, it shouldn't be passing this into libtool in the first place but
11for now this resolves the nastiest problems this causes.
12
13func_normal_abspath would resolve an empty path to `pwd` so we need
14to filter the zero case.
15
16RP 2012/8/24
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/ltmain.sh b/ltmain.sh
26index a03433f..46f47c2 100644
27--- a/ltmain.sh
28+++ b/ltmain.sh
29@@ -6359,6 +6359,10 @@ func_mode_link ()
30 func_warning "ignoring multiple \`-rpath's for a libtool library"
31
32 install_libdir="$1"
33+ if test -n "$install_libdir"; then
34+ func_normal_abspath "$install_libdir"
35+ install_libdir=$func_normal_abspath_result
36+ fi
37
38 oldlibs=
39 if test -z "$rpath"; then
40--
411.7.10.4
42
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta/recipes-devtools/gcc/gcc-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
new file mode 100644
index 0000000000..199984d655
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,43 @@
1From 97e4591c20310425e7aca0e6712a8d9480e7744c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH 33/35] gcc: armv4: pass fix-v4bx to linker to support EABI.
5
6The LINK_SPEC for linux gets overwritten by linux-eabi.h which
7means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
8the option is not passed to linker when chosing march=armv4
9This patch redefines this in linux-eabi.h and reinserts it
10for eabi defaulting toolchains.
11
12We might want to send it upstream.
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16Upstream-Status: Pending
17---
18 gcc/config/arm/linux-eabi.h | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
22index 80f454d..4db3eb9 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -77,10 +77,14 @@
26 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
27 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
28
29+/* For armv4 we pass --fix-v4bx to linker to support EABI */
30+#undef TARGET_FIX_V4BX_SPEC
31+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
32+
33 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
34 use the GNU/Linux version, not the generic BPABI version. */
35 #undef LINK_SPEC
36-#define LINK_SPEC BE8_LINK_SPEC \
37+#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
41--
421.7.10.4
43
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta/recipes-devtools/gcc/gcc-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
new file mode 100644
index 0000000000..66b9f89a13
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,102 @@
1From fc5e4beaea856a2b486c770ad3addc0f5bb3100e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH 34/35] Use the multilib config files from ${B} instead of
5 using the ones from ${S}
6
7Use the multilib config files from ${B} instead of using the ones from ${S}
8so that the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
13
14Upstream-Status: Inappropriate [configuration]
15---
16 gcc/configure | 22 ++++++++++++++++++----
17 gcc/configure.ac | 22 ++++++++++++++++++----
18 2 files changed, 36 insertions(+), 8 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index 8bc0c98..3cd0817 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -11519,10 +11519,20 @@ done
25 tmake_file_=
26 for f in ${tmake_file}
27 do
28- if test -f ${srcdir}/config/$f
29- then
30- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31- fi
32+ case $f in
33+ */t-linux64 )
34+ if test -f ./config/$f
35+ then
36+ tmake_file_="${tmake_file_} ./config/$f"
37+ fi
38+ ;;
39+ * )
40+ if test -f ${srcdir}/config/$f
41+ then
42+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
43+ fi
44+ ;;
45+ esac
46 done
47 tmake_file="${tmake_file_}"
48
49@@ -11533,6 +11543,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do
52 case $f in
53+ */linux64.h )
54+ tm_file_list="${tm_file_list} ./config/$f"
55+ tm_include_list="${tm_include_list} ./config/$f"
56+ ;;
57 ./* )
58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 5e5e84f..415a6df 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -1700,10 +1700,20 @@ done
65 tmake_file_=
66 for f in ${tmake_file}
67 do
68- if test -f ${srcdir}/config/$f
69- then
70- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71- fi
72+ case $f in
73+ */t-linux64 )
74+ if test -f ./config/$f
75+ then
76+ tmake_file_="${tmake_file_} ./config/$f"
77+ fi
78+ ;;
79+ * )
80+ if test -f ${srcdir}/config/$f
81+ then
82+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
83+ fi
84+ ;;
85+ esac
86 done
87 tmake_file="${tmake_file_}"
88
89@@ -1714,6 +1724,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do
92 case $f in
93+ */linux64.h )
94+ tm_file_list="${tm_file_list} ./config/$f"
95+ tm_include_list="${tm_include_list} ./config/$f"
96+ ;;
97 ./* )
98 f=`echo $f | sed 's/^..//'`
99 tm_file_list="${tm_file_list} $f"
100--
1011.7.10.4
102
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0035-wcast-qual-PR-55383.patch b/meta/recipes-devtools/gcc/gcc-4.8/0035-wcast-qual-PR-55383.patch
new file mode 100644
index 0000000000..be4cf4a737
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0035-wcast-qual-PR-55383.patch
@@ -0,0 +1,55 @@
1From deffdb0b2497a106061d3ea2c6a3fef4fba3445e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:39:51 +0400
4Subject: [PATCH 35/35] wcast-qual PR/55383
5
6This is a backport from gcc bugzilla
7
8http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55383
9
10This commit fixes a wrong warning behavior. This bug which has no
11workaround other than disabling the warning.
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Backport
16---
17 gcc/c/c-typeck.c | 2 +-
18 gcc/testsuite/c-c++-common/Wcast-qual-1.c | 6 +++---
19 2 files changed, 4 insertions(+), 4 deletions(-)
20
21diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
22index ddb6d39..c624120 100644
23--- a/gcc/c/c-typeck.c
24+++ b/gcc/c/c-typeck.c
25@@ -4464,7 +4464,7 @@ handle_warn_cast_qual (location_t loc, tree type, tree otype)
26 /* There are qualifiers present in IN_OTYPE that are not present
27 in IN_TYPE. */
28 warning_at (loc, OPT_Wcast_qual,
29- "cast discards %q#v qualifier from pointer target type",
30+ "cast discards %qv qualifier from pointer target type",
31 discarded);
32
33 if (added || discarded)
34diff --git a/gcc/testsuite/c-c++-common/Wcast-qual-1.c b/gcc/testsuite/c-c++-common/Wcast-qual-1.c
35index 640e4f0..56382c7 100644
36--- a/gcc/testsuite/c-c++-common/Wcast-qual-1.c
37+++ b/gcc/testsuite/c-c++-common/Wcast-qual-1.c
38@@ -85,11 +85,11 @@ f3 (void ***bar)
39 void
40 f4 (void * const **bar)
41 {
42- const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
43+ const void ***p9 = (const void ***) bar; /* { dg-warning "cast discards .const. qualifier" } */
44 void * const **p11 = (void * const **) bar;
45- void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast" } */
46+ void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */
47 const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
48- const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
49+ const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */
50 void * const * const * p19 = (void * const * const *) bar;
51 const void * const * const *p21 = (const void * const * const *) bar;
52 }
53--
541.7.10.4
55
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0036-PR-target-56102.patch b/meta/recipes-devtools/gcc/gcc-4.8/0036-PR-target-56102.patch
new file mode 100644
index 0000000000..a9498fcb7e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0036-PR-target-56102.patch
@@ -0,0 +1,83 @@
1From fa049b3584a1cc36c250205e3d5841e6a40ff677 Mon Sep 17 00:00:00 2001
2From: amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 27 Mar 2013 08:16:54 +0000
4Subject: [PATCH] PR target/56102
5
6* config/arm/arm.c (thumb1_rtx_costs, thumb1_size_rtx_costs): Fix rtx costs for SET/ASHIFT/ASHIFTRT/LSHIFTRT/ROTATERT patterns with mult-word mode.
7
8git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197155 138bc75d-0d04-0410-961f-82ee72b054a4
9
10Upstream-Status: Backport
11http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57329
12
13Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
14---
15 gcc/config/arm/arm.c | 17 ++++++++++++++---
16 1 file changed, 14 insertions(+), 3 deletions(-)
17
18diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
19index 460d333..edf850d 100644
20--- a/gcc/config/arm/arm.c
21+++ b/gcc/config/arm/arm.c
22@@ -7094,7 +7094,7 @@ static inline int
23 thumb1_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
24 {
25 enum machine_mode mode = GET_MODE (x);
26- int total;
27+ int total, words;
28
29 switch (code)
30 {
31@@ -7102,6 +7102,8 @@ thumb1_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
32 case ASHIFTRT:
33 case LSHIFTRT:
34 case ROTATERT:
35+ return (mode == SImode) ? COSTS_N_INSNS (1) : COSTS_N_INSNS (2);
36+
37 case PLUS:
38 case MINUS:
39 case COMPARE:
40@@ -7125,7 +7127,10 @@ thumb1_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
41 return COSTS_N_INSNS (1) + 16;
42
43 case SET:
44- return (COSTS_N_INSNS (1)
45+ /* A SET doesn't have a mode, so let's look at the SET_DEST to get
46+ the mode. */
47+ words = ARM_NUM_INTS (GET_MODE_SIZE (GET_MODE (SET_DEST (x))));
48+ return (COSTS_N_INSNS (words)
49 + 4 * ((MEM_P (SET_SRC (x)))
50 + MEM_P (SET_DEST (x))));
51
52@@ -7822,6 +7827,7 @@ static inline int
53 thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
54 {
55 enum machine_mode mode = GET_MODE (x);
56+ int words;
57
58 switch (code)
59 {
60@@ -7829,6 +7835,8 @@ thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
61 case ASHIFTRT:
62 case LSHIFTRT:
63 case ROTATERT:
64+ return (mode == SImode) ? COSTS_N_INSNS (1) : COSTS_N_INSNS (2);
65+
66 case PLUS:
67 case MINUS:
68 case COMPARE:
69@@ -7847,7 +7855,10 @@ thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
70 return COSTS_N_INSNS (1);
71
72 case SET:
73- return (COSTS_N_INSNS (1)
74+ /* A SET doesn't have a mode, so let's look at the SET_DEST to get
75+ the mode. */
76+ words = ARM_NUM_INTS (GET_MODE_SIZE (GET_MODE (SET_DEST (x))));
77+ return (COSTS_N_INSNS (words)
78 + 4 * ((MEM_P (SET_SRC (x)))
79 + MEM_P (SET_DEST (x))));
80
81--
821.8.2.1
83
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0037-gcc-4.8-PR56797.patch b/meta/recipes-devtools/gcc/gcc-4.8/0037-gcc-4.8-PR56797.patch
new file mode 100644
index 0000000000..b5d7b864fd
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0037-gcc-4.8-PR56797.patch
@@ -0,0 +1,66 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From patchwork Fri Apr 19 09:34:49 2013
5Content-Type: text/plain; charset="utf-8"
6MIME-Version: 1.0
7Content-Transfer-Encoding: 7bit
8Subject: [ARM] Fix PR56797
9Date: Thu, 18 Apr 2013 23:34:49 -0000
10From: Greta Yorsh <Greta.Yorsh@arm.com>
11X-Patchwork-Id: 237891
12Message-Id: <000801ce3ce1$23fbdd60$6bf39820$@yorsh@arm.com>
13To: "GCC Patches" <gcc-patches@gcc.gnu.org>
14Cc: <raj.khem@gmail.com>, "Richard Earnshaw" <Richard.Earnshaw@arm.com>,
15 "Ramana Radhakrishnan" <Ramana.Radhakrishnan@arm.com>
16
17Fix PR56797
18http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56797
19
20The problem is that peephole optimizer thinks it can generate an ldm, but
21the pattern for ldm no longer matches, because after r188738 it requires
22that if one of the destination registers is SP then the base register must
23be SP, and it's not SP in the test case.
24
25The test case fails on armv5t but doesn't fail on armv6t2 or armv7-a because
26peephole doesn't trigger there (because there is a different epilogue
27sequence). It looks like a latent problem for other architecture or CPUs.
28
29This patch adds this condition to the peephole optimizer.
30
31No regression on qemu for arm-none-eabi and fixes the test reported in the
32PR. I couldn't minimize the test sufficiently to include it in the
33testsuite.
34
35Ok for trunk?
36
37Thanks,
38Greta
39
40gcc/
41
422013-04-18 Greta Yorsh <Greta.Yorsh@arm.com>
43
44 PR target/56797
45 * config/arm/arm.c (load_multiple_sequence): Require SP
46 as base register for loads if SP is in the register list.
47
48
49diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
50index d00849c..60fef78 100644
51--- a/gcc/config/arm/arm.c
52+++ b/gcc/config/arm/arm.c
53@@ -10347,6 +10347,13 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order,
54 || (i != nops - 1 && unsorted_regs[i] == base_reg))
55 return 0;
56
57+ /* Don't allow SP to be loaded unless it is also the base
58+ register. It guarantees that SP is reset correctly when
59+ an LDM instruction is interruptted. Otherwise, we might
60+ end up with a corrupt stack. */
61+ if (unsorted_regs[i] == SP_REGNUM && base_reg != SP_REGNUM)
62+ return 0;
63+
64 unsorted_offsets[i] = INTVAL (offset);
65 if (i == 0 || unsorted_offsets[i] < unsorted_offsets[order[0]])
66 order[0] = i;
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0038-gcc-4.8-build-args.patch b/meta/recipes-devtools/gcc/gcc-4.8/0038-gcc-4.8-build-args.patch
new file mode 100644
index 0000000000..c27e009619
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0038-gcc-4.8-build-args.patch
@@ -0,0 +1,41 @@
1When cross compiling a target gcc, target flags may be used on the host
2
3Configure identifies a number of warning flags (WARN_CFLAGS and
4WARN_CXXFLAGS) from the $CC value. The cross compiler may be different
5from the host compiler and may not support the same set of flags. This
6leads to problems such as:
7
8cc1plus: error: unrecognized command line option "-Wno-narrowing"
9cc1plus: error: unrecognized command line option "-Wno-overlength-strings"
10
11Work around this problem by removing the warning flags from the
12BUILD_CXXFLAGS value, in a way similar to the BUILD_CFLAGS.
13
14Upstream-Status: Pending
15
16Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
17
18Index: gcc-4.8.0/gcc/configure
19===================================================================
20--- gcc-4.8.0.orig/gcc/configure
21+++ gcc-4.8.0/gcc/configure
22@@ -11720,6 +10581,7 @@ STMP_FIXINC=stmp-fixinc
23 if test x$build != x$host || test "x$coverage_flags" != x
24 then
25 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
26+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
27 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
28 fi
29
30Index: gcc-4.8.0/gcc/configure.ac
31===================================================================
32--- gcc-4.8.0.orig/gcc/configure.ac
33+++ gcc-4.8.0/gcc/configure.ac
34@@ -1901,6 +1901,7 @@ STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_F
35 if test x$build != x$host || test "x$coverage_flags" != x
36 then
37 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
38+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
39 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
40 fi
41
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0039-gcc-4.8-PR57717.patch b/meta/recipes-devtools/gcc/gcc-4.8/0039-gcc-4.8-PR57717.patch
new file mode 100644
index 0000000000..f983f70d02
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0039-gcc-4.8-PR57717.patch
@@ -0,0 +1,23 @@
1This backports fix from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717
2
3Upstream-Status: Backport
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5
6Index: gcc-4.8.1/gcc/config/rs6000/rs6000.c
7===================================================================
8--- gcc-4.8.1.orig/gcc/config/rs6000/rs6000.c 2013-05-09 18:54:06.000000000 -0700
9+++ gcc-4.8.1/gcc/config/rs6000/rs6000.c 2013-06-27 08:22:40.459021366 -0700
10@@ -5431,11 +5431,12 @@
11
12 case TFmode:
13 case TDmode:
14- case TImode:
15 if (TARGET_E500_DOUBLE)
16 return (SPE_CONST_OFFSET_OK (offset)
17 && SPE_CONST_OFFSET_OK (offset + 8));
18+ /* Fall through. */
19
20+ case TImode:
21 extra = 8;
22 if (!worst_case)
23 break;
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0040-fix-g++-sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.8/0040-fix-g++-sysroot.patch
new file mode 100644
index 0000000000..d50aa5c9bc
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0040-fix-g++-sysroot.patch
@@ -0,0 +1,40 @@
1Portions of
2
3http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
4
5are not upstreamed yet. So lets keep missing pieces.
6
7Upstream-Status: Pending
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Index: gcc-4.8.1/gcc/configure.ac
12===================================================================
13--- gcc-4.8.1.orig/gcc/configure.ac 2013-07-15 15:55:49.488399132 -0700
14+++ gcc-4.8.1/gcc/configure.ac 2013-07-15 16:02:31.772406679 -0700
15@@ -148,7 +148,9 @@
16 if test "${with_sysroot+set}" = set; then
17 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
18 if test "${gcc_gxx_without_sysroot}"; then
19- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
20+ if test x${with_sysroot} != x/; then
21+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
22+ fi
23 gcc_gxx_include_dir_add_sysroot=1
24 fi
25 fi
26Index: gcc-4.8.1/gcc/configure
27===================================================================
28--- gcc-4.8.1.orig/gcc/configure 2013-07-15 15:55:49.472399132 -0700
29+++ gcc-4.8.1/gcc/configure 2013-07-15 16:02:31.780406680 -0700
30@@ -3325,7 +3325,9 @@
31 if test "${with_sysroot+set}" = set; then
32 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
33 if test "${gcc_gxx_without_sysroot}"; then
34- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
35+ if test x${with_sysroot} != x/; then
36+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
37+ fi
38 gcc_gxx_include_dir_add_sysroot=1
39 fi
40 fi
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0041-libtool-avoid-libdir.patch b/meta/recipes-devtools/gcc/gcc-4.8/0041-libtool-avoid-libdir.patch
new file mode 100644
index 0000000000..2dd9610a2f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0041-libtool-avoid-libdir.patch
@@ -0,0 +1,19 @@
1Avoid using libdir from .la which usually points to a host path
2
3Upstream-Status: Inappropriate [embedded specific]
4Signed-off-by: Jonathan Liu <net147@gmail.com>
5
6diff --git a/ltmain.sh b/ltmain.sh
7index a03433f..1902a90 100644
8--- a/ltmain.sh
9+++ b/ltmain.sh
10@@ -5628,6 +5628,9 @@ func_mode_link ()
11 absdir="$abs_ladir"
12 libdir="$abs_ladir"
13 else
14+ # Instead of using libdir from .la which usually points to a host path,
15+ # use the path the .la is contained in.
16+ libdir="$abs_ladir"
17 dir="$libdir"
18 absdir="$libdir"
19 fi
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch b/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch
new file mode 100644
index 0000000000..5356f722d9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch
@@ -0,0 +1,78 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj
3
42013-08-01 Martin Jambor <mjambor@suse.cz>
5
6 PR middle-end/57748
7 * stor-layout.c (compute_record_mode): Treat zero-sized array fields
8 like incomplete types.
9
10testsuite/
11 * gcc.dg/torture/pr57748.c: New test.
12
13
14Index: gcc-4.8.1/gcc/stor-layout.c
15===================================================================
16--- gcc-4.8.1.orig/gcc/stor-layout.c 2013-04-28 10:29:18.000000000 -0700
17+++ gcc-4.8.1/gcc/stor-layout.c 2013-08-01 15:02:08.018006125 -0700
18@@ -1618,7 +1618,9 @@
19 && integer_zerop (TYPE_SIZE (TREE_TYPE (field)))))
20 || ! host_integerp (bit_position (field), 1)
21 || DECL_SIZE (field) == 0
22- || ! host_integerp (DECL_SIZE (field), 1))
23+ || ! host_integerp (DECL_SIZE (field), 1)
24+ || (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
25+ && tree_low_cst (DECL_SIZE (field), 1) == 0))
26 return;
27
28 /* If this field is the whole struct, remember its mode so
29Index: gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c
30===================================================================
31--- /dev/null 1970-01-01 00:00:00.000000000 +0000
32+++ gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c 2013-08-01 15:02:08.062006126 -0700
33@@ -0,0 +1,45 @@
34+/* PR middle-end/57748 */
35+/* { dg-do run } */
36+
37+#include <stdlib.h>
38+
39+extern void abort (void);
40+
41+typedef long long V
42+ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
43+
44+typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
45+
46+struct __attribute__((packed)) T { char c; P s; };
47+
48+void __attribute__((noinline, noclone))
49+check (struct T *t)
50+{
51+ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
52+ abort ();
53+}
54+
55+int __attribute__((noinline, noclone))
56+get_i (void)
57+{
58+ return 0;
59+}
60+
61+void __attribute__((noinline, noclone))
62+foo (P *p)
63+{
64+ V a = { 3, 4 };
65+ int i = get_i();
66+ p->b[i] = a;
67+}
68+
69+int
70+main ()
71+{
72+ struct T *t = (struct T *) malloc (128);
73+
74+ foo (&t->s);
75+ check (t);
76+
77+ return 0;
78+}
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0043-cpp.patch b/meta/recipes-devtools/gcc/gcc-4.8/0043-cpp.patch
new file mode 100644
index 0000000000..eaf8646f97
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0043-cpp.patch
@@ -0,0 +1,40 @@
1The OE environment sets and exports CPP as being the target gcc. When building
2gcc-cross-canadian for a mingw targetted sdk, the following can be found in
3build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
4
5configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
6configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5
7configure:3666: $? = 0
8configure:3698: result: no
9configure:3786: checking how to run the C preprocessor
10configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
11configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
12configure:3876: $? = 0
13
14Note this is a *build* target (in build-x86_64-linux) so it should be using
15the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32 headers are
16very different, using the wrong cpp is a real problem. It is leaking into
17configure through the CPP variable. Ultimately this leads to build failures
18related to not being able to include a process.h file for pem-unix.c.
19
20The fix is to ensure we export a sane CPP value into the build environment when
21using build targets. We could define a CPP_FOR_BUILD value which may be the version
22which needs to be upstreamed but for now, this fix is good enough to avoid the
23problem.
24
25RP 22/08/2013
26
27Upstream-Status: Pending
28
29Index: gcc-4.8.1/Makefile.in
30===================================================================
31--- gcc-4.8.1.orig/Makefile.in 2013-03-30 11:25:03.000000000 +0000
32+++ gcc-4.8.1/Makefile.in 2013-08-13 12:03:17.151988882 +0000
33@@ -149,6 +149,7 @@
34 AR="$(AR_FOR_BUILD)"; export AR; \
35 AS="$(AS_FOR_BUILD)"; export AS; \
36 CC="$(CC_FOR_BUILD)"; export CC; \
37+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
38 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
39 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
40 CXX="$(CXX_FOR_BUILD)"; export CXX; \
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0044-gengtypes.patch b/meta/recipes-devtools/gcc/gcc-4.8/0044-gengtypes.patch
new file mode 100644
index 0000000000..e38761d4c9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0044-gengtypes.patch
@@ -0,0 +1,97 @@
1gengtype is generated for both the build system and the target. -DGENERATOR_FILE
2was added in the patch http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00273.html
3and was applied to both versions of gengtype.
4
5Unfortunately the presence of this flag triggers the build configuration (bconfig.h)
6to be included for the target build of gengtype. Compiling gengtype with the target
7compiler and bconfig.h can result in errors if the build and target systems are
8dissimilar. An example case this fails is cross compiling gcc on linux for a darwin
9target system:
10
11In file included from /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c:25:0:
12| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c: In function 'void parse_error(const char*, ...)':
13| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/system.h:93:53: error: 'fputc_unlocked' was not declared in this scope
14| # define fputc(C, Stream) fputc_unlocked (C, Stream)
15
16which occurs since auto-build.h and auto-host.h have differnet values of
17HAVE_FPUTC_UNLOCKED:
18
19#define HAVE_FPUTC_UNLOCKED 1
20/* #undef HAVE_FPUTS_UNLOCKED */
21
22The obvious fix is to only include the flag on build/ targets which this patch does, however
23this also leads to compile errors due to const_tree being undefined but used in double_int.h
24
25I added a GENERATOR_FILE2 flag to workaround those in the
26target case and allow the build to succeed.
27
28Only the build/gengtypes should have the -DGENERATOR_FILE
29
30RP 22/8/2013
31
32Upstream-Status: Pending
33
34Index: gcc-4.8.1/gcc/Makefile.in
35===================================================================
36--- gcc-4.8.1.orig/gcc/Makefile.in 2013-08-19 11:40:36.844014424 +0000
37+++ gcc-4.8.1/gcc/Makefile.in 2013-08-19 11:40:37.784014402 +0000
38@@ -3903,27 +3903,29 @@
39
40 gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
41 gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
42-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
43+CFLAGS-build/gengtype-lex.o += -DGENERATOR_FILE
44 build/gengtype-lex.o: $(BCONFIG_H)
45
46 gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
47 $(SYSTEM_H)
48 gengtype-parse.o: $(CONFIG_H)
49-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
50+CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
51 build/gengtype-parse.o: $(BCONFIG_H)
52
53 gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
54 gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
55 $(XREGEX_H)
56 gengtype-state.o: $(CONFIG_H)
57-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
58+CFLAGS-gengtype-state.o += -DGENERATOR_FILE2
59+CFLAGS-build/gengtype-state.o += -DGENERATOR_FILE
60 build/gengtype-state.o: $(BCONFIG_H)
61
62 gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \
63 rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
64 $(OBSTACK_H) $(XREGEX_H)
65 gengtype.o: $(CONFIG_H)
66-CFLAGS-gengtype.o += -DGENERATOR_FILE
67+CFLAGS-gengtype.o += -DGENERATOR_FILE2
68+CFLAGS-build/gengtype.o += -DGENERATOR_FILE
69 build/gengtype.o: $(BCONFIG_H)
70
71 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
72@@ -3988,7 +3990,7 @@
73 # any system header is included.
74 gengtype-lex.c : gengtype-lex.l
75 -$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
76- echo '#include "bconfig.h"' > $@.tmp; \
77+ echo '' > $@.tmp; \
78 cat $@ >> $@.tmp; \
79 mv $@.tmp $@; \
80 }
81Index: gcc-4.8.1/gcc/double-int.h
82===================================================================
83--- gcc-4.8.1.orig/gcc/double-int.h 2013-01-30 11:04:30.000000000 +0000
84+++ gcc-4.8.1/gcc/double-int.h 2013-08-19 11:41:51.564012719 +0000
85@@ -448,10 +448,12 @@
86
87
88 #ifndef GENERATOR_FILE
89+#ifndef GENERATOR_FILE2
90 /* Conversion to and from GMP integer representations. */
91
92 void mpz_set_double_int (mpz_t, double_int, bool);
93 double_int mpz_get_double_int (const_tree, mpz_t, bool);
94 #endif
95+#endif
96
97 #endif /* DOUBLE_INT_H */
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch b/meta/recipes-devtools/gcc/gcc-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch
new file mode 100644
index 0000000000..96fa1da073
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch
@@ -0,0 +1,21 @@
1This backports fix from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717
2
3Upstream-Status: Backport
4Signed-off-by: Julian Brown <Julian_Brown@mentor.com>
5
6fix for PR57717 (PowerPC E500v2)
7http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00668.html
8
9--- a/gcc/config/rs6000/rs6000.c 2013-05-09 20:54:06.000000000 -0500
10+++ b/gcc/config/rs6000/rs6000.c 2013-08-28 01:25:24.865218744 -0500
11@@ -6337,9 +6337,7 @@
12 && GET_CODE (XEXP (x, 1)) == CONST_INT
13 && reg_offset_p
14 && !SPE_VECTOR_MODE (mode)
15- && !(TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
16- || mode == DDmode || mode == TDmode
17- || mode == DImode))
18+ && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
19 && VECTOR_MEM_NONE_P (mode))
20 {
21 HOST_WIDE_INT val = INTVAL (XEXP (x, 1));
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0046-libatomic-deptracking.patch b/meta/recipes-devtools/gcc/gcc-4.8/0046-libatomic-deptracking.patch
new file mode 100644
index 0000000000..6ea4f42765
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0046-libatomic-deptracking.patch
@@ -0,0 +1,41 @@
1gcc 4.8 won't build with --disable-dependency-tracking since the *.Ppo files
2don't get created unless --enable-dependency-tracking is true.
3
4This patch ensures we only use those compiler options when its enabled.
5
6Upstream-Status: Submitted
7
8(Problem was already reported upstream, attached this patch there
9http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
10
11RP
122012/09/22
13
14Index: gcc-4.8.1/libatomic/Makefile.am
15===================================================================
16--- gcc-4.8.1.orig/libatomic/Makefile.am 2013-01-14 18:16:23.000000000 +0000
17+++ gcc-4.8.1/libatomic/Makefile.am 2013-09-22 10:38:18.904064750 +0000
18@@ -100,7 +100,8 @@
19 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
20 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
21
22-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
23+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
24+@AMDEP_FALSE@M_DEPS =
25 M_SIZE = -DN=$(PAT_N)
26 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
27 M_FILE = $(PAT_BASE)_n.c
28Index: gcc-4.8.1/libatomic/Makefile.in
29===================================================================
30--- gcc-4.8.1.orig/libatomic/Makefile.in 2013-05-31 09:09:26.000000000 +0000
31+++ gcc-4.8.1/libatomic/Makefile.in 2013-09-22 10:40:42.520059917 +0000
32@@ -298,7 +298,8 @@
33 PAT_S = $(word 3,$(PAT_SPLIT))
34 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
35 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
36-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
37+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
38+@AMDEP_FALSE@M_DEPS =
39 M_SIZE = -DN=$(PAT_N)
40 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
41 M_FILE = $(PAT_BASE)_n.c
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0047-repomembug.patch b/meta/recipes-devtools/gcc/gcc-4.8/0047-repomembug.patch
new file mode 100644
index 0000000000..868a4f3a51
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0047-repomembug.patch
@@ -0,0 +1,53 @@
1When compiling a project using -frepo, .rpo files are written alongside
2the .o file, the symbols either have O or C against them. During final linking,
3the objects can be recompiled with some of the entries tweaked/chosen by the
4tlink.c code (visible with TLINK_VERBOSE=3), it does this by changing O -> C
5in the .rpo files.
6
7My tests showed that init_repo (cp/repo.c) was correctly calling
8IDENTIFIER_REPO_CHOSEN against the right identifers and setting the
9chosen bit.
10
11By the time finish_repo() or emit_repo_p() were called, the pointer returned
12by get_identifier() for the symbol marked during init_repo had changed and
13the chosen bit was no longer set. This lead to linking bugs like:
14
15collect: relinking
16collect2: error: '_ZNK6sudoku5ClearINS_8SequenceEEclERS1_' was assigned to 'board.rpo', but was not defined during recompilation, or vice versa
17
18The problem is that the garbage collection is getting called before
19finish_repo() is called and ggc_protect_identifiers is set to false
20so the identifiers are not preserved. They are recreated but the
21chosen bits get wiped out which is why the pointer changes and the
22chosen bit is not set.
23
24The fix is to change ggc_protect_identifiers *after* the finish_repo
25calls are made.
26
27Reproduction is tricky since you need to trigger the garbage collector at
28just the right moment.
29
30RP 2013/10/9
31
32[YOCTO #5133]
33
34Upstream-State: Pending
35
36Index: gcc-4.8.1/gcc/toplev.c
37===================================================================
38--- gcc-4.8.1.orig/gcc/toplev.c 2013-03-28 08:29:51.000000000 +0000
39+++ gcc-4.8.1/gcc/toplev.c 2013-10-09 20:27:17.089228023 +0000
40@@ -551,11 +551,11 @@
41 if (flag_syntax_only || flag_wpa)
42 return;
43
44- ggc_protect_identifiers = false;
45-
46 /* This must also call finalize_compilation_unit. */
47 lang_hooks.decls.final_write_globals ();
48
49+ ggc_protect_identifiers = false;
50+
51 if (seen_error ())
52 return;
53
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/add-install-ptest-to-Makefile.patch b/meta/recipes-devtools/gcc/gcc-4.8/add-install-ptest-to-Makefile.patch
new file mode 100644
index 0000000000..3dedde50db
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/add-install-ptest-to-Makefile.patch
@@ -0,0 +1,162 @@
1Add 'install-ptest' rule.
2
3Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
4Upstream-status: Pending
5---
6diff -uNr a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
7--- a/libstdc++-v3/Makefile.in 2013-07-01 13:01:43.659958328 +0200
8+++ b/libstdc++-v3/Makefile.in 2013-08-23 13:22:41.962029555 +0200
9@@ -710,6 +710,26 @@
10 dvi:
11 install-dvi:
12
13+spath=$(subst /,\/,$(SOURCE_DIR))
14+bpath=$(subst /,\/,$(BUILD_DIR))
15+rpath=$(subst /,\/,$(REPLACE_DIR))
16+install-ptest:
17+ mkdir -p $(DEST_DIR)/gcc/testsuite
18+ mkdir -p $(DEST_DIR)/libstdc++-v3
19+ mkdir -p $(DEST_DIR)/contrib
20+ cp -r $(SOURCE_DIR)/libstdc++-v3/testsuite $(DEST_DIR)/libstdc++-v3
21+ cp $(SOURCE_DIR)/contrib/dg-extract-results.sh $(DEST_DIR)/contrib
22+ cp $(SOURCE_DIR)/gcc/BASE-VER $(DEST_DIR)/gcc
23+ cp -r $(SOURCE_DIR)/gcc/testsuite/lib $(DEST_DIR)/gcc/testsuite
24+ cp -r $(SOURCE_DIR)/libstdc++-v3/scripts $(DEST_DIR)/libstdc++-v3
25+ cp $(BUILD_DIR)/libstdc++-v3/scripts/* $(DEST_DIR)/libstdc++-v3/scripts
26+ cp $(BUILD_DIR)/libstdc++-v3/testsuite/Makefile $(DEST_DIR)/libstdc++-v3/testsuite
27+ cp $(BUILD_DIR)/libstdc++-v3/Makefile $(DEST_DIR)/libstdc++-v3
28+ sed -i -e 's|^Makefile:|_Makefile:|' $(DEST_DIR)/libstdc++-v3/testsuite/Makefile
29+ sed -i -e "s/$(spath)/$(rpath)/g" -e "s/$(bpath)/$(rpath)/g" $(DEST_DIR)/libstdc++-v3/testsuite/Makefile
30+ sed -i -e "s/$(spath)/$(rpath)/g" -e "s/$(bpath)/$(rpath)/g" $(DEST_DIR)/libstdc++-v3/Makefile
31+ sed -i -e 's/RUNTESTDEFAULTFLAGS.=/RUNTESTDEFAULTFLAGS =-a/g' ${DEST_DIR}/libstdc++-v3/testsuite/Makefile
32+
33 # All the machinations with string instantiations messes up the
34 # automake-generated TAGS rule. Make a simple one here.
35 TAGS: tags-recursive $(LISP)
36diff -uNr a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
37--- a/libstdc++-v3/testsuite/Makefile.in 2013-07-05 16:06:08.995480821 +0200
38+++ b/libstdc++-v3/testsuite/Makefile.in 2013-08-26 08:50:04.698546942 +0200
39@@ -478,6 +478,8 @@
40 maintainer-clean-generic mostlyclean mostlyclean-generic \
41 mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
42
43+buildtest-TESTS:
44+ -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) buildtest.exp
45
46 # This rule generates all of the testsuite_files* lists at once.
47 ${lists_of_files}:
48@@ -545,7 +547,7 @@
49
50 # Run the testsuite in normal mode.
51 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
52- AR="$(AR)"; export AR; \
53+ -@(AR="$(AR)"; export AR; \
54 RANLIB="$(RANLIB)"; export RANLIB; \
55 if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
56 && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
57@@ -563,6 +565,7 @@
58 exit 0; \
59 fi; \
60 srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
61+ $(SHELL) command -v g++ >/dev/null 2>&1 || echo "g++ is not installed on your system! Please note that most of the tests need g++."; \
62 EXPECT=$(EXPECT); export EXPECT; \
63 runtest=$(RUNTEST); \
64 if [ -z "$$runtest" ]; then runtest=runtest; fi; \
65@@ -606,7 +609,7 @@
66 $(RUNTESTFLAGS); \
67 fi; \
68 else echo "WARNING: could not find \`runtest'" 1>&2; :;\
69- fi
70+ fi)
71
72 check-am:
73 $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
74diff -uNr a/libstdc++-v3/testsuite/buildtest.exp b/libstdc++-v3/testsuite/buildtest.exp
75--- a/libstdc++-v3/testsuite/buildtest.exp 1970-01-01 01:00:00.000000000 +0100
76+++ b/libstdc++-v3/testsuite/buildtest.exp 2013-08-14 09:25:57.773587133 +0200
77@@ -0,0 +1,33 @@
78+# Copyright (C) 2013 Free Software Foundation, Inc.
79+#
80+# This program is free software; you can redistribute it and/or modify
81+# it under the terms of the GNU General Public License as published by
82+# the Free Software Foundation; either version 3 of the License, or
83+# (at your option) any later version.
84+#
85+# This program is distributed in the hope that it will be useful,
86+# but WITHOUT ANY WARRANTY; without even the implied warranty of
87+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88+# GNU General Public License for more details.
89+#
90+# You should have received a copy of the GNU General Public License
91+# along with this program; see the file COPYING3. If not see
92+# <http://www.gnu.org/licenses/>.
93+
94+# If there is no baseline file, or we can't find the library, skip
95+# this test. Or, hey, if we don't support this kind of symbol
96+# versioning test: don't run it.
97+
98+
99+set baseline_subdir "[eval exec $cxx $baseline_subdir_switch]"
100+
101+# Build the support objects.
102+v3-build_support
103+
104+# Build the abi_check program.
105+if { [v3_target_compile "$srcdir/util/testsuite_abi_check.cc" "abi_check" \
106+ "executable" [list "additional_flags=-w"]] != "" } {
107+ error "could not compile testsuite_abi_check.cc"
108+}
109+
110+
111diff -uNr a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp
112--- a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp 2013-08-09 10:02:56.769743266 +0200
113+++ b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp 2013-08-14 09:27:15.722299887 +0200
114@@ -24,11 +24,6 @@
115 set lib $blddir/src/.libs/libstdc++.so
116 }
117
118-set baseline_subdir "[eval exec $cxx $baseline_subdir_switch]"
119-
120-# Build the support objects.
121-v3-build_support
122-
123 if { (${v3-symver} == 0) || ![info exists baseline_dir] \
124 || ![file exists $baseline_dir] \
125 || ![file exists $lib] } {
126@@ -50,12 +45,6 @@
127 remote_exec "build" "$objdir/../scripts/extract_symvers" \
128 [list $lib "current_symbols.txt"]
129
130-# Build the abi_check program.
131-if { [v3_target_compile "$srcdir/util/testsuite_abi_check.cc" "abi_check" \
132- "executable" [list "additional_flags=-w"]] != "" } {
133- error "could not compile testsuite_abi_check.cc"
134-}
135-
136 remote_download "target" $baseline_file "baseline_symbols.txt"
137 remote_download "target" "current_symbols.txt" "current_symbols.txt"
138 set result [${tool}_load "./abi_check" \
139diff -uNr a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp
140--- a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp 2013-08-09 13:06:20.795174486 +0200
141+++ b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp 2013-08-23 13:25:31.290856664 +0200
142@@ -21,9 +21,6 @@
143 # Initialization.
144 dg-init
145
146-# Build the support objects.
147-v3-build_support
148-
149 set tests [list]
150
151 # If there is a "testsuite_files" file, use it.
152diff -uNr a/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp b/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp
153--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp 2013-08-09 13:08:17.946244225 +0200
154+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp 2013-08-09 13:31:19.812003255 +0200
155@@ -17,7 +17,6 @@
156 load_lib gdb-test.exp
157
158 dg-init
159-v3-build_support
160
161 global GDB
162 if ![info exists ::env(GUALITY_GDB_NAME)] {
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/run-ptest b/meta/recipes-devtools/gcc/gcc-4.8/run-ptest
new file mode 100644
index 0000000000..36eccc30c7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/run-ptest
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3make -C libstdc++-v3/testsuite -i check | sed -e 's/ERROR/FAIL/' -e 's/XFAIL/PASS/' -e 's/XPASS/FAIL/' -e 's/UNRESOLVED/SKIP/' -e 's/UNTESTED/SKIP/' -e 's/UNSUPPORTED/SKIP/'
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
new file mode 100644
index 0000000000..75fd206d32
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -0,0 +1,123 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5
6NATIVEDEPS = ""
7
8inherit autotools gettext ptest
9
10def get_gcc_fpu_setting(bb, d):
11 if d.getVar('ARMPKGSFX_EABI', True) == "hf" and d.getVar('TRANSLATED_TARGET_ARCH', True) == "arm":
12 return "--with-float=hard"
13 if d.getVar('TARGET_FPU', True) in [ 'soft' ]:
14 return "--with-float=soft"
15 if d.getVar('TARGET_FPU', True) in [ 'ppc-efd' ]:
16 return "--enable-e500_double"
17 return ""
18
19get_gcc_fpu_setting[vardepvalue] = "${@get_gcc_fpu_setting(bb, d)}"
20
21def get_gcc_mips_plt_setting(bb, d):
22 if d.getVar('TRANSLATED_TARGET_ARCH', True) in [ 'mips', 'mipsel' ] and 'mplt' in d.getVar('DISTRO_FEATURES',1).split() :
23 return "--with-mips-plt"
24 return ""
25
26def get_gcc_multiarch_setting(bb, d):
27 target_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
28 multiarch_options = {
29 "i586": "--enable-targets=all",
30 "powerpc": "--enable-targets=powerpc64",
31 "sparc": "--enable-targets=all",
32 }
33
34 if 'multiarch' in d.getVar('DISTRO_FEATURES', True).split() :
35 if target_arch in multiarch_options :
36 return multiarch_options[target_arch]
37 return ""
38
39# this is used by the multilib setup of gcc
40def get_tune_parameters(tune, d):
41 availtunes = d.getVar('AVAILTUNES', True)
42 if tune not in availtunes.split():
43 bb.error('The tune: %s is not one of the available tunes: %s', tune or None, availtunes)
44
45 localdata = bb.data.createCopy(d)
46 override = ':tune-' + tune
47 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
48 bb.data.update_data(localdata)
49
50 retdict = {}
51 retdict['tune'] = tune
52 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS', True)
53 retdict['features'] = localdata.getVar('TUNE_FEATURES', True)
54 # BASELIB is used by the multilib code to change library paths
55 retdict['baselib'] = localdata.getVar('BASE_LIB', True) or localdata.getVar('BASELIB', True)
56 retdict['arch'] = localdata.getVar('TUNE_ARCH', True)
57 retdict['abiextension'] = localdata.getVar('ABIEXTENSION', True)
58 retdict['target_fpu'] = localdata.getVar('TARGET_FPU', True)
59 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH', True)
60 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS', True)
61 return retdict
62
63get_tune_parameters[vardepsexclude] = "AVAILTUNES"
64
65DEBIANNAME_${MLPREFIX}libgcc = "libgcc1"
66
67MIRRORS =+ "\
68${GNU_MIRROR}/gcc ftp://gcc.gnu.org/pub/gcc/releases/ \n \
69${GNU_MIRROR}/gcc ftp://gd.tuwien.ac.at/gnu/gcc/ \n \
70${GNU_MIRROR}/gcc http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
71${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
72${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
73"
74
75#
76# Set some default values
77#
78gcclibdir = "${libdir}/gcc"
79BINV = "${PV}"
80#S = "${WORKDIR}/gcc-${PV}"
81S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
82B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
83
84# SS means Shared Stamps directory
85SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}-${PR}"
86do_fetch[stamp-base] = "${SS}"
87do_unpack[stamp-base] = "${SS}"
88do_patch[stamp-base] = "${SS}"
89SSCLEAN = "${TMPDIR}/stamps/work-shared/gcc-[0-9]*-*"
90do_fetch[stamp-base-clean] = "${SSCLEAN}"
91do_unpack[stamp-base-clean] = "${SSCLEAN}"
92do_patch[stamp-base-clean] = "${SSCLEAN}"
93
94# SW means Shared Work directory
95SW = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
96WORKDIR_task-unpack = "${SW}"
97WORKDIR_task-patch = "${SW}"
98
99target_includedir ?= "${includedir}"
100target_libdir ?= "${libdir}"
101target_base_libdir ?= "${base_libdir}"
102target_prefix ?= "${prefix}"
103
104CLEANFUNCS += "workshared_clean"
105# The do_clean should be exclusive since share ${S}
106do_clean[lockfiles] = "${SW}.clean.lock"
107
108python workshared_clean () {
109 """clear the source directory"""
110 dir = d.expand("${SW}")
111 bb.note("Removing " + dir)
112 oe.path.remove(dir)
113
114 """clear the the stamps in work-shared"""
115 dir = "%s.*" % bb.data.expand(d.getVarFlag('do_fetch', 'stamp-base', True), d)
116 bb.note("Removing " + dir)
117 oe.path.remove(dir)
118}
119
120# We need to ensure that for the shared work directory, the do_patch singatures match
121# The real WORKDIR location isn't a dependency for the shared workdir.
122src_patches[vardepsexclude] = "WORKDIR"
123should_apply[vardepsexclude] += "PN"
diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
new file mode 100644
index 0000000000..dc44cc9f08
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -0,0 +1,133 @@
1require gcc-multilib-config.inc
2#
3# Build the list of lanaguages to build.
4#
5# These can be overridden by the version specific .inc file.
6
7# Java (gcj doesn't work on all architectures)
8JAVA ?= ",java"
9JAVA_arm ?= ""
10JAVA_armeb ?= ""
11JAVA_mipsel ?= ""
12JAVA_sh3 ?= ""
13# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
14FORTRAN ?= ",f77"
15LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
16# disable --enable-target-optspace for powerpc SPE
17# at -Os libgcc.so.1 creates references into
18# hidden symbols in libgcc.a which linker complains
19# when linking shared libraries further in the build like (gnutls)
20
21SPECIAL_ARCH_LIST = "powerpc"
22OPTSPACE = '${@base_contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)}'
23
24EXTRA_OECONF_BASE ?= ""
25EXTRA_OECONF_PATHS ?= ""
26EXTRA_OECONF_INITIAL ?= ""
27EXTRA_OECONF_INTERMEDIATE ?= ""
28
29GCCMULTILIB ?= "--disable-multilib"
30GCCTHREADS ?= "posix"
31
32EXTRA_OECONF = "${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \
33 --with-gnu-ld \
34 --enable-shared \
35 --enable-languages=${LANGUAGES} \
36 --enable-threads=${GCCTHREADS} \
37 ${GCCMULTILIB} \
38 --enable-c99 \
39 --enable-long-long \
40 --enable-symvers=gnu \
41 --enable-libstdcxx-pch \
42 --program-prefix=${TARGET_PREFIX} \
43 --without-local-prefix \
44 ${OPTSPACE} \
45 ${EXTRA_OECONF_BASE} \
46 ${EXTRA_OECONF_FPU} \
47 ${EXTRA_OECONF_PATHS} \
48 ${@get_gcc_mips_plt_setting(bb, d)} \
49 ${@get_gcc_multiarch_setting(bb, d)}"
50
51export ac_cv_path_SED = 'sed'
52export gcc_cv_collect2_libs = 'none required'
53# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
54# in the config.log files (which might not get generated until do_compile
55# hence being missed by the insane do_configure check).
56
57# Build uclibc compilers without cxa_atexit support
58EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
59EXTRA_OECONF_append_libc-uclibc = " --enable-__cxa_atexit"
60
61EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
62EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
63
64EXTRA_OECONF_FPU = "${@get_gcc_fpu_setting(bb, d)}"
65CPPFLAGS = ""
66
67# powerpc needs this to comply with the ABI
68EXTRA_OECONF_append_powerpc = " --with-long-double-128"
69EXTRA_OECONF_append_powerpc64 = " --with-long-double-128"
70
71# Used by configure to define additional values for FLAGS_FOR_TARGET -
72# passed to all the compilers.
73ARCH_FLAGS_FOR_TARGET = "${TARGET_CC_ARCH}"
74EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
75
76SYSTEMHEADERS = "${target_includedir}"
77SYSTEMLIBS = "${target_base_libdir}/"
78SYSTEMLIBS1 = "${target_libdir}/"
79
80do_configure_prepend () {
81 # teach gcc to find correct target includedir when checking libc ssp support
82 mkdir -p ${B}/gcc
83 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
84 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
85 cat >>${B}/gcc/defaults.h.new <<_EOF
86#ifndef STANDARD_INCLUDE_DIR
87#define STANDARD_INCLUDE_DIR "${SYSTEMHEADERS}"
88#endif
89#ifndef STANDARD_STARTFILE_PREFIX_1
90#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
91#endif
92#ifndef STANDARD_STARTFILE_PREFIX_2
93#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
94#endif
95#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
96#endif /* ! GCC_DEFAULTS_H */
97_EOF
98 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
99}
100
101do_configure () {
102 # Setup these vars for cross building only
103 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
104 # gcc build stuff when the build is producing a cross compiler - i.e.
105 # when the 'current' target is the 'host' system, and the host is not
106 # the target (because the build is actually making a cross compiler!)
107 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
108 export CC_FOR_TARGET="${CC}"
109 export GCC_FOR_TARGET="${CC}"
110 export CXX_FOR_TARGET="${CXX}"
111 export AS_FOR_TARGET="${HOST_PREFIX}as"
112 export LD_FOR_TARGET="${HOST_PREFIX}ld"
113 export NM_FOR_TARGET="${HOST_PREFIX}nm"
114 export AR_FOR_TARGET="${HOST_PREFIX}ar"
115 export GFORTRAN_FOR_TARGET="gfortran"
116 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
117 fi
118 export CC_FOR_BUILD="${BUILD_CC}"
119 export CXX_FOR_BUILD="${BUILD_CXX}"
120 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
121 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
122 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
123 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
124 export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
125 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
126 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
127 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
128 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
129 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
130
131 oe_runconf
132}
133
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
new file mode 100644
index 0000000000..64bb6ba722
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -0,0 +1,156 @@
1inherit cross-canadian
2
3DESCRIPTION = "The cross-canadian GNU cc and gcc C compilers for ${TARGET_ARCH} target."
4PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
5BPN = "gcc"
6
7DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext"
8
9GCCMULTILIB = "--enable-multilib"
10
11require gcc-configure-common.inc
12
13EXTRA_OECONF_PATHS = "--with-gxx-include-dir=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}${target_includedir}/c++ \
14 --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
15 --with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
16 --with-build-sysroot=${STAGING_DIR_TARGET}"
17# We have to point gcc at a sysroot but we don't need to rebuild if this changes
18# e.g. we switch between different machines with different tunes.
19EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH"
20TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
21get_gcc_fpu_setting[vardepvalue] = ""
22
23#
24# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
25# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
26#
27export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
28export AS_FOR_TARGET = "${TARGET_PREFIX}as"
29export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
30export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
31export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
32export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
33export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
34export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
35export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
36export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
37export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
38export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
39
40#
41# We need to override this and make sure the compiler can find staging
42#
43export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
44
45do_configure () {
46 export CC_FOR_BUILD="${BUILD_CC}"
47 export CXX_FOR_BUILD="${BUILD_CXX}"
48 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
49 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
50 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
51 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
52 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
53 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
54 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
55 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
56 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
57 oe_runconf
58}
59
60do_compile () {
61 oe_runmake all-host
62}
63
64INHIBIT_PACKAGE_STRIP = "1"
65
66# Having anything auto depending on gcc-cross-sdk is a really bad idea...
67EXCLUDE_FROM_SHLIBS = "1"
68
69PACKAGES = "${PN} ${PN}-doc"
70
71FILES_${PN} = "\
72 ${bindir}/* \
73 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
74 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
75 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
76 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
77 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
78 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
79 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
80 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
81 ${includedir}/c++/${BINV} \
82 ${prefix}/${TARGET_SYS}/bin/* \
83 ${prefix}/${TARGET_SYS}/lib/* \
84 ${prefix}/${TARGET_SYS}/usr/include/* \
85 "
86INSANE_SKIP_${PN} += "dev-so"
87
88FILES_${PN}-doc = "\
89 ${infodir} \
90 ${mandir} \
91 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
92 "
93
94EXEEXT = ""
95
96# Compute how to get from libexecdir to bindir in python (easier than shell)
97BINRELPATH = "${@oe.path.relative(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${bindir}"))}"
98
99do_install () {
100 oe_runmake 'DESTDIR=${D}' install-host
101
102 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
103 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
104 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
105
106 # We care about g++ not c++
107 rm -f ${D}${bindir}/*c++
108
109 # We don't care about the gcc-<version> copies
110 rm -f ${D}${bindir}/*gcc-?.?*
111
112 # We use libiberty from binutils
113 rm -f ${D}${prefix}/${TARGET_SYS}/lib/libiberty.a
114 # Not sure where the strange paths come from
115 rm -f ${D}${libdir}/../lib/libiberty.a
116 rm -f ${D}${libdir}/libiberty.a
117
118 # Cleanup empty directories which are not shipped
119 # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
120 # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
121 local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
122 for i in $empty_dirs; do
123 [ -d $i ] && rmdir --ignore-fail-on-non-empty $i
124 done
125
126 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
127 # found.
128 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
129 install -d $dest
130 suffix=${EXEEXT}
131 for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
132 if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then
133 continue
134 fi
135
136 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix
137 done
138
139 chown -R root:root ${D}
140}
141
142ELFUTILS = "nativesdk-elfutils"
143DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib"
144RDEPENDS_${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}"
145
146SYSTEMHEADERS = "/usr/include"
147SYSTEMLIBS = "${target_base_libdir}/"
148SYSTEMLIBS1 = "${target_libdir}/"
149
150EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
151 --disable-libgomp --disable-libmudflap \
152 --with-mpfr=${STAGING_DIR_HOST}${layout_exec_prefix} \
153 --with-mpc=${STAGING_DIR_HOST}${layout_exec_prefix}"
154
155# gcc 4.7 needs -isystem
156export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb
new file mode 100644
index 0000000000..a87c804ef7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.7.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross-canadian.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.8.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.8.bb
new file mode 100644
index 0000000000..a87c804ef7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.8.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross-canadian.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial.inc b/meta/recipes-devtools/gcc/gcc-cross-initial.inc
new file mode 100644
index 0000000000..81845386f9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial.inc
@@ -0,0 +1,81 @@
1DEPENDS = "virtual/${TARGET_PREFIX}binutils ${NATIVEDEPS}"
2PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
3PACKAGES = ""
4
5INHIBIT_AUTOTOOLS_DEPS = "1"
6INHIBIT_DEFAULT_DEPS = "1"
7
8CROSS_TARGET_SYS_DIR_append = ".${PN}"
9
10# This is intended to be a -very- basic config
11# sysroot is needed in case we use libc-initial
12EXTRA_OECONF = "--with-newlib \
13 --without-headers \
14 --disable-shared \
15 --disable-threads \
16 --disable-multilib \
17 --disable-__cxa_atexit \
18 --enable-languages=c \
19 ${OPTSPACE} \
20 --program-prefix=${TARGET_PREFIX} \
21 --with-sysroot=${STAGING_DIR_TARGET} \
22 --with-build-sysroot=${GCCCROSS_BUILDSYSROOT} \
23 ${EXTRA_OECONF_INITIAL} \
24 ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--with-ld=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld.bfd', '', d)} \
25 ${EXTRA_OECONF_FPU}"
26
27EXTRA_OECONF += " --with-native-system-header-dir=${SYSTEMHEADERS} "
28
29GCCCROSS_BUILDSYSROOT = "${B}/tmpsysroot"
30
31do_configure_prepend () {
32 sysr=${GCCCROSS_BUILDSYSROOT}${target_includedir}
33 mkdir -p $sysr
34 for t in linux asm asm-generic; do
35 rm -f $sysr/$t
36 ln -s ${STAGING_DIR_TARGET}${target_includedir}/$t $sysr/
37 done
38}
39
40do_compile () {
41 oe_runmake all-gcc all-target-libgcc
42}
43do_install () {
44 oe_runmake 'DESTDIR=${D}' install-gcc install-target-libgcc
45
46 # We don't really need this (here shares/ contains man/, info/, locale/).
47 rm -rf ${D}${datadir}/
48
49 # We use libiberty from binutils
50 find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
51 find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
52
53 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
54 # found. These need to be relative paths so they work in different locations.
55 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
56 install -d $dest
57 for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
58 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
59 done
60 # fixed limits.h infact includes the so called real limits.h
61 # which should come from libc but when we build libc-initial
62 # then bunch of configure tests include fixed limits.h which in turn
63 # includes real limits.h but this real limits.h is not staged yet
64 # so we overwirte the generated include-fixed/limits.h for gcc-cross-initial
65 # to get rid references to real limits.h
66 cp gcc/include-fixed/limits.h ${D}${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed/limits.h
67}
68#
69# Override the default sysroot staging copy since this won't look like a target system
70#
71sysroot_stage_all() {
72 sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
73 install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/
74 install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/
75 mv ${SYSROOT_DESTDIR}${target_base_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/ || true
76 mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true
77}
78
79do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST}/ ${SYSROOT_DESTDIR}/${STAGING_DIR_TARGET}/${target_base_libdir}/"
80do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST}/ ${STAGING_DIR_TCBOOTSTRAP}/${target_base_libdir}/"
81
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.7.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.7.bb
new file mode 100644
index 0000000000..4c73e5ce61
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.7.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.8.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.8.bb
new file mode 100644
index 0000000000..4c73e5ce61
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.8.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
new file mode 100644
index 0000000000..25a3142261
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -0,0 +1,185 @@
1inherit cross
2
3INHIBIT_DEFAULT_DEPS = "1"
4EXTRADEPENDS = ""
5DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc ${EXTRADEPENDS} ${NATIVEDEPS}"
6PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
7python () {
8 if d.getVar("TARGET_OS", True).startswith("linux"):
9 d.setVar("EXTRADEPENDS", "linux-libc-headers")
10}
11
12require gcc-configure-common.inc
13
14EXTRA_OECONF += " --enable-poison-system-directories"
15EXTRA_OECONF_append_sh4 = " --with-multilib-list= --enable-incomplete-targets "
16
17EXTRA_OECONF += "--disable-libunwind-exceptions \
18 --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \
19 --with-system-zlib "
20
21EXTRA_OECONF_PATHS = " \
22 --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
23 --with-sysroot=${STAGING_DIR_TARGET} \
24 --with-build-sysroot=${STAGING_DIR_TARGET}"
25
26ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
27
28do_configure_prepend () {
29 sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure
30}
31
32do_compile () {
33 export CC="${BUILD_CC}"
34 export AR_FOR_TARGET="${TARGET_SYS}-ar"
35 export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
36 export LD_FOR_TARGET="${TARGET_SYS}-ld"
37 export NM_FOR_TARGET="${TARGET_SYS}-nm"
38 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
39 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
40 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
41 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
42 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
43
44 oe_runmake all-host all-target-libgcc
45 # now generate script to drive testing
46 echo "#!/usr/bin/env sh" >${B}/${TARGET_PREFIX}testgcc
47 set >> ${B}/${TARGET_PREFIX}testgcc
48 # prune out the unneeded vars
49 sed -i -e "/^BASH/d" ${B}/${TARGET_PREFIX}testgcc
50 sed -i -e "/^USER/d" ${B}/${TARGET_PREFIX}testgcc
51 sed -i -e "/^OPT/d" ${B}/${TARGET_PREFIX}testgcc
52 sed -i -e "/^DIRSTACK/d" ${B}/${TARGET_PREFIX}testgcc
53 sed -i -e "/^EUID/d" ${B}/${TARGET_PREFIX}testgcc
54 sed -i -e "/^FUNCNAME/d" ${B}/${TARGET_PREFIX}testgcc
55 sed -i -e "/^GROUPS/d" ${B}/${TARGET_PREFIX}testgcc
56 sed -i -e "/^HOST/d" ${B}/${TARGET_PREFIX}testgcc
57 sed -i -e "/^HOME/d" ${B}/${TARGET_PREFIX}testgcc
58 sed -i -e "/^IFS/d" ${B}/${TARGET_PREFIX}testgcc
59 sed -i -e "/^LC_ALL/d" ${B}/${TARGET_PREFIX}testgcc
60 sed -i -e "/^LOGNAME/d" ${B}/${TARGET_PREFIX}testgcc
61 sed -i -e "/^MACHTYPE/d" ${B}/${TARGET_PREFIX}testgcc
62 sed -i -e "/^OSTYPE/d" ${B}/${TARGET_PREFIX}testgcc
63 sed -i -e "/^PIPE/d" ${B}/${TARGET_PREFIX}testgcc
64 sed -i -e "/^SHELL/d" ${B}/${TARGET_PREFIX}testgcc
65 sed -i -e "/^'/d" ${B}/${TARGET_PREFIX}testgcc
66 sed -i -e "/^UID/d" ${B}/${TARGET_PREFIX}testgcc
67 sed -i -e "/^TERM/d" ${B}/${TARGET_PREFIX}testgcc
68 sed -i -e "/^PATCH_GET/d" ${B}/${TARGET_PREFIX}testgcc
69 sed -i -e "/^PKG_/d" ${B}/${TARGET_PREFIX}testgcc
70 sed -i -e "/^POSIXLY_/d" ${B}/${TARGET_PREFIX}testgcc
71 sed -i -e "/^PPID/d" ${B}/${TARGET_PREFIX}testgcc
72 sed -i -e "/^PS4/d" ${B}/${TARGET_PREFIX}testgcc
73 sed -i -e "/^Q/d" ${B}/${TARGET_PREFIX}testgcc
74 sed -i -e "/^SHLVL/d" ${B}/${TARGET_PREFIX}testgcc
75 sed -i -e "/^STAGING/d" ${B}/${TARGET_PREFIX}testgcc
76 sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${TARGET_PREFIX}testgcc
77 sed -i -e "/^PSEUDO/d" ${B}/${TARGET_PREFIX}testgcc
78
79 # append execution part of the script
80cat >> ${B}/${TARGET_PREFIX}testgcc << STOP
81target="\$1"
82usage () {
83 echo "Usage:"
84 echo "\$0 user@target 'extra options to dejagnu'"
85 echo "\$0 target 'extra options to dejagnu'"
86 echo "\$0 target"
87 echo "e.g. \$0 192.168.7.2 ' dg.exp=visibility-d.c'"
88 echo "will only run visibility-d.c test case"
89 echo "e.g. \$0 192.168.7.2 '/-mthumb dg.exp=visibility-d.c'"
90 echo "will only run visibility-d.c test case in thumb mode"
91 echo "You need to have dejagnu autogen expect installed"
92 echo "on the build host"
93 }
94if [ "x\$target" = "x" ]
95then
96 echo "Please specify the target machine and remote user in form of user@target\n"
97 usage
98 exit 1;
99fi
100
101shift
102
103echo "\$target" | grep "@" 2>&1 > /dev/null
104if [ "x\$?" = "x0" ]
105then
106 user=\$(echo \$target | cut -d '@' -f 1)
107 target=\$(echo \$target | cut -d '@' -f 2)
108else
109 user=\$USER
110fi
111ssh \$user@\$target date 2>&1 > /dev/null
112if [ "x\$?" != "x0" ]
113then
114 echo "Failed connecting to \$user@\$target it could be because"
115 echo "you don't have passwordless ssh setup to access \$target"
116 echo "or sometimes host key has been changed"
117 echo "in such case do something like below on build host"
118 echo "ssh-keygen -f "~/.ssh/known_hosts" -R \$target"
119 echo "and then try ssh \$user@\$target"
120
121 usage
122 exit 1
123fi
124 echo "lappend boards_dir [pwd]/../../.." > ${B}/site.exp
125 echo "load_generic_config \"unix\"" > ${B}/${PACKAGE_ARCH}.exp
126 echo "set_board_info username \$user" >> ${B}/${PACKAGE_ARCH}.exp
127 echo "set_board_info rsh_prog ssh" >> ${B}/${PACKAGE_ARCH}.exp
128 echo "set_board_info rcp_prog scp" >> ${B}/${PACKAGE_ARCH}.exp
129 echo "set_board_info hostname \$target" >> ${B}/${PACKAGE_ARCH}.exp
130 DEJAGNU=${B}/site.exp make -k check RUNTESTFLAGS="--target_board=${PACKAGE_ARCH}\$@"
131
132STOP
133
134 chmod +x ${B}/${TARGET_PREFIX}testgcc
135
136}
137
138INHIBIT_PACKAGE_STRIP = "1"
139
140# Compute how to get from libexecdir to bindir in python (easier than shell)
141BINRELPATH = "${@oe.path.relative(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${MULTIMACH_TARGET_SYS}"))}"
142
143do_install () {
144 oe_runmake 'DESTDIR=${D}' install-host
145
146 install -d ${D}${target_base_libdir}
147 install -d ${D}${target_libdir}
148
149 # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
150 # gfortran is fully backwards compatible. This is a safe and practical solution.
151 ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
152
153
154 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
155 # found. These need to be relative paths so they work in different locations.
156 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
157 install -d $dest
158 for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
159 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
160 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
161 done
162
163 # Remove things we don't need but keep share/java
164 for d in info man share/doc share/locale share/man share/info; do
165 rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d
166 done
167
168 # We use libiberty from binutils
169 find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
170 find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
171
172 # gcc-runtime installs libgcc into a special location in staging since it breaks doing a standalone build
173 case ${PN} in
174 *gcc-cross|*gcc-crosssdk)
175 dest=${D}/${includedir}/gcc-build-internal-${MULTIMACH_TARGET_SYS}
176 cp -fpPR . $dest
177 ;;
178 esac
179}
180
181do_package[noexec] = "1"
182do_packagedata[noexec] = "1"
183do_package_write_ipk[noexec] = "1"
184do_package_write_rpm[noexec] = "1"
185do_package_write_deb[noexec] = "1"
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.7.bb b/meta/recipes-devtools/gcc/gcc-cross_4.7.bb
new file mode 100644
index 0000000000..b43cca0c52
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross_4.7.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.8.bb b/meta/recipes-devtools/gcc/gcc-cross_4.8.bb
new file mode 100644
index 0000000000..b43cca0c52
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross_4.8.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial.inc b/meta/recipes-devtools/gcc/gcc-crosssdk-initial.inc
new file mode 100644
index 0000000000..c6f74a6445
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial.inc
@@ -0,0 +1,8 @@
1inherit crosssdk
2
3SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
4SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
5SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
6
7DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk gettext-native ${NATIVEDEPS}"
8PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial-crosssdk"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.7.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.7.bb
new file mode 100644
index 0000000000..fd90e1140f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.7.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-cross-initial_${PV}.bb
2require gcc-crosssdk-initial.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.8.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.8.bb
new file mode 100644
index 0000000000..fd90e1140f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.8.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-cross-initial_${PV}.bb
2require gcc-crosssdk-initial.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk.inc b/meta/recipes-devtools/gcc/gcc-crosssdk.inc
new file mode 100644
index 0000000000..467a3f5d43
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk.inc
@@ -0,0 +1,10 @@
1inherit crosssdk
2
3SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
4SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
5SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
6
7GCCMULTILIB = "--disable-multilib"
8
9DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk virtual/nativesdk-${TARGET_PREFIX}libc-for-gcc gettext-native"
10PROVIDES = "virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb
new file mode 100644
index 0000000000..40a6c4feff
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk_4.7.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_4.8.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_4.8.bb
new file mode 100644
index 0000000000..40a6c4feff
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk_4.8.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta/recipes-devtools/gcc/gcc-multilib-config.inc b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
new file mode 100644
index 0000000000..005aa6b814
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
@@ -0,0 +1,191 @@
1# following code modifies these definitions in the gcc config
2# MULTILIB_OPTIONS
3# MULTILIB_DIRNAMES
4# MULTILIB_OSDIRNAMES
5# GLIBC_DYNAMIC_LINKER32
6# GLIBC_DYNAMIC_LINKER64
7# GLIBC_DYNAMIC_LINKERX32
8# GLIBC_DYNAMIC_LINKERN32
9# For more information on use of these variables look at these files in the gcc source code
10# gcc/config/i386/t-linux64
11# gcc/config/mips/t-linux64
12# gcc/config/rs6000/t-linux64
13# gcc/config/i386/linux64.h
14# gcc/config/mips/linux64.h
15# gcc/config/rs6000/linux64.h
16
17python gcc_multilib_setup() {
18 import re
19 import shutil
20 import glob
21
22 srcdir = d.getVar('S', True)
23 builddir = d.getVar('B', True)
24 src_conf_dir = '%s/gcc/config' % srcdir
25 build_conf_dir = '%s/gcc/config' % builddir
26
27 bb.utils.remove(build_conf_dir, True)
28 ml_globs = ('%s/*/t-linux64' % src_conf_dir,
29 '%s/*/linux64.h' % src_conf_dir)
30
31 # copy the target multilib config files to ${B}
32 for ml_glob in ml_globs:
33 for fn in glob.glob(ml_glob):
34 rel_path = os.path.relpath(fn, src_conf_dir)
35 parent_dir = os.path.dirname(rel_path)
36 bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
37 bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
38
39 multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split()
40 if not multilibs:
41 return
42
43 mlprefix = d.getVar('MLPREFIX', True)
44 pn = d.getVar('PN', True)
45 if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')):
46 return
47
48
49 def write_config(root, files, options, dirnames, osdirnames):
50 for ml_conf_file in files:
51 with open(root + '/' + ml_conf_file, 'r') as f:
52 filelines = f.readlines()
53 # recreate multilib configuration variables
54 substs = [
55 (r'^(\s*(MULTILIB_OPTIONS\s*=).*)$', r'\2 %s' % '/'.join(options)),
56 (r'^(\s*MULTILIB_OPTIONS\s*\+=.*)$', ''),
57 (r'^(\s*(MULTILIB_DIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(dirnames)),
58 (r'^(\s*MULTILIB_DIRNAMES\s*\+=.*)$', ''),
59 (r'^(\s*(MULTILIB_OSDIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(osdirnames)),
60 (r'^(\s*MULTILIB_OSDIRNAMES\s*\+=.*)$', ''),
61 ]
62
63 for (i, line) in enumerate(filelines):
64 for subst in substs:
65 line = re.sub(subst[0], subst[1], line)
66 filelines[i] = line
67
68 with open(root + '/' + ml_conf_file, 'w') as f:
69 f.write(''.join(filelines))
70
71 def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32):
72 def wrap_libdir(libdir):
73 if libdir.find('SYSTEMLIBS_DIR') != -1:
74 return libdir
75 else:
76 return '"/%s/"' % libdir
77
78 for ml_conf_file in files:
79 with open(root + '/' + ml_conf_file, 'r') as f:
80 filelines = f.readlines()
81
82 # replace lines like
83 # #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
84 # by
85 # #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2"
86 # this is needed to put the correct dynamic loader path in the generated binaries
87 substs = [
88 (r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
89 r'\1' + wrap_libdir(libdir32) + r'\3'),
90 (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
91 r'\1' + wrap_libdir(libdir64) + r'\3'),
92 (r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
93 r'\1' + wrap_libdir(libdirx32) + r'\3'),
94 (r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
95 r'\1' + wrap_libdir(libdirn32) + r'\3'),
96 ]
97
98 for (i, line) in enumerate(filelines):
99 for subst in substs:
100 line = re.sub(subst[0], subst[1], line)
101 filelines[i] = line
102
103 with open(root + '/' + ml_conf_file, 'w') as f:
104 f.write(''.join(filelines))
105
106
107 gcc_target_config_files = {
108 'x86_64' : ['gcc/config/i386/t-linux64'],
109 'i586' : ['gcc/config/i386/t-linux64'],
110 'mips' : ['gcc/config/mips/t-linux64'],
111 'powerpc' : ['gcc/config/rs6000/t-linux64'],
112 }
113
114 gcc_header_config_files = {
115 'x86_64' : ['gcc/config/i386/linux64.h'],
116 'i586' : ['gcc/config/i386/linux64.h'],
117 'mips' : ['gcc/config/mips/linux64.h'],
118 'powerpc' : ['gcc/config/rs6000/linux64.h'],
119 }
120
121 target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix
122 else d.getVar('TARGET_ARCH', True))
123 if target_arch not in gcc_target_config_files:
124 bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
125 return
126
127 libdir32 = 'SYSTEMLIBS_DIR'
128 libdir64 = 'SYSTEMLIBS_DIR'
129 libdirx32 = 'SYSTEMLIBS_DIR'
130 libdirn32 = 'SYSTEMLIBS_DIR'
131
132 target_config_files = gcc_target_config_files[target_arch]
133 header_config_files = gcc_header_config_files[target_arch]
134
135 ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlprefix else 'DEFAULTTUNE']
136 mltunes = [('DEFAULTTUNE_virtclass-multilib-%s' % ml) for ml in multilibs]
137 if mlprefix:
138 mlindex = 0
139 for ml in multilibs:
140 if mlprefix.startswith(ml):
141 break
142 mlindex += 1
143
144 ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):])
145 else:
146 ml_list.extend(mltunes)
147
148 options = []
149 dirnames = []
150 osdirnames = []
151
152 for ml in ml_list:
153 tune = d.getVar(ml, True)
154 if not tune:
155 bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml)
156 continue
157 tune_parameters = get_tune_parameters(tune, d)
158
159 tune_baselib = tune_parameters['baselib']
160 if not tune_baselib:
161 bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
162 continue
163
164 if tune_baselib == 'lib64':
165 libdir64 = tune_baselib
166 elif tune_baselib == 'libx32':
167 libdirx32 = tune_baselib
168 elif tune_baselib == 'lib32':
169 libdirn32 = tune_baselib
170 elif tune_baselib == 'lib':
171 libdir32 = tune_baselib
172 else:
173 bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune))
174
175 # take out '-' and march='s from parameters
176 options.append(re.sub(r'march=[^ ]+ *', '',
177 re.sub(r' +\-+', ' ',
178 re.sub(r'^ *\-+', '', tune_parameters['ccargs']))))
179 if tune_baselib == 'lib':
180 dirnames.append('32') # /lib => 32bit lib
181 else:
182 dirnames.append(tune_baselib.replace('lib', ''))
183 osdirnames.append('../' + tune_baselib)
184
185 write_config(builddir, target_config_files, options, dirnames, osdirnames)
186 write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
187}
188
189gcc_multilib_setup[cleandirs] = "${B}/gcc/config"
190
191EXTRACONFFUNCS += "gcc_multilib_setup"
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
new file mode 100644
index 0000000000..11e53eae51
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -0,0 +1,185 @@
1require gcc-configure-common.inc
2
3CXXFLAGS := "${@oe_filter_out('-fvisibility-inlines-hidden', '${CXXFLAGS}', d)}"
4
5EXTRA_OECONF_PATHS = " \
6 --with-gxx-include-dir=${includedir}/c++/ \
7 --with-sysroot=${STAGING_DIR_TARGET} \
8 --with-build-sysroot=${STAGING_DIR_TARGET}"
9
10ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
11
12EXTRA_OECONF += "--disable-libunwind-exceptions \
13 ${@base_contains('DISTRO_FEATURES', 'ptest', 1, 0, d)}"
14EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
15
16RUNTIMETARGET = "libssp libstdc++-v3 libgomp"
17# ?
18# libiberty
19# libmudflap
20# libgfortran
21
22do_configure () {
23 export CXX="${CXX} -nostdinc++ -nostdlib++"
24 mtarget=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
25 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
26 cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/* ${B}
27 for d in libgcc ${RUNTIMETARGET}; do
28 echo "Configuring $d"
29 rm -rf ${B}/$target/$d/
30 mkdir -p ${B}/$target/$d/
31 cd ${B}/$target/$d/
32 chmod a+x ${S}/$d/configure
33 ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
34 done
35}
36
37do_compile () {
38 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
39 for d in libgcc ${RUNTIMETARGET}; do
40 cd ${B}/$target/$d/
41 oe_runmake MULTIBUILDTOP=${B}/$target/$d/
42 done
43}
44
45do_install () {
46 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
47 for d in ${RUNTIMETARGET}; do
48 cd ${B}/$target/$d/
49 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/$d/ install
50 done
51 rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir
52 rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir
53 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
54 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
55 fi
56 if [ -d ${D}${infodir} ]; then
57 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
58 fi
59 chown -R root:root ${D}
60}
61
62RDEPENDS_${PN}-ptest = "dejagnu make"
63
64do_configure_ptest() {
65 if [ "${PN}" = "${BPN}" ]; then
66 mkdir -p ${D}${PTEST_PATH}
67 cp ${S}/../run-ptest ${WORKDIR}
68 fi
69}
70
71do_compile_ptest() {
72 oe_runmake -C ${B}/${TARGET_SYS}/libstdc++-v3/testsuite buildtest-TESTS
73}
74
75do_install_ptest() {
76 oe_runmake -C ${B}/${TARGET_SYS}/libstdc++-v3 install-ptest DEST_DIR=${D}${PTEST_PATH} SOURCE_DIR=${S} BUILD_DIR=${B}/${TARGET_SYS} REPLACE_DIR=${PTEST_PATH}
77}
78
79INHIBIT_DEFAULT_DEPS = "1"
80DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc"
81PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
82
83BBCLASSEXTEND = "nativesdk"
84
85PACKAGES = "\
86 ${PN}-dbg \
87 libstdc++ \
88 libstdc++-precompile-dev \
89 libstdc++-dev \
90 libstdc++-staticdev \
91 libg2c \
92 libg2c-dev \
93 libssp \
94 libssp-dev \
95 libssp-staticdev \
96 libgfortran \
97 libgfortran-dev \
98 libgfortran-staticdev \
99 libmudflap \
100 libmudflap-dev \
101 libmudflap-staticdev \
102 libquadmath \
103 libquadmath-dev \
104 libquadmath-staticdev \
105 libgomp \
106 libgomp-dev \
107 libgomp-staticdev \
108 ${@base_contains('DISTRO_FEATURES', 'ptest', '${PN}-ptest', '', d)} \
109"
110# The base package doesn't exist, so we clear the recommends.
111RRECOMMENDS_${PN}-dbg = ""
112
113# include python debugging scripts
114FILES_${PN}-dbg += "\
115 ${libdir}/libstdc++.so.*-gdb.py \
116 ${datadir}/gcc-${BINV}/python/libstdcxx"
117
118FILES_libg2c = "${target_libdir}/libg2c.so.*"
119FILES_libg2c-dev = "\
120 ${libdir}/libg2c.so \
121 ${libdir}/libg2c.a \
122 ${libdir}/libfrtbegin.a"
123
124FILES_libstdc++ = "${libdir}/libstdc++.so.*"
125FILES_libstdc++-dev = "\
126 ${includedir}/c++/ \
127 ${libdir}/libstdc++.so \
128 ${libdir}/libstdc++.la \
129 ${libdir}/libsupc++.la"
130FILES_libstdc++-staticdev = "\
131 ${libdir}/libstdc++.a \
132 ${libdir}/libsupc++.a"
133
134FILES_libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
135
136FILES_libssp = "${libdir}/libssp.so.*"
137FILES_libssp-dev = " \
138 ${libdir}/libssp*.so \
139 ${libdir}/libssp*_nonshared.a \
140 ${libdir}/libssp*.la \
141 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ssp"
142FILES_libssp-staticdev = " \
143 ${libdir}/libssp*.a"
144
145FILES_libgfortran = "${libdir}/libgfortran.so.*"
146FILES_libgfortran-dev = " \
147 ${libdir}/libgfortran*.so \
148 ${libdir}/libgfortran.spec \
149 ${libdir}/libgfortran.la \
150 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
151 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single*"
152FILES_libgfortran-staticdev = " \
153 ${libdir}/libgfortran.a"
154
155INSANE_SKIP_${MLPREFIX}libgfortran-dev = "staticdev"
156
157FILES_libquadmath = "${libdir}/libquadmath*.so.*"
158FILES_libquadmath-dev = "\
159 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/quadmath* \
160 ${libdir}/libquadmath*.so \
161 ${libdir}/libquadmath.la"
162FILES_libquadmath-staticdev = "\
163 ${libdir}/libquadmath.a"
164
165FILES_libmudflap = "${libdir}/libmudflap*.so.*"
166FILES_libmudflap-dev = "\
167 ${libdir}/libmudflap*.so \
168 ${libdir}/libmudflap.la"
169FILES_libmudflap-staticdev = "\
170 ${libdir}/libmudflap.a"
171
172FILES_libgomp = "${libdir}/libgomp*${SOLIBS}"
173FILES_libgomp-dev = "\
174 ${libdir}/libgomp*${SOLIBSDEV} \
175 ${libdir}/libgomp*.la \
176 ${libdir}/libgomp.spec \
177 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/omp.h \
178 "
179FILES_libgomp-staticdev = "\
180 ${libdir}/libgomp*.a \
181 "
182
183do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
184do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
185do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.7.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.7.bb
new file mode 100644
index 0000000000..dd430b57eb
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-runtime_4.7.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-runtime.inc
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.8.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.8.bb
new file mode 100644
index 0000000000..497d691688
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-runtime_4.8.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-runtime.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-target.inc b/meta/recipes-devtools/gcc/gcc-target.inc
new file mode 100644
index 0000000000..e1179ac292
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-target.inc
@@ -0,0 +1,154 @@
1GCCMULTILIB = "--enable-multilib"
2require gcc-configure-common.inc
3
4EXTRA_OECONF_PATHS = " \
5 --with-sysroot=/ \
6 --with-build-sysroot=${STAGING_DIR_TARGET} \
7 --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
8 --with-gxx-include-dir=${includedir}/c++/"
9
10ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR} -I${B}/gcc/include/ "
11
12PACKAGES = "\
13 ${PN} ${PN}-plugins ${PN}-symlinks \
14 g++ g++-symlinks \
15 cpp cpp-symlinks \
16 g77 g77-symlinks \
17 gfortran gfortran-symlinks \
18 gcov gcov-symlinks \
19 ${PN}-plugin-dev \
20 ${PN}-doc \
21 ${PN}-dev \
22 ${PN}-dbg \
23"
24
25FILES_${PN} = "\
26 ${bindir}/${TARGET_PREFIX}gcc* \
27 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2 \
28 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc* \
29 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
30 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
31 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
32 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
33 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
34 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
35 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
36 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
37"
38INSANE_SKIP_${PN} += "dev-so"
39
40FILES_${PN}-dbg += "\
41 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/.debug/ \
42 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/.debug/ \
43"
44FILES_${PN}-dev = "\
45 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
46 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
47"
48FILES_${PN}-plugin-dev = "\
49 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
50 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
51 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
52"
53FILES_${PN}-symlinks = "\
54 ${bindir}/cc \
55 ${bindir}/gcc \
56 ${bindir}/gccbug \
57"
58
59FILES_${PN}-plugins = "\
60 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
61"
62ALLOW_EMPTY_${PN}-plugins = "1"
63
64FILES_g77 = "\
65 ${bindir}/${TARGET_PREFIX}g77 \
66 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
67"
68FILES_g77-symlinks = "\
69 ${bindir}/g77 \
70 ${bindir}/f77 \
71"
72FILES_gfortran = "\
73 ${bindir}/${TARGET_PREFIX}gfortran \
74 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
75"
76FILES_gfortran-symlinks = "\
77 ${bindir}/gfortran \
78 ${bindir}/f95"
79
80FILES_cpp = "\
81 ${bindir}/${TARGET_PREFIX}cpp \
82 ${base_libdir}/cpp \
83 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
84FILES_cpp-symlinks = "${bindir}/cpp"
85
86FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov"
87FILES_gcov-symlinks = "${bindir}/gcov"
88
89FILES_g++ = "\
90 ${bindir}/${TARGET_PREFIX}g++ \
91 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
92"
93FILES_g++-symlinks = "\
94 ${bindir}/c++ \
95 ${bindir}/g++ \
96"
97
98
99FILES_${PN}-doc = "\
100 ${infodir} \
101 ${mandir} \
102 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
103"
104
105do_install () {
106 oe_runmake 'DESTDIR=${D}' install-host
107
108 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
109 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
110 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
111 rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
112 rmdir ${D}${includedir}
113 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
114
115 # Hack around specs file assumptions
116 test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs
117
118 # Cleanup manpages..
119 rm -rf ${D}${mandir}/man7
120
121 cd ${D}${bindir}
122
123 # We care about g++ not c++
124 rm -f *c++
125
126 # We don't care about the gcc-<version> ones for this
127 rm -f *gcc-?.?*
128
129 # We use libiberty from binutils
130 find ${D}${libdir} -name libiberty.a | xargs rm -f
131 find ${D}${libdir} -name libiberty.h | xargs rm -f
132
133 # Not sure why we end up with these but we don't want them...
134 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
135
136 # Symlinks so we can use these trivially on the target
137 if [ -e ${TARGET_PREFIX}g77 ]; then
138 ln -sf ${TARGET_PREFIX}g77 g77 || true
139 ln -sf g77 f77 || true
140 fi
141 if [ -e ${TARGET_PREFIX}gfortran ]; then
142 ln -sf ${TARGET_PREFIX}gfortran gfortran || true
143 ln -sf gfortran f95 || true
144 fi
145 ln -sf ${TARGET_PREFIX}g++ g++
146 ln -sf ${TARGET_PREFIX}gcc gcc
147 ln -sf ${TARGET_PREFIX}cpp cpp
148 install -d ${D}${base_libdir}
149 ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
150 ln -sf g++ c++
151 ln -sf gcc cc
152
153 chown -R root:root ${D}
154}
diff --git a/meta/recipes-devtools/gcc/gcc_4.7.bb b/meta/recipes-devtools/gcc/gcc_4.7.bb
new file mode 100644
index 0000000000..0ae22e8fa3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc_4.7.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-target.inc
diff --git a/meta/recipes-devtools/gcc/gcc_4.8.bb b/meta/recipes-devtools/gcc/gcc_4.8.bb
new file mode 100644
index 0000000000..c4827c6443
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc_4.8.bb
@@ -0,0 +1,7 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-target.inc
3
4# Building with thumb enabled on armv4t fails with
5# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs
6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
7ARM_INSTRUCTION_SET_armv4 = "arm"
diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
new file mode 100644
index 0000000000..fe98238677
--- /dev/null
+++ b/meta/recipes-devtools/gcc/libgcc.inc
@@ -0,0 +1,143 @@
1INHIBIT_DEFAULT_DEPS = "1"
2
3DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
4
5PACKAGES = "\
6 ${PN} \
7 ${PN}-dev \
8 ${PN}-dbg \
9 libgcov-dev \
10 "
11
12FILES_${PN} = "${base_libdir}/libgcc*.so.*"
13FILES_${PN}-dev = " \
14 ${base_libdir}/libgcc*.so \
15 ${libdir}/${TARGET_SYS}/${BINV}/*crt* \
16 ${libdir}/${TARGET_SYS}/${BINV}/64 \
17 ${libdir}/${TARGET_SYS}/${BINV}/32 \
18 ${libdir}/${TARGET_SYS}/${BINV}/x32 \
19 ${libdir}/${TARGET_SYS}/${BINV}/n32 \
20 ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
21FILES_libgcov-dev = " \
22 ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \
23 "
24FILES_${PN}-dbg += "${base_libdir}/.debug/"
25
26do_configure () {
27 target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
28 install -d ${D}${base_libdir} ${D}${libdir}
29 cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$target/* ${B}
30 mkdir -p ${B}/${BPN}
31 cd ${B}/${BPN}
32 chmod a+x ${S}/${BPN}/configure
33 ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
34}
35
36do_compile () {
37 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
38 cd ${B}/${BPN}
39 oe_runmake MULTIBUILDTOP=${B}/$target/${BPN}/
40}
41
42do_install () {
43 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
44 cd ${B}/${BPN}
45 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/${BPN}/ install
46
47 # Move libgcc_s into /lib
48 mkdir -p ${D}${base_libdir}
49 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
50 mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
51 else
52 mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
53 fi
54
55 # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
56 # so that cross-gcc can find it in the sysroot
57
58 mv ${D}${libdir}/gcc/* ${D}${libdir}
59 rm -rf ${D}${libdir}/gcc/
60 # unwind.h is installed here which is shipped in gcc-cross
61 # as well as target gcc and they are identical so we dont
62 # ship one with libgcc here
63 rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
64}
65
66do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
67do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
68do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
69do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
70
71BBCLASSEXTEND = "nativesdk"
72
73INSANE_SKIP_${PN}-dev = "staticdev"
74INSANE_SKIP_${MLPREFIX}libgcov-dev = "staticdev"
75
76addtask multilib_install after do_install before do_package do_populate_sysroot
77# this makes multilib gcc files findable for target gcc
78# e.g.
79# /usr/lib/i586-pokymllib32-linux/4.7/
80# by creating this symlink to it
81# /usr/lib64/x86_64-poky-linux/4.7/32
82
83python do_multilib_install() {
84 import re
85
86 multilibs = d.getVar('MULTILIB_VARIANTS', True)
87 if not multilibs or bb.data.inherits_class('nativesdk', d):
88 return
89
90 binv = d.getVar('BINV', True)
91
92 mlprefix = d.getVar('MLPREFIX', True)
93 if ('%slibgcc' % mlprefix) != d.getVar('PN', True):
94 return
95
96 if mlprefix:
97 orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL', True)
98 orig_tune_params = get_tune_parameters(orig_tune, d)
99 orig_tune_baselib = orig_tune_params['baselib']
100 orig_tune_bitness = orig_tune_baselib.replace('lib', '')
101 if not orig_tune_bitness:
102 orig_tune_bitness = '32'
103
104 src = '../../../' + orig_tune_baselib + '/' + \
105 d.getVar('TARGET_SYS_MULTILIB_ORIGINAL', True) + '/' + binv + '/'
106
107 dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
108 d.getVar('TARGET_SYS', True) + '/' + binv + '/' + orig_tune_bitness
109
110 if os.path.lexists(dest):
111 os.unlink(dest)
112 os.symlink(src, dest)
113 return
114
115
116 for ml in multilibs.split():
117 tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, True)
118 if not tune:
119 bb.warn('DEFAULTTUNE_virtclass-multilib-%s is not defined. Skipping...' % ml)
120 continue
121
122 tune_parameters = get_tune_parameters(tune, d)
123 tune_baselib = tune_parameters['baselib']
124 if not tune_baselib:
125 bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
126 continue
127
128 tune_arch = tune_parameters['arch']
129 tune_bitness = tune_baselib.replace('lib', '')
130 if not tune_bitness:
131 tune_bitness = '32' # /lib => 32bit lib
132
133 src = '../../../' + tune_baselib + '/' + \
134 tune_arch + d.getVar('TARGET_VENDOR', True) + 'ml' + ml + \
135 '-' + d.getVar('TARGET_OS', True) + '/' + binv + '/'
136
137 dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
138 d.getVar('TARGET_SYS', True) + '/' + binv + '/' + tune_bitness
139
140 if os.path.lexists(dest):
141 os.unlink(dest)
142 os.symlink(src, dest)
143}
diff --git a/meta/recipes-devtools/gcc/libgcc_4.7.bb b/meta/recipes-devtools/gcc/libgcc_4.7.bb
new file mode 100644
index 0000000000..9716e2e5ba
--- /dev/null
+++ b/meta/recipes-devtools/gcc/libgcc_4.7.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc
3
diff --git a/meta/recipes-devtools/gcc/libgcc_4.8.bb b/meta/recipes-devtools/gcc/libgcc_4.8.bb
new file mode 100644
index 0000000000..a5152f28e9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/libgcc_4.8.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc